| #
64ae02c3
|
| 27-Feb-2012 |
Luigi Rizzo <luigi@FreeBSD.org> |
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
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.
show more ...
|
| #
babc7c12
|
| 17-Feb-2012 |
Luigi Rizzo <luigi@FreeBSD.org> |
Various cleanups for readability (no functional changes)
- remove the KEVENT code, which was incomplete and not compiled anyways; - change some while() loops into for() - adjust indentation - remove
Various cleanups for readability (no functional changes)
- remove the KEVENT code, which was incomplete and not compiled anyways; - change some while() loops into for() - adjust indentation - remove extra whitespace
MFC after: 1 week
show more ...
|
| #
9dba179d
|
| 17-Feb-2012 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
IFC @231845
Sponsored by: Cisco Systems, Inc.
|
| #
1a26580e
|
| 13-Feb-2012 |
Luigi Rizzo <luigi@FreeBSD.org> |
- use struct ifnet as explicit type of the argument to the txsync() and rxsync() callbacks, removing some variables made useless by this change;
- add generic lock and irq handling routines. The
- use struct ifnet as explicit type of the argument to the txsync() and rxsync() callbacks, removing some variables made useless by this change;
- add generic lock and irq handling routines. These can be useful in case there are no driver locks that we can reuse;
- add a few macros to reduce differences with the Linux version.
show more ...
|
| #
5819da83
|
| 08-Feb-2012 |
Luigi Rizzo <luigi@FreeBSD.org> |
- change the buffer size from a constant to a TUNABLE variable (hw.netmap.buf_size) so we can experiment with values different from 2048 which may give better cache performance.
- rearrange the
- change the buffer size from a constant to a TUNABLE variable (hw.netmap.buf_size) so we can experiment with values different from 2048 which may give better cache performance.
- rearrange the memory allocation code so it will be easier to replace it with a different implementation. The current code relies on a single large contiguous chunk of memory obtained through contigmalloc. The new implementation (not committed yet) uses multiple smaller chunks which are easier to fit in a fragmented address space.
show more ...
|
| #
2157a17c
|
| 26-Jan-2012 |
Luigi Rizzo <luigi@FreeBSD.org> |
ixgbe changes: - remove experimental code for disabling CRC - use the correct constant for conversion between interrupt rate and EITR values (the previous values were off by a factor of 2) - make d
ixgbe changes: - remove experimental code for disabling CRC - use the correct constant for conversion between interrupt rate and EITR values (the previous values were off by a factor of 2) - make dev.ix.N.queueM.interrupt_rate a RW sysctl variable. Changing individual values affects the queue immediately, and propagates to all interfaces at the next reinit. - add dev.ix.N.queueM.irqs rdonly sysctl, to export the actual interrupt counts
Netmap-related changes for ixgbe: - use the "new" format for TX descriptors in netmap mode. - pass interrupt mitigation delays to the user process doing poll() on a netmap file descriptor. On the RX side this means we will not check the ring more than once per interrupt. This gives the process a chance to sleep and process packets in larger batches, thus reducing CPU usage. On the TX side we take this even further: completed transmissions are reclaimed every half ring even if the NIC interrupts more often. This saves even more CPU without any additional tx delays.
Generic Netmap-related changes: - align the netmap_kring to cache lines so that there is no false sharing (possibly useful for multiqueue NICs and MSIX interrupts, which are handled by different cores). It's a minor improvement but it does not cost anything.
Reviewed by: Jack Vogel Approved by: Jack Vogel
show more ...
|
| #
bcda432e
|
| 13-Jan-2012 |
Luigi Rizzo <luigi@FreeBSD.org> |
indentation and whitespace fixes
|
| #
6dba29a2
|
| 13-Jan-2012 |
Luigi Rizzo <luigi@FreeBSD.org> |
Two performance-related fixes: 1. as reported by Alexander Fiveg, the allocator was reporting half of the allocated memory. Fix this by exiting from the loop earlier (not too critical because t
Two performance-related fixes: 1. as reported by Alexander Fiveg, the allocator was reporting half of the allocated memory. Fix this by exiting from the loop earlier (not too critical because this code is going away soon).
2. following a discussion on freebsd-current http://lists.freebsd.org/pipermail/freebsd-current/2012-January/031144.html turns out that (re)loading the dmamap was expensive and not optimized. This operation is in the critical path when doing zero-copy forwarding between interfaces. At least on netmap and i386/amd64, the bus_dmamap_load can be completely bypassed if the map is NULL, so we do it.
The latter change gives an almost 3x improvement in forwarding performance, from the previous 9.5Mpps at 2.9GHz to the current line rate (14.2Mpps) at 1.733GHz. (this is for 64+4 byte packets, in other configurations the PCIe bus is a bottleneck).
show more ...
|
| #
446ee301
|
| 10-Jan-2012 |
Luigi Rizzo <luigi@FreeBSD.org> |
other simplifications in the internal interfaces to the memory allocator.
|
| #
6e10c8b8
|
| 10-Jan-2012 |
Luigi Rizzo <luigi@FreeBSD.org> |
small code cleanup in preparation for future modifications in the memory allocator used by netmap. No functional change, two small bug fixes: - in if_re.c add a missing bus_dmamap_sync() - in netmap.
small code cleanup in preparation for future modifications in the memory allocator used by netmap. No functional change, two small bug fixes: - in if_re.c add a missing bus_dmamap_sync() - in netmap.c comment out a spurious free() in an error handling block
show more ...
|
| #
d0c7b075
|
| 23-Dec-2011 |
Luigi Rizzo <luigi@FreeBSD.org> |
1. don't use if_pspare directly, but through a macro WMA()
2. move a variable declaration at the beginning of a block
|
| #
02ad4083
|
| 05-Dec-2011 |
Luigi Rizzo <luigi@FreeBSD.org> |
revise the implementation of the rings connected to the host stack
|
| #
506cc70c
|
| 05-Dec-2011 |
Luigi Rizzo <luigi@FreeBSD.org> |
1. Fix the handling of link reset while in netmap more. A link reset now is completely transparent for the netmap client: even if the NIC resets its own ring (e.g. restarting from 0), the cl
1. Fix the handling of link reset while in netmap more. A link reset now is completely transparent for the netmap client: even if the NIC resets its own ring (e.g. restarting from 0), the client will not see any change in the current rx/tx positions, because the driver will keep track of the offset between the two.
2. make the device-specific code more uniform across different drivers There were some inconsistencies in the implementation of the netmap support routines, now drivers have been aligned to a common code structure.
3. import netmap support for ixgbe . This is implemented as a very small patch for ixgbe.c (233 lines, 11 chunks, mostly comments: in total the patch has only 54 lines of new code) , as most of the code is in an external file sys/dev/netmap/ixgbe_netmap.h , following some initial comments from Jack Vogel about making changes less intrusive. (Note, i have emailed Jack multiple times asking if he had comments on this structure of the code; i got no reply so i assume he is fine with it).
Support for other drivers (em, lem, re, igb) will come later.
"ixgbe" is now the reference driver for netmap support. Both the external file (sys/dev/netmap/ixgbe_netmap.h) and the device-specific patches (in sys/dev/ixgbe/ixgbe.c) are heavily commented and should serve as a reference for other device drivers.
Tested on i386 and amd64 with the pkt-gen program in tools/tools/netmap, the sender does 14.88 Mpps at 1050 Mhz and 14.2 Mpps at 900 MHz on an i7-860 with 4 cores and 82599 card. Haven't tried yet more aggressive optimizations such as adding 'prefetch' instructions in the time-critical parts of the code.
show more ...
|
| #
85df3791
|
| 23-Nov-2011 |
Luigi Rizzo <luigi@FreeBSD.org> |
fix formatting warning using casts. The numbers involved are small and these are debug statements, so there is no reason to obfuscate the format string with PRIsomeKINDofINTEGER
|
| #
68b8534b
|
| 17-Nov-2011 |
Luigi Rizzo <luigi@FreeBSD.org> |
Bring in support for netmap, a framework for very efficient packet I/O from userspace, capable of line rate at 10G, see
http://info.iet.unipi.it/~luigi/netmap/
At this time I am bringing in only t
Bring in support for netmap, a framework for very efficient packet I/O from userspace, capable of line rate at 10G, see
http://info.iet.unipi.it/~luigi/netmap/
At this time I am bringing in only the generic code (sys/dev/netmap/ plus two headers under sys/net/), and some sample applications in tools/tools/netmap. There is also a manpage in share/man/man4 [1]
In order to make use of the framework you need to build a kernel with "device netmap", and patch individual drivers with the code that you can find in
sys/dev/netmap/head.diff
The file will go away as the relevant pieces are committed to the various device drivers, which should happen in a few days after talking to the driver maintainers.
Netmap support is available at the moment for Intel 10G and 1G cards (ixgbe, em/lem/igb), and for the Realtek 1G card ("re"). I have partial patches for "bge" and am starting to work on "cxgbe". Hopefully changes are trivial enough so interested third parties can submit their patches. Interested people can contact me for advice on how to add netmap support to specific devices.
CREDITS: Netmap has been developed by Luigi Rizzo and other collaborators at the Universita` di Pisa, and supported by EU project CHANGE (http://www.change-project.eu/) The code is distributed under a BSD Copyright.
[1] In my opinion is a bad idea to have all manpage in one directory. We should place kernel documentation in the same dir that contains the code, which would make it much simpler to keep doc and code in sync, reduce the clutter in share/man/ and incidentally is the policy used for all of userspace code. Makefiles and doc tools can be trivially adjusted to find the manpages in the relevant subdirs.
show more ...
|