Skip to content

Commit 46002bf

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 2021-08-20 This series contains updates to igc and e1000e drivers. Aaron Ma resolves a page fault which occurs when thunderbolt is unplugged for igc. Toshiki Nishioka fixes Tx queue looping to use actual number of queues instead of max value for igc. Sasha fixes an incorrect latency comparison by decoding the values before comparing and prevents attempted writes to read-only NVMs for e1000e. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 5ed74b0 + 4051f68 commit 46002bf

File tree

4 files changed

+50
-24
lines changed

4 files changed

+50
-24
lines changed

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

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
10061006
{
10071007
u32 reg = link << (E1000_LTRV_REQ_SHIFT + E1000_LTRV_NOSNOOP_SHIFT) |
10081008
link << E1000_LTRV_REQ_SHIFT | E1000_LTRV_SEND;
1009+
u16 max_ltr_enc_d = 0; /* maximum LTR decoded by platform */
1010+
u16 lat_enc_d = 0; /* latency decoded */
10091011
u16 lat_enc = 0; /* latency encoded */
10101012

10111013
if (link) {
@@ -1059,7 +1061,17 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
10591061
E1000_PCI_LTR_CAP_LPT + 2, &max_nosnoop);
10601062
max_ltr_enc = max_t(u16, max_snoop, max_nosnoop);
10611063

1062-
if (lat_enc > max_ltr_enc)
1064+
lat_enc_d = (lat_enc & E1000_LTRV_VALUE_MASK) *
1065+
(1U << (E1000_LTRV_SCALE_FACTOR *
1066+
((lat_enc & E1000_LTRV_SCALE_MASK)
1067+
>> E1000_LTRV_SCALE_SHIFT)));
1068+
1069+
max_ltr_enc_d = (max_ltr_enc & E1000_LTRV_VALUE_MASK) *
1070+
(1U << (E1000_LTRV_SCALE_FACTOR *
1071+
((max_ltr_enc & E1000_LTRV_SCALE_MASK)
1072+
>> E1000_LTRV_SCALE_SHIFT)));
1073+
1074+
if (lat_enc_d > max_ltr_enc_d)
10631075
lat_enc = max_ltr_enc;
10641076
}
10651077

@@ -4115,13 +4127,17 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)
41154127
return ret_val;
41164128

41174129
if (!(data & valid_csum_mask)) {
4118-
data |= valid_csum_mask;
4119-
ret_val = e1000_write_nvm(hw, word, 1, &data);
4120-
if (ret_val)
4121-
return ret_val;
4122-
ret_val = e1000e_update_nvm_checksum(hw);
4123-
if (ret_val)
4124-
return ret_val;
4130+
e_dbg("NVM Checksum Invalid\n");
4131+
4132+
if (hw->mac.type < e1000_pch_cnp) {
4133+
data |= valid_csum_mask;
4134+
ret_val = e1000_write_nvm(hw, word, 1, &data);
4135+
if (ret_val)
4136+
return ret_val;
4137+
ret_val = e1000e_update_nvm_checksum(hw);
4138+
if (ret_val)
4139+
return ret_val;
4140+
}
41254141
}
41264142

41274143
return e1000e_validate_nvm_checksum_generic(hw);

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

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

275275
/* Latency Tolerance Reporting */
276276
#define E1000_LTRV 0x000F8
277+
#define E1000_LTRV_VALUE_MASK 0x000003FF
277278
#define E1000_LTRV_SCALE_MAX 5
278279
#define E1000_LTRV_SCALE_FACTOR 5
280+
#define E1000_LTRV_SCALE_SHIFT 10
281+
#define E1000_LTRV_SCALE_MASK 0x00001C00
279282
#define E1000_LTRV_REQ_SHIFT 15
280283
#define E1000_LTRV_NOSNOOP_SHIFT 16
281284
#define E1000_LTRV_SEND (1 << 30)

drivers/net/ethernet/intel/igc/igc_main.c

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ static void igc_release_hw_control(struct igc_adapter *adapter)
149149
struct igc_hw *hw = &adapter->hw;
150150
u32 ctrl_ext;
151151

152+
if (!pci_device_is_present(adapter->pdev))
153+
return;
154+
152155
/* Let firmware take over control of h/w */
153156
ctrl_ext = rd32(IGC_CTRL_EXT);
154157
wr32(IGC_CTRL_EXT,
@@ -4449,26 +4452,29 @@ void igc_down(struct igc_adapter *adapter)
44494452

44504453
igc_ptp_suspend(adapter);
44514454

4452-
/* disable receives in the hardware */
4453-
rctl = rd32(IGC_RCTL);
4454-
wr32(IGC_RCTL, rctl & ~IGC_RCTL_EN);
4455-
/* flush and sleep below */
4456-
4455+
if (pci_device_is_present(adapter->pdev)) {
4456+
/* disable receives in the hardware */
4457+
rctl = rd32(IGC_RCTL);
4458+
wr32(IGC_RCTL, rctl & ~IGC_RCTL_EN);
4459+
/* flush and sleep below */
4460+
}
44574461
/* set trans_start so we don't get spurious watchdogs during reset */
44584462
netif_trans_update(netdev);
44594463

44604464
netif_carrier_off(netdev);
44614465
netif_tx_stop_all_queues(netdev);
44624466

4463-
/* disable transmits in the hardware */
4464-
tctl = rd32(IGC_TCTL);
4465-
tctl &= ~IGC_TCTL_EN;
4466-
wr32(IGC_TCTL, tctl);
4467-
/* flush both disables and wait for them to finish */
4468-
wrfl();
4469-
usleep_range(10000, 20000);
4467+
if (pci_device_is_present(adapter->pdev)) {
4468+
/* disable transmits in the hardware */
4469+
tctl = rd32(IGC_TCTL);
4470+
tctl &= ~IGC_TCTL_EN;
4471+
wr32(IGC_TCTL, tctl);
4472+
/* flush both disables and wait for them to finish */
4473+
wrfl();
4474+
usleep_range(10000, 20000);
44704475

4471-
igc_irq_disable(adapter);
4476+
igc_irq_disable(adapter);
4477+
}
44724478

44734479
adapter->flags &= ~IGC_FLAG_NEED_LINK_UPDATE;
44744480

@@ -5489,7 +5495,7 @@ static bool validate_schedule(struct igc_adapter *adapter,
54895495
if (e->command != TC_TAPRIO_CMD_SET_GATES)
54905496
return false;
54915497

5492-
for (i = 0; i < IGC_MAX_TX_QUEUES; i++) {
5498+
for (i = 0; i < adapter->num_tx_queues; i++) {
54935499
if (e->gate_mask & BIT(i))
54945500
queue_uses[i]++;
54955501

@@ -5546,7 +5552,7 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter,
55465552

55475553
end_time += e->interval;
55485554

5549-
for (i = 0; i < IGC_MAX_TX_QUEUES; i++) {
5555+
for (i = 0; i < adapter->num_tx_queues; i++) {
55505556
struct igc_ring *ring = adapter->tx_ring[i];
55515557

55525558
if (!(e->gate_mask & BIT(i)))

drivers/net/ethernet/intel/igc/igc_ptp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,8 @@ void igc_ptp_suspend(struct igc_adapter *adapter)
849849
adapter->ptp_tx_skb = NULL;
850850
clear_bit_unlock(__IGC_PTP_TX_IN_PROGRESS, &adapter->state);
851851

852-
igc_ptp_time_save(adapter);
852+
if (pci_device_is_present(adapter->pdev))
853+
igc_ptp_time_save(adapter);
853854
}
854855

855856
/**

0 commit comments

Comments
 (0)