unsigned search_depth[EFX_FARCH_FILTER_TYPE_COUNT];
};
-struct efx_filter_state {
- spinlock_t lock;
+struct efx_farch_filter_state {
struct efx_farch_filter_table table[EFX_FARCH_FILTER_TABLE_COUNT];
-#ifdef CONFIG_RFS_ACCEL
- u32 *rps_flow_id;
- unsigned rps_expire_index;
-#endif
};
static void
static void efx_farch_filter_push_rx_config(struct efx_nic *efx)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
struct efx_farch_filter_table *table;
efx_oword_t filter_ctl;
static void efx_farch_filter_push_tx_limits(struct efx_nic *efx)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
struct efx_farch_filter_table *table;
efx_oword_t tx_cfg;
static void
efx_farch_filter_reset_rx_def(struct efx_nic *efx, unsigned filter_idx)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
struct efx_farch_filter_table *table =
&state->table[EFX_FARCH_FILTER_TABLE_RX_DEF];
struct efx_farch_filter_spec *spec = &table->spec[filter_idx];
u32 efx_filter_get_rx_id_limit(struct efx_nic *efx)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
unsigned int range = EFX_FARCH_FILTER_MATCH_PRI_COUNT - 1;
enum efx_farch_filter_table_id table_id;
struct efx_filter_spec *gen_spec,
bool replace_equal)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
struct efx_farch_filter_table *table;
struct efx_farch_filter_spec spec;
efx_oword_t filter;
rep_index = spec.type - EFX_FARCH_FILTER_UC_DEF;
ins_index = rep_index;
- spin_lock_bh(&state->lock);
+ spin_lock_bh(&efx->filter_lock);
} else {
/* Search concurrently for
* (1) a filter to be replaced (rep_index): any filter
ins_index = -1;
depth = 1;
- spin_lock_bh(&state->lock);
+ spin_lock_bh(&efx->filter_lock);
for (;;) {
if (!test_bit(i, table->used_bitmap)) {
rc = efx_farch_filter_make_id(&spec, ins_index);
out:
- spin_unlock_bh(&state->lock);
+ spin_unlock_bh(&efx->filter_lock);
return rc;
}
enum efx_filter_priority priority,
u32 filter_id)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
enum efx_farch_filter_table_id table_id;
struct efx_farch_filter_table *table;
unsigned int filter_idx;
return -ENOENT;
spec = &table->spec[filter_idx];
- spin_lock_bh(&state->lock);
+ spin_lock_bh(&efx->filter_lock);
if (test_bit(filter_idx, table->used_bitmap) &&
spec->priority == priority) {
rc = -ENOENT;
}
- spin_unlock_bh(&state->lock);
+ spin_unlock_bh(&efx->filter_lock);
return rc;
}
enum efx_filter_priority priority,
u32 filter_id, struct efx_filter_spec *spec_buf)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
enum efx_farch_filter_table_id table_id;
struct efx_farch_filter_table *table;
struct efx_farch_filter_spec *spec;
return -ENOENT;
spec = &table->spec[filter_idx];
- spin_lock_bh(&state->lock);
+ spin_lock_bh(&efx->filter_lock);
if (test_bit(filter_idx, table->used_bitmap) &&
spec->priority == priority) {
rc = -ENOENT;
}
- spin_unlock_bh(&state->lock);
+ spin_unlock_bh(&efx->filter_lock);
return rc;
}
enum efx_farch_filter_table_id table_id,
enum efx_filter_priority priority)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
struct efx_farch_filter_table *table = &state->table[table_id];
unsigned int filter_idx;
- spin_lock_bh(&state->lock);
+ spin_lock_bh(&efx->filter_lock);
for (filter_idx = 0; filter_idx < table->size; ++filter_idx)
if (table->spec[filter_idx].priority <= priority)
if (table->used == 0)
efx_farch_filter_table_reset_search_depth(table);
- spin_unlock_bh(&state->lock);
+ spin_unlock_bh(&efx->filter_lock);
}
/**
u32 efx_filter_count_rx_used(struct efx_nic *efx,
enum efx_filter_priority priority)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
enum efx_farch_filter_table_id table_id;
struct efx_farch_filter_table *table;
unsigned int filter_idx;
u32 count = 0;
- spin_lock_bh(&state->lock);
+ spin_lock_bh(&efx->filter_lock);
for (table_id = EFX_FARCH_FILTER_TABLE_RX_IP;
table_id <= EFX_FARCH_FILTER_TABLE_RX_DEF;
}
}
- spin_unlock_bh(&state->lock);
+ spin_unlock_bh(&efx->filter_lock);
return count;
}
enum efx_filter_priority priority,
u32 *buf, u32 size)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
enum efx_farch_filter_table_id table_id;
struct efx_farch_filter_table *table;
unsigned int filter_idx;
s32 count = 0;
- spin_lock_bh(&state->lock);
+ spin_lock_bh(&efx->filter_lock);
for (table_id = EFX_FARCH_FILTER_TABLE_RX_IP;
table_id <= EFX_FARCH_FILTER_TABLE_RX_DEF;
}
}
out:
- spin_unlock_bh(&state->lock);
+ spin_unlock_bh(&efx->filter_lock);
return count;
}
/* Restore filter stater after reset */
void efx_restore_filters(struct efx_nic *efx)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
enum efx_farch_filter_table_id table_id;
struct efx_farch_filter_table *table;
efx_oword_t filter;
unsigned int filter_idx;
- spin_lock_bh(&state->lock);
+ spin_lock_bh(&efx->filter_lock);
for (table_id = 0; table_id < EFX_FARCH_FILTER_TABLE_COUNT; table_id++) {
table = &state->table[table_id];
efx_farch_filter_push_rx_config(efx);
efx_farch_filter_push_tx_limits(efx);
- spin_unlock_bh(&state->lock);
+ spin_unlock_bh(&efx->filter_lock);
}
int efx_probe_filters(struct efx_nic *efx)
{
- struct efx_filter_state *state;
+ struct efx_farch_filter_state *state;
struct efx_farch_filter_table *table;
unsigned table_id;
- state = kzalloc(sizeof(*efx->filter_state), GFP_KERNEL);
+ state = kzalloc(sizeof(struct efx_farch_filter_state), GFP_KERNEL);
if (!state)
return -ENOMEM;
efx->filter_state = state;
- spin_lock_init(&state->lock);
+ spin_lock_init(&efx->filter_lock);
if (efx_nic_rev(efx) >= EFX_REV_FALCON_B0) {
#ifdef CONFIG_RFS_ACCEL
- state->rps_flow_id = kcalloc(FR_BZ_RX_FILTER_TBL0_ROWS,
- sizeof(*state->rps_flow_id),
- GFP_KERNEL);
- if (!state->rps_flow_id)
+ efx->rps_flow_id = kcalloc(FR_BZ_RX_FILTER_TBL0_ROWS,
+ sizeof(*efx->rps_flow_id),
+ GFP_KERNEL);
+ if (!efx->rps_flow_id)
goto fail;
#endif
table = &state->table[EFX_FARCH_FILTER_TABLE_RX_IP];
void efx_remove_filters(struct efx_nic *efx)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
enum efx_farch_filter_table_id table_id;
for (table_id = 0; table_id < EFX_FARCH_FILTER_TABLE_COUNT; table_id++) {
vfree(state->table[table_id].spec);
}
#ifdef CONFIG_RFS_ACCEL
- kfree(state->rps_flow_id);
+ kfree(efx->rps_flow_id);
#endif
kfree(state);
}
/* Update scatter enable flags for filters pointing to our own RX queues */
void efx_filter_update_rx_scatter(struct efx_nic *efx)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
enum efx_farch_filter_table_id table_id;
struct efx_farch_filter_table *table;
efx_oword_t filter;
unsigned int filter_idx;
- spin_lock_bh(&state->lock);
+ spin_lock_bh(&efx->filter_lock);
for (table_id = EFX_FARCH_FILTER_TABLE_RX_IP;
table_id <= EFX_FARCH_FILTER_TABLE_RX_DEF;
efx_farch_filter_push_rx_config(efx);
- spin_unlock_bh(&state->lock);
+ spin_unlock_bh(&efx->filter_lock);
}
#ifdef CONFIG_RFS_ACCEL
{
struct efx_nic *efx = netdev_priv(net_dev);
struct efx_channel *channel;
- struct efx_filter_state *state = efx->filter_state;
struct efx_filter_spec spec;
const struct iphdr *ip;
const __be16 *ports;
return rc;
/* Remember this so we can check whether to expire the filter later */
- state->rps_flow_id[rc] = flow_id;
+ efx->rps_flow_id[rc] = flow_id;
channel = efx_get_channel(efx, skb_get_rx_queue(skb));
++channel->rfs_filters_added;
bool __efx_filter_rfs_expire(struct efx_nic *efx, unsigned quota)
{
- struct efx_filter_state *state = efx->filter_state;
+ struct efx_farch_filter_state *state = efx->filter_state;
struct efx_farch_filter_table *table =
&state->table[EFX_FARCH_FILTER_TABLE_RX_IP];
unsigned mask = table->size - 1;
unsigned index;
unsigned stop;
- if (!spin_trylock_bh(&state->lock))
+ if (!spin_trylock_bh(&efx->filter_lock))
return false;
- index = state->rps_expire_index;
+ index = efx->rps_expire_index;
stop = (index + quota) & mask;
while (index != stop) {
table->spec[index].priority == EFX_FILTER_PRI_HINT &&
rps_may_expire_flow(efx->net_dev,
table->spec[index].dmaq_id,
- state->rps_flow_id[index], index)) {
+ efx->rps_flow_id[index], index)) {
netif_info(efx, rx_status, efx->net_dev,
"expiring filter %d [flow %u]\n",
- index, state->rps_flow_id[index]);
+ index, efx->rps_flow_id[index]);
efx_farch_filter_table_clear_entry(efx, table, index);
}
index = (index + 1) & mask;
}
- state->rps_expire_index = stop;
+ efx->rps_expire_index = stop;
if (table->used == 0)
efx_farch_filter_table_reset_search_depth(table);
- spin_unlock_bh(&state->lock);
+ spin_unlock_bh(&efx->filter_lock);
return true;
}