From: Stanislav Zaikin Date: Mon, 26 May 2025 07:52:57 +0000 (+0200) Subject: linux-cp: do not lock table when it's not needed X-Git-Tag: v26.02-rc0~188 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=4e58900cf8d1e34d023b36e1518c4cdfa04d5da6;p=vpp.git linux-cp: do not lock table when it's not needed Do not lock table when lcp is not installing routes (e.g. zero nexthops or ipv6 multicast routes), otherwise it will stay locked forever. Type: fix Signed-off-by: Stanislav Zaikin Change-Id: I4070ce0e0823b5afbd56c5cd79ae39a02c7d4300 --- diff --git a/src/plugins/linux-cp/lcp_router.c b/src/plugins/linux-cp/lcp_router.c index 27f53357a4d..4c13c360e00 100644 --- a/src/plugins/linux-cp/lcp_router.c +++ b/src/plugins/linux-cp/lcp_router.c @@ -1332,7 +1332,6 @@ lcp_router_route_add (struct rtnl_route *rr, int is_replace) lcp_router_route_mk_prefix (rr, &pfx); entry_flags = lcp_router_route_mk_entry_flags (rtype, table_id, rproto); - nlt = lcp_router_table_add_or_lock (table_id, pfx.fp_proto); /* Skip any kernel routes and IPv6 LL or multicast routes */ if (rproto == RTPROT_KERNEL || (FIB_PROTOCOL_IP6 == pfx.fp_proto && @@ -1360,6 +1359,8 @@ lcp_router_route_add (struct rtnl_route *rr, int is_replace) if (0 != vec_len (np.paths)) { + nlt = lcp_router_table_add_or_lock (table_id, pfx.fp_proto); + if (rtype == RTN_MULTICAST) { /* it's not clear to me how linux expresses the RPF paramters @@ -1423,6 +1424,16 @@ lcp_router_route_add (struct rtnl_route *rr, int is_replace) LCP_ROUTER_DBG ("no paths for route: %d:%U %U", rtnl_route_get_table (rr), format_fib_prefix, &pfx, format_fib_entry_flags, entry_flags); + + nlt = + lcp_router_table_find (lcp_router_table_k2f (table_id), pfx.fp_proto); + + if (is_replace && nlt) + { + fib_source_t fib_src; + fib_src = lcp_router_proto_fib_source (rproto); + fib_table_entry_delete (nlt->nlt_fib_index, &pfx, fib_src); + } } vec_free (np.paths); }