diff options
author | Mohsin Kazmi <sykazmi@cisco.com> | 2020-06-10 12:35:05 +0200 |
---|---|---|
committer | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2020-06-16 01:35:05 +0000 |
commit | 0cf528233ab9272d7153f7323bacae2d50313b1a (patch) | |
tree | db9a463f939da54acc3f976cd2c2d536aa2e064d | |
parent | ff13e46215ab96df988310b4a20eddefad92de99 (diff) |
gso: fix the udp checksum in test
Type: fix
Change-Id: I7005e4763e73f3679c40f94bdab26d439cd23188
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
-rw-r--r-- | src/vnet/pg/input.c | 19 | ||||
-rw-r--r-- | src/vnet/pg/pg.api | 2 | ||||
-rw-r--r-- | test/test_gso.py | 4 |
3 files changed, 10 insertions, 15 deletions
diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c index 483add0b5f3..6968cce19e7 100644 --- a/src/vnet/pg/input.c +++ b/src/vnet/pg/input.c @@ -1537,7 +1537,6 @@ fill_buffer_offload_flags (vlib_main_t * vm, u32 * buffers, u32 n_buffers, { vlib_buffer_t *b0 = vlib_get_buffer (vm, buffers[i]); u8 l4_proto = 0; - u8 l4_hdr_sz = 0; ethernet_header_t *eh = (ethernet_header_t *) vlib_buffer_get_current (b0); @@ -1589,25 +1588,21 @@ fill_buffer_offload_flags (vlib_main_t * vm, u32 * buffers, u32 n_buffers, if (l4_proto == IP_PROTOCOL_TCP) { b0->flags |= VNET_BUFFER_F_OFFLOAD_TCP_CKSUM; - tcp_header_t *tcp = (tcp_header_t *) (vlib_buffer_get_current (b0) + - vnet_buffer - (b0)->l4_hdr_offset); - tcp->checksum = 0; - if (gso_enabled) + + /* only set GSO flag for chained buffers */ + if (gso_enabled && (b0->flags & VLIB_BUFFER_NEXT_PRESENT)) { b0->flags |= VNET_BUFFER_F_GSO; - l4_hdr_sz = tcp_header_bytes (tcp); - vnet_buffer2 (b0)->gso_l4_hdr_sz = l4_hdr_sz; + tcp_header_t *tcp = + (tcp_header_t *) (vlib_buffer_get_current (b0) + + vnet_buffer (b0)->l4_hdr_offset); + vnet_buffer2 (b0)->gso_l4_hdr_sz = tcp_header_bytes (tcp); vnet_buffer2 (b0)->gso_size = gso_size; } } else if (l4_proto == IP_PROTOCOL_UDP) { b0->flags |= VNET_BUFFER_F_OFFLOAD_UDP_CKSUM; - udp_header_t *udp = (udp_header_t *) (vlib_buffer_get_current (b0) + - vnet_buffer - (b0)->l4_hdr_offset); - udp->checksum = 0; } } } diff --git a/src/vnet/pg/pg.api b/src/vnet/pg/pg.api index ad44beeedfa..86343d5c8df 100644 --- a/src/vnet/pg/pg.api +++ b/src/vnet/pg/pg.api @@ -26,7 +26,7 @@ import "vnet/interface_types.api"; @param client_index - opaque cookie to identify the sender @param context - sender context, to match reply w/ request @param interface_id - interface index - @param enable_gso - enable gso on this interface + @param gso_enabled - enable gso on this interface @param gso_size - gso size on this interface */ define pg_create_interface diff --git a/test/test_gso.py b/test/test_gso.py index 7189104a859..ba830049e64 100644 --- a/test/test_gso.py +++ b/test/test_gso.py @@ -371,7 +371,7 @@ class TestGSO(VppTestCase): self.assertEqual(rx[IP].src, self.pg0.local_ip4) self.assertEqual(rx[IP].dst, self.pg0.remote_ip4) self.assert_ip_checksum_valid(rx) - self.assert_udp_checksum_valid(rx) + self.assert_udp_checksum_valid(rx, ignore_zero_checksum=False) self.assertEqual(rx[VXLAN].vni, 10) inner = rx[VXLAN].payload self.assertEqual(rx[IP].len - 20 - 8 - 8, len(inner)) @@ -402,7 +402,7 @@ class TestGSO(VppTestCase): self.assertEqual(rx[IP].src, self.pg0.local_ip4) self.assertEqual(rx[IP].dst, self.pg0.remote_ip4) self.assert_ip_checksum_valid(rx) - self.assert_udp_checksum_valid(rx) + self.assert_udp_checksum_valid(rx, ignore_zero_checksum=False) self.assertEqual(rx[VXLAN].vni, 10) inner = rx[VXLAN].payload self.assertEqual(rx[IP].len - 20 - 8 - 8, len(inner)) |