Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 214967
b: refs/heads/master
c: 993284d
h: refs/heads/master
i:
  214965: 17e47f0
  214963: f91a31c
  214959: e0f1420
v: v3
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Oct 8, 2010
1 parent 1c8c6cc commit c3a6435
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 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: 4e7f79511e7332ae4056eda9156a0299511ea41e
refs/heads/master: 993284dfff3ba4643f08b592427d0ac758d30156
11 changes: 10 additions & 1 deletion trunk/drivers/net/sfc/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
#define FILTER_CTL_SRCH_FUDGE_WILD 3
#define FILTER_CTL_SRCH_FUDGE_FULL 1

/* Hard maximum hop limit. Hardware will time-out beyond 200-something.
* We also need to avoid infinite loops in efx_filter_search() when the
* table is full.
*/
#define FILTER_CTL_SRCH_MAX 200

struct efx_filter_table {
u32 offset; /* address of table relative to BAR */
unsigned size; /* number of entries */
Expand Down Expand Up @@ -183,7 +189,8 @@ static int efx_filter_search(struct efx_filter_table *table,
incr = efx_filter_increment(key);

for (depth = 1, filter_idx = hash & (table->size - 1);
test_bit(filter_idx, table->used_bitmap);
depth <= FILTER_CTL_SRCH_MAX &&
test_bit(filter_idx, table->used_bitmap);
++depth) {
cmp = &table->spec[filter_idx];
if (efx_filter_equal(spec, cmp))
Expand All @@ -192,6 +199,8 @@ static int efx_filter_search(struct efx_filter_table *table,
}
if (!for_insert)
return -ENOENT;
if (depth > FILTER_CTL_SRCH_MAX)
return -EBUSY;
found:
*depth_required = depth;
return filter_idx;
Expand Down

0 comments on commit c3a6435

Please sign in to comment.