[PATCH v2 0/8] net/memif: lifecycle fixes and unit test
Sriram Yagnaraman
sriram.yagnaraman at ericsson.com
Thu Oct 15 16:39:37 CEST 2026
This series fixes a set of error-path and lifecycle bugs in the memif
PMD and adds a unit test for the driver.
The first seven patches are fixes:
- guard eth_memif_tx() against an empty burst (nb_pkts == 0);
- close file descriptor 0 instead of leaking it;
- do not close the EAL-owned memseg fd in zero-copy mode;
- free the MAC address allocated during probe on failure;
- unwind a partially-created device on create failure;
- disconnect on close so a stopped server's control channel is not
leaked, and make memif_disconnect() safe on a never-started device;
- fix eth_memif_tx_zc() returning 65535 on an invalid interrupt fd.
The last patch adds a memif PMD unit test (app/test, memif_pmd_autotest):
a server/client vdev pair over a loopback socket covering dev_info, link
state, stats, single-segment loopback (slow and fast path), multi-segment
loopback across a ring wrap, stop/start reconnect, empty Tx burst, and
close without stop.
Verified: memif_pmd_autotest passes 10/10; each commit builds with
-Dwerror=true; check-git-log and checkpatch are clean.
Thanks to Stephen Hemminger and the ai-code-review bot for the v1 review
that prompted all of the v2 changes below.
v2:
- P1: correct Fixes tag (Tx fast path, not original driver); move the
empty-burst check after the ring == NULL block.
- P2: drop the memseg-fd change from this patch; split it out as a
separate fix (new patch 3) that stops closing the EAL-owned fd
rather than widening the check to ">= 0".
- P3 (new): do not close the EAL-owned memseg fd in either
memif_connect() or memif_free_regions().
- P4 (MAC leak): document the secondary -1 -> -ENOMEM change.
- P5 (unwind): add Fixes: multi-process support.
- P6 (disconnect): rewrite the commit message to name the real
trigger (server binds pmd->cc without a dev_started check).
- New patch 7: fix eth_memif_tx_zc() bogus Tx count on invalid fd.
- Test: add the file to MAINTAINERS; make close-without-stop actually
connect a peer so the cc leak is exercised; return TEST_FAILED (not
SKIPPED) on probe failure; add a default-bsize pair to cover the Tx
fast path; set ring size via rsize and fix the stale comments; verify
the full payload instead of the first byte.
Sriram Yagnaraman (8):
net/memif: guard against empty Tx burst
net/memif: close file descriptor zero
net/memif: do not close EAL-owned memseg file descriptor
net/memif: fix MAC address leak on probe failure
net/memif: unwind partial device on create failure
net/memif: disconnect on device close
net/memif: fix bogus Tx count on invalid interrupt FD
test/memif: add memif PMD unit test
MAINTAINERS | 1 +
app/test/meson.build | 1 +
app/test/test_pmd_memif.c | 693 ++++++++++++++++++++++++++++++
drivers/net/memif/memif_socket.c | 14 +-
drivers/net/memif/rte_eth_memif.c | 70 +--
5 files changed, 750 insertions(+), 29 deletions(-)
create mode 100644 app/test/test_pmd_memif.c
--
2.43.7
More information about the dev
mailing list