]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
nfp: flower: fix ethernet check on match fields
authorJohn Hurley <john.hurley@netronome.com>
Wed, 10 Jul 2019 18:30:29 +0000 (19:30 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Jul 2019 22:31:55 +0000 (15:31 -0700)
commitfd262a6d8a5d8d504e6a0b0183a05deda6bef7a3
treeb146f48acd05d7f2caf53fee426c766cca44f608
parent3929502b957ed05575e74134a817f26c42d13e2c
nfp: flower: fix ethernet check on match fields

NFP firmware does not explicitly match on an ethernet type field. Rather,
each rule has a bitmask of match fields that can be used to infer the
ethernet type.

Currently, if a flower rule contains an unknown ethernet type, a check is
carried out for matches on other fields of the packet. If matches on
layer 3 or 4 are found, then the offload is rejected as firmware will not
be able to extract these fields from a packet with an ethernet type it
does not currently understand.

However, if a rule contains an unknown ethernet type without any L3 (or
above) matches then this will effectively be offloaded as a rule with a
wildcarded ethertype. This can lead to misclassifications on the firmware.

Fix this issue by rejecting all flower rules that specify a match on an
unknown ethernet type.

Further ensure correct offloads by moving the 'L3 and above' check to any
rule that does not specify an ethernet type and rejecting rules with
further matches. This means that we can still offload rules with a
wildcarded ethertype if they only match on L2 fields but will prevent
rules which match on further fields that we cannot be sure if the firmware
will be able to extract.

Fixes: af9d842c1354 ("nfp: extend flower add flow offload")
Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/netronome/nfp/flower/offload.c