svn commit: r270292 - stable/10/sys/net

Navdeep Parhar np at FreeBSD.org
Thu Aug 21 19:42:04 UTC 2014


Author: np
Date: Thu Aug 21 19:42:03 2014
New Revision: 270292
URL: http://svnweb.freebsd.org/changeset/base/270292

Log:
  Update a couple of header files that were missed in r270252.  This is a
  direct commit to stable/10.
  
  Submitted by:	luigi

Modified:
  stable/10/sys/net/netmap.h
  stable/10/sys/net/netmap_user.h

Modified: stable/10/sys/net/netmap.h
==============================================================================
--- stable/10/sys/net/netmap.h	Thu Aug 21 19:32:54 2014	(r270291)
+++ stable/10/sys/net/netmap.h	Thu Aug 21 19:42:03 2014	(r270292)
@@ -445,6 +445,13 @@ struct netmap_if {
  *		Set the virtio-net header length used by the client
  *		of a VALE switch port.
  *
+ *	NETMAP_BDG_NEWIF
+ *		create a persistent VALE port with name nr_name.
+ *		Used by vale-ctl -n ...
+ *
+ *	NETMAP_BDG_DELIF
+ *		delete a persistent VALE port. Used by vale-ctl -d ...
+ *
  * nr_arg1, nr_arg2, nr_arg3  (in/out)		command specific
  *
  *
@@ -478,11 +485,12 @@ struct nmreq {
 	uint16_t	nr_cmd;
 #define NETMAP_BDG_ATTACH	1	/* attach the NIC */
 #define NETMAP_BDG_DETACH	2	/* detach the NIC */
-#define NETMAP_BDG_LOOKUP_REG	3	/* register lookup function */
+#define NETMAP_BDG_REGOPS	3	/* register bridge callbacks */
 #define NETMAP_BDG_LIST		4	/* get bridge's info */
 #define NETMAP_BDG_VNET_HDR     5       /* set the port virtio-net-hdr length */
 #define NETMAP_BDG_OFFSET	NETMAP_BDG_VNET_HDR	/* deprecated alias */
-
+#define NETMAP_BDG_NEWIF	6	/* create a virtual port */
+#define NETMAP_BDG_DELIF	7	/* destroy a virtual port */
 	uint16_t	nr_arg1;	/* reserve extra rings in NIOCREGIF */
 #define NETMAP_BDG_HOST		1	/* attach the host stack on ATTACH */
 
@@ -517,6 +525,7 @@ enum {	NR_REG_DEFAULT	= 0,	/* backward c
 #define NIOCREGIF	_IOWR('i', 146, struct nmreq) /* interface register */
 #define NIOCTXSYNC	_IO('i', 148) /* sync tx queues */
 #define NIOCRXSYNC	_IO('i', 149) /* sync rx queues */
+#define NIOCCONFIG	_IOWR('i',150, struct nm_ifreq) /* for ext. modules */
 #endif /* !NIOCREGIF */
 
 
@@ -533,4 +542,15 @@ nm_ring_empty(struct netmap_ring *ring)
 	return (ring->cur == ring->tail);
 }
 
+/*
+ * Opaque structure that is passed to an external kernel
+ * module via ioctl(fd, NIOCCONFIG, req) for a user-owned
+ * bridge port (at this point ephemeral VALE interface).
+ */
+#define NM_IFRDATA_LEN 256
+struct nm_ifreq {
+	char nifr_name[IFNAMSIZ];
+	char data[NM_IFRDATA_LEN];
+};
+
 #endif /* _NET_NETMAP_H_ */

Modified: stable/10/sys/net/netmap_user.h
==============================================================================
--- stable/10/sys/net/netmap_user.h	Thu Aug 21 19:32:54 2014	(r270291)
+++ stable/10/sys/net/netmap_user.h	Thu Aug 21 19:42:03 2014	(r270292)
@@ -149,21 +149,21 @@ nm_ring_space(struct netmap_ring *ring)
 #define ND(_fmt, ...) do {} while(0)
 #define D(_fmt, ...)						\
 	do {							\
-		struct timeval t0;				\
-		gettimeofday(&t0, NULL);			\
+		struct timeval _t0;				\
+		gettimeofday(&_t0, NULL);			\
 		fprintf(stderr, "%03d.%06d %s [%d] " _fmt "\n",	\
-		    (int)(t0.tv_sec % 1000), (int)t0.tv_usec,	\
+		    (int)(_t0.tv_sec % 1000), (int)_t0.tv_usec,	\
 		    __FUNCTION__, __LINE__, ##__VA_ARGS__);	\
         } while (0)
 
 /* Rate limited version of "D", lps indicates how many per second */
 #define RD(lps, format, ...)                                    \
     do {                                                        \
-        static int t0, __cnt;                                   \
+        static int __t0, __cnt;                                 \
         struct timeval __xxts;                                  \
         gettimeofday(&__xxts, NULL);                            \
-        if (t0 != __xxts.tv_sec) {                              \
-            t0 = __xxts.tv_sec;                                 \
+        if (__t0 != __xxts.tv_sec) {                            \
+            __t0 = __xxts.tv_sec;                               \
             __cnt = 0;                                          \
         }                                                       \
         if (__cnt++ < lps) {                                    \
@@ -495,23 +495,23 @@ nm_open(const char *ifname, const struct
 			(char *)d->mem + d->memsize;
 	}
 
-	if (nr_flags ==  NR_REG_SW) { /* host stack */
+	if (d->req.nr_flags ==  NR_REG_SW) { /* host stack */
 		d->first_tx_ring = d->last_tx_ring = d->req.nr_tx_rings;
 		d->first_rx_ring = d->last_rx_ring = d->req.nr_rx_rings;
-	} else if (nr_flags ==  NR_REG_ALL_NIC) { /* only nic */
+	} else if (d->req.nr_flags ==  NR_REG_ALL_NIC) { /* only nic */
 		d->first_tx_ring = 0;
 		d->first_rx_ring = 0;
 		d->last_tx_ring = d->req.nr_tx_rings - 1;
 		d->last_rx_ring = d->req.nr_rx_rings - 1;
-	} else if (nr_flags ==  NR_REG_NIC_SW) {
+	} else if (d->req.nr_flags ==  NR_REG_NIC_SW) {
 		d->first_tx_ring = 0;
 		d->first_rx_ring = 0;
 		d->last_tx_ring = d->req.nr_tx_rings;
 		d->last_rx_ring = d->req.nr_rx_rings;
-	} else if (nr_flags == NR_REG_ONE_NIC) {
+	} else if (d->req.nr_flags == NR_REG_ONE_NIC) {
 		/* XXX check validity */
 		d->first_tx_ring = d->last_tx_ring =
-		d->first_rx_ring = d->last_rx_ring = nr_ringid;
+		d->first_rx_ring = d->last_rx_ring = d->req.nr_ringid & NETMAP_RING_MASK;
 	} else { /* pipes */
 		d->first_tx_ring = d->last_tx_ring = 0;
 		d->first_rx_ring = d->last_rx_ring = 0;


More information about the svn-src-all mailing list