RE: [PATCH v3 08/14] test/bpf: skip ELF test if null PMD disabled

Marat Khalili
2026-01-23T11:56:14Z

> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Thursday 22 January 2026 00:50
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; stable@dpdk.org; Konstantin Ananyev
> <konstantin.ananyev@huawei.com>; Marat Khalili <marat.khalili@huawei.com>
> Subject: [PATCH v3 08/14] test/bpf: skip ELF test if null PMD disabled
>
> If null PMD is disabled, the test to load filter can not work
> because it uses that. Change to skip the test if setup fails.
>
> Fixes: 81038845c90b ("test/bpf: add Rx and Tx filtering")
> Cc: stable@dpdk.org
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> app/test/test_bpf.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c
> index 0e969f9f13..8bf783c00c 100644
> --- a/app/test/test_bpf.c
> +++ b/app/test/test_bpf.c
> @@ -3441,7 +3441,11 @@ static int null_vdev_setup(const char *name, uint16_t *port, struct rte_mempool
>
> /* Make a null device */
> ret = rte_vdev_init(name, NULL);
> - TEST_ASSERT(ret == 0, "rte_vdev_init(%s) failed: %d", name, ret);
> + if (ret != 0) {
> + printf("rte_vdev_init(%s) failed: %d:%s\n",
> + name, ret, strerror(-ret));
> + return -ENOTSUP;
> + }
>
> ret = rte_eth_dev_get_port_by_name(name, port);
> TEST_ASSERT(ret == 0, "failed to get port id for %s: %d", name, ret);
> --
> 2.51.0

I know there are multiple approaches considered, but this one is ok as well.

However, I would only return -ENOTSUP if we _know_ null PMD is disabled, not
if it just failed to initialize.