Skip to content

Commit 74f88c1

Browse files
committed
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2020-12-23 Commit e086ba2 ("e1000e: disable s0ix entry and exit flows for ME systems") disabled S0ix flows for systems that have various incarnations of the i219-LM ethernet controller. This was done because of some regressions caused by an earlier commit 632fbd5 ("e1000e: fix S0ix flows for cable connected case") with i219-LM controller. Per discussion with Intel architecture team this direction should be changed and allow S0ix flows to be used by default. This patch series includes directional changes for their conclusions in https://lkml.org/lkml/2020/12/13/15. * '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: e1000e: Export S0ix flags to ethtool Revert "e1000e: disable s0ix entry and exit flows for ME systems" e1000e: bump up timeout to wait when ME un-configures ULP mode e1000e: Only run S0ix flows if shutdown succeeded ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents e7579d5 + 3c98cbf commit 74f88c1

File tree

4 files changed

+71
-52
lines changed

4 files changed

+71
-52
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca);
436436
#define FLAG2_DFLT_CRC_STRIPPING BIT(12)
437437
#define FLAG2_CHECK_RX_HWTSTAMP BIT(13)
438438
#define FLAG2_CHECK_SYSTIM_OVERFLOW BIT(14)
439+
#define FLAG2_ENABLE_S0IX_FLOWS BIT(15)
439440

440441
#define E1000_RX_DESC_PS(R, i) \
441442
(&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ struct e1000_stats {
2323
int stat_offset;
2424
};
2525

26+
static const char e1000e_priv_flags_strings[][ETH_GSTRING_LEN] = {
27+
#define E1000E_PRIV_FLAGS_S0IX_ENABLED BIT(0)
28+
"s0ix-enabled",
29+
};
30+
31+
#define E1000E_PRIV_FLAGS_STR_LEN ARRAY_SIZE(e1000e_priv_flags_strings)
32+
2633
#define E1000_STAT(str, m) { \
2734
.stat_string = str, \
2835
.type = E1000_STATS, \
@@ -1776,6 +1783,8 @@ static int e1000e_get_sset_count(struct net_device __always_unused *netdev,
17761783
return E1000_TEST_LEN;
17771784
case ETH_SS_STATS:
17781785
return E1000_STATS_LEN;
1786+
case ETH_SS_PRIV_FLAGS:
1787+
return E1000E_PRIV_FLAGS_STR_LEN;
17791788
default:
17801789
return -EOPNOTSUPP;
17811790
}
@@ -2097,6 +2106,10 @@ static void e1000_get_strings(struct net_device __always_unused *netdev,
20972106
p += ETH_GSTRING_LEN;
20982107
}
20992108
break;
2109+
case ETH_SS_PRIV_FLAGS:
2110+
memcpy(data, e1000e_priv_flags_strings,
2111+
E1000E_PRIV_FLAGS_STR_LEN * ETH_GSTRING_LEN);
2112+
break;
21002113
}
21012114
}
21022115

@@ -2305,6 +2318,37 @@ static int e1000e_get_ts_info(struct net_device *netdev,
23052318
return 0;
23062319
}
23072320

2321+
static u32 e1000e_get_priv_flags(struct net_device *netdev)
2322+
{
2323+
struct e1000_adapter *adapter = netdev_priv(netdev);
2324+
u32 priv_flags = 0;
2325+
2326+
if (adapter->flags2 & FLAG2_ENABLE_S0IX_FLOWS)
2327+
priv_flags |= E1000E_PRIV_FLAGS_S0IX_ENABLED;
2328+
2329+
return priv_flags;
2330+
}
2331+
2332+
static int e1000e_set_priv_flags(struct net_device *netdev, u32 priv_flags)
2333+
{
2334+
struct e1000_adapter *adapter = netdev_priv(netdev);
2335+
unsigned int flags2 = adapter->flags2;
2336+
2337+
flags2 &= ~FLAG2_ENABLE_S0IX_FLOWS;
2338+
if (priv_flags & E1000E_PRIV_FLAGS_S0IX_ENABLED) {
2339+
struct e1000_hw *hw = &adapter->hw;
2340+
2341+
if (hw->mac.type < e1000_pch_cnp)
2342+
return -EINVAL;
2343+
flags2 |= FLAG2_ENABLE_S0IX_FLOWS;
2344+
}
2345+
2346+
if (flags2 != adapter->flags2)
2347+
adapter->flags2 = flags2;
2348+
2349+
return 0;
2350+
}
2351+
23082352
static const struct ethtool_ops e1000_ethtool_ops = {
23092353
.supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS,
23102354
.get_drvinfo = e1000_get_drvinfo,
@@ -2336,6 +2380,8 @@ static const struct ethtool_ops e1000_ethtool_ops = {
23362380
.set_eee = e1000e_set_eee,
23372381
.get_link_ksettings = e1000_get_link_ksettings,
23382382
.set_link_ksettings = e1000_set_link_ksettings,
2383+
.get_priv_flags = e1000e_get_priv_flags,
2384+
.set_priv_flags = e1000e_set_priv_flags,
23392385
};
23402386

23412387
void e1000e_set_ethtool_ops(struct net_device *netdev)

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,9 @@ static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force)
12401240
return 0;
12411241

12421242
if (er32(FWSM) & E1000_ICH_FWSM_FW_VALID) {
1243+
struct e1000_adapter *adapter = hw->adapter;
1244+
bool firmware_bug = false;
1245+
12431246
if (force) {
12441247
/* Request ME un-configure ULP mode in the PHY */
12451248
mac_reg = er32(H2ME);
@@ -1248,16 +1251,24 @@ static s32 e1000_disable_ulp_lpt_lp(struct e1000_hw *hw, bool force)
12481251
ew32(H2ME, mac_reg);
12491252
}
12501253

1251-
/* Poll up to 300msec for ME to clear ULP_CFG_DONE. */
1254+
/* Poll up to 2.5 seconds for ME to clear ULP_CFG_DONE.
1255+
* If this takes more than 1 second, show a warning indicating a
1256+
* firmware bug
1257+
*/
12521258
while (er32(FWSM) & E1000_FWSM_ULP_CFG_DONE) {
1253-
if (i++ == 30) {
1259+
if (i++ == 250) {
12541260
ret_val = -E1000_ERR_PHY;
12551261
goto out;
12561262
}
1263+
if (i > 100 && !firmware_bug)
1264+
firmware_bug = true;
12571265

12581266
usleep_range(10000, 11000);
12591267
}
1260-
e_dbg("ULP_CONFIG_DONE cleared after %dmsec\n", i * 10);
1268+
if (firmware_bug)
1269+
e_warn("ULP_CONFIG_DONE took %dmsec. This is a firmware bug\n", i * 10);
1270+
else
1271+
e_dbg("ULP_CONFIG_DONE cleared after %dmsec\n", i * 10);
12611272

12621273
if (force) {
12631274
mac_reg = er32(H2ME);

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

Lines changed: 10 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -103,45 +103,6 @@ static const struct e1000_reg_info e1000_reg_info_tbl[] = {
103103
{0, NULL}
104104
};
105105

106-
struct e1000e_me_supported {
107-
u16 device_id; /* supported device ID */
108-
};
109-
110-
static const struct e1000e_me_supported me_supported[] = {
111-
{E1000_DEV_ID_PCH_LPT_I217_LM},
112-
{E1000_DEV_ID_PCH_LPTLP_I218_LM},
113-
{E1000_DEV_ID_PCH_I218_LM2},
114-
{E1000_DEV_ID_PCH_I218_LM3},
115-
{E1000_DEV_ID_PCH_SPT_I219_LM},
116-
{E1000_DEV_ID_PCH_SPT_I219_LM2},
117-
{E1000_DEV_ID_PCH_LBG_I219_LM3},
118-
{E1000_DEV_ID_PCH_SPT_I219_LM4},
119-
{E1000_DEV_ID_PCH_SPT_I219_LM5},
120-
{E1000_DEV_ID_PCH_CNP_I219_LM6},
121-
{E1000_DEV_ID_PCH_CNP_I219_LM7},
122-
{E1000_DEV_ID_PCH_ICP_I219_LM8},
123-
{E1000_DEV_ID_PCH_ICP_I219_LM9},
124-
{E1000_DEV_ID_PCH_CMP_I219_LM10},
125-
{E1000_DEV_ID_PCH_CMP_I219_LM11},
126-
{E1000_DEV_ID_PCH_CMP_I219_LM12},
127-
{E1000_DEV_ID_PCH_TGP_I219_LM13},
128-
{E1000_DEV_ID_PCH_TGP_I219_LM14},
129-
{E1000_DEV_ID_PCH_TGP_I219_LM15},
130-
{0}
131-
};
132-
133-
static bool e1000e_check_me(u16 device_id)
134-
{
135-
struct e1000e_me_supported *id;
136-
137-
for (id = (struct e1000e_me_supported *)me_supported;
138-
id->device_id; id++)
139-
if (device_id == id->device_id)
140-
return true;
141-
142-
return false;
143-
}
144-
145106
/**
146107
* __ew32_prepare - prepare to write to MAC CSR register on certain parts
147108
* @hw: pointer to the HW structure
@@ -6962,21 +6923,20 @@ static __maybe_unused int e1000e_pm_suspend(struct device *dev)
69626923
struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
69636924
struct e1000_adapter *adapter = netdev_priv(netdev);
69646925
struct pci_dev *pdev = to_pci_dev(dev);
6965-
struct e1000_hw *hw = &adapter->hw;
69666926
int rc;
69676927

69686928
e1000e_flush_lpic(pdev);
69696929

69706930
e1000e_pm_freeze(dev);
69716931

69726932
rc = __e1000_shutdown(pdev, false);
6973-
if (rc)
6933+
if (rc) {
69746934
e1000e_pm_thaw(dev);
6975-
6976-
/* Introduce S0ix implementation */
6977-
if (hw->mac.type >= e1000_pch_cnp &&
6978-
!e1000e_check_me(hw->adapter->pdev->device))
6979-
e1000e_s0ix_entry_flow(adapter);
6935+
} else {
6936+
/* Introduce S0ix implementation */
6937+
if (adapter->flags2 & FLAG2_ENABLE_S0IX_FLOWS)
6938+
e1000e_s0ix_entry_flow(adapter);
6939+
}
69806940

69816941
return rc;
69826942
}
@@ -6986,12 +6946,10 @@ static __maybe_unused int e1000e_pm_resume(struct device *dev)
69866946
struct net_device *netdev = pci_get_drvdata(to_pci_dev(dev));
69876947
struct e1000_adapter *adapter = netdev_priv(netdev);
69886948
struct pci_dev *pdev = to_pci_dev(dev);
6989-
struct e1000_hw *hw = &adapter->hw;
69906949
int rc;
69916950

69926951
/* Introduce S0ix implementation */
6993-
if (hw->mac.type >= e1000_pch_cnp &&
6994-
!e1000e_check_me(hw->adapter->pdev->device))
6952+
if (adapter->flags2 & FLAG2_ENABLE_S0IX_FLOWS)
69956953
e1000e_s0ix_exit_flow(adapter);
69966954

69976955
rc = __e1000_resume(pdev);
@@ -7655,6 +7613,9 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
76557613
if (!(adapter->flags & FLAG_HAS_AMT))
76567614
e1000e_get_hw_control(adapter);
76577615

7616+
if (hw->mac.type >= e1000_pch_cnp)
7617+
adapter->flags2 |= FLAG2_ENABLE_S0IX_FLOWS;
7618+
76587619
strlcpy(netdev->name, "eth%d", sizeof(netdev->name));
76597620
err = register_netdev(netdev);
76607621
if (err)

0 commit comments

Comments
 (0)