netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: gro: Fix a 'directive in macro's argument list' sparse warning
@ 2022-02-16 10:31 Gal Pressman
  2022-02-16 14:06 ` Alexander Lobakin
  0 siblings, 1 reply; 3+ messages in thread
From: Gal Pressman @ 2022-02-16 10:31 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: netdev, Paolo Abeni, Gal Pressman, Maxim Mikityanskiy

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()")
Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
 include/net/gro.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net/gro.h b/include/net/gro.h
index a765fedda5c4..146e2af8dd7d 100644
--- a/include/net/gro.h
+++ b/include/net/gro.h
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: gro: Fix a 'directive in macro's argument list' sparse warning
  2022-02-16 10:31 [PATCH net-next] net: gro: Fix a 'directive in macro's argument list' sparse warning Gal Pressman
@ 2022-02-16 14:06 ` Alexander Lobakin
  2022-02-16 18:49   ` Gal Pressman
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Lobakin @ 2022-02-16 14:06 UTC (permalink / raw)
  To: Gal Pressman
  Cc: Alexander Lobakin, David S. Miller, Jakub Kicinski, netdev,
	Paolo Abeni, Maxim Mikityanskiy

From: Gal Pressman <gal@nvidia.com>
Date: Wed, 16 Feb 2022 12:31:00 +0200

> 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.

Acked-by: Alexander Lobakin <alexandr.lobakin@intel.com>

> 
> Fixes: de5a1f3ce4c8 ("net: gro: minor optimization for dev_gro_receive()")
> Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
> Signed-off-by: Gal Pressman <gal@nvidia.com>
> ---
>  include/net/gro.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/net/gro.h b/include/net/gro.h
> index a765fedda5c4..146e2af8dd7d 100644
> --- a/include/net/gro.h
> +++ b/include/net/gro.h
> @@ -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?

>  	/* 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;
> -- 
> 2.25.1

Thanks!
Al

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: gro: Fix a 'directive in macro's argument list' sparse warning
  2022-02-16 14:06 ` Alexander Lobakin
@ 2022-02-16 18:49   ` Gal Pressman
  0 siblings, 0 replies; 3+ messages in thread
From: Gal Pressman @ 2022-02-16 18:49 UTC (permalink / raw)
  To: Alexander Lobakin
  Cc: David S. Miller, Jakub Kicinski, netdev, Paolo Abeni,
	Maxim Mikityanskiy

On 16/02/2022 16:06, Alexander Lobakin wrote:
> From: Gal Pressman <gal@nvidia.com>
> Date: Wed, 16 Feb 2022 12:31:00 +0200
>
>> 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.
>
> Acked-by: Alexander Lobakin <alexandr.lobakin@intel.com>

Thank you!

>> Fixes: de5a1f3ce4c8 ("net: gro: minor optimization for dev_gro_receive()")
>> Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com>
>> Signed-off-by: Gal Pressman <gal@nvidia.com>
>> ---
>>  include/net/gro.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/net/gro.h b/include/net/gro.h
>> index a765fedda5c4..146e2af8dd7d 100644
>> --- a/include/net/gro.h
>> +++ b/include/net/gro.h
>> @@ -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?

Sure, will add a comment and fix the alignment.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-16 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-16 10:31 [PATCH net-next] net: gro: Fix a 'directive in macro's argument list' sparse warning Gal Pressman
2022-02-16 14:06 ` Alexander Lobakin
2022-02-16 18:49   ` Gal Pressman

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).