Clean up netmap(4) slightly

- Add missing sections for .Xr references.
- Replace .br with .Pp (the former macro is deprecated).
- Use the .Sx (section reference) macro when referring to
  LIBRARIES, not the .Xr (cross-reference) macro.
- Add commas after "e.g." and "i.e." [*].

Bump .Dd for the change

Approved by:	luigi
MFC after:	1 week
Reported by:	igor [*], make manlint
Sponsored by:	Dell EMC Isilon
Differential Revision:	D9859
This commit is contained in:
Enji Cooper 2017-03-03 06:18:47 +00:00
parent 3dd94b6769
commit 3f879a470b

View File

@ -27,16 +27,15 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd December 14, 2015 .Dd March 2, 2017
.Dt NETMAP 4 .Dt NETMAP 4
.Os .Os
.Sh NAME .Sh NAME
.Nm netmap .Nm netmap
.Nd a framework for fast packet I/O .Nd a framework for fast packet I/O
.br
.Nm VALE .Nm VALE
.Nd a fast VirtuAl Local Ethernet using the netmap API .Nd a fast VirtuAl Local Ethernet using the netmap API
.br .Pp
.Nm netmap pipes .Nm netmap pipes
.Nd a shared memory packet transport channel .Nd a shared memory packet transport channel
.Sh SYNOPSIS .Sh SYNOPSIS
@ -61,7 +60,7 @@ implementing a very fast and modular in-kernel software switch/dataplane;
a shared memory packet transport channel; a shared memory packet transport channel;
.It Nm netmap monitors .It Nm netmap monitors
a mechanism similar to a mechanism similar to
.Xr bpf .Xr bpf 4
to capture traffic to capture traffic
.El .El
.Pp .Pp
@ -85,7 +84,7 @@ NICs without native
.Nm .Nm
support can still use the API in emulated mode, support can still use the API in emulated mode,
which uses unmodified device drivers and is 3-5 times faster than which uses unmodified device drivers and is 3-5 times faster than
.Xr bpf .Xr bpf 4
or raw sockets. or raw sockets.
.Pp .Pp
Userspace clients can dynamically switch NICs into Userspace clients can dynamically switch NICs into
@ -175,8 +174,9 @@ ports (including
and and
.Nm netmap pipe .Nm netmap pipe
ports). ports).
Simpler, higher level functions are described in section Simpler, higher level functions are described in the
.Xr LIBRARIES . .Sx LIBRARIES
section.
.Pp .Pp
Ports and rings are created and controlled through a file descriptor, Ports and rings are created and controlled through a file descriptor,
created by opening a special device created by opening a special device
@ -191,14 +191,14 @@ argument.
.Va arg.nr_name .Va arg.nr_name
specifies the netmap port name, as follows: specifies the netmap port name, as follows:
.Bl -tag -width XXXX .Bl -tag -width XXXX
.It Dv OS network interface name (e.g. 'em0', 'eth1', ... ) .It Dv OS network interface name (e.g., 'em0', 'eth1', ... )
the data path of the NIC is disconnected from the host stack, the data path of the NIC is disconnected from the host stack,
and the file descriptor is bound to the NIC (one or all queues), and the file descriptor is bound to the NIC (one or all queues),
or to the host stack; or to the host stack;
.It Dv valeSSS:PPP .It Dv valeSSS:PPP
the file descriptor is bound to port PPP of VALE switch SSS. the file descriptor is bound to port PPP of VALE switch SSS.
Switch instances and ports are dynamically created if necessary. Switch instances and ports are dynamically created if necessary.
.br .Pp
Both SSS and PPP have the form [0-9a-zA-Z_]+ , the string Both SSS and PPP have the form [0-9a-zA-Z_]+ , the string
cannot exceed IFNAMSIZ characters, and PPP cannot cannot exceed IFNAMSIZ characters, and PPP cannot
be the name of any existing OS network interface. be the name of any existing OS network interface.
@ -340,14 +340,14 @@ should not be assumed to be a power of two.
.Pp .Pp
.Va head .Va head
is the first slot available to userspace; is the first slot available to userspace;
.br .Pp
.Va cur .Va cur
is the wakeup point: is the wakeup point:
select/poll will unblock when select/poll will unblock when
.Va tail .Va tail
passes passes
.Va cur ; .Va cur ;
.br .Pp
.Va tail .Va tail
is the first slot reserved to the kernel. is the first slot reserved to the kernel.
.Pp .Pp
@ -419,7 +419,7 @@ Below is an example of the evolution of a TX ring:
.Fn select .Fn select
and and
.Fn poll .Fn poll
will block if there is no space in the ring, i.e. will block if there is no space in the ring, i.e.,
.Dl ring->cur == ring->tail .Dl ring->cur == ring->tail
and return when new slots have become available. and return when new slots have become available.
.Pp .Pp
@ -453,7 +453,7 @@ slots up to
are returned to the kernel for further receives, and are returned to the kernel for further receives, and
.Va tail .Va tail
may advance to report new incoming packets. may advance to report new incoming packets.
.br .Pp
Below is an example of the evolution of an RX ring: Below is an example of the evolution of an RX ring:
.Bd -literal .Bd -literal
after the syscall, there are some (h)eld and some (R)eceived slots after the syscall, there are some (h)eld and some (R)eceived slots
@ -510,7 +510,7 @@ packet must not be used in the learning bridge code.
indicates that the packet's payload is in a user-supplied buffer indicates that the packet's payload is in a user-supplied buffer
whose user virtual address is in the 'ptr' field of the slot. whose user virtual address is in the 'ptr' field of the slot.
The size can reach 65535 bytes. The size can reach 65535 bytes.
.br .Pp
This is only supported on the transmit ring of This is only supported on the transmit ring of
.Nm VALE .Nm VALE
ports, and it helps reducing data copies in the interconnection ports, and it helps reducing data copies in the interconnection
@ -592,8 +592,8 @@ indicate the size of transmit and receive rings.
indicate the number of transmit indicate the number of transmit
and receive rings. and receive rings.
Both ring number and sizes may be configured at runtime Both ring number and sizes may be configured at runtime
using interface-specific functions (e.g. using interface-specific functions (e.g.,
.Xr ethtool .Xr ethtool 8
). ).
.El .El
.It Dv NIOCREGIF .It Dv NIOCREGIF
@ -611,7 +611,7 @@ The recommended way to bind a file descriptor to a port is
to use function to use function
.Va nm_open(..) .Va nm_open(..)
(see (see
.Xr LIBRARIES ) .Sx LIBRARIES )
which parses names to access specific port types and which parses names to access specific port types and
enable features. enable features.
In the following we document the main features. In the following we document the main features.
@ -761,7 +761,7 @@ The following functions are available:
.Bl -tag -width XXXXX .Bl -tag -width XXXXX
.It Va struct nm_desc * nm_open(const char *ifname, const struct nmreq *req, uint64_t flags, const struct nm_desc *arg) .It Va struct nm_desc * nm_open(const char *ifname, const struct nmreq *req, uint64_t flags, const struct nm_desc *arg)
similar to similar to
.Xr pcap_open , .Xr pcap_open 3pcap ,
binds a file descriptor to a port. binds a file descriptor to a port.
.Bl -tag -width XX .Bl -tag -width XX
.It Va ifname .It Va ifname
@ -774,7 +774,7 @@ The nm_flags and nm_ringid values are overwritten by parsing
ifname and flags, and other fields can be overridden through ifname and flags, and other fields can be overridden through
the other two arguments. the other two arguments.
.It Va arg .It Va arg
points to a struct nm_desc containing arguments (e.g. from a previously points to a struct nm_desc containing arguments (e.g., from a previously
open file descriptor) that should override the defaults. open file descriptor) that should override the defaults.
The fields are used as described below The fields are used as described below
.It Va flags .It Va flags
@ -830,10 +830,11 @@ mode but still significantly higher than various raw socket types
Note that for slow devices (such as 1 Gbit/s and slower NICs, Note that for slow devices (such as 1 Gbit/s and slower NICs,
or several 10 Gbit/s NICs whose hardware is unable to sustain line rate), or several 10 Gbit/s NICs whose hardware is unable to sustain line rate),
emulated and native mode will likely have similar or same throughput. emulated and native mode will likely have similar or same throughput.
.br .Pp
When emulation is in use, packet sniffer programs such as tcpdump When emulation is in use, packet sniffer programs such as tcpdump
could see received packets before they are diverted by netmap. This behaviour could see received packets before they are diverted by netmap.
is not intentional, being just an artifact of the implementation of emulation. This behaviour is not intentional, being just an artifact of the implementation
of emulation.
Note that in case the netmap application subsequently moves packets received Note that in case the netmap application subsequently moves packets received
from the emulated adapter onto the host RX ring, the sniffer will intercept from the emulated adapter onto the host RX ring, the sniffer will intercept
those packets again, since the packets are injected to the host stack as they those packets again, since the packets are injected to the host stack as they
@ -854,11 +855,11 @@ and module parameters on Linux
.Bl -tag -width indent .Bl -tag -width indent
.It Va dev.netmap.admode: 0 .It Va dev.netmap.admode: 0
Controls the use of native or emulated adapter mode. Controls the use of native or emulated adapter mode.
.br .Pp
0 uses the best available option; 0 uses the best available option;
.br .Pp
1 forces native mode and fails if not available; 1 forces native mode and fails if not available;
.br .Pp
2 forces emulated hence never fails. 2 forces emulated hence never fails.
.It Va dev.netmap.generic_ringsize: 1024 .It Va dev.netmap.generic_ringsize: 1024
Ring size used for emulated netmap mode Ring size used for emulated netmap mode
@ -939,7 +940,7 @@ directory in
.Fx .Fx
distributions. distributions.
.Pp .Pp
.Xr pkt-gen .Xr pkt-gen 8
is a general purpose traffic source/sink. is a general purpose traffic source/sink.
.Pp .Pp
As an example As an example
@ -950,11 +951,11 @@ is a traffic sink.
Both print traffic statistics, to help monitor Both print traffic statistics, to help monitor
how the system performs. how the system performs.
.Pp .Pp
.Xr pkt-gen .Xr pkt-gen 8
has many options can be uses to set packet sizes, addresses, has many options can be uses to set packet sizes, addresses,
rates, and use multiple send/receive threads and cores. rates, and use multiple send/receive threads and cores.
.Pp .Pp
.Xr bridge .Xr bridge 4
is another test program which interconnects two is another test program which interconnects two
.Nm .Nm
ports. ports.
@ -1046,7 +1047,7 @@ to replenish the receive ring:
.Ed .Ed
.Ss ACCESSING THE HOST STACK .Ss ACCESSING THE HOST STACK
The host stack is for all practical purposes just a regular ring pair, The host stack is for all practical purposes just a regular ring pair,
which you can access with the netmap API (e.g. with which you can access with the netmap API (e.g., with
.Dl nm_open("netmap:eth0^", ... ) ; .Dl nm_open("netmap:eth0^", ... ) ;
All packets that the host would send to an interface in All packets that the host would send to an interface in
.Nm .Nm
@ -1056,11 +1057,11 @@ TX ring are send up to the host stack.
A simple way to test the performance of a A simple way to test the performance of a
.Nm VALE .Nm VALE
switch is to attach a sender and a receiver to it, switch is to attach a sender and a receiver to it,
e.g. running the following in two different terminals: e.g., running the following in two different terminals:
.Dl pkt-gen -i vale1:a -f rx # receiver .Dl pkt-gen -i vale1:a -f rx # receiver
.Dl pkt-gen -i vale1:b -f tx # sender .Dl pkt-gen -i vale1:b -f tx # sender
The same example can be used to test netmap pipes, by simply The same example can be used to test netmap pipes, by simply
changing port names, e.g. changing port names, e.g.,
.Dl pkt-gen -i vale2:x{3 -f rx # receiver on the master side .Dl pkt-gen -i vale2:x{3 -f rx # receiver on the master side
.Dl pkt-gen -i vale2:x}3 -f tx # sender on the slave side .Dl pkt-gen -i vale2:x}3 -f tx # sender on the slave side
.Pp .Pp
@ -1128,7 +1129,7 @@ multiqueue, schedulers, packet filters.
Multiple transmit and receive rings are supported natively Multiple transmit and receive rings are supported natively
and can be configured with ordinary OS tools, and can be configured with ordinary OS tools,
such as such as
.Xr ethtool .Xr ethtool 8
or or
device-specific sysctl variables. device-specific sysctl variables.
The same goes for Receive Packet Steering (RPS) The same goes for Receive Packet Steering (RPS)