Skip to contentSkip to conversation

devtools/cocci: update cocci for ethdev namespace

PATCH Superseded Aman Singh 2 participants 13 messages Jan 23, 2022 – Mar 8, 2022

lore
Share & tools
lore

Aman Singh

author
#0 lore raw

PATCH v2 1/1 devtools/cocci: update cocci for ethdev namespace

Added two specific exceptions for ETH_SPEED_10G and ETH_SPEED_25G to avoid there name change. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

---
 devtools/cocci/namespace_ethdev.cocci | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
devtools/cocci/namespace_ethdev.cocci +3 -2
index d5de41e117..50a1d296f3 100644
@@ -1,7 +1,7 @@
 @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_)";
+|ETH_SPEED|ETH_TUNNEL_FILT|ETH_RSS_RETA_|ETH_VMDQ|ETH_NUM|ETH_QINQ|ETH_MAX_)";
 @@
 I
 
@@ -16,7 +16,8 @@ exception_matches = ["ETH_VLAN_FILTER_CLASSIFY","ETH_VLAN_FILTER_ANY",
 "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_"]
+"ETH_RSS_KEY_SIZE_REGS","ETH_NUM_STATISTIC_COUNTERS","ETH_SPEED_10G",
+"ETH_SPEED_25G"]
 
 if any(x in I for x in exception_matches):
         coccinelle .J= I;
Signature · 1 line
2.25.1
#1 lore raw

23/01/2022 18:20, Aman Singh:

Quoted 3 lines

Added two specific exceptions for ETH_SPEED_10G and ETH_SPEED_25G to avoid there name change. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

Please could you explain why?

#2 lore raw

Hi Thomas

Quoted 5 lines · Thomas Monjalon

23/01/2022 18:20, Aman Singh:

Quoted 3 lines

Added two specific exceptions for ETH_SPEED_10G and ETH_SPEED_25G to avoid there name change. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

Please could you explain why?

These two macro's ETH_SPEED_10G & ETH_SPEED_25G are used by ifpga driver and script should no change these.
There are multiple ETH_SPEED_NUM_xxx macro that need to be changed to RTE_ETH_SPEED_NUM_xxx. So added above two as specific exceptions.

The other two patterns ETH_TUNNEL_FILTER & ETH_RSS_RETA were missed before. The script should change these to RTE_ETH_TUNNEL_FILTER & RTE_ETH_RSS_RETA

Quoted 2 lines
#3 lore raw

04/02/2022 07:13, Singh, Aman Deep:

Quoted 4 lines

Hi Thomas

Quoted 1 line · Thomas Monjalon

23/01/2022 18:20, Aman Singh:

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Added two specific exceptions for ETH_SPEED_10G and ETH_SPEED_25G to avoid there name change. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

Please could you explain why?

These two macro's ETH_SPEED_10G & ETH_SPEED_25G are used by ifpga driver and script should no change these.
There are multiple ETH_SPEED_NUM_xxx macro that need to be changed to RTE_ETH_SPEED_NUM_xxx. So added above two as specific exceptions.

Why doing this exception? What is special with ifpga?

Quoted 2 lines

The other two patterns ETH_TUNNEL_FILTER & ETH_RSS_RETA were missed before. The script should change these to RTE_ETH_TUNNEL_FILTER & RTE_ETH_RSS_RETA

The explanations should be part of the commit log please.

#4 lore raw
Quoted 8 lines · Thomas Monjalon

04/02/2022 07:13, Singh, Aman Deep:

Quoted 7 lines

Hi Thomas

Quoted 4 lines · Thomas Monjalon

23/01/2022 18:20, Aman Singh:

Quoted 3 lines

Added two specific exceptions for ETH_SPEED_10G and ETH_SPEED_25G to avoid there name change. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

Please could you explain why?

These two macro's ETH_SPEED_10G & ETH_SPEED_25G are used by ifpga driver and script should no change these.
There are multiple ETH_SPEED_NUM_xxx macro that need to be changed to RTE_ETH_SPEED_NUM_xxx. So added above two as specific exceptions.

Why doing this exception? What is special with ifpga?

These two macro's are defined in 'ifpga/base/opae_eth_group.h' we don't intend to change these. Target is ethdev namespace only.

Quoted 4 lines
Quoted 3 lines

The other two patterns ETH_TUNNEL_FILTER & ETH_RSS_RETA were missed before. The script should change these to RTE_ETH_TUNNEL_FILTER & RTE_ETH_RSS_RETA

The explanations should be part of the commit log please.

Sure, if this explanation is fine? Will update in next version.

Quoted 3 lines
#5 lore raw

10/02/2022 14:26, Singh, Aman Deep:

Quoted 10 lines · Thomas Monjalon
Quoted 9 lines

04/02/2022 07:13, Singh, Aman Deep:

Quoted 8 lines

Hi Thomas

Quoted 5 lines · Thomas Monjalon

23/01/2022 18:20, Aman Singh:

Quoted 3 lines

Added two specific exceptions for ETH_SPEED_10G and ETH_SPEED_25G to avoid there name change. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

Please could you explain why?

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

These two macro's ETH_SPEED_10G & ETH_SPEED_25G are used by ifpga driver and script should no change these.
There are multiple ETH_SPEED_NUM_xxx macro that need to be changed to RTE_ETH_SPEED_NUM_xxx. So added above two as specific exceptions.

Why doing this exception? What is special with ifpga?

These two macro's are defined in 'ifpga/base/opae_eth_group.h' we don't intend to change these. Target is ethdev namespace only.

So we will miss future use of a deprecated macro
because ifpga is redefining it?
I think it is a wrong approach.
We should not make any exception in the check.
Instead we can just ignore the warning for ifpga.

Quoted 5 lines
Quoted 3 lines
Quoted 2 lines

The other two patterns ETH_TUNNEL_FILTER & ETH_RSS_RETA were missed before. The script should change these to RTE_ETH_TUNNEL_FILTER & RTE_ETH_RSS_RETA

The explanations should be part of the commit log please.

Sure, if this explanation is fine? Will update in next version.

Yes thanks.

#6 lore raw
Quoted 15 lines · Thomas Monjalon

10/02/2022 14:26, Singh, Aman Deep:

Quoted 14 lines · Thomas Monjalon
Quoted 13 lines

04/02/2022 07:13, Singh, Aman Deep:

Quoted 12 lines

Hi Thomas

Quoted 5 lines · Thomas Monjalon

23/01/2022 18:20, Aman Singh:

Quoted 3 lines

Added two specific exceptions for ETH_SPEED_10G and ETH_SPEED_25G to avoid there name change. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

Please could you explain why?

These two macro's ETH_SPEED_10G & ETH_SPEED_25G are used by ifpga driver and script should no change these.
There are multiple ETH_SPEED_NUM_xxx macro that need to be changed to RTE_ETH_SPEED_NUM_xxx. So added above two as specific exceptions.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Why doing this exception? What is special with ifpga?

These two macro's are defined in 'ifpga/base/opae_eth_group.h' we don't intend to change these. Target is ethdev namespace only.

So we will miss future use of a deprecated macro
because ifpga is redefining it?
I think it is a wrong approach.
We should not make any exception in the check.
Instead we can just ignore the warning for ifpga.

Actually ifpga is not redefining these two macro's ETH_SPEED_10G & ETH_SPEED_25G, they are unique to it. Only there prefix, matches with ethdev macro's ETH_SPEED_NUM_xxx, which caused coccinelle script to modify these to RTE_ETH_SPEED_10G & RTE_ETH_SPEED_25G. So just avoiding it by this change.

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines

The other two patterns ETH_TUNNEL_FILTER & ETH_RSS_RETA were missed before. The script should change these to RTE_ETH_TUNNEL_FILTER & RTE_ETH_RSS_RETA

The explanations should be part of the commit log please.

Sure, if this explanation is fine? Will update in next version.

Yes thanks.

#7 lore raw

11/02/2022 09:07, Singh, Aman Deep:

Quoted 25 lines · Thomas Monjalon
Quoted 15 lines

10/02/2022 14:26, Singh, Aman Deep:

Quoted 14 lines · Thomas Monjalon
Quoted 13 lines

04/02/2022 07:13, Singh, Aman Deep:

Quoted 12 lines

Hi Thomas

Quoted 5 lines · Thomas Monjalon

23/01/2022 18:20, Aman Singh:

Quoted 3 lines

Added two specific exceptions for ETH_SPEED_10G and ETH_SPEED_25G to avoid there name change. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

Please could you explain why?

These two macro's ETH_SPEED_10G & ETH_SPEED_25G are used by ifpga driver and script should no change these.
There are multiple ETH_SPEED_NUM_xxx macro that need to be changed to RTE_ETH_SPEED_NUM_xxx. So added above two as specific exceptions.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Why doing this exception? What is special with ifpga?

These two macro's are defined in 'ifpga/base/opae_eth_group.h' we don't intend to change these. Target is ethdev namespace only.

So we will miss future use of a deprecated macro
because ifpga is redefining it?
I think it is a wrong approach.
We should not make any exception in the check.
Instead we can just ignore the warning for ifpga.

Quoted 4 lines

Actually ifpga is not redefining these two macro's ETH_SPEED_10G & ETH_SPEED_25G, they are unique to it. Only there prefix, matches with ethdev macro's ETH_SPEED_NUM_xxx, which caused coccinelle script to modify these to RTE_ETH_SPEED_10G & RTE_ETH_SPEED_25G. So just avoiding it by this change.

Would it work to restrict the match to ETH_SPEED_NUM?

#8 lore raw
Quoted 25 lines · Thomas Monjalon

11/02/2022 09:07, Singh, Aman Deep:

Quoted 24 lines · Thomas Monjalon
Quoted 23 lines

10/02/2022 14:26, Singh, Aman Deep:

Quoted 9 lines · Thomas Monjalon
Quoted 8 lines

04/02/2022 07:13, Singh, Aman Deep:

Quoted 7 lines

Hi Thomas

Quoted 4 lines · Thomas Monjalon

23/01/2022 18:20, Aman Singh:

Quoted 3 lines

Added two specific exceptions for ETH_SPEED_10G and ETH_SPEED_25G to avoid there name change. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

Please could you explain why?

These two macro's ETH_SPEED_10G & ETH_SPEED_25G are used by ifpga driver and script should no change these.
There are multiple ETH_SPEED_NUM_xxx macro that need to be changed to RTE_ETH_SPEED_NUM_xxx. So added above two as specific exceptions.

Why doing this exception? What is special with ifpga?

These two macro's are defined in 'ifpga/base/opae_eth_group.h' we don't intend to change these. Target is ethdev namespace only.

So we will miss future use of a deprecated macro
because ifpga is redefining it?
I think it is a wrong approach.
We should not make any exception in the check.
Instead we can just ignore the warning for ifpga.

Quoted 5 lines
Quoted 4 lines

Actually ifpga is not redefining these two macro's ETH_SPEED_10G & ETH_SPEED_25G, they are unique to it. Only there prefix, matches with ethdev macro's ETH_SPEED_NUM_xxx, which caused coccinelle script to modify these to RTE_ETH_SPEED_10G & RTE_ETH_SPEED_25G. So just avoiding it by this change.

Would it work to restrict the match to ETH_SPEED_NUM?

The script will change ETH_SPEED_NUM_xxx macros to RTE_ETH_SPEED_NUM_xxx as per the requirement.

Quoted 3 lines
#9 lore raw

15/02/2022 19:51, Singh, Aman Deep:

Quoted 26 lines · Thomas Monjalon
Quoted 25 lines

11/02/2022 09:07, Singh, Aman Deep:

Quoted 24 lines · Thomas Monjalon
Quoted 23 lines

10/02/2022 14:26, Singh, Aman Deep:

Quoted 9 lines · Thomas Monjalon
Quoted 8 lines

04/02/2022 07:13, Singh, Aman Deep:

Quoted 7 lines

Hi Thomas

Quoted 4 lines · Thomas Monjalon

23/01/2022 18:20, Aman Singh:

Quoted 3 lines

Added two specific exceptions for ETH_SPEED_10G and ETH_SPEED_25G to avoid there name change. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

Please could you explain why?

These two macro's ETH_SPEED_10G & ETH_SPEED_25G are used by ifpga driver and script should no change these.
There are multiple ETH_SPEED_NUM_xxx macro that need to be changed to RTE_ETH_SPEED_NUM_xxx. So added above two as specific exceptions.

Why doing this exception? What is special with ifpga?

These two macro's are defined in 'ifpga/base/opae_eth_group.h' we don't intend to change these. Target is ethdev namespace only.

So we will miss future use of a deprecated macro
because ifpga is redefining it?
I think it is a wrong approach.
We should not make any exception in the check.
Instead we can just ignore the warning for ifpga.

Quoted 8 lines
Quoted 5 lines
Quoted 4 lines

Actually ifpga is not redefining these two macro's ETH_SPEED_10G & ETH_SPEED_25G, they are unique to it. Only there prefix, matches with ethdev macro's ETH_SPEED_NUM_xxx, which caused coccinelle script to modify these to RTE_ETH_SPEED_10G & RTE_ETH_SPEED_25G. So just avoiding it by this change.

Would it work to restrict the match to ETH_SPEED_NUM?

The script will change ETH_SPEED_NUM_xxx macros to RTE_ETH_SPEED_NUM_xxx as per the requirement.

No there is a misunderstanding.
I am asking to filter on ETH_SPEED_NUM instead of ETH_SPEED with exceptions.

#10 lore raw
Quoted 31 lines · Thomas Monjalon

15/02/2022 19:51, Singh, Aman Deep:

Quoted 30 lines · Thomas Monjalon
Quoted 29 lines

11/02/2022 09:07, Singh, Aman Deep:

Quoted 28 lines · Thomas Monjalon
Quoted 15 lines

10/02/2022 14:26, Singh, Aman Deep:

Quoted 14 lines · Thomas Monjalon
Quoted 13 lines

04/02/2022 07:13, Singh, Aman Deep:

Quoted 12 lines

Hi Thomas

Quoted 5 lines · Thomas Monjalon

23/01/2022 18:20, Aman Singh:

Quoted 3 lines

Added two specific exceptions for ETH_SPEED_10G and ETH_SPEED_25G to avoid there name change. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

Please could you explain why?

These two macro's ETH_SPEED_10G & ETH_SPEED_25G are used by ifpga driver and script should no change these.
There are multiple ETH_SPEED_NUM_xxx macro that need to be changed to RTE_ETH_SPEED_NUM_xxx. So added above two as specific exceptions.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Why doing this exception? What is special with ifpga?

These two macro's are defined in 'ifpga/base/opae_eth_group.h' we don't intend to change these. Target is ethdev namespace only.

So we will miss future use of a deprecated macro
because ifpga is redefining it?
I think it is a wrong approach.
We should not make any exception in the check.
Instead we can just ignore the warning for ifpga.

Actually ifpga is not redefining these two macro's ETH_SPEED_10G & ETH_SPEED_25G, they are unique to it. Only there prefix, matches with ethdev macro's ETH_SPEED_NUM_xxx, which caused coccinelle script to modify these to RTE_ETH_SPEED_10G & RTE_ETH_SPEED_25G. So just avoiding it by this change.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Would it work to restrict the match to ETH_SPEED_NUM?

The script will change ETH_SPEED_NUM_xxx macros to RTE_ETH_SPEED_NUM_xxx as per the requirement.

No there is a misunderstanding.
I am asking to filter on ETH_SPEED_NUM instead of ETH_SPEED with exceptions.

Yes, can do it this way. I will upload new patch with this change.

Quoted 3 lines
author
#11 lore raw

PATCH v3 1/1 devtools/cocci: update cocci for ethdev namespace

In reply to Aman Singh

Changed the filter from ETH_SPEED to ETH_SPEED_NUM to make the match more specific. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA as these were missed before.

---

*v3: Rather than exception for ETH_SPEED_10G & ETH_SPEED_25G macro's
made search filter more specific to ETH_SPEED_NUM. As per comments.

*v2: Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA

 devtools/cocci/namespace_ethdev.cocci | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
devtools/cocci/namespace_ethdev.cocci +3 -2
index d5de41e117..125adc44c5 100644
@@ -1,7 +1,8 @@
 @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_)";
+|ETH_SPEED_NUM|ETH_TUNNEL_FILT|ETH_RSS_RETA_|ETH_VMDQ|ETH_NUM|ETH_QINQ|
+|ETH_MAX_)";
 @@
 I
 
@@ -16,7 +17,7 @@ exception_matches = ["ETH_VLAN_FILTER_CLASSIFY","ETH_VLAN_FILTER_ANY",
 "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_"]
+"ETH_RSS_KEY_SIZE_REGS","ETH_NUM_STATISTIC_COUNTERS"]
 
 if any(x in I for x in exception_matches):
         coccinelle .J= I;
Signature · 1 line
2.25.1
#12 lore raw

07/03/2022 15:27, Aman Singh:

Quoted 5 lines

Changed the filter from ETH_SPEED to ETH_SPEED_NUM to make the match more specific. Added check for ETH_TUNNEL_FILTER and ETH_RSS_RETA as these were missed before.

Applied, thanks.