Skip to content

Commit be4d2a5

Browse files
committed
Merge branch 'nfp-flower-bugs'
John Hurley says: ==================== Fix bugs in NFP flower match offload This patchset contains bug fixes for corner cases in the match fields of flower offloads. The patches ensure that flows that should not be supported are not (incorrectly) offloaded. These include rules that match on layer 3 and/or 4 data without specified ethernet or ip protocol fields. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 3929502 + 103b7c2 commit be4d2a5

File tree

1 file changed

+11
-17
lines changed
  • drivers/net/ethernet/netronome/nfp/flower

1 file changed

+11
-17
lines changed

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

Lines changed: 11 additions & 17 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) {
@@ -389,18 +386,15 @@ nfp_flower_calculate_key_layers(struct nfp_app *app,
389386
key_layer |= NFP_FLOWER_LAYER_TP;
390387
key_size += sizeof(struct nfp_flower_tp_ports);
391388
break;
392-
default:
393-
/* Other ip proto - we need check the masks for the
394-
* remainder of the key to ensure we can offload.
395-
*/
396-
if (nfp_flower_check_higher_than_l3(flow)) {
397-
NL_SET_ERR_MSG_MOD(extack, "unsupported offload: unknown IP protocol with L4 matches not supported");
398-
return -EOPNOTSUPP;
399-
}
400-
break;
401389
}
402390
}
403391

392+
if (!(key_layer & NFP_FLOWER_LAYER_TP) &&
393+
nfp_flower_check_higher_than_l3(flow)) {
394+
NL_SET_ERR_MSG_MOD(extack, "unsupported offload: cannot match on L4 information without specified IP protocol type");
395+
return -EOPNOTSUPP;
396+
}
397+
404398
if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_TCP)) {
405399
struct flow_match_tcp tcp;
406400
u32 tcp_flags;

0 commit comments

Comments
 (0)