Skip to content

Commit 335b320

Browse files
committed
Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== 1GbE Intel Wired LAN Driver Updates 2015-12-14 This series contains updates to e1000e and igb. Alex Duyck changes e1000_up() to void since it always returned 0, also by making it void, we can drop some code since we no longer have to worry about non-zero return values. Aaron Sierra removes GS40G specific defines and functions since the i210 internal PHY can be accessed with the access functions shared by 82580, i350 and i354 devices. Also removes the code to add the PHY address into the PCDL register address, since there is no real reason to do so. Joe updates the cable length function reports all four pairs true min, max and average cable length for i210. Also updated ethtool to use enum-based labels instead of hard coded values. Benjamin Poirier cleans up code that is never reachable since MSI-X interrupts are not shared in e1000e. Also removes the ICR read in the other interrupt handler, since the information is not needed and IMS is configured such that the only link status change can trigger the other interrupt handler. Fixed in MSI-X mode, there is no handler for the LSC interrupt so there is no point in writing that to ICS now that we always assume other interrupts are caused by LSC. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 5833e05 + 0a8047a commit 335b320

File tree

11 files changed

+120
-179
lines changed

11 files changed

+120
-179
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,13 @@
441441
#define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */
442442
#define E1000_IMS_TXQ0 E1000_ICR_TXQ0 /* Tx Queue 0 Interrupt */
443443
#define E1000_IMS_TXQ1 E1000_ICR_TXQ1 /* Tx Queue 1 Interrupt */
444-
#define E1000_IMS_OTHER E1000_ICR_OTHER /* Other Interrupts */
444+
#define E1000_IMS_OTHER E1000_ICR_OTHER /* Other Interrupt */
445445

446446
/* Interrupt Cause Set */
447447
#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */
448448
#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */
449449
#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */
450+
#define E1000_ICS_OTHER E1000_ICR_OTHER /* Other Interrupt */
450451

451452
/* Transmit Descriptor Control */
452453
#define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ extern const char e1000e_driver_version[];
480480
void e1000e_check_options(struct e1000_adapter *adapter);
481481
void e1000e_set_ethtool_ops(struct net_device *netdev);
482482

483-
int e1000e_up(struct e1000_adapter *adapter);
483+
void e1000e_up(struct e1000_adapter *adapter);
484484
void e1000e_down(struct e1000_adapter *adapter, bool reset);
485485
void e1000e_reinit_locked(struct e1000_adapter *adapter);
486486
void e1000e_reset(struct e1000_adapter *adapter);

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

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,30 +1905,15 @@ static irqreturn_t e1000_msix_other(int __always_unused irq, void *data)
19051905
struct net_device *netdev = data;
19061906
struct e1000_adapter *adapter = netdev_priv(netdev);
19071907
struct e1000_hw *hw = &adapter->hw;
1908-
u32 icr = er32(ICR);
1909-
1910-
if (!(icr & E1000_ICR_INT_ASSERTED)) {
1911-
if (!test_bit(__E1000_DOWN, &adapter->state))
1912-
ew32(IMS, E1000_IMS_OTHER);
1913-
return IRQ_NONE;
1914-
}
19151908

1916-
if (icr & adapter->eiac_mask)
1917-
ew32(ICS, (icr & adapter->eiac_mask));
1909+
hw->mac.get_link_status = true;
19181910

1919-
if (icr & E1000_ICR_OTHER) {
1920-
if (!(icr & E1000_ICR_LSC))
1921-
goto no_link_interrupt;
1922-
hw->mac.get_link_status = true;
1923-
/* guard against interrupt when we're going down */
1924-
if (!test_bit(__E1000_DOWN, &adapter->state))
1925-
mod_timer(&adapter->watchdog_timer, jiffies + 1);
1911+
/* guard against interrupt when we're going down */
1912+
if (!test_bit(__E1000_DOWN, &adapter->state)) {
1913+
mod_timer(&adapter->watchdog_timer, jiffies + 1);
1914+
ew32(IMS, E1000_IMS_OTHER);
19261915
}
19271916

1928-
no_link_interrupt:
1929-
if (!test_bit(__E1000_DOWN, &adapter->state))
1930-
ew32(IMS, E1000_IMS_LSC | E1000_IMS_OTHER);
1931-
19321917
return IRQ_HANDLED;
19331918
}
19341919

@@ -1946,6 +1931,9 @@ static irqreturn_t e1000_intr_msix_tx(int __always_unused irq, void *data)
19461931
/* Ring was not completely cleaned, so fire another interrupt */
19471932
ew32(ICS, tx_ring->ims_val);
19481933

1934+
if (!test_bit(__E1000_DOWN, &adapter->state))
1935+
ew32(IMS, adapter->tx_ring->ims_val);
1936+
19491937
return IRQ_HANDLED;
19501938
}
19511939

@@ -2027,19 +2015,16 @@ static void e1000_configure_msix(struct e1000_adapter *adapter)
20272015
hw->hw_addr + E1000_EITR_82574(vector));
20282016
else
20292017
writel(1, hw->hw_addr + E1000_EITR_82574(vector));
2018+
adapter->eiac_mask |= E1000_IMS_OTHER;
20302019

20312020
/* Cause Tx interrupts on every write back */
20322021
ivar |= (1 << 31);
20332022

20342023
ew32(IVAR, ivar);
20352024

20362025
/* enable MSI-X PBA support */
2037-
ctrl_ext = er32(CTRL_EXT);
2038-
ctrl_ext |= E1000_CTRL_EXT_PBA_CLR;
2039-
2040-
/* Auto-Mask Other interrupts upon ICR read */
2041-
ew32(IAM, ~E1000_EIAC_MASK_82574 | E1000_IMS_OTHER);
2042-
ctrl_ext |= E1000_CTRL_EXT_EIAME;
2026+
ctrl_ext = er32(CTRL_EXT) & ~E1000_CTRL_EXT_IAME;
2027+
ctrl_ext |= E1000_CTRL_EXT_PBA_CLR | E1000_CTRL_EXT_EIAME;
20432028
ew32(CTRL_EXT, ctrl_ext);
20442029
e1e_flush();
20452030
}
@@ -2255,7 +2240,7 @@ static void e1000_irq_enable(struct e1000_adapter *adapter)
22552240

22562241
if (adapter->msix_entries) {
22572242
ew32(EIAC_82574, adapter->eiac_mask & E1000_EIAC_MASK_82574);
2258-
ew32(IMS, adapter->eiac_mask | E1000_IMS_OTHER | E1000_IMS_LSC);
2243+
ew32(IMS, adapter->eiac_mask | E1000_IMS_LSC);
22592244
} else if ((hw->mac.type == e1000_pch_lpt) ||
22602245
(hw->mac.type == e1000_pch_spt)) {
22612246
ew32(IMS, IMS_ENABLE_MASK | E1000_IMS_ECCER);
@@ -4146,10 +4131,24 @@ void e1000e_reset(struct e1000_adapter *adapter)
41464131

41474132
}
41484133

4149-
int e1000e_up(struct e1000_adapter *adapter)
4134+
/**
4135+
* e1000e_trigger_lsc - trigger an LSC interrupt
4136+
* @adapter:
4137+
*
4138+
* Fire a link status change interrupt to start the watchdog.
4139+
**/
4140+
static void e1000e_trigger_lsc(struct e1000_adapter *adapter)
41504141
{
41514142
struct e1000_hw *hw = &adapter->hw;
41524143

4144+
if (adapter->msix_entries)
4145+
ew32(ICS, E1000_ICS_OTHER);
4146+
else
4147+
ew32(ICS, E1000_ICS_LSC);
4148+
}
4149+
4150+
void e1000e_up(struct e1000_adapter *adapter)
4151+
{
41534152
/* hardware has been reset, we need to reload some things */
41544153
e1000_configure(adapter);
41554154

@@ -4161,13 +4160,7 @@ int e1000e_up(struct e1000_adapter *adapter)
41614160

41624161
netif_start_queue(adapter->netdev);
41634162

4164-
/* fire a link change interrupt to start the watchdog */
4165-
if (adapter->msix_entries)
4166-
ew32(ICS, E1000_ICS_LSC | E1000_ICR_OTHER);
4167-
else
4168-
ew32(ICS, E1000_ICS_LSC);
4169-
4170-
return 0;
4163+
e1000e_trigger_lsc(adapter);
41714164
}
41724165

41734166
static void e1000e_flush_descriptors(struct e1000_adapter *adapter)
@@ -4592,11 +4585,7 @@ static int e1000_open(struct net_device *netdev)
45924585
hw->mac.get_link_status = true;
45934586
pm_runtime_put(&pdev->dev);
45944587

4595-
/* fire a link status change interrupt to start the watchdog */
4596-
if (adapter->msix_entries)
4597-
ew32(ICS, E1000_ICS_LSC | E1000_ICR_OTHER);
4598-
else
4599-
ew32(ICS, E1000_ICS_LSC);
4588+
e1000e_trigger_lsc(adapter);
46004589

46014590
return 0;
46024591

@@ -6633,7 +6622,7 @@ static int e1000e_pm_runtime_resume(struct device *dev)
66336622
return rc;
66346623

66356624
if (netdev->flags & IFF_UP)
6636-
rc = e1000e_up(adapter);
6625+
e1000e_up(adapter);
66376626

66386627
return rc;
66396628
}
@@ -6824,13 +6813,8 @@ static void e1000_io_resume(struct pci_dev *pdev)
68246813

68256814
e1000_init_manageability_pt(adapter);
68266815

6827-
if (netif_running(netdev)) {
6828-
if (e1000e_up(adapter)) {
6829-
dev_err(&pdev->dev,
6830-
"can't bring device back up after reset\n");
6831-
return;
6832-
}
6833-
}
6816+
if (netif_running(netdev))
6817+
e1000e_up(adapter);
68346818

68356819
netif_device_attach(netdev);
68366820

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ static s32 igb_get_cfg_done_82575(struct e1000_hw *);
4545
static s32 igb_init_hw_82575(struct e1000_hw *);
4646
static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *);
4747
static s32 igb_read_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16 *);
48-
static s32 igb_read_phy_reg_82580(struct e1000_hw *, u32, u16 *);
49-
static s32 igb_write_phy_reg_82580(struct e1000_hw *, u32, u16);
5048
static s32 igb_reset_hw_82575(struct e1000_hw *);
5149
static s32 igb_reset_hw_82580(struct e1000_hw *);
5250
static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *, bool);
@@ -205,13 +203,10 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
205203
case e1000_82580:
206204
case e1000_i350:
207205
case e1000_i354:
208-
phy->ops.read_reg = igb_read_phy_reg_82580;
209-
phy->ops.write_reg = igb_write_phy_reg_82580;
210-
break;
211206
case e1000_i210:
212207
case e1000_i211:
213-
phy->ops.read_reg = igb_read_phy_reg_gs40g;
214-
phy->ops.write_reg = igb_write_phy_reg_gs40g;
208+
phy->ops.read_reg = igb_read_phy_reg_82580;
209+
phy->ops.write_reg = igb_write_phy_reg_82580;
215210
break;
216211
default:
217212
phy->ops.read_reg = igb_read_phy_reg_igp;
@@ -2153,7 +2148,7 @@ void igb_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable)
21532148
* Reads the MDI control register in the PHY at offset and stores the
21542149
* information read to data.
21552150
**/
2156-
static s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data)
2151+
s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data)
21572152
{
21582153
s32 ret_val;
21592154

@@ -2177,7 +2172,7 @@ static s32 igb_read_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 *data)
21772172
*
21782173
* Writes data to MDI control register in the PHY at offset.
21792174
**/
2180-
static s32 igb_write_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 data)
2175+
s32 igb_write_phy_reg_82580(struct e1000_hw *hw, u32 offset, u16 data)
21812176
{
21822177
s32 ret_val;
21832178

drivers/net/ethernet/intel/igb/e1000_defines.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,10 @@
927927

928928
/* Intel i347-AT4 Registers */
929929

930-
#define I347AT4_PCDL 0x10 /* PHY Cable Diagnostics Length */
930+
#define I347AT4_PCDL0 0x10 /* Pair 0 PHY Cable Diagnostics Length */
931+
#define I347AT4_PCDL1 0x11 /* Pair 1 PHY Cable Diagnostics Length */
932+
#define I347AT4_PCDL2 0x12 /* Pair 2 PHY Cable Diagnostics Length */
933+
#define I347AT4_PCDL3 0x13 /* Pair 3 PHY Cable Diagnostics Length */
931934
#define I347AT4_PCDC 0x15 /* PHY Cable Diagnostics Control */
932935
#define I347AT4_PAGE_SELECT 0x16
933936

drivers/net/ethernet/intel/igb/e1000_hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ struct e1000_phy_info {
441441
u16 cable_length;
442442
u16 max_cable_length;
443443
u16 min_cable_length;
444+
u16 pair_length[4];
444445

445446
u8 mdix;
446447

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,10 +861,10 @@ s32 igb_pll_workaround_i210(struct e1000_hw *hw)
861861
if (ret_val)
862862
nvm_word = E1000_INVM_DEFAULT_AL;
863863
tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL;
864+
igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, E1000_PHY_PLL_FREQ_PAGE);
864865
for (i = 0; i < E1000_MAX_PLL_TRIES; i++) {
865866
/* check current state directly from internal PHY */
866-
igb_read_phy_reg_gs40g(hw, (E1000_PHY_PLL_FREQ_PAGE |
867-
E1000_PHY_PLL_FREQ_REG), &phy_word);
867+
igb_read_phy_reg_82580(hw, E1000_PHY_PLL_FREQ_REG, &phy_word);
868868
if ((phy_word & E1000_PHY_PLL_UNCONF)
869869
!= E1000_PHY_PLL_UNCONF) {
870870
ret_val = 0;
@@ -896,6 +896,7 @@ s32 igb_pll_workaround_i210(struct e1000_hw *hw)
896896
/* restore WUC register */
897897
wr32(E1000_WUC, wuc);
898898
}
899+
igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, 0);
899900
/* restore MDICNFG setting */
900901
wr32(E1000_MDICNFG, mdicnfg);
901902
return ret_val;

drivers/net/ethernet/intel/igb/e1000_i210.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ enum E1000_INVM_STRUCTURE_TYPE {
8585
#define E1000_PCI_PMCSR_D3 0x03
8686
#define E1000_MAX_PLL_TRIES 5
8787
#define E1000_PHY_PLL_UNCONF 0xFF
88-
#define E1000_PHY_PLL_FREQ_PAGE 0xFC0000
88+
#define E1000_PHY_PLL_FREQ_PAGE 0xFC
8989
#define E1000_PHY_PLL_FREQ_REG 0x000E
9090
#define E1000_INVM_DEFAULT_AL 0x202F
9191
#define E1000_INVM_AUTOLOAD 0x0A

0 commit comments

Comments
 (0)