* fib/rib: allow storing void * instead of nexthop index
@ 2024-07-31 15:04 Robin Jarry
2024-07-31 15:53 ` Medvedkin, Vladimir
0 siblings, 1 reply; 2+ messages in thread
From: Robin Jarry @ 2024-07-31 15:04 UTC (permalink / raw)
To: Vladimir Medvedkin; +Cc: Thomas Monjalon, dev, Bruce Richardson
Hi Vladimir,
I noticed that the fib/rib APIs (both IPv4 and IPv6) require the next
hops to be represented as integer indexes. Reading the code, I noticed
that they are stored as uint64_t with the MSB used for internal
purposes.
This require either having a contiguous array of nexthop objects and
choose an index in that array, or store pointer offsets as nexthop
indexes and do pointer arithmetics to reconstruct the real pointers.
Both are not very practical and/or hacky.
Would it be possible to store arbitrary pointers? That would mean
moving that 64th bit information elsewhere.
I'd love to hear what you think on the matter.
Cheers,
Robin
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: fib/rib: allow storing void * instead of nexthop index
2024-07-31 15:04 fib/rib: allow storing void * instead of nexthop index Robin Jarry
@ 2024-07-31 15:53 ` Medvedkin, Vladimir
0 siblings, 0 replies; 2+ messages in thread
From: Medvedkin, Vladimir @ 2024-07-31 15:53 UTC (permalink / raw)
To: Robin Jarry; +Cc: Thomas Monjalon, dev, Bruce Richardson
Hi Robin,
On 31/07/2024 16:04, Robin Jarry wrote:
> Hi Vladimir,
>
> I noticed that the fib/rib APIs (both IPv4 and IPv6) require the next
> hops to be represented as integer indexes. Reading the code, I noticed
> that they are stored as uint64_t with the MSB used for internal purposes.
I believe you are asking about FIB, not RIB. In current FIB
implementation 1 LSB is used for internal purposes.
>
> This require either having a contiguous array of nexthop objects and
> choose an index in that array,
As far as I know that's what most of "l3 forward" applications (aka
routers) are doing, if they are interested in performance. Not only DPDK
powered.
> or store pointer offsets as nexthop indexes and do pointer arithmetics
> to reconstruct the real pointers. Both are not very practical and/or
> hacky.
>
> Would it be possible to store arbitrary pointers? That would mean
> moving that 64th bit information elsewhere.
For arbitrary pointer - no, since it needs to store 1 more bit for
internal purpose. However, if you have 2 byte aligned pointer you can
store the pointer shifted right by 1 bit, and after lookup just shift
the result back.
>
> I'd love to hear what you think on the matter.
>
> Cheers,
> Robin
>
--
Regards,
Vladimir
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-31 15:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-31 15:04 fib/rib: allow storing void * instead of nexthop index Robin Jarry
2024-07-31 15:53 ` Medvedkin, Vladimir
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).