Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Feb 2014 04:27:41 +0000 (UTC)
From:      Luigi Rizzo <luigi@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r262149 - head/sys/dev/netmap
Message-ID:  <201402180427.s1I4RfiZ024875@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: luigi
Date: Tue Feb 18 04:27:41 2014
New Revision: 262149
URL: http://svnweb.freebsd.org/changeset/base/262149

Log:
  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.

Modified:
  head/sys/dev/netmap/netmap.c

Modified: head/sys/dev/netmap/netmap.c
==============================================================================
--- head/sys/dev/netmap/netmap.c	Tue Feb 18 03:42:49 2014	(r262148)
+++ head/sys/dev/netmap/netmap.c	Tue Feb 18 04:27:41 2014	(r262149)
@@ -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 cm
 		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;
 			}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402180427.s1I4RfiZ024875>