[PATCH] net/pcap: set live interface as non-blocking

Stephen Hemminger stephen at networkplumber.org
Sat Aug 24 20:07:10 CEST 2024


The DPDK PMD's are supposed to be non-blocking and poll for packets.
Configure PCAP to do this on live interface.

Bugzilla ID: 1526
Reported-by: Ofer Dagan <ofer.d at claroty.com>
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/pcap/pcap_ethdev.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index bfec085045..c4e6c93d4a 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -522,6 +522,12 @@ open_iface_live(const char *iface, pcap_t **pcap) {
 		return -1;
 	}
 
+	if (pcap_setnonblock(*pcap, 1, errbuf)) {
+		PMD_LOG(ERR, "Couldn't set non-blocking on %s: %s", iface, errbuf);
+		pcap_close(*pcap);
+		return -1;
+	}
+
 	return 0;
 }
 
-- 
2.43.0



More information about the dev mailing list