summaryrefslogtreecommitdiffstats
path: root/share/man/man4/netmap.4
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 /share/man/man4/netmap.4
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 'share/man/man4/netmap.4')
-rw-r--r--share/man/man4/netmap.422
1 files changed, 15 insertions, 7 deletions
diff --git a/share/man/man4/netmap.4 b/share/man/man4/netmap.4
index 1ad574d..dfd96b0 100644
--- a/share/man/man4/netmap.4
+++ b/share/man/man4/netmap.4
@@ -28,7 +28,7 @@
.\" $FreeBSD$
.\" $Id: netmap.4 9662 2011-11-16 13:18:06Z luigi $: stable/8/share/man/man4/bpf.4 181694 2008-08-13 17:45:06Z ed $
.\"
-.Dd November 16, 2011
+.Dd February 27, 2012
.Dt NETMAP 4
.Os
.Sh NAME
@@ -123,8 +123,9 @@ one ring pair (numbered N) for packets from/to the host stack.
struct netmap_ring {
const ssize_t buf_ofs;
const uint32_t num_slots; /* number of slots in the ring. */
- uint32_t avail; /* number of usable slots */
- uint32_t cur; /* 'current' index for the user side */
+ uint32_t avail; /* number of usable slots */
+ uint32_t cur; /* 'current' index for the user side */
+ uint32_t reserved; /* not refilled before current */
const uint16_t nr_buf_size;
uint16_t flags;
@@ -173,10 +174,14 @@ defined as follows:
.Bd -literal
struct nmreq {
char nr_name[IFNAMSIZ];
+ uint32_t nr_version; /* API version */
+#define NETMAP_API 2 /* current version */
uint32_t nr_offset; /* nifp offset in the shared region */
uint32_t nr_memsize; /* size of the shared region */
- uint32_t nr_numdescs; /* descriptors per queue */
- uint16_t nr_numqueues;
+ uint32_t nr_tx_slots; /* slots in tx rings */
+ uint32_t nr_rx_slots; /* slots in rx rings */
+ uint16_t nr_tx_rings; /* number of tx rings */
+ uint16_t nr_rx_rings; /* number of tx rings */
uint16_t nr_ringid; /* ring(s) we care about */
#define NETMAP_HW_RING 0x4000 /* low bits indicate one hw ring */
#define NETMAP_SW_RING 0x2000 /* we process the sw ring */
@@ -199,8 +204,10 @@ and are:
returns information about the interface named in nr_name.
On return, nr_memsize indicates the size of the shared netmap
memory region (this is device-independent),
-nr_numslots indicates how many buffers are in a ring,
-nr_numrings indicates the number of rings supported by the hardware.
+nr_tx_slots and nr_rx_slots indicates how many buffers are in a
+transmit and receive ring,
+nr_tx_rings and nr_rx_rings indicates the number of transmit
+and receive rings supported by the hardware.
.Pp
If the device does not support netmap, the ioctl returns EINVAL.
.It Dv NIOCREGIF
@@ -266,6 +273,7 @@ struct netmap_request nmr;
fd = open("/dev/netmap", O_RDWR);
bzero(&nmr, sizeof(nmr));
strcpy(nmr.nm_name, "ix0");
+nmr.nm_version = NETMAP_API;
ioctl(fd, NIOCREG, &nmr);
p = mmap(0, nmr.memsize, fd);
nifp = NETMAP_IF(p, nmr.offset);
OpenPOWER on IntegriCloud