aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/InterfaceUtil.py
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2023-05-22 10:14:09 +0200
committerVratko Polak <vrpolak@cisco.com>2023-05-22 10:14:09 +0200
commit6e862ec7b63e177b9b0103612848b3377271729b (patch)
tree66cc7d86e049536acf5246c4159c9483df2ee1aa /resources/libraries/python/InterfaceUtil.py
parentec194ef8ecfa656b9b1d5056b49dd3877d1268e1 (diff)
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 <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/InterfaceUtil.py')
-rw-r--r--resources/libraries/python/InterfaceUtil.py24
1 files changed, 10 insertions, 14 deletions
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: