On 15/04/2026 14:42, Eelco Chaudron wrote:
External email: Use caution opening links or attachments
This patch refactors the DPDK offload test infrastructure to simplify
the interface configuration. Instead of using OVS_DPDK_VF_PCI_ADDRS
with a space-separated list of PCI addresses and VF indices (e.g.,
"0000:17:00.0,0 0000:17:00.0,1"), the tests now use OVS_PF_PCI
with a single PF address (e.g., "0000:17:00.0") and derive VF
information from sysfs.
Signed-off-by: Eelco Chaudron <[email protected]>
---
Changes to v3:
- Fixed documentation.
- Changed test macro names from xxxx_netdev() to xxx_port().
- Use local variables in shell macros.
Changes to v2:
- Use PCI address rather than port name, so other blades might
be supported.
- Moved/renamed shell helpers.
- Updated documentation.
---
Documentation/topics/testing.rst | 24 +++---
tests/system-common-macros.at | 90 ++++++++++++++++++++++
tests/system-dpdk-offloads-macros.at | 108 ++++-----------------------
3 files changed, 120 insertions(+), 102 deletions(-)
Hi Eelco,
The macros still has some references to "netdev" instead of "port" (see
below). Other than that LGTM.
Those are only comments there, so I'm fine also with keeping it.
If you prefer to keep:
Acked-by: Eli Britstein <[email protected]>
...
+# ovs_get_vf_port(<PF_PORT_PCI>, <VF_INDEX>)
+#
+# This function tries to find the VF's netdev for the given PF's VF index.
s/netdev/port
+#
+ovs_get_vf_port() {
+ local PF_PCI=$1
+ local VF_IDX=$2
+
+ local vf_net_dir="/sys/bus/pci/devices/$PF_PCI/virtfn$VF_IDX/net"
+ if test ! -d "$vf_net_dir"; then
+ return 1
+ fi
+
+ local vf_name=$(ls "$vf_net_dir" 2>/dev/null | head -1)
+ if test -z "$vf_name"; then
+ return 2
+ fi
+
+ echo "$vf_name"
+ return 0
+}
+
+# ovs_get_representor_port(<PF_PORT_PCI>, <VF_INDEX>)
+#
+# This function tries to find the representor's netdev for the given PF's VF
s/netdev/port
+# index.
+#
+ovs_get_representor_port() {
+ local PF_PCI=$1
+ local VF_IDX=$2
+
+ local representor=$(grep -l "vf$VF_IDX$" \
+ /sys/bus/pci/devices/$PF_PCI/net/*/phys_port_name \
+ 2>/dev/null | head -1)
+ if test -z "$representor"; then
+ return 2
+ fi
+
+ basename $(dirname "$representor")
+ return 0
+}
+
+# ovs_verify_pf_cfg(<PF_PORT_PCI>)
+#
+# Verify that the given PF port exists and that the required VFs are properly
+# configured, i.e. have representor ports.
+#
+ovs_verify_pf_cfg() {
+ local PF_PCI=$1
+ local VF_NAMES=()
+ local REPRESENTOR_NAMES=()
+ local PCI_REGEX=[[0-9a-fA-F]]{4}:[[0-9a-fA-F]]{2}:[[0-9a-fA-F]]{2}\.[[0-7]]
+ local vf_net_dir vf_name representor i
+
+ echo "$PF_PCI" | grep -E -q "^$PCI_REGEX$" || return 1
+
+ for i in {0..5}; do
+ # Get VF netdev using PCI path
s/netdev/port
+ vf_net_dir="/sys/bus/pci/devices/$PF_PCI/virtfn$i/net"
...
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev