From 6e862ec7b63e177b9b0103612848b3377271729b Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Mon, 22 May 2023 10:14:09 +0200 Subject: feat(interface): apply MTU for dpdk plugin ifaces When changing MTU on a running VPP, the interface has to be down. - Other plugins (rdma, avf, af_xdp) need vastly different logic, so support for them will be added later. + Mlx5-core does not need to set MTU on Linux interface. + MTU setting now does not happen at final setting path up, it happens in driver initialization layer instead E.g. AVF tests will not attempt to change MTU. + MTU edit removed from some non-hardware interfaces (including memif) e.g. bond interfaces. MTU on parent hw interface seems to be enough. + The non-jumbo MTU value used is 1800, so 1518B tests with additional encapsulation can still work. + When VPP MTU setting fails, the failure is now propagated. Previously, the failure was just logged and ignored, but now there is no reason to hide it. Ticket: CSIT-1797 Change-Id: I3b853f1faf90001d544cbbb87b2affbb882ffba0 Signed-off-by: Vratko Polak --- resources/libraries/python/InterfaceUtil.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'resources/libraries/python') diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 24a65e86a9..7e645d1f5f 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -347,32 +347,28 @@ class InterfaceUtil: exec_cmd_no_error(node, cmd, sudo=True) @staticmethod - def vpp_set_interface_mtu(node, interface, mtu=9200): - """Set Ethernet MTU on interface. + def vpp_set_interface_mtu(node, interface, mtu): + """Apply new MTU value to a VPP hardware interface. + + The interface should be down when this is called. :param node: VPP node. - :param interface: Interface to setup MTU. Default: 9200. + :param interface: Interface to set MTU on. :param mtu: Ethernet MTU size in Bytes. :type node: dict :type interface: str or int :type mtu: int + :raises AsserionError: If VPP refused to change the MTU or set if state. """ if isinstance(interface, str): sw_if_index = Topology.get_interface_sw_index(node, interface) else: sw_if_index = interface - cmd = u"hw_interface_set_mtu" err_msg = f"Failed to set interface MTU on host {node[u'host']}" - args = dict( - sw_if_index=sw_if_index, - mtu=int(mtu) - ) - try: - with PapiSocketExecutor(node) as papi_exec: - papi_exec.add(cmd, **args).get_reply(err_msg) - except AssertionError as err: - logger.debug(f"Setting MTU failed.\n{err}") + args = dict(sw_if_index=sw_if_index, mtu=int(mtu)) + with PapiSocketExecutor(node) as papi_exec: + papi_exec.add(cmd, **args).get_reply(err_msg) @staticmethod def vpp_node_interfaces_ready_wait(node, retries=15): @@ -1994,7 +1990,7 @@ class InterfaceUtil: thread_data = VPPUtil.vpp_show_threads(node) worker_cnt = len(thread_data) - 1 if not worker_cnt: - return None + return worker_ids = list() if workers: for item in thread_data: -- cgit 1.2.3-korg