DPDK patches and discussions
 help / color / mirror / Atom feed
From: Marat Khalili <marat.khalili@huawei.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [PATCH v2 1/2] test: add a test for null PMD
Date: Tue, 6 Jan 2026 17:40:43 +0000	[thread overview]
Message-ID: <0e08cb939d1147c694b46c55c9668db2@huawei.com> (raw)
In-Reply-To: <20260106164815.158430-2-stephen@networkplumber.org>

> +/* Create random valid ethernet packets */
> +static int
> +test_mbuf_setup_burst(struct rte_mbuf **bufs, unsigned int burst_size)
> +{
> +	unsigned int i;
> +
> +	if (rte_pktmbuf_alloc_bulk(mp, bufs, burst_size) != 0)
> +		return -1;
> +
> +	for (i = 0; i < burst_size; i++) {
> +		struct rte_mbuf *m = bufs[i];
> +		uint16_t len;
> +
> +		/* Choose random length between ether min and available space */
> +		len = rte_rand_max(rte_pktmbuf_tailroom(m) - RTE_ETHER_MIN_LEN)

Nit: could technically use rte_pktmbuf_tailroom(m) - RTE_ETHER_MIN_LEN + 1.

> +			+ RTE_ETHER_MIN_LEN;
> +		m->data_len = len;
> +		m->buf_len = len;

Not sure why we are changing buf_len here.

> +	}
> +	return 0;
> +}

Would still be cool to verify non-standard data_off.

// snip

> +/*
> + * Test: MAC address operations
> + */
> +static int
> +test_null_mac_addr(void)
> +{
> +	struct rte_ether_addr mac_addr;
> +	struct rte_ether_addr new_mac = {
> +		.addr_bytes = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55}
> +	};
> +	int ret;
> +
> +	/* Get current MAC address */
> +	ret = rte_eth_macaddr_get(port_id, &mac_addr);
> +	TEST_ASSERT(ret == 0, "Failed to get MAC address");
> +
> +	/* Set new MAC address */
> +	ret = rte_eth_dev_default_mac_addr_set(port_id, &new_mac);
> +	TEST_ASSERT(ret == 0, "Failed to set MAC address");
> +

Still not checking that it actually does something.

> +	return TEST_SUCCESS;
> +}

I still wish the test was more behavior- and less implementation-based.
It almost feels like it works around existing bugs in the module now.
However I agree that no tests whatsoever is probably worse, therefore

Acked-by: Marat Khalili <marat.khalili@huawei.com>

  reply	other threads:[~2026-01-06 17:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-04 22:25 [PATCH] " Stephen Hemminger
2026-01-05 14:49 ` Marat Khalili
2026-01-05 17:38   ` Stephen Hemminger
2026-01-06 16:47 ` [PATCH v2 0/2] net/null: add a test Stephen Hemminger
2026-01-06 16:47   ` [PATCH v2 1/2] test: add a test for null PMD Stephen Hemminger
2026-01-06 17:40     ` Marat Khalili [this message]
2026-01-06 18:01       ` Stephen Hemminger
2026-01-06 16:47   ` [PATCH v2 2/2] net/null: revise info_get Stephen Hemminger
2026-01-08 20:40 ` [PATCH v3 0/3] test: new test for null PMD Stephen Hemminger
2026-01-08 20:40   ` [PATCH v3 1/3] net/null: cleanup info_get Stephen Hemminger
2026-01-08 20:40   ` [PATCH v3 2/3] test: allow larger packet sizes Stephen Hemminger
2026-01-09 15:00     ` Morten Brørup
2026-01-10 17:21       ` Stephen Hemminger
2026-01-08 20:40   ` [PATCH v3 3/3] test: add a test for null PMD Stephen Hemminger
2026-01-09  1:21     ` Stephen Hemminger
2026-01-10 17:22 ` [PATCH v4 0/3] null pmd minor cleanup and add test Stephen Hemminger
2026-01-10 17:22   ` [PATCH v4 1/3] net/null: cleanup info_get Stephen Hemminger
2026-01-10 17:22   ` [PATCH v4 2/3] test: generate larger packet bursts Stephen Hemminger
2026-01-10 17:22   ` [PATCH v4 3/3] test: add a test for null PMD Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e08cb939d1147c694b46c55c9668db2@huawei.com \
    --to=marat.khalili@huawei.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).