From: "Robin Jarry" <rjarry@redhat.com>
To: "Vladimir Medvedkin" <medvedkinv@gmail.com>,
"Stephen Hemminger" <stephen@networkplumber.org>
Cc: "Morten Brørup" <mb@smartsharesystems.com>,
"Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>,
dev@dpdk.org, "Bruce Richardson" <bruce.richardson@intel.com>,
"David Marchand" <david.marchand@redhat.com>,
"Thomas Monjalon" <thomas@monjalon.net>,
"Konstantin Ananyev" <konstantin.ananyev@huawei.com>
Subject: Re: rte_fib network order bug
Date: Fri, 22 Nov 2024 17:14:36 +0100 [thread overview]
Message-ID: <D5SUAHQG4BFP.IRLD8VYLD2U7@redhat.com> (raw)
In-Reply-To: <CANDrEHkxt32+PHRWNBYjpo2t3cxLemwK_iKYfNbA85OR_t3cjw@mail.gmail.com>
Vladimir Medvedkin, Nov 17, 2024 at 16:04:
> [Robin]
>> I had not understood that it was *only* the lookups that were network
>> order
>
> [Morten]
>> When I saw the byte order flag the first time, it was not clear to me
>> either that it only affected lookups - I too thought it covered the
>> entire API of the library. This needs to be emphasized in the
>> description of the flag. And the flag's name should contain LOOKUP
>> [Morten] > And/or rename RTE_FIB_F_NETWORK_ORDER to
>> RTE_FIB_F_NETWORK_ORDER_LOOKUP or similar.
>
> There is a clear comment for this flag that it has effects on lookup.
> Repeating the statement with an exclamation mark seems too much.
> Moreover, at first this flag was named "RTE_FIB_FLAG_LOOKUP_BE" and it
> was suggested for renaming here:
> https://inbox.dpdk.org/dev/D4SWPKOPRD5Z.87YIET3Y4AW@redhat.com/
This is my bad then. I had misunderstood what this flag was for.
I should have been more careful. You had clearly stated that it was only
affecting the lookup.
> So, feel free to submit patches adding this feature to the control
> plane API, but let's consider:
I can commit to working on that topic if we can get a consensus. In my
opinion there are two different approaches:
1) Change all IPv4 routing *APIs* to only use network order addresses
=====================================================================
This would make them consistent with all networking stacks (linux, vpp,
bsd, etc.) and would avoid confusion from users (like me) who naively
used these libraries with addresses generated with inet_pton() or
addresses taken verbatim from IPv4 packet headers.
More importantly, it would make them consistent on big-endian and
little-endian architectures. Currently, the same code could work
(without any byte swap) on aarch4, but would not work on x86_64.
It would also make them consistent with their IPv6 counterparts which do
not require any byteswap.
This would be a drastic and breaking change but I think this would be
the better solution in the long run.
To ensure that potential users of these libraries will not miss this
change, the uint32_t parameters should be changed to a rte_ipv4_addr
structure that follows the same idea than rte_ipv6_addr.
We could also simply use rte_be32_t types everywhere but it would expose
potential users of these APIs with bugs that could not be found at
compilation.
Internally, all these routing libraries would continue using host order
integers, the changes I am suggesting only affect the public API.
2) Implement network order via opt-in flags
===========================================
This would allow the same thing as solution 1) but would keep the
default behaviour which I find confusing and inconsistent with IPv6 and
with all IPv4 networking stacks that I know.
The other concern I have with that second solution is that the public
APIs would continue using uint32_t parameters which would be only
correct when the network-order mode is not enabled.
On the other hand, it does not break any API for users that do not use
the flags.
There would need to be an additional RTE_IPV4_BE() macro to declare IPv4
addresses in network order.
Any thoughts?
prev parent reply other threads:[~2024-11-22 16:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 9:31 Robin Jarry
2024-11-13 10:42 ` Medvedkin, Vladimir
2024-11-13 13:27 ` Robin Jarry
2024-11-13 19:39 ` Medvedkin, Vladimir
2024-11-14 7:43 ` Morten Brørup
2024-11-14 10:18 ` Robin Jarry
2024-11-14 14:35 ` Morten Brørup
2024-11-15 13:01 ` Robin Jarry
2024-11-15 13:52 ` Morten Brørup
2024-11-15 14:07 ` Bruce Richardson
2024-11-15 14:28 ` Robin Jarry
2024-11-15 16:20 ` Stephen Hemminger
2024-11-17 15:04 ` Vladimir Medvedkin
2024-11-22 15:35 ` Thomas Monjalon
2024-11-22 16:14 ` 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=D5SUAHQG4BFP.IRLD8VYLD2U7@redhat.com \
--to=rjarry@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@huawei.com \
--cc=mb@smartsharesystems.com \
--cc=medvedkinv@gmail.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--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;
as well as URLs for NNTP newsgroup(s).