summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/ef100_rx.c
diff options
context:
space:
mode:
authorEdward Cree <ecree@solarflare.com>2020-08-14 14:26:22 +0200
committerDavid S. Miller <davem@davemloft.net>2020-08-14 23:07:16 +0200
commit068885434ccb20542e0d759aebbefe7a6724d85f (patch)
tree0b09ac803886c4b0af1e13ab88bacfd83570a668 /drivers/net/ethernet/sfc/ef100_rx.c
parentMerge tag 'linux-can-fixes-for-5.9-20200814' of git://git.kernel.org/pub/scm/... (diff)
downloadlinux-068885434ccb20542e0d759aebbefe7a6724d85f.tar.xz
linux-068885434ccb20542e0d759aebbefe7a6724d85f.zip
sfc: check hash is valid before using it
On EF100, the RX hash field in the packet prefix may not be valid (e.g. if the header parse failed), and this is indicated by a one-bit flag elsewhere in the packet prefix. Only call skb_set_hash() if the RSS_HASH_VALID bit is set. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/ef100_rx.c')
-rw-r--r--drivers/net/ethernet/sfc/ef100_rx.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/sfc/ef100_rx.c b/drivers/net/ethernet/sfc/ef100_rx.c
index 13ba1a4f66fc..012925e878f4 100644
--- a/drivers/net/ethernet/sfc/ef100_rx.c
+++ b/drivers/net/ethernet/sfc/ef100_rx.c
@@ -31,6 +31,11 @@
#define ESF_GZ_RX_PREFIX_NT_OR_INNER_L3_CLASS_WIDTH \
ESF_GZ_RX_PREFIX_HCLASS_NT_OR_INNER_L3_CLASS_WIDTH
+bool ef100_rx_buf_hash_valid(const u8 *prefix)
+{
+ return PREFIX_FIELD(prefix, RSS_HASH_VALID);
+}
+
static bool check_fcs(struct efx_channel *channel, u32 *prefix)
{
u16 rxclass;