aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-09-19 17:35:30 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-19 17:35:30 -0400
commit6c62f606b0db9f5ee47fbc20a5fc8ddcc803841a (patch)
tree4b1fffc27a7482a8a1e5c105e21ddc110adb7a14 /drivers/net
parent58310b3fc6aaa4f896ad3cbcd88851e7ad0908f6 (diff)
parent6fbac83952f85b7d1c7ad674eb7c65d206da2c66 (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 2014-09-18 This series contains updates to ixgbe and ixgbevf. Ethan Zhao cleans up ixgbe and ixgbevf by removing bd_number from the adapter struct because it is not longer useful. Mark fixes ixgbe where if a hardware transmit timestamp is requested, an uninitialized workqueue entry may be scheduled. Added a check for a PTP clock to avoid that. Jacob provides a number of cleanups for ixgbe. Since we may call ixgbe_acquire_msix_vectors() prior to registering our netdevice, we should not use the netdevice specific printk and use e_dev_warn() instead. Similar to how ixgbevf handles acquiring MSI-X vectors, we can return an error code instead of relying on the flag being set. This makes it more clear that we have failed to setup MSI-X mode and will make it easier to consolidate MSI-X related code into a single function. In the case of disabling DCB, it is not an error since we still can function, we just have to let the user know. So use e_dev_warn() instead of e_err(). Added warnings for other features that are disabled when we are without MSI-X support. Cleanup flags that are no longer used or needed. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe.h4
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c151
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c11
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf.h1
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c4
5 files changed, 83 insertions, 88 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 06744f86fbc2..673d82095779 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -611,9 +611,7 @@ struct ixgbe_adapter {
611 * thus the additional *_CAPABLE flags. 611 * thus the additional *_CAPABLE flags.
612 */ 612 */
613 u32 flags; 613 u32 flags;
614#define IXGBE_FLAG_MSI_CAPABLE (u32)(1 << 0)
615#define IXGBE_FLAG_MSI_ENABLED (u32)(1 << 1) 614#define IXGBE_FLAG_MSI_ENABLED (u32)(1 << 1)
616#define IXGBE_FLAG_MSIX_CAPABLE (u32)(1 << 2)
617#define IXGBE_FLAG_MSIX_ENABLED (u32)(1 << 3) 615#define IXGBE_FLAG_MSIX_ENABLED (u32)(1 << 3)
618#define IXGBE_FLAG_RX_1BUF_CAPABLE (u32)(1 << 4) 616#define IXGBE_FLAG_RX_1BUF_CAPABLE (u32)(1 << 4)
619#define IXGBE_FLAG_RX_PS_CAPABLE (u32)(1 << 5) 617#define IXGBE_FLAG_RX_PS_CAPABLE (u32)(1 << 5)
@@ -728,8 +726,6 @@ struct ixgbe_adapter {
728 u8 __iomem *io_addr; /* Mainly for iounmap use */ 726 u8 __iomem *io_addr; /* Mainly for iounmap use */
729 u32 wol; 727 u32 wol;
730 728
731 u16 bd_number;
732
733 u16 eeprom_verh; 729 u16 eeprom_verh;
734 u16 eeprom_verl; 730 u16 eeprom_verl;
735 u16 eeprom_cap; 731 u16 eeprom_cap;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 7ecd99c5c5d5..ce40c77381e9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -696,46 +696,83 @@ static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
696 ixgbe_set_rss_queues(adapter); 696 ixgbe_set_rss_queues(adapter);
697} 697}
698 698
699static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter, 699/**
700 int vectors) 700 * ixgbe_acquire_msix_vectors - acquire MSI-X vectors
701 * @adapter: board private structure
702 *
703 * Attempts to acquire a suitable range of MSI-X vector interrupts. Will
704 * return a negative error code if unable to acquire MSI-X vectors for any
705 * reason.
706 */
707static int ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter)
701{ 708{
702 int vector_threshold; 709 struct ixgbe_hw *hw = &adapter->hw;
710 int i, vectors, vector_threshold;
711
712 /* We start by asking for one vector per queue pair */
713 vectors = max(adapter->num_rx_queues, adapter->num_tx_queues);
703 714
704 /* We'll want at least 2 (vector_threshold): 715 /* It is easy to be greedy for MSI-X vectors. However, it really
705 * 1) TxQ[0] + RxQ[0] handler 716 * doesn't do much good if we have a lot more vectors than CPUs. We'll
706 * 2) Other (Link Status Change, etc.) 717 * be somewhat conservative and only ask for (roughly) the same number
718 * of vectors as there are CPUs.
707 */ 719 */
708 vector_threshold = MIN_MSIX_COUNT; 720 vectors = min_t(int, vectors, num_online_cpus());
709 721
710 /* 722 /* Some vectors are necessary for non-queue interrupts */
711 * The more we get, the more we will assign to Tx/Rx Cleanup 723 vectors += NON_Q_VECTORS;
712 * for the separate queues...where Rx Cleanup >= Tx Cleanup. 724
713 * Right now, we simply care about how many we'll get; we'll 725 /* Hardware can only support a maximum of hw.mac->max_msix_vectors.
714 * set them up later while requesting irq's. 726 * With features such as RSS and VMDq, we can easily surpass the
727 * number of Rx and Tx descriptor queues supported by our device.
728 * Thus, we cap the maximum in the rare cases where the CPU count also
729 * exceeds our vector limit
715 */ 730 */
731 vectors = min_t(int, vectors, hw->mac.max_msix_vectors);
732
733 /* We want a minimum of two MSI-X vectors for (1) a TxQ[0] + RxQ[0]
734 * handler, and (2) an Other (Link Status Change, etc.) handler.
735 */
736 vector_threshold = MIN_MSIX_COUNT;
737
738 adapter->msix_entries = kcalloc(vectors,
739 sizeof(struct msix_entry),
740 GFP_KERNEL);
741 if (!adapter->msix_entries)
742 return -ENOMEM;
743
744 for (i = 0; i < vectors; i++)
745 adapter->msix_entries[i].entry = i;
746
716 vectors = pci_enable_msix_range(adapter->pdev, adapter->msix_entries, 747 vectors = pci_enable_msix_range(adapter->pdev, adapter->msix_entries,
717 vector_threshold, vectors); 748 vector_threshold, vectors);
718 749
719 if (vectors < 0) { 750 if (vectors < 0) {
720 /* Can't allocate enough MSI-X interrupts? Oh well. 751 /* A negative count of allocated vectors indicates an error in
721 * This just means we'll go with either a single MSI 752 * acquiring within the specified range of MSI-X vectors
722 * vector or fall back to legacy interrupts.
723 */ 753 */
724 netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev, 754 e_dev_warn("Failed to allocate MSI-X interrupts. Err: %d\n",
725 "Unable to allocate MSI-X interrupts\n"); 755 vectors);
756
726 adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED; 757 adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED;
727 kfree(adapter->msix_entries); 758 kfree(adapter->msix_entries);
728 adapter->msix_entries = NULL; 759 adapter->msix_entries = NULL;
729 } else { 760
730 adapter->flags |= IXGBE_FLAG_MSIX_ENABLED; /* Woot! */ 761 return vectors;
731 /*
732 * Adjust for only the vectors we'll use, which is minimum
733 * of max_msix_q_vectors + NON_Q_VECTORS, or the number of
734 * vectors we were allocated.
735 */
736 vectors -= NON_Q_VECTORS;
737 adapter->num_q_vectors = min(vectors, adapter->max_q_vectors);
738 } 762 }
763
764 /* we successfully allocated some number of vectors within our
765 * requested range.
766 */
767 adapter->flags |= IXGBE_FLAG_MSIX_ENABLED;
768
769 /* Adjust for only the vectors we'll use, which is minimum
770 * of max_q_vectors, or the number of vectors we were allocated.
771 */
772 vectors -= NON_Q_VECTORS;
773 adapter->num_q_vectors = min_t(int, vectors, adapter->max_q_vectors);
774
775 return 0;
739} 776}
740 777
741static void ixgbe_add_ring(struct ixgbe_ring *ring, 778static void ixgbe_add_ring(struct ixgbe_ring *ring,
@@ -1054,51 +1091,20 @@ static void ixgbe_reset_interrupt_capability(struct ixgbe_adapter *adapter)
1054 **/ 1091 **/
1055static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter) 1092static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
1056{ 1093{
1057 struct ixgbe_hw *hw = &adapter->hw; 1094 int err;
1058 int vector, v_budget, err;
1059
1060 /*
1061 * It's easy to be greedy for MSI-X vectors, but it really
1062 * doesn't do us much good if we have a lot more vectors
1063 * than CPU's. So let's be conservative and only ask for
1064 * (roughly) the same number of vectors as there are CPU's.
1065 * The default is to use pairs of vectors.
1066 */
1067 v_budget = max(adapter->num_rx_queues, adapter->num_tx_queues);
1068 v_budget = min_t(int, v_budget, num_online_cpus());
1069 v_budget += NON_Q_VECTORS;
1070
1071 /*
1072 * At the same time, hardware can only support a maximum of
1073 * hw.mac->max_msix_vectors vectors. With features
1074 * such as RSS and VMDq, we can easily surpass the number of Rx and Tx
1075 * descriptor queues supported by our device. Thus, we cap it off in
1076 * those rare cases where the cpu count also exceeds our vector limit.
1077 */
1078 v_budget = min_t(int, v_budget, hw->mac.max_msix_vectors);
1079
1080 /* A failure in MSI-X entry allocation isn't fatal, but it does
1081 * mean we disable MSI-X capabilities of the adapter. */
1082 adapter->msix_entries = kcalloc(v_budget,
1083 sizeof(struct msix_entry), GFP_KERNEL);
1084 if (adapter->msix_entries) {
1085 for (vector = 0; vector < v_budget; vector++)
1086 adapter->msix_entries[vector].entry = vector;
1087
1088 ixgbe_acquire_msix_vectors(adapter, v_budget);
1089 1095
1090 if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) 1096 /* We will try to get MSI-X interrupts first */
1091 return; 1097 if (!ixgbe_acquire_msix_vectors(adapter))
1092 } 1098 return;
1093 1099
1094 /* At this point, we do not have MSI-X capabilities. We need to 1100 /* At this point, we do not have MSI-X capabilities. We need to
1095 * reconfigure or disable various features which require MSI-X 1101 * reconfigure or disable various features which require MSI-X
1096 * capability. 1102 * capability.
1097 */ 1103 */
1098 1104
1099 /* disable DCB if number of TCs exceeds 1 */ 1105 /* Disable DCB unless we only have a single traffic class */
1100 if (netdev_get_num_tc(adapter->netdev) > 1) { 1106 if (netdev_get_num_tc(adapter->netdev) > 1) {
1101 e_err(probe, "num TCs exceeds number of queues - disabling DCB\n"); 1107 e_dev_warn("Number of DCB TCs exceeds number of available queues. Disabling DCB support.\n");
1102 netdev_reset_tc(adapter->netdev); 1108 netdev_reset_tc(adapter->netdev);
1103 1109
1104 if (adapter->hw.mac.type == ixgbe_mac_82598EB) 1110 if (adapter->hw.mac.type == ixgbe_mac_82598EB)
@@ -1108,13 +1114,16 @@ static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
1108 adapter->temp_dcb_cfg.pfc_mode_enable = false; 1114 adapter->temp_dcb_cfg.pfc_mode_enable = false;
1109 adapter->dcb_cfg.pfc_mode_enable = false; 1115 adapter->dcb_cfg.pfc_mode_enable = false;
1110 } 1116 }
1117
1111 adapter->dcb_cfg.num_tcs.pg_tcs = 1; 1118 adapter->dcb_cfg.num_tcs.pg_tcs = 1;
1112 adapter->dcb_cfg.num_tcs.pfc_tcs = 1; 1119 adapter->dcb_cfg.num_tcs.pfc_tcs = 1;
1113 1120
1114 /* disable SR-IOV */ 1121 /* Disable SR-IOV support */
1122 e_dev_warn("Disabling SR-IOV support\n");
1115 ixgbe_disable_sriov(adapter); 1123 ixgbe_disable_sriov(adapter);
1116 1124
1117 /* disable RSS */ 1125 /* Disable RSS */
1126 e_dev_warn("Disabling RSS support\n");
1118 adapter->ring_feature[RING_F_RSS].limit = 1; 1127 adapter->ring_feature[RING_F_RSS].limit = 1;
1119 1128
1120 /* recalculate number of queues now that many features have been 1129 /* recalculate number of queues now that many features have been
@@ -1124,13 +1133,11 @@ static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
1124 adapter->num_q_vectors = 1; 1133 adapter->num_q_vectors = 1;
1125 1134
1126 err = pci_enable_msi(adapter->pdev); 1135 err = pci_enable_msi(adapter->pdev);
1127 if (err) { 1136 if (err)
1128 netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev, 1137 e_dev_warn("Failed to allocate MSI interrupt, falling back to legacy. Error: %d\n",
1129 "Unable to allocate MSI interrupt, falling back to legacy. Error: %d\n", 1138 err);
1130 err); 1139 else
1131 return; 1140 adapter->flags |= IXGBE_FLAG_MSI_ENABLED;
1132 }
1133 adapter->flags |= IXGBE_FLAG_MSI_ENABLED;
1134} 1141}
1135 1142
1136/** 1143/**
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 6a12bb1d49ca..06ef5a32a893 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7108,9 +7108,10 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
7108 tx_flags |= IXGBE_TX_FLAGS_SW_VLAN; 7108 tx_flags |= IXGBE_TX_FLAGS_SW_VLAN;
7109 } 7109 }
7110 7110
7111 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP && 7111 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
7112 !test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS, 7112 adapter->ptp_clock &&
7113 &adapter->state))) { 7113 !test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS,
7114 &adapter->state)) {
7114 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 7115 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
7115 tx_flags |= IXGBE_TX_FLAGS_TSTAMP; 7116 tx_flags |= IXGBE_TX_FLAGS_TSTAMP;
7116 7117
@@ -7981,7 +7982,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
7981 struct ixgbe_adapter *adapter = NULL; 7982 struct ixgbe_adapter *adapter = NULL;
7982 struct ixgbe_hw *hw; 7983 struct ixgbe_hw *hw;
7983 const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data]; 7984 const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data];
7984 static int cards_found;
7985 int i, err, pci_using_dac, expected_gts; 7985 int i, err, pci_using_dac, expected_gts;
7986 unsigned int indices = MAX_TX_QUEUES; 7986 unsigned int indices = MAX_TX_QUEUES;
7987 u8 part_str[IXGBE_PBANUM_LENGTH]; 7987 u8 part_str[IXGBE_PBANUM_LENGTH];
@@ -8067,8 +8067,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
8067 netdev->watchdog_timeo = 5 * HZ; 8067 netdev->watchdog_timeo = 5 * HZ;
8068 strlcpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); 8068 strlcpy(netdev->name, pci_name(pdev), sizeof(netdev->name));
8069 8069
8070 adapter->bd_number = cards_found;
8071
8072 /* Setup hw api */ 8070 /* Setup hw api */
8073 memcpy(&hw->mac.ops, ii->mac_ops, sizeof(hw->mac.ops)); 8071 memcpy(&hw->mac.ops, ii->mac_ops, sizeof(hw->mac.ops));
8074 hw->mac.type = ii->mac; 8072 hw->mac.type = ii->mac;
@@ -8352,7 +8350,6 @@ skip_sriov:
8352 ixgbe_add_sanmac_netdev(netdev); 8350 ixgbe_add_sanmac_netdev(netdev);
8353 8351
8354 e_dev_info("%s\n", ixgbe_default_device_descr); 8352 e_dev_info("%s\n", ixgbe_default_device_descr);
8355 cards_found++;
8356 8353
8357#ifdef CONFIG_IXGBE_HWMON 8354#ifdef CONFIG_IXGBE_HWMON
8358 if (ixgbe_sysfs_init(adapter)) 8355 if (ixgbe_sysfs_init(adapter))
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
index a0a1de9ce238..ba96cb5b886d 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
@@ -385,7 +385,6 @@ struct ixgbevf_adapter {
385 /* structs defined in ixgbe_vf.h */ 385 /* structs defined in ixgbe_vf.h */
386 struct ixgbe_hw hw; 386 struct ixgbe_hw hw;
387 u16 msg_enable; 387 u16 msg_enable;
388 u16 bd_number;
389 /* Interrupt Throttle Rate */ 388 /* Interrupt Throttle Rate */
390 u32 eitr_param; 389 u32 eitr_param;
391 390
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index c22a00c3621a..030a219c85e3 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -3464,7 +3464,6 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3464 struct ixgbevf_adapter *adapter = NULL; 3464 struct ixgbevf_adapter *adapter = NULL;
3465 struct ixgbe_hw *hw = NULL; 3465 struct ixgbe_hw *hw = NULL;
3466 const struct ixgbevf_info *ii = ixgbevf_info_tbl[ent->driver_data]; 3466 const struct ixgbevf_info *ii = ixgbevf_info_tbl[ent->driver_data];
3467 static int cards_found;
3468 int err, pci_using_dac; 3467 int err, pci_using_dac;
3469 3468
3470 err = pci_enable_device(pdev); 3469 err = pci_enable_device(pdev);
@@ -3525,8 +3524,6 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3525 3524
3526 ixgbevf_assign_netdev_ops(netdev); 3525 ixgbevf_assign_netdev_ops(netdev);
3527 3526
3528 adapter->bd_number = cards_found;
3529
3530 /* Setup hw api */ 3527 /* Setup hw api */
3531 memcpy(&hw->mac.ops, ii->mac_ops, sizeof(hw->mac.ops)); 3528 memcpy(&hw->mac.ops, ii->mac_ops, sizeof(hw->mac.ops));
3532 hw->mac.type = ii->mac; 3529 hw->mac.type = ii->mac;
@@ -3601,7 +3598,6 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3601 hw_dbg(hw, "MAC: %d\n", hw->mac.type); 3598 hw_dbg(hw, "MAC: %d\n", hw->mac.type);
3602 3599
3603 hw_dbg(hw, "Intel(R) 82599 Virtual Function\n"); 3600 hw_dbg(hw, "Intel(R) 82599 Virtual Function\n");
3604 cards_found++;
3605 return 0; 3601 return 0;
3606 3602
3607err_register: 3603err_register: