[PATCH RESEND v7 4/5] app/testpmd: add attach and detach port for multiple process

2024-09-28 Thread Huisong Li
The port information needs to be updated due to attaching and detaching port. Currently, it is done in the same thread as removing or probing device, which doesn't satisfy the operation of attaching and detaching device in multiple process. If this operation is performed in one process, the other

[PATCH RESEND v7 5/5] app/testpmd: stop forwarding in new or destroy event

2024-09-28 Thread Huisong Li
When testpmd receives the new or destroy event, the port related information will be updated. Testpmd must stop packet forwarding before updating the information to avoid some serious problems. Signed-off-by: Huisong Li Acked-by: Chengwen Feng --- app/test-pmd/testpmd.c | 4 1 file changed

[PATCH RESEND v7 3/5] app/testpmd: check the validity of the port

2024-09-28 Thread Huisong Li
This patch checks the validity of port id for all events in 'eth_event_callback()'. Signed-off-by: Huisong Li Acked-by: Aman Singh Acked-by: Chengwen Feng --- app/test-pmd/testpmd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/t

[PATCH RESEND v7 2/5] ethdev: fix skip valid port in probing callback

2024-09-28 Thread Huisong Li
The event callback in application may use the macro RTE_ETH_FOREACH_DEV to iterate over all enabled ports to do something(like, verifying the port id validity) when receive a probing event. If the ethdev state of a port is not RTE_ETH_DEV_UNUSED, this port will be considered as a valid port. Howev

[PATCH RESEND v7 1/5] drivers/bus: restore driver assignment at front of probing

2024-09-28 Thread Huisong Li
The driver assignment was moved back at the end of the device probing because there is no something to use rte_driver during the phase of probing. See commit 391797f04208 ("drivers/bus: move driver assignment to end of probing") However, it is necessary for probing callback to reference rte_driver

[PATCH RESEND v7 0/5] app/testpmd: support multiple process attach and detach port

2024-09-28 Thread Huisong Li
This patchset fix some bugs and support attaching and detaching port in primary and secondary. --- -v7: fix conflicts -v6: adjust rte_eth_dev_is_used position based on alphabetical order in version.map -v5: move 'ALLOCATED' state to the back of 'REMOVED' to avoid abi break. -v4: fix a mi

Re: [RFC] ethdev: introduce PTP device capability

2024-09-28 Thread lihuisong (C)
在 2024/9/26 4:42, Ferruh Yigit 写道: On 9/24/2024 8:24 AM, lihuisong (C) wrote: Hi Ferruh, 在 2024/9/23 6:23, Ferruh Yigit 写道: On 1/30/2024 3:58 AM, Huisong Li wrote: Currently, the PTP feature is a little messy and has some issue. 1> There is different implementation for PTP. This feature of

Re:[PATCH] raw/zxdh: introduce zxdh raw device driver

2024-09-28 Thread Yong Zhang
Hi thomas, I hope this message finds you well. I initially submitted the zxdh rawdev driver on June 12th, and the final version was submitted on August 12th. Since then, I have not received any feedback from the community. I would appreciate it if you could provide any suggestions for modific

Re: [PATCH] maintainers: fix prog guide paths

2024-09-28 Thread Thomas Monjalon
Stephen Hemminger, Sep 28, 2024 at 20:35: > On Wed, 25 Sep 2024 23:22:33 +0200 > Thomas Monjalon wrote: > > > When moving some files in doc subdirectories for ethdev and eventdev, > > the references in the file MAINTAINERS were forgotten. > > The new paths are used in this fix. > > > > Fixes: 41d

[RFC PATCH v12] mempool: fix mempool cache size

2024-09-28 Thread Morten Brørup
This patch refactors the mempool cache to fix two bugs: 1. When a mempool is created with a per-lcore cache size of N objects, the per-lcore caches were actually created with a size of 1.5 * N objects. 2. The mempool cache field names did not reflect their purpose; the "flushthresh" field held the

Re: [PATCH] MAINTAINERS: remove Raveendra Padasalagi

2024-09-28 Thread Thomas Monjalon
Cc Ajit for ack 28/09/2024 18:53, Stephen Hemminger: > This email address is bouncing remove from MAINTAINERS. > > Signed-off-by: Stephen Hemminger > --- > MAINTAINERS | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/MAINTAINERS b/MAINTAINERS > index c5a703b5c0..8efa0f7810 100644 > ---

Re: [PATCH] maintainers: fix prog guide paths

2024-09-28 Thread Stephen Hemminger
On Wed, 25 Sep 2024 23:22:33 +0200 Thomas Monjalon wrote: > When moving some files in doc subdirectories for ethdev and eventdev, > the references in the file MAINTAINERS were forgotten. > The new paths are used in this fix. > > Fixes: 41dd9a6bc2d9 ("doc: reorganize prog guide") > > Signed-off-

[RFC PATCH v11] mempool: fix mempool cache size

2024-09-28 Thread Morten Brørup
This patch refactors the mempool cache to fix two bugs: 1. When a mempool is created with a per-lcore cache size of N objects, the per-lcore caches were actually created with a size of 1.5 * N objects. 2. The mempool cache field names did not reflect their purpose; the "flushthresh" field held the

[PATCH] MAINTAINERS: remove Raveendra Padasalagi

2024-09-28 Thread Stephen Hemminger
This email address is bouncing remove from MAINTAINERS. Signed-off-by: Stephen Hemminger --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index c5a703b5c0..8efa0f7810 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1104,7 +1104,6 @@ F: doc/guides/crypto

[PATCH v2 16/16] eal: add alloc_function attribute to rte_malloc

2024-09-28 Thread Stephen Hemminger
Use the GCC function attribute to detect cases where memory is allocated with rte_malloc and freed incorrectly with libc version of free (and vice versa). Also will detect some other pointer mismatches. Signed-off-by: Stephen Hemminger --- doc/guides/rel_notes/release_24_11.rst | 8 lib/ea

[PATCH v2 15/16] drivers/ifpga: fix free function mismatch

2024-09-28 Thread Stephen Hemminger
The raw ifpga driver redefines malloc to be opae_malloc and free to be opae_free; which is a bad idea. This leads to case where interrupt efd array is allocated with calloc() and then passed to rte_free. The workaround is to allocate the array with rte_calloc() instead. Fixes: d61138d4f0e2 ("driv

[PATCH v2 14/16] common/qat: fix use after free

2024-09-28 Thread Stephen Hemminger
Checking return value of rte_memzone_free() is pointless and if it failed then it was because the pointer was null. Fixes: 7b1374b1e6e7 ("common/qat: limit configuration to primary process") Cc: arkadiuszx.kusz...@intel.com Signed-off-by: Stephen Hemminger --- drivers/common/qat/qat_device.c |

[PATCH v2 13/16] raw/ifpga/base: fix use after free

2024-09-28 Thread Stephen Hemminger
The TAILQ_FOREACH() macro would refer to info after it had been freed. Fix by introducing TAILQ_FOREACH_SAFE here. Fixes: 4a19f89104f8 ("raw/ifpga/base: support multiple cards") Cc: tianfei.zh...@intel.com Cc: sta...@dpdk.org Signed-off-by: Stephen Hemminger --- drivers/raw/ifpga/base/opae_inte

[PATCH v2 12/16] net/nfp: fix duplicate call to rte_free

2024-09-28 Thread Stephen Hemminger
Calling rte_free twice on same object will corrupt the heap. Warning is: In function 'nfp_pre_tun_table_check_del', inlined from 'nfp_flow_destroy' at ../drivers/net/nfp/flower/nfp_flower_flow.c:5143:9: ../drivers/net/nfp/flower/nfp_flower_flow.c:3830:9: error: pointer 'entry' used after 'rte_fre

[PATCH v2 11/16] net/cpfl: fix free of nonheap object

2024-09-28 Thread Stephen Hemminger
With proper annotation, GCC discovers that this driver is calling rte_free() on an object that was not allocated (it is part of array in another object). In function ‘cpfl_flow_js_mr_layout’, inlined from ‘cpfl_flow_js_mr_action’ at ../drivers/net/cpfl/cpfl_flow_parser.c:848:9, inlined fr

[PATCH v2 10/16] net/sfc: fix use-after-free warning messages

2024-09-28 Thread Stephen Hemminger
If compiler detection of use-after-free is enabled then this drivers debug messages will cause warnings. Change to move debug message before the object is freed. Bugzilla ID: 1551 Fixes: 55c1238246d5 ("net/sfc: add more debug messages to transfer flows") Signed-off-by: Stephen Hemminger Reviewed-

[PATCH v2 09/16] net/e1000: fix use-after-free

2024-09-28 Thread Stephen Hemminger
The driver cleanup code was freeing the filter object then dereferencing it. Bugzilla ID: 1550 Fixes: 6a4d050e2855 ("net/igb: flush all the filter") Cc: wei.zh...@intel.com Cc: sta...@dpdk.org Signed-off-by: Stephen Hemminger --- drivers/net/e1000/igb_ethdev.c | 4 ++-- 1 file changed, 2 insert

[PATCH v2 08/16] bpf: fix free mismatch if convert fails

2024-09-28 Thread Stephen Hemminger
If conversion of cBF to eBPF fails then an object allocated with rte_malloc() would be passed to free(). [908/3201] Compiling C object lib/librte_bpf.a.p/bpf_bpf_convert.c.o ../lib/bpf/bpf_convert.c: In function ‘rte_bpf_convert’: ../lib/bpf/bpf_convert.c:559:17: warning: ‘free’ called on pointer

[PATCH v2 06/16] examples/vhost: fix free function mismatch

2024-09-28 Thread Stephen Hemminger
The pointer bdev is allocated with rte_zmalloc() and then incorrectly freed with free() which will lead pool corruption. Bugzilla ID: 1553 Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample") Cc: jin...@intel.com Cc: sta...@dpdk.org Signed-off-by: Stephen Hemminger --- exa

[PATCH v2 07/16] net/cnxk: fix use-after-free

2024-09-28 Thread Stephen Hemminger
The driver would refer to the mempool object after it was freed. Bugzilla ID: 1554 Fixes: 7ea187184a51 ("common/cnxk: support 1-N pool-aura per NIX LF") Cc: rbhans...@marvell.com Cc: sta...@dpdk.org Signed-off-by: Stephen Hemminger --- drivers/net/cnxk/cnxk_ethdev_sec.c | 2 +- 1 file changed,

[PATCH v2 05/16] event/cnxk: fix pointer mismatch in cleanup

2024-09-28 Thread Stephen Hemminger
The code to cleanup in case of error was passing incorrect value to rte_free. The ports[] entry was allocated with rte_malloc and that should be used instead of the offset in that object. Fixes: 97a05c1fe634 ("event/cnxk: add port config") Cc: sthot...@marvell.com Cc: sta...@dpdk.org Signed-off-b

[PATCH v2 04/16] dma/ixd: fix incorrect free function in cleanup

2024-09-28 Thread Stephen Hemminger
The data structure is allocated with rte_malloc and incorrectly freed in cleanup logic using free. Bugzilla ID: 1549 Fixes: 9449330a8458 ("dma/idxd: create dmadev instances on PCI probe") Cc: kevin.la...@intel.com Cc: sta...@dpdk.org Signed-off-by: Stephen Hemminger --- drivers/dma/idxd/idxd_pc

[PATCH v2 03/16] cryptodev/bcmfs: fix mis-matched free

2024-09-28 Thread Stephen Hemminger
The device structure is allocated with rte_malloc() and then incorrectly freed with free(). This will lead to corrupt malloc pool. Bugzilla ID: 1552 Fixes: c8e79da7c676 ("crypto/bcmfs: introduce BCMFS driver") Cc: vikas.gu...@broadcom.com Cc: sta...@dpdk.org Signed-off-by: Stephen Hemminger ---

[PATCH v2 02/16] memzone: fix use after free in tracing

2024-09-28 Thread Stephen Hemminger
Using the freed value for tracing is not a good idea. Although it is harmless for tracing, it will cause analyzers to flag this as unsafe. Signed-off-by: Stephen Hemminger --- lib/eal/common/eal_common_memzone.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/eal/common

[PATCH v2 01/16] eal: add function attributes for allocation functions

2024-09-28 Thread Stephen Hemminger
The allocation functions take a alignment argument that can be useful to hint the compiler optimizer. This is supported by Gcc and Clang but only useful with Gcc because Clang gives warning if alignment is 0. Recent versions of GCC have a malloc attribute that can be used to find mismatches betwe

[PATCH v2 00/16] Fix allocation bugs and add malloc hardening

2024-09-28 Thread Stephen Hemminger
Recent versions of Gcc have some additonal function attributes tha can help with DPDK performance and stability. The alloc_align attribute can tell the compiler what the alignment of the allocation will be, and the optimizer can use this to produce better code (especially memcpy and structure copi

Re: [PATCH] eal/alarm_cancel: Fix thread starvation

2024-09-28 Thread Stephen Hemminger
On Wed, 25 Sep 2024 21:42:06 +0200 Wojciech Panfil wrote: > Issue: > Two threads: > > - A, executing rte_eal_alarm_cancel, > - B, executing eal_alarm_callback. > > Such case can cause starvation of thread B. Please see that there is a > small time window between lock and unlock in thread A, so

[DPDK/ethdev Bug 1555] nfp: duplicate call to rte_free

2024-09-28 Thread bugzilla
https://bugs.dpdk.org/show_bug.cgi?id=1555 Bug ID: 1555 Summary: nfp: duplicate call to rte_free Product: DPDK Version: 24.11 Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority:

[PATCH v9 8/8] test-pmd: add a JSON packet output

2024-09-28 Thread Stephen Hemminger
When doing automated testing it is useful to show packet meta data in JSON. Signed-off-by: Stephen Hemminger --- app/test-pmd/cmdline.c | 6 +- app/test-pmd/config.c | 3 + app/test-pmd/testpmd.h | 1 + app/test-pmd/util.c

[PATCH v9 7/8] test-pmd: add packet dissect format

2024-09-28 Thread Stephen Hemminger
Add ability to get decode packet in summary tshark style format. Signed-off-by: Stephen Hemminger --- app/test-pmd/cmdline.c | 6 ++-- app/test-pmd/config.c | 23 + app/test-pmd/testpmd.h | 1 + app/test-pmd/util.c

[PATCH v9 6/8] test-pmd: add hex decode

2024-09-28 Thread Stephen Hemminger
This adds new command: testpmd> set format hex which decodes packet in hex. Signed-off-by: Stephen Hemminger --- app/test-pmd/cmdline.c | 40 +++ app/test-pmd/config.c | 11 + app/test-pmd/testpmd.c | 1 + app/te

[PATCH v9 4/8] test: add test for packet dissector

2024-09-28 Thread Stephen Hemminger
Add some tests for new packet dissector. Signed-off-by: Stephen Hemminger --- app/test/meson.build| 1 + app/test/test_dissect.c | 302 2 files changed, 303 insertions(+) create mode 100644 app/test/test_dissect.c diff --git a/app/test/meson.build

[PATCH v9 5/8] test-pmd: add option to redirect packet log

2024-09-28 Thread Stephen Hemminger
When running tests in interactive mode, it is useful to be able to redirect the packet decode (verbose output) into a file. Signed-off-by: Stephen Hemminger --- app/test-pmd/cmdline.c | 41 + app/test-pmd/config.c | 23

[PATCH v9 3/8] mbuf: decode the hash and fdir info in rte_pktmbuf_dump

2024-09-28 Thread Stephen Hemminger
Useful to be able to see the meta data in the hex dump. Signed-off-by: Stephen Hemminger --- lib/mbuf/rte_mbuf.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/lib/mbuf/rte_mbuf.c b/lib/mbuf/rte_mbuf.c index 559d5ad8a7..8e452ca98f 100644 --- a/lib/mbuf/rte_mbuf.c +++ b/lib/m

[PATCH v9 2/8] net: add new packet dissector

2024-09-28 Thread Stephen Hemminger
The function rte_dissect_mbuf is used to decode the contents of an mbuf into ah uman readable format similar to what tshark uses. For now, handles IP, IPv6, TCP, UDP, ICMP and ARP. Signed-off-by: Stephen Hemminger --- lib/net/meson.build | 2 + lib/net/rte_dissect.c | 428 ++

[PATCH v9 1/8] net: add more icmp types

2024-09-28 Thread Stephen Hemminger
Add more defines for additional defined ICMP types. Signed-off-by: Stephen Hemminger --- lib/net/rte_icmp.h | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/net/rte_icmp.h b/lib/net/rte_icmp.h index 4bf64d70ad..b51b60a6d2 100644 --- a/lib/net/rte_ic

[PATCH v9 0/8] test-pmd packet decoding enhancements

2024-09-28 Thread Stephen Hemminger
While debugging TAP rte_flow discovered that test pmd verbose output was confusing and unhelpful. Instead, made a simple dissector that prints one line per packet like this in test-pmd. The new commands are: testpmd> set output /tmp/packet.log testpmd> set format dissect To enable

Re: [PATCH 10/16] net/sfc: fix use-after-free warning messages

2024-09-28 Thread Ivan Malov
Reviewed-by: Ivan Malov Thank you. On Fri, 27 Sep 2024, Stephen Hemminger wrote: If compiler detection of use-after-free is enabled then this drivers debug messages will cause warnings. Change to move debug message before the object is freed. Bugzilla ID: 1551 Fixes: 55c1238246d5 ("net/sfc:

RE: [PATCH 16/16] mempool: annotate mempool create

2024-09-28 Thread Morten Brørup
> From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Friday, 27 September 2024 22.46 > > Use rte_alloc_function annotation to catch mismatch errors > on memzone handling. > > Signed-off-by: Stephen Hemminger > --- Note for other reviewers: rte_mempool_free() was intentionally m