sonic-swss
sonic-swss copied to clipboard
[subintf] Fix kernel mtu inheritance from parent
Why I did it
Sub port interface inherits mtu from parent port. This should hold for both kernel and SAI/ASIC.
At kernel side, decreasing parent port mtu, sub port interface mtu will decrease accordingly. However, this is not true in the reverse direction: Increasing parent port mtu, sub port interface mtu will not increase automatically. Treatment from user software, specifically, intfmgrd
, is therefore needed to fill the gap for mtu inheritance from parent port.
The SAI/ASIC side mtu of sub port interface is not affected by this PR.
What I did Have IntfMgr subscribe to CONFIG PORT and LAG table to listen to parent port mtu change, and set the corresponding mtu value to sub port interface in kernel.
Because the operation of parent port mtu change is issued from portmgrd
or teammgrd
, which is a separate process from intfmgrd
, sub port interface mtu increase may occur before its parent port mtu increase is processed by the corresponding process. In such a case, ip link
command will fail (as sub port interface mtu cannot be larger than that of its parent), and we leverage doTask
retry logic to ensure that the sub port interface mtu increase will succeed ultimately.
How I verified it vs test
Parent port mtu change: 9100 -> 8888 -> 6666 -> 7777 -> 9100. For every mtu change, check sub port interface mtu at both kernel and SAI/ASIC.
Details if related
Contains https://github.com/Azure/sonic-swss/pull/1873, which lays the common foundation.
vs test failure message without the fix in this PR. Failure on line 1229:
========================================================================= FAILURES ==========================================================================
__________________________________________________________ TestSubPortIntf.test_sub_port_intf_mtu ___________________________________________________________
self = <test_sub_port_intf.TestSubPortIntf object at 0x7f3d0f5c20b8>, dvs = <conftest.DockerVirtualSwitch object at 0x7f3d0f76ae80>
def test_sub_port_intf_mtu(self, dvs):
self.connect_dbs(dvs)
> self._test_sub_port_intf_mtu(dvs, self.SUB_PORT_INTERFACE_UNDER_TEST)
test_sub_port_intf.py:1268:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test_sub_port_intf.py:1229: in _test_sub_port_intf_mtu
self.check_sub_port_intf_mtu_kernel(dvs, sub_port_intf_name, mtu)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_sub_port_intf.TestSubPortIntf object at 0x7f3d0f5c20b8>, dvs = <conftest.DockerVirtualSwitch object at 0x7f3d0f76ae80>
port_name = 'Ethernet64.10', mtu = '7777'
def check_sub_port_intf_mtu_kernel(self, dvs, port_name, mtu):
(ec, out) = dvs.runcmd(['bash', '-c', "ip link show {} | grep 'mtu {}'".format(port_name, mtu)])
> assert ec == 0
E assert 1 == 0
E +1
E -0
test_sub_port_intf.py:328: AssertionError
================================================================== short test summary info ==================================================================
FAILED test_sub_port_intf.py::TestSubPortIntf::test_sub_port_intf_mtu - assert 1 == 0
=============================================================== 1 failed in 67.38s (0:01:07) ================================================================