From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2601DCA0EF2 for ; Tue, 12 Sep 2023 15:08:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id AB35E40629; Tue, 12 Sep 2023 15:08:00 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org AB35E40629 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1694531280; bh=sfTUSzNf5QwWZqe9Z1YyUttaMxjtpePGc1U1wXAsq3Y=; h=Date:From:To:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=tHxwcv1dxYOcK92I5erlPddP8VQ4UTOS8f16fGYu8Wuyt+UK+SGFAbYQ4gkAKdjiT rHVn5XnboPFrsS/Y8WXlmXBmmxKiswkCf6hDXh4lDLEut5HjgupAILCnot2O+jOTub KEpxMLR0v4amyYfyG3WloQrQPOhcmLQvYTgyhhqt3kl+b70BbN3ro81bn4uGaNpmpP bfuuu5EUUrMnCrh2HxA0qBdajybyaYdWCkLa2Sxd5bd0aGm3c2bUIJsG+7Gd1+vmo0 dAaPQ0vuiLKM8q/2A7HxMCad/MRgNrg9mfwwFdHPtC2DTZzmVkmyBZxxSOpUjaygWI M5u43CcxqO3Rg== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4gSgkvwoGuEk; Tue, 12 Sep 2023 15:07:58 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 8F3A540432; Tue, 12 Sep 2023 15:07:58 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 8F3A540432 Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 8E83E1BF27E for ; Tue, 12 Sep 2023 10:50:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 668ED82062 for ; Tue, 12 Sep 2023 10:50:46 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 668ED82062 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Uw2eaSznS2XP for ; Tue, 12 Sep 2023 10:50:45 +0000 (UTC) X-Greylist: delayed 997 seconds by postgrey-1.37 at util1.osuosl.org; Tue, 12 Sep 2023 10:50:45 UTC DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 52E8782052 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 52E8782052 for ; Tue, 12 Sep 2023 10:50:45 +0000 (UTC) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4RlKZZ4gLPz6J7jc; Tue, 12 Sep 2023 18:29:26 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 12 Sep 2023 11:34:04 +0100 Date: Tue, 12 Sep 2023 11:34:03 +0100 From: Jonathan Cameron To: Ilpo =?ISO-8859-1?Q?J=E4rvinen?= Message-ID: <20230912113403.00006c39@Huawei.com> In-Reply-To: <20230911121501.21910-4-ilpo.jarvinen@linux.intel.com> References: <20230911121501.21910-1-ilpo.jarvinen@linux.intel.com> <20230911121501.21910-4-ilpo.jarvinen@linux.intel.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Mailman-Approved-At: Tue, 12 Sep 2023 15:07:56 +0000 Subject: Re: [Intel-wired-lan] [PATCH 3/8] igb: Use FIELD_GET() to extract Link Width X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pci@vger.kernel.org, Jesse Brandeburg , linux-kernel@vger.kernel.org, Eric Dumazet , netdev@vger.kernel.org, Tony Nguyen , Jakub Kicinski , Bjorn Helgaas , Paolo Abeni , "David S. Miller" , intel-wired-lan@lists.osuosl.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Mon, 11 Sep 2023 15:14:56 +0300 Ilpo J=E4rvinen wrote: > Use FIELD_GET() to extract PCIe Negotiated Link Width field instead of > custom masking and shifting. > = > Signed-off-by: Ilpo J=E4rvinen > --- > drivers/net/ethernet/intel/igb/e1000_mac.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > = > diff --git a/drivers/net/ethernet/intel/igb/e1000_mac.c b/drivers/net/eth= ernet/intel/igb/e1000_mac.c > index caf91c6f52b4..5a23b9cfec6c 100644 > --- a/drivers/net/ethernet/intel/igb/e1000_mac.c > +++ b/drivers/net/ethernet/intel/igb/e1000_mac.c > @@ -1,6 +1,7 @@ > // SPDX-License-Identifier: GPL-2.0 > /* Copyright(c) 2007 - 2018 Intel Corporation. */ > = > +#include > #include > #include > #include > @@ -50,9 +51,8 @@ s32 igb_get_bus_info_pcie(struct e1000_hw *hw) > break; > } > = > - bus->width =3D (enum e1000_bus_width)((pcie_link_status & > - PCI_EXP_LNKSTA_NLW) >> > - PCI_EXP_LNKSTA_NLW_SHIFT); > + bus->width =3D (enum e1000_bus_width)FIELD_GET(PCI_EXP_LNKSTA_NLW, > + pcie_link_status); This cast is a bit ugly given it takes the values 0, 1, 2, 3 and we extra a field that the spec says contains 1, 2, 4, 8 etc Hence it only works because only 1 and 2 are used I think... Not nice. Also, whilst looking at this I note that e1000e has it's own defines for PCIE_LINK_WIDTH_MASK and PCIE_LINK_WIDTH_SHIFT = Looks like those should be changed to use the standard defines. For extra giggles there are two e1000_bus_width enum definitions in differe= nt headers. Actual patch is good - just 'interesting' stuff noticed whilst looking at i= t :) Jonathan > } > = > reg =3D rd32(E1000_STATUS); _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan