diff mbox series

devtools/cocci: added script for ethdev namespace

Message ID 20211008102949.70716-1-aman.deep.singh@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series devtools/cocci: added script for ethdev namespace | expand

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-spell-check-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/checkpatch success coding style OK

Commit Message

Aman Singh Oct. 8, 2021, 10:29 a.m. UTC
The cocci script is to help add prefix 'RTE_ETH' namespace to all enum
& macro of ethdev library in a backward compatible way. After the script
makes the changes few manual changes are required in rte_ethdev.h for
enum name changes.

Signed-off-by: Aman Singh <aman.deep.singh@intel.com>
---
 devtools/cocci/namespace_ethdev.cocci | 50 +++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 devtools/cocci/namespace_ethdev.cocci
diff mbox series

Patch

diff --git a/devtools/cocci/namespace_ethdev.cocci b/devtools/cocci/namespace_ethdev.cocci
new file mode 100644
index 0000000000..383db454f0
--- /dev/null
+++ b/devtools/cocci/namespace_ethdev.cocci
@@ -0,0 +1,50 @@ 
+@rule1@
+identifier I =~  "^(RTE_FC_|ETH_MQ_|ETH_RSS_|DEV_RX_|DEV_TX_|ETH_LINK_|RTE_RETA|
+ETH_SPEED|RTE_TUNNEL|ETH_VLAN|ETH_4|ETH_8|ETH_16|ETH_32|ETH_64|RTE_FDIR|RTE_L2|
+ETH_DCB|ETH_MIRROR|ETH_VMDQ|ETH_NUM|ETH_QINQ|rte_fdir)";
+@@
+I
+
+@ script : python p@
+I << rule1.I;
+J;
+@@
+coccinelle .J="RTE_ETH_" + I[4:];
+if I.isupper() == False:
+	coccinelle .J="rte_eth_" + I[4:];
+
+exception_matches = ["ETH_RSS_MODE","ETH_VLAN_FILTER_ANY","ETH_VLAN_FILTER_SPEC",
+"ETH_VLAN_FILTER_CLASSIFY","ETH_RSS_UPDATE","RTE_FDIR_MODE"]
+
+if any(x in I for x in exception_matches):
+        coccinelle .J= I;
+
+@ identifier@
+identifier rule1.I;
+identifier p.J;
+@@
+- I
++ J
+
+@rule2@
+identifier A  =~  "^(RTE_FC_|ETH_MQ_|ETH_RSS_|DEV_RX_|DEV_TX_|ETH_LINK_|RTE_RETA|
+ETH_SPEED|RTE_TUNNEL|ETH_VLAN|ETH_4|ETH_8|ETH_16|ETH_32|ETH_64|RTE_FDIR|RTE_L2|
+ETH_DCB|ETH_MIRROR|ETH_VMDQ|ETH_NUM|ETH_QINQ)";
+expression B ;
+@@
+#define A B
+
+@ script : python p2@
+A << rule2.A;
+K;
+@@
+coccinelle .K="RTE_ETH_" + A[4:];
+
+@ identifier2@
+identifier rule2.A;
+expression rule2.B;
+identifier p2.K;
+@@
+- #define A B
++ #define K B
++ #define A K