Limit usage of internal API in tests
cover Limit usage of internal API in tests
This series is aimed at 26.11.
We had a few bug reports related to internal (and experimental) symbols issues during 26.07 development.
See for example https://bugs.dpdk.org/show_bug.cgi?id=1957 or more recently https://bugs.dpdk.org/show_bug.cgi?id=1967.
To catch such issues earlier in the CI, this series proposes to run the unit tests through meson with the ABI reference unit test binary against the current ABI libraries and drivers.
For this to work, some unit tests must be skipped (since meson may invoke the ABI reference code with tests that were unknown at the time).
A few unit tests were directly dereferencing internal structures and are reworked so they use public APIs.
Additionally, unit tests were allowed to use any internal API which has hidden a few issues (like a public API backed by internal symbols in the hash library).
So disable the global ALLLOW_INTERNAL_API and move it to code explicitly requiring internal API, with the hope it will push us to have better API.
The last patch contains a hack for now, where the cached ABI reference is force regenerated with a branch of mine where I backported the fixes of this series.
Signature · 41 lines
David Marchand David Marchand (10): bbdev: fix stats aggregation from queues bbdev: add per-queue statistics API hash: fix GFNI stubs export test: uninline helper for forking test/bonding: get MAC address with public API test/devargs: check driver presence with public API test/vdev: find device with public API test: limit internal API usage ci: make ABI reference generation faster ci: run reference unit tests against ABI .ci/linux-build.sh | 35 +++- .github/workflows/build.yml | 15 +- MAINTAINERS | 1 + app/test-bbdev/test_bbdev_perf.c | 38 +--- app/test/meson.build | 7 +- app/test/process.c | 231 +++++++++++++++++++++++++ app/test/process.h | 228 +----------------------- app/test/test_devargs.c | 12 +- app/test/test_external_mem.c | 2 + app/test/test_link_bonding.c | 35 ++-- app/test/test_malloc.c | 2 + app/test/test_mempool.c | 2 + app/test/test_pdump.c | 3 + app/test/test_pdump.h | 3 + app/test/test_vdev.c | 85 ++------- app/test/virtual_pmd.c | 2 + devtools/test-meson-builds.sh | 5 +- doc/guides/rel_notes/release_26_07.rst | 5 + lib/bbdev/rte_bbdev.c | 26 ++- lib/bbdev/rte_bbdev.h | 20 +++ lib/hash/rte_thash_gfni.c | 4 +- lib/hash/rte_thash_gfni.h | 2 - 22 files changed, 405 insertions(+), 358 deletions(-) create mode 100644 app/test/process.c -- 2.54.0
PATCH 1/10 bbdev: fix stats aggregation from queues
The device stats retrieval was missing aggregation of enqueue_status_count, acc_offload_cycles, and enqueue_depth_avail from per-queue statistics.
--- lib/bbdev/rte_bbdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
lib/bbdev/rte_bbdev.c +5 -1
@@ -745,7 +745,7 @@ rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id)static void get_stats_from_queues (struct rte_bbdev *dev,struct rte_bbdev_stats *stats) { -unsigned int q_id; +unsigned int i, q_id;for (q_id =0 ; q_id < dev->data->num_queues; q_id++) {struct rte_bbdev_stats *q_stats = &dev->data->queues[q_id].queue_stats;
@@ -756,6 +756,10 @@ get_stats_from_queues(struct rte_bbdev *dev, struct rte_bbdev_stats *stats) stats->dequeue_err_count += q_stats->dequeue_err_count; stats->enqueue_warn_count += q_stats->enqueue_warn_count; stats->dequeue_warn_count += q_stats->dequeue_warn_count; +for (i =0 ; i <RTE_BBDEV_ENQ_STATUS_SIZE_MAX ; i++) + stats->enqueue_status_count[i] += q_stats->enqueue_status_count[i]; + stats->acc_offload_cycles += q_stats->acc_offload_cycles; + stats->enqueue_depth_avail += q_stats->enqueue_depth_avail; }rte_bbdev_log_debug ("Got stats on %u" , dev->data->dev_id); }
Signature · 1 line
2.54.0
RE: [PATCH 01/10] bbdev: fix stats aggregation from queues
Hi David,
We use the same structure for device and queue level stats for simplicity.
But really bringing these 2 at device level as an aggregate level do not really make much sense at system evel (ie sum of of queue depth is irrelevant). The other ones are relevant. I don't think we should change this, it would just create confusion with users. That's a nack to me, let me know if unclear.
Thanks
Nic
Quoted 45 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Friday, July 17, 2026 2:30 AM
To: [email protected]
Cc: [email protected]; Chautru, Nicolas <[email protected]>; Maxime Coquelin <[email protected]>; Akhil Goyal <[email protected]>
Subject: [PATCH 01/10] bbdev: fix stats aggregation from queuesThe device stats retrieval was missing aggregation of
enqueue_status_count,acc_offload_cycles, andenqueue_depth_availfrom per-queue statistics.Fixes 4f08028c5e24 ("bbdev: expose queue related warning and status")Signed-off-by David Marchand <[email protected]>--- lib/bbdev/rte_bbdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)lib/bbdev/rte_bbdev.c index renamed from lib/bbdev/rte_bbdev.c +0
-0
ea644c1f9b..90095578cb100644lib/bbdev/rte_bbdev.c +0
-0@@ -745,7 +745,7 @@ rte_bbdev_queue_stop(uint16_t dev_id, uint16_t
queue_id) static voidget_stats_from_queues(struct rte_bbdev *dev, struct rte_bbdev_stats *stats){lib/bbdev/rte_bbdev.c +5
-1-unsigned int q_id; +unsigned int i, q_id;for (q_id =0 ; q_id < dev->data->num_queues; q_id++) {struct rte_bbdev_stats *q_stats = &dev->data->queues[q_id].queue_stats;@@ -756,6 +756,10 @@ get_stats_from_queues(struct rte_bbdev *dev, struct rte_bbdev_stats *stats) stats->dequeue_err_count += q_stats->dequeue_err_count; stats->enqueue_warn_count += q_stats->enqueue_warn_count; stats->dequeue_warn_count += q_stats->dequeue_warn_count; +for (i =0 ; i <RTE_BBDEV_ENQ_STATUS_SIZE_MAX ; i++) + stats->enqueue_status_count[i] += q_stats- >enqueue_status_count[i]; + stats->acc_offload_cycles += q_stats->acc_offload_cycles; + stats->enqueue_depth_avail += q_stats->enqueue_depth_avail; }
rte_bbdev_log_debug("Got stats on %u", dev->data->dev_id); }
--
2.54.0
Re: [PATCH 01/10] bbdev: fix stats aggregation from queues
Quoted 5 lines · Nicolas
Hi David,
We use the same structure for device and queue level stats for simplicity.
But really bringing these 2 at device level as an aggregate level do not really make much sense at system evel (ie sum of of queue depth is irrelevant). The other ones are relevant. I don't think we should change this, it would just create confusion with users. That's a nack to me, let me know if unclear.
I find all those stats confusing, but otohI don't really care. I'll drop in next revision.
Signature · 1 line
David Marchand
PATCH 2/10 bbdev: add per-queue statistics API
In reply to David MarchandAdd rte_bbdev_queue_stats_get() to retrieve statistics for a specific queue. This allows applications to get per-queue stats without accessing internal data structures.
Update test-bbdev to use the new API.
--- app/test-bbdev/test_bbdev_perf.c | 38 +++++--------------------- doc/guides/rel_notes/release_26_07.rst | 5 ++++ lib/bbdev/rte_bbdev.c | 20 ++++++++++++++ lib/bbdev/rte_bbdev.h | 20 ++++++++++++++ 4 files changed, 52 insertions(+), 31 deletions(-)
app/test-bbdev/test_bbdev_perf.c +7 -31
@@ -5849,30 +5849,6 @@ validation_test(struct active_device *ad, struct test_op_params *op_params)return validation_latency_test (ad, op_params, false); } -static int -get_bbdev_queue_stats (uint16_t dev_id,uint16_t queue_id, -struct rte_bbdev_stats *stats) -{ -struct rte_bbdev *dev = &rte_bbdev_devices[dev_id]; -struct rte_bbdev_stats *q_stats; - -if (queue_id >= dev->data->num_queues) -return -1 ; - - q_stats = &dev->data->queues[queue_id].queue_stats; - - stats->enqueued_count = q_stats->enqueued_count; - stats->dequeued_count = q_stats->dequeued_count; - stats->enqueue_err_count = q_stats->enqueue_err_count; - stats->dequeue_err_count = q_stats->dequeue_err_count; - stats->enqueue_warn_count = q_stats->enqueue_warn_count; - stats->dequeue_warn_count = q_stats->dequeue_warn_count; - stats->acc_offload_cycles = q_stats->acc_offload_cycles; - stats->enqueue_depth_avail = q_stats->enqueue_depth_avail; - -return 0 ; -} - static int offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs, struct rte_bbdev_fft_op *ref_op, uint16_t dev_id,
@@ -5906,7 +5882,7 @@ offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs, &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -5988,7 +5964,7 @@ offload_latency_test_mldts(struct rte_mempool *mempool, struct test_buffers *buf &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6069,7 +6045,7 @@ offload_latency_test_dec(struct rte_mempool *mempool, struct test_buffers *bufs, &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6163,7 +6139,7 @@ offload_latency_test_ldpc_dec(struct rte_mempool *mempool, }while (unlikely (burst_sz != enq)); enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6251,7 +6227,7 @@ offload_latency_test_enc(struct rte_mempool *mempool, struct test_buffers *bufs, enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6332,7 +6308,7 @@ offload_latency_test_ldpc_enc(struct rte_mempool *mempool, }while (unlikely (burst_sz != enq)); enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6482,7 +6458,7 @@ offload_cost_test(struct active_device *ad, rte_get_tsc_hz());struct rte_bbdev_stats stats = {0 }; - ret =get_bbdev_queue_stats (ad->dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (ad->dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, ad->dev_id);
doc/guides/rel_notes/release_26_07.rst +5 -0
@@ -190,6 +190,11 @@ New Features * Added ``eof`` devarg to use link state to signal end of receive file input. * Added unit test suite. +* **Added per-queue statistics API in bbdev.** + + Added ``rte_bbdev_queue_stats_get()`` function to retrieve statistics + for a specific queue, complementing the existing device-level statistics API. + * **Updated Marvell cnxk crypto driver.** * Added support for ML-KEM and ML-DSA on CN20K platform.
lib/bbdev/rte_bbdev.c +20 -0
@@ -819,6 +819,26 @@ rte_bbdev_stats_reset(uint16_t dev_id)return 0 ; } +RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_bbdev_queue_stats_get, 26.07) +int rte_bbdev_queue_stats_get (uint16_t dev_id,uint16_t queue_id,struct rte_bbdev_stats *stats) +{ +struct rte_bbdev *dev =get_dev (dev_id); + +VALID_DEV_OR_RET_ERR (dev, dev_id); +VALID_QUEUE_OR_RET_ERR (queue_id, dev); + +if (stats ==NULL ) { +rte_bbdev_log (ERR ,"NULL stats structure" ); +return -EINVAL ; + } + + *stats = dev->data->queues[queue_id].queue_stats; + +rte_bbdev_log_debug ("Retrieved stats for queue %u of device %u" , + queue_id, dev_id); +return 0 ; +} +RTE_EXPORT_SYMBOL (rte_bbdev_info_get) intrte_bbdev_info_get (uint16_t dev_id,struct rte_bbdev_info *dev_info)
lib/bbdev/rte_bbdev.h +20 -0
@@ -316,6 +316,26 @@ rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats);int rte_bbdev_stats_reset (uint16_t dev_id); +/** +* Retrieve the statistics of a specific queue. +* +* @param dev_id +* The identifier of the device. +* @param queue_id +* The index of the queue. +* @param stats +* Pointer to structure to where statistics will be copied. On error, this +* location may or may not have been modified. +* +* @return +* - 0 on success +* - -ENODEV if dev_id is invalid +* - -EINVAL if stats is NULL +* - -ERANGE if queue_id is out of range +*/ +__rte_experimental +int rte_bbdev_queue_stats_get(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_stats *stats); +/** Device information supplied by the device's driver */ /* Structure rte_bbdev_driver_info 8< */
Signature · 1 line
2.54.0
PATCH 3/10 hash: fix GFNI stubs export
In reply to David MarchandInternal symbols *can not* be called as part of public ABI. The GFNI stubs must be exported so that an application may call them through the (inlined) GFNI API without requiring ALLOW_INTERNAL_API.
--- lib/hash/rte_thash_gfni.c | 4 ++-- lib/hash/rte_thash_gfni.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
lib/hash/rte_thash_gfni.c +2 -2
@@ -13,7 +13,7 @@ RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO);#define HASH_LOG (level, ...) \ RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) -RTE_EXPORT_INTERNAL_SYMBOL (rte_thash_gfni_stub) +RTE_EXPORT_SYMBOL (rte_thash_gfni_stub) uint32_t rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused, const uint8_t *key __rte_unused, int len __rte_unused)
@@ -29,7 +29,7 @@ rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused,return 0 ; } -RTE_EXPORT_INTERNAL_SYMBOL(rte_thash_gfni_bulk_stub) +RTE_EXPORT_SYMBOL(rte_thash_gfni_bulk_stub) void rte_thash_gfni_bulk_stub(const uint64_t *mtrx __rte_unused, int len __rte_unused, uint8_t *tuple[] __rte_unused,
lib/hash/rte_thash_gfni.h +0 -2
@@ -22,11 +22,9 @@ extern "C" {* @internal * Stubs only used when GFNI is not available. */ -__rte_internal uint32_t rte_thash_gfni_stub (const uint64_t *mtrx,const uint8_t *key,int len); -__rte_internal void rte_thash_gfni_bulk_stub (const uint64_t *mtrx,int len,uint8_t *tuple[],uint32_t val[],uint32_t num);
Signature · 1 line
2.54.0
Re: [PATCH 03/10] hash: fix GFNI stubs export
Quoted 7 lines · David Marchand
Internal symbols *can not* be called as part of public ABI. The GFNI stubs must be exported so that an application may call them through the (inlined) GFNI API without requiring
ALLOW_INTERNAL_API.Fixes 944a03a5cfc1 ("hash: fix MSVC link on GFNI stubs")Signed-off-by David Marchand <[email protected]>
Quoted 46 lines
--- lib/hash/rte_thash_gfni.c | 4 ++-- lib/hash/rte_thash_gfni.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)lib/hash/rte_thash_gfni.c +2
-2@@ -13,7 +13,7 @@ RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO);#define HASH_LOG (level, ...) \ RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) -RTE_EXPORT_INTERNAL_SYMBOL (rte_thash_gfni_stub) +RTE_EXPORT_SYMBOL (rte_thash_gfni_stub) uint32_t rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused, const uint8_t *key __rte_unused, int len __rte_unused)@@ -29,7 +29,7 @@ rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused,return 0 ; } -RTE_EXPORT_INTERNAL_SYMBOL(rte_thash_gfni_bulk_stub) +RTE_EXPORT_SYMBOL(rte_thash_gfni_bulk_stub) void rte_thash_gfni_bulk_stub(const uint64_t *mtrx __rte_unused, int len __rte_unused, uint8_t *tuple[] __rte_unused,lib/hash/rte_thash_gfni.h +0
-2@@ -22,11 +22,9 @@ extern "C" {* @internal * Stubs only used when GFNI is not available. */ -__rte_internal uint32_t rte_thash_gfni_stub (const uint64_t *mtrx,const uint8_t *key,int len); -__rte_internal void rte_thash_gfni_bulk_stub (const uint64_t *mtrx,int len,uint8_t *tuple[],uint32_t val[],uint32_t num);Signature · 1 line
2.54.0
RE: [PATCH 03/10] hash: fix GFNI stubs export
In reply to David MarchandQuoted 43 lines
Internal symbols *can not* be called as part of public ABI. The GFNI stubs must be exported so that an application may call them through the (inlined) GFNI API without requiring
ALLOW_INTERNAL_API.Fixes 944a03a5cfc1 ("hash: fix MSVC link on GFNI stubs")Signed-off-by David Marchand <[email protected]>--- lib/hash/rte_thash_gfni.c | 4 ++-- lib/hash/rte_thash_gfni.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)lib/hash/rte_thash_gfni.c +2
-2@@ -13,7 +13,7 @@ RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO);#define HASH_LOG (level, ...) \ RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) -RTE_EXPORT_INTERNAL_SYMBOL (rte_thash_gfni_stub) +RTE_EXPORT_SYMBOL (rte_thash_gfni_stub) uint32_t rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused, const uint8_t *key __rte_unused, int len __rte_unused)@@ -29,7 +29,7 @@ rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused,return 0 ; } -RTE_EXPORT_INTERNAL_SYMBOL(rte_thash_gfni_bulk_stub) +RTE_EXPORT_SYMBOL(rte_thash_gfni_bulk_stub) void rte_thash_gfni_bulk_stub(const uint64_t *mtrx __rte_unused, int len __rte_unused, uint8_t *tuple[] __rte_unused,lib/hash/rte_thash_gfni.h +0
-0@@ -22,11 +22,9 @@ extern "C" {* @internal * Stubs only used when GFNI is not available.
lib/hash/rte_thash_gfni.h extern "C" {
Quoted 10 lines
lib/hash/rte_thash_gfni.h +0
-3*/ -__rte_internal uint32_t rte_thash_gfni_stub (const uint64_t *mtrx,const uint8_t *key,int len); -__rte_internal void rte_thash_gfni_bulk_stub (const uint64_t *mtrx,int len,uint8_t *tuple[],uint32_t val[],uint32_t num); --
Quoted 1 line
2.54.0
PATCH 4/10 test: uninline helper for forking
In reply to David MarchandThere is no reason to keep those helpers inlined.
Besides, this code relies on internal API. So any consumer of process.h requires internal API.
Move this code in process.c.
--- MAINTAINERS | 1 + app/test/meson.build | 4 + app/test/process.c | 229 ++++++++++++++++++++++++++++++++++++++++++ app/test/process.h | 228 ++--------------------------------------- app/test/test_pdump.h | 3 + 5 files changed, 246 insertions(+), 219 deletions(-) create mode 100644 app/test/process.c
MAINTAINERS +1 -0
@@ -1950,6 +1950,7 @@ F: app/test/commands.c F: app/test/packet_burst_generator.c F: app/test/packet_burst_generator.h F: app/test/process.h +F: app/test/process.c F: app/test/test.c F: app/test/test.h F: app/test/test_pmd_perf.c
app/test/meson.build +4 -0
@@ -5,6 +5,10 @@ deps += ['cmdline', 'ring', 'mempool', 'mbuf'] sources += files('commands.c', 'test.c') +if not is_windows + sources += files('process.c') +endif + # optional dependencies: some files may use these - and so we should link them in - # but do not explicitly require them so they are not listed in the per-file lists below optional_deps = ['crypto_scheduler', 'lpm']
app/test/process.c new file +229 -0
229 lines not on this page · raw message
app/test/process.h +9 -219
243 lines not on this page · raw message
app/test/test_pdump.h +3 -0
@@ -11,6 +11,9 @@/* sample test to send packets to the pdump client recursively */ uint32_t send_pkts (void *empty); +/* flag to stop send_pkts thread */ +extern uint16_t flag_for_send_pkts; +/* Sample test to create setup for the pdump server tests */ int test_pdump_init (void );
Signature · 1 line
2.54.0
Re: [PATCH 04/10] test: uninline helper for forking
Quoted 8 lines · David Marchand
There is no reason to keep those helpers inlined.
Besides, this code relies on internal API. So any consumer of
process.hrequires internal API.Move this code in
process.c.Signed-off-by David Marchand <[email protected]>
PATCH 5/10 test/bonding: get MAC address with public API
In reply to David MarchandReplace direct rte_eth_devices[].data->mac_addrs access with rte_eth_macaddr_get() public API. This removes the dependency on the internal ethdev_driver.h header.
--- app/test/test_link_bonding.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-)
app/test/test_link_bonding.c +13 -22
@@ -19,7 +19,6 @@#include <rte_common.h> #include <rte_debug.h> #include <rte_ethdev.h> -#include <ethdev_driver.h> #include <rte_log.h> #include <rte_lcore.h> #include <rte_memory.h>
@@ -4763,7 +4762,7 @@ test_alb_change_mac_in_reply_sent(void)int retval =0 ;struct rte_ether_addr bond_mac, client_mac; -struct rte_ether_addr *member_mac1, *member_mac2; +struct rte_ether_addr member_mac1, member_mac2; TEST_ASSERT_SUCCESS( initialize_bonding_device_with_members(BONDING_MODE_ALB,
@@ -4779,9 +4778,7 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating four packets with different mac and ip addresses and sending
@@ -4831,10 +4828,8 @@ test_alb_change_mac_in_reply_sent(void) RTE_ARP_OP_REPLY);rte_eth_tx_burst (test_params->bonding_port_id,0 , &pkt,1 ); - member_mac1 = - rte_eth_devices[test_params->member_port_ids[0 ]].data->mac_addrs; - member_mac2 = - rte_eth_devices[test_params->member_port_ids[1 ]].data->mac_addrs; +rte_eth_macaddr_get (test_params->member_port_ids[0 ], &member_mac1); +rte_eth_macaddr_get (test_params->member_port_ids[1 ], &member_mac2);/* * Checking if packets are properly distributed on bonding ports. Packets
@@ -4852,13 +4847,13 @@ test_alb_change_mac_in_reply_sent(void) sizeof(struct rte_ether_hdr));if (member_idx%2 ==0 ) { -if (!rte_is_same_ether_addr (member_mac1, +if (!rte_is_same_ether_addr (&member_mac1, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end; } }else { -if (!rte_is_same_ether_addr (member_mac2, +if (!rte_is_same_ether_addr (&member_mac2, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end;
@@ -4885,7 +4880,7 @@ test_alb_reply_from_client(void)int retval =0 ;struct rte_ether_addr bond_mac, client_mac; -struct rte_ether_addr *member_mac1, *member_mac2; +struct rte_ether_addr member_mac1, member_mac2; TEST_ASSERT_SUCCESS( initialize_bonding_device_with_members(BONDING_MODE_ALB,
@@ -4900,9 +4895,7 @@ test_alb_reply_from_client(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating four packets with different mac and ip addresses and placing
@@ -4963,8 +4956,8 @@ test_alb_reply_from_client(void)rte_eth_rx_burst (test_params->bonding_port_id,0 , pkts_sent,MAX_PKT_BURST );rte_eth_tx_burst (test_params->bonding_port_id,0 ,NULL ,0 ); - member_mac1 = rte_eth_devices[test_params->member_port_ids[0 ]].data->mac_addrs; - member_mac2 = rte_eth_devices[test_params->member_port_ids[1 ]].data->mac_addrs; +rte_eth_macaddr_get (test_params->member_port_ids[0 ], &member_mac1); +rte_eth_macaddr_get (test_params->member_port_ids[1 ], &member_mac2);/* * Checking if update ARP packets were properly send on member ports.
@@ -4981,13 +4974,13 @@ test_alb_reply_from_client(void) sizeof(struct rte_ether_hdr));if (member_idx%2 ==0 ) { -if (!rte_is_same_ether_addr (member_mac1, +if (!rte_is_same_ether_addr (&member_mac1, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end; } }else { -if (!rte_is_same_ether_addr (member_mac2, +if (!rte_is_same_ether_addr (&member_mac2, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end;
@@ -5035,9 +5028,7 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating packet with double VLAN header and placing it in the rx queue.
Signature · 1 line
2.54.0
PATCH 6/10 test/devargs: check driver presence with public API
In reply to David MarchandLet's avoid calling internal drivers API.
--- app/test/test_devargs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
app/test/test_devargs.c +7 -3
@@ -10,7 +10,7 @@#include <rte_common.h> #include <rte_devargs.h> #include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_class.h> #include "test.h"
@@ -167,14 +167,18 @@ test_valid_devargs(void) {"net_ring0,iface=test,path=/class/bus/,queues=1" , 0, 0, 3, "vdev", "net_ring0", NULL }, }; -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); +struct rte_devargs da;int ret; ret =test_valid_devargs_cases (list,RTE_DIM (list)); -if (vdev_bus !=NULL && vdev_bus->parse ("net_ring0" ,NULL ) ==0 ) + +memset (&da,0 ,sizeof (da)); +if (rte_devargs_parse (&da,"net_ring0" ) ==0 )/* Ring vdev driver enabled. */ ret |=test_valid_devargs_cases (legacy_ring_list,RTE_DIM (legacy_ring_list)); +rte_devargs_reset (&da); +return ret; }
Signature · 1 line
2.54.0
Re: [PATCH 06/10] test/devargs: check driver presence with public API
Quoted 4 lines · David Marchand
Let's avoid calling internal drivers API.
Signed-off-by David Marchand <[email protected]>---
One suggestion inline below.
Quoted 19 lines
app/test/test_devargs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)app/test/test_devargs.c +1
-1@@ -10,7 +10,7 @@#include <rte_common.h> #include <rte_devargs.h> #include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_class.h> #include "test.h" @@ -167,14 +167,18 @@ test_valid_devargs(void) {"net_ring0,iface=test,path=/class/bus/,queues=1" , 0, 0, 3, "vdev", "net_ring0", NULL },
app/test/test_devargs.c test_valid_devargs(void) · line 176
Quoted 10 lines
app/test/test_devargs.c +4
-2}; -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); +struct rte_devargs da;int ret; ret =test_valid_devargs_cases (list,RTE_DIM (list)); -if (vdev_bus !=NULL && vdev_bus->parse ("net_ring0" ,NULL ) ==0 ) + +memset (&da,0 ,sizeof (da)); +if (rte_devargs_parse (&da,"net_ring0" ) ==0 )
From what I/AI can see, there is nothing in this test case that requires the ring PMD specifically. I think it would be good if it were updated to use net/null, so that we standardize on our basic unit tests only relying upon that PMD, rather than requiring a variety of drivers. WDYT?
Quoted 11 lines
app/test/test_devargs.c +2
-0/* Ring vdev driver enabled. */ ret |=test_valid_devargs_cases (legacy_ring_list,RTE_DIM (legacy_ring_list)); +rte_devargs_reset (&da); +return ret; }Signature · 1 line
2.54.0
Re: [PATCH 06/10] test/devargs: check driver presence with public API
Quoted 34 lines · Bruce Richardson
Quoted 4 lines · David Marchand
Let's avoid calling internal drivers API.
Signed-off-by David Marchand <[email protected]>---
Acked-by Bruce Richardson <[email protected]>One suggestion inline below.
Quoted 24 lines
app/test/test_devargs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)app/test/test_devargs.c +2
-2@@ -10,7 +10,7 @@#include <rte_common.h> #include <rte_devargs.h> #include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_class.h> #include "test.h" @@ -167,14 +167,18 @@ test_valid_devargs(void) {"net_ring0,iface=test,path=/class/bus/,queues=1" , 0, 0, 3, "vdev", "net_ring0", NULL }, }; -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); +struct rte_devargs da;int ret;
Quoted 7 lines
app/test/test_devargs.c test_valid_devargs(void) · line 176
Quoted 5 lines
app/test/test_devargs.c +3
-1ret =test_valid_devargs_cases (list,RTE_DIM (list)); -if (vdev_bus !=NULL && vdev_bus->parse ("net_ring0" ,NULL ) ==0 ) + +memset (&da,0 ,sizeof (da)); +if (rte_devargs_parse (&da,"net_ring0" ) ==0 )From what I/AI can see, there is nothing in this test case that requires
(you could write it as "From what A?I can see")
Quoted 3 lines
the ring PMD specifically. I think it would be good if it were updated to use net/null, so that we standardize on our basic unit tests only relying upon that PMD, rather than requiring a variety of drivers. WDYT?
There may be a hidden (capillotracté) reason.
Passing path=/class/bus/ seems to be intended at catching errors in devargs parsing.
No argument in net/null could accept such string.
Signature · 1 line
David Marchand
Re: [PATCH 06/10] test/devargs: check driver presence with public API
Quoted 46 lines · David Marchand
Quoted 34 lines · Bruce Richardson
Quoted 4 lines · David Marchand
Let's avoid calling internal drivers API.
Signed-off-by David Marchand <[email protected]>---
Acked-by Bruce Richardson <[email protected]>One suggestion inline below.
Quoted 24 lines
app/test/test_devargs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)app/test/test_devargs.c +2
-2@@ -10,7 +10,7 @@#include <rte_common.h> #include <rte_devargs.h> #include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_class.h> #include "test.h" @@ -167,14 +167,18 @@ test_valid_devargs(void) {"net_ring0,iface=test,path=/class/bus/,queues=1" , 0, 0, 3, "vdev", "net_ring0", NULL }, }; -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); +struct rte_devargs da;int ret;Quoted 7 lines
app/test/test_devargs.c test_valid_devargs(void) · line 176
Quoted 5 lines
app/test/test_devargs.c +3
-1ret =test_valid_devargs_cases (list,RTE_DIM (list)); -if (vdev_bus !=NULL && vdev_bus->parse ("net_ring0" ,NULL ) ==0 ) + +memset (&da,0 ,sizeof (da)); +if (rte_devargs_parse (&da,"net_ring0" ) ==0 )From what I/AI can see, there is nothing in this test case that requires
(you could write it as "From what A?I can see")
Quoted 9 lines
Quoted 3 lines
the ring PMD specifically. I think it would be good if it were updated to use net/null, so that we standardize on our basic unit tests only relying upon that PMD, rather than requiring a variety of drivers. WDYT?
There may be a hidden (capillotracté) reason.
Passing path=/class/bus/ seems to be intended at catching errors in devargs parsing.
No argument in net/null could accept such string.
Not a path string, no, though it can take other parameters. Do we specifically want/need it to take a path string?
/Bruce
Re: [PATCH 06/10] test/devargs: check driver presence with public API
Quoted 52 lines · Bruce Richardson
Quoted 50 lines · David Marchand
Quoted 34 lines · Bruce Richardson
Quoted 4 lines · David Marchand
Let's avoid calling internal drivers API.
Signed-off-by David Marchand <[email protected]>---
Acked-by Bruce Richardson <[email protected]>One suggestion inline below.
Quoted 24 lines
app/test/test_devargs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)app/test/test_devargs.c +2
-2@@ -10,7 +10,7 @@#include <rte_common.h> #include <rte_devargs.h> #include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_class.h> #include "test.h" @@ -167,14 +167,18 @@ test_valid_devargs(void) {"net_ring0,iface=test,path=/class/bus/,queues=1" , 0, 0, 3, "vdev", "net_ring0", NULL }, }; -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); +struct rte_devargs da;int ret;Quoted 7 lines
app/test/test_devargs.c test_valid_devargs(void) · line 176
Quoted 5 lines
app/test/test_devargs.c +3
-1ret =test_valid_devargs_cases (list,RTE_DIM (list)); -if (vdev_bus !=NULL && vdev_bus->parse ("net_ring0" ,NULL ) ==0 ) + +memset (&da,0 ,sizeof (da)); +if (rte_devargs_parse (&da,"net_ring0" ) ==0 )From what I/AI can see, there is nothing in this test case that requires
(you could write it as "From what A?I can see")
Quoted 3 lines
the ring PMD specifically. I think it would be good if it were updated to use net/null, so that we standardize on our basic unit tests only relying upon that PMD, rather than requiring a variety of drivers. WDYT?
Quoted 7 lines
Quoted 5 lines
There may be a hidden (capillotracté) reason.
Passing path=/class/bus/ seems to be intended at catching errors in devargs parsing.
No argument in net/null could accept such string.Not a path string, no, though it can take other parameters. Do we specifically want/need it to take a path string?
This is some special case tested for "legacy".
I prefer asking Xueming and Thomas what the intention was.
Signature · 1 line
David Marchand
Re: [PATCH 06/10] test/devargs: check driver presence with public API
17/07/2026 14:34, David Marchand:
Quoted 59 lines
Quoted 57 lines · Bruce Richardson
Quoted 55 lines · David Marchand
Quoted 34 lines · Bruce Richardson
Quoted 4 lines · David Marchand
Let's avoid calling internal drivers API.
Signed-off-by David Marchand <[email protected]>---
Acked-by Bruce Richardson <[email protected]>One suggestion inline below.
Quoted 24 lines
app/test/test_devargs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)app/test/test_devargs.c +2
-2@@ -10,7 +10,7 @@#include <rte_common.h> #include <rte_devargs.h> #include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_class.h> #include "test.h" @@ -167,14 +167,18 @@ test_valid_devargs(void) {"net_ring0,iface=test,path=/class/bus/,queues=1" , 0, 0, 3, "vdev", "net_ring0", NULL }, }; -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); +struct rte_devargs da;int ret;Quoted 7 lines
app/test/test_devargs.c test_valid_devargs(void) · line 176
Quoted 5 lines
app/test/test_devargs.c +3
-1ret =test_valid_devargs_cases (list,RTE_DIM (list)); -if (vdev_bus !=NULL && vdev_bus->parse ("net_ring0" ,NULL ) ==0 ) + +memset (&da,0 ,sizeof (da)); +if (rte_devargs_parse (&da,"net_ring0" ) ==0 )From what I/AI can see, there is nothing in this test case that requires
(you could write it as "From what A?I can see")
Quoted 3 lines
the ring PMD specifically. I think it would be good if it were updated to use net/null, so that we standardize on our basic unit tests only relying upon that PMD, rather than requiring a variety of drivers. WDYT?
There may be a hidden (capillotracté) reason.
Passing path=/class/bus/ seems to be intended at catching errors in devargs parsing.
No argument in net/null could accept such string.
Quoted 5 lines
Quoted 2 lines
Not a path string, no, though it can take other parameters. Do we specifically want/need it to take a path string?
This is some special case tested for "legacy".
I prefer asking Xueming and Thomas what the intention was.
I have no idea about the original intent.
If it's unclear, it means it can be removed :-)
PATCH 7/10 test/vdev: find device with public API
In reply to David MarchandChecking internal API has little sense as users are not supposed to call those.
Use public API to achieve similar coverage.
--- app/test/test_vdev.c | 85 ++++++++------------------------------------ 1 file changed, 15 insertions(+), 70 deletions(-)
app/test/test_vdev.c +15 -70
@@ -2,69 +2,26 @@* Copyright 2021 6WIND S.A. */ -#include <stdlib.h> #include <stdio.h> #include <string.h> -#include <rte_common.h> #include <rte_dev.h> -#include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_bus_vdev.h> #include "test.h" -#define TEST_VDEV_KEY_NAME "name" - -static const char *const valid_keys[] = { -TEST_VDEV_KEY_NAME , -NULL , -}; - -static int -cmp_dev_name (const struct rte_device *dev,const void *name) -{ -return strcmp (rte_dev_name (dev), name); -} - -static int -cmp_dev_match (const struct rte_device *dev,const void *_kvlist) -{ -const struct rte_kvargs *kvlist = _kvlist; -const char *key =TEST_VDEV_KEY_NAME ; -const char *name; - -/* no kvlist arg, all devices match */ -if (kvlist ==NULL ) -return 0 ; - -/* if key is present in kvlist and does not match, filter device */ - name =rte_kvargs_get (kvlist, key); -if (name !=NULL &&strcmp (name,rte_dev_name (dev)) !=0 ) -return -1 ; - -return 0 ; -} -static struct rte_device * -get_matching_vdev (const char *match_str) +find_vdev_by_name (const char *name) { -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); -struct rte_kvargs *kvargs =NULL ; +struct rte_dev_iterator it = {0 };struct rte_device *dev; -if (match_str !=NULL ) { - kvargs =rte_kvargs_parse (match_str, valid_keys); -if (kvargs ==NULL ) { -printf ("Failed to parse match string\n" ); -return NULL ; - } + RTE_DEV_FOREACH(dev, "bus=vdev", &it) { +if (strcmp (rte_dev_name (dev), name) ==0 ) +return dev; } - - dev = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_match, kvargs); -rte_kvargs_free (kvargs); - -return dev; +return NULL ; } static int
@@ -83,7 +40,7 @@ test_vdev_bus(void)printf ("Failed to create vdev net_null_test0\n" ); goto fail; } - dev0 = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_name,"net_null_test0" ); + dev0 =find_vdev_by_name ("net_null_test0" );if (dev0 ==NULL ) {printf ("Cannot find net_null_test0 vdev\n" ); goto fail;
@@ -94,44 +51,32 @@ test_vdev_bus(void)printf ("Failed to create vdev net_null_test1\n" ); goto fail; } - dev1 = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_name,"net_null_test1" ); + dev1 =find_vdev_by_name ("net_null_test1" );if (dev1 ==NULL ) {printf ("Cannot find net_null_test1 vdev\n" ); goto fail; } -/* try to match vdevs */ - dev =get_matching_vdev ("name=net_null_test0" ); +/* try to find vdevs */ + dev =find_vdev_by_name ("net_null_test0" );if (dev != dev0) {printf ("Cannot match net_null_test0 vdev\n" ); goto fail; } - dev =get_matching_vdev ("name=net_null_test1" ); + dev =find_vdev_by_name ("net_null_test1" );if (dev != dev1) {printf ("Cannot match net_null_test1 vdev\n" ); goto fail; } - dev =get_matching_vdev ("name=unexistant" ); + dev =find_vdev_by_name ("nonexistent" );if (dev !=NULL ) { -printf ("Unexistant vdev should not match\n" ); - goto fail; - } - - dev =get_matching_vdev ("" ); -if (dev ==NULL || dev == dev1) { -printf ("Cannot match any vdev with empty match string\n" ); - goto fail; - } - - dev =get_matching_vdev (NULL ); -if (dev ==NULL || dev == dev1) { -printf ("Cannot match any vdev with NULL match string\n" ); +printf ("Nonexistent vdev should not match\n" ); goto fail; } -/* iterate all vdevs, and ensure we find vdev0 and vdev1 */ +/* iterate all vdevs, and ensure we find dev0 and dev1 */ RTE_DEV_FOREACH(dev, "bus=vdev", &dev_iter) {if (dev == dev0) dev0 =NULL ;
Signature · 1 line
2.54.0
PATCH 8/10 test: limit internal API usage
In reply to David MarchandInternal APIs may be used for validating the internals of some component, but in general, it should be discouraged.
Let's not allow globally internal API in the unit tests.
--- app/test/meson.build | 3 --- app/test/process.c | 2 ++ app/test/test_devargs.c | 2 ++ app/test/test_external_mem.c | 2 ++ app/test/test_malloc.c | 2 ++ app/test/test_mempool.c | 2 ++ app/test/test_pdump.c | 3 +++ app/test/virtual_pmd.c | 2 ++ 8 files changed, 15 insertions(+), 3 deletions(-)
app/test/meson.build +0 -3
@@ -286,9 +286,6 @@ foreach arg: extra_flags endif endforeach -# Enable using internal APIs in unit tests -cflags += '-DALLOW_INTERNAL_API' - # create a symlink in the app/test directory for the binary, for backward compatibility if not is_windows custom_target('test_symlink',
app/test/process.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <errno.h> /* errno */ #include <limits.h> /* PATH_MAX */ #ifndef RTE_EXEC_ENV_WINDOWS
app/test/test_devargs.c +2 -0
@@ -2,6 +2,8 @@* Copyright (c) 2021 NVIDIA Corporation & Affiliates */ +#define ALLOW_INTERNAL_API +#include <stdlib.h> #include <stdio.h> #include <string.h>
app/test/test_external_mem.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2018 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include "test.h" #include <errno.h>
app/test/test_malloc.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2019 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include "test.h" #include <stdio.h>
app/test/test_mempool.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <string.h> #include <stdio.h> #include <stdlib.h>
app/test/test_pdump.c +3 -0
@@ -1,6 +1,9 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2018 Intel Corporation */ + +#define ALLOW_INTERNAL_API +#include <stdio.h> #include <unistd.h> #include <stdint.h>
app/test/virtual_pmd.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <rte_mbuf.h> #include <rte_ethdev.h> #include <ethdev_driver.h>
Signature · 1 line
2.54.0
PATCH 9/10 ci: make ABI reference generation faster
In reply to David MarchandRegenerating ABI is not something we do often, but when working on ABI topics, a lot of time may be wasted on waiting for the reference being generated.
We only care about shared libraries, avoid building final applications or examples.
And we don't need to double check headers in the ABI reference.
--- .ci/linux-build.sh | 11 ++++++++++- devtools/test-meson-builds.sh | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-)
.ci/linux-build.sh +10 -1
@@ -201,9 +201,18 @@ if [ "$ABI_CHECKS" = "true" ]; then fi if [ ! -d reference ]; then + REF_OPTS="$OPTS" + # We only care about the drivers and libs, disable developer checks and + # don't try to link apps. + REF_OPTS="$REF_OPTS -Dcheck_includes=false" + REF_OPTS="$REF_OPTS -Ddeveloper_mode=disabled" + REF_OPTS="$REF_OPTS -Ddisable_apps=*" + REF_OPTS="$REF_OPTS -Denable_docs=false" + REF_OPTS="$REF_OPTS -Dexamples=" + REF_OPTS="$REF_OPTS -Dtests=false" refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG) git clone --single-branch -b "$REF_GIT_TAG" $REF_GIT_REPO $refsrcdir - meson setup $OPTS -Dexamples= $refsrcdir $refsrcdir/build + meson setup $REF_OPTS $refsrcdir $refsrcdir/build ninja -C $refsrcdir/build DESTDIR=$(pwd)/reference meson install -C $refsrcdir/build find reference/usr/local -name '*.a' -delete
devtools/test-meson-builds.sh +4 -1
@@ -206,8 +206,11 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options] fi rm -rf $abirefdir/build + # We only care about the drivers and libs, disable + # developer checks and don't try to link apps. config $abirefdir/src $abirefdir/build ABI $cross \ - -Dexamples= $* + $* -Dcheck_includes=false -Ddeveloper_mode=disabled \ + -Ddisable_apps=* -Dexamples= -Dtests=false compile $abirefdir/build install_target $abirefdir/build $abirefdir/$targetdir
Signature · 1 line
2.54.0
PATCH 10/10 ci: run reference unit tests against ABI
In reply to David MarchandLet's check if unit tests from the reference build can run with the current release libraries/drivers.
This gives another level of ABI checking, like catching regressions on experimental or internal ABI symbols that get promoted to stable.
Skip unit tests that were added since the reference (iow v26.03).
$ git diff v26.03..origin/main | sed -ne 's/^[+]REGISTER_FAST_TEST(\([^,]*\).*$/\1/p' | sort af_packet_pmd_autotest bpf_exec_wrong_flags_autotest bpf_exec_wrong_nb_prog_arg_autotest bpf_load_null_autotest bpf_validate_autotest eal_flags_pagesz_mem_autotest feature_autotest pcap_pmd_autotest reassembly_autotest
As reported in https://bugs.dpdk.org/show_bug.cgi?id=1967, devargs and vdev autotests are broken due to drivers ABI changes since those unit tests are directly accessing internal objects.
FIXME: for now, use a branch of mine with backports on 26.03.
--- .ci/linux-build.sh | 28 +++++++++++++++++++++++++--- .github/workflows/build.yml | 15 +++++++++++++-- 2 files changed, 38 insertions(+), 5 deletions(-)
.ci/linux-build.sh +25 -3
@@ -200,23 +200,28 @@ if [ "$ABI_CHECKS" = "true" ]; then rm -rf reference fi + # FIXME: force regeneration in CI for this patch + if [ ! -e reference/usr/local/bin/dpdk-test ]; then + rm -rf reference + fi + if [ ! -d reference ]; then REF_OPTS="$OPTS" # We only care about the drivers and libs, disable developer checks and # don't try to link apps. REF_OPTS="$REF_OPTS -Dcheck_includes=false" REF_OPTS="$REF_OPTS -Ddeveloper_mode=disabled" - REF_OPTS="$REF_OPTS -Ddisable_apps=*" + REF_OPTS="$REF_OPTS -Denable_apps=test" REF_OPTS="$REF_OPTS -Denable_docs=false" REF_OPTS="$REF_OPTS -Dexamples=" - REF_OPTS="$REF_OPTS -Dtests=false" refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG) git clone --single-branch -b "$REF_GIT_TAG" $REF_GIT_REPO $refsrcdir meson setup $REF_OPTS $refsrcdir $refsrcdir/build ninja -C $refsrcdir/build DESTDIR=$(pwd)/reference meson install -C $refsrcdir/build find reference/usr/local -name '*.a' -delete - rm -rf reference/usr/local/bin + rm -rf reference/usr/local/bin/* + cp $refsrcdir/build/app/dpdk-test reference/usr/local/bin/dpdk-test rm -rf reference/usr/local/share echo $REF_GIT_TAG > reference/VERSION fi
@@ -233,6 +238,23 @@ if [ "$RUN_TESTS" = "true" ]; then catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt check_traces [ "$failed" != "true" ] + + if [ "$ABI_CHECKS" = "true" ]; then + failed= + configure_coredump + mv -f build/app/dpdk-test build/app/dpdk-test.ori + cp reference/usr/local/bin/dpdk-test build/app/dpdk-test + for t in ${ABI_SKIP_TESTS}; do + DPDK_TEST_SKIP=${DPDK_TEST_SKIP+$DPDK_TEST_SKIP,}$t + done + sudo env DPDK_TEST_SKIP="$DPDK_TEST_SKIP" \ + meson test -C build --suite fast-tests -t 3 --no-stdsplit --print-errorlogs || failed="true" + catch_coredump + catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt + check_traces + mv -f build/app/dpdk-test.ori build/app/dpdk-test + [ "$failed" != "true" ] + fi fi # Test examples compilation with an installed dpdk
.github/workflows/build.yml +13 -2
@@ -11,8 +11,9 @@ defaults: env: REF_GIT_BRANCH: main - REF_GIT_REPO: https://github.com/DPDK/dpdk - REF_GIT_TAG: v26.03 + # FIXME + REF_GIT_REPO: https://github.com/david-marchand/dpdk + REF_GIT_TAG: 26.03 jobs: checkpatch:
@@ -39,6 +40,16 @@ jobs: env: AARCH64: ${{ matrix.config.cross == 'aarch64' }} ABI_CHECKS: ${{ contains(matrix.config.checks, 'abi') }} + ABI_SKIP_TESTS: | + af_packet_pmd_autotest + bpf_exec_wrong_flags_autotest + bpf_exec_wrong_nb_prog_arg_autotest + bpf_load_null_autotest + bpf_validate_autotest + eal_flags_pagesz_mem_autotest + feature_autotest + pcap_pmd_autotest + reassembly_autotest ASAN: ${{ contains(matrix.config.checks, 'asan') }} BUILD_32BIT: ${{ matrix.config.cross == 'i386' }} BUILD_DEBUG: ${{ contains(matrix.config.checks, 'debug') }}
Signature · 1 line
2.54.0
Quoted 11 lines · David Marchand
This series is aimed at 26.11.
We had a few bug reports related to internal (and experimental) symbols issues during 26.07 development.
See for example https://bugs.dpdk.org/show_bug.cgi?id=1957 or more recently https://bugs.dpdk.org/show_bug.cgi?id=1967.To catch such issues earlier in the CI, this series proposes to run the unit tests through meson with the ABI reference unit test binary against the current ABI libraries and drivers.
I could have called test-null.sh for checking testpmd too. For a next revision if any.
Quoted 16 lines
For this to work, some unit tests must be skipped (since meson may invoke the ABI reference code with tests that were unknown at the time).
A few unit tests were directly dereferencing internal structures and are reworked so they use public APIs.
Additionally, unit tests were allowed to use any internal API which has hidden a few issues (like a public API backed by internal symbols in the hash library).
So disable the globalALLLOW_INTERNAL_APIand move it to code explicitly requiring internal API, with the hope it will push us to have better API.The last patch contains a hack for now, where the cached ABI reference is force regenerated with a branch of mine where I backported the fixes of this series.
Signature · 1 line
David Marchand
v2 cover Limit usage of internal API in tests
In reply to David MarchandWe had a few bug reports related to internal (and experimental) symbols issues during 26.07 development.
See for example https://bugs.dpdk.org/show_bug.cgi?id=1957 or more recently https://bugs.dpdk.org/show_bug.cgi?id=1967.
To catch such issues earlier in the CI, this series proposes to run the unit tests through meson with the ABI reference unit test binary against the current ABI libraries and drivers.
For this to work, some unit tests must be skipped (since meson may invoke the ABI reference code with tests that were unknown at the time).
A few unit tests were directly dereferencing internal structures and are reworked so they use public APIs.
Additionally, unit tests were allowed to use any internal API which has hidden a few issues (like a public API backed by internal symbols in the hash library).
So disable the global ALLLOW_INTERNAL_API and move it to code explicitly requiring internal API, with the hope it will push us to have better API.
The last patch contains a hack for now, where the cached ABI reference is force regenerated with a branch of mine where I backported the fixes of this series.
Signature · 47 lines
David Marchand Changes since v1: - rebased, - dropped patch 1 on bbdev, - dropped dependency on net/ring in devargs test, - removed hacks from last patch, flushed excluded tests list, added test-null.sh check, David Marchand (9): bbdev: add per-queue statistics API hash: fix GFNI stubs export test: uninline helper for forking test/bonding: get MAC address with public API test/devargs: rely on net null driver test/vdev: find device with public API test: limit internal API usage ci: make ABI reference generation faster ci: run reference binaries against current ABI .ci/linux-build.sh | 40 ++++- .github/workflows/build.yml | 1 + MAINTAINERS | 1 + app/test-bbdev/test_bbdev_perf.c | 38 +--- app/test/meson.build | 7 +- app/test/process.c | 231 +++++++++++++++++++++++++ app/test/process.h | 228 +----------------------- app/test/test_devargs.c | 21 +-- app/test/test_external_mem.c | 2 + app/test/test_link_bonding.c | 35 ++-- app/test/test_malloc.c | 2 + app/test/test_mempool.c | 2 + app/test/test_pdump.c | 3 + app/test/test_pdump.h | 3 + app/test/test_vdev.c | 85 ++------- app/test/virtual_pmd.c | 2 + devtools/test-meson-builds.sh | 5 +- doc/guides/rel_notes/release_26_11.rst | 5 + lib/bbdev/rte_bbdev.c | 20 +++ lib/bbdev/rte_bbdev.h | 20 +++ lib/hash/rte_thash_gfni.c | 4 +- lib/hash/rte_thash_gfni.h | 2 - 22 files changed, 390 insertions(+), 367 deletions(-) create mode 100644 app/test/process.c -- 2.54.0
PATCH v2 1/9 bbdev: add per-queue statistics API
Add rte_bbdev_queue_stats_get() to retrieve statistics for a specific queue. This allows applications to get per-queue stats without accessing internal data structures.
Update test-bbdev to use the new API.
--- app/test-bbdev/test_bbdev_perf.c | 38 +++++--------------------- doc/guides/rel_notes/release_26_11.rst | 5 ++++ lib/bbdev/rte_bbdev.c | 20 ++++++++++++++ lib/bbdev/rte_bbdev.h | 20 ++++++++++++++ 4 files changed, 52 insertions(+), 31 deletions(-)
app/test-bbdev/test_bbdev_perf.c +7 -31
@@ -5849,30 +5849,6 @@ validation_test(struct active_device *ad, struct test_op_params *op_params)return validation_latency_test (ad, op_params, false); } -static int -get_bbdev_queue_stats (uint16_t dev_id,uint16_t queue_id, -struct rte_bbdev_stats *stats) -{ -struct rte_bbdev *dev = &rte_bbdev_devices[dev_id]; -struct rte_bbdev_stats *q_stats; - -if (queue_id >= dev->data->num_queues) -return -1 ; - - q_stats = &dev->data->queues[queue_id].queue_stats; - - stats->enqueued_count = q_stats->enqueued_count; - stats->dequeued_count = q_stats->dequeued_count; - stats->enqueue_err_count = q_stats->enqueue_err_count; - stats->dequeue_err_count = q_stats->dequeue_err_count; - stats->enqueue_warn_count = q_stats->enqueue_warn_count; - stats->dequeue_warn_count = q_stats->dequeue_warn_count; - stats->acc_offload_cycles = q_stats->acc_offload_cycles; - stats->enqueue_depth_avail = q_stats->enqueue_depth_avail; - -return 0 ; -} - static int offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs, struct rte_bbdev_fft_op *ref_op, uint16_t dev_id,
@@ -5906,7 +5882,7 @@ offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs, &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -5988,7 +5964,7 @@ offload_latency_test_mldts(struct rte_mempool *mempool, struct test_buffers *buf &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6069,7 +6045,7 @@ offload_latency_test_dec(struct rte_mempool *mempool, struct test_buffers *bufs, &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6163,7 +6139,7 @@ offload_latency_test_ldpc_dec(struct rte_mempool *mempool, }while (unlikely (burst_sz != enq)); enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6251,7 +6227,7 @@ offload_latency_test_enc(struct rte_mempool *mempool, struct test_buffers *bufs, enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6332,7 +6308,7 @@ offload_latency_test_ldpc_enc(struct rte_mempool *mempool, }while (unlikely (burst_sz != enq)); enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6482,7 +6458,7 @@ offload_cost_test(struct active_device *ad, rte_get_tsc_hz());struct rte_bbdev_stats stats = {0 }; - ret =get_bbdev_queue_stats (ad->dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (ad->dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, ad->dev_id);
doc/guides/rel_notes/release_26_11.rst +5 -0
@@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added per-queue statistics API in bbdev.** + + Added ``rte_bbdev_queue_stats_get()`` function to retrieve statistics + for a specific queue, complementing the existing device-level statistics API. + Removed Items -------------
lib/bbdev/rte_bbdev.c +20 -0
@@ -815,6 +815,26 @@ rte_bbdev_stats_reset(uint16_t dev_id)return 0 ; } +RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_bbdev_queue_stats_get, 26.07) +int rte_bbdev_queue_stats_get (uint16_t dev_id,uint16_t queue_id,struct rte_bbdev_stats *stats) +{ +struct rte_bbdev *dev =get_dev (dev_id); + +VALID_DEV_OR_RET_ERR (dev, dev_id); +VALID_QUEUE_OR_RET_ERR (queue_id, dev); + +if (stats ==NULL ) { +rte_bbdev_log (ERR ,"NULL stats structure" ); +return -EINVAL ; + } + + *stats = dev->data->queues[queue_id].queue_stats; + +rte_bbdev_log_debug ("Retrieved stats for queue %u of device %u" , + queue_id, dev_id); +return 0 ; +} +RTE_EXPORT_SYMBOL (rte_bbdev_info_get) intrte_bbdev_info_get (uint16_t dev_id,struct rte_bbdev_info *dev_info)
lib/bbdev/rte_bbdev.h +20 -0
@@ -316,6 +316,26 @@ rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats);int rte_bbdev_stats_reset (uint16_t dev_id); +/** +* Retrieve the statistics of a specific queue. +* +* @param dev_id +* The identifier of the device. +* @param queue_id +* The index of the queue. +* @param stats +* Pointer to structure to where statistics will be copied. On error, this +* location may or may not have been modified. +* +* @return +* - 0 on success +* - -ENODEV if dev_id is invalid +* - -EINVAL if stats is NULL +* - -ERANGE if queue_id is out of range +*/ +__rte_experimental +int rte_bbdev_queue_stats_get(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_stats *stats); +/** Device information supplied by the device's driver */ /* Structure rte_bbdev_driver_info 8< */
Signature · 1 line
2.54.0
Re: [PATCH v2 1/9] bbdev: add per-queue statistics API
Quoted 7 lines · David Marchand
Add
rte_bbdev_queue_stats_get()to retrieve statistics for a specific queue. This allows applications to get per-queue stats without accessing internal data structures.Update test-bbdev to use the new API.
Signed-off-by David Marchand <[email protected]>
Seems entirely reasonable. Code looks ok to me too.
PATCH v2 2/9 hash: fix GFNI stubs export
In reply to David MarchandInternal symbols *can not* be called as part of public ABI. The GFNI stubs must be exported so that an application may call them through the (inlined) GFNI API without requiring ALLOW_INTERNAL_API.
--- lib/hash/rte_thash_gfni.c | 4 ++-- lib/hash/rte_thash_gfni.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
lib/hash/rte_thash_gfni.c +2 -2
@@ -13,7 +13,7 @@ RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO);#define HASH_LOG (level, ...) \ RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) -RTE_EXPORT_INTERNAL_SYMBOL (rte_thash_gfni_stub) +RTE_EXPORT_SYMBOL (rte_thash_gfni_stub) uint32_t rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused, const uint8_t *key __rte_unused, int len __rte_unused)
@@ -29,7 +29,7 @@ rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused,return 0 ; } -RTE_EXPORT_INTERNAL_SYMBOL(rte_thash_gfni_bulk_stub) +RTE_EXPORT_SYMBOL(rte_thash_gfni_bulk_stub) void rte_thash_gfni_bulk_stub(const uint64_t *mtrx __rte_unused, int len __rte_unused, uint8_t *tuple[] __rte_unused,
lib/hash/rte_thash_gfni.h +0 -2
@@ -22,11 +22,9 @@ extern "C" {* @internal * Stubs only used when GFNI is not available. */ -__rte_internal uint32_t rte_thash_gfni_stub (const uint64_t *mtrx,const uint8_t *key,int len); -__rte_internal void rte_thash_gfni_bulk_stub (const uint64_t *mtrx,int len,uint8_t *tuple[],uint32_t val[],uint32_t num);
Signature · 1 line
2.54.0
PATCH v2 3/9 test: uninline helper for forking
In reply to David MarchandThere is no reason to keep those helpers inlined.
Besides, this code relies on internal API. So any consumer of process.h requires internal API.
Move this code in process.c.
--- MAINTAINERS | 1 + app/test/meson.build | 4 + app/test/process.c | 229 ++++++++++++++++++++++++++++++++++++++++++ app/test/process.h | 228 ++--------------------------------------- app/test/test_pdump.h | 3 + 5 files changed, 246 insertions(+), 219 deletions(-) create mode 100644 app/test/process.c
MAINTAINERS +1 -0
@@ -1951,6 +1951,7 @@ F: app/test/commands.c F: app/test/packet_burst_generator.c F: app/test/packet_burst_generator.h F: app/test/process.h +F: app/test/process.c F: app/test/test.c F: app/test/test.h F: app/test/test_pmd_perf.c
app/test/meson.build +4 -0
@@ -5,6 +5,10 @@ deps += ['cmdline', 'ring', 'mempool', 'mbuf'] sources += files('commands.c', 'test.c') +if not is_windows + sources += files('process.c') +endif + # optional dependencies: some files may use these - and so we should link them in - # but do not explicitly require them so they are not listed in the per-file lists below optional_deps = ['crypto_scheduler', 'lpm']
app/test/process.c new file +229 -0
229 lines not on this page · raw message
app/test/process.h +9 -219
243 lines not on this page · raw message
app/test/test_pdump.h +3 -0
@@ -11,6 +11,9 @@/* sample test to send packets to the pdump client recursively */ uint32_t send_pkts (void *empty); +/* flag to stop send_pkts thread */ +extern uint16_t flag_for_send_pkts; +/* Sample test to create setup for the pdump server tests */ int test_pdump_init (void );
Signature · 1 line
2.54.0
PATCH v2 4/9 test/bonding: get MAC address with public API
In reply to David MarchandReplace direct rte_eth_devices[].data->mac_addrs access with rte_eth_macaddr_get() public API. This removes the dependency on the internal ethdev_driver.h header.
--- app/test/test_link_bonding.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-)
app/test/test_link_bonding.c +13 -22
@@ -19,7 +19,6 @@#include <rte_common.h> #include <rte_debug.h> #include <rte_ethdev.h> -#include <ethdev_driver.h> #include <rte_log.h> #include <rte_lcore.h> #include <rte_memory.h>
@@ -4763,7 +4762,7 @@ test_alb_change_mac_in_reply_sent(void)int retval =0 ;struct rte_ether_addr bond_mac, client_mac; -struct rte_ether_addr *member_mac1, *member_mac2; +struct rte_ether_addr member_mac1, member_mac2; TEST_ASSERT_SUCCESS( initialize_bonding_device_with_members(BONDING_MODE_ALB,
@@ -4779,9 +4778,7 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating four packets with different mac and ip addresses and sending
@@ -4831,10 +4828,8 @@ test_alb_change_mac_in_reply_sent(void) RTE_ARP_OP_REPLY);rte_eth_tx_burst (test_params->bonding_port_id,0 , &pkt,1 ); - member_mac1 = - rte_eth_devices[test_params->member_port_ids[0 ]].data->mac_addrs; - member_mac2 = - rte_eth_devices[test_params->member_port_ids[1 ]].data->mac_addrs; +rte_eth_macaddr_get (test_params->member_port_ids[0 ], &member_mac1); +rte_eth_macaddr_get (test_params->member_port_ids[1 ], &member_mac2);/* * Checking if packets are properly distributed on bonding ports. Packets
@@ -4852,13 +4847,13 @@ test_alb_change_mac_in_reply_sent(void) sizeof(struct rte_ether_hdr));if (member_idx%2 ==0 ) { -if (!rte_is_same_ether_addr (member_mac1, +if (!rte_is_same_ether_addr (&member_mac1, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end; } }else { -if (!rte_is_same_ether_addr (member_mac2, +if (!rte_is_same_ether_addr (&member_mac2, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end;
@@ -4885,7 +4880,7 @@ test_alb_reply_from_client(void)int retval =0 ;struct rte_ether_addr bond_mac, client_mac; -struct rte_ether_addr *member_mac1, *member_mac2; +struct rte_ether_addr member_mac1, member_mac2; TEST_ASSERT_SUCCESS( initialize_bonding_device_with_members(BONDING_MODE_ALB,
@@ -4900,9 +4895,7 @@ test_alb_reply_from_client(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating four packets with different mac and ip addresses and placing
@@ -4963,8 +4956,8 @@ test_alb_reply_from_client(void)rte_eth_rx_burst (test_params->bonding_port_id,0 , pkts_sent,MAX_PKT_BURST );rte_eth_tx_burst (test_params->bonding_port_id,0 ,NULL ,0 ); - member_mac1 = rte_eth_devices[test_params->member_port_ids[0 ]].data->mac_addrs; - member_mac2 = rte_eth_devices[test_params->member_port_ids[1 ]].data->mac_addrs; +rte_eth_macaddr_get (test_params->member_port_ids[0 ], &member_mac1); +rte_eth_macaddr_get (test_params->member_port_ids[1 ], &member_mac2);/* * Checking if update ARP packets were properly send on member ports.
@@ -4981,13 +4974,13 @@ test_alb_reply_from_client(void) sizeof(struct rte_ether_hdr));if (member_idx%2 ==0 ) { -if (!rte_is_same_ether_addr (member_mac1, +if (!rte_is_same_ether_addr (&member_mac1, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end; } }else { -if (!rte_is_same_ether_addr (member_mac2, +if (!rte_is_same_ether_addr (&member_mac2, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end;
@@ -5035,9 +5028,7 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating packet with double VLAN header and placing it in the rx queue.
Signature · 1 line
2.54.0
Re: [PATCH v2 4/9] test/bonding: get MAC address with public API
Quoted 6 lines · David Marchand
Replace direct rte_eth_devices[].data->mac_addrs access with
rte_eth_macaddr_get()public API. This removes the dependency on the internalethdev_driver.hheader.Signed-off-by David Marchand <[email protected]>---
PATCH v2 5/9 test/devargs: rely on net null driver
In reply to David MarchandThe net/null driver is enabled in all our tests builds in the CI. Standardize on using net/null instead of net/ring.
This also removes use of an internal API.
---
Changes since v1:
- dropped dependency on net/ring, used net/null instead,
--- app/test/test_devargs.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
app/test/test_devargs.c +4 -15
@@ -10,7 +10,7 @@#include <rte_common.h> #include <rte_devargs.h> #include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_class.h> #include "test.h"
@@ -160,22 +160,11 @@ test_valid_devargs(void) "pci", "1:2.3", NULL }, {"pci:1:2.3,k0=v0" , 0, 0, 1, "pci", "1:2.3", NULL }, + { "net_null0", + 0, 0, 0, "vdev", "net_null0", NULL }, }; -static const struct devargs_case legacy_ring_list[] = { - {"net_ring0" , -0 ,0 ,0 ,"vdev" ,"net_ring0" ,NULL }, - {"net_ring0,iface=test,path=/class/bus/,queues=1" , -0 ,0 ,3 ,"vdev" ,"net_ring0" ,NULL }, - }; -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); -int ret; - ret =test_valid_devargs_cases (list,RTE_DIM (list)); -if (vdev_bus !=NULL && vdev_bus->parse ("net_ring0" ,NULL ) ==0 ) -/* Ring vdev driver enabled. */ - ret |=test_valid_devargs_cases (legacy_ring_list, -RTE_DIM (legacy_ring_list)); -return ret; +return test_valid_devargs_cases (list,RTE_DIM (list)); }/* Test several invalid cases */
Signature · 1 line
2.54.0
Re: [PATCH v2 5/9] test/devargs: rely on net null driver
Quoted 5 lines · David Marchand
The net/null driver is enabled in all our tests builds in the CI. Standardize on using net/null instead of net/ring.
This also removes use of an internal API.
Quoted 9 lines
Signed-off-by David Marchand <[email protected]>---
Changes since v1:
- dropped dependency on net/ring, used net/null instead,--- app/test/test_devargs.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
PATCH v2 6/9 test/vdev: find device with public API
In reply to David MarchandChecking internal API has little sense as users are not supposed to call those.
Use public API to achieve similar coverage.
--- app/test/test_vdev.c | 85 ++++++++------------------------------------ 1 file changed, 15 insertions(+), 70 deletions(-)
app/test/test_vdev.c +15 -70
@@ -2,69 +2,26 @@* Copyright 2021 6WIND S.A. */ -#include <stdlib.h> #include <stdio.h> #include <string.h> -#include <rte_common.h> #include <rte_dev.h> -#include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_bus_vdev.h> #include "test.h" -#define TEST_VDEV_KEY_NAME "name" - -static const char *const valid_keys[] = { -TEST_VDEV_KEY_NAME , -NULL , -}; - -static int -cmp_dev_name (const struct rte_device *dev,const void *name) -{ -return strcmp (rte_dev_name (dev), name); -} - -static int -cmp_dev_match (const struct rte_device *dev,const void *_kvlist) -{ -const struct rte_kvargs *kvlist = _kvlist; -const char *key =TEST_VDEV_KEY_NAME ; -const char *name; - -/* no kvlist arg, all devices match */ -if (kvlist ==NULL ) -return 0 ; - -/* if key is present in kvlist and does not match, filter device */ - name =rte_kvargs_get (kvlist, key); -if (name !=NULL &&strcmp (name,rte_dev_name (dev)) !=0 ) -return -1 ; - -return 0 ; -} -static struct rte_device * -get_matching_vdev (const char *match_str) +find_vdev_by_name (const char *name) { -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); -struct rte_kvargs *kvargs =NULL ; +struct rte_dev_iterator it = {0 };struct rte_device *dev; -if (match_str !=NULL ) { - kvargs =rte_kvargs_parse (match_str, valid_keys); -if (kvargs ==NULL ) { -printf ("Failed to parse match string\n" ); -return NULL ; - } + RTE_DEV_FOREACH(dev, "bus=vdev", &it) { +if (strcmp (rte_dev_name (dev), name) ==0 ) +return dev; } - - dev = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_match, kvargs); -rte_kvargs_free (kvargs); - -return dev; +return NULL ; } static int
@@ -83,7 +40,7 @@ test_vdev_bus(void)printf ("Failed to create vdev net_null_test0\n" ); goto fail; } - dev0 = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_name,"net_null_test0" ); + dev0 =find_vdev_by_name ("net_null_test0" );if (dev0 ==NULL ) {printf ("Cannot find net_null_test0 vdev\n" ); goto fail;
@@ -94,44 +51,32 @@ test_vdev_bus(void)printf ("Failed to create vdev net_null_test1\n" ); goto fail; } - dev1 = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_name,"net_null_test1" ); + dev1 =find_vdev_by_name ("net_null_test1" );if (dev1 ==NULL ) {printf ("Cannot find net_null_test1 vdev\n" ); goto fail; } -/* try to match vdevs */ - dev =get_matching_vdev ("name=net_null_test0" ); +/* try to find vdevs */ + dev =find_vdev_by_name ("net_null_test0" );if (dev != dev0) {printf ("Cannot match net_null_test0 vdev\n" ); goto fail; } - dev =get_matching_vdev ("name=net_null_test1" ); + dev =find_vdev_by_name ("net_null_test1" );if (dev != dev1) {printf ("Cannot match net_null_test1 vdev\n" ); goto fail; } - dev =get_matching_vdev ("name=unexistant" ); + dev =find_vdev_by_name ("nonexistent" );if (dev !=NULL ) { -printf ("Unexistant vdev should not match\n" ); - goto fail; - } - - dev =get_matching_vdev ("" ); -if (dev ==NULL || dev == dev1) { -printf ("Cannot match any vdev with empty match string\n" ); - goto fail; - } - - dev =get_matching_vdev (NULL ); -if (dev ==NULL || dev == dev1) { -printf ("Cannot match any vdev with NULL match string\n" ); +printf ("Nonexistent vdev should not match\n" ); goto fail; } -/* iterate all vdevs, and ensure we find vdev0 and vdev1 */ +/* iterate all vdevs, and ensure we find dev0 and dev1 */ RTE_DEV_FOREACH(dev, "bus=vdev", &dev_iter) {if (dev == dev0) dev0 =NULL ;
Signature · 1 line
2.54.0
Re: [PATCH v2 6/9] test/vdev: find device with public API
Quoted 9 lines · David Marchand
Checking internal API has little sense as users are not supposed to call those.
Use public API to achieve similar coverage.Signed-off-by David Marchand <[email protected]>--- app/test/test_vdev.c | 85 ++++++++------------------------------------ 1 file changed, 15 insertions(+), 70 deletions(-)
PATCH v2 7/9 test: limit internal API usage
In reply to David MarchandInternal APIs may be used for validating the internals of some component, but in general, it should be discouraged.
Let's not allow globally internal API in the unit tests.
--- app/test/meson.build | 3 --- app/test/process.c | 2 ++ app/test/test_devargs.c | 2 ++ app/test/test_external_mem.c | 2 ++ app/test/test_malloc.c | 2 ++ app/test/test_mempool.c | 2 ++ app/test/test_pdump.c | 3 +++ app/test/virtual_pmd.c | 2 ++ 8 files changed, 15 insertions(+), 3 deletions(-)
app/test/meson.build +0 -3
@@ -286,9 +286,6 @@ foreach arg: extra_flags endif endforeach -# Enable using internal APIs in unit tests -cflags += '-DALLOW_INTERNAL_API' - # create a symlink in the app/test directory for the binary, for backward compatibility if not is_windows custom_target('test_symlink',
app/test/process.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <errno.h> /* errno */ #include <limits.h> /* PATH_MAX */ #ifndef RTE_EXEC_ENV_WINDOWS
app/test/test_devargs.c +2 -0
@@ -2,6 +2,8 @@* Copyright (c) 2021 NVIDIA Corporation & Affiliates */ +#define ALLOW_INTERNAL_API +#include <stdlib.h> #include <stdio.h> #include <string.h>
app/test/test_external_mem.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2018 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include "test.h" #include <errno.h>
app/test/test_malloc.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2019 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include "test.h" #include <stdio.h>
app/test/test_mempool.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <string.h> #include <stdio.h> #include <stdlib.h>
app/test/test_pdump.c +3 -0
@@ -1,6 +1,9 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2018 Intel Corporation */ + +#define ALLOW_INTERNAL_API +#include <stdio.h> #include <unistd.h> #include <stdint.h>
app/test/virtual_pmd.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <rte_mbuf.h> #include <rte_ethdev.h> #include <ethdev_driver.h>
Signature · 1 line
2.54.0
Re: [PATCH v2 7/9] test: limit internal API usage
Quoted 6 lines · David Marchand
Internal APIs may be used for validating the internals of some component, but in general, it should be discouraged.
Let's not allow globally internal API in the unit tests.
Signed-off-by David Marchand <[email protected]>
Quoted 11 lines
--- app/test/meson.build | 3 --- app/test/process.c | 2 ++ app/test/test_devargs.c | 2 ++ app/test/test_external_mem.c | 2 ++ app/test/test_malloc.c | 2 ++ app/test/test_mempool.c | 2 ++ app/test/test_pdump.c | 3 +++ app/test/virtual_pmd.c | 2 ++ 8 files changed, 15 insertions(+), 3 deletions(-)
RE: [PATCH v2 7/9] test: limit internal API usage
In reply to David MarchandQuoted 10 lines
From: David Marchand [mailto:[email protected]]
Sent: Thursday, 23 July 2026 14.56Internal APIs may be used for validating the internals of some component, but in general, it should be discouraged.
Let's not allow globally internal API in the unit tests.
Signed-off-by David Marchand <[email protected]>---
PATCH v2 8/9 ci: make ABI reference generation faster
In reply to David MarchandRegenerating ABI is not something we do often, but when working on ABI topics, a lot of time may be wasted on waiting for the reference being generated.
We only care about shared libraries, avoid building final applications or examples.
And we don't need to double check headers in the ABI reference.
--- .ci/linux-build.sh | 11 ++++++++++- devtools/test-meson-builds.sh | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-)
.ci/linux-build.sh +10 -1
@@ -201,9 +201,18 @@ if [ "$ABI_CHECKS" = "true" ]; then fi if [ ! -d reference ]; then + REF_OPTS="$OPTS" + # We only care about the drivers and libs, disable developer checks and + # don't try to link apps. + REF_OPTS="$REF_OPTS -Dcheck_includes=false" + REF_OPTS="$REF_OPTS -Ddeveloper_mode=disabled" + REF_OPTS="$REF_OPTS -Ddisable_apps=*" + REF_OPTS="$REF_OPTS -Denable_docs=false" + REF_OPTS="$REF_OPTS -Dexamples=" + REF_OPTS="$REF_OPTS -Dtests=false" refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG) git clone --single-branch -b "$REF_GIT_TAG" $REF_GIT_REPO $refsrcdir - meson setup $OPTS -Dexamples= $refsrcdir $refsrcdir/build + meson setup $REF_OPTS $refsrcdir $refsrcdir/build ninja -C $refsrcdir/build DESTDIR=$(pwd)/reference meson install -C $refsrcdir/build find reference/usr/local -name '*.a' -delete
devtools/test-meson-builds.sh +4 -1
@@ -206,8 +206,11 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options] fi rm -rf $abirefdir/build + # We only care about the drivers and libs, disable + # developer checks and don't try to link apps. config $abirefdir/src $abirefdir/build ABI $cross \ - -Dexamples= $* + $* -Dcheck_includes=false -Ddeveloper_mode=disabled \ + -Ddisable_apps=* -Dexamples= -Dtests=false compile $abirefdir/build install_target $abirefdir/build $abirefdir/$targetdir
Signature · 1 line
2.54.0
Re: [PATCH v2 8/9] ci: make ABI reference generation faster
Quoted 21 lines · David Marchand
Regenerating ABI is not something we do often, but when working on ABI topics, a lot of time may be wasted on waiting for the reference being generated.
We only care about shared libraries, avoid building final applications or examples.
And we don't need to double check headers in the ABI reference.Signed-off-by David Marchand <[email protected]>--- .ci/linux-build.sh | 11 ++++++++++- devtools/test-meson-builds.sh | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-).ci/linux-build.sh +0
-0@@ -201,9 +201,18 @@ if [ "$ABI_CHECKS" = "true" ]; then fi
.ci/linux-build.sh if [ "$ABI_CHECKS" = "true" ]; then · line 212
Quoted 10 lines
.ci/linux-build.sh +9
-0if [ ! -d reference ]; then + REF_OPTS="$OPTS" + # We only care about the drivers and libs, disable developer checks and + # don't try to link apps. + REF_OPTS="$REF_OPTS -Dcheck_includes=false" + REF_OPTS="$REF_OPTS -Ddeveloper_mode=disabled" + REF_OPTS="$REF_OPTS -Ddisable_apps=*" + REF_OPTS="$REF_OPTS -Denable_docs=false" + REF_OPTS="$REF_OPTS -Dexamples=" + REF_OPTS="$REF_OPTS -Dtests=false"
Minor nit, but this shouldn't be necessary, as it will now be covered under the disable_apps wildcard AFAIK.
A number of these are already the default, but I suppose explicitly stating them is harmless (as is setting tests=false).
Quoted 14 lines
.ci/linux-build.sh +1
-1refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG) git clone --single-branch -b "$REF_GIT_TAG" $REF_GIT_REPO $refsrcdir - meson setup $OPTS -Dexamples= $refsrcdir $refsrcdir/build + meson setup $REF_OPTS $refsrcdir $refsrcdir/build ninja -C $refsrcdir/build DESTDIR=$(pwd)/reference meson install -C $refsrcdir/build find reference/usr/local -name '*.a' -deletedevtools/test-meson-builds.sh +0
-0@@ -206,8 +206,11 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options] fi
devtools/test-meson-builds.sh build () # <directory> <target cc | cross file> <ABI check> [meson options] · line 216
Quoted 10 lines
devtools/test-meson-builds.sh +4
-1rm -rf $abirefdir/build + # We only care about the drivers and libs, disable + # developer checks and don't try to link apps. config $abirefdir/src $abirefdir/build ABI $cross \ - -Dexamples= $* + $* -Dcheck_includes=false -Ddeveloper_mode=disabled \ + -Ddisable_apps=* -Dexamples= -Dtests=false compile $abirefdir/build install_target $abirefdir/build $abirefdir/$targetdir
PATCH v2 9/9 ci: run reference binaries against current ABI
In reply to David MarchandLet's check if a testpmd and unit tests from a reference build can run with the current release libraries/drivers.
This gives another level of ABI checking, like catching regressions on experimental or internal ABI symbols that get promoted to stable.
We may need to skip unit tests that were added since the reference. So add a ABI_SKIP_TESTS environment variable in preparation.
---
Changes since v1:
- dropped hack, testing this patch can't be done in the CI now,
- emptied the excluded tests list,
- added test-null.sh,
--- .ci/linux-build.sh | 33 ++++++++++++++++++++++++++++++--- .github/workflows/build.yml | 1 + 2 files changed, 31 insertions(+), 3 deletions(-)
.ci/linux-build.sh +30 -3
@@ -206,23 +206,33 @@ if [ "$ABI_CHECKS" = "true" ]; then # don't try to link apps. REF_OPTS="$REF_OPTS -Dcheck_includes=false" REF_OPTS="$REF_OPTS -Ddeveloper_mode=disabled" - REF_OPTS="$REF_OPTS -Ddisable_apps=*" + REF_OPTS="$REF_OPTS -Denable_apps=test,test-pmd" REF_OPTS="$REF_OPTS -Denable_docs=false" REF_OPTS="$REF_OPTS -Dexamples=" - REF_OPTS="$REF_OPTS -Dtests=false" refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG) git clone --single-branch -b "$REF_GIT_TAG" $REF_GIT_REPO $refsrcdir meson setup $REF_OPTS $refsrcdir $refsrcdir/build ninja -C $refsrcdir/build DESTDIR=$(pwd)/reference meson install -C $refsrcdir/build find reference/usr/local -name '*.a' -delete - rm -rf reference/usr/local/bin + rm -rf reference/usr/local/bin/* + cp $refsrcdir/build/app/dpdk-test reference/usr/local/bin/dpdk-test + cp $refsrcdir/build/app/dpdk-testpmd reference/usr/local/bin/dpdk-testpmd rm -rf reference/usr/local/share echo $REF_GIT_TAG > reference/VERSION fi DESTDIR=$(pwd)/install meson install -C build devtools/check-abi.sh reference install ${ABI_CHECKS_WARN_ONLY:-} + + failed= + configure_coredump + mv -f build/app/dpdk-testpmd build/app/dpdk-testpmd.ori + cp reference/usr/local/bin/dpdk-testpmd build/app/dpdk-testpmd + devtools/test-null.sh || failed="true" + mv -f build/app/dpdk-testpmd.ori build/app/dpdk-testpmd + catch_coredump + [ "$failed" != "true" ] fi if [ "$RUN_TESTS" = "true" ]; then
@@ -233,6 +243,23 @@ if [ "$RUN_TESTS" = "true" ]; then catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt check_traces [ "$failed" != "true" ] + + if [ "$ABI_CHECKS" = "true" ]; then + failed= + configure_coredump + mv -f build/app/dpdk-test build/app/dpdk-test.ori + cp reference/usr/local/bin/dpdk-test build/app/dpdk-test + for t in ${ABI_SKIP_TESTS}; do + DPDK_TEST_SKIP=${DPDK_TEST_SKIP+$DPDK_TEST_SKIP,}$t + done + sudo env DPDK_TEST_SKIP="$DPDK_TEST_SKIP" \ + meson test -C build --suite fast-tests -t 3 --no-stdsplit --print-errorlogs || failed="true" + catch_coredump + catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt + check_traces + mv -f build/app/dpdk-test.ori build/app/dpdk-test + [ "$failed" != "true" ] + fi fi # Test examples compilation with an installed dpdk
.github/workflows/build.yml +1 -0
@@ -39,6 +39,7 @@ jobs: env: AARCH64: ${{ matrix.config.cross == 'aarch64' }} ABI_CHECKS: ${{ contains(matrix.config.checks, 'abi') }} + ABI_SKIP_TESTS: none ASAN: ${{ contains(matrix.config.checks, 'asan') }} BUILD_32BIT: ${{ matrix.config.cross == 'i386' }} BUILD_DEBUG: ${{ contains(matrix.config.checks, 'debug') }}
Signature · 1 line
2.54.0
Re: [PATCH v2 9/9] ci: run reference binaries against current ABI
Quoted 9 lines · David Marchand
Let's check if a testpmd and unit tests from a reference build can run with the current release libraries/drivers.
This gives another level of ABI checking, like catching regressions on experimental or internal ABI symbols that get promoted to stable.
We may need to skip unit tests that were added since the reference. So add a
ABI_SKIP_TESTSenvironment variable in preparation.
Quoted 8 lines
Signed-off-by David Marchand <[email protected]>---
Changes since v1:
- dropped hack, testing this patch can't be done in the CI now,
- emptied the excluded tests list,
- addedtest-null.sh,---
This is a good test to run. It's something I believe our internal validation team does at times too. Some comments inline below, nothing major though.
Quoted 9 lines
.ci/linux-build.sh | 33 ++++++++++++++++++++++++++++++--- .github/workflows/build.yml | 1 + 2 files changed, 31 insertions(+), 3 deletions(-).ci/linux-build.sh +0
-0
.ci/linux-build.sh if [ "$ABI_CHECKS" = "true" ]; then · line 212
Quoted 8 lines
.ci/linux-build.sh +1
-2@@ -206,23 +206,33 @@ if [ "$ABI_CHECKS" = "true" ]; then # don't try to link apps. REF_OPTS="$REF_OPTS -Dcheck_includes=false" REF_OPTS="$REF_OPTS -Ddeveloper_mode=disabled" - REF_OPTS="$REF_OPTS -Ddisable_apps=*" + REF_OPTS="$REF_OPTS -Denable_apps=test,test-pmd" REF_OPTS="$REF_OPTS -Denable_docs=false" REF_OPTS="$REF_OPTS -Dexamples=" - REF_OPTS="$REF_OPTS -Dtests=false"
These changes should go in the previous patch, I think - certainly you can drop the tests=false one, since it should be a no-op.
.ci/linux-build.sh if [ "$ABI_CHECKS" = "true" ]; then · line 220
Quoted 10 lines
.ci/linux-build.sh +3
-1refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG) git clone --single-branch -b "$REF_GIT_TAG" $REF_GIT_REPO $refsrcdir meson setup $REF_OPTS $refsrcdir $refsrcdir/build ninja -C $refsrcdir/build DESTDIR=$(pwd)/reference meson install -C $refsrcdir/build find reference/usr/local -name '*.a' -delete - rm -rf reference/usr/local/bin + rm -rf reference/usr/local/bin/* + cp $refsrcdir/build/app/dpdk-test reference/usr/local/bin/dpdk-test + cp $refsrcdir/build/app/dpdk-testpmd reference/usr/local/bin/dpdk-testpmd
At this point I'd suggest running "meson test --list --suite=fast-tests" to get the list of available tests in the reference implementation.
Quoted 21 lines
.ci/linux-build.sh +9
-0rm -rf reference/usr/local/share echo $REF_GIT_TAG > reference/VERSION fi DESTDIR=$(pwd)/install meson install -C build devtools/check-abi.sh reference install ${ABI_CHECKS_WARN_ONLY:-} + + failed= + configure_coredump + mv -f build/app/dpdk-testpmd build/app/dpdk-testpmd.ori + cp reference/usr/local/bin/dpdk-testpmd build/app/dpdk-testpmd + devtools/test-null.sh || failed="true" + mv -f build/app/dpdk-testpmd.ori build/app/dpdk-testpmd + catch_coredump + [ "$failed" != "true" ] fi if [ "$RUN_TESTS" = "true" ]; then@@ -233,6 +243,23 @@ if [ "$RUN_TESTS" = "true" ]; then catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt check_traces
.ci/linux-build.sh if [ "$RUN_TESTS" = "true" ]; then · line 254
Quoted 10 lines
.ci/linux-build.sh +9
-0[ "$failed" != "true" ] + + if [ "$ABI_CHECKS" = "true" ]; then + failed= + configure_coredump + mv -f build/app/dpdk-test build/app/dpdk-test.ori + cp reference/usr/local/bin/dpdk-test build/app/dpdk-test + for t in ${ABI_SKIP_TESTS}; do + DPDK_TEST_SKIP=${DPDK_TEST_SKIP+$DPDK_TEST_SKIP,}$t + done
As well as the ABI_SKIP_TESTS, you could automate the list by again running "meson test --list --suite..." and then only running the tests in both lists. [using "sort" and "uniq -d" perhaps?]
Quoted 26 lines
.ci/linux-build.sh +8
-0+ sudo env DPDK_TEST_SKIP="$DPDK_TEST_SKIP" \ + meson test -C build --suite fast-tests -t 3 --no-stdsplit --print-errorlogs || failed="true" + catch_coredump + catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt + check_traces + mv -f build/app/dpdk-test.ori build/app/dpdk-test + [ "$failed" != "true" ] + fi fi # Test examples compilation with an installed dpdk.github/workflows/build.yml +1
-0@@ -39,6 +39,7 @@ jobs: env: AARCH64: ${{ matrix.config.cross == 'aarch64' }} ABI_CHECKS: ${{ contains(matrix.config.checks, 'abi') }} + ABI_SKIP_TESTS: none ASAN: ${{ contains(matrix.config.checks, 'asan') }} BUILD_32BIT: ${{ matrix.config.cross == 'i386' }} BUILD_DEBUG: ${{ contains(matrix.config.checks, 'debug') }}Signature · 1 line
2.54.0
v3 cover Limit usage of internal API in tests
In reply to David MarchandWe had a few bug reports related to internal (and experimental) symbols issues during 26.07 development.
See for example https://bugs.dpdk.org/show_bug.cgi?id=1957 or more recently https://bugs.dpdk.org/show_bug.cgi?id=1967.
To catch such issues earlier in the CI, this series proposes to run the unit tests through meson with the ABI reference unit test binary against the current ABI libraries and drivers.
For this to work, some unit tests must be skipped (since meson may invoke the ABI reference code with tests that were unknown at the time).
A few unit tests were directly dereferencing internal structures and are reworked so they use public APIs.
Additionally, unit tests were allowed to use any internal API which has hidden a few issues (like a public API backed by internal symbols in the hash library).
So disable the global ALLLOW_INTERNAL_API and move it to code explicitly requiring internal API, with the hope it will push us to have better API.
The last patch contains a hack for now, where the cached ABI reference is force regenerated with a branch of mine where I backported the fixes of this series.
Signature · 49 lines
David Marchand Changes since v2: - automated tests list generation in last patch, Changes since v1: - rebased, - dropped patch 1 on bbdev, - dropped dependency on net/ring in devargs test, - removed hacks from last patch, flushed excluded tests list, added test-null.sh check, David Marchand (9): bbdev: add per-queue statistics API hash: fix GFNI stubs export test: uninline helper for forking test/bonding: get MAC address with public API test/devargs: rely on net null driver test/vdev: find device with public API test: limit internal API usage ci: make ABI reference generation faster ci: run reference binaries against current ABI .ci/linux-build.sh | 41 ++++- MAINTAINERS | 1 + app/test-bbdev/test_bbdev_perf.c | 38 +--- app/test/meson.build | 7 +- app/test/process.c | 231 +++++++++++++++++++++++++ app/test/process.h | 228 +----------------------- app/test/test_devargs.c | 21 +-- app/test/test_external_mem.c | 2 + app/test/test_link_bonding.c | 35 ++-- app/test/test_malloc.c | 2 + app/test/test_mempool.c | 2 + app/test/test_pdump.c | 3 + app/test/test_pdump.h | 3 + app/test/test_vdev.c | 85 ++------- app/test/virtual_pmd.c | 2 + devtools/test-meson-builds.sh | 5 +- doc/guides/rel_notes/release_26_11.rst | 5 + lib/bbdev/rte_bbdev.c | 20 +++ lib/bbdev/rte_bbdev.h | 20 +++ lib/hash/rte_thash_gfni.c | 4 +- lib/hash/rte_thash_gfni.h | 2 - 21 files changed, 390 insertions(+), 367 deletions(-) create mode 100644 app/test/process.c -- 2.54.0
PATCH v3 1/9 bbdev: add per-queue statistics API
Add rte_bbdev_queue_stats_get() to retrieve statistics for a specific queue. This allows applications to get per-queue stats without accessing internal data structures.
Update test-bbdev to use the new API.
--- app/test-bbdev/test_bbdev_perf.c | 38 +++++--------------------- doc/guides/rel_notes/release_26_11.rst | 5 ++++ lib/bbdev/rte_bbdev.c | 20 ++++++++++++++ lib/bbdev/rte_bbdev.h | 20 ++++++++++++++ 4 files changed, 52 insertions(+), 31 deletions(-)
app/test-bbdev/test_bbdev_perf.c +7 -31
@@ -5849,30 +5849,6 @@ validation_test(struct active_device *ad, struct test_op_params *op_params)return validation_latency_test (ad, op_params, false); } -static int -get_bbdev_queue_stats (uint16_t dev_id,uint16_t queue_id, -struct rte_bbdev_stats *stats) -{ -struct rte_bbdev *dev = &rte_bbdev_devices[dev_id]; -struct rte_bbdev_stats *q_stats; - -if (queue_id >= dev->data->num_queues) -return -1 ; - - q_stats = &dev->data->queues[queue_id].queue_stats; - - stats->enqueued_count = q_stats->enqueued_count; - stats->dequeued_count = q_stats->dequeued_count; - stats->enqueue_err_count = q_stats->enqueue_err_count; - stats->dequeue_err_count = q_stats->dequeue_err_count; - stats->enqueue_warn_count = q_stats->enqueue_warn_count; - stats->dequeue_warn_count = q_stats->dequeue_warn_count; - stats->acc_offload_cycles = q_stats->acc_offload_cycles; - stats->enqueue_depth_avail = q_stats->enqueue_depth_avail; - -return 0 ; -} - static int offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs, struct rte_bbdev_fft_op *ref_op, uint16_t dev_id,
@@ -5906,7 +5882,7 @@ offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs, &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -5988,7 +5964,7 @@ offload_latency_test_mldts(struct rte_mempool *mempool, struct test_buffers *buf &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6069,7 +6045,7 @@ offload_latency_test_dec(struct rte_mempool *mempool, struct test_buffers *bufs, &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6163,7 +6139,7 @@ offload_latency_test_ldpc_dec(struct rte_mempool *mempool, }while (unlikely (burst_sz != enq)); enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6251,7 +6227,7 @@ offload_latency_test_enc(struct rte_mempool *mempool, struct test_buffers *bufs, enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6332,7 +6308,7 @@ offload_latency_test_ldpc_enc(struct rte_mempool *mempool, }while (unlikely (burst_sz != enq)); enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6482,7 +6458,7 @@ offload_cost_test(struct active_device *ad, rte_get_tsc_hz());struct rte_bbdev_stats stats = {0 }; - ret =get_bbdev_queue_stats (ad->dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (ad->dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, ad->dev_id);
doc/guides/rel_notes/release_26_11.rst +5 -0
@@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added per-queue statistics API in bbdev.** + + Added ``rte_bbdev_queue_stats_get()`` function to retrieve statistics + for a specific queue, complementing the existing device-level statistics API. + Removed Items -------------
lib/bbdev/rte_bbdev.c +20 -0
@@ -815,6 +815,26 @@ rte_bbdev_stats_reset(uint16_t dev_id)return 0 ; } +RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_bbdev_queue_stats_get, 26.07) +int rte_bbdev_queue_stats_get (uint16_t dev_id,uint16_t queue_id,struct rte_bbdev_stats *stats) +{ +struct rte_bbdev *dev =get_dev (dev_id); + +VALID_DEV_OR_RET_ERR (dev, dev_id); +VALID_QUEUE_OR_RET_ERR (queue_id, dev); + +if (stats ==NULL ) { +rte_bbdev_log (ERR ,"NULL stats structure" ); +return -EINVAL ; + } + + *stats = dev->data->queues[queue_id].queue_stats; + +rte_bbdev_log_debug ("Retrieved stats for queue %u of device %u" , + queue_id, dev_id); +return 0 ; +} +RTE_EXPORT_SYMBOL (rte_bbdev_info_get) intrte_bbdev_info_get (uint16_t dev_id,struct rte_bbdev_info *dev_info)
lib/bbdev/rte_bbdev.h +20 -0
@@ -316,6 +316,26 @@ rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats);int rte_bbdev_stats_reset (uint16_t dev_id); +/** +* Retrieve the statistics of a specific queue. +* +* @param dev_id +* The identifier of the device. +* @param queue_id +* The index of the queue. +* @param stats +* Pointer to structure to where statistics will be copied. On error, this +* location may or may not have been modified. +* +* @return +* - 0 on success +* - -ENODEV if dev_id is invalid +* - -EINVAL if stats is NULL +* - -ERANGE if queue_id is out of range +*/ +__rte_experimental +int rte_bbdev_queue_stats_get(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_stats *stats); +/** Device information supplied by the device's driver */ /* Structure rte_bbdev_driver_info 8< */
Signature · 1 line
2.54.0
PATCH v3 2/9 hash: fix GFNI stubs export
In reply to David MarchandInternal symbols *can not* be called as part of public ABI. The GFNI stubs must be exported so that an application may call them through the (inlined) GFNI API without requiring ALLOW_INTERNAL_API.
--- lib/hash/rte_thash_gfni.c | 4 ++-- lib/hash/rte_thash_gfni.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
lib/hash/rte_thash_gfni.c +2 -2
@@ -13,7 +13,7 @@ RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO);#define HASH_LOG (level, ...) \ RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) -RTE_EXPORT_INTERNAL_SYMBOL (rte_thash_gfni_stub) +RTE_EXPORT_SYMBOL (rte_thash_gfni_stub) uint32_t rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused, const uint8_t *key __rte_unused, int len __rte_unused)
@@ -29,7 +29,7 @@ rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused,return 0 ; } -RTE_EXPORT_INTERNAL_SYMBOL(rte_thash_gfni_bulk_stub) +RTE_EXPORT_SYMBOL(rte_thash_gfni_bulk_stub) void rte_thash_gfni_bulk_stub(const uint64_t *mtrx __rte_unused, int len __rte_unused, uint8_t *tuple[] __rte_unused,
lib/hash/rte_thash_gfni.h +0 -2
@@ -22,11 +22,9 @@ extern "C" {* @internal * Stubs only used when GFNI is not available. */ -__rte_internal uint32_t rte_thash_gfni_stub (const uint64_t *mtrx,const uint8_t *key,int len); -__rte_internal void rte_thash_gfni_bulk_stub (const uint64_t *mtrx,int len,uint8_t *tuple[],uint32_t val[],uint32_t num);
Signature · 1 line
2.54.0
PATCH v3 3/9 test: uninline helper for forking
In reply to David MarchandThere is no reason to keep those helpers inlined.
Besides, this code relies on internal API. So any consumer of process.h requires internal API.
Move this code in process.c.
--- MAINTAINERS | 1 + app/test/meson.build | 4 + app/test/process.c | 229 ++++++++++++++++++++++++++++++++++++++++++ app/test/process.h | 228 ++--------------------------------------- app/test/test_pdump.h | 3 + 5 files changed, 246 insertions(+), 219 deletions(-) create mode 100644 app/test/process.c
MAINTAINERS +1 -0
@@ -1945,6 +1945,7 @@ F: app/test/commands.c F: app/test/packet_burst_generator.c F: app/test/packet_burst_generator.h F: app/test/process.h +F: app/test/process.c F: app/test/test.c F: app/test/test.h F: app/test/test_pmd_perf.c
app/test/meson.build +4 -0
@@ -5,6 +5,10 @@ deps += ['cmdline', 'ring', 'mempool', 'mbuf'] sources += files('commands.c', 'test.c') +if not is_windows + sources += files('process.c') +endif + # optional dependencies: some files may use these - and so we should link them in - # but do not explicitly require them so they are not listed in the per-file lists below optional_deps = ['crypto_scheduler', 'lpm']
app/test/process.c new file +229 -0
229 lines not on this page · raw message
app/test/process.h +9 -219
243 lines not on this page · raw message
app/test/test_pdump.h +3 -0
@@ -11,6 +11,9 @@/* sample test to send packets to the pdump client recursively */ uint32_t send_pkts (void *empty); +/* flag to stop send_pkts thread */ +extern uint16_t flag_for_send_pkts; +/* Sample test to create setup for the pdump server tests */ int test_pdump_init (void );
Signature · 1 line
2.54.0
PATCH v3 4/9 test/bonding: get MAC address with public API
In reply to David MarchandReplace direct rte_eth_devices[].data->mac_addrs access with rte_eth_macaddr_get() public API. This removes the dependency on the internal ethdev_driver.h header.
--- app/test/test_link_bonding.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-)
app/test/test_link_bonding.c +13 -22
@@ -19,7 +19,6 @@#include <rte_common.h> #include <rte_debug.h> #include <rte_ethdev.h> -#include <ethdev_driver.h> #include <rte_log.h> #include <rte_lcore.h> #include <rte_memory.h>
@@ -4763,7 +4762,7 @@ test_alb_change_mac_in_reply_sent(void)int retval =0 ;struct rte_ether_addr bond_mac, client_mac; -struct rte_ether_addr *member_mac1, *member_mac2; +struct rte_ether_addr member_mac1, member_mac2; TEST_ASSERT_SUCCESS( initialize_bonding_device_with_members(BONDING_MODE_ALB,
@@ -4779,9 +4778,7 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating four packets with different mac and ip addresses and sending
@@ -4831,10 +4828,8 @@ test_alb_change_mac_in_reply_sent(void) RTE_ARP_OP_REPLY);rte_eth_tx_burst (test_params->bonding_port_id,0 , &pkt,1 ); - member_mac1 = - rte_eth_devices[test_params->member_port_ids[0 ]].data->mac_addrs; - member_mac2 = - rte_eth_devices[test_params->member_port_ids[1 ]].data->mac_addrs; +rte_eth_macaddr_get (test_params->member_port_ids[0 ], &member_mac1); +rte_eth_macaddr_get (test_params->member_port_ids[1 ], &member_mac2);/* * Checking if packets are properly distributed on bonding ports. Packets
@@ -4852,13 +4847,13 @@ test_alb_change_mac_in_reply_sent(void) sizeof(struct rte_ether_hdr));if (member_idx%2 ==0 ) { -if (!rte_is_same_ether_addr (member_mac1, +if (!rte_is_same_ether_addr (&member_mac1, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end; } }else { -if (!rte_is_same_ether_addr (member_mac2, +if (!rte_is_same_ether_addr (&member_mac2, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end;
@@ -4885,7 +4880,7 @@ test_alb_reply_from_client(void)int retval =0 ;struct rte_ether_addr bond_mac, client_mac; -struct rte_ether_addr *member_mac1, *member_mac2; +struct rte_ether_addr member_mac1, member_mac2; TEST_ASSERT_SUCCESS( initialize_bonding_device_with_members(BONDING_MODE_ALB,
@@ -4900,9 +4895,7 @@ test_alb_reply_from_client(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating four packets with different mac and ip addresses and placing
@@ -4963,8 +4956,8 @@ test_alb_reply_from_client(void)rte_eth_rx_burst (test_params->bonding_port_id,0 , pkts_sent,MAX_PKT_BURST );rte_eth_tx_burst (test_params->bonding_port_id,0 ,NULL ,0 ); - member_mac1 = rte_eth_devices[test_params->member_port_ids[0 ]].data->mac_addrs; - member_mac2 = rte_eth_devices[test_params->member_port_ids[1 ]].data->mac_addrs; +rte_eth_macaddr_get (test_params->member_port_ids[0 ], &member_mac1); +rte_eth_macaddr_get (test_params->member_port_ids[1 ], &member_mac2);/* * Checking if update ARP packets were properly send on member ports.
@@ -4981,13 +4974,13 @@ test_alb_reply_from_client(void) sizeof(struct rte_ether_hdr));if (member_idx%2 ==0 ) { -if (!rte_is_same_ether_addr (member_mac1, +if (!rte_is_same_ether_addr (&member_mac1, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end; } }else { -if (!rte_is_same_ether_addr (member_mac2, +if (!rte_is_same_ether_addr (&member_mac2, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end;
@@ -5035,9 +5028,7 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating packet with double VLAN header and placing it in the rx queue.
Signature · 1 line
2.54.0
PATCH v3 5/9 test/devargs: rely on net null driver
In reply to David MarchandThe net/null driver is enabled in all our tests builds in the CI. Standardize on using net/null instead of net/ring.
This also removes use of an internal API.
---
Changes since v1:
- dropped dependency on net/ring, used net/null instead,
--- app/test/test_devargs.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
app/test/test_devargs.c +4 -15
@@ -10,7 +10,7 @@#include <rte_common.h> #include <rte_devargs.h> #include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_class.h> #include "test.h"
@@ -160,22 +160,11 @@ test_valid_devargs(void) "pci", "1:2.3", NULL }, {"pci:1:2.3,k0=v0" , 0, 0, 1, "pci", "1:2.3", NULL }, + { "net_null0", + 0, 0, 0, "vdev", "net_null0", NULL }, }; -static const struct devargs_case legacy_ring_list[] = { - {"net_ring0" , -0 ,0 ,0 ,"vdev" ,"net_ring0" ,NULL }, - {"net_ring0,iface=test,path=/class/bus/,queues=1" , -0 ,0 ,3 ,"vdev" ,"net_ring0" ,NULL }, - }; -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); -int ret; - ret =test_valid_devargs_cases (list,RTE_DIM (list)); -if (vdev_bus !=NULL && vdev_bus->parse ("net_ring0" ,NULL ) ==0 ) -/* Ring vdev driver enabled. */ - ret |=test_valid_devargs_cases (legacy_ring_list, -RTE_DIM (legacy_ring_list)); -return ret; +return test_valid_devargs_cases (list,RTE_DIM (list)); }/* Test several invalid cases */
Signature · 1 line
2.54.0
Re: [PATCH v3 5/9] test/devargs: rely on net null driver
Quoted 8 lines · On Mon, 21 Sep 2026 13:47:32 +0200 David Marchand <[email protected]>…
The net/null driver is enabled in all our tests builds in the CI. Standardize on using net/null instead of net/ring.
This also removes use of an internal API.
Signed-off-by David Marchand <[email protected]>Acked-by Bruce Richardson <[email protected]>---
Patch 5/9 (test/devargs: rely on net null driver)
Info:
- The removed legacy_ring_list case covered vdev devargs with 3 key=value pairs (iface=test,path=...,queues=1). Its replacement ("net_null0") has 0 kv pairs, so multi-key vdev devargs parsing loses its only test coverage with no equivalent added back.
PATCH v3 6/9 test/vdev: find device with public API
In reply to David MarchandChecking internal API has little sense as users are not supposed to call those.
Use public API to achieve similar coverage.
--- app/test/test_vdev.c | 85 ++++++++------------------------------------ 1 file changed, 15 insertions(+), 70 deletions(-)
app/test/test_vdev.c +15 -70
@@ -2,69 +2,26 @@* Copyright 2021 6WIND S.A. */ -#include <stdlib.h> #include <stdio.h> #include <string.h> -#include <rte_common.h> #include <rte_dev.h> -#include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_bus_vdev.h> #include "test.h" -#define TEST_VDEV_KEY_NAME "name" - -static const char *const valid_keys[] = { -TEST_VDEV_KEY_NAME , -NULL , -}; - -static int -cmp_dev_name (const struct rte_device *dev,const void *name) -{ -return strcmp (rte_dev_name (dev), name); -} - -static int -cmp_dev_match (const struct rte_device *dev,const void *_kvlist) -{ -const struct rte_kvargs *kvlist = _kvlist; -const char *key =TEST_VDEV_KEY_NAME ; -const char *name; - -/* no kvlist arg, all devices match */ -if (kvlist ==NULL ) -return 0 ; - -/* if key is present in kvlist and does not match, filter device */ - name =rte_kvargs_get (kvlist, key); -if (name !=NULL &&strcmp (name,rte_dev_name (dev)) !=0 ) -return -1 ; - -return 0 ; -} -static struct rte_device * -get_matching_vdev (const char *match_str) +find_vdev_by_name (const char *name) { -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); -struct rte_kvargs *kvargs =NULL ; +struct rte_dev_iterator it = {0 };struct rte_device *dev; -if (match_str !=NULL ) { - kvargs =rte_kvargs_parse (match_str, valid_keys); -if (kvargs ==NULL ) { -printf ("Failed to parse match string\n" ); -return NULL ; - } + RTE_DEV_FOREACH(dev, "bus=vdev", &it) { +if (strcmp (rte_dev_name (dev), name) ==0 ) +return dev; } - - dev = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_match, kvargs); -rte_kvargs_free (kvargs); - -return dev; +return NULL ; } static int
@@ -83,7 +40,7 @@ test_vdev_bus(void)printf ("Failed to create vdev net_null_test0\n" ); goto fail; } - dev0 = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_name,"net_null_test0" ); + dev0 =find_vdev_by_name ("net_null_test0" );if (dev0 ==NULL ) {printf ("Cannot find net_null_test0 vdev\n" ); goto fail;
@@ -94,44 +51,32 @@ test_vdev_bus(void)printf ("Failed to create vdev net_null_test1\n" ); goto fail; } - dev1 = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_name,"net_null_test1" ); + dev1 =find_vdev_by_name ("net_null_test1" );if (dev1 ==NULL ) {printf ("Cannot find net_null_test1 vdev\n" ); goto fail; } -/* try to match vdevs */ - dev =get_matching_vdev ("name=net_null_test0" ); +/* try to find vdevs */ + dev =find_vdev_by_name ("net_null_test0" );if (dev != dev0) {printf ("Cannot match net_null_test0 vdev\n" ); goto fail; } - dev =get_matching_vdev ("name=net_null_test1" ); + dev =find_vdev_by_name ("net_null_test1" );if (dev != dev1) {printf ("Cannot match net_null_test1 vdev\n" ); goto fail; } - dev =get_matching_vdev ("name=unexistant" ); + dev =find_vdev_by_name ("nonexistent" );if (dev !=NULL ) { -printf ("Unexistant vdev should not match\n" ); - goto fail; - } - - dev =get_matching_vdev ("" ); -if (dev ==NULL || dev == dev1) { -printf ("Cannot match any vdev with empty match string\n" ); - goto fail; - } - - dev =get_matching_vdev (NULL ); -if (dev ==NULL || dev == dev1) { -printf ("Cannot match any vdev with NULL match string\n" ); +printf ("Nonexistent vdev should not match\n" ); goto fail; } -/* iterate all vdevs, and ensure we find vdev0 and vdev1 */ +/* iterate all vdevs, and ensure we find dev0 and dev1 */ RTE_DEV_FOREACH(dev, "bus=vdev", &dev_iter) {if (dev == dev0) dev0 =NULL ;
Signature · 1 line
2.54.0
Re: [PATCH v3 6/9] test/vdev: find device with public API
Quoted 7 lines · On Mon, 21 Sep 2026 13:47:33 +0200 David Marchand <[email protected]>…
Checking internal API has little sense as users are not supposed to call those.
Use public API to achieve similar coverage.Signed-off-by David Marchand <[email protected]>Acked-by Bruce Richardson <[email protected]>---
Patch 6/9 (test/vdev: find device with public API) Info:
- get_matching_vdev("") and get_matching_vdev(NULL) previously verified "match any vdev" behaviour with an empty/NULL match string. find_vdev_by_name() has no equivalent case, so that behaviour is no longer exercised.
PATCH v3 7/9 test: limit internal API usage
In reply to David MarchandInternal APIs may be used for validating the internals of some component, but in general, it should be discouraged.
Let's not allow globally internal API in the unit tests.
--- app/test/meson.build | 3 --- app/test/process.c | 2 ++ app/test/test_devargs.c | 2 ++ app/test/test_external_mem.c | 2 ++ app/test/test_malloc.c | 2 ++ app/test/test_mempool.c | 2 ++ app/test/test_pdump.c | 3 +++ app/test/virtual_pmd.c | 2 ++ 8 files changed, 15 insertions(+), 3 deletions(-)
app/test/meson.build +0 -3
@@ -286,9 +286,6 @@ foreach arg: extra_flags endif endforeach -# Enable using internal APIs in unit tests -cflags += '-DALLOW_INTERNAL_API' - # create a symlink in the app/test directory for the binary, for backward compatibility if not is_windows custom_target('test_symlink',
app/test/process.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <errno.h> /* errno */ #include <limits.h> /* PATH_MAX */ #ifndef RTE_EXEC_ENV_WINDOWS
app/test/test_devargs.c +2 -0
@@ -2,6 +2,8 @@* Copyright (c) 2021 NVIDIA Corporation & Affiliates */ +#define ALLOW_INTERNAL_API +#include <stdlib.h> #include <stdio.h> #include <string.h>
app/test/test_external_mem.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2018 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include "test.h" #include <errno.h>
app/test/test_malloc.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2019 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include "test.h" #include <stdio.h>
app/test/test_mempool.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <string.h> #include <stdio.h> #include <stdlib.h>
app/test/test_pdump.c +3 -0
@@ -1,6 +1,9 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2018 Intel Corporation */ + +#define ALLOW_INTERNAL_API +#include <stdio.h> #include <unistd.h> #include <stdint.h>
app/test/virtual_pmd.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <rte_mbuf.h> #include <rte_ethdev.h> #include <ethdev_driver.h>
Signature · 1 line
2.54.0
PATCH v3 8/9 ci: make ABI reference generation faster
In reply to David MarchandRegenerating ABI is not something we do often, but when working on ABI topics, a lot of time may be wasted on waiting for the reference being generated.
We only care about shared libraries, avoid building final applications or examples.
And we don't need to double check headers in the ABI reference.
---
Changes since v2:
- removed unneeded -Dtests=
--- .ci/linux-build.sh | 10 +++++++++- devtools/test-meson-builds.sh | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-)
.ci/linux-build.sh +9 -1
@@ -201,9 +201,17 @@ if [ "$ABI_CHECKS" = "true" ]; then fi if [ ! -d reference ]; then + REF_OPTS="$OPTS" + # We only care about the drivers and libs, disable developer checks and + # don't try to link apps. + REF_OPTS="$REF_OPTS -Dcheck_includes=false" + REF_OPTS="$REF_OPTS -Ddeveloper_mode=disabled" + REF_OPTS="$REF_OPTS -Ddisable_apps=*" + REF_OPTS="$REF_OPTS -Denable_docs=false" + REF_OPTS="$REF_OPTS -Dexamples=" refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG) git clone --single-branch -b "$REF_GIT_TAG" $REF_GIT_REPO $refsrcdir - meson setup $OPTS -Dexamples= $refsrcdir $refsrcdir/build + meson setup $REF_OPTS $refsrcdir $refsrcdir/build ninja -C $refsrcdir/build DESTDIR=$(pwd)/reference meson install -C $refsrcdir/build find reference/usr/local -name '*.a' -delete
devtools/test-meson-builds.sh +4 -1
@@ -206,8 +206,11 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options] fi rm -rf $abirefdir/build + # We only care about the drivers and libs, disable + # developer checks and don't try to link apps. config $abirefdir/src $abirefdir/build ABI $cross \ - -Dexamples= $* + $* -Dcheck_includes=false -Ddeveloper_mode=disabled \ + -Ddisable_apps=* -Dexamples= compile $abirefdir/build install_target $abirefdir/build $abirefdir/$targetdir
Signature · 1 line
2.54.0
PATCH v3 9/9 ci: run reference binaries against current ABI
In reply to David MarchandLet's check if a testpmd and unit tests from a reference build can run with the current release libraries/drivers.
This gives another level of ABI checking, like catching regressions on experimental or internal ABI symbols that get promoted to stable without providing an alias for existing users.
We may need to skip unit tests that were added since the reference. So add a ABI_SKIP_TESTS environment variable in preparation.
---
Changes since v2:
- automated generation of the tests list,
Changes since v1:
- dropped hack, testing this patch can't be done in the CI now,
- emptied the excluded tests list,
- added test-null.sh,
--- .ci/linux-build.sh | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-)
.ci/linux-build.sh +31 -2
@@ -206,7 +206,7 @@ if [ "$ABI_CHECKS" = "true" ]; then # don't try to link apps. REF_OPTS="$REF_OPTS -Dcheck_includes=false" REF_OPTS="$REF_OPTS -Ddeveloper_mode=disabled" - REF_OPTS="$REF_OPTS -Ddisable_apps=*" + REF_OPTS="$REF_OPTS -Denable_apps=test,test-pmd" REF_OPTS="$REF_OPTS -Denable_docs=false" REF_OPTS="$REF_OPTS -Dexamples=" refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG)
@@ -215,13 +215,25 @@ if [ "$ABI_CHECKS" = "true" ]; then ninja -C $refsrcdir/build DESTDIR=$(pwd)/reference meson install -C $refsrcdir/build find reference/usr/local -name '*.a' -delete - rm -rf reference/usr/local/bin + rm -rf reference/usr/local/bin/* + cp $refsrcdir/build/app/dpdk-test reference/usr/local/bin/dpdk-test + meson test -C $refsrcdir/build --list --suite fast-tests | sort > reference/tests.txt + cp $refsrcdir/build/app/dpdk-testpmd reference/usr/local/bin/dpdk-testpmd rm -rf reference/usr/local/share echo $REF_GIT_TAG > reference/VERSION fi DESTDIR=$(pwd)/install meson install -C build devtools/check-abi.sh reference install ${ABI_CHECKS_WARN_ONLY:-} + + failed= + configure_coredump + mv -f build/app/dpdk-testpmd build/app/dpdk-testpmd.ori + cp reference/usr/local/bin/dpdk-testpmd build/app/dpdk-testpmd + devtools/test-null.sh || failed="true" + mv -f build/app/dpdk-testpmd.ori build/app/dpdk-testpmd + catch_coredump + [ "$failed" != "true" ] fi if [ "$RUN_TESTS" = "true" ]; then
@@ -232,6 +244,23 @@ if [ "$RUN_TESTS" = "true" ]; then catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt check_traces [ "$failed" != "true" ] + + if [ "$ABI_CHECKS" = "true" ]; then + failed= + configure_coredump + mv -f build/app/dpdk-test build/app/dpdk-test.ori + cp reference/usr/local/bin/dpdk-test build/app/dpdk-test + meson test -C build --list --suite fast-tests | sort > build/tests.txt + DPDK_TEST_SKIP=$(grep -vxFf reference/tests.txt build/tests.txt | + sed -n 's,DPDK:.* / ,,p' | tr '\n' ',') + sudo env DPDK_TEST_SKIP="$DPDK_TEST_SKIP" \ + meson test -C build --suite fast-tests -t 3 --no-stdsplit --print-errorlogs || failed="true" + catch_coredump + catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt + check_traces + mv -f build/app/dpdk-test.ori build/app/dpdk-test + [ "$failed" != "true" ] + fi fi # Test examples compilation with an installed dpdk
Signature · 1 line
2.54.0
Re: [PATCH v3 9/9] ci: run reference binaries against current ABI
Quoted 7 lines · On Mon, 21 Sep 2026 13:47:36 +0200 David Marchand <[email protected]>…
Let's check if a testpmd and unit tests from a reference build can run with the current release libraries/drivers.
This gives another level of ABI checking, like catching regressions on experimental or internal ABI symbols that get promoted to stable without providing an alias for existing users.
Quoted 5 lines
We may need to skip unit tests that were added since the reference. So add a
ABI_SKIP_TESTSenvironment variable in preparation.Signed-off-by David Marchand <[email protected]>---
Patch 9/9 (ci: run reference binaries against current ABI) Errors:
- The new DPDK_TEST_SKIP computation in .ci/linux-build.sh never skips anything, defeating the mechanism the commit message says it adds ("We may need to skip unit tests that were added since the reference"):
DPDK_TEST_SKIP=$(grep -vxFf reference/tests.txt build/tests.txt |
sed -n 's,DPDK:.* / ,,p' | tr '\n' ',') The sed pattern assumes a "DPDK:<suite> / <test>" format, but meson test --list --suite fast-tests never produces that. I built the tree and ran the exact command; with meson 1.12.0 the output is "fast-tests - DPDK:acl_autotest" (dash, no slash). I also checked meson 0.57.2 (DPDK's stated minimum): with a single --suite filter, get_pretty_suite() takes the else branch and returns the bare test name only ("acl_autotest", no prefix at all). Neither format contains " / ", so the sed substitution never fires and DPDK_TEST_SKIP is always empty, regardless of meson version.
Consequence: once this lands, any future series that adds a new fast-tests unit test will fail CI when ABI_CHECKS and RUN_TESTS are both enabled -- the new test name is not filtered out, meson test invokes it (DPDK_TEST=<name>) against the old reference dpdk-test binary, which does not implement it, the command exits non-zero into failed="true", and the trailing
[ "$failed" != "true" ] fails the -e script. This is exactly the scenario the DPDK_TEST_SKIP logic was added to prevent.
Info:
- The commit message says "add a ABI_SKIP_TESTS environment variable in preparation," but the code implements DPDK_TEST_SKIP. Possibly a rebase/rename artifact worth squashing before merge.
Re: [PATCH v3 9/9] ci: run reference binaries against current ABI
Quoted 10 lines · Stephen Hemminger
Patch 9/9 (ci: run reference binaries against current ABI) Errors:
- The newDPDK_TEST_SKIPcomputation in.ci/linux-build.shnever skips anything, defeating the mechanism the commit message says it adds ("We may need to skip unit tests that were added since the reference"):DPDK_TEST_SKIP=$(grep -vxFf reference/tests.txt build/tests.txt | sed -n 's,DPDK:.* / ,,p' | tr '\n' ',')
Quoted 10 lines
The sed pattern assumes a "DPDK:<suite> / <test>" format, but
meson test --list --suite fast-testsnever produces that. I built the tree and ran the exact command; with meson 1.12.0 the output is "fast-tests - DPDK:acl_autotest" (dash, no slash). I also checked meson 0.57.2 (DPDK's stated minimum): with a single --suite filter,get_pretty_suite()takes theelsebranch and returns the bare test name only ("acl_autotest", no prefix at all). Neither format contains " / ", so the sed substitution never fires andDPDK_TEST_SKIPis always empty, regardless of meson version.
Let's have AI reply to AI.
The format change happened between meson 1.9.0 and 1.10.0:
┌───────────────┬─────────────────────────────┬──────────────────────┐ │ Meson Version │ Output Format │ Sed Pattern Matches? │ ├───────────────┼─────────────────────────────┼──────────────────────┤ │ ≤ 1.9.0 │ DPDK:fast-tests / test_name │ ✅ Yes │ ├───────────────┼─────────────────────────────┼──────────────────────┤ │ ≥ 1.10.0 │ fast-tests - DPDK:test_name │ ❌ No │ └───────────────┴─────────────────────────────┴──────────────────────┘
The sed pattern in .ci/linux-build.sh:255:
sed -n 's,DPDK:.* / ,,p'
This pattern looks for DPDK:...something... / which:
- Works with meson ≤ 1.9.0 (format: DPDK:fast-tests / acl_autotest)
- Fails with meson ≥ 1.10.0 (format: fast-tests - DPDK:acl_autotest
— no " / ")
Where the AI was wrong: The claim about meson 0.57.2 producing bare
names is incorrect. DPDK defines 6 test suites, so len(self.suites) > 1 is always true, and the "pretty" format is always used regardless of which --suite is queried.
Current status: Your system has meson 1.7.2, which uses the old
format and works. Ubuntu 22.04 in CI likely has meson ~0.61.x-1.x which would also work. But the script will break once CI environments upgrade to meson 1.10.0+.
Bottom line: The concern is valid for future-proofing, but the
severity is overstated — it doesn't "never work", it works with older meson but will break with meson ≥ 1.10.0.
Quoted 9 lines
Consequence: once this lands, any future series that adds a new fast-tests unit test will fail CI when
ABI_CHECKSandRUN_TESTSare both enabled -- the new test name is not filtered out, meson test invokes it (DPDK_TEST=<name>) against the old reference dpdk-test binary, which does not implement it, the command exits non-zero into failed="true", and the trailing
[ "$failed" != "true" ]fails the-escript. This is exactly the scenario theDPDK_TEST_SKIPlogic was added to prevent.
Quoted 5 lines
Info:
- The commit message says "add aABI_SKIP_TESTSenvironment variable in preparation," but the code implementsDPDK_TEST_SKIP. Possibly a rebase/rename artifact worth squashing before merge.
Ah yes, forgot to remove.
Signature · 1 line
David Marchand
v4 cover Limit usage of internal API in tests
In reply to David MarchandWe had a few bug reports related to internal (and experimental) symbols issues during 26.07 development.
See for example https://bugs.dpdk.org/show_bug.cgi?id=1957 or more recently https://bugs.dpdk.org/show_bug.cgi?id=1967.
To catch such issues earlier in the CI, this series proposes to run the unit tests through meson with the ABI reference unit test binary against the current ABI libraries and drivers.
For this to work, some unit tests must be skipped (since meson may invoke the ABI reference code with tests that were unknown at the time).
A few unit tests were directly dereferencing internal structures and are reworked so they use public APIs.
Additionally, unit tests were allowed to use any internal API which has hidden a few issues (like a public API backed by internal symbols in the hash library).
So disable the global ALLLOW_INTERNAL_API and move it to code explicitly requiring internal API, with the hope it will push us to have better API.
Signature · 52 lines
David Marchand Changes since v3: - fixed support of newer meson version in last patch, Changes since v2: - automated tests list generation in last patch, Changes since v1: - rebased, - dropped patch 1 on bbdev, - dropped dependency on net/ring in devargs test, - removed hacks from last patch, flushed excluded tests list, added test-null.sh check, David Marchand (9): bbdev: add per-queue statistics API hash: fix GFNI stubs export test: uninline helper for forking test/bonding: get MAC address with public API test/devargs: rely on net null driver test/vdev: find device with public API test: limit internal API usage ci: make ABI reference generation faster ci: run reference binaries against current ABI .ci/linux-build.sh | 44 ++++- MAINTAINERS | 1 + app/test-bbdev/test_bbdev_perf.c | 38 +--- app/test/meson.build | 7 +- app/test/process.c | 231 +++++++++++++++++++++++++ app/test/process.h | 228 +----------------------- app/test/test_devargs.c | 21 +-- app/test/test_external_mem.c | 2 + app/test/test_link_bonding.c | 35 ++-- app/test/test_malloc.c | 2 + app/test/test_mempool.c | 2 + app/test/test_pdump.c | 3 + app/test/test_pdump.h | 3 + app/test/test_vdev.c | 85 ++------- app/test/virtual_pmd.c | 2 + devtools/test-meson-builds.sh | 5 +- doc/guides/rel_notes/release_26_11.rst | 5 + lib/bbdev/rte_bbdev.c | 20 +++ lib/bbdev/rte_bbdev.h | 20 +++ lib/hash/rte_thash_gfni.c | 4 +- lib/hash/rte_thash_gfni.h | 2 - 21 files changed, 393 insertions(+), 367 deletions(-) create mode 100644 app/test/process.c -- 2.54.0
PATCH v4 1/9 bbdev: add per-queue statistics API
Add rte_bbdev_queue_stats_get() to retrieve statistics for a specific queue. This allows applications to get per-queue stats without accessing internal data structures.
Update test-bbdev to use the new API.
--- app/test-bbdev/test_bbdev_perf.c | 38 +++++--------------------- doc/guides/rel_notes/release_26_11.rst | 5 ++++ lib/bbdev/rte_bbdev.c | 20 ++++++++++++++ lib/bbdev/rte_bbdev.h | 20 ++++++++++++++ 4 files changed, 52 insertions(+), 31 deletions(-)
app/test-bbdev/test_bbdev_perf.c +7 -31
@@ -5849,30 +5849,6 @@ validation_test(struct active_device *ad, struct test_op_params *op_params)return validation_latency_test (ad, op_params, false); } -static int -get_bbdev_queue_stats (uint16_t dev_id,uint16_t queue_id, -struct rte_bbdev_stats *stats) -{ -struct rte_bbdev *dev = &rte_bbdev_devices[dev_id]; -struct rte_bbdev_stats *q_stats; - -if (queue_id >= dev->data->num_queues) -return -1 ; - - q_stats = &dev->data->queues[queue_id].queue_stats; - - stats->enqueued_count = q_stats->enqueued_count; - stats->dequeued_count = q_stats->dequeued_count; - stats->enqueue_err_count = q_stats->enqueue_err_count; - stats->dequeue_err_count = q_stats->dequeue_err_count; - stats->enqueue_warn_count = q_stats->enqueue_warn_count; - stats->dequeue_warn_count = q_stats->dequeue_warn_count; - stats->acc_offload_cycles = q_stats->acc_offload_cycles; - stats->enqueue_depth_avail = q_stats->enqueue_depth_avail; - -return 0 ; -} - static int offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs, struct rte_bbdev_fft_op *ref_op, uint16_t dev_id,
@@ -5906,7 +5882,7 @@ offload_latency_test_fft(struct rte_mempool *mempool, struct test_buffers *bufs, &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -5988,7 +5964,7 @@ offload_latency_test_mldts(struct rte_mempool *mempool, struct test_buffers *buf &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6069,7 +6045,7 @@ offload_latency_test_dec(struct rte_mempool *mempool, struct test_buffers *bufs, &ops_enq[enq], burst_sz - enq); }while (unlikely (burst_sz != enq)); - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6163,7 +6139,7 @@ offload_latency_test_ldpc_dec(struct rte_mempool *mempool, }while (unlikely (burst_sz != enq)); enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6251,7 +6227,7 @@ offload_latency_test_enc(struct rte_mempool *mempool, struct test_buffers *bufs, enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6332,7 +6308,7 @@ offload_latency_test_ldpc_enc(struct rte_mempool *mempool, }while (unlikely (burst_sz != enq)); enq_sw_last_time =rte_rdtsc_precise () - enq_start_time; - ret =get_bbdev_queue_stats (dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, dev_id);
@@ -6482,7 +6458,7 @@ offload_cost_test(struct active_device *ad, rte_get_tsc_hz());struct rte_bbdev_stats stats = {0 }; - ret =get_bbdev_queue_stats (ad->dev_id, queue_id, &stats); + ret =rte_bbdev_queue_stats_get (ad->dev_id, queue_id, &stats);TEST_ASSERT_SUCCESS (ret,"Failed to get stats for queue (%u) of device (%u)" , queue_id, ad->dev_id);
doc/guides/rel_notes/release_26_11.rst +5 -0
@@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added per-queue statistics API in bbdev.** + + Added ``rte_bbdev_queue_stats_get()`` function to retrieve statistics + for a specific queue, complementing the existing device-level statistics API. + Removed Items -------------
lib/bbdev/rte_bbdev.c +20 -0
@@ -815,6 +815,26 @@ rte_bbdev_stats_reset(uint16_t dev_id)return 0 ; } +RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_bbdev_queue_stats_get, 26.07) +int rte_bbdev_queue_stats_get (uint16_t dev_id,uint16_t queue_id,struct rte_bbdev_stats *stats) +{ +struct rte_bbdev *dev =get_dev (dev_id); + +VALID_DEV_OR_RET_ERR (dev, dev_id); +VALID_QUEUE_OR_RET_ERR (queue_id, dev); + +if (stats ==NULL ) { +rte_bbdev_log (ERR ,"NULL stats structure" ); +return -EINVAL ; + } + + *stats = dev->data->queues[queue_id].queue_stats; + +rte_bbdev_log_debug ("Retrieved stats for queue %u of device %u" , + queue_id, dev_id); +return 0 ; +} +RTE_EXPORT_SYMBOL (rte_bbdev_info_get) intrte_bbdev_info_get (uint16_t dev_id,struct rte_bbdev_info *dev_info)
lib/bbdev/rte_bbdev.h +20 -0
@@ -316,6 +316,26 @@ rte_bbdev_stats_get(uint16_t dev_id, struct rte_bbdev_stats *stats);int rte_bbdev_stats_reset (uint16_t dev_id); +/** +* Retrieve the statistics of a specific queue. +* +* @param dev_id +* The identifier of the device. +* @param queue_id +* The index of the queue. +* @param stats +* Pointer to structure to where statistics will be copied. On error, this +* location may or may not have been modified. +* +* @return +* - 0 on success +* - -ENODEV if dev_id is invalid +* - -EINVAL if stats is NULL +* - -ERANGE if queue_id is out of range +*/ +__rte_experimental +int rte_bbdev_queue_stats_get(uint16_t dev_id, uint16_t queue_id, struct rte_bbdev_stats *stats); +/** Device information supplied by the device's driver */ /* Structure rte_bbdev_driver_info 8< */
Signature · 1 line
2.54.0
PATCH v4 2/9 hash: fix GFNI stubs export
In reply to David MarchandInternal symbols *can not* be called as part of public ABI. The GFNI stubs must be exported so that an application may call them through the (inlined) GFNI API without requiring ALLOW_INTERNAL_API.
--- lib/hash/rte_thash_gfni.c | 4 ++-- lib/hash/rte_thash_gfni.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
lib/hash/rte_thash_gfni.c +2 -2
@@ -13,7 +13,7 @@ RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO);#define HASH_LOG (level, ...) \ RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) -RTE_EXPORT_INTERNAL_SYMBOL (rte_thash_gfni_stub) +RTE_EXPORT_SYMBOL (rte_thash_gfni_stub) uint32_t rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused, const uint8_t *key __rte_unused, int len __rte_unused)
@@ -29,7 +29,7 @@ rte_thash_gfni_stub(const uint64_t *mtrx __rte_unused,return 0 ; } -RTE_EXPORT_INTERNAL_SYMBOL(rte_thash_gfni_bulk_stub) +RTE_EXPORT_SYMBOL(rte_thash_gfni_bulk_stub) void rte_thash_gfni_bulk_stub(const uint64_t *mtrx __rte_unused, int len __rte_unused, uint8_t *tuple[] __rte_unused,
lib/hash/rte_thash_gfni.h +0 -2
@@ -22,11 +22,9 @@ extern "C" {* @internal * Stubs only used when GFNI is not available. */ -__rte_internal uint32_t rte_thash_gfni_stub (const uint64_t *mtrx,const uint8_t *key,int len); -__rte_internal void rte_thash_gfni_bulk_stub (const uint64_t *mtrx,int len,uint8_t *tuple[],uint32_t val[],uint32_t num);
Signature · 1 line
2.54.0
PATCH v4 3/9 test: uninline helper for forking
In reply to David MarchandThere is no reason to keep those helpers inlined.
Besides, this code relies on internal API. So any consumer of process.h requires internal API.
Move this code in process.c.
--- MAINTAINERS | 1 + app/test/meson.build | 4 + app/test/process.c | 229 ++++++++++++++++++++++++++++++++++++++++++ app/test/process.h | 228 ++--------------------------------------- app/test/test_pdump.h | 3 + 5 files changed, 246 insertions(+), 219 deletions(-) create mode 100644 app/test/process.c
MAINTAINERS +1 -0
@@ -1945,6 +1945,7 @@ F: app/test/commands.c F: app/test/packet_burst_generator.c F: app/test/packet_burst_generator.h F: app/test/process.h +F: app/test/process.c F: app/test/test.c F: app/test/test.h F: app/test/test_pmd_perf.c
app/test/meson.build +4 -0
@@ -5,6 +5,10 @@ deps += ['cmdline', 'ring', 'mempool', 'mbuf'] sources += files('commands.c', 'test.c') +if not is_windows + sources += files('process.c') +endif + # optional dependencies: some files may use these - and so we should link them in - # but do not explicitly require them so they are not listed in the per-file lists below optional_deps = ['crypto_scheduler', 'lpm']
app/test/process.c new file +229 -0
229 lines not on this page · raw message
app/test/process.h +9 -219
243 lines not on this page · raw message
app/test/test_pdump.h +3 -0
@@ -11,6 +11,9 @@/* sample test to send packets to the pdump client recursively */ uint32_t send_pkts (void *empty); +/* flag to stop send_pkts thread */ +extern uint16_t flag_for_send_pkts; +/* Sample test to create setup for the pdump server tests */ int test_pdump_init (void );
Signature · 1 line
2.54.0
PATCH v4 4/9 test/bonding: get MAC address with public API
In reply to David MarchandReplace direct rte_eth_devices[].data->mac_addrs access with rte_eth_macaddr_get() public API. This removes the dependency on the internal ethdev_driver.h header.
--- app/test/test_link_bonding.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-)
app/test/test_link_bonding.c +13 -22
@@ -19,7 +19,6 @@#include <rte_common.h> #include <rte_debug.h> #include <rte_ethdev.h> -#include <ethdev_driver.h> #include <rte_log.h> #include <rte_lcore.h> #include <rte_memory.h>
@@ -4763,7 +4762,7 @@ test_alb_change_mac_in_reply_sent(void)int retval =0 ;struct rte_ether_addr bond_mac, client_mac; -struct rte_ether_addr *member_mac1, *member_mac2; +struct rte_ether_addr member_mac1, member_mac2; TEST_ASSERT_SUCCESS( initialize_bonding_device_with_members(BONDING_MODE_ALB,
@@ -4779,9 +4778,7 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating four packets with different mac and ip addresses and sending
@@ -4831,10 +4828,8 @@ test_alb_change_mac_in_reply_sent(void) RTE_ARP_OP_REPLY);rte_eth_tx_burst (test_params->bonding_port_id,0 , &pkt,1 ); - member_mac1 = - rte_eth_devices[test_params->member_port_ids[0 ]].data->mac_addrs; - member_mac2 = - rte_eth_devices[test_params->member_port_ids[1 ]].data->mac_addrs; +rte_eth_macaddr_get (test_params->member_port_ids[0 ], &member_mac1); +rte_eth_macaddr_get (test_params->member_port_ids[1 ], &member_mac2);/* * Checking if packets are properly distributed on bonding ports. Packets
@@ -4852,13 +4847,13 @@ test_alb_change_mac_in_reply_sent(void) sizeof(struct rte_ether_hdr));if (member_idx%2 ==0 ) { -if (!rte_is_same_ether_addr (member_mac1, +if (!rte_is_same_ether_addr (&member_mac1, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end; } }else { -if (!rte_is_same_ether_addr (member_mac2, +if (!rte_is_same_ether_addr (&member_mac2, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end;
@@ -4885,7 +4880,7 @@ test_alb_reply_from_client(void)int retval =0 ;struct rte_ether_addr bond_mac, client_mac; -struct rte_ether_addr *member_mac1, *member_mac2; +struct rte_ether_addr member_mac1, member_mac2; TEST_ASSERT_SUCCESS( initialize_bonding_device_with_members(BONDING_MODE_ALB,
@@ -4900,9 +4895,7 @@ test_alb_reply_from_client(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating four packets with different mac and ip addresses and placing
@@ -4963,8 +4956,8 @@ test_alb_reply_from_client(void)rte_eth_rx_burst (test_params->bonding_port_id,0 , pkts_sent,MAX_PKT_BURST );rte_eth_tx_burst (test_params->bonding_port_id,0 ,NULL ,0 ); - member_mac1 = rte_eth_devices[test_params->member_port_ids[0 ]].data->mac_addrs; - member_mac2 = rte_eth_devices[test_params->member_port_ids[1 ]].data->mac_addrs; +rte_eth_macaddr_get (test_params->member_port_ids[0 ], &member_mac1); +rte_eth_macaddr_get (test_params->member_port_ids[1 ], &member_mac2);/* * Checking if update ARP packets were properly send on member ports.
@@ -4981,13 +4974,13 @@ test_alb_reply_from_client(void) sizeof(struct rte_ether_hdr));if (member_idx%2 ==0 ) { -if (!rte_is_same_ether_addr (member_mac1, +if (!rte_is_same_ether_addr (&member_mac1, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end; } }else { -if (!rte_is_same_ether_addr (member_mac2, +if (!rte_is_same_ether_addr (&member_mac2, &arp_pkt->arp_data.arp_sha)) { retval =-1 ; goto test_end;
@@ -5035,9 +5028,7 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); } -rte_ether_addr_copy ( - rte_eth_devices[test_params->bonding_port_id].data->mac_addrs, - &bond_mac); +rte_eth_macaddr_get (test_params->bonding_port_id, &bond_mac);/* * Generating packet with double VLAN header and placing it in the rx queue.
Signature · 1 line
2.54.0
PATCH v4 5/9 test/devargs: rely on net null driver
In reply to David MarchandThe net/null driver is enabled in all our tests builds in the CI. Standardize on using net/null instead of net/ring.
This also removes use of an internal API.
---
Changes since v1:
- dropped dependency on net/ring, used net/null instead,
--- app/test/test_devargs.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
app/test/test_devargs.c +4 -15
@@ -10,7 +10,7 @@#include <rte_common.h> #include <rte_devargs.h> #include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_class.h> #include "test.h"
@@ -160,22 +160,11 @@ test_valid_devargs(void) "pci", "1:2.3", NULL }, {"pci:1:2.3,k0=v0" , 0, 0, 1, "pci", "1:2.3", NULL }, + { "net_null0", + 0, 0, 0, "vdev", "net_null0", NULL }, }; -static const struct devargs_case legacy_ring_list[] = { - {"net_ring0" , -0 ,0 ,0 ,"vdev" ,"net_ring0" ,NULL }, - {"net_ring0,iface=test,path=/class/bus/,queues=1" , -0 ,0 ,3 ,"vdev" ,"net_ring0" ,NULL }, - }; -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); -int ret; - ret =test_valid_devargs_cases (list,RTE_DIM (list)); -if (vdev_bus !=NULL && vdev_bus->parse ("net_ring0" ,NULL ) ==0 ) -/* Ring vdev driver enabled. */ - ret |=test_valid_devargs_cases (legacy_ring_list, -RTE_DIM (legacy_ring_list)); -return ret; +return test_valid_devargs_cases (list,RTE_DIM (list)); }/* Test several invalid cases */
Signature · 1 line
2.54.0
PATCH v4 6/9 test/vdev: find device with public API
In reply to David MarchandChecking internal API has little sense as users are not supposed to call those.
Use public API to achieve similar coverage.
--- app/test/test_vdev.c | 85 ++++++++------------------------------------ 1 file changed, 15 insertions(+), 70 deletions(-)
app/test/test_vdev.c +15 -70
@@ -2,69 +2,26 @@* Copyright 2021 6WIND S.A. */ -#include <stdlib.h> #include <stdio.h> #include <string.h> -#include <rte_common.h> #include <rte_dev.h> -#include <rte_kvargs.h> -#include <bus_driver.h> +#include <rte_bus.h> #include <rte_bus_vdev.h> #include "test.h" -#define TEST_VDEV_KEY_NAME "name" - -static const char *const valid_keys[] = { -TEST_VDEV_KEY_NAME , -NULL , -}; - -static int -cmp_dev_name (const struct rte_device *dev,const void *name) -{ -return strcmp (rte_dev_name (dev), name); -} - -static int -cmp_dev_match (const struct rte_device *dev,const void *_kvlist) -{ -const struct rte_kvargs *kvlist = _kvlist; -const char *key =TEST_VDEV_KEY_NAME ; -const char *name; - -/* no kvlist arg, all devices match */ -if (kvlist ==NULL ) -return 0 ; - -/* if key is present in kvlist and does not match, filter device */ - name =rte_kvargs_get (kvlist, key); -if (name !=NULL &&strcmp (name,rte_dev_name (dev)) !=0 ) -return -1 ; - -return 0 ; -} -static struct rte_device * -get_matching_vdev (const char *match_str) +find_vdev_by_name (const char *name) { -struct rte_bus *vdev_bus =rte_bus_find_by_name ("vdev" ); -struct rte_kvargs *kvargs =NULL ; +struct rte_dev_iterator it = {0 };struct rte_device *dev; -if (match_str !=NULL ) { - kvargs =rte_kvargs_parse (match_str, valid_keys); -if (kvargs ==NULL ) { -printf ("Failed to parse match string\n" ); -return NULL ; - } + RTE_DEV_FOREACH(dev, "bus=vdev", &it) { +if (strcmp (rte_dev_name (dev), name) ==0 ) +return dev; } - - dev = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_match, kvargs); -rte_kvargs_free (kvargs); - -return dev; +return NULL ; } static int
@@ -83,7 +40,7 @@ test_vdev_bus(void)printf ("Failed to create vdev net_null_test0\n" ); goto fail; } - dev0 = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_name,"net_null_test0" ); + dev0 =find_vdev_by_name ("net_null_test0" );if (dev0 ==NULL ) {printf ("Cannot find net_null_test0 vdev\n" ); goto fail;
@@ -94,44 +51,32 @@ test_vdev_bus(void)printf ("Failed to create vdev net_null_test1\n" ); goto fail; } - dev1 = vdev_bus->find_device (vdev_bus,NULL , cmp_dev_name,"net_null_test1" ); + dev1 =find_vdev_by_name ("net_null_test1" );if (dev1 ==NULL ) {printf ("Cannot find net_null_test1 vdev\n" ); goto fail; } -/* try to match vdevs */ - dev =get_matching_vdev ("name=net_null_test0" ); +/* try to find vdevs */ + dev =find_vdev_by_name ("net_null_test0" );if (dev != dev0) {printf ("Cannot match net_null_test0 vdev\n" ); goto fail; } - dev =get_matching_vdev ("name=net_null_test1" ); + dev =find_vdev_by_name ("net_null_test1" );if (dev != dev1) {printf ("Cannot match net_null_test1 vdev\n" ); goto fail; } - dev =get_matching_vdev ("name=unexistant" ); + dev =find_vdev_by_name ("nonexistent" );if (dev !=NULL ) { -printf ("Unexistant vdev should not match\n" ); - goto fail; - } - - dev =get_matching_vdev ("" ); -if (dev ==NULL || dev == dev1) { -printf ("Cannot match any vdev with empty match string\n" ); - goto fail; - } - - dev =get_matching_vdev (NULL ); -if (dev ==NULL || dev == dev1) { -printf ("Cannot match any vdev with NULL match string\n" ); +printf ("Nonexistent vdev should not match\n" ); goto fail; } -/* iterate all vdevs, and ensure we find vdev0 and vdev1 */ +/* iterate all vdevs, and ensure we find dev0 and dev1 */ RTE_DEV_FOREACH(dev, "bus=vdev", &dev_iter) {if (dev == dev0) dev0 =NULL ;
Signature · 1 line
2.54.0
PATCH v4 7/9 test: limit internal API usage
In reply to David MarchandInternal APIs may be used for validating the internals of some component, but in general, it should be discouraged.
Let's not allow globally internal API in the unit tests.
--- app/test/meson.build | 3 --- app/test/process.c | 2 ++ app/test/test_devargs.c | 2 ++ app/test/test_external_mem.c | 2 ++ app/test/test_malloc.c | 2 ++ app/test/test_mempool.c | 2 ++ app/test/test_pdump.c | 3 +++ app/test/virtual_pmd.c | 2 ++ 8 files changed, 15 insertions(+), 3 deletions(-)
app/test/meson.build +0 -3
@@ -286,9 +286,6 @@ foreach arg: extra_flags endif endforeach -# Enable using internal APIs in unit tests -cflags += '-DALLOW_INTERNAL_API' - # create a symlink in the app/test directory for the binary, for backward compatibility if not is_windows custom_target('test_symlink',
app/test/process.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <errno.h> /* errno */ #include <limits.h> /* PATH_MAX */ #ifndef RTE_EXEC_ENV_WINDOWS
app/test/test_devargs.c +2 -0
@@ -2,6 +2,8 @@* Copyright (c) 2021 NVIDIA Corporation & Affiliates */ +#define ALLOW_INTERNAL_API +#include <stdlib.h> #include <stdio.h> #include <string.h>
app/test/test_external_mem.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2018 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include "test.h" #include <errno.h>
app/test/test_malloc.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2019 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include "test.h" #include <stdio.h>
app/test/test_mempool.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <string.h> #include <stdio.h> #include <stdlib.h>
app/test/test_pdump.c +3 -0
@@ -1,6 +1,9 @@/* SPDX-License-Identifier: BSD-3-Clause * Copyright(c) 2018 Intel Corporation */ + +#define ALLOW_INTERNAL_API +#include <stdio.h> #include <unistd.h> #include <stdint.h>
app/test/virtual_pmd.c +2 -0
@@ -2,6 +2,8 @@* Copyright(c) 2010-2014 Intel Corporation */ +#define ALLOW_INTERNAL_API +#include <rte_mbuf.h> #include <rte_ethdev.h> #include <ethdev_driver.h>
Signature · 1 line
2.54.0
PATCH v4 8/9 ci: make ABI reference generation faster
In reply to David MarchandRegenerating ABI is not something we do often, but when working on ABI topics, a lot of time may be wasted on waiting for the reference being generated.
We only care about shared libraries, avoid building final applications or examples.
And we don't need to double check headers in the ABI reference.
---
Changes since v2:
- removed unneeded -Dtests=
--- .ci/linux-build.sh | 10 +++++++++- devtools/test-meson-builds.sh | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-)
.ci/linux-build.sh +9 -1
@@ -201,9 +201,17 @@ if [ "$ABI_CHECKS" = "true" ]; then fi if [ ! -d reference ]; then + REF_OPTS="$OPTS" + # We only care about the drivers and libs, disable developer checks and + # don't try to link apps. + REF_OPTS="$REF_OPTS -Dcheck_includes=false" + REF_OPTS="$REF_OPTS -Ddeveloper_mode=disabled" + REF_OPTS="$REF_OPTS -Ddisable_apps=*" + REF_OPTS="$REF_OPTS -Denable_docs=false" + REF_OPTS="$REF_OPTS -Dexamples=" refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG) git clone --single-branch -b "$REF_GIT_TAG" $REF_GIT_REPO $refsrcdir - meson setup $OPTS -Dexamples= $refsrcdir $refsrcdir/build + meson setup $REF_OPTS $refsrcdir $refsrcdir/build ninja -C $refsrcdir/build DESTDIR=$(pwd)/reference meson install -C $refsrcdir/build find reference/usr/local -name '*.a' -delete
devtools/test-meson-builds.sh +4 -1
@@ -206,8 +206,11 @@ build () # <directory> <target cc | cross file> <ABI check> [meson options] fi rm -rf $abirefdir/build + # We only care about the drivers and libs, disable + # developer checks and don't try to link apps. config $abirefdir/src $abirefdir/build ABI $cross \ - -Dexamples= $* + $* -Dcheck_includes=false -Ddeveloper_mode=disabled \ + -Ddisable_apps=* -Dexamples= compile $abirefdir/build install_target $abirefdir/build $abirefdir/$targetdir
Signature · 1 line
2.54.0
PATCH v4 9/9 ci: run reference binaries against current ABI
In reply to David MarchandLet's check if a testpmd and unit tests from a reference build can run with the current release libraries/drivers.
This gives another level of ABI checking, like catching regressions on experimental or internal ABI symbols that get promoted to stable without providing an alias for existing users.
Automatically skip unit tests that did not exist in the reference build.
---
Changes since v3:
- fixed support of newer meson version,
- updated commitlog,
Changes since v2:
- automated generation of the tests list,
Changes since v1:
- dropped hack, testing this patch can't be done in the CI now,
- emptied the excluded tests list,
- added test-null.sh,
---
.ci/linux-build.sh | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
.ci/linux-build.sh +34 -2
@@ -206,7 +206,7 @@ if [ "$ABI_CHECKS" = "true" ]; then # don't try to link apps. REF_OPTS="$REF_OPTS -Dcheck_includes=false" REF_OPTS="$REF_OPTS -Ddeveloper_mode=disabled" - REF_OPTS="$REF_OPTS -Ddisable_apps=*" + REF_OPTS="$REF_OPTS -Denable_apps=test,test-pmd" REF_OPTS="$REF_OPTS -Denable_docs=false" REF_OPTS="$REF_OPTS -Dexamples=" refsrcdir=$(readlink -f $(pwd)/../dpdk-$REF_GIT_TAG)
@@ -215,13 +215,27 @@ if [ "$ABI_CHECKS" = "true" ]; then ninja -C $refsrcdir/build DESTDIR=$(pwd)/reference meson install -C $refsrcdir/build find reference/usr/local -name '*.a' -delete - rm -rf reference/usr/local/bin + rm -rf reference/usr/local/bin/* + cp $refsrcdir/build/app/dpdk-test reference/usr/local/bin/dpdk-test + meson introspect $refsrcdir/build --tests | + jq -r '.[] | select(.suite[] | contains("fast-tests")) | .name' | + sort > reference/tests.txt + cp $refsrcdir/build/app/dpdk-testpmd reference/usr/local/bin/dpdk-testpmd rm -rf reference/usr/local/share echo $REF_GIT_TAG > reference/VERSION fi DESTDIR=$(pwd)/install meson install -C build devtools/check-abi.sh reference install ${ABI_CHECKS_WARN_ONLY:-} + + failed= + configure_coredump + mv -f build/app/dpdk-testpmd build/app/dpdk-testpmd.ori + cp reference/usr/local/bin/dpdk-testpmd build/app/dpdk-testpmd + devtools/test-null.sh || failed="true" + mv -f build/app/dpdk-testpmd.ori build/app/dpdk-testpmd + catch_coredump + [ "$failed" != "true" ] fi if [ "$RUN_TESTS" = "true" ]; then
@@ -232,6 +246,24 @@ if [ "$RUN_TESTS" = "true" ]; then catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt check_traces [ "$failed" != "true" ] + + if [ "$ABI_CHECKS" = "true" ]; then + failed= + configure_coredump + mv -f build/app/dpdk-test build/app/dpdk-test.ori + cp reference/usr/local/bin/dpdk-test build/app/dpdk-test + meson introspect build --tests | + jq -r '.[] | select(.suite[] | contains("fast-tests")) | .name' | + sort > build/tests.txt + DPDK_TEST_SKIP=$(grep -vxFf reference/tests.txt build/tests.txt | tr '\n' ',') + sudo env DPDK_TEST_SKIP="$DPDK_TEST_SKIP" \ + meson test -C build --suite fast-tests -t 3 --no-stdsplit --print-errorlogs || failed="true" + catch_coredump + catch_ubsan DPDK:fast-tests build/meson-logs/testlog.txt + check_traces + mv -f build/app/dpdk-test.ori build/app/dpdk-test + [ "$failed" != "true" ] + fi fi # Test examples compilation with an installed dpdk
Signature · 1 line
2.54.0
Re: [PATCH v4 9/9] ci: run reference binaries against current ABI
Quoted 10 lines · David Marchand
Let's check if a testpmd and unit tests from a reference build can run with the current release libraries/drivers.
This gives another level of ABI checking, like catching regressions on experimental or internal ABI symbols that get promoted to stable without providing an alias for existing users.
Automatically skip unit tests that did not exist in the reference build.
Signed-off-by David Marchand <[email protected]>
Quoted 65 lines · David Marchand
We had a few bug reports related to internal (and experimental) symbols issues during 26.07 development.
See for example https://bugs.dpdk.org/show_bug.cgi?id=1957 or more recently https://bugs.dpdk.org/show_bug.cgi?id=1967.To catch such issues earlier in the CI, this series proposes to run the unit tests through meson with the ABI reference unit test binary against the current ABI libraries and drivers.
For this to work, some unit tests must be skipped (since meson may invoke the ABI reference code with tests that were unknown at the time).
A few unit tests were directly dereferencing internal structures and are reworked so they use public APIs.
Additionally, unit tests were allowed to use any internal API which has hidden a few issues (like a public API backed by internal symbols in the hash library).
So disable the globalALLLOW_INTERNAL_APIand move it to code explicitly requiring internal API, with the hope it will push us to have better API.--
David MarchandChanges since v3:
- fixed support of newer meson version in last patch,Changes since v2:
- automated tests list generation in last patch,Changes since v1:
- rebased,
- dropped patch 1 on bbdev,
- dropped dependency on net/ring in devargs test,
- removed hacks from last patch, flushed excluded tests list, addedtest-null.shcheck,David Marchand (9):
bbdev: add per-queue statistics API
hash: fix GFNI stubs export
test: uninline helper for forking
test/bonding: get MAC address with public API
test/devargs: rely on net null driver
test/vdev: find device with public API
test: limit internal API usage
ci: make ABI reference generation faster
ci: run reference binaries against current ABI.ci/linux-build.sh | 44 ++++- MAINTAINERS | 1 + app/test-bbdev/test_bbdev_perf.c | 38 +--- app/test/meson.build | 7 +- app/test/process.c | 231 +++++++++++++++++++++++++ app/test/process.h | 228 +----------------------- app/test/test_devargs.c | 21 +-- app/test/test_external_mem.c | 2 + app/test/test_link_bonding.c | 35 ++-- app/test/test_malloc.c | 2 + app/test/test_mempool.c | 2 + app/test/test_pdump.c | 3 + app/test/test_pdump.h | 3 + app/test/test_vdev.c | 85 ++------- app/test/virtual_pmd.c | 2 +
Quoted 8 lines
devtools/test-meson-builds.sh | 5 +- doc/guides/rel_notes/release_26_11.rst | 5 + lib/bbdev/rte_bbdev.c | 20 +++ lib/bbdev/rte_bbdev.h | 20 +++ lib/hash/rte_thash_gfni.c | 4 +- lib/hash/rte_thash_gfni.h | 2 - 21 files changed, 393 insertions(+), 367 deletions(-) create mode 100644 app/test/process.c
Series applied, thanks for the reviews.
Signature · 1 line
David Marchand
Quoted 12 lines · On Tue, 22 Sep 2026 11:40:16 +0200 David Marchand <[email protected]>…
We had a few bug reports related to internal (and experimental) symbols issues during 26.07 development.
See for example https://bugs.dpdk.org/show_bug.cgi?id=1957 or more recently https://bugs.dpdk.org/show_bug.cgi?id=1967.To catch such issues earlier in the CI, this series proposes to run the unit tests through meson with the ABI reference unit test binary against the current ABI libraries and drivers.
For this to work, some unit tests must be skipped (since meson may invoke the ABI reference code with tests that were unknown at the time).
Quoted 8 lines
A few unit tests were directly dereferencing internal structures and are reworked so they use public APIs.
Additionally, unit tests were allowed to use any internal API which has hidden a few issues (like a public API backed by internal symbols in the hash library).
So disable the globalALLLOW_INTERNAL_APIand move it to code explicitly requiring internal API, with the hope it will push us to have better API.
I think this causing breakage with minsize build. It is not correct to use __rte_internal on inline helper functions in header file. I checked and only thash has that anti-pattern.
In file included from ../lib/hash/rte_thash_gfni.h:13,
from ../lib/hash/rte_thash.h:23,
from ../app/test/test_thash_perf.c:13:
In function ‘rte_thash_gfni’,
inlined from ‘run_rss_calc’ at ../app/test/test_thash_perf.c:58:13:
../lib/hash/rte_thash_x86_gfni.h:181:27: error: call to ‘__rte_thash_gfni’ declared with attribute error: Symbol is not public ABI
181 | __m512i xor_acc = __rte_thash_gfni(m, tuple, NULL, len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~In function ‘rte_thash_gfni_bulk’,
inlined from ‘run_rss_calc_bulk’ at ../app/test/test_thash_perf.c:79:3,
inlined from ‘run_thash_test’ at ../app/test/test_thash_perf.c:122:13:../lib/hash/rte_thash_x86_gfni.h:213:27: error: call to ‘__rte_thash_gfni’ declared with attribute error: Symbol is not public ABI
213 | xor_acc = __rte_thash_gfni(mtrx, tuple[i], tuple[i + 1], len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~AI analysis:
Pre-existing: the actual bug
lib/hash/rte_thash_x86_gfni.h:32 and :67 put __rte_internal on two static inline helpers, __rte_thash_xor_reduce and __rte_thash_gfni. The public, stable (per b9dd86db2a) wrappers rte_thash_gfni() / rte_thash_gfni_bulk() call them. Those markers date to 4fd8c4cb0d ("hash: add new Toeplitz hash implementation") — they've always been wrong. Any external application including rte_thash.h without ALLOW_INTERNAL_API was already broken; 1f1c91397c just made DPDK's own tree hit the same wall.
This is the same class of bug da31ef54c8 ("hash: fix GFNI stubs export") fixed for the out-of-line stubs — it missed the inline helpers.
Why only minsize
__rte_internal expands to __attribute__((error(...))), which only fires if the call survives to codegen:
-O0 : 6 -O1 : 0 -O2 : 0 -O3 : 0 -Os : 2
At -O1/-O2/-O3 GCC inlines the helper and the call vanishes. At -Os it declines to inline (function too large), at -O0 it never inlines. So the marker was never actually enforcing anything at the default optimization levels — it only detonates under specific inlining decisions. minsize and a debug build are the two configs that expose it.
Recommended fix
Drop __rte_internal from those two static inline helpers, rather than restoring ALLOW_INTERNAL_API to app/test. __rte_internal on a static inline in an installed public header is wrong by construction: there's no exported symbol to protect, and it makes the public wrappers unusable from outside DPDK.
Verified: with those two markers removed, test_thash.c and test_thash_perf.c both compile clean at -O0 and -Os (6→0 and 2→0). I grepped the rest of lib/ and drivers/ for __rte_internal immediately preceding static inline in public headers — these two are the only instances, so a single small patch covers it. Fixes:
should point at 4fd8c4cb0d, not 1f1c91397c.
Quoted 39 lines · Stephen Hemminger
Quoted 12 lines · On Tue, 22 Sep 2026 11:40:16 +0200 David Marchand <[email protected]>…
We had a few bug reports related to internal (and experimental) symbols issues during 26.07 development.
See for example https://bugs.dpdk.org/show_bug.cgi?id=1957 or more recently https://bugs.dpdk.org/show_bug.cgi?id=1967.To catch such issues earlier in the CI, this series proposes to run the unit tests through meson with the ABI reference unit test binary against the current ABI libraries and drivers.
For this to work, some unit tests must be skipped (since meson may invoke the ABI reference code with tests that were unknown at the time).
Quoted 8 lines
A few unit tests were directly dereferencing internal structures and are reworked so they use public APIs.
Additionally, unit tests were allowed to use any internal API which has hidden a few issues (like a public API backed by internal symbols in the hash library).
So disable the globalALLLOW_INTERNAL_APIand move it to code explicitly requiring internal API, with the hope it will push us to have better API.I think this causing breakage with minsize build. It is not correct to use
__rte_internalon inline helper functions in header file. I checked and only thash has that anti-pattern.In file included from
../lib/hash/rte_thash_gfni.h:13,from ../lib/hash/rte_thash.h:23, from ../app/test/test_thash_perf.c:13: In function ‘rte_thash_gfni’, inlined from ‘run_rss_calc’ at ../app/test/test_thash_perf.c:58:13: ../lib/hash/rte_thash_x86_gfni.h:181:27: error: call to ‘__rte_thash_gfni’ declared with attribute error: Symbol is not public ABI 181 | __m512i xor_acc = __rte_thash_gfni(m, tuple, NULL, len); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 7 lines
In function ‘rte_thash_gfni_bulk’,
inlined from ‘run_rss_calc_bulk’ at../app/test/test_thash_perf.c:79:3,
inlined from ‘run_thash_test’ at../app/test/test_thash_perf.c:122:13:../lib/hash/rte_thash_x86_gfni.h:213:27: error: call to ‘__rte_thash_gfni’ declared with attribute error: Symbol is not public ABI213 | xor_acc = __rte_thash_gfni(mtrx, tuple[i], tuple[i + 1], len); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Indeed.
I had disabled minsize builds some time (well, months) ago and forgot to re-enable them.
I'll send a fix soon.
Signature · 1 line
David Marchand