Re: [PATCH 04/10] eal: fix plugin dir walk

2025-06-23 Thread David Marchand
On Fri, Jun 20, 2025 at 11:19 AM Bruce Richardson
 wrote:
>
> On Thu, Jun 19, 2025 at 09:10:30AM +0200, David Marchand wrote:
> > For '.' and '..' directories (or any short file name),
> > a out of bound issue occurs.
> >
> > Caught by UBSan:
> >
> > EAL: Detected shared linkage of DPDK
> > ../lib/eal/common/eal_common_options.c:420:15: runtime error: index -2
> >   out of bounds for type 'char[256]'
> > #0 0x7f867eedf206 in eal_plugindir_init
> >   eal_common_options.c
> > #1 0x7f867eede58a in eal_plugins_init
> >   (build/lib/librte_eal.so.25+0xde58a)
> >   (BuildId: e7e4a1935e4bacb51c82ab1a84098a27decf3b4c)
> > #2 0x7f867efb8587 in rte_eal_init
> >   (build/lib/librte_eal.so.25+0x1b8587)
> >   (BuildId: e7e4a1935e4bacb51c82ab1a84098a27decf3b4c)
> > #3 0x55b62360861e in main
> >   (/home/runner/work/dpdk/dpdk/build/app/dpdk-testpmd+0x9e061e)
> >   (BuildId: d821ec918612c83fad8b5ccb6cc518e66bee48cd)
> > #4 0x7f8667429d8f in __libc_start_call_main
> >   csu/../sysdeps/nptl/libc_start_call_main.h:58:16
> > #5 0x7f8667429e3f in __libc_start_main
> >   csu/../csu/libc-start.c:392:3
> > #6 0x55b622d9d444 in _start
> >   (/home/runner/work/dpdk/dpdk/build/app/dpdk-testpmd+0x175444)
> >   (BuildId: d821ec918612c83fad8b5ccb6cc518e66bee48cd)
> > SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
> >   ../lib/eal/common/eal_common_options.c:420:15 in
> >   ../lib/eal/common/eal_common_options.c:421:15:
> >   runtime error: index 18446744073709551609 out of bounds
> >   for type 'char[256]'
> >
> > Fixes: c57f6e5c604a ("eal: fix plugin loading")
> > Cc: sta...@dpdk.org
> >
> > Signed-off-by: David Marchand 
> > ---
> Acked-by: Bruce Richardson 
>
> One thought inline below...
>
> >  lib/eal/common/eal_common_options.c | 15 +++
> >  1 file changed, 11 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/eal/common/eal_common_options.c 
> > b/lib/eal/common/eal_common_options.c
> > index 83b6fc7e89..153f807e4f 100644
> > --- a/lib/eal/common/eal_common_options.c
> > +++ b/lib/eal/common/eal_common_options.c
> > @@ -399,6 +399,14 @@ eal_plugins_init(void)
> >  }
> >  #else
> >
> > +static bool
> > +ends_with(const char *str, size_t str_len, const char *tail)
> > +{
> > + size_t tail_len = strlen(tail);
> > +
> > + return str_len >= tail_len && strncmp(&str[str_len - tail_len], tail, 
> > tail_len) == 0;
> > +}
> > +
>
> I wonder if that function is worth renaming to "rte_str_ends_with" and
> putting in rte_string_fns.h?

I'll have a look and see if we have potential users in the tree.



-- 
David Marchand



RE: [PATCH v2 2/2] lib/graph: default-align rte_graph_cluster_stats

2025-06-23 Thread Marat Khalili
Gently reminding about this issue, I still hope to see graph tests passing 
under sanitizer.

We cannot just remove __rte_cache_aligned from rte_graph_cluster_stats without 
removing it from rte_graph_cluster_node_stats because of how C works. But we 
can perhaps use rte_malloc to align our allocations in a way that matches the 
declaration. Would it be an ok solution?

> -Original Message-
> From: Marat Khalili 
> Sent: Tuesday 17 June 2025 17:40
> To: Jerin Jacob 
> Cc: Jerin Jacob ; Kiran Kumar K
> ; Nithin Dabilpuram
> ; Zhirun Yan ; Pavan
> Nikhilesh ; dev@dpdk.org
> Subject: RE: [PATCH v2 2/2] lib/graph: default-align rte_graph_cluster_stats
> 
> > -Original Message-
> > From: Jerin Jacob 
> > Sent: Tuesday 17 June 2025 16:50
> >
> > > > > -struct __rte_cache_aligned rte_graph_cluster_node_stats {
> > > > > +struct rte_graph_cluster_node_stats {
> > > >
> > > > This is a fastpath structure. No need to change the alignment here.
> > >
> > > rte_graph_cluster_stats includes it, so unfortunately would stay cache-
> > aligned regardless of the attributes unless we make
> > rte_graph_cluster_node_stats default-aligned as well. If you are sure that
> > we need to keep node one cache-aligned we can return to rte_malloc
> > solution (or posix_memalign, but I would prefer not to hand-code aligned
> > realloc).
> >
> > I think, existing following code will take care of this. Are you
> > seeing the sanitizer issue if the change is only updating
> > rte_graph_cluster_stats alignment?
> 
> Yes, still seeing the sanitizer issue. And if fails even before reaching 
> clusters,
> on the struct rte_graph_cluster_stats itself because I believe alignment
> propagates from members to enclosing structs.
> 
> > /* For a given cluster, max nodes will be the max number of graphs 
> > */
> > cluster_node_size += cluster->nb_graphs * sizeof(struct rte_node *);
> > cluster_node_size = RTE_ALIGN(cluster_node_size,
> > RTE_CACHE_LINE_SIZE);
> 
> Please correct me if I am wrong, AFAIU it looks like this in memory:
> - rte_graph_cluster_stats
> - cluster_node
>   - rte_graph_cluster_node_stats
> - rte_node *[nb_graphs]
> - padding of rte_node pointers array to cacheline
> - cluster_node
>   - rte_graph_cluster_node_stats
> - rte_node *[nb_graphs]...
> 
> cluster_node_size calculation above ensures correct distance between
> cluster_node structs due to presence of the rte_node pointers arrays in
> between, but alignment of the first cluster_node still depends on the
> alignment of rte_graph_cluster_stats, and each of the next ones depends on
> the previous. We could of course re-align the first one manually (in each 
> loop,
> after allocating some extra space), but to me it looks like the job rte_malloc
> could easier do for us. What do you think would be the right way forward?


Re: [PATCH 05/10] cmdline: fix port list parsing

2025-06-23 Thread Bruce Richardson
On Mon, Jun 23, 2025 at 11:40:15AM +0200, David Marchand wrote:
> On Fri, Jun 20, 2025 at 11:59 AM Bruce Richardson
>  wrote:
> >
> > On Thu, Jun 19, 2025 at 09:10:31AM +0200, David Marchand wrote:
> > > Doing arithmetics with the NULL pointer is undefined.
> > >
> > > Caught by UBSan:
> > >
> > > ../lib/cmdline/cmdline_parse_portlist.c:40:19: runtime error:
> > >   applying non-zero offset 1 to null pointer
> > > SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
> > >   ../lib/cmdline/cmdline_parse_portlist.c:40:19 in
> > >
> > > Fixes: af75078fece3 ("first public release")
> > > Cc: sta...@dpdk.org
> > >
> > > Signed-off-by: David Marchand 
> > > ---
> > >  lib/cmdline/cmdline_parse_portlist.c | 13 +
> > >  1 file changed, 9 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/lib/cmdline/cmdline_parse_portlist.c 
> > > b/lib/cmdline/cmdline_parse_portlist.c
> > > index ef6ce223b5..0c07cc02b5 100644
> > > --- a/lib/cmdline/cmdline_parse_portlist.c
> > > +++ b/lib/cmdline/cmdline_parse_portlist.c
> > > @@ -4,6 +4,7 @@
> > >   * All rights reserved.
> > >   */
> > >
> > > +#include 
> > >  #include 
> > >  #include 
> > >  #include 
> > > @@ -37,10 +38,11 @@ parse_ports(cmdline_portlist_t *pl, const char *str)
> > >   const char *first, *last;
> > >   char *end;
> > >
> > > - for (first = str, last = first;
> > > - first != NULL && last != NULL;
> > > - first = last + 1) {
> >
> > Maybe I'm a little slow this morning, but I can't see how this is actually
> > a problem. By my understanding, the check for "first != NULL && last !=
> > NULL" happens before any increment of "first = last + 1", meaning we are
> > guaranteed that the last is never null when we increment it.
> 
> Well, not sure I follow, but the problem is not at the first
> iteration, if this is what you mean.
> 
> On the last iteration of the parsing, there is no , left in the string
> that is parsed so last = strchr(first, ',') makes last == NULL.
> Then the first variable is set to last + 1 *before* evaluating the end
> condition.
> 
> I removed this patch of the series, rerun the test and I see:
> 
> 9/75 DPDK:fast-tests / cmdline_autotest   OK  0.22s
> 09:20:08 DPDK_TEST=cmdline_autotest MALLOC_PERTURB_=169
> /home/runner/work/dpdk/dpdk/build/app/dpdk-test --no-huge -m 2048 -d
> /home/runner/work/dpdk/dpdk/build/drivers
> --- output ---
> stdout:
> RTE>>cmdline_autotest
> Testind parsing ethernet addresses...
> Testind parsing port lists...
> Testind parsing numbers...
> Testing parsing IP addresses...
> Testing parsing strings...
> Testing circular buffer...
> Testing library functions...
> Test OK
> RTE>>
> stderr:
> EAL: Detected CPU lcores: 4
> EAL: Detected NUMA nodes: 1
> EAL: Detected shared linkage of DPDK
> EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
> EAL: Selected IOVA mode 'VA'
> APP: HPET is not enabled, using TSC as default timer
> ../lib/cmdline/cmdline_parse_portlist.c:44:19: runtime error: applying
> non-zero offset 1 to null pointer
> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
> ../lib/cmdline/cmdline_parse_portlist.c:44:19 in
> --
> 
> 
Thanks for the explanation. I was indeed thinking the issue was on the
first iteration only.

With the change to fix this, we can actually make last a local var within
the loop itself. Also, by using a while rather than do-while we can remove
the initial check for str = NULL. Here's an alternate fix that is very
slightly shorter, and limits the scope of "last":

diff --git a/lib/cmdline/cmdline_parse_portlist.c 
b/lib/cmdline/cmdline_parse_portlist.c
index ebe2a961bb..c65f3b704e 100644
--- a/lib/cmdline/cmdline_parse_portlist.c
+++ b/lib/cmdline/cmdline_parse_portlist.c
@@ -34,14 +34,11 @@ static int
 parse_ports(cmdline_portlist_t *pl, const char *str)
 {
size_t ps, pe;
-   const char *first, *last;
+   const char *first = str;
char *end;
 
-   for (first = str, last = first;
-   first != NULL && last != NULL;
-   first = last + 1) {
-
-   last = strchr(first, ',');
+   while (first != NULL) {
+   const char *last = strchr(first, ',');
 
errno = 0;
ps = strtoul(first, &end, 10);
@@ -65,6 +62,8 @@ parse_ports(cmdline_portlist_t *pl, const char *str)
return -1;
 
parse_set_list(pl, ps, pe);
+
+   first = (last == NULL ? NULL : last + 1);
}
 
return 0;



Re: [PATCH 05/10] cmdline: fix port list parsing

2025-06-23 Thread David Marchand
On Fri, Jun 20, 2025 at 11:59 AM Bruce Richardson
 wrote:
>
> On Thu, Jun 19, 2025 at 09:10:31AM +0200, David Marchand wrote:
> > Doing arithmetics with the NULL pointer is undefined.
> >
> > Caught by UBSan:
> >
> > ../lib/cmdline/cmdline_parse_portlist.c:40:19: runtime error:
> >   applying non-zero offset 1 to null pointer
> > SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
> >   ../lib/cmdline/cmdline_parse_portlist.c:40:19 in
> >
> > Fixes: af75078fece3 ("first public release")
> > Cc: sta...@dpdk.org
> >
> > Signed-off-by: David Marchand 
> > ---
> >  lib/cmdline/cmdline_parse_portlist.c | 13 +
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/cmdline/cmdline_parse_portlist.c 
> > b/lib/cmdline/cmdline_parse_portlist.c
> > index ef6ce223b5..0c07cc02b5 100644
> > --- a/lib/cmdline/cmdline_parse_portlist.c
> > +++ b/lib/cmdline/cmdline_parse_portlist.c
> > @@ -4,6 +4,7 @@
> >   * All rights reserved.
> >   */
> >
> > +#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -37,10 +38,11 @@ parse_ports(cmdline_portlist_t *pl, const char *str)
> >   const char *first, *last;
> >   char *end;
> >
> > - for (first = str, last = first;
> > - first != NULL && last != NULL;
> > - first = last + 1) {
>
> Maybe I'm a little slow this morning, but I can't see how this is actually
> a problem. By my understanding, the check for "first != NULL && last !=
> NULL" happens before any increment of "first = last + 1", meaning we are
> guaranteed that the last is never null when we increment it.

Well, not sure I follow, but the problem is not at the first
iteration, if this is what you mean.

On the last iteration of the parsing, there is no , left in the string
that is parsed so last = strchr(first, ',') makes last == NULL.
Then the first variable is set to last + 1 *before* evaluating the end
condition.

I removed this patch of the series, rerun the test and I see:

9/75 DPDK:fast-tests / cmdline_autotest   OK  0.22s
09:20:08 DPDK_TEST=cmdline_autotest MALLOC_PERTURB_=169
/home/runner/work/dpdk/dpdk/build/app/dpdk-test --no-huge -m 2048 -d
/home/runner/work/dpdk/dpdk/build/drivers
--- output ---
stdout:
RTE>>cmdline_autotest
Testind parsing ethernet addresses...
Testind parsing port lists...
Testind parsing numbers...
Testing parsing IP addresses...
Testing parsing strings...
Testing circular buffer...
Testing library functions...
Test OK
RTE>>
stderr:
EAL: Detected CPU lcores: 4
EAL: Detected NUMA nodes: 1
EAL: Detected shared linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
APP: HPET is not enabled, using TSC as default timer
../lib/cmdline/cmdline_parse_portlist.c:44:19: runtime error: applying
non-zero offset 1 to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../lib/cmdline/cmdline_parse_portlist.c:44:19 in
--


-- 
David Marchand



Re: [PATCH 02/10] test/telemetry: fix test calling all commands

2025-06-23 Thread David Marchand
Hello Shai,

On Thu, Jun 19, 2025 at 9:11 AM David Marchand
 wrote:
>
> This test was doing nothing as it could not find the telemetry client
> script following the test suite rework.
>
> Caught while looking at UNH unit test logs:
>
> /root/workspace/Generic-Unit-Test-DPDK/dpdk/app/test/suites/test_telemetry.sh:
> 18: 
> /root/workspace/Generic-Unit-Test-DPDK/dpdk/app/usertools/dpdk-telemetry.py:
> not found
>
> Fixes: 9da71dc4f96e ("test: add test case for scripted telemetry commands")
> Cc: sta...@dpdk.org
>
> Signed-off-by: David Marchand 

This fix is flagged as a failure because telemetry_all hits a 10s
timeout in AWS CI.
https://mails.dpdk.org/archives/test-report/2025-June/887693.html

Please use a 30s timeout (like other CI do for fast-tests), iow pass a
'-t 3' to the meson test command.

Thanks.


-- 
David Marchand



RE: [PATCH] net/iavf: fix VLAN offload strip flag

2025-06-23 Thread Loftus, Ciara
> Subject: [PATCH] net/iavf: fix VLAN offload strip flag
> 
>  For i40e kernel drivers which support either vlan(v1) or vlan(v2)
>  VIRTCHNL OP,it will set strip on when setting filter on. But dpdk
>  side will not change strip flag. To be consistent with dpdk side,
>  explicitly disable strip again.
> 
> Bugzilla ID:1725
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Amiya Ranjan Mohakud 
> ---
>  drivers/net/intel/iavf/iavf_ethdev.c | 48 +---
>  1 file changed, 29 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/net/intel/iavf/iavf_ethdev.c
> b/drivers/net/intel/iavf/iavf_ethdev.c
> index b3dacbef84..f93e7bf9ae 100644
> --- a/drivers/net/intel/iavf/iavf_ethdev.c
> +++ b/drivers/net/intel/iavf/iavf_ethdev.c
> @@ -1378,13 +1378,38 @@ iavf_dev_del_mac_addr(struct rte_eth_dev
> *dev, uint32_t index)
>   vf->mac_num--;
>  }
> 
> +static int
> +iavf_disable_vlan_strip_ex(struct rte_eth_dev *dev, int on)
> +{
> + /* For i40e kernel drivers which supports both vlan(v1 & v2)
> VIRTCHNL OP,
> +  * it will set strip on when setting filter on but dpdk side will not
> +  * change strip flag. To be consistent with dpdk side, explicitly 
> disable
> +  * strip again.
> +  *
> +  */
> + struct iavf_adapter *adapter =
> + IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> + struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
> + int err;
> +
> + if (adapter->hw.mac.type == IAVF_MAC_XL710 ||
> + adapter->hw.mac.type == IAVF_MAC_VF ||
> + adapter->hw.mac.type == IAVF_MAC_X722_VF) {
> + if (on && !(dev_conf->rxmode.offloads &
> RTE_ETH_RX_OFFLOAD_VLAN_STRIP)) {
> + err = iavf_disable_vlan_strip(adapter);
> + if (err)
> + return -EIO;
> + }
> + }
> + return 0;
> +}
> +
>  static int
>  iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
>  {
>   struct iavf_adapter *adapter =
>   IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
>   struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
> - struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
>   int err;
> 
>   if (adapter->closed)
> @@ -1394,7 +1419,8 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev,
> uint16_t vlan_id, int on)
>   err = iavf_add_del_vlan_v2(adapter, vlan_id, on);
>   if (err)
>   return -EIO;
> - return 0;
> +
> + return iavf_disable_vlan_strip_ex(dev, on);
>   }
> 
>   if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
> @@ -1404,23 +1430,7 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev,
> uint16_t vlan_id, int on)
>   if (err)
>   return -EIO;
> 
> - /* For i40e kernel driver which only supports vlan(v1) VIRTCHNL OP,
> -  * it will set strip on when setting filter on but dpdk side will not
> -  * change strip flag. To be consistent with dpdk side, disable strip
> -  * again.
> -  *
> -  * For i40e kernel driver which supports vlan v2, dpdk will invoke vlan
> v2
> -  * related function, so it won't go through here.
> -  */
> - if (adapter->hw.mac.type == IAVF_MAC_XL710 ||
> - adapter->hw.mac.type == IAVF_MAC_X722_VF) {
> - if (on && !(dev_conf->rxmode.offloads &
> RTE_ETH_RX_OFFLOAD_VLAN_STRIP)) {
> - err = iavf_disable_vlan_strip(adapter);
> - if (err)
> - return -EIO;
> - }
> - }
> - return 0;
> + return iavf_disable_vlan_strip_ex(dev, on);
>  }

Hi,

Thanks for the patch. I reproduced the issue it aims to resolve and confirm the 
patch resolves it.
I noticed when testing that even if the vf command in the iavf_add_del_vlan_v2 
function fails, the stripping may still be enabled. However, we only re-disable 
it if the iavf_add_del_vlan_v2 function was successful. Perhaps we should make 
the disabling unconditional or even better make it depend on if the stripping 
was enabled although I'm not sure if there's a way to check for this.
With test-pmd I use "rx_vlan add all " and it fails on adding vlan 17 
but still triggers the stripping to be enabled.

If you are posting a v2 please check the indentation on the commit message, it 
looks like there is some unnecessary whitespace.

Thanks,
Ciara

> 
>  static void
> --
> 2.39.5 (Apple Git-154)



Re: [PATCH v2 2/2] common/cnxk: fix null pointer checks

2025-06-23 Thread zhoumin

Recheck-request: rebase=main, loongarch-compilation



Re: [PATCH v2 2/2] common/cnxk: fix null pointer checks

2025-06-23 Thread zhoumin

Recheck-request: rebase=next-net-mrvl-for-main, loongarch-compilation



RE: [PATCH v2 2/2] lib/graph: default-align rte_graph_cluster_stats

2025-06-23 Thread Marat Khalili
> -Original Message-
> From: David Marchand 
> Sent: Monday 23 June 2025 13:08
> 
> Could you spend some time on reviewing patches on the topic?
> Like for example:
> https://patchwork.dpdk.org/project/dpdk/list/?series=35509

Sure, will look!

> rte_malloc is not required.
> I have a fix in an branch of mine, that makes use of aligned_alloc
> (which is C11), you need to manually copy data in stats_mem_populate.

Sure aligned_alloc and manual copy for realloc should work as well. I will then 
re-submit addressing your comments to 1/2 and dropping 2/2, and will wait for 
your fix. Thanks for the reviews!


Re: [PATCH v2 2/2] common/cnxk: fix null pointer checks

2025-06-23 Thread zhoumin

Recheck-request: rebase=next-net-mrvl-for-main, loongarch-compilation



[PATCH v2 02/10] test/telemetry: fix test calling all commands

2025-06-23 Thread David Marchand
This test was doing nothing as it could not find the telemetry client
script following the test suite rework.

Caught while looking at UNH unit test logs:

/root/workspace/Generic-Unit-Test-DPDK/dpdk/app/test/suites/test_telemetry.sh:
18: /root/workspace/Generic-Unit-Test-DPDK/dpdk/app/usertools/dpdk-telemetry.py:
not found

Fixes: 9da71dc4f96e ("test: add test case for scripted telemetry commands")
Cc: sta...@dpdk.org

Signed-off-by: David Marchand 
Acked-by: Bruce Richardson 
---
 app/test/suites/test_telemetry.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/suites/test_telemetry.sh 
b/app/test/suites/test_telemetry.sh
index ca6abe266e..20806b43e4 100755
--- a/app/test/suites/test_telemetry.sh
+++ b/app/test/suites/test_telemetry.sh
@@ -7,7 +7,7 @@ which jq || {
 exit 77
 }
 
-rootdir=$(readlink -f $(dirname $(readlink -f $0))/../..)
+rootdir=$(readlink -f $(dirname $(readlink -f $0))/../../..)
 tmpoutput=$(mktemp -t dpdk.test_telemetry.XX)
 trap "cat $tmpoutput; rm -f $tmpoutput" EXIT
 
-- 
2.49.0



[PATCH v2 01/10] ci: save ccache on failure

2025-06-23 Thread David Marchand
When troubleshooting unit test failures and repeating jobs in GHA,
the absence of ccache makes the whole process way slower.

Signed-off-by: David Marchand 
---
 .github/workflows/build.yml | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e5f17ef6ac..6c4bc664d0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -164,6 +164,12 @@ jobs:
 chmod o-w $HOME
 - name: Build and test
   run: .ci/linux-build.sh
+- name: Save ccache on failure
+  if: failure()
+  uses: actions/cache/save@v4
+  with:
+path: ~/.ccache
+key: ${{ steps.get_ref_keys.outputs.ccache }}-${{ github.ref }}
 - name: Upload logs on failure
   if: failure()
   uses: actions/upload-artifact@v4
-- 
2.49.0



[PATCH v2 03/10] test/mempool: fix test without stack driver

2025-06-23 Thread David Marchand
In a minimal build, the mempool/stack driver is disabled.
Separate the code specific to this external driver and rename unrelated
variables.

Signed-off-by: David Marchand 
Acked-by: Andrew Rybchenko 
---
 app/test/test_mempool.c | 32 
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index 61385e096e..63356998fd 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -847,9 +847,11 @@ test_mempool(void)
size_t alignment = 0;
struct rte_mempool *mp_cache = NULL;
struct rte_mempool *mp_nocache = NULL;
-   struct rte_mempool *mp_stack_anon = NULL;
-   struct rte_mempool *mp_stack_mempool_iter = NULL;
+   struct rte_mempool *mp_anon = NULL;
+   struct rte_mempool *mp_mempool_iter = NULL;
+#ifdef RTE_MEMPOOL_STACK
struct rte_mempool *mp_stack = NULL;
+#endif
struct rte_mempool *default_pool = NULL;
struct rte_mempool *mp_alignment = NULL;
struct mp_data cb_arg = {
@@ -884,28 +886,28 @@ test_mempool(void)
}
 
/* create an empty mempool  */
-   mp_stack_anon = rte_mempool_create_empty("test_stack_anon",
+   mp_anon = rte_mempool_create_empty("test_anon",
MEMPOOL_SIZE,
MEMPOOL_ELT_SIZE,
RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
SOCKET_ID_ANY, 0);
 
-   if (mp_stack_anon == NULL)
+   if (mp_anon == NULL)
GOTO_ERR(ret, err);
 
/* populate an empty mempool */
-   ret = rte_mempool_populate_anon(mp_stack_anon);
+   ret = rte_mempool_populate_anon(mp_anon);
printf("%s ret = %d\n", __func__, ret);
if (ret < 0)
GOTO_ERR(ret, err);
 
/* Try to populate when already populated */
-   ret = rte_mempool_populate_anon(mp_stack_anon);
+   ret = rte_mempool_populate_anon(mp_anon);
if (ret != 0)
GOTO_ERR(ret, err);
 
/* create a mempool  */
-   mp_stack_mempool_iter = rte_mempool_create("test_iter_obj",
+   mp_mempool_iter = rte_mempool_create("test_iter_obj",
MEMPOOL_SIZE,
MEMPOOL_ELT_SIZE,
RTE_MEMPOOL_CACHE_MAX_SIZE, 0,
@@ -913,20 +915,21 @@ test_mempool(void)
my_obj_init, NULL,
SOCKET_ID_ANY, 0);
 
-   if (mp_stack_mempool_iter == NULL)
+   if (mp_mempool_iter == NULL)
GOTO_ERR(ret, err);
 
/* test to initialize mempool objects and memory */
-   nb_objs = rte_mempool_obj_iter(mp_stack_mempool_iter, my_obj_init,
+   nb_objs = rte_mempool_obj_iter(mp_mempool_iter, my_obj_init,
NULL);
if (nb_objs == 0)
GOTO_ERR(ret, err);
 
-   nb_mem_chunks = rte_mempool_mem_iter(mp_stack_mempool_iter,
+   nb_mem_chunks = rte_mempool_mem_iter(mp_mempool_iter,
test_mp_mem_init, &cb_arg);
if (nb_mem_chunks == 0 || cb_arg.ret < 0)
GOTO_ERR(ret, err);
 
+#ifdef RTE_MEMPOOL_STACK
/* create a mempool with an external handler */
mp_stack = rte_mempool_create_empty("test_stack",
MEMPOOL_SIZE,
@@ -947,6 +950,7 @@ test_mempool(void)
GOTO_ERR(ret, err);
}
rte_mempool_obj_iter(mp_stack, my_obj_init, NULL);
+#endif /* RTE_MEMPOOL_STACK */
 
/* Create a mempool based on Default handler */
printf("Testing %s mempool handler\n", default_pool_ops);
@@ -1077,9 +1081,11 @@ test_mempool(void)
if (test_mempool_same_name_twice_creation() < 0)
GOTO_ERR(ret, err);
 
+#ifdef RTE_MEMPOOL_STACK
/* test the stack handler */
if (test_mempool_basic(mp_stack, 1) < 0)
GOTO_ERR(ret, err);
+#endif
 
if (test_mempool_basic(default_pool, 1) < 0)
GOTO_ERR(ret, err);
@@ -1105,9 +,11 @@ test_mempool(void)
 err:
rte_mempool_free(mp_nocache);
rte_mempool_free(mp_cache);
-   rte_mempool_free(mp_stack_anon);
-   rte_mempool_free(mp_stack_mempool_iter);
+   rte_mempool_free(mp_anon);
+   rte_mempool_free(mp_mempool_iter);
+#ifdef RTE_MEMPOOL_STACK
rte_mempool_free(mp_stack);
+#endif
rte_mempool_free(default_pool);
rte_mempool_free(mp_alignment);
 
-- 
2.49.0



[PATCH v2 06/10] cmdline: fix highest bit port list parsing

2025-06-23 Thread David Marchand
pl->map is a uint32_t.

Caught by UBSan:

../lib/cmdline/cmdline_parse_portlist.c:27:17: runtime error:
left shift of 1 by 31 places cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../lib/cmdline/cmdline_parse_portlist.c:27:17 in

Fixes: af75078fece3 ("first public release")
Cc: sta...@dpdk.org

Signed-off-by: David Marchand 
Acked-by: Bruce Richardson 
---
Changes since v1:
- moved variable increment out of the macro call,

---
 lib/cmdline/cmdline_parse_portlist.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/cmdline/cmdline_parse_portlist.c 
b/lib/cmdline/cmdline_parse_portlist.c
index 549f6d9671..3efe4143e3 100644
--- a/lib/cmdline/cmdline_parse_portlist.c
+++ b/lib/cmdline/cmdline_parse_portlist.c
@@ -10,7 +10,9 @@
 #include 
 
 #include 
+#include 
 #include 
+
 #include "cmdline_parse.h"
 #include "cmdline_parse_portlist.h"
 
@@ -26,7 +28,8 @@ static void
 parse_set_list(cmdline_portlist_t *pl, size_t low, size_t high)
 {
do {
-   pl->map |= (1 << low++);
+   pl->map |= RTE_BIT32(low);
+   low++;
} while (low <= high);
 }
 
-- 
2.49.0



[PATCH v2 04/10] eal: fix plugin dir walk

2025-06-23 Thread David Marchand
For '.' and '..' directories (or any short file name),
a out of bound issue occurs.

Caught by UBSan:

EAL: Detected shared linkage of DPDK
../lib/eal/common/eal_common_options.c:420:15: runtime error: index -2
out of bounds for type 'char[256]'
#0 0x7f867eedf206 in eal_plugindir_init
eal_common_options.c
#1 0x7f867eede58a in eal_plugins_init
(build/lib/librte_eal.so.25+0xde58a)
(BuildId: e7e4a1935e4bacb51c82ab1a84098a27decf3b4c)
#2 0x7f867efb8587 in rte_eal_init
(build/lib/librte_eal.so.25+0x1b8587)
(BuildId: e7e4a1935e4bacb51c82ab1a84098a27decf3b4c)
#3 0x55b62360861e in main
(/home/runner/work/dpdk/dpdk/build/app/dpdk-testpmd+0x9e061e)
(BuildId: d821ec918612c83fad8b5ccb6cc518e66bee48cd)
#4 0x7f8667429d8f in __libc_start_call_main
csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#5 0x7f8667429e3f in __libc_start_main
csu/../csu/libc-start.c:392:3
#6 0x55b622d9d444 in _start
(/home/runner/work/dpdk/dpdk/build/app/dpdk-testpmd+0x175444)
(BuildId: d821ec918612c83fad8b5ccb6cc518e66bee48cd)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../lib/eal/common/eal_common_options.c:420:15 in
../lib/eal/common/eal_common_options.c:421:15:
runtime error: index 18446744073709551609 out of bounds
for type 'char[256]'

Fixes: c57f6e5c604a ("eal: fix plugin loading")
Cc: sta...@dpdk.org

Signed-off-by: David Marchand 
Acked-by: Bruce Richardson 
---
 lib/eal/common/eal_common_options.c | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/eal/common/eal_common_options.c 
b/lib/eal/common/eal_common_options.c
index 83b6fc7e89..153f807e4f 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -399,6 +399,14 @@ eal_plugins_init(void)
 }
 #else
 
+static bool
+ends_with(const char *str, size_t str_len, const char *tail)
+{
+   size_t tail_len = strlen(tail);
+
+   return str_len >= tail_len && strncmp(&str[str_len - tail_len], tail, 
tail_len) == 0;
+}
+
 static int
 eal_plugindir_init(const char *path)
 {
@@ -417,13 +425,12 @@ eal_plugindir_init(const char *path)
}
 
while ((dent = readdir(d)) != NULL) {
+   size_t nlen = strnlen(dent->d_name, sizeof(dent->d_name));
struct stat sb;
-   int nlen = strnlen(dent->d_name, sizeof(dent->d_name));
 
/* check if name ends in .so or .so.ABI_VERSION */
-   if (strcmp(&dent->d_name[nlen - 3], ".so") != 0 &&
-   strcmp(&dent->d_name[nlen - 4 - strlen(ABI_VERSION)],
-  ".so."ABI_VERSION) != 0)
+   if (!ends_with(dent->d_name, nlen, ".so") &&
+   !ends_with(dent->d_name, nlen, 
".so."ABI_VERSION))
continue;
 
snprintf(sopath, sizeof(sopath), "%s/%s", path, dent->d_name);
-- 
2.49.0



[PATCH v2 07/10] tailq: fix cast macro for null pointer

2025-06-23 Thread David Marchand
Doing arithmetics with the NULL pointer is undefined.

Caught by UBSan:

../app/test/test_tailq.c:111:9: runtime error:
member access within null pointer of type 'struct rte_tailq_head'

Fixes: f6b4f6c9c123 ("tailq: use a single cast macro")
Cc: sta...@dpdk.org

Signed-off-by: David Marchand 
Acked-by: Bruce Richardson 
---
 lib/eal/include/rte_tailq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/eal/include/rte_tailq.h b/lib/eal/include/rte_tailq.h
index 89f7ef2134..c23df77d96 100644
--- a/lib/eal/include/rte_tailq.h
+++ b/lib/eal/include/rte_tailq.h
@@ -54,7 +54,7 @@ struct rte_tailq_elem {
  * Return the first tailq entry cast to the right struct.
  */
 #define RTE_TAILQ_CAST(tailq_entry, struct_name) \
-   (struct struct_name *)&(tailq_entry)->tailq_head
+   (tailq_entry == NULL ? NULL : (struct struct_name 
*)&(tailq_entry)->tailq_head)
 
 /**
  * Utility macro to make looking up a tailqueue for a particular struct easier.
-- 
2.49.0



[PATCH v2 05/10] cmdline: fix port list parsing

2025-06-23 Thread David Marchand
Doing arithmetics with the NULL pointer is undefined.

Caught by UBSan:

../lib/cmdline/cmdline_parse_portlist.c:40:19: runtime error:
applying non-zero offset 1 to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../lib/cmdline/cmdline_parse_portlist.c:40:19 in

Fixes: af75078fece3 ("first public release")
Cc: sta...@dpdk.org

Signed-off-by: David Marchand 
---
Changes since v1:
- moved some variable as suggested by Bruce,

---
 lib/cmdline/cmdline_parse_portlist.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/cmdline/cmdline_parse_portlist.c 
b/lib/cmdline/cmdline_parse_portlist.c
index ef6ce223b5..549f6d9671 100644
--- a/lib/cmdline/cmdline_parse_portlist.c
+++ b/lib/cmdline/cmdline_parse_portlist.c
@@ -33,15 +33,12 @@ parse_set_list(cmdline_portlist_t *pl, size_t low, size_t 
high)
 static int
 parse_ports(cmdline_portlist_t *pl, const char *str)
 {
+   const char *first = str;
size_t ps, pe;
-   const char *first, *last;
char *end;
 
-   for (first = str, last = first;
-   first != NULL && last != NULL;
-   first = last + 1) {
-
-   last = strchr(first, ',');
+   while (first != NULL) {
+   const char *last = strchr(first, ',');
 
errno = 0;
ps = strtoul(first, &end, 10);
@@ -65,6 +62,7 @@ parse_ports(cmdline_portlist_t *pl, const char *str)
return -1;
 
parse_set_list(pl, ps, pe);
+   first = (last == NULL ? NULL : last + 1);
}
 
return 0;
-- 
2.49.0



[PATCH v2 08/10] hash: fix unaligned access in predictable RSS

2025-06-23 Thread David Marchand
Caught by UBSan:

../lib/hash/rte_thash.c:421:8: runtime error: load of misaligned address
0x0001816c2da3 for type 'uint32_t' (aka 'unsigned int'),
which requires 4 byte alignment

Fixes: 28ebff11c2dc ("hash: add predictable RSS")
Cc: sta...@dpdk.org

Signed-off-by: David Marchand 
---
 lib/hash/rte_thash.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c
index 6c662bf14f..6d4dbea6d7 100644
--- a/lib/hash/rte_thash.c
+++ b/lib/hash/rte_thash.c
@@ -415,10 +415,10 @@ generate_subkey(struct rte_thash_ctx *ctx, struct 
thash_lfsr *lfsr,
 static inline uint32_t
 get_subvalue(struct rte_thash_ctx *ctx, uint32_t offset)
 {
-   uint32_t *tmp, val;
+   uint32_t tmp, val;
 
-   tmp = (uint32_t *)(&ctx->hash_key[offset >> 3]);
-   val = rte_be_to_cpu_32(*tmp);
+   memcpy(&tmp, &ctx->hash_key[offset >> 3], sizeof(tmp));
+   val = rte_be_to_cpu_32(tmp);
val >>= (TOEPLITZ_HASH_LEN - ((offset & (CHAR_BIT - 1)) +
ctx->reta_sz_log));
 
-- 
2.49.0



[PATCH v2 09/10] stack: fix unaligned accesses on 128-bit

2025-06-23 Thread David Marchand
Caught by UBSan:

../lib/eal/x86/include/rte_atomic_64.h:206:21: runtime error:
member access within misaligned address 0x7ffd9c67f228 for
type 'const rte_int128_t', which requires 16 byte alignment
0x7ffd9c67f228: note: pointer points here
 00 00 00 00  c0 5d 3e 00 01 00 00 00  01 00 00 00 00 00 00 00
  ^
 00 00 00 00 00 00 00 00  00 00 00 00
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../lib/eal/x86/include/rte_atomic_64.h:206:21 in
../lib/eal/x86/include/rte_atomic_64.h:206:21: runtime error:
member access within misaligned address 0x7ffd9c67f228 for type
'const union rte_int128_t::(anonymous at
../lib/eal/include/generic/rte_atomic.h:1102:2)', which requires
16 byte alignment
0x7ffd9c67f228: note: pointer points here
 00 00 00 00  c0 5d 3e 00 01 00 00 00  01 00 00 00 00 00 00 00
  ^
 00 00 00 00 00 00 00 00  00 00 00 00
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../lib/eal/x86/include/rte_atomic_64.h:206:21 in
../lib/eal/x86/include/rte_atomic_64.h:206:16: runtime error:
load of misaligned address 0x7ffd9c67f228 for type
'const uint64_t' (aka 'const unsigned long'), which requires
16 byte alignment
0x7ffd9c67f228: note: pointer points here
 00 00 00 00  c0 5d 3e 00 01 00 00 00  01 00 00 00 00 00 00 00
  ^
 00 00 00 00 00 00 00 00  00 00 00 00
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../lib/eal/x86/include/rte_atomic_64.h:206:21 in

Fixes: 3340202f5954 ("stack: add lock-free implementation")
Cc: sta...@dpdk.org

Signed-off-by: David Marchand 
---
 lib/stack/rte_stack_lf_c11.h | 8 
 lib/stack/rte_stack_lf_generic.h | 8 
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/stack/rte_stack_lf_c11.h b/lib/stack/rte_stack_lf_c11.h
index b97e02d6a1..f674731235 100644
--- a/lib/stack/rte_stack_lf_c11.h
+++ b/lib/stack/rte_stack_lf_c11.h
@@ -63,13 +63,13 @@ __rte_stack_lf_push_elems(struct rte_stack_lf_list *list,
  struct rte_stack_lf_elem *last,
  unsigned int num)
 {
-   struct rte_stack_lf_head old_head;
+   alignas(16) struct rte_stack_lf_head old_head;
int success;
 
old_head = list->head;
 
do {
-   struct rte_stack_lf_head new_head;
+   alignas(16) struct rte_stack_lf_head new_head;
 
/* Swing the top pointer to the first element in the list and
 * make the last element point to the old top.
@@ -102,7 +102,7 @@ __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list,
 void **obj_table,
 struct rte_stack_lf_elem **last)
 {
-   struct rte_stack_lf_head old_head;
+   alignas(16) struct rte_stack_lf_head old_head;
uint64_t len;
int success = 0;
 
@@ -129,7 +129,7 @@ __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list,
 
/* Pop num elements */
do {
-   struct rte_stack_lf_head new_head;
+   alignas(16) struct rte_stack_lf_head new_head;
struct rte_stack_lf_elem *tmp;
unsigned int i;
 
diff --git a/lib/stack/rte_stack_lf_generic.h b/lib/stack/rte_stack_lf_generic.h
index cc69e4d168..32f56dffdd 100644
--- a/lib/stack/rte_stack_lf_generic.h
+++ b/lib/stack/rte_stack_lf_generic.h
@@ -36,13 +36,13 @@ __rte_stack_lf_push_elems(struct rte_stack_lf_list *list,
  struct rte_stack_lf_elem *last,
  unsigned int num)
 {
-   struct rte_stack_lf_head old_head;
+   alignas(16) struct rte_stack_lf_head old_head;
int success;
 
old_head = list->head;
 
do {
-   struct rte_stack_lf_head new_head;
+   alignas(16) struct rte_stack_lf_head new_head;
 
/* An acquire fence (or stronger) is needed for weak memory
 * models to establish a synchronized-with relationship between
@@ -77,7 +77,7 @@ __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list,
 void **obj_table,
 struct rte_stack_lf_elem **last)
 {
-   struct rte_stack_lf_head old_head;
+   alignas(16) struct rte_stack_lf_head old_head;
int success = 0;
 
/* Reserve num elements, if available */
@@ -99,7 +99,7 @@ __rte_stack_lf_pop_elems(struct rte_stack_lf_list *list,
 
/* Pop num elements */
do {
-   struct rte_stack_lf_head new_head;
+   alignas(16) struct rte_stack_lf_head new_head;
struct rte_stack_lf_elem *tmp;
unsigned int i;
 
-- 
2.49.0



[PATCH v2 10/10] build: support Undefined Behavior Sanitizer

2025-06-23 Thread David Marchand
Enable UBSan in GHA.
There are still a lot of issues so only run unit tests for a "mini"
target.

Building with debugoptimized forces -O2 and consumes too much memory
with UBSan, prefer plain build (iow -O0) even though this hides a number
of build issues.

Signed-off-by: David Marchand 
---
 .ci/linux-build.sh  | 27 +--
 .github/workflows/build.yml |  5 +
 app/test/suites/meson.build |  3 +--
 config/meson.build  | 18 +-
 devtools/words-case.txt |  1 +
 5 files changed, 49 insertions(+), 5 deletions(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index e9272d3931..905c11b1bf 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -44,6 +44,13 @@ catch_coredump() {
 return 1
 }
 
+catch_ubsan() {
+[ "$UBSAN" = "true" ] || return 0
+grep -q UndefinedBehaviorSanitizer $2 2>/dev/null || return 0
+grep -E "($1|UndefinedBehaviorSanitizer)" $2
+return 1
+}
+
 check_traces() {
 which babeltrace >/dev/null || return 0
 for file in $(sudo find $HOME -name metadata); do
@@ -100,7 +107,6 @@ fi
 
 OPTS="$OPTS -Dplatform=generic"
 OPTS="$OPTS -Ddefault_library=$DEF_LIB"
-OPTS="$OPTS -Dbuildtype=$buildtype"
 if [ "$STDATOMIC" = "true" ]; then
OPTS="$OPTS -Denable_stdatomic=true"
 else
@@ -117,13 +123,28 @@ else
 fi
 OPTS="$OPTS -Dlibdir=lib"
 
+buildtype=debugoptimized
+sanitizer=
 if [ "$ASAN" = "true" ]; then
-OPTS="$OPTS -Db_sanitize=address"
+sanitizer=${sanitizer:+$sanitizer,}address
+fi
+
+if [ "$UBSAN" = "true" ]; then
+sanitizer=${sanitizer:+$sanitizer,}undefined
+if [ "$RUN_TESTS" = "true" ]; then
+# UBSan takes too much memory with -O2
+buildtype=plain
+fi
+fi
+
+if [ -n "$sanitizer" ]; then
+OPTS="$OPTS -Db_sanitize=$sanitizer"
 if [ "${CC%%clang}" != "$CC" ]; then
 OPTS="$OPTS -Db_lundef=false"
 fi
 fi
 
+OPTS="$OPTS -Dbuildtype=$buildtype"
 OPTS="$OPTS -Dwerror=true"
 
 if [ -d build ]; then
@@ -141,6 +162,7 @@ if [ -z "$cross_file" ]; then
 configure_coredump
 devtools/test-null.sh || failed="true"
 catch_coredump
+catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt
 check_traces
 [ "$failed" != "true" ]
 fi
@@ -182,6 +204,7 @@ if [ "$RUN_TESTS" = "true" ]; then
 configure_coredump
 sudo meson test -C build --suite fast-tests -t 3 || failed="true"
 catch_coredump
+catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt
 check_traces
 [ "$failed" != "true" ]
 fi
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 6c4bc664d0..4353bb97d8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -54,6 +54,7 @@ jobs:
   RISCV64: ${{ matrix.config.cross == 'riscv64' }}
   RUN_TESTS: ${{ contains(matrix.config.checks, 'tests') }}
   STDATOMIC: ${{ contains(matrix.config.checks, 'stdatomic') }}
+  UBSAN: ${{ contains(matrix.config.checks, 'ubsan') }}
 
 strategy:
   fail-fast: false
@@ -62,6 +63,10 @@ jobs:
   - os: ubuntu-22.04
 compiler: gcc
 mini: mini
+  - os: ubuntu-22.04
+compiler: clang
+mini: mini
+checks: tests+ubsan
   - os: ubuntu-22.04
 compiler: gcc
 checks: stdatomic
diff --git a/app/test/suites/meson.build b/app/test/suites/meson.build
index e482373330..0cba63ee12 100644
--- a/app/test/suites/meson.build
+++ b/app/test/suites/meson.build
@@ -72,8 +72,7 @@ foreach suite:test_suites
 elif not has_hugepage
 continue  #skip this tests
 endif
-if not asan and (get_option('b_sanitize') == 'address'
-or get_option('b_sanitize') == 'address,undefined')
+if not asan and get_option('b_sanitize').contains('address')
 continue  # skip this test
 endif
 
diff --git a/config/meson.build b/config/meson.build
index f31fef216c..b8a8511a7f 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -499,7 +499,7 @@ if get_option('b_lto')
 endif
 endif
 
-if get_option('b_sanitize') == 'address' or get_option('b_sanitize') == 
'address,undefined'
+if get_option('b_sanitize').contains('address')
 if is_windows
 error('ASan is not supported on windows')
 endif
@@ -519,6 +519,22 @@ if get_option('b_sanitize') == 'address' or 
get_option('b_sanitize') == 'address
 endif
 endif
 
+if get_option('b_sanitize').contains('undefined')
+if is_windows
+error('UBSan is not supported on windows')
+endif
+
+if cc.get_id() == 'gcc'
+ubsan_dep = cc.find_library('ubsan', required: true)
+if (not cc.links('int main(int argc, char *argv[]) { return 0; }',
+dependencies: ubsan_dep))
+error('broken dependency, "libubsan"')
+endif
+add_project_link_arguments('-lubsan', language: 'c')
+dpdk_extra_ldflags += '-lubsan'
+endif
+

[PATCH v2 00/10] Run with UBSan in GHA

2025-06-23 Thread David Marchand
This series fixes a number of issues reported by UBSan and adds a simple
job in GHA to avoid introducing undefined behavior in the core
components.
There is way more work/fixes to do if we want to run with a full set of
components, but baby steps first.


-- 
David Marchand

Changes since v1:
- small updates on patches 5 and 6,

David Marchand (10):
  ci: save ccache on failure
  test/telemetry: fix test calling all commands
  test/mempool: fix test without stack driver
  eal: fix plugin dir walk
  cmdline: fix port list parsing
  cmdline: fix highest bit port list parsing
  tailq: fix cast macro for null pointer
  hash: fix unaligned access in predictable RSS
  stack: fix unaligned accesses on 128-bit
  build: support Undefined Behavior Sanitizer

 .ci/linux-build.sh   | 27 +--
 .github/workflows/build.yml  | 11 ++
 app/test/suites/meson.build  |  3 +--
 app/test/suites/test_telemetry.sh|  2 +-
 app/test/test_mempool.c  | 32 +---
 config/meson.build   | 18 +++-
 devtools/words-case.txt  |  1 +
 lib/cmdline/cmdline_parse_portlist.c | 15 +++--
 lib/eal/common/eal_common_options.c  | 15 +
 lib/eal/include/rte_tailq.h  |  2 +-
 lib/hash/rte_thash.c |  6 +++---
 lib/stack/rte_stack_lf_c11.h |  8 +++
 lib/stack/rte_stack_lf_generic.h |  8 +++
 13 files changed, 107 insertions(+), 41 deletions(-)

-- 
2.49.0



Re: [PATCH 06/10] cmdline: fix highest bit port list parsing

2025-06-23 Thread David Marchand
On Fri, Jun 20, 2025 at 11:22 AM Bruce Richardson
 wrote:
>
> On Thu, Jun 19, 2025 at 09:10:32AM +0200, David Marchand wrote:
> > pl->map is a uint32_t.
> >
> > Caught by UBSan:
> >
> > ../lib/cmdline/cmdline_parse_portlist.c:27:17: runtime error:
> >   left shift of 1 by 31 places cannot be represented in type 'int'
> > SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
> >   ../lib/cmdline/cmdline_parse_portlist.c:27:17 in
> >
> > Fixes: af75078fece3 ("first public release")
> > Cc: sta...@dpdk.org
> >
> > Signed-off-by: David Marchand 
> > ---
> >  lib/cmdline/cmdline_parse_portlist.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/cmdline/cmdline_parse_portlist.c 
> > b/lib/cmdline/cmdline_parse_portlist.c
> > index 0c07cc02b5..3ef427d32a 100644
> > --- a/lib/cmdline/cmdline_parse_portlist.c
> > +++ b/lib/cmdline/cmdline_parse_portlist.c
> > @@ -11,7 +11,9 @@
> >  #include 
> >
> >  #include 
> > +#include 
> >  #include 
> > +
> >  #include "cmdline_parse.h"
> >  #include "cmdline_parse_portlist.h"
> >
> > @@ -27,7 +29,7 @@ static void
> >  parse_set_list(cmdline_portlist_t *pl, size_t low, size_t high)
> >  {
> >   do {
> > - pl->map |= (1 << low++);
> > + pl->map |= RTE_BIT32(low++);
> >   } while (low <= high);
> >  }
> >
> While this is correct, the use of "++" in a call to a macro sets off some
> alarm bells for me!
> Can we put the "++" in the while instead, as "++low"?

It would be safer yes.


-- 
David Marchand



Re: [PATCH v7 0/4] Add TxPP Support for E830

2025-06-23 Thread Bruce Richardson
On Tue, Jun 17, 2025 at 10:36:10PM +, Soumyadeep Hore wrote:
> Added TxPP support for E830 adapters.
> ---
> v2:
> - Fixed Compilation warnings
> ---
> v3:
> - Fixed further Compilation warnings (uinitialised one)
> ---
> v4:
> - Addressed Bruce's comments
> ---
> v5:
> - Addressed Bruce's and Ciara's comments
> ---
> v6:
> - Addressed Bruce's comments
> - Fixed compilation warnings
> ---
> v7:
> - Addressed Bruce's comments
> - Fixed Windows Compilation Warnings
> ---
> Paul Greenwalt (1):
>   net/ice: update E830 Tx Time Queue Context Structure
> 
> Soumyadeep Hore (3):
>   net/ice: add read clock feature
>   net/intel: add TxPP Support for E830
>   doc: announce TxPP support for E830 adapters
> 

Series-acked-by: Bruce Richardson 

Patchset applied to dpdk-next-net intel. I've adjusted patch 3 a little on
apply:
* adding a short release note entry
* removing some of the line splits so that error messages don't break
  across lines, and so that code lines don't split unnecessarily.

Please double check the patches on next-net-intel to ensure all is still ok
after these tweaks.

Thanks,
/Bruce


[PATCH 2/2] net/mlx5: use consecutive memory for all Tx queues

2025-06-23 Thread Bing Zhao
High cache miss rate may impact the software performance
significantly. Usually, the cache misses are caused by the
conflict and then some eviction may happen.

Now in the mlx5 PMD, the Tx queues are created separately, that
means the memory footprints may differ due to the different
configurations. In some case, the cache miss rate will be higher
than other cases and cause a performance drop in the software. And
it will be very hard to make the traffic generating rate stable
enough.

In practice, accessing linear and consecutive memory addresses will
reduce the conflicts significantly. This will make the Tx performance
more stable.

Signed-off-by: Bing Zhao 
---
 drivers/common/mlx5/mlx5_common.h  |  2 +
 drivers/common/mlx5/mlx5_common_devx.c | 77 +-
 drivers/common/mlx5/mlx5_common_devx.h |  2 +-
 drivers/common/mlx5/mlx5_devx_cmds.h   |  5 ++
 drivers/net/mlx5/hws/mlx5dr_internal.h |  1 -
 drivers/net/mlx5/mlx5.h|  8 ++-
 drivers/net/mlx5/mlx5_devx.c   | 35 ++--
 drivers/net/mlx5/mlx5_flow_aso.c   |  2 +-
 drivers/net/mlx5/mlx5_trigger.c| 56 +++
 drivers/net/mlx5/mlx5_tx.h |  2 +
 drivers/net/mlx5/mlx5_txpp.c   |  2 +-
 drivers/net/mlx5/mlx5_txq.c| 18 +-
 12 files changed, 172 insertions(+), 38 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_common.h 
b/drivers/common/mlx5/mlx5_common.h
index bea1382911..b952300cb4 100644
--- a/drivers/common/mlx5/mlx5_common.h
+++ b/drivers/common/mlx5/mlx5_common.h
@@ -46,6 +46,8 @@
!!(((bf)[((b) / (sizeof((bf)[0]) * CHAR_BIT))] & \
((size_t)1 << ((b) % (sizeof((bf)[0]) * CHAR_BIT)
 
+#define MLX5_ROUNDUP(x, y) x) + ((y) - 1)) / (y)) * (y))
+
 /*
  * Helper macros to work around __VA_ARGS__ limitations in a C99 compliant
  * manner.
diff --git a/drivers/common/mlx5/mlx5_common_devx.c 
b/drivers/common/mlx5/mlx5_common_devx.c
index cd1292b92b..cfd495c304 100644
--- a/drivers/common/mlx5/mlx5_common_devx.c
+++ b/drivers/common/mlx5/mlx5_common_devx.c
@@ -167,10 +167,12 @@ mlx5_devx_cq_create(void *ctx, struct mlx5_devx_cq 
*cq_obj, uint16_t log_desc_n,
  */
 RTE_EXPORT_INTERNAL_SYMBOL(mlx5_devx_sq_destroy)
 void
-mlx5_devx_sq_destroy(struct mlx5_devx_sq *sq)
+mlx5_devx_sq_destroy(struct mlx5_devx_sq *sq, bool consec_mem)
 {
if (sq->sq)
claim_zero(mlx5_devx_cmd_destroy(sq->sq));
+   if (consec_mem)
+   return;
if (sq->umem_obj)
claim_zero(mlx5_os_umem_dereg(sq->umem_obj));
if (sq->umem_buf)
@@ -220,38 +222,54 @@ mlx5_devx_sq_create(void *ctx, struct mlx5_devx_sq 
*sq_obj, uint16_t log_wqbb_n,
uint32_t umem_size, umem_dbrec;
uint32_t num_of_wqbbs = RTE_BIT32(log_wqbb_n);
int ret;
+   uint32_t wq_umem_id;
+   uint32_t wq_umem_offset;
 
if (alignment == (size_t)-1) {
DRV_LOG(ERR, "Failed to get WQE buf alignment.");
rte_errno = ENOMEM;
return -rte_errno;
}
-   /* Allocate memory buffer for WQEs and doorbell record. */
umem_size = MLX5_WQE_SIZE * num_of_wqbbs;
umem_dbrec = RTE_ALIGN(umem_size, MLX5_DBR_SIZE);
-   umem_size += MLX5_DBR_SIZE;
-   umem_buf = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO, umem_size,
-  alignment, socket);
-   if (!umem_buf) {
-   DRV_LOG(ERR, "Failed to allocate memory for SQ.");
-   rte_errno = ENOMEM;
-   return -rte_errno;
-   }
-   /* Register allocated buffer in user space with DevX. */
-   umem_obj = mlx5_os_umem_reg(ctx, (void *)(uintptr_t)umem_buf, umem_size,
-   IBV_ACCESS_LOCAL_WRITE);
-   if (!umem_obj) {
-   DRV_LOG(ERR, "Failed to register umem for SQ.");
-   rte_errno = errno;
-   goto error;
+   if (!attr->acc_mem) {
+   umem_size += MLX5_DBR_SIZE;
+   /* Allocate memory buffer for WQEs and doorbell record. */
+   umem_buf = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO, umem_size,
+  alignment, socket);
+   if (!umem_buf) {
+   DRV_LOG(ERR, "Failed to allocate memory for SQ.");
+   rte_errno = ENOMEM;
+   return -rte_errno;
+   }
+   /* Register allocated buffer in user space with DevX. */
+   umem_obj = mlx5_os_umem_reg(ctx, (void *)(uintptr_t)umem_buf, 
umem_size,
+   IBV_ACCESS_LOCAL_WRITE);
+   if (!umem_obj) {
+   DRV_LOG(ERR, "Failed to register umem for SQ.");
+   rte_errno = errno;
+   goto error;
+   }
+   wq_umem_id = mlx5_os_get_umem_id(umem_obj);
+   wq_umem_offset = 0;
+   } else {
+   

[PATCH 1/2] net/mlx5: add new devarg for Tx queue consecutive memory

2025-06-23 Thread Bing Zhao
With this commit, a new device argument is introduced to control
the memory allocation for Tx queues.

By default, 'txq_consec_mem' is 1 to let all the Tx queues use a
consecutive memory area and a single MR.

Signed-off-by: Bing Zhao 
---
 drivers/net/mlx5/mlx5.c | 14 ++
 drivers/net/mlx5/mlx5.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index b4bd43aae2..f5beebd2fd 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -185,6 +185,9 @@
 /* Device parameter to control representor matching in ingress/egress flows 
with HWS. */
 #define MLX5_REPR_MATCHING_EN "repr_matching_en"
 
+/* Using consecutive memory address and single MR for all Tx queues. */
+#define MLX5_TXQ_CONSEC_MEM "txq_consec_mem"
+
 /* Shared memory between primary and secondary processes. */
 struct mlx5_shared_data *mlx5_shared_data;
 
@@ -1447,6 +1450,8 @@ mlx5_dev_args_check_handler(const char *key, const char 
*val, void *opaque)
config->cnt_svc.cycle_time = tmp;
} else if (strcmp(MLX5_REPR_MATCHING_EN, key) == 0) {
config->repr_matching = !!tmp;
+   } else if (strcmp(MLX5_TXQ_CONSEC_MEM, key) == 0) {
+   config->txq_consec_mem = !!tmp;
}
return 0;
 }
@@ -1486,6 +1491,7 @@ mlx5_shared_dev_ctx_args_config(struct 
mlx5_dev_ctx_shared *sh,
MLX5_HWS_CNT_SERVICE_CORE,
MLX5_HWS_CNT_CYCLE_TIME,
MLX5_REPR_MATCHING_EN,
+   MLX5_TXQ_CONSEC_MEM,
NULL,
};
int ret = 0;
@@ -1501,6 +1507,7 @@ mlx5_shared_dev_ctx_args_config(struct 
mlx5_dev_ctx_shared *sh,
config->cnt_svc.cycle_time = MLX5_CNT_SVC_CYCLE_TIME_DEFAULT;
config->cnt_svc.service_core = rte_get_main_lcore();
config->repr_matching = 1;
+   config->txq_consec_mem = 1;
if (mkvlist != NULL) {
/* Process parameters. */
ret = mlx5_kvargs_process(mkvlist, params,
@@ -1584,6 +1591,7 @@ mlx5_shared_dev_ctx_args_config(struct 
mlx5_dev_ctx_shared *sh,
config->allow_duplicate_pattern);
DRV_LOG(DEBUG, "\"fdb_def_rule_en\" is %u.", config->fdb_def_rule);
DRV_LOG(DEBUG, "\"repr_matching_en\" is %u.", config->repr_matching);
+   DRV_LOG(DEBUG, "\"txq_consec_mem\" is %u.", config->txq_consec_mem);
return 0;
 }
 
@@ -3150,6 +3158,12 @@ mlx5_probe_again_args_validate(struct mlx5_common_device 
*cdev,
sh->ibdev_name);
goto error;
}
+   if (sh->config.txq_consec_mem ^ config->txq_consec_mem) {
+   DRV_LOG(ERR, "\"txq_consec_mem\" "
+   "configuration mismatch for shared %s context.",
+   sh->ibdev_name);
+   goto error;
+   }
mlx5_free(config);
return 0;
 error:
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 5695d0f54a..4e0287cbc0 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -393,6 +393,7 @@ struct mlx5_sh_config {
/* Allow/Prevent the duplicate rules pattern. */
uint32_t fdb_def_rule:1; /* Create FDB default jump rule */
uint32_t repr_matching:1; /* Enable implicit vport matching in HWS FDB. 
*/
+   uint32_t txq_consec_mem:1; /**/
 };
 
 /* Structure for VF VLAN workaround. */
-- 
2.34.1



Re: [PATCH v2 1/2] net/cnxk: fix lock for security session ops

2025-06-23 Thread zhoumin

Recheck-request: rebase=next-net-mrvl-for-main, loongarch-compilation



Re: [PATCH v2 1/2] lib/graph: lib/graph: fix memset with NULL

2025-06-23 Thread David Marchand
On Tue, Jun 17, 2025 at 5:14 PM Marat Khalili  wrote:
>
> This was flagged by undefined behaviour sanitizer: memset should not be
> called with NULL first argument. (memset requires first argument to be
> pointer to a memory object, so passing NULL may result in an undefined
> behaviour including among other things optimizer potentially removing
> code paths depending on stat->xstat_count being NULL.)
>
> Sanitizer message:
>
> lib/graph/graph_stats.c:473:2: runtime error: null pointer passed as
> argument 1, which is declared to never be null
>
> To fix the issue add a check that stat->xstat_count is not NULL before
> the call.
>
> Fixes: 070db97e017 ("graph: support node xstats")
>
> Signed-off-by: Marat Khalili 
> ---
>
> v2: Following the suggestions from Jerin Jacob changed the Subject and
> added Fixes line.
>
>  lib/graph/graph_stats.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c
> index eac73cbf71..57cd72e7cc 100644
> --- a/lib/graph/graph_stats.c
> +++ b/lib/graph/graph_stats.c
> @@ -470,7 +470,9 @@ cluster_node_arregate_stats(struct cluster_node *cluster, 
> bool dispatch)
> uint64_t *xstat;
> uint8_t i;
>
> -   memset(stat->xstat_count, 0, sizeof(uint64_t) * stat->xstat_cntrs);
> +   if (stat->xstat_count != NULL)

I would check against stat->xstat_cntrs since the array is allocated
based on this count.
This will be more consistent with the loop on this same counter later
in this function.


> +   memset(stat->xstat_count, 0,
> +   sizeof(uint64_t) * stat->xstat_cntrs);

No need for going to a new line.


> for (count = 0; count < cluster->nb_nodes; count++) {
> node = cluster->nodes[count];
>

Thanks for the fix.


-- 
David Marchand



Re: [PATCH v2 2/2] lib/graph: default-align rte_graph_cluster_stats

2025-06-23 Thread David Marchand
On Mon, Jun 23, 2025 at 10:53 AM Marat Khalili  wrote:
>
> Gently reminding about this issue, I still hope to see graph tests passing 
> under sanitizer.

Thanks for trying to fix this, but without coverage on the topic, it
is likely we will have new errors in the future.

Now that the trace framework has been fixed (856aef55de95 ("trace: fix
undefined behavior in register")), enabling UBSan in the CI has become
easier.
Could you spend some time on reviewing patches on the topic?
Like for example: https://patchwork.dpdk.org/project/dpdk/list/?series=35509


>
> We cannot just remove __rte_cache_aligned from rte_graph_cluster_stats 
> without removing it from rte_graph_cluster_node_stats because of how C works. 
> But we can perhaps use rte_malloc to align our allocations in a way that 
> matches the declaration. Would it be an ok solution?

rte_malloc is not required.
I have a fix in an branch of mine, that makes use of aligned_alloc
(which is C11), you need to manually copy data in stats_mem_populate.


-- 
David Marchand



Re: [PATCH v2 05/10] cmdline: fix port list parsing

2025-06-23 Thread Bruce Richardson
On Mon, Jun 23, 2025 at 03:52:35PM +0200, David Marchand wrote:
> Doing arithmetics with the NULL pointer is undefined.
> 
> Caught by UBSan:
> 
> ../lib/cmdline/cmdline_parse_portlist.c:40:19: runtime error:
>   applying non-zero offset 1 to null pointer
> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
>   ../lib/cmdline/cmdline_parse_portlist.c:40:19 in
> 
> Fixes: af75078fece3 ("first public release")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: David Marchand 
> ---
> Changes since v1:
> - moved some variable as suggested by Bruce,
> 
Acked-by: Bruce Richardson 


Re: [PATCH v3 0/3] enable drivers to be compiled with MSVC

2025-06-23 Thread David Marchand
On Thu, Jun 12, 2025 at 4:17 PM Andre Muezerie
 wrote:
>
> This patchset solves the last issues preventing drivers from being
> compiled with MSVC (array range initialization) and enables the
> drivers to be built with it.
>
> Array range initialization is non-standard and is not provided by
> all compilers. MSVC does not implement it and ends up emitting
> errors like the one below:
>
> drivers/net/r8169/r8169_phy.c(380):
> error C2143: syntax error: missing ':' before '...'
> case CFG_METHOD_48 ... CFG_METHOD_57:
>
> The fix is to explicitly initialize each element in the range.
>
> v3:
> - Add a patch to enable drivers to be compiled with MSVC.
>
> v2:
> - Rebase on top of latest main.
>
> Andre Muezerie (3):
>   app/test: remove use of non-standard array range initialization
>   drivers/net: remove use of non-standard array range initialization
>   drivers: enable drivers to be compiled with MSVC
>
>  app/test/test_cryptodev_zuc_test_vectors.h | 156 ++-
>  drivers/meson.build|   4 -
>  drivers/net/octeon_ep/otx_ep_mbox.c|  24 +-
>  drivers/net/r8169/base/rtl8125a_mcu.c  |   8 +-
>  drivers/net/r8169/base/rtl8126a.c  |   5 +-
>  drivers/net/r8169/r8169_ethdev.c   |  34 +-
>  drivers/net/r8169/r8169_hw.c   | 447 ++---
>  drivers/net/r8169/r8169_phy.c  | 163 +++-
>  drivers/net/r8169/r8169_rxtx.c |  25 +-
>  9 files changed, 770 insertions(+), 96 deletions(-)

Recheck-request: rebase=main, iol-compile-amd64-testing, iol-unit-amd64-testing

-- 
David Marchand



Re: [PATCH v5 1/3] eal: deprecate old coremask-based EAL parameters

2025-06-23 Thread David Marchand
On Tue, May 27, 2025 at 5:29 PM Bruce Richardson
 wrote:
>
> As the number of cores/cpus on platforms has increased over the years,
> the use of coremasks rather than core-lists for identifying DPDK cores
> has become more and more unwieldy. At this point, let's deprecate the
> coremask-based EAL parameters for future removal, and point users to the
> core-list based versions instead.
>
> Signed-off-by: Bruce Richardson 
> ---
>  doc/guides/eventdevs/dlb2.rst|  6 +++---
>  doc/guides/faq/faq.rst   |  8 +++-
>  doc/guides/linux_gsg/build_sample_apps.rst   |  7 +++
>  doc/guides/linux_gsg/eal_args.include.rst|  8 ++--
>  doc/guides/prog_guide/meson_ut.rst   |  2 +-
>  doc/guides/prog_guide/multi_proc_support.rst |  2 +-
>  doc/guides/prog_guide/service_cores.rst  |  8 
>  doc/guides/rel_notes/deprecation.rst | 10 ++
>  doc/guides/sample_app_ug/ip_frag.rst |  7 +--
>  doc/guides/sample_app_ug/ip_reassembly.rst   |  7 +--
>  doc/guides/sample_app_ug/multi_process.rst   | 14 +-
>  doc/guides/sample_app_ug/qos_scheduler.rst   |  2 +-
>  doc/guides/sample_app_ug/test_pipeline.rst   |  2 +-
>  doc/guides/tools/testbbdev.rst   |  2 +-
>  lib/eal/common/eal_common_options.c  |  6 ++
>  15 files changed, 43 insertions(+), 48 deletions(-)

This patch will need some rebase.

I see you fixed a few docs, but there are quite some misses in
copy/pasted blocks:

doc/guides/bbdevs/acc100.rst:  ./test-bbdev.py -e="-c 0xff0
-a${VF_PCI_ADDR}" -c validation -n 64 -b 32 -l 1 -v
./ldpc_dec_default.data
doc/guides/bbdevs/fpga_5gnr_fec.rst:  ./test-bbdev.py -e="-c 0xff0
-a${VF_PCI_ADDR}" -c validation -n 64 -b 32 -l 1 -v
./ldpc_dec_default.data
doc/guides/bbdevs/fpga_5gnr_fec.rst:  ./test-bbdev.py -e="-c 0xff0
-a${VF_PCI_ADDR}" -c validation -n 64 -b 32 -l 1 -v
./ldpc_dec_default.data
doc/guides/bbdevs/fpga_lte_fec.rst:  ./test-bbdev.py -e="-c 0xff0
-a${VF_PCI_ADDR}" -c validation -n 64 -b 32 -l 1 -v
./turbo_dec_default.data
doc/guides/bbdevs/vrb1.rst:   test-bbdev.py -e="-c 0xff0
-a${VF_PCI_ADDR}" -c validation -n 64 -b 64 -l 1 -v
./ldpc_dec_default.data
doc/guides/bbdevs/vrb2.rst:   test-bbdev.py -e="-c 0xff0
-a${VF_PCI_ADDR}" -c validation -n 64 -b 64 -l 1 -v
./ldpc_dec_default.data

doc/guides/cryptodevs/mlx5.rst:  dpdk-test -c 1 -n 1 -w
,class=crypto,wcs_file=
doc/guides/cryptodevs/mlx5.rst:  dpdk-test -c 1 -n 1 -w ,class=crypto
doc/guides/cryptodevs/octeontx.rst:./build/ipsec-secgw
--log-level=8 -c 0xff -- -P -p 0x3 -u 0x2 --config

doc/guides/howto/packet_capture_framework.rst: sudo
/app/dpdk-testpmd -c 0xf0 -n 4 -- -i
--port-topology=chained

doc/guides/mempool/cnxk.rst: echo "mempool_autotest" |
/app/test/dpdk-test -c 0xf0
--mbuf-pool-ops-name="cn10k_mempool_ops"
doc/guides/mempool/octeontx.rst:.//app/test/dpdk-test
-c 0xf --base-virtaddr=0x1000 \

doc/guides/nics/cnxk.rst:  .//app/dpdk-testpmd -c 0xc
-a 0002:02:00.0 -- --portmask=0x1 --nb-cores=1 --port-topology=loop
--rxq=1 --txq=1
doc/guides/nics/cnxk.rst:   ./dpdk-testpmd -c 3 -w
0002:02:00.0,switch_header=exdsa -- -i \
doc/guides/nics/cpfl.rst:  dpdk-testpmd -c 0x3 -n 4 -a
:af:00.6,vport=[0-1],flow_parser="refpkg.json" -- -i
doc/guides/nics/dpaa.rst:  .//app/dpdk-testpmd -c 0xff -n 1 \
doc/guides/nics/dpaa2.rst:  ./dpdk-testpmd -c 0xff -n 1 -- -i
--portmask=0x3 --nb-cores=1 --no-flush-rx
doc/guides/nics/dpaa2.rst:  ./dpdk-testpmd  -c 0xf -n 1 -- -i
--portmask 0x3 --nb-cores=1 --txq=4 --rxq=4
doc/guides/nics/fail_safe.rst:  .//app/dpdk-testpmd -c
0xff -n 4 \
doc/guides/nics/fail_safe.rst:  .//app/dpdk-testpmd -c
0xff -n 4 \
doc/guides/nics/fail_safe.rst:  .//app/dpdk-testpmd -c
0xff -n 4 -a ff:ff.f \
doc/guides/nics/fail_safe.rst:  .//app/dpdk-testpmd -c
0xff -n 4 \
doc/guides/nics/ice.rst:dpdk-testpmd -c 0xff -- -i
doc/guides/nics/ice.rst:dpdk-testpmd -c 0xff -- -i
doc/guides/nics/ice.rst:   examples/dpdk-ptpclient -c f -n 3 -a
:ec:00.1 --force-max-simd-bitwidth=64 -- -T 1 -p 0x1 -c 1
doc/guides/nics/mvneta.rst:-c 3 -- -i --p 3 -a
doc/guides/nics/mvneta.rst:   ./dpdk-testpmd
--vdev=net_mvneta,iface=eth0,iface=eth1 -c 3 -- \
doc/guides/nics/mvneta.rst:   ./dpdk-l2fwd
--vdev=net_mvneta,iface=eth0,iface=eth1 -c 3 -- -T 1 -p 3
doc/guides/nics/mvpp2.rst:   ./dpdk-testpmd
--vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 7 -- \
doc/guides/nics/mvpp2.rst: -c 7 -- -i -a --disable-hw-vlan-strip
--rxq=3 --txq=3
doc/guides/nics/mvpp2.rst:   ./dpdk-testpmd
--vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 3 -- -i --p 3 -a
--disable-hw-vlan-strip
doc/guides/nics/mvpp2.rst:  ./dpdk-testpmd
--vdev=eth_mvpp2,iface=eth0,iface=eth2 -c 6 -- -i -p 3 -a --txd 1024
--rxd 1024
doc/guides/nics/mvpp2.rst:  ./dpdk-testpmd
--vdev=net_mrvl,iface=eth0,iface=eth2,cfg=./qos_config -c 7 -- \
doc/guides/nics/octeontx.rst:  .//app/dpdk-testpmd -c 700 \
doc/gu

Re: [PATCH v5 0/3] lcore options cleanup

2025-06-23 Thread David Marchand
On Sun, Jun 8, 2025 at 11:12 PM Thomas Monjalon  wrote:
>
> 27/05/2025 17:29, Bruce Richardson:
> > This patchset performs some basic cleanup of EAL lcore arguments before
> > any more serious work is done on them (as discussed in previous patchset
> > revisions).
> >
> > * mark the old coremask parameter (-c) and service core mask (-s) as
> >   deprecated, so they can be dropped in future. Everything should now be
> >   done using core lists where possible.
> > * consolidate the, previously separate but similar, "-l" and "--lcores"
> >   flags into just short and long versions of the same thing. This does
> >   not affect the "--lcores" flag at all, but expands the scope of what
> >   was possible with "-l".
> > * Add documentation of examples of use of the -l/--lcores parameter
> >
> > V5: adjust the examples in patch 3, to only use quotes where necessary
> >   and explain in a note why they are sometimes used in the examples.
> >
> > Bruce Richardson (3):
> >   eal: deprecate old coremask-based EAL parameters
> >   eal: merge corelist and core mapping options
> >   doc: provide examples of using lcores EAL parameter
>
> This first step looks reasonnable,
> but we need more acks for the deprecation.
>
> Applied without the first patch deprecating the famous -c option,
> pending for a later stage in this release cycle.

Sorry, I wanted to review this series sooner.
It looks good to me, even though it is already applied.

The deprecation notice lgtm, I sent some comments on it.


-- 
David Marchand



Re: [PATCH v5 1/3] eal: deprecate old coremask-based EAL parameters

2025-06-23 Thread David Marchand
On Mon, Jun 23, 2025 at 6:13 PM Bruce Richardson
 wrote:
> > This patch will need some rebase.
> >
> > I see you fixed a few docs, but there are quite some misses in
> > copy/pasted blocks:
> >
> I'll take a look and respin this.
>
> I'm think of separating it into two patches: first patch with the doc
> updates to remove use of -c flag. This should happen independent of the
> deprecation, I think, and second patch just the deprecation notice. Does
> that sound reasonable?

Yes, we can already cleanup the docs (advertising lists instead of
mask), and then have the deprecation notice.


-- 
David Marchand



[PATCH v2 3/3] net/mlx5: use consecutive memory for all Tx queues

2025-06-23 Thread Bing Zhao
High cache miss rate may impact the software performance
significantly. Usually, the cache misses are caused by the
conflict and then some eviction may happen.

Now in the mlx5 PMD, the Tx queues are created separately, that
means the memory footprints may differ due to the different
configurations. In some case, the cache miss rate will be higher
than other cases and cause a performance drop in the software. And
it will be very hard to make the traffic generating rate stable
enough.

In practice, accessing linear and consecutive memory addresses will
reduce the conflicts significantly. This will make the Tx performance
more stable.

Signed-off-by: Bing Zhao 
---
 drivers/common/mlx5/mlx5_common.h  |  2 +
 drivers/common/mlx5/mlx5_common_devx.c | 77 +-
 drivers/common/mlx5/mlx5_common_devx.h |  2 +-
 drivers/common/mlx5/mlx5_devx_cmds.h   |  5 ++
 drivers/net/mlx5/hws/mlx5dr_internal.h |  1 -
 drivers/net/mlx5/mlx5.h|  8 ++-
 drivers/net/mlx5/mlx5_devx.c   | 34 ++--
 drivers/net/mlx5/mlx5_flow_aso.c   |  2 +-
 drivers/net/mlx5/mlx5_trigger.c| 56 +++
 drivers/net/mlx5/mlx5_tx.h |  2 +
 drivers/net/mlx5/mlx5_txpp.c   |  2 +-
 drivers/net/mlx5/mlx5_txq.c| 18 +-
 12 files changed, 171 insertions(+), 38 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_common.h 
b/drivers/common/mlx5/mlx5_common.h
index bea1382911..b952300cb4 100644
--- a/drivers/common/mlx5/mlx5_common.h
+++ b/drivers/common/mlx5/mlx5_common.h
@@ -46,6 +46,8 @@
!!(((bf)[((b) / (sizeof((bf)[0]) * CHAR_BIT))] & \
((size_t)1 << ((b) % (sizeof((bf)[0]) * CHAR_BIT)
 
+#define MLX5_ROUNDUP(x, y) x) + ((y) - 1)) / (y)) * (y))
+
 /*
  * Helper macros to work around __VA_ARGS__ limitations in a C99 compliant
  * manner.
diff --git a/drivers/common/mlx5/mlx5_common_devx.c 
b/drivers/common/mlx5/mlx5_common_devx.c
index cd1292b92b..cfd495c304 100644
--- a/drivers/common/mlx5/mlx5_common_devx.c
+++ b/drivers/common/mlx5/mlx5_common_devx.c
@@ -167,10 +167,12 @@ mlx5_devx_cq_create(void *ctx, struct mlx5_devx_cq 
*cq_obj, uint16_t log_desc_n,
  */
 RTE_EXPORT_INTERNAL_SYMBOL(mlx5_devx_sq_destroy)
 void
-mlx5_devx_sq_destroy(struct mlx5_devx_sq *sq)
+mlx5_devx_sq_destroy(struct mlx5_devx_sq *sq, bool consec_mem)
 {
if (sq->sq)
claim_zero(mlx5_devx_cmd_destroy(sq->sq));
+   if (consec_mem)
+   return;
if (sq->umem_obj)
claim_zero(mlx5_os_umem_dereg(sq->umem_obj));
if (sq->umem_buf)
@@ -220,38 +222,54 @@ mlx5_devx_sq_create(void *ctx, struct mlx5_devx_sq 
*sq_obj, uint16_t log_wqbb_n,
uint32_t umem_size, umem_dbrec;
uint32_t num_of_wqbbs = RTE_BIT32(log_wqbb_n);
int ret;
+   uint32_t wq_umem_id;
+   uint32_t wq_umem_offset;
 
if (alignment == (size_t)-1) {
DRV_LOG(ERR, "Failed to get WQE buf alignment.");
rte_errno = ENOMEM;
return -rte_errno;
}
-   /* Allocate memory buffer for WQEs and doorbell record. */
umem_size = MLX5_WQE_SIZE * num_of_wqbbs;
umem_dbrec = RTE_ALIGN(umem_size, MLX5_DBR_SIZE);
-   umem_size += MLX5_DBR_SIZE;
-   umem_buf = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO, umem_size,
-  alignment, socket);
-   if (!umem_buf) {
-   DRV_LOG(ERR, "Failed to allocate memory for SQ.");
-   rte_errno = ENOMEM;
-   return -rte_errno;
-   }
-   /* Register allocated buffer in user space with DevX. */
-   umem_obj = mlx5_os_umem_reg(ctx, (void *)(uintptr_t)umem_buf, umem_size,
-   IBV_ACCESS_LOCAL_WRITE);
-   if (!umem_obj) {
-   DRV_LOG(ERR, "Failed to register umem for SQ.");
-   rte_errno = errno;
-   goto error;
+   if (!attr->acc_mem) {
+   umem_size += MLX5_DBR_SIZE;
+   /* Allocate memory buffer for WQEs and doorbell record. */
+   umem_buf = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO, umem_size,
+  alignment, socket);
+   if (!umem_buf) {
+   DRV_LOG(ERR, "Failed to allocate memory for SQ.");
+   rte_errno = ENOMEM;
+   return -rte_errno;
+   }
+   /* Register allocated buffer in user space with DevX. */
+   umem_obj = mlx5_os_umem_reg(ctx, (void *)(uintptr_t)umem_buf, 
umem_size,
+   IBV_ACCESS_LOCAL_WRITE);
+   if (!umem_obj) {
+   DRV_LOG(ERR, "Failed to register umem for SQ.");
+   rte_errno = errno;
+   goto error;
+   }
+   wq_umem_id = mlx5_os_get_umem_id(umem_obj);
+   wq_umem_offset = 0;
+   } else {
+   

[PATCH v2 2/3] net/mlx5: add new devarg for Tx queue consecutive memory

2025-06-23 Thread Bing Zhao
With this commit, a new device argument is introduced to control
the memory allocation for Tx queues.

By default, 'txq_consec_mem' is 1 to let all the Tx queues use a
consecutive memory area and a single MR.

Signed-off-by: Bing Zhao 
---
 drivers/net/mlx5/mlx5.c | 14 ++
 drivers/net/mlx5/mlx5.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index b4bd43aae2..f5beebd2fd 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -185,6 +185,9 @@
 /* Device parameter to control representor matching in ingress/egress flows 
with HWS. */
 #define MLX5_REPR_MATCHING_EN "repr_matching_en"
 
+/* Using consecutive memory address and single MR for all Tx queues. */
+#define MLX5_TXQ_CONSEC_MEM "txq_consec_mem"
+
 /* Shared memory between primary and secondary processes. */
 struct mlx5_shared_data *mlx5_shared_data;
 
@@ -1447,6 +1450,8 @@ mlx5_dev_args_check_handler(const char *key, const char 
*val, void *opaque)
config->cnt_svc.cycle_time = tmp;
} else if (strcmp(MLX5_REPR_MATCHING_EN, key) == 0) {
config->repr_matching = !!tmp;
+   } else if (strcmp(MLX5_TXQ_CONSEC_MEM, key) == 0) {
+   config->txq_consec_mem = !!tmp;
}
return 0;
 }
@@ -1486,6 +1491,7 @@ mlx5_shared_dev_ctx_args_config(struct 
mlx5_dev_ctx_shared *sh,
MLX5_HWS_CNT_SERVICE_CORE,
MLX5_HWS_CNT_CYCLE_TIME,
MLX5_REPR_MATCHING_EN,
+   MLX5_TXQ_CONSEC_MEM,
NULL,
};
int ret = 0;
@@ -1501,6 +1507,7 @@ mlx5_shared_dev_ctx_args_config(struct 
mlx5_dev_ctx_shared *sh,
config->cnt_svc.cycle_time = MLX5_CNT_SVC_CYCLE_TIME_DEFAULT;
config->cnt_svc.service_core = rte_get_main_lcore();
config->repr_matching = 1;
+   config->txq_consec_mem = 1;
if (mkvlist != NULL) {
/* Process parameters. */
ret = mlx5_kvargs_process(mkvlist, params,
@@ -1584,6 +1591,7 @@ mlx5_shared_dev_ctx_args_config(struct 
mlx5_dev_ctx_shared *sh,
config->allow_duplicate_pattern);
DRV_LOG(DEBUG, "\"fdb_def_rule_en\" is %u.", config->fdb_def_rule);
DRV_LOG(DEBUG, "\"repr_matching_en\" is %u.", config->repr_matching);
+   DRV_LOG(DEBUG, "\"txq_consec_mem\" is %u.", config->txq_consec_mem);
return 0;
 }
 
@@ -3150,6 +3158,12 @@ mlx5_probe_again_args_validate(struct mlx5_common_device 
*cdev,
sh->ibdev_name);
goto error;
}
+   if (sh->config.txq_consec_mem ^ config->txq_consec_mem) {
+   DRV_LOG(ERR, "\"txq_consec_mem\" "
+   "configuration mismatch for shared %s context.",
+   sh->ibdev_name);
+   goto error;
+   }
mlx5_free(config);
return 0;
 error:
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 5695d0f54a..4e0287cbc0 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -393,6 +393,7 @@ struct mlx5_sh_config {
/* Allow/Prevent the duplicate rules pattern. */
uint32_t fdb_def_rule:1; /* Create FDB default jump rule */
uint32_t repr_matching:1; /* Enable implicit vport matching in HWS FDB. 
*/
+   uint32_t txq_consec_mem:1; /**/
 };
 
 /* Structure for VF VLAN workaround. */
-- 
2.34.1



[PATCH v2 1/3] net/mlx5: fix the WQE size calculation for Tx queue

2025-06-23 Thread Bing Zhao
The txq_calc_wqebb_cnt() should be aligned with the calculation in
the function mlx5_txq_devx_obj_new(). Or when the input descriptor
number is 512, the WQE size will be wrongly considered to be 30 when
no max_inline_data is set. The total number of WQE will be considered
as 256 and that is incorrect.

Fixes: 38b4b397a57d ("net/mlx5: add Tx configuration and setup")
Cc: viachesl...@mellanox.com

Signed-off-by: Bing Zhao 
---
 drivers/net/mlx5/mlx5_txq.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 5fee5bc4e8..2fdb472ab3 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -706,9 +706,15 @@ txq_calc_wqebb_cnt(struct mlx5_txq_ctrl *txq_ctrl)
 
wqe_size = MLX5_WQE_CSEG_SIZE +
   MLX5_WQE_ESEG_SIZE +
-  MLX5_WSEG_SIZE -
-  MLX5_ESEG_MIN_INLINE_SIZE +
-  txq_ctrl->max_inline_data;
+  MLX5_WSEG_SIZE;
+   wqe_size += txq_ctrl->txq.tso_en ?
+   RTE_ALIGN(txq_ctrl->max_tso_header, MLX5_WSEG_SIZE) : 0;
+   if (txq_ctrl->txq.inlen_send)
+   wqe_size = RTE_MAX(wqe_size, MLX5_WQE_CSEG_SIZE +
+MLX5_WQE_ESEG_SIZE +
+RTE_ALIGN(txq_ctrl->txq.inlen_send 
+
+  sizeof(uint32_t),
+  MLX5_WSEG_SIZE));
return rte_align32pow2(wqe_size * desc) / MLX5_WQE_SIZE;
 }
 
-- 
2.34.1



[PATCH v2 0/3] Use consecutive Tx queues' memory

2025-06-23 Thread Bing Zhao
This patchset will move all the mlx5 Tx queues memory to a
consecutive memory area. All the WQEBBs will be allocated based
on the offset of this memory area.

---
v2:
 1. add a new fix for legacy code of WQE calculation
 2. fix the style
---


Bing Zhao (3):
  net/mlx5: fix the WQE size calculation for Tx queue
  net/mlx5: add new devarg for Tx queue consecutive memory
  net/mlx5: use consecutive memory for all Tx queues

 drivers/common/mlx5/mlx5_common.h  |  2 +
 drivers/common/mlx5/mlx5_common_devx.c | 77 +-
 drivers/common/mlx5/mlx5_common_devx.h |  2 +-
 drivers/common/mlx5/mlx5_devx_cmds.h   |  5 ++
 drivers/net/mlx5/hws/mlx5dr_internal.h |  1 -
 drivers/net/mlx5/mlx5.c| 14 +
 drivers/net/mlx5/mlx5.h|  7 +++
 drivers/net/mlx5/mlx5_devx.c   | 34 ++--
 drivers/net/mlx5/mlx5_flow_aso.c   |  2 +-
 drivers/net/mlx5/mlx5_trigger.c| 56 +++
 drivers/net/mlx5/mlx5_tx.h |  2 +
 drivers/net/mlx5/mlx5_txpp.c   |  2 +-
 drivers/net/mlx5/mlx5_txq.c| 30 --
 13 files changed, 194 insertions(+), 40 deletions(-)

-- 
2.34.1



[PATCH v2] net/iavf: fix VLAN offload strip flag

2025-06-23 Thread Amiya Ranjan Mohakud
For i40e kernel drivers which support either vlan(v1) or vlan(v2)
VIRTCHNL OP,it will set strip on when setting filter on. But dpdk
side will not change strip flag. To be consistent with dpdk side,
explicitly disable strip again.

Bugzilla ID:1725
Cc: sta...@dpdk.org

v2:
- Fixed indentation in commit message

Signed-off-by: Amiya Ranjan Mohakud 
---
 drivers/net/intel/iavf/iavf_ethdev.c | 48 +---
 1 file changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/net/intel/iavf/iavf_ethdev.c 
b/drivers/net/intel/iavf/iavf_ethdev.c
index b3dacbef84..f93e7bf9ae 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -1378,13 +1378,38 @@ iavf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t 
index)
vf->mac_num--;
 }
 
+static int
+iavf_disable_vlan_strip_ex(struct rte_eth_dev *dev, int on)
+{
+   /* For i40e kernel drivers which supports both vlan(v1 & v2) VIRTCHNL 
OP,
+* it will set strip on when setting filter on but dpdk side will not
+* change strip flag. To be consistent with dpdk side, explicitly 
disable
+* strip again.
+*
+*/
+   struct iavf_adapter *adapter =
+   IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
+   struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
+   int err;
+
+   if (adapter->hw.mac.type == IAVF_MAC_XL710 ||
+   adapter->hw.mac.type == IAVF_MAC_VF ||
+   adapter->hw.mac.type == IAVF_MAC_X722_VF) {
+   if (on && !(dev_conf->rxmode.offloads & 
RTE_ETH_RX_OFFLOAD_VLAN_STRIP)) {
+   err = iavf_disable_vlan_strip(adapter);
+   if (err)
+   return -EIO;
+   }
+   }
+   return 0;
+}
+
 static int
 iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 {
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
-   struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
int err;
 
if (adapter->closed)
@@ -1394,7 +1419,8 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, 
uint16_t vlan_id, int on)
err = iavf_add_del_vlan_v2(adapter, vlan_id, on);
if (err)
return -EIO;
-   return 0;
+
+   return iavf_disable_vlan_strip_ex(dev, on);
}
 
if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
@@ -1404,23 +1430,7 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, 
uint16_t vlan_id, int on)
if (err)
return -EIO;
 
-   /* For i40e kernel driver which only supports vlan(v1) VIRTCHNL OP,
-* it will set strip on when setting filter on but dpdk side will not
-* change strip flag. To be consistent with dpdk side, disable strip
-* again.
-*
-* For i40e kernel driver which supports vlan v2, dpdk will invoke vlan 
v2
-* related function, so it won't go through here.
-*/
-   if (adapter->hw.mac.type == IAVF_MAC_XL710 ||
-   adapter->hw.mac.type == IAVF_MAC_X722_VF) {
-   if (on && !(dev_conf->rxmode.offloads & 
RTE_ETH_RX_OFFLOAD_VLAN_STRIP)) {
-   err = iavf_disable_vlan_strip(adapter);
-   if (err)
-   return -EIO;
-   }
-   }
-   return 0;
+   return iavf_disable_vlan_strip_ex(dev, on);
 }
 
 static void
-- 
2.39.5 (Apple Git-154)



Re: [PATCH v2] net/iavf: fix VLAN offload strip flag

2025-06-23 Thread Amiya Ranjan Mohakud
Hi Ciara
Thanks for your effort in reproducing the issue and confirming that the
patch works. However, I have taken care of the indentation in the commit
message and sent out a v2 patch. Appreciate your review comments.

*>>>Perhaps we should make the disabling unconditional or even better make
it depend on if the stripping was enabled although I'm not sure if there's
a way to check for this.*

I understand and agree with your point of disabling vlan_strip after
checking if the stripping is enabled. But like you mentioned, I'm also not
sure if there is any way to know that.

However, I think, the current check also does a good job by checking the
dev_conf parameter against RTE_ETH_RX_OFFLOAD_VLAN_STRIP and re-disables
the vlan_strip after every vlan_add operation.


Thanks
Amiya


On Mon, 23 Jun 2025 at 23:41, Amiya Ranjan Mohakud <
amiyaranjan.moha...@gmail.com> wrote:

> For i40e kernel drivers which support either vlan(v1) or vlan(v2)
> VIRTCHNL OP,it will set strip on when setting filter on. But dpdk
> side will not change strip flag. To be consistent with dpdk side,
> explicitly disable strip again.
>
> Bugzilla ID:1725
> Cc: sta...@dpdk.org
>
> v2:
> - Fixed indentation in commit message
>
> Signed-off-by: Amiya Ranjan Mohakud 
> ---
>  drivers/net/intel/iavf/iavf_ethdev.c | 48 +---
>  1 file changed, 29 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/intel/iavf/iavf_ethdev.c
> b/drivers/net/intel/iavf/iavf_ethdev.c
> index b3dacbef84..f93e7bf9ae 100644
> --- a/drivers/net/intel/iavf/iavf_ethdev.c
> +++ b/drivers/net/intel/iavf/iavf_ethdev.c
> @@ -1378,13 +1378,38 @@ iavf_dev_del_mac_addr(struct rte_eth_dev *dev,
> uint32_t index)
> vf->mac_num--;
>  }
>
> +static int
> +iavf_disable_vlan_strip_ex(struct rte_eth_dev *dev, int on)
> +{
> +   /* For i40e kernel drivers which supports both vlan(v1 & v2)
> VIRTCHNL OP,
> +* it will set strip on when setting filter on but dpdk side will
> not
> +* change strip flag. To be consistent with dpdk side, explicitly
> disable
> +* strip again.
> +*
> +*/
> +   struct iavf_adapter *adapter =
> +   IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> +   struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
> +   int err;
> +
> +   if (adapter->hw.mac.type == IAVF_MAC_XL710 ||
> +   adapter->hw.mac.type == IAVF_MAC_VF ||
> +   adapter->hw.mac.type == IAVF_MAC_X722_VF) {
> +   if (on && !(dev_conf->rxmode.offloads &
> RTE_ETH_RX_OFFLOAD_VLAN_STRIP)) {
> +   err = iavf_disable_vlan_strip(adapter);
> +   if (err)
> +   return -EIO;
> +   }
> +   }
> +   return 0;
> +}
> +
>  static int
>  iavf_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int
> on)
>  {
> struct iavf_adapter *adapter =
> IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
> -   struct rte_eth_conf *dev_conf = &dev->data->dev_conf;
> int err;
>
> if (adapter->closed)
> @@ -1394,7 +1419,8 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev,
> uint16_t vlan_id, int on)
> err = iavf_add_del_vlan_v2(adapter, vlan_id, on);
> if (err)
> return -EIO;
> -   return 0;
> +
> +   return iavf_disable_vlan_strip_ex(dev, on);
> }
>
> if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN))
> @@ -1404,23 +1430,7 @@ iavf_dev_vlan_filter_set(struct rte_eth_dev *dev,
> uint16_t vlan_id, int on)
> if (err)
> return -EIO;
>
> -   /* For i40e kernel driver which only supports vlan(v1) VIRTCHNL OP,
> -* it will set strip on when setting filter on but dpdk side will
> not
> -* change strip flag. To be consistent with dpdk side, disable
> strip
> -* again.
> -*
> -* For i40e kernel driver which supports vlan v2, dpdk will invoke
> vlan v2
> -* related function, so it won't go through here.
> -*/
> -   if (adapter->hw.mac.type == IAVF_MAC_XL710 ||
> -   adapter->hw.mac.type == IAVF_MAC_X722_VF) {
> -   if (on && !(dev_conf->rxmode.offloads &
> RTE_ETH_RX_OFFLOAD_VLAN_STRIP)) {
> -   err = iavf_disable_vlan_strip(adapter);
> -   if (err)
> -   return -EIO;
> -   }
> -   }
> -   return 0;
> +   return iavf_disable_vlan_strip_ex(dev, on);
>  }
>
>  static void
> --
> 2.39.5 (Apple Git-154)
>
>


[PATCH 0/2] Use consecutive Tx queues' memory

2025-06-23 Thread Bing Zhao
This patchset will move all the mlx5 Tx queues memory to a
consecutive memory area. All the WQEBBs will be allocated based
on the offset of this memory area.

Bing Zhao (2):
  net/mlx5: add new devarg for Tx queue consecutive memory
  net/mlx5: use consecutive memory for all Tx queues

 drivers/common/mlx5/mlx5_common.h  |  2 +
 drivers/common/mlx5/mlx5_common_devx.c | 77 +-
 drivers/common/mlx5/mlx5_common_devx.h |  2 +-
 drivers/common/mlx5/mlx5_devx_cmds.h   |  5 ++
 drivers/net/mlx5/hws/mlx5dr_internal.h |  1 -
 drivers/net/mlx5/mlx5.c| 14 +
 drivers/net/mlx5/mlx5.h|  7 +++
 drivers/net/mlx5/mlx5_devx.c   | 35 ++--
 drivers/net/mlx5/mlx5_flow_aso.c   |  2 +-
 drivers/net/mlx5/mlx5_trigger.c| 56 +++
 drivers/net/mlx5/mlx5_tx.h |  2 +
 drivers/net/mlx5/mlx5_txpp.c   |  2 +-
 drivers/net/mlx5/mlx5_txq.c| 18 +-
 13 files changed, 186 insertions(+), 37 deletions(-)

-- 
2.34.1



RE: [EXTERNAL] [PATCH] doc: announce DMA configuration structure changes

2025-06-23 Thread Amit Prakash Shukla
Acked-by: Amit Prakash Shukla 


From: pbhagavat...@marvell.com  
Sent: Wednesday, April 16, 2025 4:36 PM
To: Jerin Jacob 
Cc: Vamsi Krishna Attunuru ; g.si...@nxp.com; 
sachin.sax...@nxp.com; hemant.agra...@nxp.com; fengcheng...@huawei.com; 
bruce.richard...@intel.com; kevin.la...@intel.com; conor.wa...@intel.com; 
Gowrishankar Muthukrishnan ; Vidya Sagar Velumuri 
; anatoly.bura...@intel.com; dev@dpdk.org; Pavan 
Nikhilesh Bhagavatula 
Subject: [EXTERNAL] [PATCH] doc: announce DMA configuration structure changes

From: Pavan Nikhilesh  Deprecate rte_dma_conf 
structure to allow for a more flexible configuration of DMA devices. The new 
structure will have a flags field instead of multiple boolean fields for each 
feature. 
ZjQcmQRYFpfptBannerStart
Prioritize security for external emails: 
Confirm sender and content safety before clicking links or opening attachments 
  
https://us-phishalarm-ewt.proofpoint.com/EWT/v1/CRVmXkqW!tg3Z1f8UAnVa1M-cmd367pSy50oaG5i-erPnxhrfkp_lTFDGry0-uCQnbPxTrMJQ9QhDCdGTFh21ta0HYCWLBlk3vg5y8fISwiE1hA$
  ‌ 


ZjQcmQRYFpfptBannerEnd
From: Pavan Nikhilesh 

Deprecate rte_dma_conf structure to allow for a more flexible
configuration of DMA devices.
The new structure will have a flags field instead of multiple
boolean fields for each feature.

Signed-off-by: Pavan Nikhilesh 
---
 doc/guides/rel_notes/deprecation.rst | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/doc/guides/rel_notes/deprecation.rst 
b/doc/guides/rel_notes/deprecation.rst
index 36489f6e68..854db96c08 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -142,3 +142,9 @@ Deprecation Notices
 * bus/vmbus: Starting DPDK 25.11, all the vmbus API defined in
   ``drivers/bus/vmbus/rte_bus_vmbus.h`` will become internal to DPDK.
   Those API functions are used internally by DPDK core and netvsc PMD.
+
+* dmadev: The ``rte_dma_conf`` structure is updated to include a new field
+  ``rte_dma_conf::flags`` that should be used to configure dmadev features.
+  The existing field ``rte_dma_conf::enable_silent`` is removed and replaced
+  with the new flag ``RTE_DMA_CFG_FLAG_SILENT``, to configure silent mode
+  the flag should be set in ``rte_dma_conf::flags`` during device 
configuration.
-- 
2.43.0



CFP Deadline Extended - DPDK Bay Area Summit - September 2025

2025-06-23 Thread Nathan Southern
Dear DPDK Community,

Our CFP deadline for the 2025 Bay Area Summit in Santa Clara, Sep. 17-18,
2025, has been formally extended by two weeks, through Sunday, July 6 at
11:59pm Pacific Time.

You can reach the CFP page here
.

We look forward to receiving and reviewing your submissions. Thank you for
your interest and let us know if you have any questions.

With appreciation,

Nathan


Nathan C. Southern, Senior Program Coordinator

Data Plane Development Kit (DPDK)

The Linux Foundation

248.835.4812 (mobile)

nsouth...@linuxfoundation.org


RE: [PATCH v2 2/2] lib/graph: default-align rte_graph_cluster_stats

2025-06-23 Thread Morten Brørup
> From: David Marchand [mailto:david.march...@redhat.com]
> Sent: Monday, 23 June 2025 14.08
> 
> On Mon, Jun 23, 2025 at 10:53 AM Marat Khalili 
> wrote:
> >
> > We cannot just remove __rte_cache_aligned from rte_graph_cluster_stats
> without removing it from rte_graph_cluster_node_stats because of how C works.
> But we can perhaps use rte_malloc to align our allocations in a way that
> matches the declaration. Would it be an ok solution?
> 
> rte_malloc is not required.
> I have a fix in an branch of mine, that makes use of aligned_alloc
> (which is C11), you need to manually copy data in stats_mem_populate.

MSVC doesn't support aligned_alloc().
For MSVC, you have to use _aligned_malloc() and _aligned_free(), like in the 
"lcore variables" library:
https://elixir.bootlin.com/dpdk/v25.03/source/lib/eal/common/eal_common_lcore_var.c



Re: [PATCH v5 1/3] eal: deprecate old coremask-based EAL parameters

2025-06-23 Thread Bruce Richardson
On Mon, Jun 23, 2025 at 06:01:00PM +0200, David Marchand wrote:
> On Tue, May 27, 2025 at 5:29 PM Bruce Richardson
>  wrote:
> >
> > As the number of cores/cpus on platforms has increased over the years,
> > the use of coremasks rather than core-lists for identifying DPDK cores
> > has become more and more unwieldy. At this point, let's deprecate the
> > coremask-based EAL parameters for future removal, and point users to the
> > core-list based versions instead.
> >
> > Signed-off-by: Bruce Richardson 
> > ---
> >  doc/guides/eventdevs/dlb2.rst|  6 +++---
> >  doc/guides/faq/faq.rst   |  8 +++-
> >  doc/guides/linux_gsg/build_sample_apps.rst   |  7 +++
> >  doc/guides/linux_gsg/eal_args.include.rst|  8 ++--
> >  doc/guides/prog_guide/meson_ut.rst   |  2 +-
> >  doc/guides/prog_guide/multi_proc_support.rst |  2 +-
> >  doc/guides/prog_guide/service_cores.rst  |  8 
> >  doc/guides/rel_notes/deprecation.rst | 10 ++
> >  doc/guides/sample_app_ug/ip_frag.rst |  7 +--
> >  doc/guides/sample_app_ug/ip_reassembly.rst   |  7 +--
> >  doc/guides/sample_app_ug/multi_process.rst   | 14 +-
> >  doc/guides/sample_app_ug/qos_scheduler.rst   |  2 +-
> >  doc/guides/sample_app_ug/test_pipeline.rst   |  2 +-
> >  doc/guides/tools/testbbdev.rst   |  2 +-
> >  lib/eal/common/eal_common_options.c  |  6 ++
> >  15 files changed, 43 insertions(+), 48 deletions(-)
> 
> This patch will need some rebase.
> 
> I see you fixed a few docs, but there are quite some misses in
> copy/pasted blocks:
> 
I'll take a look and respin this.

I'm think of separating it into two patches: first patch with the doc
updates to remove use of -c flag. This should happen independent of the
deprecation, I think, and second patch just the deprecation notice. Does
that sound reasonable?

/Bruce