Commit 656bd03a authored by Tianyu Yuan's avatar Tianyu Yuan Committed by Jakub Kicinski

nfp: flower: configure tunnel neighbour on cmsg rx

nfp_tun_write_neigh() function will configure a tunnel neighbour when
calling nfp_tun_neigh_event_handler() or nfp_flower_cmsg_process_one_rx()
(with no tunnel neighbour type) from firmware.

When configuring IP on physical port as a tunnel endpoint, no operation
will be performed after receiving the cmsg mentioned above.

Therefore, add a progress to configure tunnel neighbour in this case.

v2: Correct format of fixes tag.

Fixes: f1df7956 ("nfp: flower: rework tunnel neighbour configuration")
Signed-off-by: default avatarTianyu Yuan <tianyu.yuan@corigine.com>
Reviewed-by: default avatarLouis Peens <louis.peens@corigine.com>
Reviewed-by: default avatarBaowen Zheng <baowen.zheng@corigine.com>
Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20220714081915.148378-1-simon.horman@corigine.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3d8c51b2
...@@ -447,7 +447,8 @@ void nfp_tun_unlink_and_update_nn_entries(struct nfp_app *app, ...@@ -447,7 +447,8 @@ void nfp_tun_unlink_and_update_nn_entries(struct nfp_app *app,
static void static void
nfp_tun_write_neigh(struct net_device *netdev, struct nfp_app *app, nfp_tun_write_neigh(struct net_device *netdev, struct nfp_app *app,
void *flow, struct neighbour *neigh, bool is_ipv6) void *flow, struct neighbour *neigh, bool is_ipv6,
bool override)
{ {
bool neigh_invalid = !(neigh->nud_state & NUD_VALID) || neigh->dead; bool neigh_invalid = !(neigh->nud_state & NUD_VALID) || neigh->dead;
size_t neigh_size = is_ipv6 ? sizeof(struct nfp_tun_neigh_v6) : size_t neigh_size = is_ipv6 ? sizeof(struct nfp_tun_neigh_v6) :
...@@ -546,6 +547,13 @@ nfp_tun_write_neigh(struct net_device *netdev, struct nfp_app *app, ...@@ -546,6 +547,13 @@ nfp_tun_write_neigh(struct net_device *netdev, struct nfp_app *app,
if (nn_entry->flow) if (nn_entry->flow)
list_del(&nn_entry->list_head); list_del(&nn_entry->list_head);
kfree(nn_entry); kfree(nn_entry);
} else if (nn_entry && !neigh_invalid && override) {
mtype = is_ipv6 ? NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6 :
NFP_FLOWER_CMSG_TYPE_TUN_NEIGH;
nfp_tun_link_predt_entries(app, nn_entry);
nfp_flower_xmit_tun_conf(app, mtype, neigh_size,
nn_entry->payload,
GFP_ATOMIC);
} }
spin_unlock_bh(&priv->predt_lock); spin_unlock_bh(&priv->predt_lock);
...@@ -610,7 +618,7 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, ...@@ -610,7 +618,7 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
dst_release(dst); dst_release(dst);
} }
nfp_tun_write_neigh(n->dev, app, &flow6, n, true); nfp_tun_write_neigh(n->dev, app, &flow6, n, true, false);
#else #else
return NOTIFY_DONE; return NOTIFY_DONE;
#endif /* CONFIG_IPV6 */ #endif /* CONFIG_IPV6 */
...@@ -633,7 +641,7 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event, ...@@ -633,7 +641,7 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
ip_rt_put(rt); ip_rt_put(rt);
} }
nfp_tun_write_neigh(n->dev, app, &flow4, n, false); nfp_tun_write_neigh(n->dev, app, &flow4, n, false, false);
} }
#else #else
return NOTIFY_DONE; return NOTIFY_DONE;
...@@ -676,7 +684,7 @@ void nfp_tunnel_request_route_v4(struct nfp_app *app, struct sk_buff *skb) ...@@ -676,7 +684,7 @@ void nfp_tunnel_request_route_v4(struct nfp_app *app, struct sk_buff *skb)
ip_rt_put(rt); ip_rt_put(rt);
if (!n) if (!n)
goto fail_rcu_unlock; goto fail_rcu_unlock;
nfp_tun_write_neigh(n->dev, app, &flow, n, false); nfp_tun_write_neigh(n->dev, app, &flow, n, false, true);
neigh_release(n); neigh_release(n);
rcu_read_unlock(); rcu_read_unlock();
return; return;
...@@ -718,7 +726,7 @@ void nfp_tunnel_request_route_v6(struct nfp_app *app, struct sk_buff *skb) ...@@ -718,7 +726,7 @@ void nfp_tunnel_request_route_v6(struct nfp_app *app, struct sk_buff *skb)
if (!n) if (!n)
goto fail_rcu_unlock; goto fail_rcu_unlock;
nfp_tun_write_neigh(n->dev, app, &flow, n, true); nfp_tun_write_neigh(n->dev, app, &flow, n, true, true);
neigh_release(n); neigh_release(n);
rcu_read_unlock(); rcu_read_unlock();
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment