Skip to content

Commit fd262a6

Browse files
jahurleydavem330
authored andcommitted
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: af9d842 ("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>
1 parent 3929502 commit fd262a6

File tree

1 file changed

+5
-8
lines changed
  • drivers/net/ethernet/netronome/nfp/flower

1 file changed

+5
-8
lines changed

drivers/net/ethernet/netronome/nfp/flower/offload.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,12 @@ nfp_flower_calculate_key_layers(struct nfp_app *app,
368368
break;
369369

370370
default:
371-
/* Other ethtype - we need check the masks for the
372-
* remainder of the key to ensure we can offload.
373-
*/
374-
if (nfp_flower_check_higher_than_mac(flow)) {
375-
NL_SET_ERR_MSG_MOD(extack, "unsupported offload: non IPv4/IPv6 offload with L3/L4 matches not supported");
376-
return -EOPNOTSUPP;
377-
}
378-
break;
371+
NL_SET_ERR_MSG_MOD(extack, "unsupported offload: match on given EtherType is not supported");
372+
return -EOPNOTSUPP;
379373
}
374+
} else if (nfp_flower_check_higher_than_mac(flow)) {
375+
NL_SET_ERR_MSG_MOD(extack, "unsupported offload: cannot match above L2 without specified EtherType");
376+
return -EOPNOTSUPP;
380377
}
381378

382379
if (basic.mask && basic.mask->ip_proto) {

0 commit comments

Comments
 (0)