From d723161e038d00e59766aa67a6a0dcc350227e4b Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Thu, 7 Jun 2018 10:17:57 +0200 Subject: MTU: Software interface / Per-protocol MTU support This patch separates setting of hardware interfaec and software interface MTU. Software MTU is L2 payload MTU (i.e. not including L2 header). Per-protocol MTU for IPv4, IPv6 and MPLS can also be set. Currently only IP4, IP6 are enabled in adjacency / rewrite code. Documentation in src/vnet/MTU.md Change-Id: Iee2fd6f0bbc8210748dd8e073ab9fab87d323690 Signed-off-by: Ole Troan --- test/test_mtu.py | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'test/test_mtu.py') diff --git a/test/test_mtu.py b/test/test_mtu.py index cef0ec0d8d5..1327c4bfd8e 100644 --- a/test/test_mtu.py +++ b/test/test_mtu.py @@ -76,23 +76,17 @@ class TestMTU(VppTestCase): rv = self.vapi.sw_interface_dump() for i in rv: if i.sw_if_index == sw_if_index: - return i.link_mtu + return i.mtu[0] return 0 def test_ip4_mtu(self): """ IP4 MTU test """ - # - # TODO: Link MTU is 216 bytes 'off'. Fix when L3 MTU patches committed - # - mtu_offset = 216 p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) p_ip4 = IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4, flags='DF') - # TODO: Re-enable when MTU fixes are committed current_mtu = self.get_mtu(self.pg1.sw_if_index) - current_mtu -= mtu_offset p_payload = UDP(sport=1234, dport=1234) / self.payload( current_mtu - 20 - 8) @@ -105,8 +99,8 @@ class TestMTU(VppTestCase): self.validate(p[1], p4_reply) # MTU - self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, 576 + mtu_offset) - self.assertEqual(576, self.get_mtu(self.pg1.sw_if_index) - mtu_offset) + self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [576, 0, 0, 0]) + self.assertEqual(576, self.get_mtu(self.pg1.sw_if_index)) # Should fail. Too large MTU p_icmp4 = ICMP(type='dest-unreach', code='fragmentation-needed', @@ -166,17 +160,12 @@ class TestMTU(VppTestCase): ''' # Reset MTU self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, - current_mtu + mtu_offset) + [current_mtu, 0, 0, 0]) def test_ip6_mtu(self): """ IP6 MTU test """ - # - # TODO: Link MTU is 216 bytes 'off'. Fix when L3 MTU patches committed - # - mtu_offset = 216 current_mtu = self.get_mtu(self.pg1.sw_if_index) - current_mtu -= mtu_offset p_ether = Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) p_ip6 = IPv6(src=self.pg0.remote_ip6, dst=self.pg1.remote_ip6) @@ -192,8 +181,8 @@ class TestMTU(VppTestCase): self.validate(p[1], p6_reply) # MTU (only checked on encap) - self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, 1280 + mtu_offset) - self.assertEqual(1280, self.get_mtu(self.pg1.sw_if_index) - mtu_offset) + self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [1280, 0, 0, 0]) + self.assertEqual(1280, self.get_mtu(self.pg1.sw_if_index)) # Should fail. Too large MTU p_icmp6 = ICMPv6PacketTooBig(mtu=1280, cksum=0x4c7a) @@ -211,7 +200,8 @@ class TestMTU(VppTestCase): self.validate_bytes(str(p[1]), icmp6_reply) # Reset MTU - self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, current_mtu) + self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, + [current_mtu, 0, 0, 0]) if __name__ == '__main__': -- cgit 1.2.3-korg