aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/sfc')
-rw-r--r--drivers/net/ethernet/sfc/Makefile2
-rw-r--r--drivers/net/ethernet/sfc/ef10.c1
-rw-r--r--drivers/net/ethernet/sfc/ef10_sriov.c52
-rw-r--r--drivers/net/ethernet/sfc/ef10_sriov.h2
-rw-r--r--drivers/net/ethernet/sfc/efx.c23
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h1
-rw-r--r--drivers/net/ethernet/sfc/siena.c1
-rw-r--r--drivers/net/ethernet/sfc/siena_sriov.c5
-rw-r--r--drivers/net/ethernet/sfc/siena_sriov.h1
9 files changed, 87 insertions, 1 deletions
diff --git a/drivers/net/ethernet/sfc/Makefile b/drivers/net/ethernet/sfc/Makefile
index a08a789f8378..ce8470fe79d5 100644
--- a/drivers/net/ethernet/sfc/Makefile
+++ b/drivers/net/ethernet/sfc/Makefile
@@ -3,6 +3,6 @@ sfc-y += efx.o nic.o farch.o falcon.o siena.o ef10.o tx.o \
3 tenxpress.o txc43128_phy.o falcon_boards.o \ 3 tenxpress.o txc43128_phy.o falcon_boards.o \
4 mcdi.o mcdi_port.o mcdi_mon.o ptp.o 4 mcdi.o mcdi_port.o mcdi_mon.o ptp.o
5sfc-$(CONFIG_SFC_MTD) += mtd.o 5sfc-$(CONFIG_SFC_MTD) += mtd.o
6sfc-$(CONFIG_SFC_SRIOV) += sriov.o siena_sriov.o 6sfc-$(CONFIG_SFC_SRIOV) += sriov.o siena_sriov.o ef10_sriov.o
7 7
8obj-$(CONFIG_SFC) += sfc.o 8obj-$(CONFIG_SFC) += sfc.o
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 4dab1b92ba18..68900293ef7b 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -3690,6 +3690,7 @@ const struct efx_nic_type efx_hunt_a0_nic_type = {
3690 .ptp_write_host_time = efx_ef10_ptp_write_host_time, 3690 .ptp_write_host_time = efx_ef10_ptp_write_host_time,
3691 .ptp_set_ts_sync_events = efx_ef10_ptp_set_ts_sync_events, 3691 .ptp_set_ts_sync_events = efx_ef10_ptp_set_ts_sync_events,
3692 .ptp_set_ts_config = efx_ef10_ptp_set_ts_config, 3692 .ptp_set_ts_config = efx_ef10_ptp_set_ts_config,
3693 .sriov_configure = efx_ef10_sriov_configure,
3693 .sriov_init = efx_ef10_sriov_init, 3694 .sriov_init = efx_ef10_sriov_init,
3694 .sriov_fini = efx_ef10_sriov_fini, 3695 .sriov_fini = efx_ef10_sriov_fini,
3695 .sriov_mac_address_changed = efx_ef10_sriov_mac_address_changed, 3696 .sriov_mac_address_changed = efx_ef10_sriov_mac_address_changed,
diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c
new file mode 100644
index 000000000000..9e6a3e197e01
--- /dev/null
+++ b/drivers/net/ethernet/sfc/ef10_sriov.c
@@ -0,0 +1,52 @@
1/****************************************************************************
2 * Driver for Solarflare network controllers and boards
3 * Copyright 2015 Solarflare Communications Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation, incorporated herein by reference.
8 */
9#include <linux/pci.h>
10#include <linux/module.h>
11#include "net_driver.h"
12#include "efx.h"
13#include "nic.h"
14#include "mcdi_pcol.h"
15
16#ifdef CONFIG_SFC_SRIOV
17static int efx_ef10_pci_sriov_enable(struct efx_nic *efx, int num_vfs)
18{
19 int rc = 0;
20 struct pci_dev *dev = efx->pci_dev;
21
22 efx->vf_count = num_vfs;
23 rc = pci_enable_sriov(dev, num_vfs);
24 if (rc) {
25 efx->vf_count = 0;
26 netif_err(efx, probe, efx->net_dev,
27 "Failed to enable SRIOV VFs\n");
28 }
29 return rc;
30}
31
32static int efx_ef10_pci_sriov_disable(struct efx_nic *efx)
33{
34 struct pci_dev *dev = efx->pci_dev;
35
36 efx->vf_count = 0;
37 pci_disable_sriov(dev);
38 return 0;
39}
40#endif
41
42int efx_ef10_sriov_configure(struct efx_nic *efx, int num_vfs)
43{
44#ifdef CONFIG_SFC_SRIOV
45 if (num_vfs == 0)
46 return efx_ef10_pci_sriov_disable(efx);
47 else
48 return efx_ef10_pci_sriov_enable(efx, num_vfs);
49#else
50 return -EOPNOTSUPP;
51#endif
52}
diff --git a/drivers/net/ethernet/sfc/ef10_sriov.h b/drivers/net/ethernet/sfc/ef10_sriov.h
index 030bca44ab01..6ea115e3c3f2 100644
--- a/drivers/net/ethernet/sfc/ef10_sriov.h
+++ b/drivers/net/ethernet/sfc/ef10_sriov.h
@@ -17,6 +17,8 @@ static inline bool efx_ef10_sriov_wanted(struct efx_nic *efx)
17 return false; 17 return false;
18} 18}
19 19
20int efx_ef10_sriov_configure(struct efx_nic *efx, int num_vfs);
21
20static inline int efx_ef10_sriov_init(struct efx_nic *efx) 22static inline int efx_ef10_sriov_init(struct efx_nic *efx)
21{ 23{
22 return -EOPNOTSUPP; 24 return -EOPNOTSUPP;
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 232c76689076..fa9ce2adf542 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -3047,6 +3047,26 @@ static int efx_pci_probe(struct pci_dev *pci_dev,
3047 return rc; 3047 return rc;
3048} 3048}
3049 3049
3050/* efx_pci_sriov_configure returns the actual number of Virtual Functions
3051 * enabled on success
3052 */
3053#ifdef CONFIG_SFC_SRIOV
3054static int efx_pci_sriov_configure(struct pci_dev *dev, int num_vfs)
3055{
3056 int rc;
3057 struct efx_nic *efx = pci_get_drvdata(dev);
3058
3059 if (efx->type->sriov_configure) {
3060 rc = efx->type->sriov_configure(efx, num_vfs);
3061 if (rc)
3062 return rc;
3063 else
3064 return num_vfs;
3065 } else
3066 return -ENOSYS;
3067}
3068#endif
3069
3050static int efx_pm_freeze(struct device *dev) 3070static int efx_pm_freeze(struct device *dev)
3051{ 3071{
3052 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); 3072 struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
@@ -3269,6 +3289,9 @@ static struct pci_driver efx_pci_driver = {
3269 .remove = efx_pci_remove, 3289 .remove = efx_pci_remove,
3270 .driver.pm = &efx_pm_ops, 3290 .driver.pm = &efx_pm_ops,
3271 .err_handler = &efx_err_handlers, 3291 .err_handler = &efx_err_handlers,
3292#ifdef CONFIG_SFC_SRIOV
3293 .sriov_configure = efx_pci_sriov_configure,
3294#endif
3272}; 3295};
3273 3296
3274/************************************************************************** 3297/**************************************************************************
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index ae0d145a5bed..a6f4d9aadd40 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -1330,6 +1330,7 @@ struct efx_nic_type {
1330 int (*ptp_set_ts_sync_events)(struct efx_nic *efx, bool en, bool temp); 1330 int (*ptp_set_ts_sync_events)(struct efx_nic *efx, bool en, bool temp);
1331 int (*ptp_set_ts_config)(struct efx_nic *efx, 1331 int (*ptp_set_ts_config)(struct efx_nic *efx,
1332 struct hwtstamp_config *init); 1332 struct hwtstamp_config *init);
1333 int (*sriov_configure)(struct efx_nic *efx, int num_vfs);
1333 int (*sriov_init)(struct efx_nic *efx); 1334 int (*sriov_init)(struct efx_nic *efx);
1334 void (*sriov_fini)(struct efx_nic *efx); 1335 void (*sriov_fini)(struct efx_nic *efx);
1335 void (*sriov_mac_address_changed)(struct efx_nic *efx); 1336 void (*sriov_mac_address_changed)(struct efx_nic *efx);
diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c
index 3671e1dd42ca..49792287dd67 100644
--- a/drivers/net/ethernet/sfc/siena.c
+++ b/drivers/net/ethernet/sfc/siena.c
@@ -998,6 +998,7 @@ const struct efx_nic_type siena_a0_nic_type = {
998#endif 998#endif
999 .ptp_write_host_time = siena_ptp_write_host_time, 999 .ptp_write_host_time = siena_ptp_write_host_time,
1000 .ptp_set_ts_config = siena_ptp_set_ts_config, 1000 .ptp_set_ts_config = siena_ptp_set_ts_config,
1001 .sriov_configure = efx_siena_sriov_configure,
1001 .sriov_init = efx_siena_sriov_init, 1002 .sriov_init = efx_siena_sriov_init,
1002 .sriov_fini = efx_siena_sriov_fini, 1003 .sriov_fini = efx_siena_sriov_fini,
1003 .sriov_mac_address_changed = efx_siena_sriov_mac_address_changed, 1004 .sriov_mac_address_changed = efx_siena_sriov_mac_address_changed,
diff --git a/drivers/net/ethernet/sfc/siena_sriov.c b/drivers/net/ethernet/sfc/siena_sriov.c
index ccadd4634001..9366756e6101 100644
--- a/drivers/net/ethernet/sfc/siena_sriov.c
+++ b/drivers/net/ethernet/sfc/siena_sriov.c
@@ -1701,3 +1701,8 @@ bool efx_siena_sriov_wanted(struct efx_nic *efx)
1701 return false; 1701 return false;
1702#endif 1702#endif
1703} 1703}
1704
1705int efx_siena_sriov_configure(struct efx_nic *efx, int num_vfs)
1706{
1707 return 0;
1708}
diff --git a/drivers/net/ethernet/sfc/siena_sriov.h b/drivers/net/ethernet/sfc/siena_sriov.h
index 5014ae41df65..8b2ca430a4ea 100644
--- a/drivers/net/ethernet/sfc/siena_sriov.h
+++ b/drivers/net/ethernet/sfc/siena_sriov.h
@@ -41,6 +41,7 @@
41 ((EFX_MAX_VF_EVQ_SIZE + 2 * EFX_MAX_DMAQ_SIZE) * \ 41 ((EFX_MAX_VF_EVQ_SIZE + 2 * EFX_MAX_DMAQ_SIZE) * \
42 sizeof(efx_qword_t) / EFX_BUF_SIZE) 42 sizeof(efx_qword_t) / EFX_BUF_SIZE)
43 43
44int efx_siena_sriov_configure(struct efx_nic *efx, int num_vfs);
44int efx_siena_sriov_init(struct efx_nic *efx); 45int efx_siena_sriov_init(struct efx_nic *efx);
45void efx_siena_sriov_fini(struct efx_nic *efx); 46void efx_siena_sriov_fini(struct efx_nic *efx);
46void efx_siena_sriov_mac_address_changed(struct efx_nic *efx); 47void efx_siena_sriov_mac_address_changed(struct efx_nic *efx);