Commit e4fe938c authored by Edward Cree's avatar Edward Cree Committed by David S. Miller

sfc: move 'must restore' flags out of ef10-specific nic_data

Common code in mcdi_filters.c uses these flags, so by moving them to
 either struct efx_nic (in the case of must_realloc_vis) or struct
 efx_mcdi_filter_table (for must_restore_rss_contexts and
 must_restore_filters), decouple this code from ef10's nic_data.
Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 484a75b1
...@@ -1281,13 +1281,13 @@ static int efx_ef10_init_nic(struct efx_nic *efx) ...@@ -1281,13 +1281,13 @@ static int efx_ef10_init_nic(struct efx_nic *efx)
nic_data->must_check_datapath_caps = false; nic_data->must_check_datapath_caps = false;
} }
if (nic_data->must_realloc_vis) { if (efx->must_realloc_vis) {
/* We cannot let the number of VIs change now */ /* We cannot let the number of VIs change now */
rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis, rc = efx_ef10_alloc_vis(efx, nic_data->n_allocated_vis,
nic_data->n_allocated_vis); nic_data->n_allocated_vis);
if (rc) if (rc)
return rc; return rc;
nic_data->must_realloc_vis = false; efx->must_realloc_vis = false;
} }
if (nic_data->must_restore_piobufs && nic_data->n_piobufs) { if (nic_data->must_restore_piobufs && nic_data->n_piobufs) {
...@@ -1326,9 +1326,8 @@ static void efx_ef10_table_reset_mc_allocations(struct efx_nic *efx) ...@@ -1326,9 +1326,8 @@ static void efx_ef10_table_reset_mc_allocations(struct efx_nic *efx)
#endif #endif
/* All our allocations have been reset */ /* All our allocations have been reset */
nic_data->must_realloc_vis = true; efx->must_realloc_vis = true;
nic_data->must_restore_rss_contexts = true; efx_mcdi_filter_table_reset_mc_allocations(efx);
nic_data->must_restore_filters = true;
nic_data->must_restore_piobufs = true; nic_data->must_restore_piobufs = true;
efx_ef10_forget_old_piobufs(efx); efx_ef10_forget_old_piobufs(efx);
efx->rss_context.context_id = EFX_MCDI_RSS_CONTEXT_INVALID; efx->rss_context.context_id = EFX_MCDI_RSS_CONTEXT_INVALID;
...@@ -3100,16 +3099,15 @@ void efx_ef10_handle_drain_event(struct efx_nic *efx) ...@@ -3100,16 +3099,15 @@ void efx_ef10_handle_drain_event(struct efx_nic *efx)
static int efx_ef10_fini_dmaq(struct efx_nic *efx) static int efx_ef10_fini_dmaq(struct efx_nic *efx)
{ {
struct efx_ef10_nic_data *nic_data = efx->nic_data;
struct efx_channel *channel;
struct efx_tx_queue *tx_queue; struct efx_tx_queue *tx_queue;
struct efx_rx_queue *rx_queue; struct efx_rx_queue *rx_queue;
struct efx_channel *channel;
int pending; int pending;
/* If the MC has just rebooted, the TX/RX queues will have already been /* If the MC has just rebooted, the TX/RX queues will have already been
* torn down, but efx->active_queues needs to be set to zero. * torn down, but efx->active_queues needs to be set to zero.
*/ */
if (nic_data->must_realloc_vis) { if (efx->must_realloc_vis) {
atomic_set(&efx->active_queues, 0); atomic_set(&efx->active_queues, 0);
return 0; return 0;
} }
......
...@@ -331,7 +331,6 @@ static s32 efx_mcdi_filter_insert_locked(struct efx_nic *efx, ...@@ -331,7 +331,6 @@ static s32 efx_mcdi_filter_insert_locked(struct efx_nic *efx,
bool replace_equal) bool replace_equal)
{ {
DECLARE_BITMAP(mc_rem_map, EFX_EF10_FILTER_SEARCH_LIMIT); DECLARE_BITMAP(mc_rem_map, EFX_EF10_FILTER_SEARCH_LIMIT);
struct efx_ef10_nic_data *nic_data = efx->nic_data;
struct efx_mcdi_filter_table *table; struct efx_mcdi_filter_table *table;
struct efx_filter_spec *saved_spec; struct efx_filter_spec *saved_spec;
struct efx_rss_context *ctx = NULL; struct efx_rss_context *ctx = NULL;
...@@ -460,7 +459,7 @@ static s32 efx_mcdi_filter_insert_locked(struct efx_nic *efx, ...@@ -460,7 +459,7 @@ static s32 efx_mcdi_filter_insert_locked(struct efx_nic *efx,
rc = efx_mcdi_filter_push(efx, spec, &table->entry[ins_index].handle, rc = efx_mcdi_filter_push(efx, spec, &table->entry[ins_index].handle,
ctx, replacing); ctx, replacing);
if (rc == -EINVAL && nic_data->must_realloc_vis) if (rc == -EINVAL && efx->must_realloc_vis)
/* The MC rebooted under us, causing it to reject our filter /* The MC rebooted under us, causing it to reject our filter
* insertion as pointing to an invalid VI (spec->dmaq_id). * insertion as pointing to an invalid VI (spec->dmaq_id).
*/ */
...@@ -1355,6 +1354,16 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx) ...@@ -1355,6 +1354,16 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx)
return rc; return rc;
} }
void efx_mcdi_filter_table_reset_mc_allocations(struct efx_nic *efx)
{
struct efx_mcdi_filter_table *table = efx->filter_state;
if (table) {
table->must_restore_filters = true;
table->must_restore_rss_contexts = true;
}
}
/* /*
* Caller must hold efx->filter_sem for read if race against * Caller must hold efx->filter_sem for read if race against
* efx_mcdi_filter_table_remove() is possible * efx_mcdi_filter_table_remove() is possible
...@@ -1362,7 +1371,6 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx) ...@@ -1362,7 +1371,6 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx)
void efx_mcdi_filter_table_restore(struct efx_nic *efx) void efx_mcdi_filter_table_restore(struct efx_nic *efx)
{ {
struct efx_mcdi_filter_table *table = efx->filter_state; struct efx_mcdi_filter_table *table = efx->filter_state;
struct efx_ef10_nic_data *nic_data = efx->nic_data;
unsigned int invalid_filters = 0, failed = 0; unsigned int invalid_filters = 0, failed = 0;
struct efx_mcdi_filter_vlan *vlan; struct efx_mcdi_filter_vlan *vlan;
struct efx_filter_spec *spec; struct efx_filter_spec *spec;
...@@ -1374,7 +1382,7 @@ void efx_mcdi_filter_table_restore(struct efx_nic *efx) ...@@ -1374,7 +1382,7 @@ void efx_mcdi_filter_table_restore(struct efx_nic *efx)
WARN_ON(!rwsem_is_locked(&efx->filter_sem)); WARN_ON(!rwsem_is_locked(&efx->filter_sem));
if (!nic_data->must_restore_filters) if (!table->must_restore_filters)
return; return;
if (!table) if (!table)
...@@ -1453,7 +1461,7 @@ void efx_mcdi_filter_table_restore(struct efx_nic *efx) ...@@ -1453,7 +1461,7 @@ void efx_mcdi_filter_table_restore(struct efx_nic *efx)
netif_err(efx, hw, efx->net_dev, netif_err(efx, hw, efx->net_dev,
"unable to restore %u filters\n", failed); "unable to restore %u filters\n", failed);
else else
nic_data->must_restore_filters = false; table->must_restore_filters = false;
} }
void efx_mcdi_filter_table_remove(struct efx_nic *efx) void efx_mcdi_filter_table_remove(struct efx_nic *efx)
...@@ -2176,13 +2184,13 @@ int efx_mcdi_rx_pull_rss_config(struct efx_nic *efx) ...@@ -2176,13 +2184,13 @@ int efx_mcdi_rx_pull_rss_config(struct efx_nic *efx)
void efx_mcdi_rx_restore_rss_contexts(struct efx_nic *efx) void efx_mcdi_rx_restore_rss_contexts(struct efx_nic *efx)
{ {
struct efx_ef10_nic_data *nic_data = efx->nic_data; struct efx_mcdi_filter_table *table = efx->filter_state;
struct efx_rss_context *ctx; struct efx_rss_context *ctx;
int rc; int rc;
WARN_ON(!mutex_is_locked(&efx->rss_lock)); WARN_ON(!mutex_is_locked(&efx->rss_lock));
if (!nic_data->must_restore_rss_contexts) if (!table->must_restore_rss_contexts)
return; return;
list_for_each_entry(ctx, &efx->rss_context.list, list) { list_for_each_entry(ctx, &efx->rss_context.list, list) {
...@@ -2198,7 +2206,7 @@ void efx_mcdi_rx_restore_rss_contexts(struct efx_nic *efx) ...@@ -2198,7 +2206,7 @@ void efx_mcdi_rx_restore_rss_contexts(struct efx_nic *efx)
"; RSS filters may fail to be applied\n", "; RSS filters may fail to be applied\n",
ctx->user_id, rc); ctx->user_id, rc);
} }
nic_data->must_restore_rss_contexts = false; table->must_restore_rss_contexts = false;
} }
int efx_mcdi_pf_rx_push_rss_config(struct efx_nic *efx, bool user, int efx_mcdi_pf_rx_push_rss_config(struct efx_nic *efx, bool user,
......
...@@ -75,6 +75,10 @@ struct efx_mcdi_filter_table { ...@@ -75,6 +75,10 @@ struct efx_mcdi_filter_table {
/* Whether in multicast promiscuous mode when last changed */ /* Whether in multicast promiscuous mode when last changed */
bool mc_promisc_last; bool mc_promisc_last;
bool mc_overflow; /* Too many MC addrs; should always imply mc_promisc */ bool mc_overflow; /* Too many MC addrs; should always imply mc_promisc */
/* RSS contexts have yet to be restored after MC reboot */
bool must_restore_rss_contexts;
/* filters have yet to be restored after MC reboot */
bool must_restore_filters;
bool vlan_filter; bool vlan_filter;
struct list_head vlan_list; struct list_head vlan_list;
}; };
...@@ -83,6 +87,8 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx); ...@@ -83,6 +87,8 @@ int efx_mcdi_filter_table_probe(struct efx_nic *efx);
void efx_mcdi_filter_table_remove(struct efx_nic *efx); void efx_mcdi_filter_table_remove(struct efx_nic *efx);
void efx_mcdi_filter_table_restore(struct efx_nic *efx); void efx_mcdi_filter_table_restore(struct efx_nic *efx);
void efx_mcdi_filter_table_reset_mc_allocations(struct efx_nic *efx);
/* /*
* The filter table(s) are managed by firmware and we have write-only * The filter table(s) are managed by firmware and we have write-only
* access. When removing filters we must identify them to the * access. When removing filters we must identify them to the
......
...@@ -890,6 +890,7 @@ struct efx_async_filter_insertion { ...@@ -890,6 +890,7 @@ struct efx_async_filter_insertion {
* @vport_id: The function's vport ID, only relevant for PFs * @vport_id: The function's vport ID, only relevant for PFs
* @int_error_count: Number of internal errors seen recently * @int_error_count: Number of internal errors seen recently
* @int_error_expire: Time at which error count will be expired * @int_error_expire: Time at which error count will be expired
* @must_realloc_vis: Flag: VIs have yet to be reallocated after MC reboot
* @irq_soft_enabled: Are IRQs soft-enabled? If not, IRQ handler will * @irq_soft_enabled: Are IRQs soft-enabled? If not, IRQ handler will
* acknowledge but do nothing else. * acknowledge but do nothing else.
* @irq_status: Interrupt status buffer * @irq_status: Interrupt status buffer
...@@ -1050,6 +1051,7 @@ struct efx_nic { ...@@ -1050,6 +1051,7 @@ struct efx_nic {
unsigned int_error_count; unsigned int_error_count;
unsigned long int_error_expire; unsigned long int_error_expire;
bool must_realloc_vis;
bool irq_soft_enabled; bool irq_soft_enabled;
struct efx_buffer irq_status; struct efx_buffer irq_status;
unsigned irq_zero_count; unsigned irq_zero_count;
......
...@@ -360,10 +360,6 @@ enum { ...@@ -360,10 +360,6 @@ enum {
* @warm_boot_count: Last seen MC warm boot count * @warm_boot_count: Last seen MC warm boot count
* @vi_base: Absolute index of first VI in this function * @vi_base: Absolute index of first VI in this function
* @n_allocated_vis: Number of VIs allocated to this function * @n_allocated_vis: Number of VIs allocated to this function
* @must_realloc_vis: Flag: VIs have yet to be reallocated after MC reboot
* @must_restore_rss_contexts: Flag: RSS contexts have yet to be restored after
* MC reboot
* @must_restore_filters: Flag: filters have yet to be restored after MC reboot
* @n_piobufs: Number of PIO buffers allocated to this function * @n_piobufs: Number of PIO buffers allocated to this function
* @wc_membase: Base address of write-combining mapping of the memory BAR * @wc_membase: Base address of write-combining mapping of the memory BAR
* @pio_write_base: Base address for writing PIO buffers * @pio_write_base: Base address for writing PIO buffers
...@@ -403,9 +399,6 @@ struct efx_ef10_nic_data { ...@@ -403,9 +399,6 @@ struct efx_ef10_nic_data {
u16 warm_boot_count; u16 warm_boot_count;
unsigned int vi_base; unsigned int vi_base;
unsigned int n_allocated_vis; unsigned int n_allocated_vis;
bool must_realloc_vis;
bool must_restore_rss_contexts;
bool must_restore_filters;
unsigned int n_piobufs; unsigned int n_piobufs;
void __iomem *wc_membase, *pio_write_base; void __iomem *wc_membase, *pio_write_base;
unsigned int pio_write_vi_base; unsigned int pio_write_vi_base;
......
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