aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/efx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/sfc/efx.c')
-rw-r--r--drivers/net/ethernet/sfc/efx.c70
1 files changed, 55 insertions, 15 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index c9c306aef2d9..ac571cf14485 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -1175,25 +1175,40 @@ static unsigned int efx_wanted_parallelism(struct efx_nic *efx)
1175 unsigned int count; 1175 unsigned int count;
1176 int cpu; 1176 int cpu;
1177 1177
1178 if (rss_cpus) 1178 if (rss_cpus) {
1179 return rss_cpus; 1179 count = rss_cpus;
1180 } else {
1181 if (unlikely(!zalloc_cpumask_var(&thread_mask, GFP_KERNEL))) {
1182 netif_warn(efx, probe, efx->net_dev,
1183 "RSS disabled due to allocation failure\n");
1184 return 1;
1185 }
1180 1186
1181 if (unlikely(!zalloc_cpumask_var(&thread_mask, GFP_KERNEL))) { 1187 count = 0;
1182 netif_warn(efx, probe, efx->net_dev, 1188 for_each_online_cpu(cpu) {
1183 "RSS disabled due to allocation failure\n"); 1189 if (!cpumask_test_cpu(cpu, thread_mask)) {
1184 return 1; 1190 ++count;
1191 cpumask_or(thread_mask, thread_mask,
1192 topology_thread_cpumask(cpu));
1193 }
1194 }
1195
1196 free_cpumask_var(thread_mask);
1185 } 1197 }
1186 1198
1187 count = 0; 1199 /* If RSS is requested for the PF *and* VFs then we can't write RSS
1188 for_each_online_cpu(cpu) { 1200 * table entries that are inaccessible to VFs
1189 if (!cpumask_test_cpu(cpu, thread_mask)) { 1201 */
1190 ++count; 1202 if (efx_sriov_wanted(efx) && efx_vf_size(efx) > 1 &&
1191 cpumask_or(thread_mask, thread_mask, 1203 count > efx_vf_size(efx)) {
1192 topology_thread_cpumask(cpu)); 1204 netif_warn(efx, probe, efx->net_dev,
1193 } 1205 "Reducing number of RSS channels from %u to %u for "
1206 "VF support. Increase vf-msix-limit to use more "
1207 "channels on the PF.\n",
1208 count, efx_vf_size(efx));
1209 count = efx_vf_size(efx);
1194 } 1210 }
1195 1211
1196 free_cpumask_var(thread_mask);
1197 return count; 1212 return count;
1198} 1213}
1199 1214
@@ -1327,6 +1342,10 @@ static int efx_probe_interrupts(struct efx_nic *efx)
1327 } 1342 }
1328 } 1343 }
1329 1344
1345 /* RSS might be usable on VFs even if it is disabled on the PF */
1346 efx->rss_spread = (efx->n_rx_channels > 1 ?
1347 efx->n_rx_channels : efx_vf_size(efx));
1348
1330 return 0; 1349 return 0;
1331} 1350}
1332 1351
@@ -1426,7 +1445,7 @@ static int efx_probe_nic(struct efx_nic *efx)
1426 get_random_bytes(&efx->rx_hash_key, sizeof(efx->rx_hash_key)); 1445 get_random_bytes(&efx->rx_hash_key, sizeof(efx->rx_hash_key));
1427 for (i = 0; i < ARRAY_SIZE(efx->rx_indir_table); i++) 1446 for (i = 0; i < ARRAY_SIZE(efx->rx_indir_table); i++)
1428 efx->rx_indir_table[i] = 1447 efx->rx_indir_table[i] =
1429 ethtool_rxfh_indir_default(i, efx->n_rx_channels); 1448 ethtool_rxfh_indir_default(i, efx->rss_spread);
1430 1449
1431 efx_set_channels(efx); 1450 efx_set_channels(efx);
1432 netif_set_real_num_tx_queues(efx->net_dev, efx->n_tx_channels); 1451 netif_set_real_num_tx_queues(efx->net_dev, efx->n_tx_channels);
@@ -1915,6 +1934,7 @@ static int efx_set_mac_address(struct net_device *net_dev, void *data)
1915 } 1934 }
1916 1935
1917 memcpy(net_dev->dev_addr, new_addr, net_dev->addr_len); 1936 memcpy(net_dev->dev_addr, new_addr, net_dev->addr_len);
1937 efx_sriov_mac_address_changed(efx);
1918 1938
1919 /* Reconfigure the MAC */ 1939 /* Reconfigure the MAC */
1920 mutex_lock(&efx->mac_lock); 1940 mutex_lock(&efx->mac_lock);
@@ -1981,6 +2001,12 @@ static const struct net_device_ops efx_netdev_ops = {
1981 .ndo_set_mac_address = efx_set_mac_address, 2001 .ndo_set_mac_address = efx_set_mac_address,
1982 .ndo_set_rx_mode = efx_set_rx_mode, 2002 .ndo_set_rx_mode = efx_set_rx_mode,
1983 .ndo_set_features = efx_set_features, 2003 .ndo_set_features = efx_set_features,
2004#ifdef CONFIG_SFC_SRIOV
2005 .ndo_set_vf_mac = efx_sriov_set_vf_mac,
2006 .ndo_set_vf_vlan = efx_sriov_set_vf_vlan,
2007 .ndo_set_vf_spoofchk = efx_sriov_set_vf_spoofchk,
2008 .ndo_get_vf_config = efx_sriov_get_vf_config,
2009#endif
1984#ifdef CONFIG_NET_POLL_CONTROLLER 2010#ifdef CONFIG_NET_POLL_CONTROLLER
1985 .ndo_poll_controller = efx_netpoll, 2011 .ndo_poll_controller = efx_netpoll,
1986#endif 2012#endif
@@ -2150,6 +2176,7 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok)
2150 2176
2151 efx_start_interrupts(efx, false); 2177 efx_start_interrupts(efx, false);
2152 efx_restore_filters(efx); 2178 efx_restore_filters(efx);
2179 efx_sriov_reset(efx);
2153 2180
2154 mutex_unlock(&efx->mac_lock); 2181 mutex_unlock(&efx->mac_lock);
2155 2182
@@ -2440,6 +2467,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev)
2440 rtnl_unlock(); 2467 rtnl_unlock();
2441 2468
2442 efx_stop_interrupts(efx, false); 2469 efx_stop_interrupts(efx, false);
2470 efx_sriov_fini(efx);
2443 efx_unregister_netdev(efx); 2471 efx_unregister_netdev(efx);
2444 2472
2445 efx_mtd_remove(efx); 2473 efx_mtd_remove(efx);
@@ -2581,6 +2609,11 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
2581 if (rc) 2609 if (rc)
2582 goto fail4; 2610 goto fail4;
2583 2611
2612 rc = efx_sriov_init(efx);
2613 if (rc)
2614 netif_err(efx, probe, efx->net_dev,
2615 "SR-IOV can't be enabled rc %d\n", rc);
2616
2584 netif_dbg(efx, probe, efx->net_dev, "initialisation successful\n"); 2617 netif_dbg(efx, probe, efx->net_dev, "initialisation successful\n");
2585 2618
2586 /* Try to create MTDs, but allow this to fail */ 2619 /* Try to create MTDs, but allow this to fail */
@@ -2732,6 +2765,10 @@ static int __init efx_init_module(void)
2732 if (rc) 2765 if (rc)
2733 goto err_notifier; 2766 goto err_notifier;
2734 2767
2768 rc = efx_init_sriov();
2769 if (rc)
2770 goto err_sriov;
2771
2735 reset_workqueue = create_singlethread_workqueue("sfc_reset"); 2772 reset_workqueue = create_singlethread_workqueue("sfc_reset");
2736 if (!reset_workqueue) { 2773 if (!reset_workqueue) {
2737 rc = -ENOMEM; 2774 rc = -ENOMEM;
@@ -2747,6 +2784,8 @@ static int __init efx_init_module(void)
2747 err_pci: 2784 err_pci:
2748 destroy_workqueue(reset_workqueue); 2785 destroy_workqueue(reset_workqueue);
2749 err_reset: 2786 err_reset:
2787 efx_fini_sriov();
2788 err_sriov:
2750 unregister_netdevice_notifier(&efx_netdev_notifier); 2789 unregister_netdevice_notifier(&efx_netdev_notifier);
2751 err_notifier: 2790 err_notifier:
2752 return rc; 2791 return rc;
@@ -2758,6 +2797,7 @@ static void __exit efx_exit_module(void)
2758 2797
2759 pci_unregister_driver(&efx_pci_driver); 2798 pci_unregister_driver(&efx_pci_driver);
2760 destroy_workqueue(reset_workqueue); 2799 destroy_workqueue(reset_workqueue);
2800 efx_fini_sriov();
2761 unregister_netdevice_notifier(&efx_netdev_notifier); 2801 unregister_netdevice_notifier(&efx_netdev_notifier);
2762 2802
2763} 2803}