Skip to contentSkip to conversation

net: gro: Fix a 'directive in macro's argument list' sparse warning

PATCH Superseded Gal Pressman 2 participants 3 messages Feb 16, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: gro: Fix a 'directive in macro's argument list' sparse warning

Following the cited commit, sparse started complaining about:
../include/net/gro.h:58:1: warning: directive in macro's argument list ../include/net/gro.h:59:1: warning: directive in macro's argument list

Fix that by moving the defines out of the struct_group() macro.

Fixes de5a1f3ce4c8 ("net: gro: minor optimization for dev_gro_receive()")
---
 include/net/gro.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/net/gro.h +2 -2
index a765fedda5c4..146e2af8dd7d 100644
@@ -35,6 +35,8 @@ struct napi_gro_cb {
 	/* jiffies when first packet was created/queued */
 	unsigned long age;
 
+#define NAPI_GRO_FREE		  1
+#define NAPI_GRO_FREE_STOLEN_HEAD 2
 	/* portion of the cb set to zero at every gro iteration */
 	struct_group(zeroed,
 
@@ -55,8 +57,6 @@ struct napi_gro_cb {
 
 		/* Free the skb? */
 		u8	free:2;
-#define NAPI_GRO_FREE		  1
-#define NAPI_GRO_FREE_STOLEN_HEAD 2
 
 		/* Used in foo-over-udp, set in udp[46]_gro_receive */
 		u8	is_ipv6:1;
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw

From: Gal Pressman <[email protected]>
Date: Wed, 16 Feb 2022 12:31:00 +0200

Quoted 5 lines

Following the cited commit, sparse started complaining about:
../include/net/gro.h:58:1: warning: directive in macro's argument list ../include/net/gro.h:59:1: warning: directive in macro's argument list

Fix that by moving the defines out of the struct_group() macro.

Ah, correct, sorry that I missed it during the initial review.

Quoted 13 lines
Fixes de5a1f3ce4c8 ("net: gro: minor optimization for dev_gro_receive()")
---
 include/net/gro.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/net/gro.h +0 -0
index a765fedda5c4..146e2af8dd7d 100644

include/net/gro.h struct napi_gro_cb { · line 39

Quoted 5 lines
include/net/gro.h +2 -0
@@ -35,6 +35,8 @@ struct napi_gro_cb {
 	/* jiffies when first packet was created/queued */
 	unsigned long age;
 
+#define NAPI_GRO_FREE		  1
+#define NAPI_GRO_FREE_STOLEN_HEAD 2

1. Maybe add a comment above the definitions that they belong to the napi_gro_cb::free field?
2. Maybe align the second with tabs while at it?

Quoted 14 lines
include/net/gro.h +0 -2
 	/* portion of the cb set to zero at every gro iteration */
 	struct_group(zeroed,
 
@@ -55,8 +57,6 @@ struct napi_gro_cb {
 
 		/* Free the skb? */
 		u8	free:2;
-#define NAPI_GRO_FREE		  1
-#define NAPI_GRO_FREE_STOLEN_HEAD 2
 
 		/* Used in foo-over-udp, set in udp[46]_gro_receive */
 		u8	is_ipv6:1;
Signature · 1 line
2.25.1

Thanks!
Al

#2 lore raw
Quoted 11 lines · Alexander Lobakin

From: Gal Pressman <[email protected]>
Date: Wed, 16 Feb 2022 12:31:00 +0200

Quoted 5 lines

Following the cited commit, sparse started complaining about:
../include/net/gro.h:58:1: warning: directive in macro's argument list ../include/net/gro.h:59:1: warning: directive in macro's argument list

Fix that by moving the defines out of the struct_group() macro.

Ah, correct, sorry that I missed it during the initial review.

Thank you!

Quoted 15 lines
Quoted 15 lines
Fixes de5a1f3ce4c8 ("net: gro: minor optimization for dev_gro_receive()")
---
 include/net/gro.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/net/gro.h +0 -0
index a765fedda5c4..146e2af8dd7d 100644
@@ -35,6 +35,8 @@ struct napi_gro_cb {
 	/* jiffies when first packet was created/queued */
 	unsigned long age;
 
Quoted 5 lines

include/net/gro.h struct napi_gro_cb { · line 39

Quoted 2 lines
include/net/gro.h +2 -0
+#define NAPI_GRO_FREE		  1
+#define NAPI_GRO_FREE_STOLEN_HEAD 2

1. Maybe add a comment above the definitions that they belong to the napi_gro_cb::free field?
2. Maybe align the second with tabs while at it?

Sure, will add a comment and fix the alignment.