X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Finterface.h;h=744496cdd5df67c224c8daefb67db5939902b628;hb=f09d655101d2400df91d2a388168b925eea0dc01;hp=83abea4593e2d2db82fe34b22649e77fd3cfdf9c;hpb=f91098e49cd9ea65cfecabf3832cbb88316c4429;p=vpp.git diff --git a/src/vnet/interface.h b/src/vnet/interface.h index 83abea4593e..744496cdd5d 100644 --- a/src/vnet/interface.h +++ b/src/vnet/interface.h @@ -229,6 +229,7 @@ typedef struct _vnet_device_class /* Error strings indexed by error code for this node. */ char **tx_function_error_strings; + vl_counter_t *tx_function_error_counters; /* Number of error codes used by this node. */ u32 tx_function_n_errors; @@ -326,12 +327,11 @@ static __clib_unused vnet_device_class_t __clib_unused_##x extern vnet_device_class_t devclass; \ vlib_node_fn_registration_t *r; \ r = &CLIB_MARCH_SFX (devclass##_tx_fn_registration); \ - r->priority = CLIB_MARCH_FN_PRIORITY (); \ - r->name = CLIB_MARCH_VARIANT_STR; \ + r->march_variant = CLIB_MARCH_SFX (CLIB_MARCH_VARIANT_TYPE); \ r->next_registration = devclass.tx_fn_registrations; \ devclass.tx_fn_registrations = r; \ } \ - uword CLIB_CPU_OPTIMIZED CLIB_MARCH_SFX (devclass##_tx_fn) + uword CLIB_MARCH_SFX (devclass##_tx_fn) /** * Link Type: A description of the protocol of packets on the link. @@ -511,21 +511,64 @@ typedef enum vnet_hw_interface_flags_t_ VNET_HW_INTERFACE_FLAG_HALF_DUPLEX = (1 << 1), VNET_HW_INTERFACE_FLAG_FULL_DUPLEX = (1 << 2), - /* rx mode flags */ - VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE = (1 << 16), + /* non-broadcast multiple access */ + VNET_HW_INTERFACE_FLAG_NBMA = (1 << 19), +} vnet_hw_interface_flags_t; + +typedef enum vnet_hw_interface_capabilities_t_ +{ + VNET_HW_INTERFACE_CAP_NONE, /* tx checksum offload */ - VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD = (1 << 17), + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_CKSUM = (1 << 0), + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM = (1 << 1), + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM = (1 << 2), + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_OUTER_CKSUM = (1 << 3), + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_OUTER_CKSUM = (1 << 4), + + /* rx checksum offload */ + VNET_HW_INTERFACE_CAP_SUPPORTS_RX_IP4_CKSUM = (1 << 5), + VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_CKSUM = (1 << 6), + VNET_HW_INTERFACE_CAP_SUPPORTS_RX_TCP_CKSUM = (1 << 7), + VNET_HW_INTERFACE_CAP_SUPPORTS_RX_IP4_OUTER_CKSUM = (1 << 8), + VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_OUTER_CKSUM = (1 << 9), /* gso */ - VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO = (1 << 18), + VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO = (1 << 10), + VNET_HW_INTERFACE_CAP_SUPPORTS_UDP_GSO = (1 << 11), + VNET_HW_INTERFACE_CAP_SUPPORTS_VXLAN_TNL_GSO = (1 << 12), + VNET_HW_INTERFACE_CAP_SUPPORTS_IPIP_TNL_GSO = (1 << 13), + VNET_HW_INTERFACE_CAP_SUPPORTS_GENEVE_TNL_GSO = (1 << 14), + VNET_HW_INTERFACE_CAP_SUPPORTS_GRE_TNL_GSO = (1 << 15), + VNET_HW_INTERFACE_CAP_SUPPORTS_UDP_TNL_GSO = (1 << 16), + VNET_HW_INTERFACE_CAP_SUPPORTS_IP_TNL_GSO = (1 << 17), + + /* lro */ + VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_LRO = (1 << 18), + + /* rx mode */ + VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE = (1 << 30), + /* hw/driver can switch between l2-promisc and l3-dmac-filter modes */ + VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER = (1 << 31), +} vnet_hw_interface_capabilities_t; - /* non-broadcast multiple access */ - VNET_HW_INTERFACE_FLAG_NBMA = (1 << 19), +#define VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM \ + (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | \ + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM) - /* hw/driver can switch between l2-promisc and l3-dmac-filter modes */ - VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER = (1 << 20), -} vnet_hw_interface_flags_t; +#define VNET_HW_INTERFACE_CAP_SUPPORTS_TX_CKSUM \ + (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_CKSUM | \ + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | \ + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM) + +#define VNET_HW_INTERFACE_CAP_SUPPORTS_L4_RX_CKSUM \ + (VNET_HW_INTERFACE_CAP_SUPPORTS_RX_TCP_CKSUM | \ + VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_CKSUM) + +#define VNET_HW_INTERFACE_CAP_SUPPORTS_RX_CKSUM \ + (VNET_HW_INTERFACE_CAP_SUPPORTS_RX_IP4_CKSUM | \ + VNET_HW_INTERFACE_CAP_SUPPORTS_RX_TCP_CKSUM | \ + VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_CKSUM) #define VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT 1 #define VNET_HW_INTERFACE_FLAG_SPEED_SHIFT 3 @@ -561,15 +604,11 @@ typedef struct typedef struct vnet_hw_interface_t { CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); - /* Interface name. */ - u8 *name; - /* flags */ vnet_hw_interface_flags_t flags; - - /* link speed in kbps */ - u32 link_speed; + /* capabilities flags */ + vnet_hw_interface_capabilities_t caps; /* Hardware address as vector. Zero (e.g. zero-length vector) if no address for this class (e.g. PPP). */ @@ -579,6 +618,9 @@ typedef struct vnet_hw_interface_t /* NAME.{output,tx} nodes for this interface. */ u32 output_node_index, tx_node_index; + /* interface-output-arc-end node next index for tx node */ + u32 if_out_arc_end_node_next_index; + /* (dev_class, dev_instance) uniquely identifies hw interface. */ u32 dev_class_index; u32 dev_instance; @@ -593,6 +635,14 @@ typedef struct vnet_hw_interface_t /* Software index for this hardware interface. */ u32 sw_if_index; + CLIB_CACHE_LINE_ALIGN_MARK (cacheline1); + + /* Interface name. */ + u8 *name; + + /* link speed in kbps */ + u32 link_speed; + /* Next index in interface-output node for this interface used by node function vnet_per_buffer_interface_output() */ u32 output_node_next_index; @@ -650,6 +700,9 @@ typedef struct vnet_hw_interface_t u32 trace_classify_table_index; } vnet_hw_interface_t; +STATIC_ASSERT_OFFSET_OF (vnet_hw_interface_t, cacheline1, + CLIB_CACHE_LINE_BYTES); + typedef struct { u32 dev_instance; @@ -943,6 +996,10 @@ typedef struct /* feature_arc_index */ u8 output_feature_arc_index; + + /* fast lookup tables */ + u32 *hw_if_index_by_sw_if_index; + u16 *if_out_arc_end_next_index_by_sw_if_index; } vnet_interface_main_t; static inline void @@ -983,11 +1040,13 @@ typedef struct u8 free_data; u32 sw_if_index; int filter; + vlib_error_t drop_err; } vnet_pcap_dispatch_trace_args_t; int vnet_pcap_dispatch_trace_configure (vnet_pcap_dispatch_trace_args_t *); extern vlib_node_registration_t vnet_interface_output_node; +extern vlib_node_registration_t vnet_interface_output_arc_end_node; #endif /* included_vnet_interface_h */