summaryrefslogtreecommitdiff
path: root/sys/dev/netmap/netmap_kern.h
Commit message (Collapse)AuthorAgeFilesLines
* MFC r357663Vincenzo Maffione2020-02-151-1/+0
| | | | | | | | | | | | | netmap: improve netmap(4) and vale(4) man pages Clean up obsolete sysctl descriptions and add missing ones. PR: 243838 Reviewed by: bcr Differential Revision: https://reviews.freebsd.org/D23546 Notes: svn path=/stable/11/; revision=357961
* MFC r356704Vincenzo Maffione2020-01-161-1/+0
| | | | | | | | | | | | | | | | netmap: disable passthrough with no hypervisor support The netmap passthrough subsystem requires proper support in the hypervisor. In particular, two PCI device ids (from the Red Hat PCI vendor id 0x1b36) need to be assigned to the two netmap virtual devices. We then disable these devices until the ids have not been assigned, in order to avoid conflicts with other virtual devices emulated by upstream QEMU. PR: 241774 Notes: svn path=/stable/11/; revision=356805
* MFC r343579, r344253Vincenzo Maffione2019-02-251-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | netmap: fix lock order reversal related to kqueue usage When using poll(), select() or kevent() on netmap file descriptors, netmap executes the equivalent of NIOCTXSYNC and NIOCRXSYNC commands, before collecting the events that are ready. In other words, the poll/kevent callback has side effects. This is done to avoid the overhead of two system call per iteration (e.g., poll() + ioctl(NIOC*XSYNC)). When the kqueue subsystem invokes the kqueue(9) f_event callback (netmap_knrw), it holds the lock of the struct knlist object associated to the netmap port (the lock is provided at initialization, by calling knlist_init_mtx). However, netmap_knrw() may need to wake up another netmap port (or even the same one), which means that it may need to call knote(). Since knote() needs the lock of the struct knlist object associated to the to-be-wake-up netmap port, it is possible to have a lock order reversal problem (AB/BA deadlock). This change prevents the deadlock by executing the knote() call in a per-selinfo taskqueue, where it is possible to hold a mutex. The change also adds a counter (kqueue_users) to keep track of how many kqueue users are referencing a given struct nm_selinfo. In this way, nm_os_selwakeup() can schedule the kevent notification task only when kqueue is actually being used. This is important to avoid wasting CPU in the common case where kqueue is not used. Reviewed by: aleksandr.fedorov_itglobal.com Differential Revision: https://reviews.freebsd.org/D18956 Notes: svn path=/stable/11/; revision=344509
* MFC r343772, r343867Vincenzo Maffione2019-02-121-12/+15
| | | | | | | | | | | | | | | | | netmap: refactor logging macros and pipes Changelist: - Replace ND, D and RD macros with nm_prdis, nm_prinf, nm_prerr and nm_prlim, to avoid possible naming conflicts. - Add netmap_krings_mode_commit() helper function and use that to reduce code duplication. - Refactor pipes control code to export some functions that can be reused by the veth driver (on Linux) and epair(4). - Add check to reject API requests with version less than 11. - Small code refactoring for the null adapter. Notes: svn path=/stable/11/; revision=344047
* MFC r343689Vincenzo Maffione2019-02-071-0/+9
| | | | | | | | | | netmap: upgrade sync-kloop support Add SYNC_KLOOP_MODE option, and add support for direct mode, where application executes the TXSYNC and RXSYNC in the context of the ioeventfd wake up callback. Notes: svn path=/stable/11/; revision=343866
* MFC r343346Vincenzo Maffione2019-02-061-50/+3
| | | | | | | | | | | | | | | | | | | | | | netmap: improvements to the netmap kloop (CSB mode) Changelist: - Add the proper memory barriers in the kloop ring processing functions. - Fix memory barriers usage in the user helpers (nm_sync_kloop_appl_write, nm_sync_kloop_appl_read). - Fix nm_kr_txempty() helper to look at rhead rather than rcur. This is important since the kloop can read a value of rcur which is ahead of the value of rhead (see explanation in nm_sync_kloop_appl_write) - Remove obsolete ptnetmap_guest_write_kring_csb() and ptnet_guest_read_kring_csb(). - Prepare in advance the arguments for netmap_sync_kloop_[tr]x_ring(), to make the kloop faster. - Provide kernel and user implementation for nm_ldld_barrier() and nm_ldst_barrier() Notes: svn path=/stable/11/; revision=343832
* MFC r343344Vincenzo Maffione2019-02-061-1/+0
| | | | | | | | | | | | | | | | | | netmap: fix knote() argument to match the mutex state The nm_os_selwakeup function needs to call knote() to wake up kqueue(9) users. However, this function can be called from different code paths, with different lock requirements. This patch fixes the knote() call argument to match the relavant lock state. Also, comments have been updated to reflect current code. PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219846 Reported by: Aleksandr Fedorov <aleksandr.fedorov@itglobal.com> Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D18876 Notes: svn path=/stable/11/; revision=343831
* MFC r342300Vincenzo Maffione2018-12-241-0/+1
| | | | | | | | | | | | netmap: move buf_size validation code to its own function This code validates the netmap buf_size against the interface MTU and maximum descriptor size, to make sure the values are consistent. Moving this functionality to its own function is needed because this function is also called by Linux-specific code. Notes: svn path=/stable/11/; revision=342395
* MFC r341516, r341589Vincenzo Maffione2018-12-131-131/+210
| | | | | | | | | | | | | | | | | | | | | | | | | | netmap: align codebase to the current upstream (760279cfb2730a585) Changelist: - Replace netmap passthrough host support with a more general mechanism to call TXSYNC/RXSYNC from an in-kernel event-loop. No kernel threads are used to use this feature: the application is required to spawn a thread (or a process) and issue a SYNC_KLOOP_START (NIOCCTRL) command in the thread body. The kernel loop is executed by the ioctl implementation, which returns to userspace only when a different thread calls SYNC_KLOOP_STOP or the netmap file descriptor is closed. - Update the if_ptnet driver to cope with the new data structures, and prune all the obsolete ptnetmap code. - Add support for "null" netmap ports, useful to allocate netmap_if, netmap_ring and netmap buffers to be used by specialized applications (e.g. hypervisors). TXSYNC/RXSYNC on these ports have no effect. - Various fixes and code refactoring. Sponsored by: Sunny Valley Networks Differential Revision: https://reviews.freebsd.org/D18015 Notes: svn path=/stable/11/; revision=342033
* MFC r339639Vincenzo Maffione2018-12-041-274/+956
| | | | | | | | | | | | | | | | | | | | | netmap: align codebase to the current upstream (sha 8374e1a7e6941) Changelist: - Move large parts of VALE code to a new file and header netmap_bdg.[ch]. This is useful to reuse the code within upcoming projects. - Improvements and bug fixes to pipes and monitors. - Introduce nm_os_onattach(), nm_os_onenter() and nm_os_onexit() to handle differences between FreeBSD and Linux. - Introduce some new helper functions to handle more host rings and fake rings (netmap_all_rings(), netmap_real_rings(), ...) - Added new sysctl to enable/disable hw checksum in emulated netmap mode. - nm_inject: add support for NS_MOREFRAG Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D17364 Notes: svn path=/stable/11/; revision=341477
* Revert r330897:Eitan Adler2018-03-291-3/+1
| | | | | | | | | | | | | | | | | | | | This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code. Revert with prejudice. This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes. Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes. Requested by: gjb (re) Notes: svn path=/stable/11/; revision=331722
* Partial merge of the SPDX changesEitan Adler2018-03-141-1/+3
| | | | | | | | | | These changes are incomplete but are making it difficult to determine what other changes can/should be merged. No objections from: pfg Notes: svn path=/stable/11/; revision=330897
* Fix a crash in netmap when using the emulated mode.Luiz Otavio O Souza2017-01-251-5/+3
| | | | | | | | | | | This is a direct commit to stable/11 as the -head version was already fixed by a recent import of a new netmap version. Submitted by: Vincenzo Maffione <v.maffione@gmail.com> Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/stable/11/; revision=312783
* add a use count so the netmap module cannot be unloaded while in use.Luigi Rizzo2015-07-191-0/+1
| | | | Notes: svn path=/head/; revision=285699
* small documentation updateLuigi Rizzo2015-07-191-3/+4
| | | | Notes: svn path=/head/; revision=285695
* staticize functions only used in netmap.cLuigi Rizzo2015-07-101-38/+13
| | | | | | | | | | | | | (detected by jenkins run with gcc 4.9) Update documentation on the use of netmap_priv_d, rename the refcount and use the same structure in FreeBSD and linux No functional changes. Notes: svn path=/head/; revision=285359
* Sync netmap sources with the version in our private tree.Luigi Rizzo2015-07-101-148/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains large contributions from Giuseppe Lettieri and Stefano Garzarella, is partly supported by grants from Verisign and Cisco, and brings in the following: - fix zerocopy monitor ports and introduce copying monitor ports (the latter are lower performance but give access to all traffic in parallel with the application) - exclusive open mode, useful to implement solutions that recover from crashes of the main netmap client (suggested by Patrick Kelsey) - revised memory allocator in preparation for the 'passthrough mode' (ptnetmap) recently presented at bsdcan. ptnetmap is described in S. Garzarella, G. Lettieri, L. Rizzo; Virtual device passthrough for high speed VM networking, ACM/IEEE ANCS 2015, Oakland (CA) May 2015 http://info.iet.unipi.it/~luigi/research.html - fix rx CRC handing on ixl - add module dependencies for netmap when building drivers as modules - minor simplifications to device-specific routines (*txsync, *rxsync) - general code cleanup (remove unused variables, introduce macros to access rings and remove duplicate code, Applications do not need to be recompiled, unless of course they want to use the new features (monitors and exclusive open). Those willing to try this code on stable/10 can just update the sys/dev/netmap/*, sys/net/netmap* with the version in HEAD and apply the small patches to individual device drivers. MFC after: 1 month Sponsored by: (partly) Verisign, Cisco Notes: svn path=/head/; revision=285349
* add support for private knote lock (reduces lock contention),Luigi Rizzo2014-11-131-1/+8
| | | | | | | | adapting OS_selrecord accordingly. Problem and fix suggested by adrian and jmg Notes: svn path=/head/; revision=274459
* in the Linux section, properly define the NMG_LOCK type.Luigi Rizzo2014-11-111-7/+21
| | | | | | | | Also import WITH_GENERIC in preparation to adding fine-grained options to disable specific netmap components. Notes: svn path=/head/; revision=274362
* fix a typoLuigi Rizzo2014-11-101-1/+1
| | | | Notes: svn path=/head/; revision=274355
* adapt the code to different freebsd versions.Luigi Rizzo2014-09-251-3/+6
| | | | | | | Not necessary to MFC Notes: svn path=/head/; revision=272110
* Provide pointer from struct ifnet to struct netmap_adapter,Gleb Smirnoff2014-08-311-1/+1
| | | | | | | instead of abusing spare field. Notes: svn path=/head/; revision=270874
* Change netmap's global lock to sx instead of a mutex.Navdeep Parhar2014-08-201-7/+7
| | | | | | | | Reviewed by: luigi@ MFC after: 1 day Notes: svn path=/head/; revision=270253
* Update to the current version of netmap.Luigi Rizzo2014-08-161-88/+328
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mostly bugfixes or features developed in the past 6 months, so this is a 10.1 candidate. Basically no user API changes (some bugfixes in sys/net/netmap_user.h). In detail: 1. netmap support for virtio-net, including in netmap mode. Under bhyve and with a netmap backend [2] we reach over 1Mpps with standard APIs (e.g. libpcap), and 5-8 Mpps in netmap mode. 2. (kernel) add support for multiple memory allocators, so we can better partition physical and virtual interfaces giving access to separate users. The most visible effect is one additional argument to the various kernel functions to compute buffer addresses. All netmap-supported drivers are affected, but changes are mechanical and trivial 3. (kernel) simplify the prototype for *txsync() and *rxsync() driver methods. All netmap drivers affected, changes mostly mechanical. 4. add support for netmap-monitor ports. Think of it as a mirroring port on a physical switch: a netmap monitor port replicates traffic present on the main port. Restrictions apply. Drive carefully. 5. if_lem.c: support for various paravirtualization features, experimental and disabled by default. Most of these are described in our ANCS'13 paper [1]. Paravirtualized support in netmap mode is new, and beats the numbers in the paper by a large factor (under qemu-kvm, we measured gues-host throughput up to 10-12 Mpps). A lot of refactoring and additional documentation in the files in sys/dev/netmap, but apart from #2 and #3 above, almost nothing of this stuff is visible to other kernel parts. Example programs in tools/tools/netmap have been updated with bugfixes and to support more of the existing features. This is meant to go into 10.1 so we plan an MFC before the Aug.22 deadline. A lot of this code has been contributed by my colleagues at UNIPI, including Giuseppe Lettieri, Vincenzo Maffione, Stefano Garzarella. MFC after: 3 days. Notes: svn path=/head/; revision=270063
* sync the code with the one in stable/10Luigi Rizzo2014-06-091-1/+3
| | | | | | | | (wrap the if_t compatibilty function into a __FreeBSD_version conditional block) Notes: svn path=/head/; revision=267283
* align comments with the ones in our development trunkLuigi Rizzo2014-06-061-7/+6
| | | | Notes: svn path=/head/; revision=267165
* whitespace change: remove trailing whitespaceLuigi Rizzo2014-06-051-2/+2
| | | | Notes: svn path=/head/; revision=267128
* Introduce a procedural interface to the ifnet structure. The newMarcel Moolenaar2014-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | interface allows the ifnet structure to be defined as an opaque type in NIC drivers. This then allows the ifnet structure to be changed without a need to change or recompile NIC drivers. Put differently, NIC drivers can be written and compiled once and be used with different network stack implementations, provided of course that those network stack implementations have an API and ABI compatible interface. This commit introduces the 'if_t' type to replace 'struct ifnet *' as the type of a network interface. The 'if_t' type is defined as 'void *' to enable the compiler to perform type conversion to 'struct ifnet *' and vice versa where needed and without warnings. The functions that implement the API are the only functions that need to have an explicit cast. The MII code has been converted to use the driver API to avoid unnecessary code churn. Code churn comes from having to work with both converted and unconverted drivers in correlation with having callback functions that take an interface. By converting the MII code first, the callback functions can be defined so that the compiler will perform the typecasts automatically. As soon as all drivers have been converted, the if_t type can be redefined as needed and the API functions can be fix to not need an explicit cast. The immediate benefactors of this change are: 1. Juniper Networks - The network stack implementation in Junos is entirely different from FreeBSD's one and this change allows Juniper to build "stock" NIC drivers that can be used in combination with both the FreeBSD and Junos stacks. 2. FreeBSD - This change opens the door towards changing ifnet and implementing new features and optimizations in the network stack without it requiring a change in the many NIC drivers FreeBSD has. Submitted by: Anuranjan Shukla <anshukla@juniper.net> Reviewed by: glebius@ Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=266974
* This new version of netmap brings you the following:Luigi Rizzo2014-02-151-22/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - netmap pipes, providing bidirectional blocking I/O while moving 100+ Mpps between processes using shared memory channels (no mistake: over one hundred million. But mind you, i said *moving* not *processing*); - kqueue support (BHyVe needs it); - improved user library. Just the interface name lets you select a NIC, host port, VALE switch port, netmap pipe, and individual queues. The upcoming netmap-enabled libpcap will use this feature. - optional extra buffers associated to netmap ports, for applications that need to buffer data yet don't want to make copies. - segmentation offloading for the VALE switch, useful between VMs. and a number of bug fixes and performance improvements. My colleagues Giuseppe Lettieri and Vincenzo Maffione did a substantial amount of work on these features so we owe them a big thanks. There are some external repositories that can be of interest: https://code.google.com/p/netmap our public repository for netmap/VALE code, including linux versions and other stuff that does not belong here, such as python bindings. https://code.google.com/p/netmap-libpcap a clone of the libpcap repository with netmap support. With this any libpcap client has access to most netmap feature with no recompilation. E.g. tcpdump can filter packets at 10-15 Mpps. https://code.google.com/p/netmap-ipfw a userspace version of ipfw+dummynet which uses netmap to send/receive packets. Speed is up in the 7-10 Mpps range per core for simple rulesets. Both netmap-libpcap and netmap-ipfw will be merged upstream at some point, but while this happens it is useful to have access to them. And yes, this code will be merged soon. It is infinitely better than the version currently in 10 and 9. MFC after: 3 days Notes: svn path=/head/; revision=261909
* fix use after free when releasing a netmap adapter.Luigi Rizzo2014-01-071-2/+2
| | | | | | | Submitted by: Giuseppe Lettieri Notes: svn path=/head/; revision=260411
* It is 2014 and we have a new version of netmap.Luigi Rizzo2014-01-061-215/+273
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most relevant features: - netmap emulation on any NIC, even those without native netmap support. On the ixgbe we have measured about 4Mpps/core/queue in this mode, which is still a lot more than with sockets/bpf. - seamless interconnection of VALE switch, NICs and host stack. If you disable accelerations on your NIC (say em0) ifconfig em0 -txcsum -txcsum you can use the VALE switch to connect the NIC and the host stack: vale-ctl -h valeXX:em0 allowing sharing the NIC with other netmap clients. - THE USER API HAS SLIGHTLY CHANGED (head/cur/tail pointers instead of pointers/count as before). This was unavoidable to support, in the future, multiple threads operating on the same rings. Netmap clients require very small source code changes to compile again. On the plus side, the new API should be easier to understand and the internals are a lot simpler. The manual page has been updated extensively to reflect the current features and give some examples. This is the result of work of several people including Giuseppe Lettieri, Vincenzo Maffione, Michio Honda and myself, and has been financially supported by EU projects CHANGE and OPENLAB, from NetApp University Research Fund, NEC, and of course the Universita` di Pisa. Notes: svn path=/head/; revision=260368
* fix the build using __builtin_prefetch() instead of redefining prefetch()Luigi Rizzo2013-12-161-1/+0
| | | | Notes: svn path=/head/; revision=259487
* split netmap code according to functions:Luigi Rizzo2013-12-151-83/+513
| | | | | | | | | | | | | | - netmap.c base code - netmap_freebsd.c FreeBSD-specific code - netmap_generic.c emulate netmap over standard drivers - netmap_mbq.c simple mbuf tailq - netmap_mem2.c memory management - netmap_vale.c VALE switch simplify devce-specific code Notes: svn path=/head/; revision=259412
* update to the latest netmap snapshot.Luigi Rizzo2013-11-011-41/+230
| | | | | | | | | | | | | | | | | | | | | | | This includes the following: - use separate memory regions for VALE ports - locking fixes - some simplifications in the NIC-specific routines - performance improvements for the VALE switch - some new features in the pkt-gen test program - documentation updates There are small API changes that require programs to be recompiled (NETMAP_API has been bumped so you will detect old binaries at runtime). In particular: - struct netmap_slot now is 16 bytes to support an extra pointer, which may save one data copy when using VALE ports or VMs; - the struct netmap_if has two extra fields; MFC after: 3 days Notes: svn path=/head/; revision=257529
* Bring in a number of new features, mostly implemented by Michio Honda:Luigi Rizzo2013-05-301-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - the VALE switch now support up to 254 destinations per switch, unicast or broadcast (multicast goes to all ports). - we can attach hw interfaces and the host stack to a VALE switch, which means we will be able to use it more or less as a native bridge (minor tweaks still necessary). A 'vale-ctl' program is supplied in tools/tools/netmap to attach/detach ports the switch, and list current configuration. - the lookup function in the VALE switch can be reassigned to something else, similar to the pf hooks. This will enable attaching the firewall, or other processing functions (e.g. in-kernel openvswitch) directly on the netmap port. The internal API used by device drivers does not change. Userspace applications should be recompiled because we bump NETMAP_API as we now use some fields in the struct nmreq that were previously ignored -- otherwise, data structures are the same. Manpages will be committed separately. Notes: svn path=/head/; revision=251139
* Partial cleanup in preparation for upcoming changes:Luigi Rizzo2013-04-301-5/+17
| | | | | | | | | | | | | | | | - netmap_rx_irq()/netmap_tx_irq() can now be called by FreeBSD drivers hiding the logic for handling NIC interrupts in netmap mode. This also simplifies the case of NICs attached to VALE switches. Individual drivers will be updated with separate commits. - use the same refcount() API for FreeBSD and linux - plus some comments, typos and formatting fixes Portions contributed by Michio Honda Notes: svn path=/head/; revision=250107
* whitespace changes:Luigi Rizzo2013-04-291-3/+8
| | | | | | | remove $Id$ lines, and add blank lines around some #if / #elif /#endif Notes: svn path=/head/; revision=250052
* mostly whitespace changes:Luigi Rizzo2013-04-191-12/+4
| | | | | | | | - remove vestiges of the old memory allocator - clean up some comments Notes: svn path=/head/; revision=249659
* control some debugging messages with dev.netmap.verboseLuigi Rizzo2013-01-231-0/+3
| | | | | | | | add infrastracture to adapt to changes in number of queues and buffers at runtime Notes: svn path=/head/; revision=245835
* add some definition and driver changes in preparation forLuigi Rizzo2013-01-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | two upcoming features: semi-transparent mode: when a device is opened in this mode, the user program will be able to mark slots that must be forwarded to the "other" side (i.e. from NIC to host stack, or viceversa), and the forwarding will occur automatically at the next netmap syscall. This saves the need to open another file descriptor and do the forwarding manually. direct-forwarding mode: when operating with a VALE port, the user can specify in the slot the actual destination port, overriding the forwarding decision made by a lookup of the destination MAC. This can be useful to implement packet dispatchers. No API changes will be introduced. No new functionality in this patch yet. Notes: svn path=/head/; revision=245579
* This is an import of code, mostly from Giuseppe Lettieri,Luigi Rizzo2012-10-191-11/+63
| | | | | | | | | | | | | | | | | | | | | | | | that revises the netmap memory allocator so that the various parameters (number and size of buffers, rings, descriptors) can be modified at runtime through sysctl variables. The changes become effective when no netmap clients are active. The API is mostly unchanged, although the NIOCUNREGIF ioctl now does not bring the interface back to normal mode: and you need to close the file descriptor for that. This change was necessary to track who is using the mapped region, and since it is a simplification of the API there was no incentive in trying to preserve NIOCUNREGIF. We will remove the ioctl from the kernel next time we need a real API change (and version bump). Among other things, buffer allocation when opening devices is now much faster: it used to take O(N^2) time, now it is linear. Submitted by: Giuseppe Lettieri Notes: svn path=/head/; revision=241719
* Clarify comments about number of tx / rx ringsEd Maste2012-08-081-2/+2
| | | | Notes: svn path=/head/; revision=239140
* fix some signed/unsigned warnings in the netmap code.Luigi Rizzo2012-08-021-1/+1
| | | | | | | | Unfortunately the original drivers still have a lot of sign conversion/comparison warnings. Notes: svn path=/head/; revision=238985
* remove a redundant MALLOC_DECLARELuigi Rizzo2012-07-311-4/+0
| | | | Notes: svn path=/head/; revision=238937
* remove unused definition, whitespace cleanupLuigi Rizzo2012-07-271-9/+6
| | | | Notes: svn path=/head/; revision=238831
* Add support for VALE bridges to the netmap core, seeLuigi Rizzo2012-07-261-2/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://info.iet.unipi.it/~luigi/vale/ VALE lets you dynamically instantiate multiple software bridges that talk the netmap API (and are *extremely* fast), so you can test netmap applications without the need for high end hardware. This is particularly useful as I am completing a netmap-aware version of ipfw, and VALE provides an excellent testing platform. Also, I also have netmap backends for qemu mostly ready for commit to the port, and this too will let you interconnect virtual machines at high speed without fiddling with bridges, tap or other slow solutions. The API for applications is unchanged, so you can use the code in tools/tools/netmap (which i will update soon) on the VALE ports. This commit also syncs the code with the one in my internal repository, so you will see some conditional code for other platforms. The code should run mostly unmodified on stable/9 so people interested in trying it can just copy sys/dev/netmap/ and sys/net/netmap*.h from HEAD VALE is joint work with my colleague Giuseppe Lettieri, and is partly supported by the EU Projects CHANGE and OPENLAB Notes: svn path=/head/; revision=238812
* A bit of cleanup in the names of fields of netmap-related structures.Luigi Rizzo2012-04-131-12/+34
| | | | | | | | Use the name 'ring' instead of 'queue' in all fields. Bump NETMAP_API. Notes: svn path=/head/; revision=234227
* Some code restructuring to bring the memory allocator out of netmap.cLuigi Rizzo2012-04-121-8/+4
| | | | | | | | | | | | | | and make it easier to replace it with a different implementation. On passing, also fix indentation. NOTE: I know that #include "foo.c" is ugly, but the alternative (add another entry to sys/conf/files, add a separate header with structs and prototypes, and expose functions that are meant to be private) looks even worse to me. We need a more modular way to specify dependencies and build options. Notes: svn path=/head/; revision=234174
* A bunch of netmap fixes:Luigi Rizzo2012-02-271-43/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=232238
* (This commit only touches code within the DEV_NETMAP blocks)Luigi Rizzo2012-02-151-0/+52
| | | | | | | | | | | | Introduce some functions to map NIC ring indexes into netmap ring indexes and vice versa. This way we can implement the bound checks only in one place (and hopefully in a correct way). On passing, make the code and comments more uniform across the various drivers. Notes: svn path=/head/; revision=231796