DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Robin Jarry" <rjarry@redhat.com>
To: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>, <dev@dpdk.org>
Subject: Re: [PATCH dpdk] fib,rib: implement full network order support for IPv4
Date: Fri, 16 Oct 2026 17:56:03 +0200	[thread overview]
Message-ID: <DM6DVTPQVKBJ.16GPH4JSTG0K2@redhat.com> (raw)
In-Reply-To: <1263b2cc-6fc6-4b85-b542-6764c2a66825@intel.com>

Hi Vladimir,

Sorry for the late reply, your email was in spam...

Medvedkin, Vladimir, Sep 30, 2026 at 19:12:
> Hi Robin,
>
> Thanks for the patch.
>
> check-git-log.sh reports
> Wrong headline format:
>          fib,rib: implement full network order support for IPv4
> could you please split for 2 patches?

I will try. The changes are intertwined somehow.

> A few comments inline.
> Also reflect changes in release notes please.

Ack.

>> +	ret = rte_fib_add(fib, ip_be, 24, nh_set);
>> +	RTE_TEST_ASSERT(ret == 0, "Failed to add route\n");
> it is probably worth to add an extra more specific route to better 
> coverage. Or keep RIB in host order and byteswap inside the 
> rte_fib_add() as I suggested below

>> +int32_t
>> +test_network_order(void)
>> +{
>> +	struct rte_rib *rib = NULL;
>> +	struct rte_rib_node *node;
>> +	struct rte_rib_conf config;
>> +
>> +	uint32_t ip_he = RTE_IPV4(192, 0, 2, 0);
> just a nit: ip_he does it stands for "host endian"? ip_ho instead for 
> "host order"?

Yes, to match with be (Big Endian).

>> +/*
>> + * modify_fib operates in host byte order. When the RIB carries the
>> + * network-order flag, rte_rib_get_nxt/rte_rib_get_ip return addresses
>
> nit: rte_rib_get_nxt() does not return address directly. It accepts it as an argument

I will rephrase that comment.

>> +	rib_conf.flags = (conf->flags & RTE_FIB_F_NETWORK_ORDER) ?
>> +		RTE_RIB_F_NETWORK_ORDER : 0;
> do we really need to align the RIB and FIB byte order? Since the RIB 
> structure is internal, why not keep it in host order and byteswap just 
> once at the API boundary, i.e. in _fib_add/del? In that case, we 
> wouldn’t need to touch the internal algorithm-specific code (dir24_8). 
> This would make things an order of magnitude simpler and cleaner.

Yes, because the control plane will iterate over the RIB and will expect
addresses to be in a consistent endianness.

Honestly, I would really prefer if that host-order thing was only an
internal implementation detail of the FIB algorithm and that *all* user
facing APIs only dealt with *network order* addresses.

But that would be a hard-break of the ABI. Would that be so terrible?
Who reasonably needs IPv4 host-order addresses for real world
applications?

>> -/** If set, fib lookup is expecting IPv4 address in network byte order */
>> -#define RTE_FIB_F_LOOKUP_NETWORK_ORDER 1
>> -#define RTE_FIB_ALLOWED_FLAGS (RTE_FIB_F_LOOKUP_NETWORK_ORDER)
>> +/** If set, all user-facing IPv4 addresses are in network byte order */
>> +#define RTE_FIB_F_NETWORK_ORDER 1
>> +#define RTE_FIB_F_LOOKUP_NETWORK_ORDER \
>> +	(RTE_DEPRECATED(RTE_FIB_F_LOOKUP_NETWORK_ORDER) RTE_FIB_F_NETWORK_ORDER)
> I'd suggest to keep 2 flags at the moment - the old one just for lookup 
> and a new one for lookup and control plane operations

OK, depending on your decision on my previous question, I'll change
accordingly.

>> +#define RIB_NODE_NET_ORDER	2
> RTE_RIB_NET_ORDER_NODE, just to avoid confusion with current naming? 
> Also since this is a bit flag it would be better to define it via bit 
> shift instead of a power of 2 digit

OK, same thing as above. If we can decide to change all user-facing APIs
to big-endian, we don't need this flag ;)

>> +	if (node->flag & RIB_NODE_NET_ORDER)
>> +		*ip = rte_cpu_to_be_32(*ip);
> plz reflect this change of behavior in doxygen

Ditto.

>> --- a/lib/rib/rte_rib.h
>> +++ b/lib/rib/rte_rib.h
>> @@ -17,6 +17,7 @@
>>   #include <stdlib.h>
>>   #include <stdint.h>
>>   
>> +#include <rte_byteorder.h>
> why include it here in .h?

I need to revisit this patch. I don't remember.

>> +/** If set, all user-facing IPv4 addresses are in network byte order */
>> +#define RTE_RIB_F_NETWORK_ORDER 1
>> +
>>   /** RIB configuration structure */
>>   struct rte_rib_conf {
>>   	/**
>> @@ -46,6 +50,7 @@ struct rte_rib_conf {
>>   	size_t	ext_sz;
>>   	/* size of rte_rib_node's pool */
>>   	int	max_nodes;
>> +	unsigned int flags; /**< Optional feature flags from RTE_RIB_F_* */
> old tests (and all possible places we're using rte_rib_conf struct) 
> should be updated to account for this new flag

I thought I had updated all sites, but I will make a sweep.

Thanks for the review.

-- 
Robin

# Contains a substantial amount of non-tobacco ingredients.


      reply	other threads:[~2026-10-16 15:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18  8:39 [PATCH dpdk] fib,rib: implement full network order support for IPv4 Robin Jarry
2026-09-30 17:12 ` Medvedkin, Vladimir
2026-10-16 15:56   ` Robin Jarry [this message]

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=DM6DVTPQVKBJ.16GPH4JSTG0K2@redhat.com \
    --to=rjarry@redhat.com \
    --cc=dev@dpdk.org \
    --cc=vladimir.medvedkin@intel.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