summaryrefslogtreecommitdiffstats
path: root/src/plugins/vmxnet3/output.c
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2020-09-15 09:48:38 -0700
committerDamjan Marion <dmarion@me.com>2020-09-16 16:54:20 +0000
commit007abe751f2ee86528d0ccc005a3da1c90850868 (patch)
tree2c95fa65ff7ae47f0d1f56905873a4df7a445f89 /src/plugins/vmxnet3/output.c
parentcc7c88e529eb3a2ca0934f27eb048c8ca3788f95 (diff)
vmxnet3: gso fixes
outbound: wrong header len computation gso size and header length need to be set in the first segment of the chain inbound: EOP may have zero length descriptor to terminate the chain missing endian conversion for ethertype Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Iaa003c0e9af3ead4df6c6c0d5772a179d2ff15c4
Diffstat (limited to 'src/plugins/vmxnet3/output.c')
-rw-r--r--src/plugins/vmxnet3/output.c18
1 files changed, 13 insertions, 5 deletions
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");