DPDK patches and discussions
 help / color / mirror / Atom feed
From: Aman Singh <aman.deep.singh@intel.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [PATCH] devtools/cocci: add script for ethdev namespace
Date: Tue, 23 Nov 2021 14:17:19 +0530	[thread overview]
Message-ID: <20211123084719.1313-1-aman.deep.singh@intel.com> (raw)

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>
---
 devtools/cocci/namespace_ethdev.cocci | 48 +++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 devtools/cocci/namespace_ethdev.cocci

diff --git a/devtools/cocci/namespace_ethdev.cocci b/devtools/cocci/namespace_ethdev.cocci
new file mode 100644
index 0000000000..d5de41e117
--- /dev/null
+++ b/devtools/cocci/namespace_ethdev.cocci
@@ -0,0 +1,48 @@
+@rule1@
+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
+
+@ script : python p@
+I << rule1.I;
+J;
+@@
+coccinelle .J="RTE_ETH_" + I[4:];
+
+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","ETH_MAX_RX_CLIENTS_E1H",
+"ETH_MAX_AGGREGATION_QUEUES_E1","ETH_RSS_ENGINE_NUM","ETH_NUM_MAC_FILTERS",
+"ETH_MAX_NUM_RX_QUEUES_PER_VF_QUAD","ETH_RSS_IND_TABLE_ENTRIES_NUM",
+"ETH_RSS_KEY_SIZE_REGS","ETH_NUM_STATISTIC_COUNTERS","ETH_SPEED_"]
+
+if any(x in I for x in exception_matches):
+        coccinelle .J= I;
+
+@ identifier@
+identifier rule1.I;
+identifier p.J;
+@@
+- I
++ J
+
+// Below rule for structures only
+@rule2@
+identifier A  =~  "rte_fdir_conf|rte_intr_conf";
+@@
+struct A
+
+@ script : python p2@
+A << rule2.A;
+B;
+@@
+coccinelle .B="rte_eth_" + A[4:];
+
+@ identifier2@
+identifier rule2.A;
+identifier p2.B;
+@@
+- struct A
++ struct B
-- 
2.17.1


             reply	other threads:[~2021-11-23  8:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23  8:47 Aman Singh [this message]
2021-11-25 18:41 ` Ferruh Yigit
2021-11-26 16:37   ` Ferruh Yigit
2021-11-26 16:58     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211123084719.1313-1-aman.deep.singh@intel.com \
    --to=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).