* [PATCH v2] devtools/cocci: added script for ethdev namespace
@ 2021-11-22 17:53 Aman Singh
0 siblings, 0 replies; only message in thread
From: Aman Singh @ 2021-11-22 17:53 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit
The cocci script is to help add prefix 'RTE_ETH' namespace to enum
& macro of ethdev library. It helps in automating these changes for
applications. The script won't make changes in the code comment part.
Usage: spatch <script path> <app path>
Signed-off-by: Aman Singh <aman.deep.singh@intel.com>
---
v2:
* Added support for struct changes
* Removed backward compatibility code gen part
devtools/cocci/namespace_ethdev.cocci | 34 ++++++++++++---------------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/devtools/cocci/namespace_ethdev.cocci b/devtools/cocci/namespace_ethdev.cocci
index 383db454f0..8bb189da5b 100644
--- a/devtools/cocci/namespace_ethdev.cocci
+++ b/devtools/cocci/namespace_ethdev.cocci
@@ -1,7 +1,7 @@
@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)";
+identifier I =~ "^(RTE_FC_|ETH_MQ_|ETH_RSS|DEV_RX_|DEV_TX_|ETH_LINK|RTE_RETA|
+|ETH_DCB|RTE_TUNNEL|ETH_VLAN|ETH_4|ETH_8|ETH_16|ETH_32|ETH_64|RTE_FDIR|RTE_L2|
+|ETH_SPEED|ETH_MIRROR|ETH_VMDQ|ETH_NUM|ETH_QINQ|ETH_MAX_)";
@@
I
@@ -10,11 +10,10 @@ 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"]
+exception_matches = ["ETH_VLAN_FILTER_CLASSIFY","ETH_VLAN_FILTER_ANY",
+"ETH_VLAN_FILTER_SPEC","ETH_RSS_MODE","ETH_RSS_UPDATE","RTE_FDIR_MODE",
+"RTE_FDIR_NO","RTE_FDIR_REPORT"]
if any(x in I for x in exception_matches):
coccinelle .J= I;
@@ -26,25 +25,22 @@ identifier p.J;
- I
+ J
+
+// Below rule for structures only
@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 ;
+identifier A =~ "rte_fdir_conf|rte_intr_conf";
@@
-#define A B
+struct A
@ script : python p2@
A << rule2.A;
-K;
+B;
@@
-coccinelle .K="RTE_ETH_" + A[4:];
+coccinelle .B="rte_eth_" + A[4:];
@ identifier2@
identifier rule2.A;
-expression rule2.B;
-identifier p2.K;
+identifier p2.B;
@@
-- #define A B
-+ #define K B
-+ #define A K
+- struct A
++ struct B
--
2.17.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-22 17:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22 17:53 [PATCH v2] devtools/cocci: added script for ethdev namespace Aman Singh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).