summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2014-02-18 04:27:41 +0000
committerluigi <luigi@FreeBSD.org>2014-02-18 04:27:41 +0000
commitc2bafade9307a03078e5afd8d1e94ee036192c8c (patch)
tree2ed500c7565d0cad3eabf04596f8aab890b8b9dc
parent521737384dcc8c078e0c9624cdc4d5f72e11b80d (diff)
downloadFreeBSD-src-c2bafade9307a03078e5afd8d1e94ee036192c8c.zip
FreeBSD-src-c2bafade9307a03078e5afd8d1e94ee036192c8c.tar.gz
two small changes:
- intercept FIONBIO and FIOASYNC ioctls on netmap file descriptors. libpcap calls them to set non blocking I/O on the file descriptor, for netmap this is a no-op because there is no read/write, but not intercepting would cause fcntl() to return -1 - rate limit and put under netmap.verbose some messages that occur when threads use concurrently the same file descriptor.
-rw-r--r--sys/dev/netmap/netmap.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c
index de88fb5..6fd8028 100644
--- a/sys/dev/netmap/netmap.c
+++ b/sys/dev/netmap/netmap.c
@@ -137,6 +137,7 @@ ports attached to the switch)
#include <sys/param.h> /* defines used in kernel.h */
#include <sys/kernel.h> /* types used in module initialization */
#include <sys/conf.h> /* cdevsw struct, UID, GID */
+#include <sys/filio.h> /* FIONBIO */
#include <sys/sockio.h>
#include <sys/socketvar.h> /* struct socket */
#include <sys/malloc.h>
@@ -1827,6 +1828,11 @@ netmap_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
break;
#ifdef __FreeBSD__
+ case FIONBIO:
+ case FIOASYNC:
+ ND("FIONBIO/FIOASYNC are no-ops");
+ break;
+
case BIOCIMMEDIATE:
case BIOCGHDRCMPLT:
case BIOCSHDRCMPLT:
@@ -2002,7 +2008,9 @@ flush_tx:
continue;
/* only one thread does txsync */
if (nm_kr_tryget(kring)) {
- D("%p lost race on txring %d, ok", priv, i);
+ if (netmap_verbose)
+ RD(2, "%p lost race on txring %d, ok",
+ priv, i);
continue;
}
if (nm_txsync_prologue(kring) >= kring->nkr_num_slots) {
@@ -2049,7 +2057,9 @@ do_retry_rx:
kring = &na->rx_rings[i];
if (nm_kr_tryget(kring)) {
- D("%p lost race on rxring %d, ok", priv, i);
+ if (netmap_verbose)
+ RD(2, "%p lost race on rxring %d, ok",
+ priv, i);
continue;
}
OpenPOWER on IntegriCloud