[PATCH v2 03/12] devtools: handle multiple drivers in doc check

David Marchand david.marchand at redhat.com
Wed Oct 21 12:30:17 CEST 2026


The doc check currently does not look into the Intel drivers, nor does
it handle multiple drivers in a single code.

Add helpers to extract driver names from paths and map them to code
directories.

When a driver name matches its code directory, report differences in
both directions (code vs doc, doc vs code).

When multiple docs share one code directory, only report doc items
not in code to avoid false positives.

Also rename doc files to match their code directory names.

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 MAINTAINERS                                   |  2 +-
 devtools/check-doc-vs-code.sh                 | 67 +++++++++++++++++--
 .../features/{afpacket.ini => af_packet.ini}  |  2 +-
 .../features/{cxgbevf.ini => cxgbe_vf.ini}    |  2 +-
 4 files changed, 63 insertions(+), 10 deletions(-)
 rename doc/guides/nics/features/{afpacket.ini => af_packet.ini} (70%)
 rename doc/guides/nics/features/{cxgbevf.ini => cxgbe_vf.ini} (90%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1720cff62e..e05bea2f0c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -679,7 +679,7 @@ F: examples/bond/
 Linux AF_PACKET
 M: Stephen Hemminger <stephen at networkplumber.org>
 F: drivers/net/af_packet/
-F: doc/guides/nics/features/afpacket.ini
+F: doc/guides/nics/features/af_packet.ini
 F: app/test/test_pmd_af_packet.c
 
 Linux AF_XDP
diff --git a/devtools/check-doc-vs-code.sh b/devtools/check-doc-vs-code.sh
index 80d77907f0..4dacb78b2e 100755
--- a/devtools/check-doc-vs-code.sh
+++ b/devtools/check-doc-vs-code.sh
@@ -36,30 +36,83 @@ has_file_change() # <pattern>
 	changed_files | grep -q "$1"
 }
 
+net_driver_from_path() # <path>
+{
+	sed -rn '
+		s,.*drivers/net/intel/([^/]*)/.*,\1,p; t
+		s,.*drivers/net/([^./]*)/.*,\1,p; t
+		s,.*doc/guides/nics/features/([^./]*).*,\1,p'
+}
+
 changed_net_drivers()
 {
-	net_paths='drivers/net/|doc/guides/nics/features/'
 	[ -n "$drivers" ] ||
 		drivers=$(changed_files |
-			sed -rn "s,^($net_paths)([^./]*).*,\2,p" |
+			net_driver_from_path |
 			sort -u)
 	echo "$drivers"
 }
 
 all_net_drivers()
 {
-	find $rootdir/drivers/net -mindepth 1 -maxdepth 1 -type d |
-	sed 's,.*/,,' |
-	sort
+	{
+		find $rootdir/drivers/net -name meson.build
+		ls $rootdir/doc/guides/nics/features/*.ini
+	} |
+	net_driver_from_path |
+	sort -u
+}
+
+driver_code_dir() # <driver>
+{
+	drv=$(echo "$1" | sed -r 's/_(dcf|vec|vf)$//')
+	case $drv in
+	enetc|enetc4)
+		echo "$rootdir/drivers/net/enetc" ;;
+	igb|igc|e1000)
+		echo "$rootdir/drivers/net/intel/e1000" ;;
+	ixgbe|i40e|ice|fm10k|ipn3ke|idpf|cpfl|iavf)
+		echo "$rootdir/drivers/net/intel/$drv" ;;
+	*)
+		echo "$rootdir/drivers/net/$drv" ;;
+	esac
+}
+
+# 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)
+flow_item_diff() # <driver> <code_dir> <doc_items> <code_items>
+{
+	{
+		[ -n "$3" ] && echo "$3"
+		[ -n "$4" ] && {
+			echo "$4"
+			[ "$1" != $(basename "$2") ] && echo "$4"
+		}
+	} | sort | uniq -u
 }
 
 check_rte_flow() # <driver>
 {
-	code=$rootdir/drivers/net/$1
+	code=$(driver_code_dir $1)
 	doc=$rootdir/doc/guides/nics/features/$1.ini
 	[ -d $code ] || return 0
 	[ -f $doc ] || return 0
-	report=$($selfdir/parse-flow-support.sh $code $doc)
+	code_support=$($selfdir/parse-flow-support.sh $code)
+	report=$(
+		for category in item action; do
+			section="rte_flow ${category}s]"
+			code_items=$(echo "$code_support" | sed -n "/$section/,/]/p" |
+				sed '/]/d' | sed 's, *=.*,,' | sed '/^$/d' | sort -u)
+			doc_items=$(sed -n "/$section/,/]/p" "$doc" |
+				sed '/]/d' | sed 's, *=.*,,' | sed '/^$/d' | sort -u)
+			if [ -n "$doc_items" ] || [ -n "$code_items" ]; then
+				flow_item_diff $1 $code "$doc_items" "$code_items"
+			fi |
+			grep . |
+			sed "s,^,$category ,"
+		done
+	)
 	if [ -n "$report" ]; then
 		error "rte_flow doc out of sync for $1"
 		echo "$report" | sed 's,^,\t,'
diff --git a/doc/guides/nics/features/afpacket.ini b/doc/guides/nics/features/af_packet.ini
similarity index 70%
rename from doc/guides/nics/features/afpacket.ini
rename to doc/guides/nics/features/af_packet.ini
index bc669dfb8a..b1cbc54aca 100644
--- a/doc/guides/nics/features/afpacket.ini
+++ b/doc/guides/nics/features/af_packet.ini
@@ -1,5 +1,5 @@
 ;
-; Supported features of the 'afpacket' network poll mode driver.
+; Supported features of the 'af_packet' network poll mode driver.
 ;
 ; Refer to default.ini for the full list of available PMD features.
 ;
diff --git a/doc/guides/nics/features/cxgbevf.ini b/doc/guides/nics/features/cxgbe_vf.ini
similarity index 90%
rename from doc/guides/nics/features/cxgbevf.ini
rename to doc/guides/nics/features/cxgbe_vf.ini
index a921cda6b1..b77b202272 100644
--- a/doc/guides/nics/features/cxgbevf.ini
+++ b/doc/guides/nics/features/cxgbe_vf.ini
@@ -1,5 +1,5 @@
 ;
-; Supported features of the 'cxgbevf' network poll mode driver.
+; Supported features of the 'cxgbe_vf' network poll mode driver.
 ;
 ; Refer to default.ini for the full list of available PMD features.
 ;
-- 
2.54.0



More information about the dev mailing list