Skip to content

Commit

Permalink
nfp: flower: add ipv6 bit to pre_tunnel control message
Browse files Browse the repository at this point in the history
Differentiate between ipv4 and ipv6 flows when configuring the pre_tunnel
table to prevent them trampling each other in the table.

Fixes: 7834616 ("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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Louis Peens authored and David S. Miller committed Mar 16, 2021
1 parent 982e5ee commit 5c4f5e1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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. */
Expand Down

0 comments on commit 5c4f5e1

Please sign in to comment.