From: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
To: Robin Jarry <rjarry@redhat.com>
Cc: <dev@dpdk.org>, Bruce Richardson <bruce.richardson@intel.com>
Subject: Re: fib{,6}: questions and proposals
Date: Tue, 19 Mar 2024 17:16:16 +0000 [thread overview]
Message-ID: <fd03db0e-342f-4cac-8e56-9ecbcbe3c89d@intel.com> (raw)
In-Reply-To: <CZXL4F6YCVGI.3QKXZXWNV61KN@redhat.com>
Hi Robin,
On 19/03/2024 08:30, Robin Jarry wrote:
> Hi Vladimir,
>
> I have been using rte_fib for a while and stumbled upon a few quirks.
> I was wondering if you would answer some questions:
>
> 1) Is it OK/safe to share the same fib to perform route lookups from
> multiple lcores in parallel? So far my observations seem to validate
> that assumption but I would like your opinion :)
Yes, 100% :)
>
> 2) Is it OK/safe to modify a fib from a control thread (read/write)
> while it is used by data path threads (read only)?
This part is a bit more complicated. In practice, I would say yes,
however, there is a possibility that if the lookup thread is preempted
in the middle of the lookup process, and at the same time the control
thread deletes the corresponding route, then the lookup result may
return outdated data. This problem is solved in LPM with RCU enabled. I
have plans to implement it in the near future in the FIB.
>
> 3) There is no public API to list/walk all configured routes in a fib.
> Would that be possible/easy to implement?
Yes, it already there. FIB under the hood uses rte_rib to hold existing
routes. So walking through can be implemented like:
struct rte_fib fib;
....
struct rte_rib rib = rte_fib_get_rib(fib);
struct rte_rib_node *cur = NULL;
do {
cur = rte_rib_get_nxt(rib, RTE_IPV4(0,0,0,0) /*this is supernet where
you'd like to iterate*/, 0 /*and this is depth*/, cur, RTE_RIB_GET_NXT_ALL);
if (cur)
printf...
} while (cur)
>
> 4) In rte_fib, every IPv4 address (route *and* next hop) needs to be
> in host order. This is not consistent with fib6 where addresses are
> stored in network order. It took me quite a while to figure out what
> was wrong with my code.
>
> I assume this is because DIR24 needs host order integers and not
> TRIE. Why was this not hidden in the API?
>
> Could we add a flag to rte_fib_conf to change the behaviour? This
> would avoid error prone ntohl/htonl juggling.
This API behavior was created in such a way that it is the same as LPM.
As for LPM, I think it was done this way for performance reasons because
in some scenarios you only working with the host order ipv4 addresses.
>
> Thanks in advance for your replies :)
>
--
Regards,
Vladimir
next prev parent reply other threads:[~2024-03-19 17:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 8:30 Robin Jarry
2024-03-19 17:16 ` Medvedkin, Vladimir [this message]
2024-03-19 20:38 ` Robin Jarry
2024-03-20 7:45 ` Morten Brørup
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fd03db0e-342f-4cac-8e56-9ecbcbe3c89d@intel.com \
--to=vladimir.medvedkin@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=rjarry@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).