feat(avf): Migrate to plugins/dev_iavf 05/40005/52
authorVratko Polak <[email protected]>
Tue, 14 Jan 2025 10:16:14 +0000 (11:16 +0100)
committerVratko Polak <[email protected]>
Tue, 14 Jan 2025 10:16:14 +0000 (11:16 +0100)
Change-Id: I4f4f17560f4c65a8f308e1f394207b7cec474b96
Signed-off-by: Vratko Polak <[email protected]>
resources/api/vpp/supported_crcs.yaml
resources/libraries/python/Constants.py
resources/libraries/python/InterfaceUtil.py
resources/libraries/robot/shared/interfaces.robot

index 2a65497..c53e86e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2024 Cisco and/or its affiliates.
+# Copyright (c) 2025 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:
     af_xdp_create_v3: '0xcf4b1827'  # perf
     af_xdp_create_v3_reply: '0x5383d31f'  # perf
 
-    # plugins/avf/avf.api
-    avf_create: '0xdaab8ae2'  # dev
-    avf_create_reply: '0x5383d31f'  # dev
-
     # vnet/bonding/bond.api
     bond_add_member: '0xe7d14948'  # perf
     bond_add_member_reply: '0xe8d4e804'  # perf
     # TODO: Which test to run to verify det44_* messages?
     # dhcp_proxy_dump / details # honeycomb
 
+    # vnet/dev/dev.api
+    dev_attach: '0x44b725fc'
+    dev_attach_reply: '0x6082b181'
+    dev_create_port_if: '0xdbdf06f3'
+    dev_create_port_if_reply: '0x243c2374'
+
     # vnet/flow/flow.api
     flow_add_v2: '0x5b757558'  # dev
     flow_add_v2_reply: '0x8587dc85'  # dev
index 5ec3fcf..8fb354f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2024 Cisco and/or its affiliates.
+# Copyright (c) 2025 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:
@@ -428,7 +428,7 @@ class Constants:
     # Each driver needs different plugin to work.
     NIC_DRIVER_TO_PLUGINS = {
         "vfio-pci": "dpdk_plugin.so",
-        "avf": "avf_plugin.so",
+        "avf": "dev_iavf_plugin.so",
         "rdma-core": "rdma_plugin.so",
         "mlx5_core": "dpdk_plugin.so",
         "af_xdp": "af_xdp_plugin.so",
index ff01330..7a0e373 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2024 Cisco and/or its affiliates.
+# Copyright (c) 2025 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:
@@ -1261,32 +1261,37 @@ class InterfaceUtil:
             the node.
         """
         PapiSocketExecutor.run_cli_cmd(
-            node, u"set logging class avf level debug"
+            node, u"set logging class dev level debug"
+        )
+        PapiSocketExecutor.run_cli_cmd(
+            node, u"set logging class iavf level debug"
         )
 
-        cmd = u"avf_create"
+        cmd = u"dev_attach"
         vf_pci_addr = Topology.get_interface_pci_addr(node, if_key)
         args = dict(
-            pci_addr=InterfaceUtil.pci_to_int(vf_pci_addr),
-            enable_elog=0,
-            rxq_num=int(num_rx_queues) if num_rx_queues else 0,
-            rxq_size=rxq_size,
-            txq_size=txq_size
+            device_id=f"pci/{vf_pci_addr}",
+            driver_name="iavf",
         )
-        err_msg = f"Failed to create AVF interface on host {node[u'host']}"
+        err_msg = f"Failed to attach AVF driver on host {node[u'host']}"
+        with PapiSocketExecutor(node) as papi_exec:
+            reply = papi_exec.add(cmd, **args).get_reply(err_msg)
+            logger.debug(f"reply: {reply}")
+            dev_index = reply["dev_index"]
 
-        # FIXME: Remove once the fw/driver is upgraded.
-        for _ in range(10):
-            with PapiSocketExecutor(node) as papi_exec:
-                try:
-                    sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(
-                        err_msg
-                    )
-                    break
-                except AssertionError:
-                    logger.error(err_msg)
-        else:
-            raise AssertionError(err_msg)
+        cmd = u"dev_create_port_if"
+        args = dict(
+            dev_index=dev_index,
+            intf_name="",
+            num_rx_queues=int(num_rx_queues) if num_rx_queues else 0,
+            rx_queue_size=rxq_size,
+            tx_queue_size=txq_size,
+            port_id=0,
+        )
+        err_msg = f"Failed to create AVF port on host {node[u'host']}"
+        with PapiSocketExecutor(node) as papi_exec:
+            sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(err_msg)
+        PapiSocketExecutor.run_cli_cmd(node, "show dev")
 
         InterfaceUtil.add_eth_interface(
             node, sw_if_index=sw_if_index, ifc_pfx=u"eth_avf",
@@ -1820,6 +1825,9 @@ class InterfaceUtil:
     def init_generic_interface(node, ifc_key, numvfs=0, osi_layer=u"L2"):
         """Init PCI device. Bind to proper drivers. Optionally create NIC VFs.
 
+        When creating VFs, also set large enough MTU on PF.
+        As this is called in suite setup, we must allow jumbo here.
+
         :param node: DUT node.
         :param ifc_key: Interface key from topology file.
         :param numvfs: Number of VIFs to initialize, 0 - disable the VIFs.
@@ -1859,6 +1867,10 @@ class InterfaceUtil:
         if not numvfs:
             if osi_layer == u"L2":
                 InterfaceUtil.set_linux_interface_promisc(node, pf_dev)
+        else:
+            # AVF VFs cannot read if limited by MTU on PF, ensure default here.
+            # TODO: Allow test-case specific PF initialization if possible.
+            InterfaceUtil.set_interface_mtu(node, [pf_pci_addr])
 
         vf_ifc_keys = []
         # Set MAC address and bind each virtual function to uio driver.
index b4d6959..e994628 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2024 Cisco and/or its affiliates.
+# Copyright (c) 2025 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:
 
 | Initialize layer avf on node
 | | [Documentation]
-| | ... | Initialize AVF (Intel) interfaces on DUT on NIC PF.
+| | ... | Initialize AVF (Intel) interfaces on DUT on NIC PF. Set MTU.
 | |
 | | ... | *Arguments:*
 | | ... | - dut - DUT node. Type: string
 | | | Set List Value | ${${dut}_vf${pf}_mac} | ${vf} | ${_mac}
 | | | Set List Value | ${${dut}_vf${pf}_pci} | ${vf} | ${_pci}
 | | | Set List Value | ${${dut}_vf${pf}_vlan} | ${vf} | ${_vlan}
+| | | VPP Set Interface MTU | ${nodes['${dut}']}
+| | | ... | ${${dut}_vf${pf}}[${vf}] | mtu=${recommended_mtu}
 | | END
 
 | Initialize layer af_xdp on node