From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Subject: Re: [PATCH v4 0/3] null pmd minor cleanup and add test
Date: Sun, 11 Jan 2026 16:56:01 -0800 [thread overview]
Message-ID: <20260111165601.5b49a621@phoenix.local> (raw)
In-Reply-To: <20260110172336.9859-1-stephen@networkplumber.org>
On Sat, 10 Jan 2026 09:22:35 -0800
Stephen Hemminger <stephen@networkplumber.org> wrote:
> This series adds small optimization to net/null and
> adds a unit test for null PMD.
>
> v4 - change parameters to packet burst
>
> Stephen Hemminger (3):
> net/null: cleanup info_get
> test: generate larger packet bursts
> test: add a test for null PMD
>
> app/test/meson.build | 1 +
> app/test/packet_burst_generator.c | 38 +-
> app/test/packet_burst_generator.h | 4 +-
> app/test/test_pmd_null.c | 968 ++++++++++++++++++++++++++++++
> drivers/net/null/rte_eth_null.c | 9 +-
> 5 files changed, 994 insertions(+), 26 deletions(-)
> create mode 100644 app/test/test_pmd_null.c
>
AI code review feedback:
Now let me provide a comprehensive review of these three patches according to the DPDK guidelines.
---
## DPDK Patch Review: null PMD changes (v4 1-3/3)
### Patch 1/3: `net/null: cleanup info_get`
**Commit Message:**
- ✅ Subject line: 29 characters (≤60 limit)
- ✅ Format: `net/null: cleanup info_get` - correct prefix format
- ✅ Lowercase after colon
- ✅ No trailing period
- ✅ `Signed-off-by:` present with real name and email
- ✅ Body wrapped appropriately
**Code Review:**
| Severity | Issue |
|----------|-------|
| ✅ Good | Removing redundant NULL checks - ethdev validates arguments before calling driver callbacks |
| ✅ Good | `UINT32_MAX` is cleaner than `(uint32_t)-1` |
| ✅ Good | Removing `min_rx_bufsize = 0` since struct is zero-initialized |
| ✅ Good | Combining declaration with initialization |
**Verdict: LGTM** - Clean, straightforward improvement.
---
### Patch 2/3: `test: generate larger packet bursts`
**Commit Message:**
| Severity | Issue |
|----------|-------|
| ⚠️ Warning | Subject prefix `test:` should be `app/test:` per DPDK conventions |
| ✅ Good | Subject ≤60 characters |
| ✅ Good | Signed-off-by present |
| ✅ Good | Body explains the rationale clearly |
**Code Review:**
| Severity | Issue |
|----------|-------|
| ⚠️ Warning | Line 245: `if (i != (int)(nb_pkt_segs - 1))` - awkward cast. Consider changing loop variable `i` to `uint16_t` to avoid mixed signed/unsigned comparison |
| ℹ️ Info | The comment removal about `RTE_MAX_SEGS_PER_PKT` is good - the old comment was misleading (`nb_segs` is 16-bit, not 8-bit) |
**Suggested fix for the cast:**
```c
// Either change loop variable:
for (uint16_t seg = 1; seg < nb_pkt_segs; seg++) {
...
if (seg != nb_pkt_segs - 1)
// Or keep int and compare differently:
if (i < nb_pkt_segs - 1)
```
---
### Patch 3/3: `test: add a test for null PMD`
**Commit Message:**
| Severity | Issue |
|----------|-------|
| ⚠️ Warning | Subject prefix `test:` should be `app/test:` per DPDK conventions |
| ✅ Good | Subject ≤60 characters |
| ✅ Good | Signed-off-by present |
**Code Review:**
| Severity | Issue | Location |
|----------|-------|----------|
| ❌ Error | **Wrong dependency in meson.build**: `'net_ring'` should be `'net_null'` - the test uses null PMD, not ring PMD | `app/test/meson.build` |
| ❌ Error | **Bug in `test_mbuf_setup_burst()`**: Setting `m->buf_len = len` is incorrect. `buf_len` is the buffer size, not packet length. This corrupts the mbuf metadata and could cause memory corruption. Should only set `data_len` and `pkt_len`. | Lines 200-201 |
| ⚠️ Warning | Missing return value checks in `test_null_teardown()` for `rte_eth_dev_stop()` and `rte_eth_dev_close()` | Lines 137-138 |
| ⚠️ Warning | `test_null_mac_addr()` sets MAC but doesn't verify the change took effect | Lines 571-586 |
| ℹ️ Info | Good use of `TEST_SKIPPED` for multi-threaded test when insufficient lcores available |
| ✅ Good | SPDX license identifier on first line |
| ✅ Good | Copyright immediately follows SPDX |
| ✅ Good | Proper include ordering (system → DPDK → local) |
| ✅ Good | Comprehensive test coverage: basic RX/TX, stats, custom size, copy mode, no-rx mode, link status, RSS, RETA, MT |
**Critical fix needed in `test_mbuf_setup_burst()`:**
```c
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)
+ RTE_ETHER_MIN_LEN;
m->data_len = len;
- m->buf_len = len; /* ERROR: buf_len should not be modified! */
+ m->pkt_len = len; /* Set total packet length */
}
return 0;
}
```
**Fix for meson.build:**
```python
- 'test_pmd_null.c': ['net_ring', 'ethdev', 'bus_vdev'],
+ 'test_pmd_null.c': ['net_null', 'ethdev', 'bus_vdev'],
```
---
## Summary
| Patch | Status | Action Required |
|-------|--------|-----------------|
| 1/3 `net/null: cleanup info_get` | ✅ Ready | None - LGTM |
| 2/3 `test: generate larger packet bursts` | ⚠️ Minor issues | Consider prefix fix and cleaner loop variable |
| 3/3 `test: add a test for null PMD` | ❌ Needs v5 | Fix `buf_len` bug, fix meson dependency |
The critical issues in patch 3/3 (the `buf_len` corruption bug and wrong meson dependency) should be fixed before merging.
next prev parent reply other threads:[~2026-01-12 0:56 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-04 22:25 [PATCH] test: add a test for null PMD 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
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
2026-01-12 0:56 ` Stephen Hemminger [this message]
2026-01-14 18:30 ` [PATCH v5 0/3] test: add null PMD test suite Stephen Hemminger
2026-01-14 18:30 ` [PATCH v5 1/3] net/null: cleanup info_get Stephen Hemminger
2026-01-14 18:30 ` [PATCH v5 2/3] test: generate larger packet bursts Stephen Hemminger
2026-01-14 18:30 ` [PATCH v5 3/3] test: add a test for null PMD Stephen Hemminger
2026-01-18 16:50 ` [PATCH v6 0/3] test: add null PMD test suite Stephen Hemminger
2026-01-18 16:50 ` [PATCH v6 1/3] net/null: cleanup info response Stephen Hemminger
2026-01-18 16:50 ` [PATCH v6 2/3] test: generate larger packet bursts Stephen Hemminger
2026-01-18 16:50 ` [PATCH v6 3/3] test: add a test for null PMD Stephen Hemminger
2026-01-25 20:23 ` [PATCH v7 0/5] net/null: improvements and bug fixes Stephen Hemminger
2026-01-25 20:23 ` [PATCH v7 1/5] net/null: cleanup info response Stephen Hemminger
2026-01-25 20:23 ` [PATCH v7 2/5] test: generate larger packet bursts Stephen Hemminger
2026-01-25 20:23 ` [PATCH v7 3/5] test: add a test for null PMD Stephen Hemminger
2026-01-25 20:23 ` [PATCH v7 4/5] net/null: add check for pool vs packet size Stephen Hemminger
2026-01-25 20:23 ` [PATCH v7 5/5] net/null: check packet size argument Stephen Hemminger
2026-01-28 19:00 ` [PATCH v8 0/5] net/null: improvements and bug fixes Stephen Hemminger
2026-01-28 19:00 ` [PATCH v8 1/5] net/null: cleanup info response Stephen Hemminger
2026-01-28 19:00 ` [PATCH v8 2/5] test: generate larger packet bursts Stephen Hemminger
2026-01-28 19:00 ` [PATCH v8 3/5] test: add a test for null PMD Stephen Hemminger
2026-01-28 19:00 ` [PATCH v8 4/5] net/null: add check for pool vs packet size Stephen Hemminger
2026-01-28 19:00 ` [PATCH v8 5/5] net/null: check packet size argument Stephen Hemminger
2026-01-29 20:25 ` [PATCH v9 0/5] net/null: improvements and bug fixes Stephen Hemminger
2026-01-29 20:25 ` [PATCH v9 1/5] net/null: cleanup info response Stephen Hemminger
2026-01-29 20:25 ` [PATCH v9 2/5] net/null: validate the numeric devargs Stephen Hemminger
2026-01-29 20:25 ` [PATCH v9 3/5] net/null: remove redundant argument validation Stephen Hemminger
2026-01-29 20:25 ` [PATCH v9 4/5] test: support larger packet sizes in burst generator Stephen Hemminger
2026-01-29 20:25 ` [PATCH v9 5/5] test: add a test for null PMD Stephen Hemminger
2026-02-01 17:17 ` [PATCH v10 0/6] net/null: bug fixes and improvements Stephen Hemminger
2026-02-01 17:17 ` [PATCH v10 1/6] net/null: fix missing mbuf leakage in the copy transmit Stephen Hemminger
2026-02-01 17:17 ` [PATCH v10 2/6] net/null: cleanup info response Stephen Hemminger
2026-02-01 17:17 ` [PATCH v10 3/6] net/null: validate the numeric devargs Stephen Hemminger
2026-02-01 17:17 ` [PATCH v10 4/6] net/null: remove redundant argument validation Stephen Hemminger
2026-02-01 17:17 ` [PATCH v10 5/6] test: support larger packet sizes in burst generator Stephen Hemminger
2026-02-01 17:17 ` [PATCH v10 6/6] test: add a test for null PMD Stephen Hemminger
2026-02-02 22:16 ` [PATCH v11 0/7] net/null: bug fixes and improvements Stephen Hemminger
2026-02-02 22:16 ` [PATCH v11 1/7] net/null: fix missing mbuf leakage in the copy transmit Stephen Hemminger
2026-02-02 22:16 ` [PATCH v11 2/7] net/null: cleanup info response Stephen Hemminger
2026-02-02 22:16 ` [PATCH v11 3/7] net/null: validate the numeric devargs Stephen Hemminger
2026-02-02 22:16 ` [PATCH v11 4/7] net/null: remove redundant argument validation Stephen Hemminger
2026-02-02 22:16 ` [PATCH v11 5/7] test: support larger packet sizes in burst generator Stephen Hemminger
2026-02-02 22:16 ` [PATCH v11 6/7] test: add a test for null PMD Stephen Hemminger
2026-02-02 22:16 ` [PATCH v11 7/7] net/null: add VLAN insert and strip offload support 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=20260111165601.5b49a621@phoenix.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.