summaryrefslogtreecommitdiffstats
path: root/sys/net/netmap_user.h
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2012-02-27 19:05:01 +0000
committerluigi <luigi@FreeBSD.org>2012-02-27 19:05:01 +0000
commit3ac0fcfb9762b2fd4991f32bff09543ba13df0d0 (patch)
treea547096f4399bc66370c43d717a40e4b79eb8401 /sys/net/netmap_user.h
parent71d18727cc7b50dc4e7c4d02cab4232fd4b10711 (diff)
downloadFreeBSD-src-3ac0fcfb9762b2fd4991f32bff09543ba13df0d0.zip
FreeBSD-src-3ac0fcfb9762b2fd4991f32bff09543ba13df0d0.tar.gz
A bunch of netmap fixes:
USERSPACE: 1. add support for devices with different number of rx and tx queues; 2. add better support for zero-copy operation, adding an extra field to the netmap ring to indicate how many buffers we have already processed but not yet released (with help from Eddie Kohler); 3. The two changes above unfortunately require an API change, so while at it add a version field and some spares to the ioctl() argument to help detect mismatches. 4. update the manual page for the two changes above; 5. update sample applications in tools/tools/netmap KERNEL: 1. simplify the internal structures moving the global wait queues to the 'struct netmap_adapter'; 2. simplify the functions that map kring<->nic ring indexes 3. normalize device-specific code, helps mainteinance; 4. start exploring the impact of micro-optimizations (prefetch etc.) in the ixgbe driver. Use 'legacy' descriptors on the tx ring and prefetch slots gives about 20% speedup at 900 MHz. Another 7-10% would come from removing the explict calls to bus_dmamap* in the core (they are effectively NOPs in this case, but it takes expensive load of the per-buffer dma maps to figure out that they are all NULL. Rx performance not investigated. I am postponing the MFC so i can import a few more improvements before merging.
Diffstat (limited to 'sys/net/netmap_user.h')
-rw-r--r--sys/net/netmap_user.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/net/netmap_user.h b/sys/net/netmap_user.h
index 6449045..be66e7a 100644
--- a/sys/net/netmap_user.h
+++ b/sys/net/netmap_user.h
@@ -32,14 +32,13 @@
/*
* $FreeBSD$
- * $Id: netmap_user.h 9495 2011-10-18 15:28:23Z luigi $
+ * $Id: netmap_user.h 10597 2012-02-21 05:08:32Z luigi $
*
* This header contains the macros used to manipulate netmap structures
* and packets in userspace. See netmap(4) for more information.
*
- * The address of the struct netmap_if, say nifp, is determined
- * by the value returned from ioctl(.., NIOCREG, ...) and the mmap
- * region:
+ * The address of the struct netmap_if, say nifp, is computed from the
+ * value returned from ioctl(.., NIOCREG, ...) and the mmap region:
* ioctl(fd, NIOCREG, &req);
* mem = mmap(0, ... );
* nifp = NETMAP_IF(mem, req.nr_nifp);
@@ -71,21 +70,20 @@
#define NETMAP_RXRING(nifp, index) \
((struct netmap_ring *)((char *)(nifp) + \
- (nifp)->ring_ofs[index + (nifp)->ni_num_queues+1] ) )
+ (nifp)->ring_ofs[index + (nifp)->ni_tx_queues+1] ) )
#define NETMAP_BUF(ring, index) \
((char *)(ring) + (ring)->buf_ofs + ((index)*(ring)->nr_buf_size))
+#define NETMAP_BUF_IDX(ring, buf) \
+ ( ((char *)(buf) - ((char *)(ring) + (ring)->buf_ofs) ) / \
+ (ring)->nr_buf_size) )
+
#define NETMAP_RING_NEXT(r, i) \
((i)+1 == (r)->num_slots ? 0 : (i) + 1 )
/*
* Return 1 if the given tx ring is empty.
- *
- * @r netmap_ring descriptor pointer.
- * Special case, a negative value in hwavail indicates that the
- * transmit queue is idle.
- * XXX revise
*/
#define NETMAP_TX_RING_EMPTY(r) ((r)->avail >= (r)->num_slots - 1)
OpenPOWER on IntegriCloud