feat(interface): apply MTU for dpdk plugin ifaces 24/37824/43
authorVratko Polak <vrpolak@cisco.com>
Mon, 22 May 2023 08:14:09 +0000 (10:14 +0200)
committerVratko Polak <vrpolak@cisco.com>
Mon, 22 May 2023 08:14:09 +0000 (10:14 +0200)
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>
resources/libraries/python/InterfaceUtil.py
resources/libraries/robot/l2/l2_bridge_domain.robot
resources/libraries/robot/l2/l2_xconnect.robot
resources/libraries/robot/overlay/srv6.robot
resources/libraries/robot/performance/performance_vars.robot
resources/libraries/robot/shared/interfaces.robot

index 24a65e8..7e645d1 100644 (file)
@@ -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:
index dbf26d3..00044e1 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright (c) 2022 Cisco and/or its affiliates.
-# Copyright (c) 2022 PANTHEON.tech and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2023 PANTHEON.tech and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
 | | Set interfaces in path up
 | | ${dut1_eth_bond_if1}= | VPP Create Bond Interface
 | | ... | ${dut1} | ${bond_mode} | ${lb_mode}
-| | Set Interface State | ${dut1} | ${dut1_eth_bond_if1} | up
-| | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1}
 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
 | | | ${_even}= | Evaluate | ${pf} % 2
 | | | Run Keyword If | not ${even}
 | | END
 | | ${dut2_eth_bond_if1}= | VPP Create Bond Interface
 | | ... | ${dut2} | ${bond_mode} | ${lb_mode}
-| | Set Interface State | ${dut2} | ${dut2_eth_bond_if1} | up
-| | VPP Set interface MTU | ${dut2} | ${dut2_eth_bond_if1}
 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
 | | | ${_even}= | Evaluate | ${pf} % 2
 | | | Run Keyword If | ${even}
index 1d4d40d..b782602 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2022 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
 | | Set interfaces in path up
 | | ${dut1_eth_bond_if1}= | VPP Create Bond Interface
 | | ... | ${dut1} | ${bond_mode} | ${lb_mode}
-| | Set Interface State | ${dut1} | ${dut1_eth_bond_if1} | up
-| | VPP Set interface MTU | ${dut1} | ${dut1_eth_bond_if1}
 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
 | | | ${_even}= | Evaluate | ${pf} % 2
 | | | Run Keyword If | not ${even}
 | | END
 | | ${dut2_eth_bond_if1}= | VPP Create Bond Interface
 | | ... | ${dut2} | ${bond_mode} | ${lb_mode}
-| | Set Interface State | ${dut2} | ${dut2_eth_bond_if1} | up
-| | VPP Set interface MTU | ${dut2} | ${dut2_eth_bond_if1}
 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
 | | | ${_even}= | Evaluate | ${pf} % 2
 | | | Run Keyword If | ${even}
index 6ce7f74..83ec894 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2022 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
 | | Set up memif interfaces on DUT node | ${dut1} | ${sock1} | ${sock1}
 | | ... | ${1} | dut1-memif-1-if1 | dut1-memif-1-if2 | ${rxq_count_int}
 | | ... | ${rxq_count_int}
-| | VPP Set interface MTU | ${dut1} | ${dut1-memif-1-if1}
-| | VPP Set interface MTU | ${dut1} | ${dut1-memif-1-if2}
 | | Run Keyword If | ${dut2_status}
 | | ... | Set up memif interfaces on DUT node | ${dut2} | ${sock2} | ${sock2}
 | | ... | ${1} | dut2-memif-1-if1 | dut2-memif-1-if2 | ${rxq_count_int}
 | | ... | ${rxq_count_int}
-| | Run Keyword If | ${dut2_status}
-| | ... | VPP Set interface MTU | ${dut2} | ${dut2-memif-1-if1}
-| | Run Keyword If | ${dut2_status}
-| | ... | VPP Set interface MTU | ${dut2} | ${dut2-memif-1-if2}
 | | FOR | ${dut} | IN | @{duts}
 | | | Show Memif | ${nodes['${dut}']}
 | | END
index 0721634..a0fa277 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2022 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at:
 | | ... | *Test variables set:*
 | | ... | - jumbo - Jumbo boolean, true if jumbo packet support has to be
 | | ... | enabled. Type: boolean
+| | ... | - recommended_mtu - Resonable value (with space for encap overhead)
+| | ... | according to jumbo. Type: int
 | |
 | | ... | *Example:*
 | |
 | | Set Numeric Frame Sizes
 | | ${jumbo} = | Evaluate | ${max_frame_size} >= 1522
 | | Set Test Variable | \${jumbo}
+| | ${recommended_mtu} = | Set Variable If | ${jumbo} | ${9200} | ${1800}
+| | Set Test Variable | \${recommended_mtu}
 
 | Set Max Rate And Jumbo
 | | [Documentation]
-| | ... | This keyword computes maximal unidirectional transmit rate
-| | ... | and jumbo boolean (some suites need that for configuration decisions).
+| | ... | This keyword computes maximal unidirectional transmit rate,
+| | ... | jumbo boolean (some suites need that for configuration decisions),
+| | ... | and recommended MTU value (depends on jumbo).
 | | ... | To streamline suite autogeneration, both input and output values
 | | ... | are communicated as test (or broader scope) variables,
 | | ... | instead of explicit arguments and return values.
 | | ... | Type: float
 | | ... | - jumbo - Jumbo boolean, true if jumbo packet support has to be
 | | ... | enabled. Type: boolean
+| | ... | - recommended_mtu - Resonable value (with space for encap overhead)
+| | ... | according to jumbo. Type: int
 | | ... | - max_frame_size - Maximal frame size including overhead. Type: float
 | | ... | - avg_directional_frame_size - Average frame size including overhead
 | | ... | for the more loaded direction. Type: float
index 6279dd0..a905373 100644 (file)
@@ -22,7 +22,7 @@
 | Set single interfaces in path up
 | | [Documentation]
 | | ... | *Set UP state on single physical VPP interfaces in path on all DUT
-| | ... | nodes and set maximal MTU.*
+| | ... | nodes.*
 | |
 | | ... | *Arguments:*
 | | ... | - pf - NIC physical function (physical port).
@@ -41,8 +41,7 @@
 
 | Set interfaces in path up
 | | [Documentation]
-| | ... | *Set UP state on VPP interfaces in path on all DUT nodes and set
-| | ... | maximal MTU.*
+| | ... | *Set UP state on VPP interfaces in path on all DUT nodes.*
 | |
 | | ... | *Arguments:*
 | | ... | - validate - Validate interfaces are up.
@@ -58,8 +57,7 @@
 
 | Set interfaces in path up on node
 | | [Documentation]
-| | ... | *Set UP state on VPP interfaces in path on specified DUT node and
-| | ... | set maximal MTU.*
+| | ... | *Set UP state on VPP interfaces in path on specified DUT node.*
 | |
 | | ... | *Arguments:*
 | | ... | - dut - DUT node on which to set the interfaces up.
@@ -77,8 +75,7 @@
 
 | Set interfaces in path up on node on PF
 | | [Documentation]
-| | ... | *Set UP state on VPP interfaces in path on specified DUT node and
-| | ... | set maximal MTU.*
+| | ... | *Set UP state on VPP interfaces in path on specified DUT node.*
 | |
 | | ... | *Arguments:*
 | | ... | - dut - DUT node on which to set the interfaces up.
@@ -97,7 +94,6 @@
 | | ${_id}= | Set Variable If | '${_chains}' == 'PASS' | _1 | ${EMPTY}
 | | FOR | ${if} | IN | @{${dut}_${int}${pf}${_id}}
 | | | Set Interface State | ${nodes['${dut}']} | ${if} | up
-| | | VPP Set Interface MTU | ${nodes['${dut}']} | ${if}
 | | END
 
 | Pre-initialize layer driver
 | | ... | Pre-initialize rdma-core driver.
 | |
 | | FOR | ${dut} | IN | @{duts}
-| | | Run Keyword If | ${jumbo}
-| | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=9200
-| | | ... | ELSE
-| | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=1518
+| | | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci}
+| | | ... | mtu=${recommended_mtu}
 | | | Set Interface Flow Control
 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
 | | END
 | | ... | Pre-initialize mlx5_core driver.
 | |
 | | FOR | ${dut} | IN | @{duts}
-| | | Run Keyword If | ${jumbo}
-| | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=9200
-| | | ... | ELSE
-| | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=1518
 | | | Set Interface Flow Control
 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
 | | END
 | Initialize layer vfio-pci on node
 | | [Documentation]
 | | ... | Initialize vfio-pci interfaces on DUT on NIC PF.
-| | ... | Currently no operation.
+| | ... | Currently just set MTU to the recommended value.
 | |
 | | ... | *Arguments:*
 | | ... | - dut - DUT node. Type: string
 | |
 | | [Arguments] | ${dut} | ${pf}
 | |
-| | No operation
+| | Set Interface State | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | down
+| | VPP Set Interface MTU
+| | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | mtu=${recommended_mtu}
 
 | Initialize layer avf on node
 | | [Documentation]
 | Initialize layer mlx5_core on node
 | | [Documentation]
 | | ... | Initialize mlx5_core interfaces on DUT on NIC PF.
-| | ... | Currently no operation.
+| | ... | Currently just set MTU to the recommended value.
 | |
 | | ... | *Arguments:*
 | | ... | - dut - DUT node. Type: string
 | |
 | | [Arguments] | ${dut} | ${pf}
 | |
-| | No operation
+| | Set Interface State | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | down
+| | VPP Set Interface MTU
+| | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | mtu=${recommended_mtu}
 
 | Initialize layer interface
 | | [Documentation]