Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3923940pxb; Tue, 10 Nov 2020 03:45:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVriHftQVkOFOquyScg5ugk4Hm61y7dSGqK2Ei9XB4aiQBR9cKAO10LTsiwc8Ma6x7BGHv X-Received: by 2002:a05:6402:7c7:: with SMTP id u7mr20427991edy.351.1605008705044; Tue, 10 Nov 2020 03:45:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605008705; cv=none; d=google.com; s=arc-20160816; b=Ujfl+54TXbuvQIJ8bPempSx4z90jDhLTdJwKsE+QbTXw4/clB5b8H67PLNtavXvhxQ 1knuMiOvXEswQ/15p4HCJNJH2sJ5hSE3R9/O/9KWuzKWEw7UXjYCuEW+/UMTXZ2b4KWv MoQoZckoTJq9h/aPxpqsYHHfKyQhxKf7pFugpMm3cGa+l/i6OZqwbrjPbHw5jNamONYa 6W16NGPq6coYhgMeaWeGi1EcPYyMDrcAVf8TTsimmp5lyikFhXpikROgTUPTd0tX5uMF lK4aT+Qkb6hs4dwybBBzhIxzWThBqT4uCSS+B580XOYYaN5sG5sclrxz4JkRW/gaEV+K E0Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=sR/UmW8U9HUE0hsqjkJo2y1L+rZQCSVJTJabk4GdygE=; b=lX64Yd5SgRRT3lt7OWTS0e/5V31SMo0YvQPHhwE039vofHr/iF4Mf6xs47TqAyDka1 eVa8ef2t5IGQRhwh/MQZyhNm4QAIWZz389g15H6a8b86PooWFTFrJLJTbbVZQ29Ffi5c jzDjCHGDOO3PonZVgDRue/QnYWa51U7BLMfgZLg+9bFhLkw5U25U3FO5TqxWzNNzPxrD bCT/N+a+2ZNB658siaFSilOwURq+O/YMvcGVxnf+zH2Y4n+zzMslyduCXpZxvETdNU7h tmzk3KEbNY00xeRtli7iGl5iOu1Mmtag6MZZx/zjGdqJtxOSTg1XYG6no+2Jryzihosj p73g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U8Z9McCc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qu15si810780ejb.40.2020.11.10.03.44.41; Tue, 10 Nov 2020 03:45:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U8Z9McCc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729359AbgKJLn0 (ORCPT + 99 others); Tue, 10 Nov 2020 06:43:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:51701 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726428AbgKJLnV (ORCPT ); Tue, 10 Nov 2020 06:43:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605008600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sR/UmW8U9HUE0hsqjkJo2y1L+rZQCSVJTJabk4GdygE=; b=U8Z9McCcIqAPH6AtZEEvzkLbc8rZVbxxlNK7ztuhkFau9RclJEFVB9XqgiazgM4E5ihPo3 dkGjo5fKEJEcaUrkHINDuMs1iwxGqY49QG/lJqeE7ySBv97WozvfeV4SBtiRfVyV/epC7k 4vNed5UQhIza6TaxvnAdhppO30SH2ok= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-594-iirgclJONoiU29HV8K3LzQ-1; Tue, 10 Nov 2020 06:43:18 -0500 X-MC-Unique: iirgclJONoiU29HV8K3LzQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 884B6802B51; Tue, 10 Nov 2020 11:43:16 +0000 (UTC) Received: from carbon (unknown [10.36.110.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6948E5B4A4; Tue, 10 Nov 2020 11:43:13 +0000 (UTC) Date: Tue, 10 Nov 2020 12:43:09 +0100 From: Jesper Dangaard Brouer To: John Fastabend Cc: Alex Shi , davem@davemloft.net, Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net/xdp: remove unused macro REG_STATE_NEW Message-ID: <20201110124309.6240df73@carbon> In-Reply-To: <5fa9b850d6de5_8c0e2089d@john-XPS-13-9370.notmuch> References: <1604641431-6295-1-git-send-email-alex.shi@linux.alibaba.com> <20201106171352.5c51342d@carbon> <3d39a08d-2e50-efeb-214f-0c7c2d1605d7@linux.alibaba.com> <5fa9b850d6de5_8c0e2089d@john-XPS-13-9370.notmuch> Organization: Red Hat Inc. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 09 Nov 2020 13:44:48 -0800 John Fastabend wrote: > Alex Shi wrote: > >=20 > >=20 > > =E5=9C=A8 2020/11/7 =E4=B8=8A=E5=8D=8812:13, Jesper Dangaard Brouer =E5= =86=99=E9=81=93: =20 > > > 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. > > >=20 > > > It is mentioned in a comment, so please send V2 with this additional = change: =20 > >=20 > > Hi Jesper, > >=20 > > Thanks a lot for comments. here is the v2: > >=20 > > From 2908d25bf2e1c90ad71a83ba056743f45da283e8 Mon Sep 17 00:00:00 2001 > > From: Alex Shi > > Date: Fri, 6 Nov 2020 13:41:58 +0800 > > Subject: [PATCH v2] net/xdp: remove unused macro REG_STATE_NEW > >=20 > > 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. > >=20 > > Signed-off-by: Alex Shi > > --- =20 >=20 > > net/core/xdp.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > >=20 > > 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 > > #include > > =20 > > -#define REG_STATE_NEW 0x0 > > #define REG_STATE_REGISTERED 0x1 > > #define REG_STATE_UNREGISTERED 0x2 > > #define REG_STATE_UNUSED 0x3 =20 >=20 > 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. I agree having the define there makes it more readable and clear what the zero state is. We can also add code that replace the comment, that check/use these defines. It is slow-path code, so it doesn't hurt to add this extra code. Generally I find it strange to "fix" these kind of warnings, but also don't care that we do fix them if it helps someone else spot code where it actually matters. > Acked-by: John Fastabend >=20 > > @@ -175,7 +174,7 @@ int xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq, > > return -ENODEV; > > } > > =20 > > - /* State either UNREGISTERED or NEW */ > > + /* State either UNREGISTERED or zero */ > > xdp_rxq_info_init(xdp_rxq); > > xdp_rxq->dev =3D dev; > > xdp_rxq->queue_index =3D queue_index; > > --=20 > > 1.8.3.1 > > =20 >=20 >=20 --=20 Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer