Skip to content

Commit 656bd03

Browse files
yuantykuba-moo
authored andcommitted
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: f1df795 ("nfp: flower: rework tunnel neighbour configuration") Signed-off-by: Tianyu Yuan <tianyu.yuan@corigine.com> Reviewed-by: Louis Peens <louis.peens@corigine.com> Reviewed-by: Baowen Zheng <baowen.zheng@corigine.com> Signed-off-by: Simon Horman <simon.horman@corigine.com> Link: https://lore.kernel.org/r/20220714081915.148378-1-simon.horman@corigine.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 3d8c51b commit 656bd03

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ void nfp_tun_unlink_and_update_nn_entries(struct nfp_app *app,
447447

448448
static void
449449
nfp_tun_write_neigh(struct net_device *netdev, struct nfp_app *app,
450-
void *flow, struct neighbour *neigh, bool is_ipv6)
450+
void *flow, struct neighbour *neigh, bool is_ipv6,
451+
bool override)
451452
{
452453
bool neigh_invalid = !(neigh->nud_state & NUD_VALID) || neigh->dead;
453454
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,
546547
if (nn_entry->flow)
547548
list_del(&nn_entry->list_head);
548549
kfree(nn_entry);
550+
} else if (nn_entry && !neigh_invalid && override) {
551+
mtype = is_ipv6 ? NFP_FLOWER_CMSG_TYPE_TUN_NEIGH_V6 :
552+
NFP_FLOWER_CMSG_TYPE_TUN_NEIGH;
553+
nfp_tun_link_predt_entries(app, nn_entry);
554+
nfp_flower_xmit_tun_conf(app, mtype, neigh_size,
555+
nn_entry->payload,
556+
GFP_ATOMIC);
549557
}
550558

551559
spin_unlock_bh(&priv->predt_lock);
@@ -610,7 +618,7 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
610618

611619
dst_release(dst);
612620
}
613-
nfp_tun_write_neigh(n->dev, app, &flow6, n, true);
621+
nfp_tun_write_neigh(n->dev, app, &flow6, n, true, false);
614622
#else
615623
return NOTIFY_DONE;
616624
#endif /* CONFIG_IPV6 */
@@ -633,7 +641,7 @@ nfp_tun_neigh_event_handler(struct notifier_block *nb, unsigned long event,
633641

634642
ip_rt_put(rt);
635643
}
636-
nfp_tun_write_neigh(n->dev, app, &flow4, n, false);
644+
nfp_tun_write_neigh(n->dev, app, &flow4, n, false, false);
637645
}
638646
#else
639647
return NOTIFY_DONE;
@@ -676,7 +684,7 @@ void nfp_tunnel_request_route_v4(struct nfp_app *app, struct sk_buff *skb)
676684
ip_rt_put(rt);
677685
if (!n)
678686
goto fail_rcu_unlock;
679-
nfp_tun_write_neigh(n->dev, app, &flow, n, false);
687+
nfp_tun_write_neigh(n->dev, app, &flow, n, false, true);
680688
neigh_release(n);
681689
rcu_read_unlock();
682690
return;
@@ -718,7 +726,7 @@ void nfp_tunnel_request_route_v6(struct nfp_app *app, struct sk_buff *skb)
718726
if (!n)
719727
goto fail_rcu_unlock;
720728

721-
nfp_tun_write_neigh(n->dev, app, &flow, n, true);
729+
nfp_tun_write_neigh(n->dev, app, &flow, n, true, true);
722730
neigh_release(n);
723731
rcu_read_unlock();
724732
return;

0 commit comments

Comments
 (0)