aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-03-06 15:01:07 -0500
committerDavid S. Miller <davem@davemloft.net>2015-03-06 15:01:07 -0500
commit76f53bfdaab2b5b96553da09219aa243ac6d8cf2 (patch)
treefa9818d19f370ae3b6980e9dff0bf35f4dfd5133
parentf0fdc80bd9ced4de3eb165c9c408e83713a71104 (diff)
parent08e8331654d1d7b2c58045e549005bc356aa7810 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates 2015-03-06 This series contains updates to e1000, e1000e and igb. Yanir provides updates to e1000e based on the patches provided by John Linville. First updates the code comment to better describe the changes and the impact on the driver. Second removed calls to ioremap/unmap for i219 since this is only relevant to older hardware only. Starting with i219, the NVM will not be mapped to its one BAR but to a address region in another bar. Alex Duyck provides two fixes for igb, first fixes a compile warning where a variable may be used uninitialized, so Alex initializes it. Second fixes an issue where all of the pin register values were having to be pushed onto the stack each time the function was called, so to avoid this, Alex made them static const so that they should only need to be allocated once and we can avoid all the instructions to get them onto the stack. Eliezer found an issue in e1000 where we needed to be calling netif_carrier_off earlier in the down() to prevent the stack from queuing more packets to the interface. Sabrina Dubroca resolved a potential race condition by adding a dummy allocator. There was a race condition between e1000_change_mtu() cleanups and netpoll, when changing the MTU across jumbo sizes. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c12
-rw-r--r--drivers/net/ethernet/intel/e1000e/ich8lan.c12
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c8
-rw-r--r--drivers/net/ethernet/intel/igb/igb_ptp.c26
4 files changed, 36 insertions, 22 deletions
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 7f997d36948f..73c98d34fa1f 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -144,6 +144,11 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
144static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, 144static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
145 struct e1000_rx_ring *rx_ring, 145 struct e1000_rx_ring *rx_ring,
146 int *work_done, int work_to_do); 146 int *work_done, int work_to_do);
147static void e1000_alloc_dummy_rx_buffers(struct e1000_adapter *adapter,
148 struct e1000_rx_ring *rx_ring,
149 int cleaned_count)
150{
151}
147static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, 152static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
148 struct e1000_rx_ring *rx_ring, 153 struct e1000_rx_ring *rx_ring,
149 int cleaned_count); 154 int cleaned_count);
@@ -516,6 +521,7 @@ void e1000_down(struct e1000_adapter *adapter)
516 struct net_device *netdev = adapter->netdev; 521 struct net_device *netdev = adapter->netdev;
517 u32 rctl, tctl; 522 u32 rctl, tctl;
518 523
524 netif_carrier_off(netdev);
519 525
520 /* disable receives in the hardware */ 526 /* disable receives in the hardware */
521 rctl = er32(RCTL); 527 rctl = er32(RCTL);
@@ -544,7 +550,6 @@ void e1000_down(struct e1000_adapter *adapter)
544 550
545 adapter->link_speed = 0; 551 adapter->link_speed = 0;
546 adapter->link_duplex = 0; 552 adapter->link_duplex = 0;
547 netif_carrier_off(netdev);
548 553
549 e1000_reset(adapter); 554 e1000_reset(adapter);
550 e1000_clean_all_tx_rings(adapter); 555 e1000_clean_all_tx_rings(adapter);
@@ -3552,8 +3557,11 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
3552 msleep(1); 3557 msleep(1);
3553 /* e1000_down has a dependency on max_frame_size */ 3558 /* e1000_down has a dependency on max_frame_size */
3554 hw->max_frame_size = max_frame; 3559 hw->max_frame_size = max_frame;
3555 if (netif_running(netdev)) 3560 if (netif_running(netdev)) {
3561 /* prevent buffers from being reallocated */
3562 adapter->alloc_rx_buf = e1000_alloc_dummy_rx_buffers;
3556 e1000_down(adapter); 3563 e1000_down(adapter);
3564 }
3557 3565
3558 /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN 3566 /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
3559 * means we reserve 2 more, this pushes us to allocate from the next 3567 * means we reserve 2 more, this pushes us to allocate from the next
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index 7523f510c7e4..9d81c0317433 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -603,12 +603,15 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
603 u16 i; 603 u16 i;
604 u32 nvm_size; 604 u32 nvm_size;
605 605
606 /* Can't read flash registers if the register set isn't mapped. */
607 nvm->type = e1000_nvm_flash_sw; 606 nvm->type = e1000_nvm_flash_sw;
608 /* in SPT, gfpreg doesn't exist. NVM size is taken from the 607
609 * STRAP register
610 */
611 if (hw->mac.type == e1000_pch_spt) { 608 if (hw->mac.type == e1000_pch_spt) {
609 /* in SPT, gfpreg doesn't exist. NVM size is taken from the
610 * STRAP register. This is because in SPT the GbE Flash region
611 * is no longer accessed through the flash registers. Instead,
612 * the mechanism has changed, and the Flash region access
613 * registers are now implemented in GbE memory space.
614 */
612 nvm->flash_base_addr = 0; 615 nvm->flash_base_addr = 0;
613 nvm_size = (((er32(STRAP) >> 1) & 0x1F) + 1) 616 nvm_size = (((er32(STRAP) >> 1) & 0x1F) + 1)
614 * NVM_SIZE_MULTIPLIER; 617 * NVM_SIZE_MULTIPLIER;
@@ -618,6 +621,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw)
618 /* Set the base address for flash register access */ 621 /* Set the base address for flash register access */
619 hw->flash_address = hw->hw_addr + E1000_FLASH_BASE_ADDR; 622 hw->flash_address = hw->hw_addr + E1000_FLASH_BASE_ADDR;
620 } else { 623 } else {
624 /* Can't read flash registers if register set isn't mapped. */
621 if (!hw->flash_address) { 625 if (!hw->flash_address) {
622 e_dbg("ERROR: Flash registers not mapped\n"); 626 e_dbg("ERROR: Flash registers not mapped\n");
623 return -E1000_ERR_CONFIG; 627 return -E1000_ERR_CONFIG;
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 6fa4fc05709e..4be4576d71aa 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -6833,7 +6833,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
6833 goto err_ioremap; 6833 goto err_ioremap;
6834 6834
6835 if ((adapter->flags & FLAG_HAS_FLASH) && 6835 if ((adapter->flags & FLAG_HAS_FLASH) &&
6836 (pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { 6836 (pci_resource_flags(pdev, 1) & IORESOURCE_MEM) &&
6837 (hw->mac.type < e1000_pch_spt)) {
6837 flash_start = pci_resource_start(pdev, 1); 6838 flash_start = pci_resource_start(pdev, 1);
6838 flash_len = pci_resource_len(pdev, 1); 6839 flash_len = pci_resource_len(pdev, 1);
6839 adapter->hw.flash_address = ioremap(flash_start, flash_len); 6840 adapter->hw.flash_address = ioremap(flash_start, flash_len);
@@ -7069,7 +7070,7 @@ err_hw_init:
7069 kfree(adapter->tx_ring); 7070 kfree(adapter->tx_ring);
7070 kfree(adapter->rx_ring); 7071 kfree(adapter->rx_ring);
7071err_sw_init: 7072err_sw_init:
7072 if (adapter->hw.flash_address) 7073 if ((adapter->hw.flash_address) && (hw->mac.type < e1000_pch_spt))
7073 iounmap(adapter->hw.flash_address); 7074 iounmap(adapter->hw.flash_address);
7074 e1000e_reset_interrupt_capability(adapter); 7075 e1000e_reset_interrupt_capability(adapter);
7075err_flashmap: 7076err_flashmap:
@@ -7142,7 +7143,8 @@ static void e1000_remove(struct pci_dev *pdev)
7142 kfree(adapter->rx_ring); 7143 kfree(adapter->rx_ring);
7143 7144
7144 iounmap(adapter->hw.hw_addr); 7145 iounmap(adapter->hw.hw_addr);
7145 if (adapter->hw.flash_address) 7146 if ((adapter->hw.flash_address) &&
7147 (adapter->hw.mac.type < e1000_pch_spt))
7146 iounmap(adapter->hw.flash_address); 7148 iounmap(adapter->hw.flash_address);
7147 pci_release_selected_regions(pdev, 7149 pci_release_selected_regions(pdev,
7148 pci_select_bars(pdev, IORESOURCE_MEM)); 7150 pci_select_bars(pdev, IORESOURCE_MEM));
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index d20fc8ed11f1..d6be4c69172d 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -358,7 +358,7 @@ static int igb_ptp_settime_i210(struct ptp_clock_info *ptp,
358static void igb_pin_direction(int pin, int input, u32 *ctrl, u32 *ctrl_ext) 358static void igb_pin_direction(int pin, int input, u32 *ctrl, u32 *ctrl_ext)
359{ 359{
360 u32 *ptr = pin < 2 ? ctrl : ctrl_ext; 360 u32 *ptr = pin < 2 ? ctrl : ctrl_ext;
361 u32 mask[IGB_N_SDP] = { 361 static const u32 mask[IGB_N_SDP] = {
362 E1000_CTRL_SDP0_DIR, 362 E1000_CTRL_SDP0_DIR,
363 E1000_CTRL_SDP1_DIR, 363 E1000_CTRL_SDP1_DIR,
364 E1000_CTRL_EXT_SDP2_DIR, 364 E1000_CTRL_EXT_SDP2_DIR,
@@ -373,16 +373,16 @@ static void igb_pin_direction(int pin, int input, u32 *ctrl, u32 *ctrl_ext)
373 373
374static void igb_pin_extts(struct igb_adapter *igb, int chan, int pin) 374static void igb_pin_extts(struct igb_adapter *igb, int chan, int pin)
375{ 375{
376 struct e1000_hw *hw = &igb->hw; 376 static const u32 aux0_sel_sdp[IGB_N_SDP] = {
377 u32 aux0_sel_sdp[IGB_N_SDP] = {
378 AUX0_SEL_SDP0, AUX0_SEL_SDP1, AUX0_SEL_SDP2, AUX0_SEL_SDP3, 377 AUX0_SEL_SDP0, AUX0_SEL_SDP1, AUX0_SEL_SDP2, AUX0_SEL_SDP3,
379 }; 378 };
380 u32 aux1_sel_sdp[IGB_N_SDP] = { 379 static const u32 aux1_sel_sdp[IGB_N_SDP] = {
381 AUX1_SEL_SDP0, AUX1_SEL_SDP1, AUX1_SEL_SDP2, AUX1_SEL_SDP3, 380 AUX1_SEL_SDP0, AUX1_SEL_SDP1, AUX1_SEL_SDP2, AUX1_SEL_SDP3,
382 }; 381 };
383 u32 ts_sdp_en[IGB_N_SDP] = { 382 static const u32 ts_sdp_en[IGB_N_SDP] = {
384 TS_SDP0_EN, TS_SDP1_EN, TS_SDP2_EN, TS_SDP3_EN, 383 TS_SDP0_EN, TS_SDP1_EN, TS_SDP2_EN, TS_SDP3_EN,
385 }; 384 };
385 struct e1000_hw *hw = &igb->hw;
386 u32 ctrl, ctrl_ext, tssdp = 0; 386 u32 ctrl, ctrl_ext, tssdp = 0;
387 387
388 ctrl = rd32(E1000_CTRL); 388 ctrl = rd32(E1000_CTRL);
@@ -409,28 +409,28 @@ static void igb_pin_extts(struct igb_adapter *igb, int chan, int pin)
409 409
410static void igb_pin_perout(struct igb_adapter *igb, int chan, int pin) 410static void igb_pin_perout(struct igb_adapter *igb, int chan, int pin)
411{ 411{
412 struct e1000_hw *hw = &igb->hw; 412 static const u32 aux0_sel_sdp[IGB_N_SDP] = {
413 u32 aux0_sel_sdp[IGB_N_SDP] = {
414 AUX0_SEL_SDP0, AUX0_SEL_SDP1, AUX0_SEL_SDP2, AUX0_SEL_SDP3, 413 AUX0_SEL_SDP0, AUX0_SEL_SDP1, AUX0_SEL_SDP2, AUX0_SEL_SDP3,
415 }; 414 };
416 u32 aux1_sel_sdp[IGB_N_SDP] = { 415 static const u32 aux1_sel_sdp[IGB_N_SDP] = {
417 AUX1_SEL_SDP0, AUX1_SEL_SDP1, AUX1_SEL_SDP2, AUX1_SEL_SDP3, 416 AUX1_SEL_SDP0, AUX1_SEL_SDP1, AUX1_SEL_SDP2, AUX1_SEL_SDP3,
418 }; 417 };
419 u32 ts_sdp_en[IGB_N_SDP] = { 418 static const u32 ts_sdp_en[IGB_N_SDP] = {
420 TS_SDP0_EN, TS_SDP1_EN, TS_SDP2_EN, TS_SDP3_EN, 419 TS_SDP0_EN, TS_SDP1_EN, TS_SDP2_EN, TS_SDP3_EN,
421 }; 420 };
422 u32 ts_sdp_sel_tt0[IGB_N_SDP] = { 421 static const u32 ts_sdp_sel_tt0[IGB_N_SDP] = {
423 TS_SDP0_SEL_TT0, TS_SDP1_SEL_TT0, 422 TS_SDP0_SEL_TT0, TS_SDP1_SEL_TT0,
424 TS_SDP2_SEL_TT0, TS_SDP3_SEL_TT0, 423 TS_SDP2_SEL_TT0, TS_SDP3_SEL_TT0,
425 }; 424 };
426 u32 ts_sdp_sel_tt1[IGB_N_SDP] = { 425 static const u32 ts_sdp_sel_tt1[IGB_N_SDP] = {
427 TS_SDP0_SEL_TT1, TS_SDP1_SEL_TT1, 426 TS_SDP0_SEL_TT1, TS_SDP1_SEL_TT1,
428 TS_SDP2_SEL_TT1, TS_SDP3_SEL_TT1, 427 TS_SDP2_SEL_TT1, TS_SDP3_SEL_TT1,
429 }; 428 };
430 u32 ts_sdp_sel_clr[IGB_N_SDP] = { 429 static const u32 ts_sdp_sel_clr[IGB_N_SDP] = {
431 TS_SDP0_SEL_FC1, TS_SDP1_SEL_FC1, 430 TS_SDP0_SEL_FC1, TS_SDP1_SEL_FC1,
432 TS_SDP2_SEL_FC1, TS_SDP3_SEL_FC1, 431 TS_SDP2_SEL_FC1, TS_SDP3_SEL_FC1,
433 }; 432 };
433 struct e1000_hw *hw = &igb->hw;
434 u32 ctrl, ctrl_ext, tssdp = 0; 434 u32 ctrl, ctrl_ext, tssdp = 0;
435 435
436 ctrl = rd32(E1000_CTRL); 436 ctrl = rd32(E1000_CTRL);
@@ -468,7 +468,7 @@ static int igb_ptp_feature_enable_i210(struct ptp_clock_info *ptp,
468 u32 tsauxc, tsim, tsauxc_mask, tsim_mask, trgttiml, trgttimh; 468 u32 tsauxc, tsim, tsauxc_mask, tsim_mask, trgttiml, trgttimh;
469 unsigned long flags; 469 unsigned long flags;
470 struct timespec ts; 470 struct timespec ts;
471 int pin; 471 int pin = -1;
472 s64 ns; 472 s64 ns;
473 473
474 switch (rq->type) { 474 switch (rq->type) {