2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright 2021 Mellanox Technologies, Ltd
5 # Parse rte_flow support of a driver directory,
6 # and optionally show difference with a doc file in .ini format.
8 dir=$1 # drivers/net/foo
9 ref=$2 # doc/guides/nics/features/foo.ini
11 if [ -z "$dir" ]; then
12 echo "directory argument is required" >&2
22 case $(basename $dir) in
24 filter=$(sed -n "/$1/{N;/TYPE_NOT_SUPPORTED/P;}" \
25 $dir/tf_ulp/ulp_rte_handler_tbl.c |
26 grep -wo "$1[[:alnum:]_]*" | sort -u |
27 tr '\n' '|' | sed 's,.$,\n,')
28 exceptions='RTE_FLOW_ACTION_TYPE_SHARED'
29 grep -vE "$filter" | grep -vE $exceptions;;
37 case $(basename $dir) in
41 # generate INI section
42 list() # <title> <pattern>
45 git grep -who "$2[[:alnum:]_]*" $dir |
46 (exclude $2; include $2) | sort -u |
47 awk 'sub(/'$2'/, "") {printf "%-20s = Y\n", tolower($0)}'
50 rte_flow_support() # <category>
53 pattern=$(echo "RTE_FLOW_$1_TYPE_" | awk '{print toupper($0)}')
54 list "$title" "$pattern" | grep -vwE 'void|indirect|end'
57 if [ -z "$ref" ]; then # generate full tables
60 rte_flow_support action
64 # compare with reference input
65 rte_flow_compare() # <category>
67 section="rte_flow $1s]"
70 sed -n "/$section/,/]/p" "$ref" | sed '/^$/d'
72 sed '/]/d' | # ignore section title
73 sed 's, *=.*,,' | # ignore value (better in doc than generated one)
74 sort | uniq -u | # show differences
75 sed "s,^,$1 ," # prefix with category name
79 rte_flow_compare action