aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2012-05-09 04:09:25 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-07-21 19:02:09 -0400
commit99d744875d01d57d832b8dbfc36d9a1990d503b8 (patch)
tree993e5373e56d489f5662ea6b4d648697a23e788a /drivers/net/ethernet
parent186e868786f97c8026f0a81400b451ace306b3a4 (diff)
ixgbe: Drop probe_vf and merge functionality into ixgbe_enable_sriov
This is meant to fix a bug in which we were not checking for pre-existing VFs if we were not setting the max_vfs value at driver load. What happens now is that we always call ixgbe_enable_sriov and this checks for pre-existing VFs ore requested VFs prior to deciding on no SR-IOV. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Tested-by: Sibai Li <sibai.li@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c3
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c33
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c24
3 files changed, 28 insertions, 32 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 38d1b65777ad..3ff5aa801a6b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -1061,8 +1061,7 @@ static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
1061 } 1061 }
1062 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; 1062 adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
1063 adapter->atr_sample_rate = 0; 1063 adapter->atr_sample_rate = 0;
1064 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) 1064 ixgbe_disable_sriov(adapter);
1065 ixgbe_disable_sriov(adapter);
1066 1065
1067 adapter->ring_feature[RING_F_RSS].limit = 1; 1066 adapter->ring_feature[RING_F_RSS].limit = 1;
1068 ixgbe_set_num_queues(adapter); 1067 ixgbe_set_num_queues(adapter);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index f4e53c1a7338..24f2b455a23f 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -4490,6 +4490,12 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
4490 hw->fc.send_xon = true; 4490 hw->fc.send_xon = true;
4491 hw->fc.disable_fc_autoneg = false; 4491 hw->fc.disable_fc_autoneg = false;
4492 4492
4493#ifdef CONFIG_PCI_IOV
4494 /* assign number of SR-IOV VFs */
4495 if (hw->mac.type != ixgbe_mac_82598EB)
4496 adapter->num_vfs = (max_vfs > 63) ? 0 : max_vfs;
4497
4498#endif
4493 /* enable itr by default in dynamic mode */ 4499 /* enable itr by default in dynamic mode */
4494 adapter->rx_itr_setting = 1; 4500 adapter->rx_itr_setting = 1;
4495 adapter->tx_itr_setting = 1; 4501 adapter->tx_itr_setting = 1;
@@ -6942,26 +6948,6 @@ static const struct net_device_ops ixgbe_netdev_ops = {
6942 .ndo_fdb_dump = ixgbe_ndo_fdb_dump, 6948 .ndo_fdb_dump = ixgbe_ndo_fdb_dump,
6943}; 6949};
6944 6950
6945static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,
6946 const struct ixgbe_info *ii)
6947{
6948#ifdef CONFIG_PCI_IOV
6949 struct ixgbe_hw *hw = &adapter->hw;
6950
6951 if (hw->mac.type == ixgbe_mac_82598EB)
6952 return;
6953
6954 /* The 82599 supports up to 64 VFs per physical function
6955 * but this implementation limits allocation to 63 so that
6956 * basic networking resources are still available to the
6957 * physical function. If the user requests greater thn
6958 * 63 VFs then it is an error - reset to default of zero.
6959 */
6960 adapter->num_vfs = (max_vfs > 63) ? 0 : max_vfs;
6961 ixgbe_enable_sriov(adapter, ii);
6962#endif /* CONFIG_PCI_IOV */
6963}
6964
6965/** 6951/**
6966 * ixgbe_wol_supported - Check whether device supports WoL 6952 * ixgbe_wol_supported - Check whether device supports WoL
6967 * @hw: hw specific details 6953 * @hw: hw specific details
@@ -7206,8 +7192,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
7206 goto err_sw_init; 7192 goto err_sw_init;
7207 } 7193 }
7208 7194
7209 ixgbe_probe_vf(adapter, ii); 7195#ifdef CONFIG_PCI_IOV
7196 ixgbe_enable_sriov(adapter, ii);
7210 7197
7198#endif
7211 netdev->features = NETIF_F_SG | 7199 netdev->features = NETIF_F_SG |
7212 NETIF_F_IP_CSUM | 7200 NETIF_F_IP_CSUM |
7213 NETIF_F_IPV6_CSUM | 7201 NETIF_F_IPV6_CSUM |
@@ -7411,8 +7399,7 @@ err_register:
7411 ixgbe_release_hw_control(adapter); 7399 ixgbe_release_hw_control(adapter);
7412 ixgbe_clear_interrupt_scheme(adapter); 7400 ixgbe_clear_interrupt_scheme(adapter);
7413err_sw_init: 7401err_sw_init:
7414 if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) 7402 ixgbe_disable_sriov(adapter);
7415 ixgbe_disable_sriov(adapter);
7416 adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP; 7403 adapter->flags2 &= ~IXGBE_FLAG2_SEARCH_FOR_SFP;
7417 iounmap(hw->hw_addr); 7404 iounmap(hw->hw_addr);
7418err_ioremap: 7405err_ioremap:
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index a825d4808cd2..593fdd54f9ab 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -82,7 +82,6 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter,
82 const struct ixgbe_info *ii) 82 const struct ixgbe_info *ii)
83{ 83{
84 struct ixgbe_hw *hw = &adapter->hw; 84 struct ixgbe_hw *hw = &adapter->hw;
85 int err = 0;
86 int num_vf_macvlans, i; 85 int num_vf_macvlans, i;
87 struct vf_macvlans *mv_list; 86 struct vf_macvlans *mv_list;
88 int pre_existing_vfs = 0; 87 int pre_existing_vfs = 0;
@@ -106,10 +105,21 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter,
106 "enabled for this device - Please reload all " 105 "enabled for this device - Please reload all "
107 "VF drivers to avoid spoofed packet errors\n"); 106 "VF drivers to avoid spoofed packet errors\n");
108 } else { 107 } else {
108 int err;
109 /*
110 * The 82599 supports up to 64 VFs per physical function
111 * but this implementation limits allocation to 63 so that
112 * basic networking resources are still available to the
113 * physical function. If the user requests greater thn
114 * 63 VFs then it is an error - reset to default of zero.
115 */
116 adapter->num_vfs = min_t(unsigned int, adapter->num_vfs, 63);
117
109 err = pci_enable_sriov(adapter->pdev, adapter->num_vfs); 118 err = pci_enable_sriov(adapter->pdev, adapter->num_vfs);
110 if (err) { 119 if (err) {
111 e_err(probe, "Failed to enable PCI sriov: %d\n", err); 120 e_err(probe, "Failed to enable PCI sriov: %d\n", err);
112 goto err_novfs; 121 adapter->num_vfs = 0;
122 return;
113 } 123 }
114 } 124 }
115 125
@@ -193,11 +203,7 @@ void ixgbe_enable_sriov(struct ixgbe_adapter *adapter,
193 /* Oh oh */ 203 /* Oh oh */
194 e_err(probe, "Unable to allocate memory for VF Data Storage - " 204 e_err(probe, "Unable to allocate memory for VF Data Storage - "
195 "SRIOV disabled\n"); 205 "SRIOV disabled\n");
196 pci_disable_sriov(adapter->pdev); 206 ixgbe_disable_sriov(adapter);
197
198err_novfs:
199 adapter->flags &= ~IXGBE_FLAG_SRIOV_ENABLED;
200 adapter->num_vfs = 0;
201} 207}
202#endif /* #ifdef CONFIG_PCI_IOV */ 208#endif /* #ifdef CONFIG_PCI_IOV */
203 209
@@ -219,6 +225,10 @@ void ixgbe_disable_sriov(struct ixgbe_adapter *adapter)
219 kfree(adapter->mv_list); 225 kfree(adapter->mv_list);
220 adapter->mv_list = NULL; 226 adapter->mv_list = NULL;
221 227
228 /* if SR-IOV is already disabled then there is nothing to do */
229 if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
230 return;
231
222#ifdef CONFIG_PCI_IOV 232#ifdef CONFIG_PCI_IOV
223 /* disable iov and allow time for transactions to clear */ 233 /* disable iov and allow time for transactions to clear */
224 pci_disable_sriov(adapter->pdev); 234 pci_disable_sriov(adapter->pdev);