]> git.baikalelectronics.ru Git - kernel.git/commit
sfc: Fix replacement detection in efx_filter_insert_filter()
authorBen Hutchings <bhutchings@solarflare.com>
Mon, 14 Jan 2013 21:23:17 +0000 (21:23 +0000)
committerBen Hutchings <bhutchings@solarflare.com>
Thu, 7 Mar 2013 20:22:02 +0000 (20:22 +0000)
commit0920fdb4998c40d143ee6ffb6bcb9b2efb85eb22
tree186c2692912d839778d27e3d2276d0bfd5a59d2d
parenta53d0c0b5af430ab4aed0e414b89e23591d3588a
sfc: Fix replacement detection in efx_filter_insert_filter()

efx_filter_insert_filter() uses the first table entry in the hash chain
that either has the same match values or is empty.  This means that
replacement doesn't always work correctly:

1. Insert filter F1 with match values M1, hashing to H1, at first
   possible entry E1.
2. Insert filter F2 with match values M2, hashing to H1, at second
   possible entry E2.
3. Remove filter F1.
4. Insert filter F3 with match values M2, hashing to H1, at first
   possible entry E1.

F3 should have either replaced F2 or been rejected (depending on
priority and the replace_equal parameter).

Instead, search for both a matching filter that the inserted filter
would replace, and an available insertion point, up to the applicable
maximum search depths.  If we insert at lower depth than a replaced
filter, clear the replaced filter.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
drivers/net/ethernet/sfc/filter.c