]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
sfc: fix filter_id misinterpretation in edge case
authorJon Cooper <jcooper@solarflare.com>
Fri, 17 Feb 2017 15:49:13 +0000 (15:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Feb 2017 20:29:39 +0000 (15:29 -0500)
commit0ccb998bf46d8dc9799b60ea0090fb08c37e96ad
tree9796a55dbcd1acd5d3771d4807da736e0a903e89
parentfbdf0e28d061708cf18ba0f8e0db5360dc9a15b9
sfc: fix filter_id misinterpretation in edge case

On EF10, hardware filter IDs are 13 bits, but in some places we store
 32-bit "full filter IDs" in which higher order bits encode the filter
 match-priority.  This could cause a filter to have a full filter ID of
 0xffff, which is also the value EFX_EF10_FILTER_ID_INVALID which we use
 in 16-bit "short" filter IDs (without match-priority bits).  This would
 occur if the hardware filter ID was 0x1fff and the match-priority was 7.
Unfortunately, some code that checks for EFX_EF10_FILTER_ID_INVALID can
 be called on full filter IDs, and will WARN_ON if this ever happens.
So, since we have plenty of spare bits in the full filter ID, this patch
 shifts the priority bits left one bit when constructing the full filter
 IDs, ensuring that the 0x2000 bit of a full filter ID will always be 0
 and thus no full filter ID can ever equal EFX_EF10_FILTER_ID_INVALID.

This patch also replaces open-coded full<->short filter ID conversions
 with calls to functions, thus keeping the definition of the full filter
 ID format in one place.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sfc/ef10.c