Re: [PATCH v8 1/3] cmdline: use C standard library as number parser

2025-05-09 Thread Burakov, Anatoly

On 5/9/2025 3:08 PM, Burakov, Anatoly wrote:

On 5/9/2025 3:02 PM, Burakov, Anatoly wrote:

On 5/8/2025 3:16 PM, Anatoly Burakov wrote:
Remove custom number parser and use C standard library instead. In 
order to

keep compatibility with earlier versions of the parser, we have to take
into account a couple of quirks:

- We did not consider "negative" numbers to be valid for anything other
   than base-10 numbers, whereas C standard library does. Adjust the 
tests

   to match the new behavior.
- We did not consider numbers such as "+4" to be valid, whereas C
   standard library does. Adjust the tests to match the new behavior.
- C standard library's strtoull does not do range checks on negative
   numbers, so we have to parse knowingly-negative numbers as signed.
- C standard library does not support binary numbers, so we keep 
around the
   relevant parts of the custom parser in place to support binary 
numbers.


Signed-off-by: Anatoly Burakov 
---

Notes:
 v7 -> v8:
 - Added the commented-out out-of-bounds check back
 - Replaced debug print messages to ensure they don't attempt to
   index the num_help[] array (should fix compile errors)
 v5 -> v6:
 - Allowed more negative numbers (such as negative octals or hex)
 - Updated unit tests to check new cases
 - Small refactoring of code to reduce amount of noise
 - More verbose debug output
 v4 -> v5:
 - Added this commit


There is a unit test failure coming specifically from this commit, 
that only happens on ARM. Log:


Error: parsing -0b0111010101 as INT16 succeeded!

That is, when confronted with a negative binary string, it seems that 
strtoll will report success, whereas other platforms report failure. 
I'm confused, is libc strtoll different on ARM? I don't have an ARM 
platform available to test this so I don't know why this is happening.




Correction: it seems that newer libc versions have added support for 
binary formats. I'll therefore amend the tests to account for that.




The specific announcement regarding binary formatted strings:

https://sourceware.org/pipermail/libc-alpha/2023-July/150524.html

Since our binary parser will be a fallback implementation starting from 
that version of libc, I think it would be easier to just add negative 
binary support to our custom parser than it would be to differentiate 
between different libc versions, and support negative binary formats 
regardless.


--
Thanks,
Anatoly


Re: [PATCH v8 1/3] cmdline: use C standard library as number parser

2025-05-09 Thread Burakov, Anatoly

On 5/8/2025 3:16 PM, Anatoly Burakov wrote:

Remove custom number parser and use C standard library instead. In order to
keep compatibility with earlier versions of the parser, we have to take
into account a couple of quirks:

- We did not consider "negative" numbers to be valid for anything other
   than base-10 numbers, whereas C standard library does. Adjust the tests
   to match the new behavior.
- We did not consider numbers such as "+4" to be valid, whereas C
   standard library does. Adjust the tests to match the new behavior.
- C standard library's strtoull does not do range checks on negative
   numbers, so we have to parse knowingly-negative numbers as signed.
- C standard library does not support binary numbers, so we keep around the
   relevant parts of the custom parser in place to support binary numbers.

Signed-off-by: Anatoly Burakov 
---

Notes:
 v7 -> v8:
 - Added the commented-out out-of-bounds check back
 - Replaced debug print messages to ensure they don't attempt to
   index the num_help[] array (should fix compile errors)
 
 v5 -> v6:

 - Allowed more negative numbers (such as negative octals or hex)
 - Updated unit tests to check new cases
 - Small refactoring of code to reduce amount of noise
 - More verbose debug output
 
 v4 -> v5:

 - Added this commit


There is a unit test failure coming specifically from this commit, that 
only happens on ARM. Log:


Error: parsing -0b0111010101 as INT16 succeeded!

That is, when confronted with a negative binary string, it seems that 
strtoll will report success, whereas other platforms report failure. I'm 
confused, is libc strtoll different on ARM? I don't have an ARM platform 
available to test this so I don't know why this is happening.


--
Thanks,
Anatoly


[PATCH v10 2/3] cmdline: add floating point support

2025-05-09 Thread Anatoly Burakov
Add support for parsing floating point numbers in cmdline library, as well
as unit tests for the new functionality. Use C library for parsing.

Signed-off-by: Anatoly Burakov 
---

Notes:
v7 -> v8:
- Fixed leftover comment about needing bigger epsilon value
- Fixed debug prints to avoid indexing num_help[] array

v6 -> v7:
- Fixed a bug in float compare in unit tests where a bigger epsilon
  value than necessary was "needed" because we were comparing float
  result to a double result

v5 -> v6:
- Small refactor to reduce amount of noise
- Use strtof for parsing single precision floats
- More unit tests

v4 -> v5:
- Reworked to use standard C library functions as much as possible,
  keeping near-100% compatibility with earlier versions (the only
  difference is that strings like "+4" are now considered valid)

v3 -> v4:
- Removed unnecessary check for integer overflow when parsing negative
  floats (as we convert to double before changing sign)
- Make naming of float exponent states more consistent

v2 -> v3:
- Fixed a bug where a free-standing negative exponent ("1e-") would attempt 
to be
  parsed, and added unit tests for this case
- Added support for floats in dpdk-cmdline-gen script
- Added documentation updates to call out float support

 app/test/test_cmdline_num.c| 283 -
 buildtools/dpdk-cmdline-gen.py |  24 ++-
 doc/guides/prog_guide/cmdline.rst  |   3 +
 doc/guides/rel_notes/release_25_07.rst |   5 +
 lib/cmdline/cmdline_parse_num.c|  68 +-
 lib/cmdline/cmdline_parse_num.h|   4 +-
 6 files changed, 367 insertions(+), 20 deletions(-)

diff --git a/app/test/test_cmdline_num.c b/app/test/test_cmdline_num.c
index 100c564188..832ed3d110 100644
--- a/app/test/test_cmdline_num.c
+++ b/app/test/test_cmdline_num.c
@@ -5,6 +5,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -23,6 +25,11 @@ struct num_signed_str {
int64_t result;
 };
 
+struct num_float_str {
+   const char * str;
+   double result;
+};
+
 const struct num_unsigned_str num_valid_positive_strs[] = {
/* decimal positive */
{"0", 0 },
@@ -144,6 +151,63 @@ const struct num_signed_str num_valid_negative_strs[] = {

{"-0b1000", 
INT64_MIN },
 };
 
+const struct num_float_str float_valid_strs[] = {
+   /* zero */
+   {"0", 0},
+   /* parse int as float */
+   {"1", 1},
+   {"-1", -1},
+   /* fractional */
+   {"1.23", 1.23},
+   {"-1.23", -1.23},
+   {"0.123", 0.123},
+   {"-0.123", -0.123},
+   {"123.456", 123.456},
+   {"-123.456", -123.456},
+   /* positive exponent */
+   {"1e2", 1e2},
+   {"-1e2", -1e2},
+   {"1E2", 1E2},
+   {"-1E2", -1E2},
+   {"0.12e3", 0.12e3},
+   {"-0.12e3", -0.12e3},
+   {"1.23e4", 1.23e4},
+   {"-1.23e4", -1.23e4},
+   {"1.23E4", 1.23E4},
+   {"-1.23E4", -1.23E4},
+   {"123.456e7", 123.456e7},
+   {"-123.456e7", -123.456e7},
+   {"123.456E7", 123.456E7},
+   {"-123.456E7", -123.456E7},
+   /* negative exponent */
+   {"1e-2", 1e-2},
+   {"-1e-2", -1e-2},
+   {"1E-2", 1E-2},
+   {"-1E-2", -1E-2},
+   {"0.12e-3", 0.12e-3},
+   {"-0.12e-3", -0.12e-3},
+   {"1.23e-4", 1.23e-4},
+   {"-1.23e-4", -1.23e-4},
+   {"1.23E-4", 1.23E-4},
+   {"-1.23E-4", -1.23E-4},
+   {"123.456e-7", 123.456e-7},
+   {"-123.456e-7", -123.456e-7},
+   {"123.456E-7", 123.456E-7},
+   {"-123.456E-7", -123.456E-7},
+   /* try overflowing float */
+   {"2e63", 2e63},
+   {"-2e63", -2e63},
+   {"2E63", 2E63},
+   {"-2E63", -2E63},
+   {"18446744073709551615", (double) UINT64_MAX},
+   {"-9223372036854775808", (double) INT64_MIN},
+   /* try overflowing double */
+   {"2e308", HUGE_VAL},
+   {"-2e308", -HUGE_VAL},
+   {"2E308", HUGE_VAL},
+   {"-2E308", HUGE_VAL},
+};
+
 const struct num_unsigned_str num_garbage_positive_strs[] = {
/* valid strings with garbage on the end, should still be valid 
*/
/* decimal */
@@ -214,6 +278,71 @@ const struct num_signed_str num_garbage_negative_strs[] = {
{"-010 garbage", INT64_MIN },
 };
 
+const struct num_float_str float_garbage_strs[] = {
+   /* valid strings with garbage on t

Re: [PATCH] net/ice: update log message

2025-05-09 Thread Burakov, Anatoly

On 5/2/2025 5:25 PM, Pillai, Dhanya R wrote:

Added log message for ddp package load failure.



Judging by the code, the log message already existed, so technically 
it's not "adding" anything. IMO a better wording would be:


"Clarified log message for DDP package load failure".


mailmap: update contributor entry


I don't think it's necessary to call this out.

With above changes (can be done on apply),

Acked-by: Anatoly Burakov 

--
Thanks,
Anatoly


[PATCH] regexdev: enable to be compiled on Windows

2025-05-09 Thread Andre Muezerie
Now that mbuf is compiling on Windows, this library can be enabled as
well.

Signed-off-by: Andre Muezerie 
---
 lib/regexdev/meson.build | 6 --
 1 file changed, 6 deletions(-)

diff --git a/lib/regexdev/meson.build b/lib/regexdev/meson.build
index 426e764ece..7e12d8cd6d 100644
--- a/lib/regexdev/meson.build
+++ b/lib/regexdev/meson.build
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2020 Mellanox Technologies, Ltd
 
-if is_windows
-build = false
-reason = 'not supported on Windows'
-subdir_done()
-endif
-
 sources = files('rte_regexdev.c')
 headers = files('rte_regexdev.h', 'rte_regexdev_driver.h')
 indirect_headers += files('rte_regexdev_core.h')
-- 
2.49.0.vfs.0.2



[PATCH v2 10/13] node: add IP6 FIB route add

2025-05-09 Thread Ankur Dwivedi
Adds a public function to add IP6 route to FIB. The applications should
call this function to add IP6 routes to FIB.

Signed-off-by: Ankur Dwivedi 
---
 lib/node/ip6_lookup_fib.c   | 35 +++
 lib/node/rte_node_ip6_api.h | 19 +++
 2 files changed, 54 insertions(+)

diff --git a/lib/node/ip6_lookup_fib.c b/lib/node/ip6_lookup_fib.c
index a4f9f53644..b510452ad8 100644
--- a/lib/node/ip6_lookup_fib.c
+++ b/lib/node/ip6_lookup_fib.c
@@ -2,6 +2,8 @@
  * Copyright(C) 2025 Marvell.
  */
 
+#include 
+
 #include 
 #include 
 #include 
@@ -58,6 +60,39 @@ rte_node_ip6_fib_create(int socket, struct rte_fib6_conf 
*conf)
return 0;
 }
 
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_node_ip6_fib_route_add, 25.07)
+int
+rte_node_ip6_fib_route_add(const struct rte_ipv6_addr *ip, uint8_t depth, 
uint16_t next_hop,
+  enum rte_node_ip6_lookup_next next_node)
+{
+   char abuf[INET6_ADDRSTRLEN];
+   unsigned int nb_sockets;
+   uint8_t socket;
+   uint32_t val;
+   int ret;
+
+   nb_sockets = rte_socket_count();
+   inet_ntop(AF_INET6, ip, abuf, sizeof(abuf));
+   /* Embedded next node id into 24 bit next hop */
+   val = ((next_node << 16) | next_hop) & ((1ull << 24) - 1);
+   node_dbg("ip6_lookup_fib", "FIB6: Adding route %s / %d nh (0x%x)", 
abuf, depth, val);
+
+   for (socket = 0; socket < nb_sockets; socket++) {
+   if (!ip6_lookup_fib_nm.fib6[socket])
+   continue;
+
+   ret = rte_fib6_add(ip6_lookup_fib_nm.fib6[socket], ip, depth, 
val);
+   if (ret < 0) {
+   node_err("ip6_lookup_fib",
+"Unable to add entry %s / %d nh (%x) to FIB on 
sock %d, rc=%d",
+abuf, depth, val, socket, ret);
+   return ret;
+   }
+   }
+
+   return 0;
+}
+
 static int
 setup_fib6(int socket)
 {
diff --git a/lib/node/rte_node_ip6_api.h b/lib/node/rte_node_ip6_api.h
index 1d2b190724..31089b35fc 100644
--- a/lib/node/rte_node_ip6_api.h
+++ b/lib/node/rte_node_ip6_api.h
@@ -86,6 +86,25 @@ int rte_node_ip6_rewrite_add(uint16_t next_hop, uint8_t 
*rewrite_data,
 __rte_experimental
 int rte_node_ip6_fib_create(int socket, struct rte_fib6_conf *conf);
 
+/**
+ * Add IPv6 route to FIB.
+ *
+ * @param ip
+ *   IPv6 address of route to be added.
+ * @param depth
+ *   Depth of the rule to be added.
+ * @param next_hop
+ *   Next hop id of the rule result to be added.
+ * @param next_node
+ *   Next node to redirect traffic to.
+ *
+ * @return
+ *   0 on success, negative otherwise.
+ */
+__rte_experimental
+int rte_node_ip6_fib_route_add(const struct rte_ipv6_addr *ip, uint8_t depth, 
uint16_t next_hop,
+  enum rte_node_ip6_lookup_next next_node);
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.25.1



[PATCH v10 3/3] app/testpmd: add sleep command

2025-05-09 Thread Anatoly Burakov
Test-pmd already has a way to run a list of commands from file, but there
is no way to pause execution for a specified amount of time between two
commands. This may be necessary for simple automation, particularly for
waiting on some asynchronous operation such as link status update.

Add a simple sleep command to wait until certain number of seconds has
passed, using the newly added cmdline library floating point support.

Signed-off-by: Anatoly Burakov 
---

Notes:
v1 -> v2:
- Add floating point support to cmdline
- Use floating point format for pause command

 app/test-pmd/cmdline.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index d4bb3ec998..b6152c07e6 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -151,6 +151,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 
"quit\n"
"Quit to prompt.\n\n"
+
+   "sleep secs\n"
+   "Sleep for secs seconds (can be fractional).\n\n"
);
}
 
@@ -7768,6 +7771,37 @@ static cmdline_parse_inst_t cmd_quit = {
},
 };
 
+/* *** SLEEP *** */
+struct cmd_sleep_result {
+   cmdline_fixed_string_t sleep;
+   double secs;
+};
+
+static void cmd_sleep_parsed(void *parsed_result,
+   __rte_unused struct cmdline *cl,
+   __rte_unused void *data)
+{
+   struct cmd_sleep_result *res = parsed_result;
+
+   rte_delay_us_sleep(res->secs * 1E6);
+}
+
+static cmdline_parse_token_string_t cmd_sleep_sleep =
+   TOKEN_STRING_INITIALIZER(struct cmd_sleep_result, sleep, "sleep");
+static cmdline_parse_token_num_t cmd_sleep_seconds =
+   TOKEN_NUM_INITIALIZER(struct cmd_sleep_result, secs, RTE_FLOAT_DOUBLE);
+
+static cmdline_parse_inst_t cmd_sleep = {
+   .f = cmd_sleep_parsed,
+   .data = NULL,
+   .help_str = "sleep : Sleep for a specified number of seconds",
+   .tokens = {
+   (void *)&cmd_sleep_sleep,
+   (void *)&cmd_sleep_seconds,
+   NULL,
+   },
+};
+
 /* *** ADD/REMOVE MAC ADDRESS FROM A PORT *** */
 struct cmd_mac_addr_result {
cmdline_fixed_string_t mac_addr_cmd;
@@ -13711,6 +13745,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
&cmd_showdevice,
&cmd_showcfg,
&cmd_showfwdall,
+   &cmd_sleep,
&cmd_start,
&cmd_start_tx_first,
&cmd_start_tx_first_n,
-- 
2.47.1



[PATCH v10 1/3] cmdline: use C standard library as number parser

2025-05-09 Thread Anatoly Burakov
Remove custom number parser and use C standard library instead. In order to
keep compatibility with earlier versions of the parser, we have to take
into account a couple of quirks:

- We did not consider "negative" numbers to be valid for anything other
  than base-10 numbers, whereas C standard library does. Adjust the tests
  to match the new behavior.
- We did not consider numbers such as "+4" to be valid, whereas C
  standard library does. Adjust the tests to match the new behavior.
- C standard library's strtoull does not do range checks on negative
  numbers, so we have to parse knowingly-negative numbers as signed.
- Some C standard library versions do not support binary numbers, so we
  keep around the relevant parts of the custom parser in place to support
  them. However, since those libc versions that do support them also
  support them being negative, allow negative binary in our parser as well.

Signed-off-by: Anatoly Burakov 
---

Notes:
v9 -> v10:
- Fixed commit message not reflecting changes for v9
- Reworked enum range check to avoid compile issues on some platforms

v8 -> v9:
- glibc 2.38 supports binary formats (0b and -0b) under certain 
conditions,
  so in order to ensure the same functionality on all glic versions, add 
support for
  positive and negative binary formats, and adjust tests accordingly

v7 -> v8:
- Added the commented-out out-of-bounds check back
- Replaced debug print messages to ensure they don't attempt to
  index the num_help[] array (should fix compile errors)

v5 -> v6:
- Allowed more negative numbers (such as negative octals or hex)
- Updated unit tests to check new cases
- Small refactoring of code to reduce amount of noise
- More verbose debug output

v4 -> v5:
- Added this commit

 app/test/test_cmdline_num.c |  34 ++-
 lib/cmdline/cmdline_parse_num.c | 395 +---
 2 files changed, 238 insertions(+), 191 deletions(-)

diff --git a/app/test/test_cmdline_num.c b/app/test/test_cmdline_num.c
index 9276de59bd..100c564188 100644
--- a/app/test/test_cmdline_num.c
+++ b/app/test/test_cmdline_num.c
@@ -139,6 +139,9 @@ const struct num_signed_str num_valid_negative_strs[] = {
{"-2147483648", INT32_MIN },
{"-2147483649", INT32_MIN - 1LL },
{"-9223372036854775808", INT64_MIN },
+   {"-0x8000", INT64_MIN },
+   {"-010", INT64_MIN },
+   
{"-0b1000", 
INT64_MIN },
 };
 
 const struct num_unsigned_str num_garbage_positive_strs[] = {
@@ -175,12 +178,40 @@ const struct num_unsigned_str num_garbage_positive_strs[] 
= {
 
 const struct num_signed_str num_garbage_negative_strs[] = {
/* valid strings with garbage on the end, should still be valid 
*/
+   /* negative numbers */
{"-9223372036854775808\0garbage", INT64_MIN },
{"-9223372036854775808\rgarbage", INT64_MIN },
{"-9223372036854775808\tgarbage", INT64_MIN },
{"-9223372036854775808\ngarbage", INT64_MIN },
{"-9223372036854775808#garbage", INT64_MIN },
{"-9223372036854775808 garbage", INT64_MIN },
+   /* negative hex */
+   {"-0x8000\0garbage", INT64_MIN },
+   {"-0x8000\rgarbage", INT64_MIN },
+   {"-0x8000\tgarbage", INT64_MIN },
+   {"-0x8000\ngarbage", INT64_MIN },
+   {"-0x8000#garbage", INT64_MIN },
+   {"-0x8000 garbage", INT64_MIN },
+   /* negative binary */
+   
{"-0b1000\0garbage",
+   INT64_MIN },
+   
{"-0b1000\rgarbage",
+   INT64_MIN },
+   
{"-0b1000\tgarbage",
+   INT64_MIN },
+   
{"-0b1000\ngarbage",
+   INT64_MIN },
+   
{"-0b1000#garbage",
+   INT64_MIN },
+   
{"-0b1000 garbage",
+   INT64_MIN },
+   /* negative octal */
+   {"-010\0garbage", INT64_MIN },
+   {"-010\rgarbage", INT64_MIN },
+   {"-010\tgarbage", INT64_MIN },
+   {"-010\ngarbage", INT64_MIN },
+   {"-010#garbage", INT64_MIN },
+   {"-010

Re: [PATCH v8 1/3] cmdline: use C standard library as number parser

2025-05-09 Thread Burakov, Anatoly

On 5/9/2025 3:02 PM, Burakov, Anatoly wrote:

On 5/8/2025 3:16 PM, Anatoly Burakov wrote:
Remove custom number parser and use C standard library instead. In 
order to

keep compatibility with earlier versions of the parser, we have to take
into account a couple of quirks:

- We did not consider "negative" numbers to be valid for anything other
   than base-10 numbers, whereas C standard library does. Adjust the 
tests

   to match the new behavior.
- We did not consider numbers such as "+4" to be valid, whereas C
   standard library does. Adjust the tests to match the new behavior.
- C standard library's strtoull does not do range checks on negative
   numbers, so we have to parse knowingly-negative numbers as signed.
- C standard library does not support binary numbers, so we keep 
around the
   relevant parts of the custom parser in place to support binary 
numbers.


Signed-off-by: Anatoly Burakov 
---

Notes:
 v7 -> v8:
 - Added the commented-out out-of-bounds check back
 - Replaced debug print messages to ensure they don't attempt to
   index the num_help[] array (should fix compile errors)
 v5 -> v6:
 - Allowed more negative numbers (such as negative octals or hex)
 - Updated unit tests to check new cases
 - Small refactoring of code to reduce amount of noise
 - More verbose debug output
 v4 -> v5:
 - Added this commit


There is a unit test failure coming specifically from this commit, that 
only happens on ARM. Log:


Error: parsing -0b0111010101 as INT16 succeeded!

That is, when confronted with a negative binary string, it seems that 
strtoll will report success, whereas other platforms report failure. I'm 
confused, is libc strtoll different on ARM? I don't have an ARM platform 
available to test this so I don't know why this is happening.




Correction: it seems that newer libc versions have added support for 
binary formats. I'll therefore amend the tests to account for that.


--
Thanks,
Anatoly


RE: Addressing ninja build error message

2025-05-09 Thread Loftus, Ciara
Hi Vivek,

Could you please send me meson-logs/meson-log.txt? It will tell me what version 
of libbpf you are using and some other useful info.
It looks to me that the af_xdp meson build is not correctly determining what 
libbpf functions are available in your environment.

As a side note, if you don't intend on using the af_xdp driver you can bypass 
its compilation by specifying -Ddisable_drivers=af_xdp during the meson build.

Thanks,
Ciara

From: vivekanandi 
Sent: Friday 18 April 2025 22:53
To: dev@dpdk.org
Subject: Addressing ninja build error message

Hello,
My name is Vivek. I'm a Computer Science major from Canada.

I was trying to install DPDK but encountered this error. I am familiar with BPF 
programming so tried to look into the compat.h file but the build/af_xdp 
directory was empty after I got the error message. I've attached a txt file 
that shows the terminal output
I ran the following scripts:
meson build
ninja -C build
Could you please direct me to the right direction for building DPDK properly? I 
am on Linux Mint. Are there dependencies that I should've instaslled?
Best Regards,
V


[PATCH v9 3/3] app/testpmd: add sleep command

2025-05-09 Thread Anatoly Burakov
Test-pmd already has a way to run a list of commands from file, but there
is no way to pause execution for a specified amount of time between two
commands. This may be necessary for simple automation, particularly for
waiting on some asynchronous operation such as link status update.

Add a simple sleep command to wait until certain number of seconds has
passed, using the newly added cmdline library floating point support.

Signed-off-by: Anatoly Burakov 
---

Notes:
v1 -> v2:
- Add floating point support to cmdline
- Use floating point format for pause command

 app/test-pmd/cmdline.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index d4bb3ec998..b6152c07e6 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -151,6 +151,9 @@ static void cmd_help_long_parsed(void *parsed_result,
 
"quit\n"
"Quit to prompt.\n\n"
+
+   "sleep secs\n"
+   "Sleep for secs seconds (can be fractional).\n\n"
);
}
 
@@ -7768,6 +7771,37 @@ static cmdline_parse_inst_t cmd_quit = {
},
 };
 
+/* *** SLEEP *** */
+struct cmd_sleep_result {
+   cmdline_fixed_string_t sleep;
+   double secs;
+};
+
+static void cmd_sleep_parsed(void *parsed_result,
+   __rte_unused struct cmdline *cl,
+   __rte_unused void *data)
+{
+   struct cmd_sleep_result *res = parsed_result;
+
+   rte_delay_us_sleep(res->secs * 1E6);
+}
+
+static cmdline_parse_token_string_t cmd_sleep_sleep =
+   TOKEN_STRING_INITIALIZER(struct cmd_sleep_result, sleep, "sleep");
+static cmdline_parse_token_num_t cmd_sleep_seconds =
+   TOKEN_NUM_INITIALIZER(struct cmd_sleep_result, secs, RTE_FLOAT_DOUBLE);
+
+static cmdline_parse_inst_t cmd_sleep = {
+   .f = cmd_sleep_parsed,
+   .data = NULL,
+   .help_str = "sleep : Sleep for a specified number of seconds",
+   .tokens = {
+   (void *)&cmd_sleep_sleep,
+   (void *)&cmd_sleep_seconds,
+   NULL,
+   },
+};
+
 /* *** ADD/REMOVE MAC ADDRESS FROM A PORT *** */
 struct cmd_mac_addr_result {
cmdline_fixed_string_t mac_addr_cmd;
@@ -13711,6 +13745,7 @@ static cmdline_parse_ctx_t builtin_ctx[] = {
&cmd_showdevice,
&cmd_showcfg,
&cmd_showfwdall,
+   &cmd_sleep,
&cmd_start,
&cmd_start_tx_first,
&cmd_start_tx_first_n,
-- 
2.47.1



[PATCH v9 2/3] cmdline: add floating point support

2025-05-09 Thread Anatoly Burakov
Add support for parsing floating point numbers in cmdline library, as well
as unit tests for the new functionality. Use C library for parsing.

Signed-off-by: Anatoly Burakov 
---

Notes:
v7 -> v8:
- Fixed leftover comment about needing bigger epsilon value
- Fixed debug prints to avoid indexing num_help[] array

v6 -> v7:
- Fixed a bug in float compare in unit tests where a bigger epsilon
  value than necessary was "needed" because we were comparing float
  result to a double result

v5 -> v6:
- Small refactor to reduce amount of noise
- Use strtof for parsing single precision floats
- More unit tests

v4 -> v5:
- Reworked to use standard C library functions as much as possible,
  keeping near-100% compatibility with earlier versions (the only
  difference is that strings like "+4" are now considered valid)

v3 -> v4:
- Removed unnecessary check for integer overflow when parsing negative
  floats (as we convert to double before changing sign)
- Make naming of float exponent states more consistent

v2 -> v3:
- Fixed a bug where a free-standing negative exponent ("1e-") would attempt 
to be
  parsed, and added unit tests for this case
- Added support for floats in dpdk-cmdline-gen script
- Added documentation updates to call out float support

 app/test/test_cmdline_num.c| 283 -
 buildtools/dpdk-cmdline-gen.py |  24 ++-
 doc/guides/prog_guide/cmdline.rst  |   3 +
 doc/guides/rel_notes/release_25_07.rst |   5 +
 lib/cmdline/cmdline_parse_num.c|  66 +-
 lib/cmdline/cmdline_parse_num.h|   4 +-
 6 files changed, 366 insertions(+), 19 deletions(-)

diff --git a/app/test/test_cmdline_num.c b/app/test/test_cmdline_num.c
index 100c564188..832ed3d110 100644
--- a/app/test/test_cmdline_num.c
+++ b/app/test/test_cmdline_num.c
@@ -5,6 +5,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -23,6 +25,11 @@ struct num_signed_str {
int64_t result;
 };
 
+struct num_float_str {
+   const char * str;
+   double result;
+};
+
 const struct num_unsigned_str num_valid_positive_strs[] = {
/* decimal positive */
{"0", 0 },
@@ -144,6 +151,63 @@ const struct num_signed_str num_valid_negative_strs[] = {

{"-0b1000", 
INT64_MIN },
 };
 
+const struct num_float_str float_valid_strs[] = {
+   /* zero */
+   {"0", 0},
+   /* parse int as float */
+   {"1", 1},
+   {"-1", -1},
+   /* fractional */
+   {"1.23", 1.23},
+   {"-1.23", -1.23},
+   {"0.123", 0.123},
+   {"-0.123", -0.123},
+   {"123.456", 123.456},
+   {"-123.456", -123.456},
+   /* positive exponent */
+   {"1e2", 1e2},
+   {"-1e2", -1e2},
+   {"1E2", 1E2},
+   {"-1E2", -1E2},
+   {"0.12e3", 0.12e3},
+   {"-0.12e3", -0.12e3},
+   {"1.23e4", 1.23e4},
+   {"-1.23e4", -1.23e4},
+   {"1.23E4", 1.23E4},
+   {"-1.23E4", -1.23E4},
+   {"123.456e7", 123.456e7},
+   {"-123.456e7", -123.456e7},
+   {"123.456E7", 123.456E7},
+   {"-123.456E7", -123.456E7},
+   /* negative exponent */
+   {"1e-2", 1e-2},
+   {"-1e-2", -1e-2},
+   {"1E-2", 1E-2},
+   {"-1E-2", -1E-2},
+   {"0.12e-3", 0.12e-3},
+   {"-0.12e-3", -0.12e-3},
+   {"1.23e-4", 1.23e-4},
+   {"-1.23e-4", -1.23e-4},
+   {"1.23E-4", 1.23E-4},
+   {"-1.23E-4", -1.23E-4},
+   {"123.456e-7", 123.456e-7},
+   {"-123.456e-7", -123.456e-7},
+   {"123.456E-7", 123.456E-7},
+   {"-123.456E-7", -123.456E-7},
+   /* try overflowing float */
+   {"2e63", 2e63},
+   {"-2e63", -2e63},
+   {"2E63", 2E63},
+   {"-2E63", -2E63},
+   {"18446744073709551615", (double) UINT64_MAX},
+   {"-9223372036854775808", (double) INT64_MIN},
+   /* try overflowing double */
+   {"2e308", HUGE_VAL},
+   {"-2e308", -HUGE_VAL},
+   {"2E308", HUGE_VAL},
+   {"-2E308", HUGE_VAL},
+};
+
 const struct num_unsigned_str num_garbage_positive_strs[] = {
/* valid strings with garbage on the end, should still be valid 
*/
/* decimal */
@@ -214,6 +278,71 @@ const struct num_signed_str num_garbage_negative_strs[] = {
{"-010 garbage", INT64_MIN },
 };
 
+const struct num_float_str float_garbage_strs[] = {
+   /* valid strings with garbage on t

[PATCH v9 1/3] cmdline: use C standard library as number parser

2025-05-09 Thread Anatoly Burakov
Remove custom number parser and use C standard library instead. In order to
keep compatibility with earlier versions of the parser, we have to take
into account a couple of quirks:

- We did not consider "negative" numbers to be valid for anything other
  than base-10 numbers, whereas C standard library does. Adjust the tests
  to match the new behavior.
- We did not consider numbers such as "+4" to be valid, whereas C
  standard library does. Adjust the tests to match the new behavior.
- C standard library's strtoull does not do range checks on negative
  numbers, so we have to parse knowingly-negative numbers as signed.
- C standard library does not support binary numbers, so we keep around the
  relevant parts of the custom parser in place to support binary numbers.

Signed-off-by: Anatoly Burakov 
---

Notes:
v8 -> v9:
- glibc 2.38 supports binary formats (0b and -0b) under certain 
conditions,
  so in order to ensure the same functionality on all glic versions, add 
support for
  positive and negative binary formats, and adjust tests accordingly

v7 -> v8:
- Added the commented-out out-of-bounds check back
- Replaced debug print messages to ensure they don't attempt to
  index the num_help[] array (should fix compile errors)

v5 -> v6:
- Allowed more negative numbers (such as negative octals or hex)
- Updated unit tests to check new cases
- Small refactoring of code to reduce amount of noise
- More verbose debug output

v4 -> v5:
- Added this commit

 app/test/test_cmdline_num.c |  34 ++-
 lib/cmdline/cmdline_parse_num.c | 382 
 2 files changed, 225 insertions(+), 191 deletions(-)

diff --git a/app/test/test_cmdline_num.c b/app/test/test_cmdline_num.c
index 9276de59bd..100c564188 100644
--- a/app/test/test_cmdline_num.c
+++ b/app/test/test_cmdline_num.c
@@ -139,6 +139,9 @@ const struct num_signed_str num_valid_negative_strs[] = {
{"-2147483648", INT32_MIN },
{"-2147483649", INT32_MIN - 1LL },
{"-9223372036854775808", INT64_MIN },
+   {"-0x8000", INT64_MIN },
+   {"-010", INT64_MIN },
+   
{"-0b1000", 
INT64_MIN },
 };
 
 const struct num_unsigned_str num_garbage_positive_strs[] = {
@@ -175,12 +178,40 @@ const struct num_unsigned_str num_garbage_positive_strs[] 
= {
 
 const struct num_signed_str num_garbage_negative_strs[] = {
/* valid strings with garbage on the end, should still be valid 
*/
+   /* negative numbers */
{"-9223372036854775808\0garbage", INT64_MIN },
{"-9223372036854775808\rgarbage", INT64_MIN },
{"-9223372036854775808\tgarbage", INT64_MIN },
{"-9223372036854775808\ngarbage", INT64_MIN },
{"-9223372036854775808#garbage", INT64_MIN },
{"-9223372036854775808 garbage", INT64_MIN },
+   /* negative hex */
+   {"-0x8000\0garbage", INT64_MIN },
+   {"-0x8000\rgarbage", INT64_MIN },
+   {"-0x8000\tgarbage", INT64_MIN },
+   {"-0x8000\ngarbage", INT64_MIN },
+   {"-0x8000#garbage", INT64_MIN },
+   {"-0x8000 garbage", INT64_MIN },
+   /* negative binary */
+   
{"-0b1000\0garbage",
+   INT64_MIN },
+   
{"-0b1000\rgarbage",
+   INT64_MIN },
+   
{"-0b1000\tgarbage",
+   INT64_MIN },
+   
{"-0b1000\ngarbage",
+   INT64_MIN },
+   
{"-0b1000#garbage",
+   INT64_MIN },
+   
{"-0b1000 garbage",
+   INT64_MIN },
+   /* negative octal */
+   {"-010\0garbage", INT64_MIN },
+   {"-010\rgarbage", INT64_MIN },
+   {"-010\tgarbage", INT64_MIN },
+   {"-010\ngarbage", INT64_MIN },
+   {"-010#garbage", INT64_MIN },
+   {"-010 garbage", INT64_MIN },
 };
 
 const char * num_invalid_strs[] = {
@@ -197,15 +228,12 @@ const char * num_invalid_strs[] = {
"0b01110101017001",
/* false negative numbers */
"-12345F623",
-   "-0x1234580A",
-

Re: [PATCH v9 1/3] cmdline: use C standard library as number parser

2025-05-09 Thread Burakov, Anatoly

On 5/9/2025 3:39 PM, Anatoly Burakov wrote:

Remove custom number parser and use C standard library instead. In order to
keep compatibility with earlier versions of the parser, we have to take
into account a couple of quirks:

- We did not consider "negative" numbers to be valid for anything other
   than base-10 numbers, whereas C standard library does. Adjust the tests
   to match the new behavior.
- We did not consider numbers such as "+4" to be valid, whereas C
   standard library does. Adjust the tests to match the new behavior.
- C standard library's strtoull does not do range checks on negative
   numbers, so we have to parse knowingly-negative numbers as signed.





- C standard library does not support binary numbers, so we keep around the
   relevant parts of the custom parser in place to support binary numbers.


Missed updating this part. Better wording:

cmdline: use C standard library as number parser

- Some C standard library versions do not support binary numbers, so we 
keep around the relevant parts of the custom parser in place to support 
binary numbers. However, since those libc versions that do support them, 
also support them being negative, allow negative binary as well.


--
Thanks,
Anatoly


Re: [PATCH] rust: RFC/demo of safe API for Dpdk Eal, Eth and Rxq

2025-05-09 Thread Van Haaren, Harry
> From: Owen Hilyard
> Sent: Friday, May 09, 2025 12:53 AM
> To: Van Haaren, Harry; Etelson, Gregory; Richardson, Bruce
> Cc: dev@dpdk.org
> Subject: Re: [PATCH] rust: RFC/demo of safe API for Dpdk Eal, Eth and Rxq
> 
> > From: Van Haaren, Harry 
> > Sent: Tuesday, May 6, 2025 12:39 PM
> > To: Owen Hilyard ; Etelson, Gregory 
> > ; Richardson, Bruce 
> > Cc: dev@dpdk.org 
> > Subject: Re: [PATCH] rust: RFC/demo of safe API for Dpdk Eal, Eth and Rxq

> > Hi All!
> >
> > Great to see passionate & detailed replies & input!
> >
> > Please folks - lets try remember to send plain-text emails, and use  >  to 
> > indent each reply.
> >Its hard to identify what I wrote (1) compared to Owen's replies (2) in the 
> >archives otherwise.
> > (Adding some "Harry wrote" and "Owen wrote" annotations to try help future 
> > readability.)
> 
> My apologies, I'll be more careful with that.

Thanks! The reply here is perfect.


> > Maybe it will help to split the conversation into two threads, with one 
> > focussing on
> "DPDK used through Safe Rust abstractions", and the other on "future cool 
> use-cases".
> 
> Agree.
> 
> > Perhaps I jumped a bit too far ahead mentioning async runtimes, and while I 
> > like the enthusiasm for designing "cool new stuff", it is probably better 
> > to be realistic around what will get "done": my bad.
> >
> > I'll reply to the "DPDK via Safe Rust" topics below, and start a new thread 
> > (with same folks on CC) for "future cool use-cases" when I've had a chance 
> > to clean up a little demo to showcase them.
> >
> >
> > > > > Thanks for sharing. However, IMHO using EAL for thread management in 
> > > > > rust
> > > > > is the wrong interface to expose.
> > > >
> > > > EAL is a singleton object in DPDK architecture.
> > > > I see it as a hub for other resources.
> >
> > Harry Wrote:
> > > Yep, i tend to agree here; EAL is central to the rest of DPDK working 
> > > correctly.
> > > And given EALs implementation is heavily relying on global static 
> > > variables, it is
> > > certainly a "singleton" instance, yes.
> >
> > Owen wrote:
> > > I think a singleton one way to implement this, but then you lose some of 
> > > the RAII/automatic resource management behavior. It would, however, make 
> > > some APIs inherently unsafe or very unergonomic unless we were to force 
> > > rte_eal_cleanup to be run via atexit(3) or the platform equivalent and 
> > > forbid the user from running it themselves. For a lot of Rust runtimes 
> > > similar to the EAL (tokio, glommio, etc), once you spawn a runtime it's 
> > > around until process exit. The other option is to have a handle which 
> > > represents the state of the EAL on the Rust side and runs rte_eal_init on 
> > > creation and rte_eal_cleanup on destruction. There are two ways we can 
> > > make that safe. First, reference counting, once the handles are created, 
> > > they can be passed around easily, and the last one runs rte_eal_cleanup 
> > > when it gets dropped.  This avoids having tons of complicated lifetimes 
> > > and I think that, everywhere that it shouldn't affect fast path 
> > > performance, we should use refcounting.
> >
> > Agreed, refcounts for EAL "singleton" concept yes. For the record, the 
> > initial patch actually returns a
> "dpdk" object from dpdk::Eal::init(), and Drop impl has a // TODO 
> rte_eal_cleanup(), so well aligned on approach here.
> > https://patches.dpdk.org/project/dpdk/patch/20250418132324.4085336-1-harry.van.haa...@intel.com/
> 
> One thing I think I'd like to see is using a "newtype" for important numbers 
> (ex: "struct EthDevQueueId(pub u16)"). This prevents some classes of error 
> but if we make the constructor public it's at most a minor inconvenience to 
> anyone who has to do something a bit odd.
> 
> > > Owen wrote:
> > > The other option is to use lifetimes. This is doable, but is going to 
> > > force people who are more likely to primarily be C or C++ developers to 
> > > dive deep into Rust's type system if they want to build abstractions over 
> > > it. If we add async into the mix, as many people are going to want to do, 
> > > it's going to become much, much harder. As a result, I'd advocate for 
> > > only using it for data path components where refcounting isn't an option.
> >
> > +1 to not using lifetimes here, it is not the right solution for this EAL / 
> > singleton type problem.
> 
> Having now looked over the initial patchset in more detail, I think we do 
> have a question of how far down "it compiles it works" we want to go. For 
> example, using typestates to make Eal::take_eth_ports impossible to call more 
> than once using something like this:
> 
> #[derive(Debug, Default)]
> pub struct Eal {
> eth_ports: Vec,
> }
> 
> impl Eal {
> pub fn init() -> Result {
> // EAL init() will do PCI probe and VDev enumeration will find/create 
> eth ports.
> // This code should loop over the ports, and build up Rust structs 
> representing them
> let eth_p

[PATCH] net/ice: update log message

2025-05-09 Thread Pillai, Dhanya R
Clarified log message for DDP package load failure

Signed-off-by: Pillai, Dhanya R 

Notes

v2 - better commit message
---
 .mailmap   | 1 +
 drivers/net/intel/ice/ice_ethdev.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/.mailmap b/.mailmap
index d8439b79ce..0f66ad834f 100644
--- a/.mailmap
+++ b/.mailmap
@@ -353,6 +353,7 @@ Devendra Singh Rawat 
 Dex Chen 
 Dexia Li 
 Dexuan Cui 
+Dhanya Pillai 
 Dharmik Thakkar  
 Dheemanth Mallikarjun 
 Dhruv Tripathi 
diff --git a/drivers/net/intel/ice/ice_ethdev.c 
b/drivers/net/intel/ice/ice_ethdev.c
index 21d3795954..bd55e0e7e1 100644
--- a/drivers/net/intel/ice/ice_ethdev.c
+++ b/drivers/net/intel/ice/ice_ethdev.c
@@ -2026,7 +2026,7 @@ int ice_load_pkg(struct ice_adapter *adapter, bool 
use_dsn, uint64_t dsn)
 
err = ice_copy_and_init_pkg(hw, buf, bufsz, 
adapter->devargs.ddp_load_sched);
if (!ice_is_init_pkg_successful(err)) {
-   PMD_INIT_LOG(ERR, "ice_copy_and_init_hw failed: %d", err);
+   PMD_INIT_LOG(ERR, "Failed to load ddp package: %d", err);
free(buf);
return -1;
}
-- 
2.43.0



[PATCH v2 00/13] add lookup fib nodes in graph library

2025-05-09 Thread Ankur Dwivedi
This patch series adds two inbuilt nodes ip4_lookup_fib and
ip6_lookup_fib in graph library. These nodes uses the existing
Forwarding Information Base (FIB) library to create FIB, to do
route addition and route lookup.

Two new commands (for ipv4 and ipv6) for providing the lookup mode
is added in the dpdk-graph application. fib or lpm can be given as
lookup mode. If these new lookup mode commands are not given, the
dpdk-graph uses lpm (Longest Prefix Match) or lpm6 by default.
If fib is given as lookup mode then the ip4_lookup_fib or ip6_lookup_fib
nodes are used by the application.

v2:
- Fixed build failure in DPDK CI.
- Changed the prefetch code in process functions. Also removed the
  prefetch of mbuf obj as it was not improving performance.
- Added code to control fib configuration from dpdk-graph application.
- Added the packet classification next nodes id in public header file,
  so that they can be used by library and application.
- Changed the macro FIB_DEFAULT_NH to point to pkt drop node.

Ankur Dwivedi (13):
  fib: move macro to header file
  node: add IP4 lookup FIB node
  node: add IP4 FIB route add
  node: add process callback for IP4 FIB
  node: move next nodes to public header file
  node: add next node in packet classification
  app/graph: add IP4 lookup mode command
  fib: move macro to header file
  node: add IP6 lookup FIB node
  node: add IP6 FIB route add
  node: add process callback for IP6 FIB
  node: add next node in packet classification
  app/graph: add IP6 lookup mode command

 app/graph/commands.list |   2 +
 app/graph/ip4_route.c   |  34 +++-
 app/graph/ip6_route.c   |  33 +++-
 app/graph/l3fwd.c   |  70 +++
 app/graph/module_api.h  |  13 ++
 doc/guides/tools/graph.rst  |  24 ++-
 lib/fib/rte_fib.c   |   3 -
 lib/fib/rte_fib.h   |   3 +
 lib/fib/rte_fib6.c  |  11 +-
 lib/fib/rte_fib6.h  |   3 +
 lib/node/ip4_lookup_fib.c   | 332 
 lib/node/ip6_lookup_fib.c   | 322 +++
 lib/node/meson.build|   5 +-
 lib/node/pkt_cls.c  |  35 ++--
 lib/node/pkt_cls_priv.h |   7 -
 lib/node/rte_node_ip4_api.h |  34 
 lib/node/rte_node_ip6_api.h |  34 
 lib/node/rte_node_pkt_cls_api.h |  39 
 18 files changed, 954 insertions(+), 50 deletions(-)
 create mode 100644 lib/node/ip4_lookup_fib.c
 create mode 100644 lib/node/ip6_lookup_fib.c
 create mode 100644 lib/node/rte_node_pkt_cls_api.h

-- 
2.25.1



[PATCH v2 08/13] fib: move macro to header file

2025-05-09 Thread Ankur Dwivedi
Moves the macro FIB6_NAMESIZE to header file and rename it to
RTE_FIB6_NAMESIZE.

Signed-off-by: Ankur Dwivedi 
---
 lib/fib/rte_fib6.c | 11 ---
 lib/fib/rte_fib6.h |  3 +++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c
index 00647bdfa4..93a1c7197b 100644
--- a/lib/fib/rte_fib6.c
+++ b/lib/fib/rte_fib6.c
@@ -28,9 +28,6 @@ static struct rte_tailq_elem rte_fib6_tailq = {
 };
 EAL_REGISTER_TAILQ(rte_fib6_tailq)
 
-/* Maximum length of a FIB name. */
-#define FIB6_NAMESIZE  64
-
 #if defined(RTE_LIBRTE_FIB_DEBUG)
 #define FIB6_RETURN_IF_TRUE(cond, retval) do { \
if (cond)   \
@@ -41,7 +38,7 @@ EAL_REGISTER_TAILQ(rte_fib6_tailq)
 #endif
 
 struct rte_fib6 {
-   charname[FIB6_NAMESIZE];
+   charname[RTE_FIB6_NAMESIZE];
enum rte_fib6_type  type;   /**< Type of FIB struct */
struct rte_rib6 *rib;   /**< RIB helper datastructure */
void*dp;/**< pointer to the dataplane struct*/
@@ -157,7 +154,7 @@ RTE_EXPORT_SYMBOL(rte_fib6_create)
 struct rte_fib6 *
 rte_fib6_create(const char *name, int socket_id, struct rte_fib6_conf *conf)
 {
-   char mem_name[FIB6_NAMESIZE];
+   char mem_name[RTE_FIB6_NAMESIZE];
int ret;
struct rte_fib6 *fib = NULL;
struct rte_rib6 *rib = NULL;
@@ -190,7 +187,7 @@ rte_fib6_create(const char *name, int socket_id, struct 
rte_fib6_conf *conf)
/* guarantee there's no existing */
TAILQ_FOREACH(te, fib_list, next) {
fib = (struct rte_fib6 *)te->data;
-   if (strncmp(name, fib->name, FIB6_NAMESIZE) == 0)
+   if (strncmp(name, fib->name, RTE_FIB6_NAMESIZE) == 0)
break;
}
fib = NULL;
@@ -261,7 +258,7 @@ rte_fib6_find_existing(const char *name)
rte_mcfg_tailq_read_lock();
TAILQ_FOREACH(te, fib_list, next) {
fib = (struct rte_fib6 *) te->data;
-   if (strncmp(name, fib->name, FIB6_NAMESIZE) == 0)
+   if (strncmp(name, fib->name, RTE_FIB6_NAMESIZE) == 0)
break;
}
rte_mcfg_tailq_read_unlock();
diff --git a/lib/fib/rte_fib6.h b/lib/fib/rte_fib6.h
index 42e6138708..625df1fa6b 100644
--- a/lib/fib/rte_fib6.h
+++ b/lib/fib/rte_fib6.h
@@ -28,6 +28,9 @@ extern "C" {
 /** Maximum depth value possible for IPv6 FIB. */
 #define RTE_FIB6_MAXDEPTH (RTE_DEPRECATED(RTE_FIB6_MAXDEPTH) 
RTE_IPV6_MAX_DEPTH)
 
+/* Maximum length of a FIB name. */
+#define RTE_FIB6_NAMESIZE  64
+
 struct rte_fib6;
 struct rte_rib6;
 
-- 
2.25.1



RE: [PATCH v6 1/2] node: add global node mbuf dynfield

2025-05-09 Thread Pavan Nikhilesh Bhagavatula



> -Original Message-
> From: Nitin Saxena 
> Sent: Monday, April 28, 2025 4:07 PM
> To: Nithin Kumar Dabilpuram ; Pavan Nikhilesh
> Bhagavatula ; Robin Jarry
> ; Christophe Fontaine 
> Cc: dev@dpdk.org; Jerin Jacob ; Nitin Saxena
> 
> Subject: [PATCH v6 1/2] node: add global node mbuf dynfield
> 
> This patch defines rte_node specific dynamic field structure
> (rte_node_mbuf_dynfield_t)
> 
> rte_node_mbuf_dynfield_t structure holds two types of fields
> - Persistent data fields which are preserved across graph walk.
>   Currently size of persistent data fields is zero.
> - Overloadable data fields which are used by any two adjacent nodes.
>   Same fields can be repurposed by any other adjacent nodes
> 
> This dynfield can be also be used by out-of-tree nodes.
> 
> Signed-off-by: Nitin Saxena 

Acked-by: Pavan Nikhilesh 

> ---
>  doc/api/doxy-api-index.md  |   2 +
>  doc/guides/rel_notes/release_25_07.rst |   6 ++
>  lib/node/meson.build   |   2 +
>  lib/node/node_mbuf_dynfield.c  |  59 +++
>  lib/node/rte_node_mbuf_dynfield.h  | 140
> +
>  5 files changed, 209 insertions(+)
>  create mode 100644 lib/node/node_mbuf_dynfield.c
>  create mode 100644 lib/node/rte_node_mbuf_dynfield.h
> 
> diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md
> index 5c425a2cb9..e1c85bcfbd 100644
> --- a/doc/api/doxy-api-index.md
> +++ b/doc/api/doxy-api-index.md
> @@ -219,6 +219,8 @@ The public API headers are grouped by topics:
>  [ip4_node](@ref rte_node_ip4_api.h),
>  [ip6_node](@ref rte_node_ip6_api.h),
>  [udp4_input_node](@ref rte_node_udp4_input_api.h)
> +  * graph_nodes_mbuf:
> +[node_mbuf_dynfield](@ref rte_node_mbuf_dynfield.h)
> 
>  - **basic**:
>[bitops](@ref rte_bitops.h),
> diff --git a/doc/guides/rel_notes/release_25_07.rst
> b/doc/guides/rel_notes/release_25_07.rst
> index 093b85d206..2dc888e65d 100644
> --- a/doc/guides/rel_notes/release_25_07.rst
> +++ b/doc/guides/rel_notes/release_25_07.rst
> @@ -55,6 +55,12 @@ New Features
>   Also, make sure to start the actual text at the margin.
>   ===
> 
> +* **Added rte_node specific global mbuf dynamic field.**
> +
> +  Instead each node registering mbuf dynamic field for its own purpose, a
> +  global structure is added which can be used/overloaded by all nodes
> +  (including out-of-tree nodes). This minimizes footprint of node specific
> mbuf
> +  dynamic field.
> 
>  Removed Items
>  -
> diff --git a/lib/node/meson.build b/lib/node/meson.build
> index 0bed97a96c..152fe41129 100644
> --- a/lib/node/meson.build
> +++ b/lib/node/meson.build
> @@ -8,6 +8,7 @@ if is_windows
>  endif
> 
>  sources = files(
> +'node_mbuf_dynfield.c',
>  'ethdev_ctrl.c',
>  'ethdev_rx.c',
>  'ethdev_tx.c',
> @@ -30,6 +31,7 @@ headers = files(
>  'rte_node_ip4_api.h',
>  'rte_node_ip6_api.h',
>  'rte_node_udp4_input_api.h',
> +'rte_node_mbuf_dynfield.h',
>  )
> 
>  # Strict-aliasing rules are violated by uint8_t[] to context size casts.
> diff --git a/lib/node/node_mbuf_dynfield.c b/lib/node/node_mbuf_dynfield.c
> new file mode 100644
> index 00..6fbbf9604c
> --- /dev/null
> +++ b/lib/node/node_mbuf_dynfield.c
> @@ -0,0 +1,59 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(C) 2025 Marvell International Ltd.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define NODE_MBUF_DYNFIELD_MEMZONE_NAME
> "__rte_node_mbuf_dynfield"
> +
> +struct node_mbuf_dynfield_mz {
> + int dynfield_offset;
> +};
> +
> +static const struct rte_mbuf_dynfield node_mbuf_dynfield_desc = {
> + .name = "rte_node_mbuf_dynfield",
> + .size = sizeof(rte_node_mbuf_dynfield_t),
> + .align = alignof(rte_node_mbuf_dynfield_t),
> +};
> +
> +RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_node_mbuf_dynfield_register,
> 25.07);
> +int rte_node_mbuf_dynfield_register(void)
> +{
> + struct node_mbuf_dynfield_mz *f = NULL;
> + const struct rte_memzone *mz = NULL;
> + int dyn_offset;
> +
> + RTE_BUILD_BUG_ON(sizeof(rte_node_mbuf_dynfield_t) <
> RTE_NODE_MBUF_DYNFIELD_SIZE);
> + RTE_BUILD_BUG_ON(sizeof(rte_node_mbuf_overload_fields_t) <
> +  RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE);
> +
> + mz =
> rte_memzone_lookup(NODE_MBUF_DYNFIELD_MEMZONE_NAME);
> +
> + if (!mz) {
> + mz =
> rte_memzone_reserve_aligned(NODE_MBUF_DYNFIELD_MEMZONE_NAME,
> +  sizeof(struct
> node_mbuf_dynfield_mz),
> +  SOCKET_ID_ANY, 0,
> +  RTE_CACHE_LINE_SIZE);
> + if (!mz) {
> + node_err("node_mbuf_dyn",
> "rte_memzone_reserve_aligned failed");
> + rte_errno = ENOMEM;
> + return -1;
> +

[PATCH v2 02/13] node: add IP4 lookup FIB node

2025-05-09 Thread Ankur Dwivedi
Adds a lookup FIB node for IP4.
Adds a public function to do fib configuration from application.

Signed-off-by: Ankur Dwivedi 
---
 lib/node/ip4_lookup_fib.c   | 141 
 lib/node/meson.build|   3 +-
 lib/node/rte_node_ip4_api.h |  15 
 3 files changed, 158 insertions(+), 1 deletion(-)
 create mode 100644 lib/node/ip4_lookup_fib.c

diff --git a/lib/node/ip4_lookup_fib.c b/lib/node/ip4_lookup_fib.c
new file mode 100644
index 00..977d97b713
--- /dev/null
+++ b/lib/node/ip4_lookup_fib.c
@@ -0,0 +1,141 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2025 Marvell.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "rte_node_ip4_api.h"
+
+#include "node_private.h"
+
+/* IP4 Lookup global data struct */
+struct ip4_lookup_fib_node_main {
+   struct rte_fib *fib[RTE_MAX_NUMA_NODES];
+};
+
+struct ip4_lookup_fib_node_ctx {
+   /* Socket's FIB */
+   struct rte_fib *fib;
+   /* Dynamic offset to mbuf priv1 */
+   int mbuf_priv1_off;
+};
+
+static struct ip4_lookup_fib_node_main ip4_lookup_fib_nm;
+
+#define FIB_DEFAULT_MAX_ROUTES (UINT16_MAX)
+#define FIB_DEFAULT_NUM_TBL8   (UINT16_MAX / 2)
+#define FIB_DEFAULT_NH (RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP << 16)
+
+#define IP4_LOOKUP_NODE_FIB(ctx) \
+   (((struct ip4_lookup_fib_node_ctx *)ctx)->fib)
+
+#define IP4_LOOKUP_FIB_NODE_PRIV1_OFF(ctx) \
+   (((struct ip4_lookup_fib_node_ctx *)ctx)->mbuf_priv1_off)
+
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_node_ip4_fib_create, 25.07)
+int
+rte_node_ip4_fib_create(int socket, struct rte_fib_conf *conf)
+{
+   struct ip4_lookup_fib_node_main *nm = &ip4_lookup_fib_nm;
+   char s[RTE_FIB_NAMESIZE];
+
+   /* One fib per socket */
+   if (nm->fib[socket])
+   return 0;
+
+   conf->default_nh = FIB_DEFAULT_NH;
+   snprintf(s, sizeof(s), "IPV4_LOOKUP_FIB_%d", socket);
+   nm->fib[socket] = rte_fib_create(s, socket, conf);
+   if (nm->fib[socket] == NULL)
+   return -rte_errno;
+
+   return 0;
+}
+
+static int
+setup_fib(int socket)
+{
+   struct ip4_lookup_fib_node_main *nm = &ip4_lookup_fib_nm;
+   struct rte_fib_conf conf;
+   char s[RTE_FIB_NAMESIZE];
+
+   /* One fib per socket */
+   if (nm->fib[socket])
+   return 0;
+
+   conf.type = RTE_FIB_DIR24_8;
+   conf.default_nh = FIB_DEFAULT_NH;
+   conf.max_routes = FIB_DEFAULT_MAX_ROUTES;
+   conf.rib_ext_sz = 0;
+   conf.dir24_8.nh_sz = RTE_FIB_DIR24_8_4B;
+   conf.dir24_8.num_tbl8 = FIB_DEFAULT_NUM_TBL8;
+   conf.flags = 0;
+   snprintf(s, sizeof(s), "IPV4_LOOKUP_FIB_%d", socket);
+   nm->fib[socket] = rte_fib_create(s, socket, &conf);
+   if (nm->fib[socket] == NULL)
+   return -rte_errno;
+
+   return 0;
+}
+
+static int
+ip4_lookup_fib_node_init(const struct rte_graph *graph, struct rte_node *node)
+{
+   static uint8_t init_once;
+   int rc;
+
+   RTE_BUILD_BUG_ON(sizeof(struct ip4_lookup_fib_node_ctx) > 
RTE_NODE_CTX_SZ);
+
+   if (!init_once) {
+   node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register(
+   &node_mbuf_priv1_dynfield_desc);
+   if (node_mbuf_priv1_dynfield_offset < 0)
+   return -rte_errno;
+
+   init_once = 1;
+   }
+
+   rc = setup_fib(graph->socket);
+   if (rc) {
+   node_err("ip4_lookup_fib", "Failed to setup fib for sock %u, 
rc=%d",
+   graph->socket, rc);
+   return rc;
+   }
+
+   /* Update socket's FIB and mbuf dyn priv1 offset in node ctx */
+   IP4_LOOKUP_NODE_FIB(node->ctx) = ip4_lookup_fib_nm.fib[graph->socket];
+   IP4_LOOKUP_FIB_NODE_PRIV1_OFF(node->ctx) = 
node_mbuf_priv1_dynfield_offset;
+
+   node_dbg("ip4_lookup_fib", "Initialized ip4_lookup_fib node");
+
+   return 0;
+}
+
+static struct rte_node_xstats ip4_lookup_fib_xstats = {
+   .nb_xstats = 1,
+   .xstat_desc = {
+   [0] = "ip4_lookup_fib_error",
+   },
+};
+
+static struct rte_node_register ip4_lookup_fib_node = {
+   .name = "ip4_lookup_fib",
+
+   .init = ip4_lookup_fib_node_init,
+   .xstats = &ip4_lookup_fib_xstats,
+
+   .nb_edges = RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP + 1,
+   .next_nodes = {
+   [RTE_NODE_IP4_LOOKUP_NEXT_IP4_LOCAL] = "ip4_local",
+   [RTE_NODE_IP4_LOOKUP_NEXT_REWRITE] = "ip4_rewrite",
+   [RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP] = "pkt_drop",
+   },
+};
+
+RTE_NODE_REGISTER(ip4_lookup_fib_node);
diff --git a/lib/node/meson.build b/lib/node/meson.build
index 0bed97a96c..d2011c8f56 100644
--- a/lib/node/meson.build
+++ b/lib/node/meson.build
@@ -13,6 +13,7 @@ sources = files(
 'ethdev_tx.c',
 'ip4_local.c',
 'ip4_lookup.c',
+'ip4_lookup_fib.c',
 'ip4_reassembly.c',
 'ip4_rew

[PATCH v2 04/13] node: add process callback for IP4 FIB

2025-05-09 Thread Ankur Dwivedi
Adds the process callback function for ip4_lookup_fib node.

Signed-off-by: Ankur Dwivedi 
---
 lib/node/ip4_lookup_fib.c | 154 ++
 1 file changed, 154 insertions(+)

diff --git a/lib/node/ip4_lookup_fib.c b/lib/node/ip4_lookup_fib.c
index f300266c00..f9a5c5aa5a 100644
--- a/lib/node/ip4_lookup_fib.c
+++ b/lib/node/ip4_lookup_fib.c
@@ -40,6 +40,159 @@ static struct ip4_lookup_fib_node_main ip4_lookup_fib_nm;
 #define IP4_LOOKUP_FIB_NODE_PRIV1_OFF(ctx) \
(((struct ip4_lookup_fib_node_ctx *)ctx)->mbuf_priv1_off)
 
+static uint16_t
+ip4_lookup_fib_node_process(struct rte_graph *graph, struct rte_node *node, 
void **objs,
+   uint16_t nb_objs)
+{
+   struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts;
+   const int dyn = IP4_LOOKUP_FIB_NODE_PRIV1_OFF(node->ctx);
+   struct rte_fib *fib = IP4_LOOKUP_NODE_FIB(node->ctx);
+   uint64_t next_hop[RTE_GRAPH_BURST_SIZE];
+   uint32_t ip[RTE_GRAPH_BURST_SIZE];
+   struct rte_ipv4_hdr *ipv4_hdr;
+   uint16_t lookup_err = 0;
+   void **to_next, **from;
+   uint16_t last_spec = 0;
+   rte_edge_t next_index;
+   uint16_t n_left_from;
+   uint16_t held = 0;
+   uint16_t next;
+   int i;
+
+   /* Speculative next */
+   next_index = RTE_NODE_IP4_LOOKUP_NEXT_REWRITE;
+
+   pkts = (struct rte_mbuf **)objs;
+   from = objs;
+   n_left_from = nb_objs;
+
+   /* Get stream for the speculated next node */
+   to_next = rte_node_next_stream_get(graph, node, next_index, nb_objs);
+
+   for (i = 0; i < 4 && i < n_left_from; i++)
+   rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[i], void *,
+   sizeof(struct rte_ether_hdr)));
+
+   i = 0;
+   while (n_left_from >= 4) {
+   if (likely(n_left_from > 7)) {
+
+   /* Prefetch next-next mbufs */
+   if (likely(n_left_from > 11)) {
+   rte_prefetch0(pkts[8]);
+   rte_prefetch0(pkts[9]);
+   rte_prefetch0(pkts[10]);
+   rte_prefetch0(pkts[11]);
+   }
+
+   /* Prefetch next mbuf data */
+   rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[4], void *,
+   sizeof(struct rte_ether_hdr)));
+   rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[5], void *,
+   sizeof(struct rte_ether_hdr)));
+   rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[6], void *,
+   sizeof(struct rte_ether_hdr)));
+   rte_prefetch0(rte_pktmbuf_mtod_offset(pkts[7], void *,
+   sizeof(struct rte_ether_hdr)));
+   }
+
+   mbuf0 = pkts[0];
+   mbuf1 = pkts[1];
+   mbuf2 = pkts[2];
+   mbuf3 = pkts[3];
+   pkts += 4;
+   n_left_from -= 4;
+   /* Extract DIP of mbuf0 */
+   ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *,
+   sizeof(struct rte_ether_hdr));
+   /* Extract cksum, ttl as ipv4 hdr is in cache */
+   node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum;
+   node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live;
+
+   ip[i++] = rte_be_to_cpu_32(ipv4_hdr->dst_addr);
+
+   /* Extract DIP of mbuf1 */
+   ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf1, struct rte_ipv4_hdr *,
+   sizeof(struct rte_ether_hdr));
+   /* Extract cksum, ttl as ipv4 hdr is in cache */
+   node_mbuf_priv1(mbuf1, dyn)->cksum = ipv4_hdr->hdr_checksum;
+   node_mbuf_priv1(mbuf1, dyn)->ttl = ipv4_hdr->time_to_live;
+
+   ip[i++] = rte_be_to_cpu_32(ipv4_hdr->dst_addr);
+
+   /* Extract DIP of mbuf2 */
+   ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf2, struct rte_ipv4_hdr *,
+   sizeof(struct rte_ether_hdr));
+   /* Extract cksum, ttl as ipv4 hdr is in cache */
+   node_mbuf_priv1(mbuf2, dyn)->cksum = ipv4_hdr->hdr_checksum;
+   node_mbuf_priv1(mbuf2, dyn)->ttl = ipv4_hdr->time_to_live;
+
+   ip[i++] = rte_be_to_cpu_32(ipv4_hdr->dst_addr);
+
+   /* Extract DIP of mbuf3 */
+   ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf3, struct rte_ipv4_hdr *,
+   sizeof(struct rte_ether_hdr));
+
+   /* Extract cksum, ttl as ipv4 hdr is in cache */
+   node_mbuf_priv1(mbuf3, dyn)->cksum = ipv4_hdr->hdr_checksum;
+   node_mbuf_priv1(mbuf3, dyn)->ttl = ipv4_hdr->time_to_live;
+
+   ip[i++] = rt

RE: [PATCH v6 2/2] node: use node mbuf dynfield in ip4 nodes

2025-05-09 Thread Pavan Nikhilesh Bhagavatula



> -Original Message-
> From: Nitin Saxena 
> Sent: Monday, April 28, 2025 4:07 PM
> To: Nithin Kumar Dabilpuram ; Pavan Nikhilesh
> Bhagavatula ; Robin Jarry
> ; Christophe Fontaine 
> Cc: dev@dpdk.org; Jerin Jacob ; Nitin Saxena
> 
> Subject: [PATCH v6 2/2] node: use node mbuf dynfield in ip4 nodes
> 
> - Used global node mbuf in ip[4|6]_lookup/rewrite nodes
> - Redefine node_mbuf_priv1() to rte_node_mbuf_overload_fields_get()
> 
> Signed-off-by: Nitin Saxena 

Acked-by: Pavan Nikhilesh 

> ---
>  lib/node/ip4_lookup.c | 14 ---
>  lib/node/ip4_rewrite.c| 15 +---
>  lib/node/ip6_lookup.c | 15 +---
>  lib/node/ip6_rewrite.c| 14 ---
>  lib/node/node_private.h   | 40 +++
>  lib/node/rte_node_mbuf_dynfield.h |  9 +++
>  6 files changed, 34 insertions(+), 73 deletions(-)
> 
> diff --git a/lib/node/ip4_lookup.c b/lib/node/ip4_lookup.c
> index 604fcb267a..f6db3219f0 100644
> --- a/lib/node/ip4_lookup.c
> +++ b/lib/node/ip4_lookup.c
> @@ -32,8 +32,6 @@ struct ip4_lookup_node_ctx {
>   int mbuf_priv1_off;
>  };
> 
> -int node_mbuf_priv1_dynfield_offset = -1;
> -
>  static struct ip4_lookup_node_main ip4_lookup_nm;
> 
>  #define IP4_LOOKUP_NODE_LPM(ctx) \
> @@ -182,17 +180,15 @@ ip4_lookup_node_init(const struct rte_graph
> *graph, struct rte_node *node)
>  {
>   uint16_t socket, lcore_id;
>   static uint8_t init_once;
> - int rc;
> + int rc, dyn;
> 
>   RTE_SET_USED(graph);
>   RTE_BUILD_BUG_ON(sizeof(struct ip4_lookup_node_ctx) >
> RTE_NODE_CTX_SZ);
> 
> + dyn = rte_node_mbuf_dynfield_register();
> + if (dyn < 0)
> + return -rte_errno;
>   if (!init_once) {
> - node_mbuf_priv1_dynfield_offset =
> rte_mbuf_dynfield_register(
> - &node_mbuf_priv1_dynfield_desc);
> - if (node_mbuf_priv1_dynfield_offset < 0)
> - return -rte_errno;
> -
>   /* Setup LPM tables for all sockets */
>   RTE_LCORE_FOREACH(lcore_id)
>   {
> @@ -210,7 +206,7 @@ ip4_lookup_node_init(const struct rte_graph *graph,
> struct rte_node *node)
> 
>   /* Update socket's LPM and mbuf dyn priv1 offset in node ctx */
>   IP4_LOOKUP_NODE_LPM(node->ctx) =
> ip4_lookup_nm.lpm_tbl[graph->socket];
> - IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) =
> node_mbuf_priv1_dynfield_offset;
> + IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) = dyn;
> 
>  #if defined(__ARM_NEON) || defined(RTE_ARCH_X86)
>   if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128)
> diff --git a/lib/node/ip4_rewrite.c b/lib/node/ip4_rewrite.c
> index a9ab5eaa57..dfa4382350 100644
> --- a/lib/node/ip4_rewrite.c
> +++ b/lib/node/ip4_rewrite.c
> @@ -259,19 +259,16 @@ ip4_rewrite_node_process(struct rte_graph
> *graph, struct rte_node *node,
>  static int
>  ip4_rewrite_node_init(const struct rte_graph *graph, struct rte_node *node)
>  {
> - static bool init_once;
> + int dyn;
> 
>   RTE_SET_USED(graph);
>   RTE_BUILD_BUG_ON(sizeof(struct ip4_rewrite_node_ctx) >
> RTE_NODE_CTX_SZ);
> 
> - if (!init_once) {
> - node_mbuf_priv1_dynfield_offset =
> rte_mbuf_dynfield_register(
> - &node_mbuf_priv1_dynfield_desc);
> - if (node_mbuf_priv1_dynfield_offset < 0)
> - return -rte_errno;
> - init_once = true;
> - }
> - IP4_REWRITE_NODE_PRIV1_OFF(node->ctx) =
> node_mbuf_priv1_dynfield_offset;
> + dyn = rte_node_mbuf_dynfield_register();
> + if (dyn < 0)
> + return -rte_errno;
> +
> + IP4_REWRITE_NODE_PRIV1_OFF(node->ctx) = dyn;
> 
>   node_dbg("ip4_rewrite", "Initialized ip4_rewrite node initialized");
> 
> diff --git a/lib/node/ip6_lookup.c b/lib/node/ip6_lookup.c
> index 827fc2f379..83c0500c76 100644
> --- a/lib/node/ip6_lookup.c
> +++ b/lib/node/ip6_lookup.c
> @@ -318,18 +318,16 @@ ip6_lookup_node_init(const struct rte_graph
> *graph, struct rte_node *node)
>  {
>   uint16_t socket, lcore_id;
>   static uint8_t init_once;
> - int rc;
> + int rc, dyn;
> 
>   RTE_SET_USED(graph);
>   RTE_BUILD_BUG_ON(sizeof(struct ip6_lookup_node_ctx) >
> RTE_NODE_CTX_SZ);
> 
> - if (!init_once) {
> - node_mbuf_priv1_dynfield_offset =
> - rte_mbuf_dynfield_register(
> - &node_mbuf_priv1_dynfield_desc);
> - if (node_mbuf_priv1_dynfield_offset < 0)
> - return -rte_errno;
> + dyn = rte_node_mbuf_dynfield_register();
> + if (dyn < 0)
> + return -rte_errno;
> 
> + if (!init_once) {
>   /* Setup LPM tables for all sockets */
>   RTE_LCORE_FOREACH(lcore_id)
>   {
> @@ -347,8 +345,7 @@ ip6_lookup_node_init(const struct rte_graph *graph,
> struct rte_node *node)
> 
>   /* Update socket's LPM and mbuf dyn priv1 offset in