Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 368191
b: refs/heads/master
c: 385904f
h: refs/heads/master
i:
  368189: e51ed79
  368187: e9a52ad
  368183: fa7e02e
  368175: c0ea518
  368159: 7899928
  368127: ce02e51
v: v3
  • Loading branch information
Ben Hutchings committed Mar 7, 2013
1 parent 72c92f4 commit e432360
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e3a699fab34a724fa8693c1274d3ddb3e213a134
refs/heads/master: 385904f819e31fcf5a5aa53fa91f3352bffa6d19
35 changes: 19 additions & 16 deletions trunk/drivers/net/ethernet/sfc/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,6 @@ static u32 efx_filter_build(efx_oword_t *filter, struct efx_filter_spec *spec)
break;
}

case EFX_FILTER_TABLE_RX_DEF:
/* One filter spec per type */
BUILD_BUG_ON(EFX_FILTER_INDEX_UC_DEF != 0);
BUILD_BUG_ON(EFX_FILTER_INDEX_MC_DEF !=
EFX_FILTER_MC_DEF - EFX_FILTER_UC_DEF);
return spec->type - EFX_FILTER_UC_DEF;

case EFX_FILTER_TABLE_RX_MAC: {
bool is_wild = spec->type == EFX_FILTER_MAC_WILD;
EFX_POPULATE_OWORD_7(
Expand Down Expand Up @@ -667,25 +660,35 @@ s32 efx_filter_insert_filter(struct efx_nic *efx, struct efx_filter_spec *spec,
struct efx_filter_spec *saved_spec;
efx_oword_t filter;
unsigned int filter_idx, depth = 0;
u32 key;
int rc;

if (!table || table->size == 0)
return -EINVAL;

key = efx_filter_build(&filter, spec);

netif_vdbg(efx, hw, efx->net_dev,
"%s: type %d search_depth=%d", __func__, spec->type,
table->search_depth[spec->type]);

spin_lock_bh(&state->lock);
if (table->id == EFX_FILTER_TABLE_RX_DEF) {
/* One filter spec per type */
BUILD_BUG_ON(EFX_FILTER_INDEX_UC_DEF != 0);
BUILD_BUG_ON(EFX_FILTER_INDEX_MC_DEF !=
EFX_FILTER_MC_DEF - EFX_FILTER_UC_DEF);
filter_idx = spec->type - EFX_FILTER_INDEX_UC_DEF;

spin_lock_bh(&state->lock);
} else {
u32 key = efx_filter_build(&filter, spec);

spin_lock_bh(&state->lock);

rc = efx_filter_search(table, spec, key, &depth);
if (rc < 0)
goto out;
filter_idx = rc;
BUG_ON(filter_idx >= table->size);
}

rc = efx_filter_search(table, spec, key, &depth);
if (rc < 0)
goto out;
filter_idx = rc;
BUG_ON(filter_idx >= table->size);
saved_spec = &table->spec[filter_idx];

if (test_bit(filter_idx, table->used_bitmap)) {
Expand Down

0 comments on commit e432360

Please sign in to comment.