diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/vmxnet3/FEATURE.yaml | 1 | ||||
-rw-r--r-- | src/plugins/vmxnet3/input.c | 20 | ||||
-rw-r--r-- | src/plugins/vmxnet3/output.c | 18 | ||||
-rw-r--r-- | src/plugins/vmxnet3/vmxnet3.c | 3 |
4 files changed, 29 insertions, 13 deletions
diff --git a/src/plugins/vmxnet3/FEATURE.yaml b/src/plugins/vmxnet3/FEATURE.yaml index 1e303f6d6ee..d204659fb34 100644 --- a/src/plugins/vmxnet3/FEATURE.yaml +++ b/src/plugins/vmxnet3/FEATURE.yaml @@ -4,6 +4,7 @@ maintainer: Steven Luong <sluong@cisco.com> features: - vmxnet3 device driver to connect to ESXi server, VMWare Fusion, and VMWare Workstation + - Supports GSO. It was tested on ESXi 6.7 description: "vmxnet3 device driver support" state: production properties: [API, CLI, STATS, MULTITHREAD] diff --git a/src/plugins/vmxnet3/input.c b/src/plugins/vmxnet3/input.c index 173ab915b2b..f182409ac59 100644 --- a/src/plugins/vmxnet3/input.c +++ b/src/plugins/vmxnet3/input.c @@ -269,7 +269,6 @@ vmxnet3_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, b0->flags = 0; b0->error = 0; b0->current_config_index = 0; - ASSERT (b0->current_length != 0); if (PREDICT_FALSE ((rx_comp->index & VMXNET3_RXCI_EOP) && (rx_comp->len & VMXNET3_RXCL_ERROR))) @@ -317,12 +316,19 @@ vmxnet3_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, else if (rx_comp->index & VMXNET3_RXCI_EOP) { /* end of segment */ - if (prev_b0) + if (PREDICT_TRUE (prev_b0 != 0)) { - prev_b0->flags |= VLIB_BUFFER_NEXT_PRESENT; - prev_b0->next_buffer = bi0; - hb->total_length_not_including_first_buffer += - b0->current_length; + if (PREDICT_TRUE (b0->current_length != 0)) + { + prev_b0->flags |= VLIB_BUFFER_NEXT_PRESENT; + prev_b0->next_buffer = bi0; + hb->total_length_not_including_first_buffer += + b0->current_length; + } + else + { + vlib_buffer_free_one (vm, bi0); + } prev_b0 = 0; got_packet = 1; } @@ -387,7 +393,7 @@ vmxnet3_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, ethernet_header_t *e = (ethernet_header_t *) hb->data; next[0] = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT; - if (!ethernet_frame_is_tagged (e->type)) + if (!ethernet_frame_is_tagged (ntohs (e->type))) vmxnet3_handle_offload (rx_comp, hb, gso_size); } diff --git a/src/plugins/vmxnet3/output.c b/src/plugins/vmxnet3/output.c index 81a1afb190c..4c9b7093f73 100644 --- a/src/plugins/vmxnet3/output.c +++ b/src/plugins/vmxnet3/output.c @@ -20,6 +20,8 @@ #include <vlib/pci/pci.h> #include <vnet/ethernet/ethernet.h> #include <vnet/devices/devices.h> +#include <vnet/ip/ip6_packet.h> +#include <vnet/ip/ip4_packet.h> #include <vmxnet3/vmxnet3.h> @@ -128,6 +130,7 @@ VNET_DEVICE_CLASS_TX_FN (vmxnet3_device_class) (vlib_main_t * vm, { u16 space_needed = 1, i; u32 gso_size = 0; + u32 l4_hdr_sz; vlib_buffer_t *b; u32 hdr_len = 0; @@ -193,8 +196,13 @@ VNET_DEVICE_CLASS_TX_FN (vmxnet3_device_class) (vlib_main_t * vm, */ ASSERT (vd->gso_enable == 1); gso_size = vnet_buffer2 (b0)->gso_size; - hdr_len = vnet_buffer (b0)->l4_hdr_offset + - sizeof (ethernet_header_t); + l4_hdr_sz = vnet_buffer2 (b0)->gso_l4_hdr_sz; + if (b0->flags & VNET_BUFFER_F_IS_IP6) + hdr_len = sizeof (ethernet_header_t) + sizeof (ip6_header_t) + + l4_hdr_sz; + else + hdr_len = sizeof (ethernet_header_t) + sizeof (ip4_header_t) + + l4_hdr_sz; } generation = txq->tx_ring.gen; @@ -202,9 +210,9 @@ VNET_DEVICE_CLASS_TX_FN (vmxnet3_device_class) (vlib_main_t * vm, } if (PREDICT_FALSE (gso_size != 0)) { - txd->flags[1] = hdr_len; - txd->flags[1] |= VMXNET3_TXF_OM (VMXNET3_OM_TSO); - txd->flags[0] |= VMXNET3_TXF_MSSCOF (gso_size); + txq->tx_desc[first_idx].flags[1] = hdr_len; + txq->tx_desc[first_idx].flags[1] |= VMXNET3_TXF_OM (VMXNET3_OM_TSO); + txq->tx_desc[first_idx].flags[0] |= VMXNET3_TXF_MSSCOF (gso_size); } txd->flags[1] |= VMXNET3_TXF_CQ | VMXNET3_TXF_EOP; asm volatile ("":::"memory"); diff --git a/src/plugins/vmxnet3/vmxnet3.c b/src/plugins/vmxnet3/vmxnet3.c index 731a34a99e1..9209c3e2f90 100644 --- a/src/plugins/vmxnet3/vmxnet3.c +++ b/src/plugins/vmxnet3/vmxnet3.c @@ -809,7 +809,8 @@ vmxnet3_create_if (vlib_main_t * vm, vmxnet3_create_if_args_t * args) vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vd->hw_if_index); hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE; if (vd->gso_enable) - hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO; + hw->flags |= (VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO | + VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD); vnet_hw_interface_set_input_node (vnm, vd->hw_if_index, vmxnet3_input_node.index); |