Commit dfb1cfbd authored by Martin Habets's avatar Martin Habets Committed by Jakub Kicinski

siena: Make SRIOV support specific for Siena

Add a Siena Kconfig option and use it in stead of the sfc one.
Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 65d4b471
...@@ -47,7 +47,7 @@ config SFC_MCDI_MON ...@@ -47,7 +47,7 @@ config SFC_MCDI_MON
This exposes the on-board firmware-managed sensors as a This exposes the on-board firmware-managed sensors as a
hardware monitor device. hardware monitor device.
config SFC_SRIOV config SFC_SRIOV
bool "Solarflare SFC9000/SFC9100-family SR-IOV support" bool "Solarflare SFC9100-family SR-IOV support"
depends on SFC && PCI_IOV depends on SFC && PCI_IOV
default y default y
help help
......
...@@ -18,3 +18,11 @@ config SFC_SIENA_MTD ...@@ -18,3 +18,11 @@ config SFC_SIENA_MTD
This exposes the on-board flash and/or EEPROM as MTD devices This exposes the on-board flash and/or EEPROM as MTD devices
(e.g. /dev/mtd1). This is required to update the firmware or (e.g. /dev/mtd1). This is required to update the firmware or
the boot configuration under Linux. the boot configuration under Linux.
config SFC_SIENA_SRIOV
bool "Solarflare SFC9000-family SR-IOV support"
depends on SFC_SIENA && PCI_IOV
default n
help
This enables support for the Single Root I/O Virtualization
features, allowing accelerated network performance in
virtualized environments.
...@@ -6,6 +6,6 @@ sfc-siena-y += farch.o siena.o \ ...@@ -6,6 +6,6 @@ sfc-siena-y += farch.o siena.o \
mcdi.o mcdi_port.o mcdi_port_common.o \ mcdi.o mcdi_port.o mcdi_port_common.o \
mcdi_mon.o mcdi_mon.o
sfc-siena-$(CONFIG_SFC_SIENA_MTD) += mtd.o sfc-siena-$(CONFIG_SFC_SIENA_MTD) += mtd.o
sfc-siena-$(CONFIG_SFC_SRIOV) += siena_sriov.o sfc-siena-$(CONFIG_SFC_SIENA_SRIOV) += siena_sriov.o
obj-$(CONFIG_SFC_SIENA) += sfc-siena.o obj-$(CONFIG_SFC_SIENA) += sfc-siena.o
...@@ -359,7 +359,7 @@ static int efx_probe_all(struct efx_nic *efx) ...@@ -359,7 +359,7 @@ static int efx_probe_all(struct efx_nic *efx)
goto fail3; goto fail3;
} }
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
rc = efx->type->vswitching_probe(efx); rc = efx->type->vswitching_probe(efx);
if (rc) /* not fatal; the PF will still work fine */ if (rc) /* not fatal; the PF will still work fine */
netif_warn(efx, probe, efx->net_dev, netif_warn(efx, probe, efx->net_dev,
...@@ -383,7 +383,7 @@ static int efx_probe_all(struct efx_nic *efx) ...@@ -383,7 +383,7 @@ static int efx_probe_all(struct efx_nic *efx)
fail5: fail5:
efx_siena_remove_filters(efx); efx_siena_remove_filters(efx);
fail4: fail4:
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
efx->type->vswitching_remove(efx); efx->type->vswitching_remove(efx);
#endif #endif
fail3: fail3:
...@@ -402,7 +402,7 @@ static void efx_remove_all(struct efx_nic *efx) ...@@ -402,7 +402,7 @@ static void efx_remove_all(struct efx_nic *efx)
efx_siena_remove_channels(efx); efx_siena_remove_channels(efx);
efx_siena_remove_filters(efx); efx_siena_remove_filters(efx);
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
efx->type->vswitching_remove(efx); efx->type->vswitching_remove(efx);
#endif #endif
efx_remove_port(efx); efx_remove_port(efx);
...@@ -592,7 +592,7 @@ static const struct net_device_ops efx_netdev_ops = { ...@@ -592,7 +592,7 @@ static const struct net_device_ops efx_netdev_ops = {
.ndo_features_check = efx_siena_features_check, .ndo_features_check = efx_siena_features_check,
.ndo_vlan_rx_add_vid = efx_vlan_rx_add_vid, .ndo_vlan_rx_add_vid = efx_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = efx_vlan_rx_kill_vid, .ndo_vlan_rx_kill_vid = efx_vlan_rx_kill_vid,
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
.ndo_set_vf_mac = efx_sriov_set_vf_mac, .ndo_set_vf_mac = efx_sriov_set_vf_mac,
.ndo_set_vf_vlan = efx_sriov_set_vf_vlan, .ndo_set_vf_vlan = efx_sriov_set_vf_vlan,
.ndo_set_vf_spoofchk = efx_sriov_set_vf_spoofchk, .ndo_set_vf_spoofchk = efx_sriov_set_vf_spoofchk,
...@@ -1108,7 +1108,7 @@ static int efx_pci_probe(struct pci_dev *pci_dev, ...@@ -1108,7 +1108,7 @@ static int efx_pci_probe(struct pci_dev *pci_dev,
/* efx_pci_sriov_configure returns the actual number of Virtual Functions /* efx_pci_sriov_configure returns the actual number of Virtual Functions
* enabled on success * enabled on success
*/ */
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
static int efx_pci_sriov_configure(struct pci_dev *dev, int num_vfs) static int efx_pci_sriov_configure(struct pci_dev *dev, int num_vfs)
{ {
int rc; int rc;
...@@ -1250,7 +1250,7 @@ static struct pci_driver efx_pci_driver = { ...@@ -1250,7 +1250,7 @@ static struct pci_driver efx_pci_driver = {
.remove = efx_pci_remove, .remove = efx_pci_remove,
.driver.pm = &efx_pm_ops, .driver.pm = &efx_pm_ops,
.err_handler = &efx_siena_err_handlers, .err_handler = &efx_siena_err_handlers,
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
.sriov_configure = efx_pci_sriov_configure, .sriov_configure = efx_pci_sriov_configure,
#endif #endif
}; };
......
...@@ -177,7 +177,7 @@ static inline void efx_siena_mtd_rename(struct efx_nic *efx) {} ...@@ -177,7 +177,7 @@ static inline void efx_siena_mtd_rename(struct efx_nic *efx) {}
static inline void efx_siena_mtd_remove(struct efx_nic *efx) {} static inline void efx_siena_mtd_remove(struct efx_nic *efx) {}
#endif #endif
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
static inline unsigned int efx_vf_size(struct efx_nic *efx) static inline unsigned int efx_vf_size(struct efx_nic *efx)
{ {
return 1 << efx->vi_scale; return 1 << efx->vi_scale;
......
...@@ -110,7 +110,7 @@ static unsigned int efx_wanted_parallelism(struct efx_nic *efx) ...@@ -110,7 +110,7 @@ static unsigned int efx_wanted_parallelism(struct efx_nic *efx)
/* If RSS is requested for the PF *and* VFs then we can't write RSS /* If RSS is requested for the PF *and* VFs then we can't write RSS
* table entries that are inaccessible to VFs * table entries that are inaccessible to VFs
*/ */
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
if (efx->type->sriov_wanted) { if (efx->type->sriov_wanted) {
if (efx->type->sriov_wanted(efx) && efx_vf_size(efx) > 1 && if (efx->type->sriov_wanted(efx) && efx_vf_size(efx) > 1 &&
count > efx_vf_size(efx)) { count > efx_vf_size(efx)) {
...@@ -348,7 +348,7 @@ int efx_siena_probe_interrupts(struct efx_nic *efx) ...@@ -348,7 +348,7 @@ int efx_siena_probe_interrupts(struct efx_nic *efx)
rss_spread = efx->n_rx_channels; rss_spread = efx->n_rx_channels;
/* RSS might be usable on VFs even if it is disabled on the PF */ /* RSS might be usable on VFs even if it is disabled on the PF */
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
if (efx->type->sriov_wanted) { if (efx->type->sriov_wanted) {
efx->rss_spread = ((rss_spread > 1 || efx->rss_spread = ((rss_spread > 1 ||
!efx->type->sriov_wanted(efx)) ? !efx->type->sriov_wanted(efx)) ?
......
...@@ -778,7 +778,7 @@ int efx_siena_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) ...@@ -778,7 +778,7 @@ int efx_siena_reset_up(struct efx_nic *efx, enum reset_type method, bool ok)
if (rc) if (rc)
goto fail; goto fail;
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
rc = efx->type->vswitching_restore(efx); rc = efx->type->vswitching_restore(efx);
if (rc) /* not fatal; the PF will still work fine */ if (rc) /* not fatal; the PF will still work fine */
netif_warn(efx, probe, efx->net_dev, netif_warn(efx, probe, efx->net_dev,
......
...@@ -228,7 +228,7 @@ static int efx_alloc_special_buffer(struct efx_nic *efx, ...@@ -228,7 +228,7 @@ static int efx_alloc_special_buffer(struct efx_nic *efx,
struct efx_special_buffer *buffer, struct efx_special_buffer *buffer,
unsigned int len) unsigned int len)
{ {
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
struct siena_nic_data *nic_data = efx->nic_data; struct siena_nic_data *nic_data = efx->nic_data;
#endif #endif
len = ALIGN(len, EFX_BUF_SIZE); len = ALIGN(len, EFX_BUF_SIZE);
...@@ -241,7 +241,7 @@ static int efx_alloc_special_buffer(struct efx_nic *efx, ...@@ -241,7 +241,7 @@ static int efx_alloc_special_buffer(struct efx_nic *efx,
/* Select new buffer ID */ /* Select new buffer ID */
buffer->index = efx->next_buffer_table; buffer->index = efx->next_buffer_table;
efx->next_buffer_table += buffer->entries; efx->next_buffer_table += buffer->entries;
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
BUG_ON(efx_siena_sriov_enabled(efx) && BUG_ON(efx_siena_sriov_enabled(efx) &&
nic_data->vf_buftbl_base < efx->next_buffer_table); nic_data->vf_buftbl_base < efx->next_buffer_table);
#endif #endif
...@@ -1187,7 +1187,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event) ...@@ -1187,7 +1187,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event)
netif_vdbg(efx, hw, efx->net_dev, "channel %d TXQ %d flushed\n", netif_vdbg(efx, hw, efx->net_dev, "channel %d TXQ %d flushed\n",
channel->channel, ev_sub_data); channel->channel, ev_sub_data);
efx_farch_handle_tx_flush_done(efx, event); efx_farch_handle_tx_flush_done(efx, event);
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
efx_siena_sriov_tx_flush_done(efx, event); efx_siena_sriov_tx_flush_done(efx, event);
#endif #endif
break; break;
...@@ -1195,7 +1195,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event) ...@@ -1195,7 +1195,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event)
netif_vdbg(efx, hw, efx->net_dev, "channel %d RXQ %d flushed\n", netif_vdbg(efx, hw, efx->net_dev, "channel %d RXQ %d flushed\n",
channel->channel, ev_sub_data); channel->channel, ev_sub_data);
efx_farch_handle_rx_flush_done(efx, event); efx_farch_handle_rx_flush_done(efx, event);
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
efx_siena_sriov_rx_flush_done(efx, event); efx_siena_sriov_rx_flush_done(efx, event);
#endif #endif
break; break;
...@@ -1233,7 +1233,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event) ...@@ -1233,7 +1233,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event)
ev_sub_data); ev_sub_data);
efx_siena_schedule_reset(efx, RESET_TYPE_DMA_ERROR); efx_siena_schedule_reset(efx, RESET_TYPE_DMA_ERROR);
} }
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
else else
efx_siena_sriov_desc_fetch_err(efx, ev_sub_data); efx_siena_sriov_desc_fetch_err(efx, ev_sub_data);
#endif #endif
...@@ -1246,7 +1246,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event) ...@@ -1246,7 +1246,7 @@ efx_farch_handle_driver_event(struct efx_channel *channel, efx_qword_t *event)
ev_sub_data); ev_sub_data);
efx_siena_schedule_reset(efx, RESET_TYPE_DMA_ERROR); efx_siena_schedule_reset(efx, RESET_TYPE_DMA_ERROR);
} }
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
else else
efx_siena_sriov_desc_fetch_err(efx, ev_sub_data); efx_siena_sriov_desc_fetch_err(efx, ev_sub_data);
#endif #endif
...@@ -1307,7 +1307,7 @@ int efx_farch_ev_process(struct efx_channel *channel, int budget) ...@@ -1307,7 +1307,7 @@ int efx_farch_ev_process(struct efx_channel *channel, int budget)
case FSE_AZ_EV_CODE_DRIVER_EV: case FSE_AZ_EV_CODE_DRIVER_EV:
efx_farch_handle_driver_event(channel, &event); efx_farch_handle_driver_event(channel, &event);
break; break;
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
case FSE_CZ_EV_CODE_USER_EV: case FSE_CZ_EV_CODE_USER_EV:
efx_siena_sriov_event(channel, &event); efx_siena_sriov_event(channel, &event);
break; break;
...@@ -1671,7 +1671,7 @@ void efx_farch_rx_pull_indir_table(struct efx_nic *efx) ...@@ -1671,7 +1671,7 @@ void efx_farch_rx_pull_indir_table(struct efx_nic *efx)
void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw) void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw)
{ {
unsigned vi_count, total_tx_channels; unsigned vi_count, total_tx_channels;
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
struct siena_nic_data *nic_data; struct siena_nic_data *nic_data;
unsigned buftbl_min; unsigned buftbl_min;
#endif #endif
...@@ -1679,7 +1679,7 @@ void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw) ...@@ -1679,7 +1679,7 @@ void efx_farch_dimension_resources(struct efx_nic *efx, unsigned sram_lim_qw)
total_tx_channels = efx->n_tx_channels + efx->n_extra_tx_channels; total_tx_channels = efx->n_tx_channels + efx->n_extra_tx_channels;
vi_count = max(efx->n_channels, total_tx_channels * EFX_MAX_TXQ_PER_CHANNEL); vi_count = max(efx->n_channels, total_tx_channels * EFX_MAX_TXQ_PER_CHANNEL);
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
nic_data = efx->nic_data; nic_data = efx->nic_data;
/* Account for the buffer table entries backing the datapath channels /* Account for the buffer table entries backing the datapath channels
* and the descriptor caches for those channels. * and the descriptor caches for those channels.
......
...@@ -1096,7 +1096,7 @@ struct efx_nic { ...@@ -1096,7 +1096,7 @@ struct efx_nic {
atomic_t rxq_flush_outstanding; atomic_t rxq_flush_outstanding;
wait_queue_head_t flush_wq; wait_queue_head_t flush_wq;
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
unsigned vf_count; unsigned vf_count;
unsigned vf_init_count; unsigned vf_init_count;
unsigned vi_scale; unsigned vi_scale;
......
...@@ -104,7 +104,7 @@ struct siena_nic_data { ...@@ -104,7 +104,7 @@ struct siena_nic_data {
struct efx_nic *efx; struct efx_nic *efx;
int wol_filter_id; int wol_filter_id;
u64 stats[SIENA_STAT_COUNT]; u64 stats[SIENA_STAT_COUNT];
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
struct siena_vf *vf; struct siena_vf *vf;
struct efx_channel *vfdi_channel; struct efx_channel *vfdi_channel;
unsigned vf_buftbl_base; unsigned vf_buftbl_base;
......
...@@ -328,7 +328,7 @@ static int siena_probe_nic(struct efx_nic *efx) ...@@ -328,7 +328,7 @@ static int siena_probe_nic(struct efx_nic *efx)
if (rc) if (rc)
goto fail5; goto fail5;
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
efx_siena_sriov_probe(efx); efx_siena_sriov_probe(efx);
#endif #endif
efx_siena_ptp_defer_probe_with_channel(efx); efx_siena_ptp_defer_probe_with_channel(efx);
...@@ -1068,7 +1068,7 @@ const struct efx_nic_type siena_a0_nic_type = { ...@@ -1068,7 +1068,7 @@ const struct efx_nic_type siena_a0_nic_type = {
#endif #endif
.ptp_write_host_time = siena_ptp_write_host_time, .ptp_write_host_time = siena_ptp_write_host_time,
.ptp_set_ts_config = siena_ptp_set_ts_config, .ptp_set_ts_config = siena_ptp_set_ts_config,
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
.sriov_configure = efx_siena_sriov_configure, .sriov_configure = efx_siena_sriov_configure,
.sriov_init = efx_siena_sriov_init, .sriov_init = efx_siena_sriov_init,
.sriov_fini = efx_siena_sriov_fini, .sriov_fini = efx_siena_sriov_fini,
......
...@@ -54,18 +54,18 @@ int efx_siena_sriov_set_vf_spoofchk(struct efx_nic *efx, int vf, ...@@ -54,18 +54,18 @@ int efx_siena_sriov_set_vf_spoofchk(struct efx_nic *efx, int vf,
int efx_siena_sriov_get_vf_config(struct efx_nic *efx, int vf, int efx_siena_sriov_get_vf_config(struct efx_nic *efx, int vf,
struct ifla_vf_info *ivf); struct ifla_vf_info *ivf);
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
static inline bool efx_siena_sriov_enabled(struct efx_nic *efx) static inline bool efx_siena_sriov_enabled(struct efx_nic *efx)
{ {
return efx->vf_init_count != 0; return efx->vf_init_count != 0;
} }
#else /* !CONFIG_SFC_SRIOV */ #else /* !CONFIG_SFC_SIENA_SRIOV */
static inline bool efx_siena_sriov_enabled(struct efx_nic *efx) static inline bool efx_siena_sriov_enabled(struct efx_nic *efx)
{ {
return false; return false;
} }
#endif /* CONFIG_SFC_SRIOV */ #endif /* CONFIG_SFC_SIENA_SRIOV */
void efx_siena_sriov_probe(struct efx_nic *efx); void efx_siena_sriov_probe(struct efx_nic *efx);
void efx_siena_sriov_tx_flush_done(struct efx_nic *efx, efx_qword_t *event); void efx_siena_sriov_tx_flush_done(struct efx_nic *efx, efx_qword_t *event);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "net_driver.h" #include "net_driver.h"
#ifdef CONFIG_SFC_SRIOV #ifdef CONFIG_SFC_SIENA_SRIOV
static inline static inline
int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac) int efx_sriov_set_vf_mac(struct net_device *net_dev, int vf_i, u8 *mac)
...@@ -78,6 +78,6 @@ int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i, ...@@ -78,6 +78,6 @@ int efx_sriov_set_vf_link_state(struct net_device *net_dev, int vf_i,
else else
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
#endif /* CONFIG_SFC_SRIOV */ #endif /* CONFIG_SFC_SIENA_SRIOV */
#endif /* EFX_SRIOV_H */ #endif /* EFX_SRIOV_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment