netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Alex Shi <alex.shi@linux.alibaba.com>,
	Jesper Dangaard Brouer <jbrouer@redhat.com>
Cc: davem@davemloft.net, Jakub Kicinski <kuba@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net/xdp: remove unused macro REG_STATE_NEW
Date: Mon, 09 Nov 2020 13:44:48 -0800	[thread overview]
Message-ID: <5fa9b850d6de5_8c0e2089d@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <3d39a08d-2e50-efeb-214f-0c7c2d1605d7@linux.alibaba.com>

Alex Shi wrote:
> 
> 
> 在 2020/11/7 上午12:13, Jesper Dangaard Brouer 写道:
> > Hmm... REG_STATE_NEW is zero, so it is implicitly set via memset zero.
> > But it is true that it is technically not directly used or referenced.
> > 
> > It is mentioned in a comment, so please send V2 with this additional change:
> 
> Hi Jesper,
> 
> Thanks a lot for comments. here is the v2:
> 
> From 2908d25bf2e1c90ad71a83ba056743f45da283e8 Mon Sep 17 00:00:00 2001
> From: Alex Shi <alex.shi@linux.alibaba.com>
> Date: Fri, 6 Nov 2020 13:41:58 +0800
> Subject: [PATCH v2] net/xdp: remove unused macro REG_STATE_NEW
> 
> To tame gcc warning on it:
> net/core/xdp.c:20:0: warning: macro "REG_STATE_NEW" is not used
> [-Wunused-macros]
> And change related comments as Jesper Dangaard Brouer suggested.
> 
> Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
> ---

>  net/core/xdp.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/core/xdp.c b/net/core/xdp.c
> index 48aba933a5a8..0df5ee5682d9 100644
> --- a/net/core/xdp.c
> +++ b/net/core/xdp.c
> @@ -19,7 +19,6 @@
>  #include <trace/events/xdp.h>
>  #include <net/xdp_sock_drv.h>
>  
> -#define REG_STATE_NEW		0x0
>  #define REG_STATE_REGISTERED	0x1
>  #define REG_STATE_UNREGISTERED	0x2
>  #define REG_STATE_UNUSED	0x3

I think having the define there makes it more readable and clear what
the zero state is. But if we run with unused-macros I guess its even
uglier to try and mark it with unused attribute.

Acked-by: John Fastabend <john.fastabend@gmail.com>

> @@ -175,7 +174,7 @@ int xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq,
>  		return -ENODEV;
>  	}
>  
> -	/* State either UNREGISTERED or NEW */
> +	/* State either UNREGISTERED or zero */
>  	xdp_rxq_info_init(xdp_rxq);
>  	xdp_rxq->dev = dev;
>  	xdp_rxq->queue_index = queue_index;
> -- 
> 1.8.3.1
> 



  reply	other threads:[~2020-11-09 21:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06  5:43 [PATCH] net/xdp: remove unused macro REG_STATE_NEW Alex Shi
2020-11-06 16:13 ` Jesper Dangaard Brouer
2020-11-07 13:08   ` Alex Shi
2020-11-09 21:44     ` John Fastabend [this message]
2020-11-10 11:43       ` Jesper Dangaard Brouer

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=5fa9b850d6de5_8c0e2089d@john-XPS-13-9370.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=alex.shi@linux.alibaba.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=hawk@kernel.org \
    --cc=jbrouer@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).