Skip to content

Commit 00b1b22

Browse files
committed
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2023-12-12 (igb, e1000e) This series contains updates to igb and e1000e drivers. Ilpo Järvinen does some cleanups to both drivers: utilizing FIELD_GET() helpers and using standard kernel defines over driver created ones. * '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue: e1000e: Use pcie_capability_read_word() for reading LNKSTA e1000e: Use PCI_EXP_LNKSTA_NLW & FIELD_GET() instead of custom defines/code igb: Use FIELD_GET() to extract Link Width ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 04c0472 + bf88f7d commit 00b1b22

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

drivers/net/ethernet/intel/e1000e/defines.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,11 +678,8 @@
678678

679679
/* PCI/PCI-X/PCI-EX Config space */
680680
#define PCI_HEADER_TYPE_REGISTER 0x0E
681-
#define PCIE_LINK_STATUS 0x12
682681

683682
#define PCI_HEADER_TYPE_MULTIFUNC 0x80
684-
#define PCIE_LINK_WIDTH_MASK 0x3F0
685-
#define PCIE_LINK_WIDTH_SHIFT 4
686683

687684
#define PHY_REVISION_MASK 0xFFFFFFF0
688685
#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */

drivers/net/ethernet/intel/e1000e/mac.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/* Copyright(c) 1999 - 2018 Intel Corporation. */
33

4+
#include <linux/bitfield.h>
5+
46
#include "e1000.h"
57

68
/**
@@ -13,21 +15,17 @@
1315
**/
1416
s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw)
1517
{
18+
struct pci_dev *pdev = hw->adapter->pdev;
1619
struct e1000_mac_info *mac = &hw->mac;
1720
struct e1000_bus_info *bus = &hw->bus;
18-
struct e1000_adapter *adapter = hw->adapter;
19-
u16 pcie_link_status, cap_offset;
21+
u16 pcie_link_status;
2022

21-
cap_offset = adapter->pdev->pcie_cap;
22-
if (!cap_offset) {
23+
if (!pci_pcie_cap(pdev)) {
2324
bus->width = e1000_bus_width_unknown;
2425
} else {
25-
pci_read_config_word(adapter->pdev,
26-
cap_offset + PCIE_LINK_STATUS,
27-
&pcie_link_status);
28-
bus->width = (enum e1000_bus_width)((pcie_link_status &
29-
PCIE_LINK_WIDTH_MASK) >>
30-
PCIE_LINK_WIDTH_SHIFT);
26+
pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &pcie_link_status);
27+
bus->width = (enum e1000_bus_width)FIELD_GET(PCI_EXP_LNKSTA_NLW,
28+
pcie_link_status);
3129
}
3230

3331
mac->ops.set_lan_id(hw);

drivers/net/ethernet/intel/igb/e1000_mac.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/* Copyright(c) 2007 - 2018 Intel Corporation. */
33

4+
#include <linux/bitfield.h>
45
#include <linux/if_ether.h>
56
#include <linux/delay.h>
67
#include <linux/pci.h>
@@ -50,9 +51,8 @@ s32 igb_get_bus_info_pcie(struct e1000_hw *hw)
5051
break;
5152
}
5253

53-
bus->width = (enum e1000_bus_width)((pcie_link_status &
54-
PCI_EXP_LNKSTA_NLW) >>
55-
PCI_EXP_LNKSTA_NLW_SHIFT);
54+
bus->width = (enum e1000_bus_width)FIELD_GET(PCI_EXP_LNKSTA_NLW,
55+
pcie_link_status);
5656
}
5757

5858
reg = rd32(E1000_STATUS);

0 commit comments

Comments
 (0)