aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2013-01-14 16:23:14 -0500
committerBen Hutchings <bhutchings@solarflare.com>2013-03-07 15:21:59 -0500
commite3a699fab34a724fa8693c1274d3ddb3e213a134 (patch)
tree388bf296145b34c1c3a1aa4af1e01cc52745a341 /drivers/net/ethernet/sfc
parent7de07a4deb8e7707892b952daa59eff67701f0c3 (diff)
sfc: Remove redundant parameter to efx_filter_search()
The 'for_insert' parameter is redundant since there are no longer any other operations that need to search based on a filter spec. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc')
-rw-r--r--drivers/net/ethernet/sfc/filter.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/net/ethernet/sfc/filter.c b/drivers/net/ethernet/sfc/filter.c
index 2fdd3a5f21c4..3d94ed73c65e 100644
--- a/drivers/net/ethernet/sfc/filter.c
+++ b/drivers/net/ethernet/sfc/filter.c
@@ -522,7 +522,7 @@ static bool efx_filter_equal(const struct efx_filter_spec *left,
522 522
523static int efx_filter_search(struct efx_filter_table *table, 523static int efx_filter_search(struct efx_filter_table *table,
524 struct efx_filter_spec *spec, u32 key, 524 struct efx_filter_spec *spec, u32 key,
525 bool for_insert, unsigned int *depth_required) 525 unsigned int *depth_required)
526{ 526{
527 unsigned hash, incr, filter_idx, depth, depth_max; 527 unsigned hash, incr, filter_idx, depth, depth_max;
528 528
@@ -531,25 +531,20 @@ static int efx_filter_search(struct efx_filter_table *table,
531 531
532 filter_idx = hash & (table->size - 1); 532 filter_idx = hash & (table->size - 1);
533 depth = 1; 533 depth = 1;
534 depth_max = (for_insert ? 534 depth_max = (spec->priority <= EFX_FILTER_PRI_HINT ?
535 (spec->priority <= EFX_FILTER_PRI_HINT ? 535 FILTER_CTL_SRCH_HINT_MAX : FILTER_CTL_SRCH_MAX);
536 FILTER_CTL_SRCH_HINT_MAX : FILTER_CTL_SRCH_MAX) :
537 table->search_depth[spec->type]);
538 536
539 for (;;) { 537 for (;;) {
540 /* Return success if entry is used and matches this spec 538 /* Return success if entry is unused or matches this spec */
541 * or entry is unused and we are trying to insert. 539 if (!test_bit(filter_idx, table->used_bitmap) ||
542 */ 540 efx_filter_equal(spec, &table->spec[filter_idx])) {
543 if (test_bit(filter_idx, table->used_bitmap) ?
544 efx_filter_equal(spec, &table->spec[filter_idx]) :
545 for_insert) {
546 *depth_required = depth; 541 *depth_required = depth;
547 return filter_idx; 542 return filter_idx;
548 } 543 }
549 544
550 /* Return failure if we reached the maximum search depth */ 545 /* Return failure if we reached the maximum search depth */
551 if (depth == depth_max) 546 if (depth == depth_max)
552 return for_insert ? -EBUSY : -ENOENT; 547 return -EBUSY;
553 548
554 filter_idx = (filter_idx + incr) & (table->size - 1); 549 filter_idx = (filter_idx + incr) & (table->size - 1);
555 ++depth; 550 ++depth;
@@ -686,7 +681,7 @@ s32 efx_filter_insert_filter(struct efx_nic *efx, struct efx_filter_spec *spec,
686 681
687 spin_lock_bh(&state->lock); 682 spin_lock_bh(&state->lock);
688 683
689 rc = efx_filter_search(table, spec, key, true, &depth); 684 rc = efx_filter_search(table, spec, key, &depth);
690 if (rc < 0) 685 if (rc < 0)
691 goto out; 686 goto out;
692 filter_idx = rc; 687 filter_idx = rc;