From 5a5c036c023ab88b9630f67055db19a1a1c6cf34 Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Thu, 16 May 2019 09:25:46 -0700 Subject: vmxnet3: gso_l4_hdr_sz is not set correctly vnet_buffer2 -> gso_l4_hdr_sz is not set correctly because vnet_buffer->l4_hdr_offset is not set yet at the top. Move the code to set vnet_buffer->gso_l4_hdr_sz further down. Change-Id: I0110e4687572bb93cb593d7d4d14a3d5083af13a Signed-off-by: Steven Luong --- src/plugins/vmxnet3/input.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'src/plugins/vmxnet3') diff --git a/src/plugins/vmxnet3/input.c b/src/plugins/vmxnet3/input.c index 87aa29cb49a..7928bc35fd9 100644 --- a/src/plugins/vmxnet3/input.c +++ b/src/plugins/vmxnet3/input.c @@ -80,22 +80,6 @@ vmxnet3_handle_offload (vmxnet3_rx_comp * rx_comp, vlib_buffer_t * hb, { u8 l4_hdr_sz = 0; - if (gso_size) - { - if (rx_comp->flags & VMXNET3_RXCF_TCP) - { - tcp_header_t *tcp = - (tcp_header_t *) (hb->data + vnet_buffer (hb)->l4_hdr_offset); - l4_hdr_sz = tcp_header_bytes (tcp); - } - else if (rx_comp->flags & VMXNET3_RXCF_UDP) - { - udp_header_t *udp = - (udp_header_t *) (hb->data + vnet_buffer (hb)->l4_hdr_offset); - l4_hdr_sz = sizeof (*udp); - } - } - if (rx_comp->flags & VMXNET3_RXCF_IP4) { ip4_header_t *ip4 = (ip4_header_t *) (hb->data + @@ -141,6 +125,18 @@ vmxnet3_handle_offload (vmxnet3_rx_comp * rx_comp, vlib_buffer_t * hb, if (gso_size) { + if (rx_comp->flags & VMXNET3_RXCF_TCP) + { + tcp_header_t *tcp = + (tcp_header_t *) (hb->data + vnet_buffer (hb)->l4_hdr_offset); + l4_hdr_sz = tcp_header_bytes (tcp); + } + else if (rx_comp->flags & VMXNET3_RXCF_UDP) + { + udp_header_t *udp = + (udp_header_t *) (hb->data + vnet_buffer (hb)->l4_hdr_offset); + l4_hdr_sz = sizeof (*udp); + } vnet_buffer2 (hb)->gso_size = gso_size; vnet_buffer2 (hb)->gso_l4_hdr_sz = l4_hdr_sz; hb->flags |= VNET_BUFFER_F_GSO; @@ -184,6 +180,18 @@ vmxnet3_handle_offload (vmxnet3_rx_comp * rx_comp, vlib_buffer_t * hb, if (gso_size) { + if (rx_comp->flags & VMXNET3_RXCF_TCP) + { + tcp_header_t *tcp = + (tcp_header_t *) (hb->data + vnet_buffer (hb)->l4_hdr_offset); + l4_hdr_sz = tcp_header_bytes (tcp); + } + else if (rx_comp->flags & VMXNET3_RXCF_UDP) + { + udp_header_t *udp = + (udp_header_t *) (hb->data + vnet_buffer (hb)->l4_hdr_offset); + l4_hdr_sz = sizeof (*udp); + } vnet_buffer2 (hb)->gso_size = gso_size; vnet_buffer2 (hb)->gso_l4_hdr_sz = l4_hdr_sz; hb->flags |= VNET_BUFFER_F_GSO; -- cgit 1.2.3-korg