Skip to contentSkip to conversation

devtools: support skipping forbid rule check

PATCH In review [email protected] 3 participants 4 messages Oct 4, 2023 – Nov 28, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 devtools: support skipping forbid rule check

From: Jerin Jacob <[email protected]>

In some case, a set of files in directory may need to skip forbid rules check.

Added an infrastructure to enable the same using SKIP_FILES variable.

---
 devtools/check-forbidden-tokens.awk | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
devtools/check-forbidden-tokens.awk +5 -2
index 026844141c..90d3a64f8e 100755
@@ -58,8 +58,11 @@ BEGIN {
 	for (i in deny_folders) {
 		re = "^\\+\\+\\+ b/" deny_folders[i];
 		if ($0 ~ re) {
-			in_file = 1
-			last_file = $0
+			# Check only if the files are not part of SKIP_FILES
+			if (!(length(SKIP_FILES) && ($re ~ SKIP_FILES))) {
+				in_file = 1
+				last_file = $0
+			}
 		}
 	}
 }
Signature · 1 line
2.42.0
#1 lore raw

PATCH 2/2 devtools: forbid rte symbols in cnxk base driver

From: Jerin Jacob <[email protected]>

cnxk base code is shared between different driver environments.

Forbid the direct usage of rte_ symbols instead use plt_ symbol as alternatives.

roc_platform.[ch] files abstract the difference of driver environment, hence skip those files for rules check.

---
 devtools/checkpatches.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
devtools/checkpatches.sh +9 -0
index 2635923e14..8baa4e9a04 100755
@@ -223,6 +223,15 @@ check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# forbid using rte_ symbols in cnxk driver base code
+	awk -v FOLDERS='drivers/common/cnxk/roc_*' \
+		-v SKIP_FILES='roc_platform*' \
+		-v EXPRESSIONS="rte_ RTE_" \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Use plt_ symbols instead of rte_ symbols in cnxk driver base code' \
+		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		"$1" || res=1
+
 	return $res
 }
 
Signature · 1 line
2.42.0
#2 lore raw

Re: [dpdk-dev] [PATCH 2/2] devtools: forbid rte symbols in cnxk base driver

04/10/2023 14:27, [email protected]:

Quoted 4 lines

From: Jerin Jacob <[email protected]>

cnxk base code is shared between different driver environments.

Quoted 8 lines

Forbid the direct usage of rte_ symbols instead use plt_ symbol as alternatives.

roc_platform.[ch] files abstract the difference of driver environment, hence skip those files for rules check.

Series applied, thanks.

I've moved the check in a more appropriate place
to keep a kind of ordering in all checks.
Also, I've changed a word to mention "API":
MESSAGE='Use plt_ symbols instead of rte_ API in cnxk base driver'

#3 lore raw
In reply to [email protected]
Quoted 9 lines · On Wed, Oct 4, 2023 at 11:56 PM <[email protected]> wrote:

From: Jerin Jacob <[email protected]>

In some case, a set of files in directory may need to skip forbid rules check.

Added an infrastructure to enable the same using SKIP_FILES variable.

Ping for review

Quoted 25 lines
---
 devtools/check-forbidden-tokens.awk | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
devtools/check-forbidden-tokens.awk +5 -3
index 026844141c..90d3a64f8e 100755
@@ -58,8 +58,11 @@ BEGIN {
        for (i in deny_folders) {
                re = "^\\+\\+\\+ b/" deny_folders[i];
                if ($0 ~ re) {
-                       in_file = 1
-                       last_file = $0
+                       # Check only if the files are not part of SKIP_FILES
+                       if (!(length(SKIP_FILES) && ($re ~ SKIP_FILES))) {
+                               in_file = 1
+                               last_file = $0
+                       }
                }
        }
 }
--

2.42.0