Let's check that the code and the documentation are aligned for VMDq capability.
Note: 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. Signed-off-by: David Marchand <[email protected]> --- devtools/check-doc-vs-code.sh | 46 ++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/devtools/check-doc-vs-code.sh b/devtools/check-doc-vs-code.sh index c58c239c87..7936f8b69f 100755 --- a/devtools/check-doc-vs-code.sh +++ b/devtools/check-doc-vs-code.sh @@ -28,7 +28,7 @@ changed_files() has_code_change() # <pattern> { - test -n "$(git log --format='%h' -S"$1" $trusted_commit..)" + test -n "$(git log --format='%h' -G"$1" $trusted_commit..)" } has_file_change() # <pattern> @@ -53,6 +53,43 @@ all_net_drivers() sort } +has_doc_feature() # <ini_file> <feature> +{ + grep -q "^$2[[:space:]]*=[[:space:]]*[YP]" "$1" +} + +all_docs_agree() # <driver> <feature> +{ + first="" + for d in "$rootdir/doc/guides/nics/features/${1}"*.ini; do + [ -f "$d" ] || return 1 + has_doc_feature "$d" "$2" && val=true || val=false + [ -n "$first" ] || first=$val + [ "$first" = "$val" ] || return 1 + done + return 0 +} + +check_mq_caps() # <driver> +{ + code=$rootdir/drivers/net/$1 + doc=$rootdir/doc/guides/nics/features/$1.ini + [ -d $code ] || return 0 + [ -f $doc ] || return 0 + + if all_docs_agree $1 "VMDq"; then + if has_doc_feature "$doc" "VMDq"; then + git grep -qE 'max_vmdq_pools[[:space:]]*=' -- "$code" || + error "VMDq documented but max_vmdq_pools not set for $1" + else + ! git grep -qE 'max_vmdq_pools[[:space:]]*=' -- "$code" || + error "max_vmdq_pools set but VMDq not documented for $1" + ! git grep -qE 'RTE_ETH_MQ_(RX|TX).*VMDQ' -- "$code" || + error "VMDq mq_mode referenced but VMDq not documented for $1" + fi + fi +} + check_rte_flow() # <driver> { code=$rootdir/drivers/net/$1 @@ -70,6 +107,7 @@ 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 @@ -81,4 +119,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 -- 2.54.0

