DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test/pmd_af_packet: cleanups
@ 2026-06-22 23:21 Stephen Hemminger
  0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2026-06-22 23:21 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

Fix two coverity bugs where fcntl() return value not checked.
Also mark some other cases as FAILED instead of skipped.
Such as failure to transmit or failure to allocate mbuf's.

Coverity ID: 503765
Coverity ID: 503766

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_pmd_af_packet.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/app/test/test_pmd_af_packet.c b/app/test/test_pmd_af_packet.c
index b668ca5b81..9fe595d606 100644
--- a/app/test/test_pmd_af_packet.c
+++ b/app/test/test_pmd_af_packet.c
@@ -556,19 +556,22 @@ test_af_packet_loopback(void)
 
 	/* Set TAP fd to non-blocking for reading */
 	int flags = fcntl(tap_fd, F_GETFL, 0);
-	fcntl(tap_fd, F_SETFL, flags | O_NONBLOCK);
+	if (flags < 0 || fcntl(tap_fd, F_SETFL, flags | O_NONBLOCK) < 0) {
+		printf("fcntl failed: %s\n", strerror(errno));
+		return TEST_FAILED;
+	}
 
 	/* Allocate and send packets */
 	allocated = alloc_tx_mbufs(tx_bufs, BURST_SIZE);
 	if (allocated == 0) {
-		printf("SKIPPED: Could not allocate mbufs\n");
-		return TEST_SKIPPED;
+		printf("Could not allocate mbufs\n");
+		return TEST_FAILED;
 	}
 
 	nb_tx = do_tx_burst(port_id, 0, tx_bufs, allocated);
 	if (nb_tx == 0) {
-		printf("SKIPPED: No packets transmitted\n");
-		return TEST_SKIPPED;
+		printf("No packets transmitted\n");
+		return TEST_FAILED;
 	}
 
 	/*
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-22 23:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-22 23:21 [PATCH] test/pmd_af_packet: cleanups Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox