diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2011-01-04 10:22:36 -0500 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2011-02-16 18:02:03 -0500 |
commit | d4726051043dd270f9a161414a8d5ced76e91dff (patch) | |
tree | 56c673af0e2fb116bb3368f6a1b3e60da6449f36 /drivers/net/sfc | |
parent | 69a19ee60d5d5adc0addbdffd254f83b60660a07 (diff) |
sfc: Limit filter search depth further for performance hints (i.e. RFS)
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r-- | drivers/net/sfc/filter.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/sfc/filter.c b/drivers/net/sfc/filter.c index d4722c41c4ce..47a1b7984788 100644 --- a/drivers/net/sfc/filter.c +++ b/drivers/net/sfc/filter.c | |||
@@ -27,6 +27,10 @@ | |||
27 | */ | 27 | */ |
28 | #define FILTER_CTL_SRCH_MAX 200 | 28 | #define FILTER_CTL_SRCH_MAX 200 |
29 | 29 | ||
30 | /* Don't try very hard to find space for performance hints, as this is | ||
31 | * counter-productive. */ | ||
32 | #define FILTER_CTL_SRCH_HINT_MAX 5 | ||
33 | |||
30 | enum efx_filter_table_id { | 34 | enum efx_filter_table_id { |
31 | EFX_FILTER_TABLE_RX_IP = 0, | 35 | EFX_FILTER_TABLE_RX_IP = 0, |
32 | EFX_FILTER_TABLE_RX_MAC, | 36 | EFX_FILTER_TABLE_RX_MAC, |
@@ -325,15 +329,16 @@ static int efx_filter_search(struct efx_filter_table *table, | |||
325 | struct efx_filter_spec *spec, u32 key, | 329 | struct efx_filter_spec *spec, u32 key, |
326 | bool for_insert, int *depth_required) | 330 | bool for_insert, int *depth_required) |
327 | { | 331 | { |
328 | unsigned hash, incr, filter_idx, depth; | 332 | unsigned hash, incr, filter_idx, depth, depth_max; |
329 | struct efx_filter_spec *cmp; | 333 | struct efx_filter_spec *cmp; |
330 | 334 | ||
331 | hash = efx_filter_hash(key); | 335 | hash = efx_filter_hash(key); |
332 | incr = efx_filter_increment(key); | 336 | incr = efx_filter_increment(key); |
337 | depth_max = (spec->priority <= EFX_FILTER_PRI_HINT ? | ||
338 | FILTER_CTL_SRCH_HINT_MAX : FILTER_CTL_SRCH_MAX); | ||
333 | 339 | ||
334 | for (depth = 1, filter_idx = hash & (table->size - 1); | 340 | for (depth = 1, filter_idx = hash & (table->size - 1); |
335 | depth <= FILTER_CTL_SRCH_MAX && | 341 | depth <= depth_max && test_bit(filter_idx, table->used_bitmap); |
336 | test_bit(filter_idx, table->used_bitmap); | ||
337 | ++depth) { | 342 | ++depth) { |
338 | cmp = &table->spec[filter_idx]; | 343 | cmp = &table->spec[filter_idx]; |
339 | if (efx_filter_equal(spec, cmp)) | 344 | if (efx_filter_equal(spec, cmp)) |
@@ -342,7 +347,7 @@ static int efx_filter_search(struct efx_filter_table *table, | |||
342 | } | 347 | } |
343 | if (!for_insert) | 348 | if (!for_insert) |
344 | return -ENOENT; | 349 | return -ENOENT; |
345 | if (depth > FILTER_CTL_SRCH_MAX) | 350 | if (depth > depth_max) |
346 | return -EBUSY; | 351 | return -EBUSY; |
347 | found: | 352 | found: |
348 | *depth_required = depth; | 353 | *depth_required = depth; |