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 five patches are fixes:

 - guard eth_memif_tx() against an empty burst so a zero-count call
   returns before touching the burst or the ring;
 - close file descriptor 0 instead of leaking it (the close path
   tested for fd > 0 instead of fd >= 0);
 - free the MAC address allocated during probe when a later step
   fails, instead of leaking it;
 - unwind a partially-created device on failure in memif_create(),
   releasing the port and the process-private data rather than
   returning with them registered and leaked;
 - disconnect the device on close so queues and shared regions are
   torn down, and make memif_disconnect() safe to call on a device
   that was configured but never started.

The last patch adds a memif PMD unit test (app/test, memif_pmd_autotest)
that stands up a server/client vdev pair over a loopback socket and
covers dev_info, link state, stats, single- and multi-segment loopback,
stop/start reconnect, empty Tx burst, and close without stop.

Verified: memif_pmd_autotest passes 9/9; check-git-log and checkpatch
are clean across the series.

Sriram Yagnaraman (6):
  net/memif: guard against empty Tx burst
  net/memif: close file descriptor zero
  net/memif: fix MAC address leak on probe failure
  net/memif: unwind partial device on create failure
  net/memif: disconnect on device close
  test/memif: add memif PMD unit test

 app/test/meson.build              |   1 +
 app/test/test_pmd_memif.c         | 574 ++++++++++++++++++++++++++++++
 drivers/net/memif/memif_socket.c  |  14 +-
 drivers/net/memif/rte_eth_memif.c |  59 ++-
 4 files changed, 626 insertions(+), 22 deletions(-)
 create mode 100644 app/test/test_pmd_memif.c

-- 
2.43.7

Reply via email to