[PATCH v2 07/12] devtools: check VMDq capability
David Marchand
david.marchand at redhat.com
Wed Oct 21 12:30:21 CEST 2026
Let's check that the code and the documentation are aligned for VMDq
capability.
Some driver directory hosts multiple drivers that have multiple
corresponding entry in doc/guides/features/. For this case, only try to
detect a discrepancy if all docs agree.
Note: net/atlantic and net/cxgbe were forcibly setting some fields in
dev_info to 0, which is unneeded since ethdev already clears the structure.
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
Changes since v1:
- added helper for checking mq capabilities,
- added handling of multi drivers,
- moved net/atlantic and net/cxgbe cleanups here,
---
devtools/check-doc-vs-code.sh | 73 +++++++++++++++++++++++++++++++
drivers/net/atlantic/atl_ethdev.c | 2 -
drivers/net/cxgbe/cxgbe_ethdev.c | 1 -
3 files changed, 73 insertions(+), 3 deletions(-)
diff --git a/devtools/check-doc-vs-code.sh b/devtools/check-doc-vs-code.sh
index 4dacb78b2e..eeb235ae61 100755
--- a/devtools/check-doc-vs-code.sh
+++ b/devtools/check-doc-vs-code.sh
@@ -78,6 +78,28 @@ driver_code_dir() # <driver>
esac
}
+doc_code_map=","
+for d in $rootdir/doc/guides/nics/features/*.ini; do
+ drv=$(basename "$d" .ini)
+ code=$(driver_code_dir $drv)
+ case $doc_code_map in
+ *,$code:*)
+ before=${doc_code_map%,$code:*}
+ after=${doc_code_map#*,$code:}
+ drivers=${after%%,*}
+ rest=${after#*,}
+ doc_code_map="$before,$code:$drivers $drv,$rest" ;;
+ *)
+ doc_code_map="$doc_code_map$code: $drv," ;;
+ esac
+done
+
+docs_for_code() # <code_dir>
+{
+ tmp=${doc_code_map#*,$1:}
+ echo ${tmp%%,*}
+}
+
# compare doc vs code items:
# - if driver matches code dir: report differences in both directions
# - otherwise: only report doc items not in code (shared code directory)
@@ -119,10 +141,55 @@ check_rte_flow() # <driver>
fi
}
+has_doc_feature() # <ini_file> <feature>
+{
+ grep -q "^$2[[:space:]]*=[[:space:]]*[YP]" "$1"
+}
+
+all_docs_agree() # <driver> <feature>
+{
+ code=$(driver_code_dir $1)
+ first=""
+ for drv in $(docs_for_code $code); do
+ d=$rootdir/doc/guides/nics/features/$drv.ini
+ has_doc_feature "$d" "$2" && val=true || val=false
+ [ -n "$first" ] || first=$val
+ [ "$first" = "$val" ] || return 1
+ done
+ return 0
+}
+
+check_mq_cap() # <driver> <feature> <indicator> <code_pattern> <mq_pattern>
+{
+ if all_docs_agree "$1" "$2"; then
+ if has_doc_feature "$doc" "$2"; then
+ git grep -qE "$4" -- "$code" ||
+ error "$2 documented but $3 not set for $1"
+ else
+ ! git grep -qE "$4" -- "$code" ||
+ error "$3 set but $2 not documented for $1"
+ ! git grep -qE "$5" -- "$code" ||
+ error "$2 mq_mode referenced but $2 not documented for $1"
+ fi
+ fi
+}
+
+check_mq_caps() # <driver>
+{
+ code=$(driver_code_dir $1)
+ doc=$rootdir/doc/guides/nics/features/$1.ini
+ [ -d $code ] || return 0
+ [ -f $doc ] || return 0
+
+ check_mq_cap $1 "VMDq" "max_vmdq_pools" 'max_vmdq_pools[[:space:]]*=' \
+ 'RTE_ETH_MQ_(RX|TX).*VMDQ'
+}
+
if [ -z "$trusted_commit" ]; then
# check all
for driver in $(all_net_drivers); do
check_rte_flow $driver
+ check_mq_caps $driver
done
exit $result
fi
@@ -134,4 +201,10 @@ if has_code_change 'RTE_FLOW_.*_TYPE_' ||
check_rte_flow $driver
done
fi
+if has_code_change 'max_vmdq_pools|RTE_ETH_MQ_.*VMDQ' ||
+ has_file_change 'doc/guides/nics/features'; then
+ for driver in $(changed_net_drivers); do
+ check_mq_caps $driver
+ done
+fi
exit $result
diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index 24184bdb18..44a65d7557 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -1106,8 +1106,6 @@ atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
dev_info->max_vfs = pci_dev->max_vfs;
dev_info->max_hash_mac_addrs = 0;
- dev_info->max_vmdq_pools = 0;
- dev_info->vmdq_queue_num = 0;
dev_info->rx_offload_capa = ATL_RX_OFFLOADS;
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 82e67eeff1..93554f354c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -129,7 +129,6 @@ int cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
device_info->max_mac_addrs = 1;
/* XXX: For now we support one MAC/port */
device_info->max_vfs = adapter->params.arch.vfcount;
- device_info->max_vmdq_pools = 0; /* XXX: For now no support for VMDQ */
device_info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP;
--
2.54.0
More information about the dev
mailing list