X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_gso.py;h=06ae7dd2f48192319d5772ed41df9f71f1644916;hb=61717cc38;hp=b7d3b98b2e9a26eb2edbcf7cf03533136e03422a;hpb=c343a17df5bba800ecd7cca92acdd2bd1f984ebf;p=vpp.git diff --git a/test/test_gso.py b/test/test_gso.py index b7d3b98b2e9..06ae7dd2f48 100644 --- a/test/test_gso.py +++ b/test/test_gso.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """GSO functional tests""" # @@ -73,7 +73,7 @@ class TestGSO(VppTestCase): IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4, flags='DF') / TCP(sport=1234, dport=1234) / - Raw('\xa5' * 65200)) + Raw(b'\xa5' * 65200)) rxs = self.send_and_expect(self.pg0, [p4], self.pg0) @@ -102,7 +102,7 @@ class TestGSO(VppTestCase): IP(src=self.pg2.remote_ip4, dst=self.pg3.remote_ip4, flags='DF') / TCP(sport=1234, dport=1234) / - Raw('\xa5' * 65200)) + Raw(b'\xa5' * 65200)) rxs = self.send_and_expect(self.pg2, [p41], self.pg3) @@ -129,11 +129,12 @@ class TestGSO(VppTestCase): i.resolve_arp() i.resolve_ndp() + self.vapi.feature_gso_enable_disable(self.pg4.sw_if_index) p42 = (Ether(src=self.pg2.remote_mac, dst=self.pg2.local_mac) / IP(src=self.pg2.remote_ip4, dst=self.pg4.remote_ip4, flags='DF') / TCP(sport=1234, dport=1234) / - Raw('\xa5' * 65200)) + Raw(b'\xa5' * 65200)) rxs = self.send_and_expect(self.pg2, [p42], self.pg4, 45) size = 0 @@ -157,7 +158,7 @@ class TestGSO(VppTestCase): p43 = (Ether(src=self.pg2.remote_mac, dst=self.pg2.local_mac) / IP(src=self.pg2.remote_ip4, dst=self.pg1.remote_ip4) / TCP(sport=1234, dport=1234) / - Raw('\xa5' * 65200)) + Raw(b'\xa5' * 65200)) rxs = self.send_and_expect(self.pg2, [p43], self.pg1, 119) size = 0 @@ -170,5 +171,38 @@ class TestGSO(VppTestCase): size -= 20 # TCP header self.assertEqual(size, 65200) + # + # Send jumbo frame with gso enabled only on input interface with 9K MTU + # and DF bit is unset. GSO packet will be fragmented. GSO size will be + # 8960. + # + self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [9000, 0, 0, 0]) + self.create_pg_interfaces(range(5, 6), 1, 8960) + for i in self.pg_interfaces: + i.admin_up() + i.config_ip4() + i.config_ip6() + i.disable_ipv6_ra() + i.resolve_arp() + i.resolve_ndp() + + self.vapi.sw_interface_set_mtu(self.pg5.sw_if_index, [9000, 0, 0, 0]) + self.vapi.feature_gso_enable_disable(self.pg1.sw_if_index) + p44 = (Ether(src=self.pg5.remote_mac, dst=self.pg5.local_mac) / + IP(src=self.pg5.remote_ip4, dst=self.pg1.remote_ip4) / + TCP(sport=1234, dport=1234) / + Raw(b'\xa5' * 65200)) + + self.pg1.enable_capture() + rxs = self.send_and_expect(self.pg5, [p44], self.pg1, 33) + size = 0 + for rx in rxs: + self.assertEqual(rx[Ether].src, self.pg1.local_mac) + self.assertEqual(rx[Ether].dst, self.pg1.remote_mac) + self.assertEqual(rx[IP].src, self.pg5.remote_ip4) + self.assertEqual(rx[IP].dst, self.pg1.remote_ip4) + size = rxs[32][TCP].seq + rxs[32][IP].len - 20 - 20 + self.assertEqual(size, 65200) + if __name__ == '__main__': unittest.main(testRunner=VppTestRunner)