nfp: flower: fix unsupported pre_tunnel flows
There are some pre_tunnel flows combinations which are incorrectly being offloaded without proper support, fix these. - Matching on MPLS is not supported for pre_tun. - Match on IPv4/IPv6 layer must be present. - Destination MAC address must match pre_tun.dev MAC Fixes: 120ffd84a9ec ("nfp: flower: verify pre-tunnel rules") Signed-off-by: Louis Peens <louis.peens@corigine.com> Signed-off-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a3bc483216
commit
982e5ee23d
@ -1142,6 +1142,12 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app,
|
|||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(key_layer & NFP_FLOWER_LAYER_IPV4) &&
|
||||||
|
!(key_layer & NFP_FLOWER_LAYER_IPV6)) {
|
||||||
|
NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: match on ipv4/ipv6 eth_type must be present");
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
/* Skip fields known to exist. */
|
/* Skip fields known to exist. */
|
||||||
mask += sizeof(struct nfp_flower_meta_tci);
|
mask += sizeof(struct nfp_flower_meta_tci);
|
||||||
ext += sizeof(struct nfp_flower_meta_tci);
|
ext += sizeof(struct nfp_flower_meta_tci);
|
||||||
@ -1152,6 +1158,13 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app,
|
|||||||
mask += sizeof(struct nfp_flower_in_port);
|
mask += sizeof(struct nfp_flower_in_port);
|
||||||
ext += sizeof(struct nfp_flower_in_port);
|
ext += sizeof(struct nfp_flower_in_port);
|
||||||
|
|
||||||
|
/* Ensure destination MAC address matches pre_tun_dev. */
|
||||||
|
mac = (struct nfp_flower_mac_mpls *)ext;
|
||||||
|
if (memcmp(&mac->mac_dst[0], flow->pre_tun_rule.dev->dev_addr, 6)) {
|
||||||
|
NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: dest MAC must match output dev MAC");
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
/* Ensure destination MAC address is fully matched. */
|
/* Ensure destination MAC address is fully matched. */
|
||||||
mac = (struct nfp_flower_mac_mpls *)mask;
|
mac = (struct nfp_flower_mac_mpls *)mask;
|
||||||
if (!is_broadcast_ether_addr(&mac->mac_dst[0])) {
|
if (!is_broadcast_ether_addr(&mac->mac_dst[0])) {
|
||||||
@ -1159,6 +1172,11 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app,
|
|||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mac->mpls_lse) {
|
||||||
|
NL_SET_ERR_MSG_MOD(extack, "unsupported pre-tunnel rule: MPLS not supported");
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
}
|
||||||
|
|
||||||
mask += sizeof(struct nfp_flower_mac_mpls);
|
mask += sizeof(struct nfp_flower_mac_mpls);
|
||||||
ext += sizeof(struct nfp_flower_mac_mpls);
|
ext += sizeof(struct nfp_flower_mac_mpls);
|
||||||
if (key_layer & NFP_FLOWER_LAYER_IPV4 ||
|
if (key_layer & NFP_FLOWER_LAYER_IPV4 ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user