aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/netmap
Commit message (Collapse)AuthorAgeFilesLines
* MFC r284179, r283959Sean Bruno2015-06-171-1/+1
| | | | | | | | | | | | | | | Implement multiqueue (max 2 tx/rx queues) for the 82574L chipset. Change default tuning parameters to handle this new configuration if EM_MULTIQUEUE is set in the kernel configuration. Off by default. See r283959 changelog for the scope of these changes. Relnotes: Yes Sponsored by: Limelight Networks Notes: svn path=/stable/10/; revision=284522
* MFC r282978:Patrick Kelsey2015-05-241-16/+67
| | | | | | | | | | | | | | | | | | | | When a netmap process terminates without the full set of buffers it was granted via rings and ni_bufs_list_head represented in those rings and lists (e.g., via SIGKILL), those buffers are no longer available for subsequent users for the lifetime of the system. To mitigate this resource leak, reset the allocator state when the last ref to that allocator is released. Note that this only recovers leaked resources for an allocator when there are no longer any users of that allocator, so there remain circumstances in which leaked allocator resources may not ever be recovered - consider a set of multiple netmap processes that are all using the same allocator (say, the global allocator) where members of that set may be killed and restarted over time but at any given point there is one member of that set running. Notes: svn path=/stable/10/; revision=283343
* MFC r275358 r275483 r276982 - Removing M_FLOWID by hps@Hiren Panchasara2015-04-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r275358: Start process of removing the use of the deprecated "M_FLOWID" flag from the FreeBSD network code. The flag is still kept around in the "sys/mbuf.h" header file, but does no longer have any users. Instead the "m_pkthdr.rsstype" field in the mbuf structure is now used to decide the meaning of the "m_pkthdr.flowid" field. To modify the "m_pkthdr.rsstype" field please use the existing "M_HASHTYPE_XXX" macros as defined in the "sys/mbuf.h" header file. This patch introduces new behaviour in the transmit direction. Previously network drivers checked if "M_FLOWID" was set in "m_flags" before using the "m_pkthdr.flowid" field. This check has now now been replaced by checking if "M_HASHTYPE_GET(m)" is different from "M_HASHTYPE_NONE". In the future more hashtypes will be added, for example hashtypes for hardware dedicated flows. "M_HASHTYPE_OPAQUE" indicates that the "m_pkthdr.flowid" value is valid and has no particular type. This change removes the need for an "if" statement in TCP transmit code checking for the presence of a valid flowid value. The "if" statement mentioned above is now a direct variable assignment which is then later checked by the respective network drivers like before. r275483: Remove M_FLOWID from SCTP code. r276982: Remove no longer used "M_FLOWID" flag from mbuf.h and update the netisr manpage. Note: The FreeBSD version has been bumped. Reviewed by: hps, tuexen Sponsored by: Limelight Networks Notes: svn path=/stable/10/; revision=281955
* MFC r281406:Rui Paulo2015-04-181-0/+6
| | | | | | | netmap: improve the netmap attach message on FreeBSD. Notes: svn path=/stable/10/; revision=281706
* sync the code with the version in head. which the exception ofLuigi Rizzo2015-02-148-46/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn 275358 (M_FLOWID deprecation, only a couple of lines) which cannot be merged. if_lem_netmap.h, if_re_netmap.h: - use the same (commented out) function to update the stat counters as in HEAD. This is a no-op here netmap.c - merge 274459 (support for private knote lock) and minor changes on nm_config and comments netmap_freebsd.c - merge 274459 (support for private knote lock) - merge 274354 (initialize color if passed as argument) netmap_generic.c - fix a comment netmap_kern.h - revise the lock macros, using sx locks; merge 274459 (private knote lock) netmap_monitor.c - use full memory barriers netmap_pipe.c - use full memory barriers, use length from the correct queue (mostly cosmetic, since the queues typically have the same size) Notes: svn path=/stable/10/; revision=278779
* MFC r272111Luigi Rizzo2014-10-061-15/+10
| | | | | | | | fix a panic when passing ifioctl from a netmap file descriptor to the underlying device. This needs to be merged to 10.1 Notes: svn path=/stable/10/; revision=272604
* MFC r270253:Navdeep Parhar2014-08-211-7/+7
| | | | | | | Change netmap's global lock to sx instead of a mutex. Notes: svn path=/stable/10/; revision=270298
* MFC 270063: update of netmap codeLuigi Rizzo2014-08-2017-782/+3069
| | | | | | | (vtnet and cxgbe not merged yet because we need some other mfc first) Notes: svn path=/stable/10/; revision=270252
* MFC 267284Luigi Rizzo2014-06-101-19/+7
| | | | | | | | | | | | | | | | | | | | | | Fixes from Fanco Ficthner on transparent mode * The way rings are updated changed with the last API bump. Also sync ->head when moving slots in netmap_sw_to_nic(). * Remove a crashing selrecord() call. * Unclog the logic surrounding netmap_rxsync_from_host(). * Add timestamping to RX host ring. * Remove a couple of obsolete comments. Submitted by: Franco Fichtner MFC after: 3 days Sponsored by: Packetwerk Notes: svn path=/stable/10/; revision=267334
* MFC 267328:Luigi Rizzo2014-06-101-9/+16
| | | | | | | | | | | change the netmap mbuf destructor so the same code works also on FreeBSD 9. For head and 10 this change has no effect, but on stable/9 it would cause panics when using emulated netmap on top of a standard device driver. MFC after: 3 days Notes: svn path=/stable/10/; revision=267333
* sync netmap code with the version in HEAD:Luigi Rizzo2014-06-099-81/+257
| | | | | | | | | | - fix handling of tx mbufs in emulated netmap mode; - introduce mbq_lock() and mbq_unlock() - rate limit some error messages - many whitespace and comment fixes Notes: svn path=/stable/10/; revision=267282
* allow building without INETLuigi Rizzo2014-02-191-0/+8
| | | | Notes: svn path=/stable/10/; revision=262214
* missing files from previous commit...Luigi Rizzo2014-02-188-0/+5144
| | | | Notes: svn path=/stable/10/; revision=262152
* MFH: sync the netmap code with the one in HEADLuigi Rizzo2014-02-188-4067/+4313
| | | | | | | | (enhanced VALE switch, netmap pipes, emulated netmap mode). See details in the log for svn 261909. Notes: svn path=/stable/10/; revision=262151
* Update the Intel igb driver to version 2.4.0Jack F Vogel2013-10-091-1/+1
| | | | | | | | | | | | | | - This version has support for the new Intel Avoton systems, including 2.5Gb support, further it now has IPv6/TSO6 support as well. Shared code has been updated where necessary as well. Thanks to my new assistant Eric Joyner for doing the transmit path changes to bring in the IPv6/TSO6 support. Thanks to Gleb for catching the one bug and change needed in NETMAP. Approved by: re Notes: svn path=/head/; revision=256200
* - fix a bug in the previous commit that was dropping the last packetLuigi Rizzo2013-06-051-11/+39
| | | | | | | | | | | | | | | | | | from each batch flowing on the VALE switch - feature: add glue for 'indirect' buffers on the sender side: if a slot has NS_INDIRECT set, the netmap buffer contains pointer(s) to the actual userspace buffers, which are accessed with copyin(). The feature is not finalised yet, as it will likely need to deal with some iovec variant for proper scatter/gather support. This will save one copy for clients (e.g. qemu) that cannot use the netmap buffer directly. A curiosity: on amd64 copyin() appears to be 10-15% faster than pkt_copy() or bcopy() at least for sizes of 256 and greater. Notes: svn path=/head/; revision=251425
* Bring in a number of new features, mostly implemented by Michio Honda:Luigi Rizzo2013-05-302-311/+1090
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* another minor bugfix in the memory allocator, this time in the free routine.Luigi Rizzo2013-05-101-1/+1
| | | | Notes: svn path=/head/; revision=250441
* remove trailing whitespaceLuigi Rizzo2013-05-024-11/+11
| | | | Notes: svn path=/head/; revision=250184
* Partial cleanup in preparation for upcoming changes:Luigi Rizzo2013-04-302-35/+87
| | | | | | | | | | | | | | | | - 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 - document alternative locking under linuxLuigi Rizzo2013-04-291-0/+2
| | | | Notes: svn path=/head/; revision=250054
* whitespace changes:Luigi Rizzo2013-04-298-9/+11
| | | | | | | remove $Id$ lines, and add blank lines around some #if / #elif /#endif Notes: svn path=/head/; revision=250052
* explicitly mark some variables as constLuigi Rizzo2013-04-291-4/+4
| | | | Notes: svn path=/head/; revision=250049
* mostly whitespace changes:Luigi Rizzo2013-04-193-47/+34
| | | | | | | | - remove vestiges of the old memory allocator - clean up some comments Notes: svn path=/head/; revision=249659
* fix a bug in the computation of the userspace offset for a give netmap buffer.Luigi Rizzo2013-04-151-1/+1
| | | | | | | Submitted by: Hugh Nhan Notes: svn path=/head/; revision=249504
* Switch the vm_object mutex to be a rwlock. This will enable in theAttilio Rao2013-03-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | future further optimizations where the vm_object lock will be held in read mode most of the time the page cache resident pool of pages are accessed for reading purposes. The change is mostly mechanical but few notes are reported: * The KPI changes as follow: - VM_OBJECT_LOCK() -> VM_OBJECT_WLOCK() - VM_OBJECT_TRYLOCK() -> VM_OBJECT_TRYWLOCK() - VM_OBJECT_UNLOCK() -> VM_OBJECT_WUNLOCK() - VM_OBJECT_LOCK_ASSERT(MA_OWNED) -> VM_OBJECT_ASSERT_WLOCKED() (in order to avoid visibility of implementation details) - The read-mode operations are added: VM_OBJECT_RLOCK(), VM_OBJECT_TRYRLOCK(), VM_OBJECT_RUNLOCK(), VM_OBJECT_ASSERT_RLOCKED(), VM_OBJECT_ASSERT_LOCKED() * The vm/vm_pager.h namespace pollution avoidance (forcing requiring sys/mutex.h in consumers directly to cater its inlining functions using VM_OBJECT_LOCK()) imposes that all the vm/vm_pager.h consumers now must include also sys/rwlock.h. * zfs requires a quite convoluted fix to include FreeBSD rwlocks into the compat layer because the name clash between FreeBSD and solaris versions must be avoided. At this purpose zfs redefines the vm_object locking functions directly, isolating the FreeBSD components in specific compat stubs. The KPI results heavilly broken by this commit. Thirdy part ports must be updated accordingly (I can think off-hand of VirtualBox, for example). Sponsored by: EMC / Isilon storage division Reviewed by: jeff Reviewed by: pjd (ZFS specific review) Discussed with: alc Tested by: pho Notes: svn path=/head/; revision=248084
* Add support for transparent mode while in netmap.Luigi Rizzo2013-01-231-30/+179
| | | | | | | | | | | | | | | | | | | | | | | By setting dev.netmap.fwd=1 (or enabling the feature with a per-ring flag), packets are forwarded between the NIC and the host stack unless the netmap client clears the NS_FORWARD flag on the individual descriptors. This feature greatly simplifies applications where some traffic (think of ARP, control traffic, ssh sessions...) must be processed by the host stack, whereas the bulk is handled by the netmap process which simply (un)marks packets that should not be forwarded. The default is chosen so that now a netmap receiver operates in a mode very similar to bpf. Of course there is no free lunch: traffic to/from the host stack still operates at OS speed (or less, as there is one extra copy in one direction). HOWEVER, since traffic goes to the user process before being reinjected, and reinjection occurs in a user context, you get some form of livelock protection for free. Notes: svn path=/head/; revision=245836
* control some debugging messages with dev.netmap.verboseLuigi Rizzo2013-01-233-54/+123
| | | | | | | | add infrastracture to adapt to changes in number of queues and buffers at runtime Notes: svn path=/head/; revision=245835
* remove the old memory allocator, not useful anymoreLuigi Rizzo2013-01-171-521/+0
| | | | Notes: svn path=/head/; revision=245581
* add some definition and driver changes in preparation forLuigi Rizzo2013-01-176-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | 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
* remove an incorrect comment and debugging codeLuigi Rizzo2013-01-171-10/+1
| | | | Notes: svn path=/head/; revision=245570
* rename the 'tag' and 'map' fields used the rx ring to theirLuigi Rizzo2012-12-201-4/+4
| | | | | | | | | | | | previous names, 'ptag' and 'pmap' -- p stands for packet. This change reduces the difference between the code in stable/9 and head, and also helps using the same ixgbe_netmap.h on both branches. Approved by: Jack Vogel Notes: svn path=/head/; revision=244514
* First of a series of 11 patches leading to new ixgbe version 2.5.0Jack F Vogel2012-11-301-4/+4
| | | | | | | This removes the header split and supporting code from the driver. Notes: svn path=/head/; revision=243714
* Use M_NOWAIT when calling malloc with a lock held.Ed Maste2012-10-191-2/+2
| | | | | | | | The check for a NULL return was already in place so I assume this was just an oversight. Notes: svn path=/head/; revision=241750
* Fix build.Gleb Smirnoff2012-10-191-2/+2
| | | | Notes: svn path=/head/; revision=241723
* This is an import of code, mostly from Giuseppe Lettieri,Luigi Rizzo2012-10-193-293/+783
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Avoid panic when a netmap instance cannot obtain memory.Ed Maste2012-10-171-1/+2
| | | | | | | | | A uint32_t is always >= 0. Sponsored by: ADARA Networks Notes: svn path=/head/; revision=241643
* Reword comment to try to improve clarity, and fix a typo.Ed Maste2012-08-131-5/+8
| | | | Notes: svn path=/head/; revision=239242
* Improve lock and unlock symmetryEd Maste2012-08-091-15/+14
| | | | | | | | | | | | | | | | | | - Move destruction of per-ring locks to netmap_dtor_locked to mirror the initialization that happens in NIOCREGIF. Otherwise unloading a netmap- capable interface that was never put into netmap mode would try to mtx_destroy an uninitialized mutex, and panic. - Destroy core_lock in netmap_detach, mirroring init in netmap_attach. - Also comment out the knlist_destroy for now as there is currently no knlist_init. Sponsored by: ADARA Networks Reviewed by: luigi@ Notes: svn path=/head/; revision=239149
* Fix whitespace (missing newline)Ed Maste2012-08-081-1/+2
| | | | Notes: svn path=/head/; revision=239141
* Clarify comments about number of tx / rx ringsEd Maste2012-08-082-3/+4
| | | | Notes: svn path=/head/; revision=239140
* fix some signed/unsigned warnings in the netmap code.Luigi Rizzo2012-08-025-8/+8
| | | | | | | | Unfortunately the original drivers still have a lot of sign conversion/comparison warnings. Notes: svn path=/head/; revision=238985
* Add a newline on an error message;Luigi Rizzo2012-08-021-7/+13
| | | | | | | | rename linux functions to avoid confusion; fix error reporting on linux Notes: svn path=/head/; revision=238982
* remove a redundant MALLOC_DECLARELuigi Rizzo2012-07-311-4/+0
| | | | Notes: svn path=/head/; revision=238937
* - move the inclusion of netmap headers to the common part of the code;Luigi Rizzo2012-07-302-9/+15
| | | | | | | - more portable annotations for unused arguments; Notes: svn path=/head/; revision=238912
* use __builtin_prefetch() for prefetch.Luigi Rizzo2012-07-271-26/+160
| | | | | | | | merge in the remaining part of the linux-specific glue so i do not need to maintain two different distributions. Notes: svn path=/head/; revision=238837
* remove unused definition, whitespace cleanupLuigi Rizzo2012-07-271-9/+6
| | | | Notes: svn path=/head/; revision=238831
* define prefetch as a noop on !x86Luigi Rizzo2012-07-261-0/+4
| | | | Notes: svn path=/head/; revision=238818
* Add support for VALE bridges to the netmap core, seeLuigi Rizzo2012-07-263-23/+781
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* this file is too old and not interesting anymore now that netmapLuigi Rizzo2012-05-171-654/+0
| | | | | | | has been MFC'ed. Notes: svn path=/head/; revision=235562