diff options
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/bonding/cli.c | 7 | ||||
-rw-r--r-- | src/vnet/devices/af_packet/af_packet.c | 13 | ||||
-rw-r--r-- | src/vnet/devices/tap/tap.c | 38 | ||||
-rw-r--r-- | src/vnet/devices/virtio/device.c | 4 | ||||
-rw-r--r-- | src/vnet/devices/virtio/pci.c | 17 | ||||
-rw-r--r-- | src/vnet/devices/virtio/vhost_user.c | 16 | ||||
-rw-r--r-- | src/vnet/ethernet/interface.c | 2 | ||||
-rw-r--r-- | src/vnet/gso/node.c | 14 | ||||
-rw-r--r-- | src/vnet/interface.h | 68 | ||||
-rw-r--r-- | src/vnet/interface_output.c | 2 | ||||
-rw-r--r-- | src/vnet/interface_output.h | 1 | ||||
-rw-r--r-- | src/vnet/pg/stream.c | 2 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_input.c | 2 |
13 files changed, 121 insertions, 65 deletions
diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c index 4ddee4a171b..a24d1104486 100644 --- a/src/vnet/bonding/cli.c +++ b/src/vnet/bonding/cli.c @@ -464,8 +464,9 @@ bond_create_if (vlib_main_t * vm, bond_create_if_args_t * args) */ if (args->gso) { - hw->flags |= (VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO | - VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD); + hw->caps |= (VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM); } if (vlib_get_thread_main ()->n_vlib_mains > 1) clib_spinlock_init (&bif->lockp); @@ -631,7 +632,7 @@ bond_add_member (vlib_main_t * vm, bond_add_member_args_t * args) clib_error_return (0, "bond interface cannot be added as member"); return; } - if (bif->gso && !(mif_hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO)) + if (bif->gso && !(mif_hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO)) { args->rv = VNET_API_ERROR_INVALID_INTERFACE; args->error = diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c index 2cc0cc70bca..60a3ccc081f 100644 --- a/src/vnet/devices/af_packet/af_packet.c +++ b/src/vnet/devices/af_packet/af_packet.c @@ -404,7 +404,7 @@ af_packet_create_if (vlib_main_t * vm, u8 * host_if_name, u8 * hw_addr_set, apif->queue_index = vnet_hw_if_register_rx_queue (vnm, apif->hw_if_index, 0, VNET_HW_IF_RXQ_THREAD_ANY); - hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE; + hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE; vnet_hw_interface_set_flags (vnm, apif->hw_if_index, VNET_HW_INTERFACE_FLAG_LINK_UP); @@ -515,10 +515,15 @@ af_packet_set_l4_cksum_offload (vlib_main_t * vm, u32 sw_if_index, u8 set) return VNET_API_ERROR_INVALID_INTERFACE; if (set) - hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD; + { + hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM); + } else - hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD; - + { + hw->caps |= (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM); + } return 0; } diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c index 7e7d3d5e8c0..5b15f92051d 100644 --- a/src/vnet/devices/tap/tap.c +++ b/src/vnet/devices/tap/tap.c @@ -724,15 +724,17 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) args->sw_if_index = vif->sw_if_index; args->rv = 0; hw = vnet_get_hw_interface (vnm, vif->hw_if_index); - hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE; + hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE; if (args->tap_flags & TAP_FLAG_GSO) { - hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO | - VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD; + hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM; } else if (args->tap_flags & TAP_FLAG_CSUM_OFFLOAD) { - hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD; + hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM; } if ((args->tap_flags & TAP_FLAG_GSO) && (args->tap_flags & TAP_FLAG_GRO_COALESCE)) @@ -834,26 +836,18 @@ tap_csum_offload_enable_disable (vlib_main_t * vm, u32 sw_if_index, vif->packet_coalesce = 0; vif->csum_offload_enabled = enable_disable ? 1 : 0; - if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) != 0) + if ((hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) != 0) { - hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO; + hw->caps &= ~VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO; } if (enable_disable) { - if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD) == - 0) - { - hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD; - } + hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM; } else { - if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD) != - 0) - { - hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD; - } + hw->caps &= ~VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM; } error: @@ -893,10 +887,10 @@ tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index, int enable_disable, vif->csum_offload_enabled = 0; if (enable_disable) { - if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) == 0) + if ((hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) == 0) { - hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO | - VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD; + hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO | + VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM; } if (is_packet_coalesce) { @@ -905,10 +899,10 @@ tap_gso_enable_disable (vlib_main_t * vm, u32 sw_if_index, int enable_disable, } else { - if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) != 0) + if ((hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) != 0) { - hw->flags &= ~(VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO | - VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD); + hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO | + VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM); } vif->packet_coalesce = 0; } diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c index fb996d551fa..e71e16caecc 100644 --- a/src/vnet/devices/virtio/device.c +++ b/src/vnet/devices/virtio/device.c @@ -965,12 +965,12 @@ virtio_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node, vnet_main_t *vnm = vnet_get_main (); vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vif->hw_if_index); - if (hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) + if (hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) return virtio_interface_tx_gso_inline (vm, node, vif, type, vring, buffers, n_left, packed, 1 /* do_gso */ , 1 /* checksum offload */ ); - else if (hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD) + else if (hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM) return virtio_interface_tx_gso_inline (vm, node, vif, type, vring, buffers, n_left, packed, 0 /* no do_gso */ , diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c index 79bd0047570..7ef4b2a52dd 100644 --- a/src/vnet/devices/virtio/pci.c +++ b/src/vnet/devices/virtio/pci.c @@ -525,8 +525,9 @@ virtio_pci_offloads (vlib_main_t * vm, virtio_if_t * vif, int gso_enabled, { vif->gso_enabled = 1; vif->csum_offload_enabled = 0; - hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO | - VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD; + hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM; } } else if (csum_offload_enabled @@ -540,9 +541,9 @@ virtio_pci_offloads (vlib_main_t * vm, virtio_if_t * vif, int gso_enabled, { vif->csum_offload_enabled = 1; vif->gso_enabled = 0; - hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO; - hw->flags |= - VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD; + hw->caps &= ~VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO; + hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM; } } else @@ -555,8 +556,8 @@ virtio_pci_offloads (vlib_main_t * vm, virtio_if_t * vif, int gso_enabled, { vif->csum_offload_enabled = 0; vif->gso_enabled = 0; - hw->flags &= ~(VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO | - VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD); + hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM | + VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO); } } } @@ -1500,7 +1501,7 @@ virtio_pci_create_if (vlib_main_t * vm, virtio_pci_create_if_args_t * args) args->sw_if_index = sw->sw_if_index; vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vif->hw_if_index); - hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE; + hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE; if (args->virtio_flags & VIRTIO_FLAG_BUFFERING) { diff --git a/src/vnet/devices/virtio/vhost_user.c b/src/vnet/devices/virtio/vhost_user.c index 426f03c6ab1..5f04db09395 100644 --- a/src/vnet/devices/virtio/vhost_user.c +++ b/src/vnet/devices/virtio/vhost_user.c @@ -515,12 +515,16 @@ vhost_user_socket_read (clib_file_t * uf) if (vui->enable_gso && ((vui->features & FEATURE_VIRTIO_NET_F_HOST_GUEST_TSO_FEATURE_BITS) == FEATURE_VIRTIO_NET_F_HOST_GUEST_TSO_FEATURE_BITS)) - hw->flags |= - (VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO | - VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD); + { + hw->caps |= (VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM | + VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM); + } else - hw->flags &= ~(VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO | - VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD); + { + hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO | + VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM); + } vnet_hw_interface_set_flags (vnm, vui->hw_if_index, 0); vui->is_ready = 0; vhost_user_update_iface_state (vui); @@ -1619,7 +1623,7 @@ vhost_user_vui_init (vnet_main_t * vnm, vhost_user_intf_t * vui, for (q = 0; q < vec_len (vui->vrings); q++) vhost_user_vring_init (vui, q); - hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE; + hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE; vnet_hw_interface_set_flags (vnm, vui->hw_if_index, 0); if (sw_if_index) diff --git a/src/vnet/ethernet/interface.c b/src/vnet/ethernet/interface.c index b5c48193bf3..f72b4930049 100644 --- a/src/vnet/ethernet/interface.c +++ b/src/vnet/ethernet/interface.c @@ -459,7 +459,7 @@ ethernet_set_flags (vnet_main_t * vnm, u32 hw_if_index, u32 flags) switch (opn_flags) { case ETHERNET_INTERFACE_FLAG_DEFAULT_L3: - if (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER) + if (hi->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER) { if (ei->flag_change (vnm, hi, opn_flags) != ~0) { diff --git a/src/vnet/gso/node.c b/src/vnet/gso/node.c index ecbdc188ec8..5814aad4b0d 100644 --- a/src/vnet/gso/node.c +++ b/src/vnet/gso/node.c @@ -523,28 +523,30 @@ vnet_gso_node_inline (vlib_main_t * vm, if (PREDICT_FALSE (hi->sw_if_index != swif0)) { hi0 = vnet_get_sup_hw_interface (vnm, swif0); - if ((hi0->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) == 0 && + if ((hi0->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) == + 0 && (b[0]->flags & VNET_BUFFER_F_GSO)) break; } if (PREDICT_FALSE (hi->sw_if_index != swif1)) { hi1 = vnet_get_sup_hw_interface (vnm, swif1); - if (!(hi1->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) && + if (!(hi1->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) && (b[1]->flags & VNET_BUFFER_F_GSO)) break; } if (PREDICT_FALSE (hi->sw_if_index != swif2)) { hi2 = vnet_get_sup_hw_interface (vnm, swif2); - if ((hi2->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) == 0 && + if ((hi2->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) == + 0 && (b[2]->flags & VNET_BUFFER_F_GSO)) break; } if (PREDICT_FALSE (hi->sw_if_index != swif3)) { hi3 = vnet_get_sup_hw_interface (vnm, swif3); - if (!(hi3->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) && + if (!(hi3->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) && (b[3]->flags & VNET_BUFFER_F_GSO)) break; } @@ -615,7 +617,7 @@ vnet_gso_node_inline (vlib_main_t * vm, if (PREDICT_FALSE (hi->sw_if_index != swif0)) { hi0 = vnet_get_sup_hw_interface (vnm, swif0); - if ((hi0->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) == 0 && + if ((hi0->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) == 0 && (b[0]->flags & VNET_BUFFER_F_GSO)) do_segmentation0 = 1; } @@ -774,7 +776,7 @@ vnet_gso_inline (vlib_main_t * vm, hi = vnet_get_sup_hw_interface (vnm, vnet_buffer (b)->sw_if_index[VLIB_TX]); - if (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) + if (hi->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) return vnet_gso_node_inline (vm, node, frame, vnm, hi, is_l2, is_ip4, is_ip6, /* do_segmentation */ 0); diff --git a/src/vnet/interface.h b/src/vnet/interface.h index 9c5844257d8..8424b71c545 100644 --- a/src/vnet/interface.h +++ b/src/vnet/interface.h @@ -510,21 +510,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 @@ -566,6 +609,8 @@ typedef struct vnet_hw_interface_t /* flags */ vnet_hw_interface_flags_t flags; + /* capabilities flags */ + vnet_hw_interface_capabilities_t caps; /* link speed in kbps */ u32 link_speed; @@ -592,6 +637,8 @@ typedef struct vnet_hw_interface_t /* Software index for this hardware interface. */ u32 sw_if_index; + CLIB_CACHE_LINE_ALIGN_MARK (cacheline1); + /* Next index in interface-output node for this interface used by node function vnet_per_buffer_interface_output() */ u32 output_node_next_index; @@ -649,6 +696,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; diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c index d2447658983..c46868e0254 100644 --- a/src/vnet/interface_output.c +++ b/src/vnet/interface_output.c @@ -491,7 +491,7 @@ VLIB_NODE_FN (vnet_interface_output_node) vnet_interface_pcap_tx_trace (vm, node, frame, 0 /* sw_if_index_from_buffer */ ); - if (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD) + if (hi->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TX_CKSUM) return vnet_interface_output_node_inline (vm, node, frame, vnm, hi, /* do_tx_offloads */ 0); else diff --git a/src/vnet/interface_output.h b/src/vnet/interface_output.h index 27aadc6c5fd..6b766d36c4f 100644 --- a/src/vnet/interface_output.h +++ b/src/vnet/interface_output.h @@ -41,7 +41,6 @@ #define __INTERFACE_INLINES_H__ #include <vnet/vnet.h> -#include <vnet/gso/hdr_offset_parser.h> static_always_inline void vnet_calc_ip4_checksums (vlib_main_t *vm, vlib_buffer_t *b, ip4_header_t *ip4, diff --git a/src/vnet/pg/stream.c b/src/vnet/pg/stream.c index 6ea80903de0..0ce640bf13f 100644 --- a/src/vnet/pg/stream.c +++ b/src/vnet/pg/stream.c @@ -267,7 +267,7 @@ pg_interface_add_or_get (pg_main_t * pg, uword if_id, u8 gso_enabled, hi = vnet_get_hw_interface (vnm, pi->hw_if_index); if (gso_enabled) { - hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO; + hi->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO; pi->gso_enabled = 1; pi->gso_size = gso_size; if (coalesce_enabled) diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c index f5d17eabc36..509732fa876 100644 --- a/src/vnet/tcp/tcp_input.c +++ b/src/vnet/tcp/tcp_input.c @@ -1776,7 +1776,7 @@ tcp_check_tx_offload (tcp_connection_t * tc, int is_ipv4) return; hw_if = vnet_get_sup_hw_interface (vnm, sw_if_idx); - if (hw_if->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) + if (hw_if->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) tc->cfg_flags |= TCP_CFG_F_TSO; } |