2023-11-21 12:35:01

by Ilpo Järvinen

[permalink] [raw]
Subject: [PATCH v4 1/3] igb: Use FIELD_GET() to extract Link Width

Use FIELD_GET() to extract PCIe Negotiated Link Width field instead of
custom masking and shifting.

Signed-off-by: Ilpo Järvinen <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
---
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/ethernet/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 <linux/bitfield.h>
#include <linux/if_ether.h>
#include <linux/delay.h>
#include <linux/pci.h>
@@ -50,9 +51,8 @@ s32 igb_get_bus_info_pcie(struct e1000_hw *hw)
break;
}

- bus->width = (enum e1000_bus_width)((pcie_link_status &
- PCI_EXP_LNKSTA_NLW) >>
- PCI_EXP_LNKSTA_NLW_SHIFT);
+ bus->width = (enum e1000_bus_width)FIELD_GET(PCI_EXP_LNKSTA_NLW,
+ pcie_link_status);
}

reg = rd32(E1000_STATUS);
--
2.30.2


2023-11-23 11:58:05

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] igb: Use FIELD_GET() to extract Link Width

On Tue, Nov 21, 2023 at 02:34:26PM +0200, Ilpo Järvinen wrote:
> Use FIELD_GET() to extract PCIe Negotiated Link Width field instead of
> custom masking and shifting.
>
> Signed-off-by: Ilpo Järvinen <[email protected]>
> Reviewed-by: Jonathan Cameron <[email protected]>

Thanks, nice to see FIELD_GET() used here.

Reviewed-by: Simon Horman <[email protected]>

2023-11-28 06:24:55

by Pucha, HimasekharX Reddy

[permalink] [raw]
Subject: RE: [Intel-wired-lan] [PATCH v4 1/3] igb: Use FIELD_GET() to extract Link Width

> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf Of Ilpo Järvinen
> Sent: Tuesday, November 21, 2023 6:04 PM
> To: David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; [email protected]; Jakub Kicinski <[email protected]>; Brandeburg, Jesse <[email protected]>; Jonathan Cameron <[email protected]>; [email protected]; Paolo Abeni <[email protected]>; Nguyen, Anthony L <[email protected]>; [email protected]
> Cc: Ilpo Järvinen <[email protected]>
> Subject: [Intel-wired-lan] [PATCH v4 1/3] igb: Use FIELD_GET() to extract Link Width
>
> Use FIELD_GET() to extract PCIe Negotiated Link Width field instead of
> custom masking and shifting.
>
> Signed-off-by: Ilpo Järvinen <[email protected]>
> Reviewed-by: Jonathan Cameron <[email protected]>
> ---
> drivers/net/ethernet/intel/igb/e1000_mac.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>

Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel)