diff options
author | 2025-01-14 11:16:14 +0100 | |
---|---|---|
committer | 2025-01-14 11:16:14 +0100 | |
commit | 2a3c98274a6dd858dc054f69011e30804e4b6bb3 (patch) | |
tree | 541df9fdfe48bca26a358c12aadde6dadf060600 /resources | |
parent | 39e81b75d0029f74c024fd681cf90d8b8e610407 (diff) |
feat(avf): Migrate to plugins/dev_iavf
Change-Id: I4f4f17560f4c65a8f308e1f394207b7cec474b96
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources')
-rw-r--r-- | resources/api/vpp/supported_crcs.yaml | 12 | ||||
-rw-r--r-- | resources/libraries/python/Constants.py | 4 | ||||
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 54 | ||||
-rw-r--r-- | resources/libraries/robot/shared/interfaces.robot | 6 |
4 files changed, 46 insertions, 30 deletions
diff --git a/resources/api/vpp/supported_crcs.yaml b/resources/api/vpp/supported_crcs.yaml index 2a65497d65..c53e86e8f4 100644 --- a/resources/api/vpp/supported_crcs.yaml +++ b/resources/api/vpp/supported_crcs.yaml @@ -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: @@ -55,10 +55,6 @@ 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 @@ -127,6 +123,12 @@ # 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 diff --git a/resources/libraries/python/Constants.py b/resources/libraries/python/Constants.py index 5ec3fcf377..8fb354fc8d 100644 --- a/resources/libraries/python/Constants.py +++ b/resources/libraries/python/Constants.py @@ -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", diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index ff013307bc..7a0e37386b 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -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. diff --git a/resources/libraries/robot/shared/interfaces.robot b/resources/libraries/robot/shared/interfaces.robot index b4d6959d01..e994628ee6 100644 --- a/resources/libraries/robot/shared/interfaces.robot +++ b/resources/libraries/robot/shared/interfaces.robot @@ -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: @@ -375,7 +375,7 @@ | 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 @@ -408,6 +408,8 @@ | | | 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 |