diff options
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 88 |
1 files changed, 57 insertions, 31 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index e756e220db3..e3442f47f93 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -563,7 +563,6 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, | |||
563 | union ixgbe_adv_rx_desc *rx_desc; | 563 | union ixgbe_adv_rx_desc *rx_desc; |
564 | struct ixgbe_rx_buffer *bi; | 564 | struct ixgbe_rx_buffer *bi; |
565 | unsigned int i; | 565 | unsigned int i; |
566 | unsigned int bufsz = rx_ring->rx_buf_len + NET_IP_ALIGN; | ||
567 | 566 | ||
568 | i = rx_ring->next_to_use; | 567 | i = rx_ring->next_to_use; |
569 | bi = &rx_ring->rx_buffer_info[i]; | 568 | bi = &rx_ring->rx_buffer_info[i]; |
@@ -593,7 +592,9 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, | |||
593 | 592 | ||
594 | if (!bi->skb) { | 593 | if (!bi->skb) { |
595 | struct sk_buff *skb; | 594 | struct sk_buff *skb; |
596 | skb = netdev_alloc_skb(adapter->netdev, bufsz); | 595 | skb = netdev_alloc_skb(adapter->netdev, |
596 | (rx_ring->rx_buf_len + | ||
597 | NET_IP_ALIGN)); | ||
597 | 598 | ||
598 | if (!skb) { | 599 | if (!skb) { |
599 | adapter->alloc_rx_buff_failed++; | 600 | adapter->alloc_rx_buff_failed++; |
@@ -608,7 +609,8 @@ static void ixgbe_alloc_rx_buffers(struct ixgbe_adapter *adapter, | |||
608 | skb_reserve(skb, NET_IP_ALIGN); | 609 | skb_reserve(skb, NET_IP_ALIGN); |
609 | 610 | ||
610 | bi->skb = skb; | 611 | bi->skb = skb; |
611 | bi->dma = pci_map_single(pdev, skb->data, bufsz, | 612 | bi->dma = pci_map_single(pdev, skb->data, |
613 | rx_ring->rx_buf_len, | ||
612 | PCI_DMA_FROMDEVICE); | 614 | PCI_DMA_FROMDEVICE); |
613 | } | 615 | } |
614 | /* Refresh the desc even if buffer_addrs didn't change because | 616 | /* Refresh the desc even if buffer_addrs didn't change because |
@@ -732,6 +734,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
732 | pci_unmap_single(pdev, rx_buffer_info->dma, | 734 | pci_unmap_single(pdev, rx_buffer_info->dma, |
733 | rx_ring->rx_buf_len, | 735 | rx_ring->rx_buf_len, |
734 | PCI_DMA_FROMDEVICE); | 736 | PCI_DMA_FROMDEVICE); |
737 | rx_buffer_info->dma = 0; | ||
735 | skb_put(skb, len); | 738 | skb_put(skb, len); |
736 | } | 739 | } |
737 | 740 | ||
@@ -2694,16 +2697,23 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
2694 | 2697 | ||
2695 | /* | 2698 | /* |
2696 | * For hot-pluggable SFP+ devices, a new SFP+ module may have | 2699 | * For hot-pluggable SFP+ devices, a new SFP+ module may have |
2697 | * arrived before interrupts were enabled. We need to kick off | 2700 | * arrived before interrupts were enabled but after probe. Such |
2698 | * the SFP+ module setup first, then try to bring up link. | 2701 | * devices wouldn't have their type identified yet. We need to |
2702 | * kick off the SFP+ module setup first, then try to bring up link. | ||
2699 | * If we're not hot-pluggable SFP+, we just need to configure link | 2703 | * If we're not hot-pluggable SFP+, we just need to configure link |
2700 | * and bring it up. | 2704 | * and bring it up. |
2701 | */ | 2705 | */ |
2702 | err = hw->phy.ops.identify(hw); | 2706 | if (hw->phy.type == ixgbe_phy_unknown) { |
2703 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 2707 | err = hw->phy.ops.identify(hw); |
2704 | DPRINTK(PROBE, ERR, "PHY not supported on this NIC %d\n", err); | 2708 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
2705 | ixgbe_down(adapter); | 2709 | /* |
2706 | return err; | 2710 | * Take the device down and schedule the sfp tasklet |
2711 | * which will unregister_netdev and log it. | ||
2712 | */ | ||
2713 | ixgbe_down(adapter); | ||
2714 | schedule_work(&adapter->sfp_config_module_task); | ||
2715 | return err; | ||
2716 | } | ||
2707 | } | 2717 | } |
2708 | 2718 | ||
2709 | if (ixgbe_is_sfp(hw)) { | 2719 | if (ixgbe_is_sfp(hw)) { |
@@ -2812,9 +2822,11 @@ static void ixgbe_clean_rx_ring(struct ixgbe_adapter *adapter, | |||
2812 | } | 2822 | } |
2813 | if (!rx_buffer_info->page) | 2823 | if (!rx_buffer_info->page) |
2814 | continue; | 2824 | continue; |
2815 | pci_unmap_page(pdev, rx_buffer_info->page_dma, PAGE_SIZE / 2, | 2825 | if (rx_buffer_info->page_dma) { |
2816 | PCI_DMA_FROMDEVICE); | 2826 | pci_unmap_page(pdev, rx_buffer_info->page_dma, |
2817 | rx_buffer_info->page_dma = 0; | 2827 | PAGE_SIZE / 2, PCI_DMA_FROMDEVICE); |
2828 | rx_buffer_info->page_dma = 0; | ||
2829 | } | ||
2818 | put_page(rx_buffer_info->page); | 2830 | put_page(rx_buffer_info->page); |
2819 | rx_buffer_info->page = NULL; | 2831 | rx_buffer_info->page = NULL; |
2820 | rx_buffer_info->page_offset = 0; | 2832 | rx_buffer_info->page_offset = 0; |
@@ -3118,7 +3130,11 @@ static inline bool ixgbe_set_fcoe_queues(struct ixgbe_adapter *adapter) | |||
3118 | #endif | 3130 | #endif |
3119 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { | 3131 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { |
3120 | DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n"); | 3132 | DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n"); |
3121 | ixgbe_set_rss_queues(adapter); | 3133 | if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) || |
3134 | (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) | ||
3135 | ixgbe_set_fdir_queues(adapter); | ||
3136 | else | ||
3137 | ixgbe_set_rss_queues(adapter); | ||
3122 | } | 3138 | } |
3123 | /* adding FCoE rx rings to the end */ | 3139 | /* adding FCoE rx rings to the end */ |
3124 | f->mask = adapter->num_rx_queues; | 3140 | f->mask = adapter->num_rx_queues; |
@@ -3376,7 +3392,12 @@ static inline bool ixgbe_cache_ring_fcoe(struct ixgbe_adapter *adapter) | |||
3376 | } | 3392 | } |
3377 | #endif /* CONFIG_IXGBE_DCB */ | 3393 | #endif /* CONFIG_IXGBE_DCB */ |
3378 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { | 3394 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { |
3379 | ixgbe_cache_ring_rss(adapter); | 3395 | if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) || |
3396 | (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) | ||
3397 | ixgbe_cache_ring_fdir(adapter); | ||
3398 | else | ||
3399 | ixgbe_cache_ring_rss(adapter); | ||
3400 | |||
3380 | fcoe_i = f->mask; | 3401 | fcoe_i = f->mask; |
3381 | } | 3402 | } |
3382 | for (i = 0; i < f->indices; i++, fcoe_i++) | 3403 | for (i = 0; i < f->indices; i++, fcoe_i++) |
@@ -3716,14 +3737,15 @@ static void ixgbe_sfp_task(struct work_struct *work) | |||
3716 | if ((hw->phy.type == ixgbe_phy_nl) && | 3737 | if ((hw->phy.type == ixgbe_phy_nl) && |
3717 | (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { | 3738 | (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { |
3718 | s32 ret = hw->phy.ops.identify_sfp(hw); | 3739 | s32 ret = hw->phy.ops.identify_sfp(hw); |
3719 | if (ret) | 3740 | if (ret == IXGBE_ERR_SFP_NOT_PRESENT) |
3720 | goto reschedule; | 3741 | goto reschedule; |
3721 | ret = hw->phy.ops.reset(hw); | 3742 | ret = hw->phy.ops.reset(hw); |
3722 | if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 3743 | if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
3723 | DPRINTK(PROBE, ERR, "failed to initialize because an " | 3744 | dev_err(&adapter->pdev->dev, "failed to initialize " |
3724 | "unsupported SFP+ module type was detected.\n" | 3745 | "because an unsupported SFP+ module type " |
3725 | "Reload the driver after installing a " | 3746 | "was detected.\n" |
3726 | "supported module.\n"); | 3747 | "Reload the driver after installing a " |
3748 | "supported module.\n"); | ||
3727 | unregister_netdev(adapter->netdev); | 3749 | unregister_netdev(adapter->netdev); |
3728 | } else { | 3750 | } else { |
3729 | DPRINTK(PROBE, INFO, "detected SFP+: %d\n", | 3751 | DPRINTK(PROBE, INFO, "detected SFP+: %d\n", |
@@ -4502,7 +4524,8 @@ static void ixgbe_multispeed_fiber_task(struct work_struct *work) | |||
4502 | u32 autoneg; | 4524 | u32 autoneg; |
4503 | 4525 | ||
4504 | adapter->flags |= IXGBE_FLAG_IN_SFP_LINK_TASK; | 4526 | adapter->flags |= IXGBE_FLAG_IN_SFP_LINK_TASK; |
4505 | if (hw->mac.ops.get_link_capabilities) | 4527 | autoneg = hw->phy.autoneg_advertised; |
4528 | if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) | ||
4506 | hw->mac.ops.get_link_capabilities(hw, &autoneg, | 4529 | hw->mac.ops.get_link_capabilities(hw, &autoneg, |
4507 | &hw->mac.autoneg); | 4530 | &hw->mac.autoneg); |
4508 | if (hw->mac.ops.setup_link_speed) | 4531 | if (hw->mac.ops.setup_link_speed) |
@@ -4524,10 +4547,17 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work) | |||
4524 | u32 err; | 4547 | u32 err; |
4525 | 4548 | ||
4526 | adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK; | 4549 | adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK; |
4550 | |||
4551 | /* Time for electrical oscillations to settle down */ | ||
4552 | msleep(100); | ||
4527 | err = hw->phy.ops.identify_sfp(hw); | 4553 | err = hw->phy.ops.identify_sfp(hw); |
4554 | |||
4528 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 4555 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
4529 | DPRINTK(PROBE, ERR, "PHY not supported on this NIC %d\n", err); | 4556 | dev_err(&adapter->pdev->dev, "failed to initialize because " |
4530 | ixgbe_down(adapter); | 4557 | "an unsupported SFP+ module type was detected.\n" |
4558 | "Reload the driver after installing a supported " | ||
4559 | "module.\n"); | ||
4560 | unregister_netdev(adapter->netdev); | ||
4531 | return; | 4561 | return; |
4532 | } | 4562 | } |
4533 | hw->mac.ops.setup_sfp(hw); | 4563 | hw->mac.ops.setup_sfp(hw); |
@@ -5513,8 +5543,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
5513 | round_jiffies(jiffies + (2 * HZ))); | 5543 | round_jiffies(jiffies + (2 * HZ))); |
5514 | err = 0; | 5544 | err = 0; |
5515 | } else if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 5545 | } else if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
5516 | dev_err(&adapter->pdev->dev, "failed to load because an " | 5546 | dev_err(&adapter->pdev->dev, "failed to initialize because " |
5517 | "unsupported SFP+ module type was detected.\n"); | 5547 | "an unsupported SFP+ module type was detected.\n" |
5548 | "Reload the driver after installing a supported " | ||
5549 | "module.\n"); | ||
5518 | goto err_sw_init; | 5550 | goto err_sw_init; |
5519 | } else if (err) { | 5551 | } else if (err) { |
5520 | dev_err(&adapter->pdev->dev, "HW Init failed: %d\n", err); | 5552 | dev_err(&adapter->pdev->dev, "HW Init failed: %d\n", err); |
@@ -5555,12 +5587,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
5555 | netdev->features |= NETIF_F_FCOE_CRC; | 5587 | netdev->features |= NETIF_F_FCOE_CRC; |
5556 | netdev->features |= NETIF_F_FSO; | 5588 | netdev->features |= NETIF_F_FSO; |
5557 | netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; | 5589 | netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; |
5558 | DPRINTK(DRV, INFO, "FCoE enabled, " | ||
5559 | "disabling Flow Director\n"); | ||
5560 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
5561 | adapter->flags &= | ||
5562 | ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; | ||
5563 | adapter->atr_sample_rate = 0; | ||
5564 | } else { | 5590 | } else { |
5565 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; | 5591 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; |
5566 | } | 5592 | } |