aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c128
1 files changed, 80 insertions, 48 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 5588ef493a3..110c65ab5cb 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -34,6 +34,7 @@
34#include <linux/in.h> 34#include <linux/in.h>
35#include <linux/ip.h> 35#include <linux/ip.h>
36#include <linux/tcp.h> 36#include <linux/tcp.h>
37#include <linux/pkt_sched.h>
37#include <linux/ipv6.h> 38#include <linux/ipv6.h>
38#include <net/checksum.h> 39#include <net/checksum.h>
39#include <net/ip6_checksum.h> 40#include <net/ip6_checksum.h>
@@ -510,8 +511,11 @@ static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector,
510 * @skb: skb currently being received and modified 511 * @skb: skb currently being received and modified
511 **/ 512 **/
512static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter, 513static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter,
513 u32 status_err, struct sk_buff *skb) 514 union ixgbe_adv_rx_desc *rx_desc,
515 struct sk_buff *skb)
514{ 516{
517 u32 status_err = le32_to_cpu(rx_desc->wb.upper.status_error);
518
515 skb->ip_summed = CHECKSUM_NONE; 519 skb->ip_summed = CHECKSUM_NONE;
516 520
517 /* Rx csum disabled */ 521 /* Rx csum disabled */
@@ -529,6 +533,16 @@ static inline void ixgbe_rx_checksum(struct ixgbe_adapter *adapter,
529 return; 533 return;
530 534
531 if (status_err & IXGBE_RXDADV_ERR_TCPE) { 535 if (status_err & IXGBE_RXDADV_ERR_TCPE) {
536 u16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info;
537
538 /*
539 * 82599 errata, UDP frames with a 0 checksum can be marked as
540 * checksum errors.
541 */
542 if ((pkt_info & IXGBE_RXDADV_PKTTYPE_UDP) &&
543 (adapter->hw.mac.type == ixgbe_mac_82599EB))
544 return;
545
532 adapter->hw_csum_rx_error++; 546 adapter->hw_csum_rx_error++;
533 return; 547 return;
534 } 548 }
@@ -766,7 +780,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
766 prefetch(next_rxd); 780 prefetch(next_rxd);
767 cleaned_count++; 781 cleaned_count++;
768 782
769 if (adapter->flags & IXGBE_FLAG2_RSC_CAPABLE) 783 if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)
770 rsc_count = ixgbe_get_rsc_count(rx_desc); 784 rsc_count = ixgbe_get_rsc_count(rx_desc);
771 785
772 if (rsc_count) { 786 if (rsc_count) {
@@ -802,7 +816,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
802 goto next_desc; 816 goto next_desc;
803 } 817 }
804 818
805 ixgbe_rx_checksum(adapter, staterr, skb); 819 ixgbe_rx_checksum(adapter, rx_desc, skb);
806 820
807 /* probably a little skewed due to removing CRC */ 821 /* probably a little skewed due to removing CRC */
808 total_rx_bytes += skb->len; 822 total_rx_bytes += skb->len;
@@ -2022,7 +2036,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2022 IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(0), psrtype); 2036 IXGBE_WRITE_REG(hw, IXGBE_PSRTYPE(0), psrtype);
2023 } 2037 }
2024 } else { 2038 } else {
2025 if (!(adapter->flags & IXGBE_FLAG2_RSC_ENABLED) && 2039 if (!(adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) &&
2026 (netdev->mtu <= ETH_DATA_LEN)) 2040 (netdev->mtu <= ETH_DATA_LEN))
2027 rx_buf_len = MAXIMUM_ETHERNET_VLAN_SIZE; 2041 rx_buf_len = MAXIMUM_ETHERNET_VLAN_SIZE;
2028 else 2042 else
@@ -2151,7 +2165,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
2151 IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl); 2165 IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, rdrxctl);
2152 } 2166 }
2153 2167
2154 if (adapter->flags & IXGBE_FLAG2_RSC_ENABLED) { 2168 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED) {
2155 /* Enable 82599 HW-RSC */ 2169 /* Enable 82599 HW-RSC */
2156 for (i = 0; i < adapter->num_rx_queues; i++) { 2170 for (i = 0; i < adapter->num_rx_queues; i++) {
2157 j = adapter->rx_ring[i].reg_idx; 2171 j = adapter->rx_ring[i].reg_idx;
@@ -2697,19 +2711,23 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
2697 2711
2698 /* 2712 /*
2699 * For hot-pluggable SFP+ devices, a new SFP+ module may have 2713 * For hot-pluggable SFP+ devices, a new SFP+ module may have
2700 * arrived before interrupts were enabled. We need to kick off 2714 * arrived before interrupts were enabled but after probe. Such
2701 * the SFP+ module setup first, then try to bring up link. 2715 * devices wouldn't have their type identified yet. We need to
2716 * kick off the SFP+ module setup first, then try to bring up link.
2702 * If we're not hot-pluggable SFP+, we just need to configure link 2717 * If we're not hot-pluggable SFP+, we just need to configure link
2703 * and bring it up. 2718 * and bring it up.
2704 */ 2719 */
2705 err = hw->phy.ops.identify(hw); 2720 if (hw->phy.type == ixgbe_phy_unknown) {
2706 if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { 2721 err = hw->phy.ops.identify(hw);
2707 dev_err(&adapter->pdev->dev, "failed to initialize because " 2722 if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
2708 "an unsupported SFP+ module type was detected.\n" 2723 /*
2709 "Reload the driver after installing a supported " 2724 * Take the device down and schedule the sfp tasklet
2710 "module.\n"); 2725 * which will unregister_netdev and log it.
2711 ixgbe_down(adapter); 2726 */
2712 return err; 2727 ixgbe_down(adapter);
2728 schedule_work(&adapter->sfp_config_module_task);
2729 return err;
2730 }
2713 } 2731 }
2714 2732
2715 if (ixgbe_is_sfp(hw)) { 2733 if (ixgbe_is_sfp(hw)) {
@@ -3126,7 +3144,11 @@ static inline bool ixgbe_set_fcoe_queues(struct ixgbe_adapter *adapter)
3126#endif 3144#endif
3127 if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { 3145 if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) {
3128 DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n"); 3146 DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n");
3129 ixgbe_set_rss_queues(adapter); 3147 if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
3148 (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
3149 ixgbe_set_fdir_queues(adapter);
3150 else
3151 ixgbe_set_rss_queues(adapter);
3130 } 3152 }
3131 /* adding FCoE rx rings to the end */ 3153 /* adding FCoE rx rings to the end */
3132 f->mask = adapter->num_rx_queues; 3154 f->mask = adapter->num_rx_queues;
@@ -3384,7 +3406,12 @@ static inline bool ixgbe_cache_ring_fcoe(struct ixgbe_adapter *adapter)
3384 } 3406 }
3385#endif /* CONFIG_IXGBE_DCB */ 3407#endif /* CONFIG_IXGBE_DCB */
3386 if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { 3408 if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) {
3387 ixgbe_cache_ring_rss(adapter); 3409 if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) ||
3410 (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE))
3411 ixgbe_cache_ring_fdir(adapter);
3412 else
3413 ixgbe_cache_ring_rss(adapter);
3414
3388 fcoe_i = f->mask; 3415 fcoe_i = f->mask;
3389 } 3416 }
3390 for (i = 0; i < f->indices; i++, fcoe_i++) 3417 for (i = 0; i < f->indices; i++, fcoe_i++)
@@ -3724,7 +3751,7 @@ static void ixgbe_sfp_task(struct work_struct *work)
3724 if ((hw->phy.type == ixgbe_phy_nl) && 3751 if ((hw->phy.type == ixgbe_phy_nl) &&
3725 (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { 3752 (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) {
3726 s32 ret = hw->phy.ops.identify_sfp(hw); 3753 s32 ret = hw->phy.ops.identify_sfp(hw);
3727 if (ret) 3754 if (ret == IXGBE_ERR_SFP_NOT_PRESENT)
3728 goto reschedule; 3755 goto reschedule;
3729 ret = hw->phy.ops.reset(hw); 3756 ret = hw->phy.ops.reset(hw);
3730 if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { 3757 if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) {
@@ -3785,16 +3812,17 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
3785 adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82598; 3812 adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82598;
3786 } else if (hw->mac.type == ixgbe_mac_82599EB) { 3813 } else if (hw->mac.type == ixgbe_mac_82599EB) {
3787 adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599; 3814 adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82599;
3788 adapter->flags |= IXGBE_FLAG2_RSC_CAPABLE; 3815 adapter->flags2 |= IXGBE_FLAG2_RSC_CAPABLE;
3789 adapter->flags |= IXGBE_FLAG2_RSC_ENABLED; 3816 adapter->flags2 |= IXGBE_FLAG2_RSC_ENABLED;
3790 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; 3817 adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE;
3791 adapter->ring_feature[RING_F_FDIR].indices = 3818 adapter->ring_feature[RING_F_FDIR].indices =
3792 IXGBE_MAX_FDIR_INDICES; 3819 IXGBE_MAX_FDIR_INDICES;
3793 adapter->atr_sample_rate = 20; 3820 adapter->atr_sample_rate = 20;
3794 adapter->fdir_pballoc = 0; 3821 adapter->fdir_pballoc = 0;
3795#ifdef IXGBE_FCOE 3822#ifdef IXGBE_FCOE
3796 adapter->flags |= IXGBE_FLAG_FCOE_ENABLED; 3823 adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE;
3797 adapter->ring_feature[RING_F_FCOE].indices = IXGBE_FCRETA_SIZE; 3824 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
3825 adapter->ring_feature[RING_F_FCOE].indices = 0;
3798#endif /* IXGBE_FCOE */ 3826#endif /* IXGBE_FCOE */
3799 } 3827 }
3800 3828
@@ -4534,13 +4562,17 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work)
4534 u32 err; 4562 u32 err;
4535 4563
4536 adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK; 4564 adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK;
4565
4566 /* Time for electrical oscillations to settle down */
4567 msleep(100);
4537 err = hw->phy.ops.identify_sfp(hw); 4568 err = hw->phy.ops.identify_sfp(hw);
4569
4538 if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { 4570 if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
4539 dev_err(&adapter->pdev->dev, "failed to initialize because " 4571 dev_err(&adapter->pdev->dev, "failed to initialize because "
4540 "an unsupported SFP+ module type was detected.\n" 4572 "an unsupported SFP+ module type was detected.\n"
4541 "Reload the driver after installing a supported " 4573 "Reload the driver after installing a supported "
4542 "module.\n"); 4574 "module.\n");
4543 ixgbe_down(adapter); 4575 unregister_netdev(adapter->netdev);
4544 return; 4576 return;
4545 } 4577 }
4546 hw->mac.ops.setup_sfp(hw); 4578 hw->mac.ops.setup_sfp(hw);
@@ -5108,9 +5140,6 @@ static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
5108 int count = 0; 5140 int count = 0;
5109 unsigned int f; 5141 unsigned int f;
5110 5142
5111 r_idx = skb->queue_mapping;
5112 tx_ring = &adapter->tx_ring[r_idx];
5113
5114 if (adapter->vlgrp && vlan_tx_tag_present(skb)) { 5143 if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
5115 tx_flags |= vlan_tx_tag_get(skb); 5144 tx_flags |= vlan_tx_tag_get(skb);
5116 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 5145 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
@@ -5120,11 +5149,19 @@ static int ixgbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
5120 tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT; 5149 tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT;
5121 tx_flags |= IXGBE_TX_FLAGS_VLAN; 5150 tx_flags |= IXGBE_TX_FLAGS_VLAN;
5122 } else if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 5151 } else if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
5123 tx_flags |= (skb->queue_mapping << 13); 5152 if (skb->priority != TC_PRIO_CONTROL) {
5124 tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT; 5153 tx_flags |= (skb->queue_mapping << 13);
5125 tx_flags |= IXGBE_TX_FLAGS_VLAN; 5154 tx_flags <<= IXGBE_TX_FLAGS_VLAN_SHIFT;
5155 tx_flags |= IXGBE_TX_FLAGS_VLAN;
5156 } else {
5157 skb->queue_mapping =
5158 adapter->ring_feature[RING_F_DCB].indices-1;
5159 }
5126 } 5160 }
5127 5161
5162 r_idx = skb->queue_mapping;
5163 tx_ring = &adapter->tx_ring[r_idx];
5164
5128 if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) && 5165 if ((adapter->flags & IXGBE_FLAG_FCOE_ENABLED) &&
5129 (skb->protocol == htons(ETH_P_FCOE))) 5166 (skb->protocol == htons(ETH_P_FCOE)))
5130 tx_flags |= IXGBE_TX_FLAGS_FCOE; 5167 tx_flags |= IXGBE_TX_FLAGS_FCOE;
@@ -5323,12 +5360,19 @@ static int ixgbe_del_sanmac_netdev(struct net_device *dev)
5323static void ixgbe_netpoll(struct net_device *netdev) 5360static void ixgbe_netpoll(struct net_device *netdev)
5324{ 5361{
5325 struct ixgbe_adapter *adapter = netdev_priv(netdev); 5362 struct ixgbe_adapter *adapter = netdev_priv(netdev);
5363 int i;
5326 5364
5327 disable_irq(adapter->pdev->irq);
5328 adapter->flags |= IXGBE_FLAG_IN_NETPOLL; 5365 adapter->flags |= IXGBE_FLAG_IN_NETPOLL;
5329 ixgbe_intr(adapter->pdev->irq, netdev); 5366 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) {
5367 int num_q_vectors = adapter->num_msix_vectors - NON_Q_VECTORS;
5368 for (i = 0; i < num_q_vectors; i++) {
5369 struct ixgbe_q_vector *q_vector = adapter->q_vector[i];
5370 ixgbe_msix_clean_many(0, q_vector);
5371 }
5372 } else {
5373 ixgbe_intr(adapter->pdev->irq, netdev);
5374 }
5330 adapter->flags &= ~IXGBE_FLAG_IN_NETPOLL; 5375 adapter->flags &= ~IXGBE_FLAG_IN_NETPOLL;
5331 enable_irq(adapter->pdev->irq);
5332} 5376}
5333#endif 5377#endif
5334 5378
@@ -5563,29 +5607,18 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
5563#endif 5607#endif
5564 5608
5565#ifdef IXGBE_FCOE 5609#ifdef IXGBE_FCOE
5566 if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) { 5610 if (adapter->flags & IXGBE_FLAG_FCOE_CAPABLE) {
5567 if (hw->mac.ops.get_device_caps) { 5611 if (hw->mac.ops.get_device_caps) {
5568 hw->mac.ops.get_device_caps(hw, &device_caps); 5612 hw->mac.ops.get_device_caps(hw, &device_caps);
5569 if (!(device_caps & IXGBE_DEVICE_CAPS_FCOE_OFFLOADS)) { 5613 if (device_caps & IXGBE_DEVICE_CAPS_FCOE_OFFLOADS)
5570 netdev->features |= NETIF_F_FCOE_CRC; 5614 adapter->flags &= ~IXGBE_FLAG_FCOE_CAPABLE;
5571 netdev->features |= NETIF_F_FSO;
5572 netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1;
5573 DPRINTK(DRV, INFO, "FCoE enabled, "
5574 "disabling Flow Director\n");
5575 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
5576 adapter->flags &=
5577 ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE;
5578 adapter->atr_sample_rate = 0;
5579 } else {
5580 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
5581 }
5582 } 5615 }
5583 } 5616 }
5584#endif /* IXGBE_FCOE */ 5617#endif /* IXGBE_FCOE */
5585 if (pci_using_dac) 5618 if (pci_using_dac)
5586 netdev->features |= NETIF_F_HIGHDMA; 5619 netdev->features |= NETIF_F_HIGHDMA;
5587 5620
5588 if (adapter->flags & IXGBE_FLAG2_RSC_ENABLED) 5621 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
5589 netdev->features |= NETIF_F_LRO; 5622 netdev->features |= NETIF_F_LRO;
5590 5623
5591 /* make sure the EEPROM is good */ 5624 /* make sure the EEPROM is good */
@@ -5627,7 +5660,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
5627 adapter->wol = 0; 5660 adapter->wol = 0;
5628 break; 5661 break;
5629 } 5662 }
5630 device_init_wakeup(&adapter->pdev->dev, true);
5631 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); 5663 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
5632 5664
5633 /* pick up the PCI bus settings for reporting later */ 5665 /* pick up the PCI bus settings for reporting later */