* [PATCH net 0/3] Fixes for nfp pre_tunnel code
@ 2021-03-16 18:13 Simon Horman
2021-03-16 18:13 ` [PATCH net 1/3] nfp: flower: fix unsupported pre_tunnel flows Simon Horman
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Simon Horman @ 2021-03-16 18:13 UTC (permalink / raw)
To: David Miller
Cc: Jakub Kicinski, Louis Peens, netdev, oss-drivers, Simon Horman
Louis Peens says:
The following set of patches fixes up a few bugs in the pre_tun
decap code paths which has been hiding for a while.
Louis Peens (3):
nfp: flower: fix unsupported pre_tunnel flows
nfp: flower: add ipv6 bit to pre_tunnel control message
nfp: flower: fix pre_tun mask id allocation
.../ethernet/netronome/nfp/flower/metadata.c | 24 +++++++++++++------
.../ethernet/netronome/nfp/flower/offload.c | 18 ++++++++++++++
.../netronome/nfp/flower/tunnel_conf.c | 15 ++++++++++--
3 files changed, 48 insertions(+), 9 deletions(-)
--
2.20.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net 1/3] nfp: flower: fix unsupported pre_tunnel flows
2021-03-16 18:13 [PATCH net 0/3] Fixes for nfp pre_tunnel code Simon Horman
@ 2021-03-16 18:13 ` Simon Horman
2021-03-16 18:13 ` [PATCH net 2/3] nfp: flower: add ipv6 bit to pre_tunnel control message Simon Horman
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2021-03-16 18:13 UTC (permalink / raw)
To: David Miller
Cc: Jakub Kicinski, Louis Peens, netdev, oss-drivers, Simon Horman
From: Louis Peens <louis.peens@corigine.com>
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>
---
.../ethernet/netronome/nfp/flower/offload.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/ethernet/netronome/nfp/flower/offload.c b/drivers/net/ethernet/netronome/nfp/flower/offload.c
index 1c59aff2163c..d72225d64a75 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/offload.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/offload.c
@@ -1142,6 +1142,12 @@ nfp_flower_validate_pre_tun_rule(struct nfp_app *app,
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. */
mask += 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);
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. */
mac = (struct nfp_flower_mac_mpls *)mask;
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;
}
+ 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);
ext += sizeof(struct nfp_flower_mac_mpls);
if (key_layer & NFP_FLOWER_LAYER_IPV4 ||
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net 2/3] nfp: flower: add ipv6 bit to pre_tunnel control message
2021-03-16 18:13 [PATCH net 0/3] Fixes for nfp pre_tunnel code Simon Horman
2021-03-16 18:13 ` [PATCH net 1/3] nfp: flower: fix unsupported pre_tunnel flows Simon Horman
@ 2021-03-16 18:13 ` Simon Horman
2021-03-16 18:13 ` [PATCH net 3/3] nfp: flower: fix pre_tun mask id allocation Simon Horman
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2021-03-16 18:13 UTC (permalink / raw)
To: David Miller
Cc: Jakub Kicinski, Louis Peens, netdev, oss-drivers, Simon Horman
From: Louis Peens <louis.peens@corigine.com>
Differentiate between ipv4 and ipv6 flows when configuring the pre_tunnel
table to prevent them trampling each other in the table.
Fixes: 783461604f7e ("nfp: flower: update flow merge code to support IPv6 tunnels")
Signed-off-by: Louis Peens <louis.peens@corigine.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
.../ethernet/netronome/nfp/flower/tunnel_conf.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
index 7248d248f604..d19c02e99114 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
@@ -16,8 +16,9 @@
#define NFP_FL_MAX_ROUTES 32
#define NFP_TUN_PRE_TUN_RULE_LIMIT 32
-#define NFP_TUN_PRE_TUN_RULE_DEL 0x1
-#define NFP_TUN_PRE_TUN_IDX_BIT 0x8
+#define NFP_TUN_PRE_TUN_RULE_DEL BIT(0)
+#define NFP_TUN_PRE_TUN_IDX_BIT BIT(3)
+#define NFP_TUN_PRE_TUN_IPV6_BIT BIT(7)
/**
* struct nfp_tun_pre_run_rule - rule matched before decap
@@ -1268,6 +1269,7 @@ int nfp_flower_xmit_pre_tun_flow(struct nfp_app *app,
{
struct nfp_flower_priv *app_priv = app->priv;
struct nfp_tun_offloaded_mac *mac_entry;
+ struct nfp_flower_meta_tci *key_meta;
struct nfp_tun_pre_tun_rule payload;
struct net_device *internal_dev;
int err;
@@ -1290,6 +1292,15 @@ int nfp_flower_xmit_pre_tun_flow(struct nfp_app *app,
if (!mac_entry)
return -ENOENT;
+ /* Set/clear IPV6 bit. cpu_to_be16() swap will lead to MSB being
+ * set/clear for port_idx.
+ */
+ key_meta = (struct nfp_flower_meta_tci *)flow->unmasked_data;
+ if (key_meta->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV6)
+ mac_entry->index |= NFP_TUN_PRE_TUN_IPV6_BIT;
+ else
+ mac_entry->index &= ~NFP_TUN_PRE_TUN_IPV6_BIT;
+
payload.port_idx = cpu_to_be16(mac_entry->index);
/* Copy mac id and vlan to flow - dev may not exist at delete time. */
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net 3/3] nfp: flower: fix pre_tun mask id allocation
2021-03-16 18:13 [PATCH net 0/3] Fixes for nfp pre_tunnel code Simon Horman
2021-03-16 18:13 ` [PATCH net 1/3] nfp: flower: fix unsupported pre_tunnel flows Simon Horman
2021-03-16 18:13 ` [PATCH net 2/3] nfp: flower: add ipv6 bit to pre_tunnel control message Simon Horman
@ 2021-03-16 18:13 ` Simon Horman
2021-03-16 21:44 ` [PATCH net 0/3] Fixes for nfp pre_tunnel code Jakub Kicinski
2021-03-16 22:50 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2021-03-16 18:13 UTC (permalink / raw)
To: David Miller
Cc: Jakub Kicinski, Louis Peens, netdev, oss-drivers, Simon Horman
From: Louis Peens <louis.peens@corigine.com>
pre_tun_rule flows does not follow the usual add-flow path, instead
they are used to update the pre_tun table on the firmware. This means
that if the mask-id gets allocated here the firmware will never see the
"NFP_FL_META_FLAG_MANAGE_MASK" flag for the specific mask id, which
triggers the allocation on the firmware side. This leads to the firmware
mask being corrupted and causing all sorts of strange behaviour.
Fixes: f12725d98cbe ("nfp: flower: offload pre-tunnel rules")
Signed-off-by: Louis Peens <louis.peens@corigine.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
.../ethernet/netronome/nfp/flower/metadata.c | 24 +++++++++++++------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/flower/metadata.c b/drivers/net/ethernet/netronome/nfp/flower/metadata.c
index 5defd31d481c..aa06fcb38f8b 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/metadata.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/metadata.c
@@ -327,8 +327,14 @@ int nfp_compile_flow_metadata(struct nfp_app *app,
goto err_free_ctx_entry;
}
+ /* Do net allocate a mask-id for pre_tun_rules. These flows are used to
+ * configure the pre_tun table and are never actually send to the
+ * firmware as an add-flow message. This causes the mask-id allocation
+ * on the firmware to get out of sync if allocated here.
+ */
new_mask_id = 0;
- if (!nfp_check_mask_add(app, nfp_flow->mask_data,
+ if (!nfp_flow->pre_tun_rule.dev &&
+ !nfp_check_mask_add(app, nfp_flow->mask_data,
nfp_flow->meta.mask_len,
&nfp_flow->meta.flags, &new_mask_id)) {
NL_SET_ERR_MSG_MOD(extack, "invalid entry: cannot allocate a new mask id");
@@ -359,7 +365,8 @@ int nfp_compile_flow_metadata(struct nfp_app *app,
goto err_remove_mask;
}
- if (!nfp_check_mask_remove(app, nfp_flow->mask_data,
+ if (!nfp_flow->pre_tun_rule.dev &&
+ !nfp_check_mask_remove(app, nfp_flow->mask_data,
nfp_flow->meta.mask_len,
NULL, &new_mask_id)) {
NL_SET_ERR_MSG_MOD(extack, "invalid entry: cannot release mask id");
@@ -374,8 +381,10 @@ int nfp_compile_flow_metadata(struct nfp_app *app,
return 0;
err_remove_mask:
- nfp_check_mask_remove(app, nfp_flow->mask_data, nfp_flow->meta.mask_len,
- NULL, &new_mask_id);
+ if (!nfp_flow->pre_tun_rule.dev)
+ nfp_check_mask_remove(app, nfp_flow->mask_data,
+ nfp_flow->meta.mask_len,
+ NULL, &new_mask_id);
err_remove_rhash:
WARN_ON_ONCE(rhashtable_remove_fast(&priv->stats_ctx_table,
&ctx_entry->ht_node,
@@ -406,9 +415,10 @@ int nfp_modify_flow_metadata(struct nfp_app *app,
__nfp_modify_flow_metadata(priv, nfp_flow);
- nfp_check_mask_remove(app, nfp_flow->mask_data,
- nfp_flow->meta.mask_len, &nfp_flow->meta.flags,
- &new_mask_id);
+ if (!nfp_flow->pre_tun_rule.dev)
+ nfp_check_mask_remove(app, nfp_flow->mask_data,
+ nfp_flow->meta.mask_len, &nfp_flow->meta.flags,
+ &new_mask_id);
/* Update flow payload with mask ids. */
nfp_flow->unmasked_data[NFP_FL_MASK_ID_LOCATION] = new_mask_id;
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net 0/3] Fixes for nfp pre_tunnel code
2021-03-16 18:13 [PATCH net 0/3] Fixes for nfp pre_tunnel code Simon Horman
` (2 preceding siblings ...)
2021-03-16 18:13 ` [PATCH net 3/3] nfp: flower: fix pre_tun mask id allocation Simon Horman
@ 2021-03-16 21:44 ` Jakub Kicinski
2021-03-16 22:50 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2021-03-16 21:44 UTC (permalink / raw)
To: Simon Horman; +Cc: David Miller, Louis Peens, netdev, oss-drivers
On Tue, 16 Mar 2021 19:13:07 +0100 Simon Horman wrote:
> Louis Peens says:
>
> The following set of patches fixes up a few bugs in the pre_tun
> decap code paths which has been hiding for a while.
Acked-by: Jakub Kicinski <kuba@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net 0/3] Fixes for nfp pre_tunnel code
2021-03-16 18:13 [PATCH net 0/3] Fixes for nfp pre_tunnel code Simon Horman
` (3 preceding siblings ...)
2021-03-16 21:44 ` [PATCH net 0/3] Fixes for nfp pre_tunnel code Jakub Kicinski
@ 2021-03-16 22:50 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-16 22:50 UTC (permalink / raw)
To: Simon Horman; +Cc: davem, kuba, louis.peens, netdev, oss-drivers
Hello:
This series was applied to netdev/net.git (refs/heads/master):
On Tue, 16 Mar 2021 19:13:07 +0100 you wrote:
> Louis Peens says:
>
> The following set of patches fixes up a few bugs in the pre_tun
> decap code paths which has been hiding for a while.
>
> Louis Peens (3):
> nfp: flower: fix unsupported pre_tunnel flows
> nfp: flower: add ipv6 bit to pre_tunnel control message
> nfp: flower: fix pre_tun mask id allocation
>
> [...]
Here is the summary with links:
- [net,1/3] nfp: flower: fix unsupported pre_tunnel flows
https://git.kernel.org/netdev/net/c/982e5ee23d76
- [net,2/3] nfp: flower: add ipv6 bit to pre_tunnel control message
https://git.kernel.org/netdev/net/c/5c4f5e19d6a8
- [net,3/3] nfp: flower: fix pre_tun mask id allocation
https://git.kernel.org/netdev/net/c/d8ce0275e45e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-03-16 22:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 18:13 [PATCH net 0/3] Fixes for nfp pre_tunnel code Simon Horman
2021-03-16 18:13 ` [PATCH net 1/3] nfp: flower: fix unsupported pre_tunnel flows Simon Horman
2021-03-16 18:13 ` [PATCH net 2/3] nfp: flower: add ipv6 bit to pre_tunnel control message Simon Horman
2021-03-16 18:13 ` [PATCH net 3/3] nfp: flower: fix pre_tun mask id allocation Simon Horman
2021-03-16 21:44 ` [PATCH net 0/3] Fixes for nfp pre_tunnel code Jakub Kicinski
2021-03-16 22:50 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.