aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/netmap
Commit message (Collapse)AuthorAgeFilesLines
...
* do not free NULL if pipe allocation failsLuigi Rizzo2015-07-191-1/+3
| | | | Notes: svn path=/head/; revision=285697
* release a reference when stopping a monitorLuigi Rizzo2015-07-191-0/+1
| | | | Notes: svn path=/head/; revision=285696
* small documentation updateLuigi Rizzo2015-07-191-3/+4
| | | | Notes: svn path=/head/; revision=285695
* Add netmap support for ixgbe SRIOV VFs (that is, to if_ixv).Patrick Kelsey2015-07-151-13/+14
| | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D2923 Reviewed by: erj, gnn Approved by: jmallett (mentor) Sponsored by: Norse Corp, Inc. Notes: svn path=/head/; revision=285592
* set the refcount for the structure (dropped by mistake in the last commit).Luigi Rizzo2015-07-131-0/+1
| | | | Notes: svn path=/head/; revision=285445
* staticize functions only used in netmap.cLuigi Rizzo2015-07-104-69/+38
| | | | | | | | | | | | | (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-1016-1392/+1884
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Change EM_MULTIQUEUE to a real kernconf entry and enable support forSean Bruno2015-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | up to 2 rx/tx queues for the 82574. Program the 82574 to enable 5 msix vectors, assign 1 to each rx queue, 1 to each tx queue and 1 to the link handler. Inspired by DragonFlyBSD, enable some RSS logic for handling tx queue handling/processing. Move multiqueue handler functions so that they line up better in a diff review to if_igb.c Always enqueue tx work to be done in em_mq_start, if unable to acquire the TX lock, then this will be processed in the background later by the taskqueue. Remove mbuf argument from em_start_mq_locked() as the work is always enqueued. (stolen from igb) Setup TARC, TXDCTL and RXDCTL registers for better performance and stability in multiqueue and singlequeue implementations. Handle Intel errata 3 and generic multiqueue behavior with the initialization of TARC(0) and TARC(1) Bind interrupt threads to cpus in order. (stolen from igb) Add 2 new DDB functions, one to display the queue(s) and their settings and one to reset the adapter. Primarily used for debugging. In the multiqueue configuration, bump RXD and TXD ring size to max for the adapter (4096). Setup an RDTR of 64 and an RADV of 128 in multiqueue configuration to cut down on the number of interrupts. RADV was arbitrarily set to 2x RDTR and can be adjusted as needed. Cleanup the display in top a bit to make it clearer where the taskqueue threads are running and what they should be doing. Ensure that both queues are processed by em_local_timer() by writing them both to the IMS register to generate soft interrupts. Ensure that an soft interrupt is generated when em_msix_link() is run so that any races between assertion of the link/status interrupt and a rx/tx interrupt are handled. Document existing tuneables: hw.em.eee_setting, hw.em.msix, hw.em.smart_pwr_down, hw.em.sbp Document use of hw.em.num_queues and the new kernel option EM_MULTIQUEUE Thanks to Intel for their continued support of FreeBSD. Reviewed by: erj jfv hiren gnn wblock Obtained from: Intel Corporation MFC after: 2 weeks Relnotes: Yes Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D1994 Notes: svn path=/head/; revision=283959
* When a netmap process terminates without the full set of buffers itPatrick Kelsey2015-05-151-16/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | 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. Based on intial work by adrian@. Reviewed by: Giuseppe Lettieri (g.lettieri@iet.unipi.it), luigi Approved by: jmallett (mentor) MFC after: 1 week Sponsored by: Norse Corp, Inc. Notes: svn path=/head/; revision=282978
* netmap: improve the netmap attach message on FreeBSD.Rui Paulo2015-04-111-0/+6
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=281406
* Make ix_crcstrip a public symbol for the moment; it probably is notBjoern A. Zeeb2015-03-241-1/+2
| | | | | | | | | | | | | | | | | the right solution but I will leave it to experts to untangle this problem to properly stop the build failures. At the moment only if_ix.c includes dev/netmap/ixgbe_netmap.h which is good as ixgbe_netmap.h defines a couple of (file) static variables--thus local to if_ix.c. static int ix_crcstrip however now also got checked from ix_txrx.c (as an extern) and should not be visible there. In fact we do see powerpc and powerpc64 build failures because of this. It is unclear to me why on other (clang built?) architectures this does not lead to a reference of an undefined symbol and similar build breakage. Notes: svn path=/head/; revision=280430
* Add native netmap support to ixl.Luigi Rizzo2015-02-241-0/+422
| | | | | | | | | | | | | | | | Preliminary tests indicate 32 Mpps on tx, 24 Mpps on rx with source and receiver on two different ports of the same 40G card. Optimizations are likely possible. The code follows closely the one for ixgbe so i do not expect stability issues. Hardware kindly supplied by Intel. Reviewed by: Jack Vogel MFC after: 1 week Notes: svn path=/head/; revision=279232
* add MODULE_VERSION, needed to track module dependenciesLuigi Rizzo2015-02-231-0/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=279199
* two minor changes from the master netmap version:Luigi Rizzo2015-02-141-4/+3
| | | | | | | | | | 1. handle errors from nm_config(), if any (none of the FreeBSD drivers currently returns an error on this function, so this change is a no-op at this time 2. use a full memory barrier on ioctls Notes: svn path=/head/; revision=278774
* whitespace change:Luigi Rizzo2015-02-141-7/+5
| | | | | | | | clarify the role of MAKEDEV_ETERNAL_KLD, and remove an old #ifdef __FreeBSD__ since the code is valid on all platforms. Notes: svn path=/head/; revision=278773
* Change the permissions from 0660 to 0600.Adrian Chadd2015-01-241-2/+2
| | | | | | | | | | | Otherwise people in wheel can do things with netmap, including but not limited to promisc transmit/receive. Approved by: luigi MFC after: 1 week Notes: svn path=/head/; revision=277653
* Start process of removing the use of the deprecated "M_FLOWID" flagHans Petter Selasky2014-12-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Additional notes: - The SCTP code changes will be committed as a separate patch. - Removal of the "M_FLOWID" flag will also be done separately. - The FreeBSD version has been bumped. MFC after: 1 month Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=275358
* add support for private knote lock (reduces lock contention),Luigi Rizzo2014-11-133-18/+49
| | | | | | | | adapting OS_selrecord accordingly. Problem and fix suggested by adrian and jmg Notes: svn path=/head/; revision=274459
* we need full barriers hereLuigi Rizzo2014-11-132-6/+6
| | | | Notes: svn path=/head/; revision=274457
* 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 typo: use ring size from the rx ring, not the tx one (they should beLuigi Rizzo2014-11-111-2/+2
| | | | | | | | the same, but just in case); - reuse the previously computed len-1 value Notes: svn path=/head/; revision=274361
* fix a typoLuigi Rizzo2014-11-101-1/+1
| | | | Notes: svn path=/head/; revision=274355
* initialize *color if passed as an argumentLuigi Rizzo2014-11-101-0/+2
| | | | Notes: svn path=/head/; revision=274354
* sync a comment with our internal repoLuigi Rizzo2014-11-101-1/+1
| | | | Notes: svn path=/head/; revision=274353
* fix a panic when passing ifioctl from a netmap file descriptor toLuigi Rizzo2014-09-251-15/+10
| | | | | | | | | | the underlying device. This needs to be merged to 10.1 Reported by: Patrick Kelsey MFC after: 3 days Notes: svn path=/head/; revision=272111
* adapt the code to different freebsd versions.Luigi Rizzo2014-09-251-3/+6
| | | | | | | Not necessary to MFC Notes: svn path=/head/; revision=272110
* Mechanically convert to if_inc_counter().Gleb Smirnoff2014-09-192-2/+2
| | | | Notes: svn path=/head/; revision=271849
* 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
* staticize two functions, and use proper format for a struct sglistLuigi Rizzo2014-08-171-7/+7
| | | | | | | (reported by bz) Notes: svn path=/head/; revision=270097
* Update to the current version of netmap.Luigi Rizzo2014-08-1617-781/+3068
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix style bug: rename the refcount field of m_ext to ext_cnt, to matchGleb Smirnoff2014-07-112-7/+7
| | | | | | | | | other members. Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=268530
* change the netmap mbuf destructor so the same code works also on FreeBSD 9.Luigi Rizzo2014-06-101-9/+16
| | | | | | | | 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. Notes: svn path=/head/; revision=267328
* Fixes from Fanco Ficthner on transparent modeLuigi Rizzo2014-06-091-19/+7
| | | | | | | | | | | | | | | | | | | | * 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=/head/; revision=267284
* 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
* better handling of netmap emulation over standard device drivers:Luigi Rizzo2014-06-062-29/+83
| | | | | | | | | | plug a potential mbuf leak, and detect bogus drivers that return ENOBUFS even when the packet has been queued. MFC after: 3 days Notes: svn path=/head/; revision=267180
* introduce mbq_lock() and mbq_unlock() for the mbq,Luigi Rizzo2014-06-063-9/+19
| | | | | | | | | | so it is easier to buil the same code on linux (this generalizes the change in svn 267142) MFC after: 3 days Notes: svn path=/head/; revision=267177
* move netmap_getna() to a freebsd-specific fileLuigi Rizzo2014-06-062-6/+8
| | | | Notes: svn path=/head/; revision=267170
* align comments with the ones in our development trunkLuigi Rizzo2014-06-062-24/+104
| | | | Notes: svn path=/head/; revision=267165
* rate limit some error messagesLuigi Rizzo2014-06-061-1/+1
| | | | Notes: svn path=/head/; revision=267164
* remove two debugging messages, align comments with the codeLuigi Rizzo2014-06-061-5/+12
| | | | | | | in our development trunk Notes: svn path=/head/; revision=267163
* add checks for invalid buffer pointers and lengthsLuigi Rizzo2014-06-061-0/+14
| | | | Notes: svn path=/head/; revision=267151
* prevent a panic when the netdev/ifp is not set in attachLuigi Rizzo2014-06-061-1/+2
| | | | | | | | | (internal c63a7b85) MFC after: 3 days Notes: svn path=/head/; revision=267150
* Use mtx_lock_spin/mtx_unlock_spin primitives on spin lockAndrey Zonov2014-06-062-8/+8
| | | | | | | | Reviewed by: luigi MFC after: 1 week Notes: svn path=/head/; revision=267142
* whitespace change: remove trailing whitespaceLuigi Rizzo2014-06-055-14/+14
| | | | Notes: svn path=/head/; revision=267128
* Introduce a procedural interface to the ifnet structure. The newMarcel Moolenaar2014-06-022-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* compile with NOINETLuigi Rizzo2014-02-201-0/+8
| | | | Notes: svn path=/head/; revision=262238
* two small changes:Luigi Rizzo2014-02-181-2/+12
| | | | | | | | | | | | - intercept FIONBIO and FIOASYNC ioctls on netmap file descriptors. libpcap calls them to set non blocking I/O on the file descriptor, for netmap this is a no-op because there is no read/write, but not intercepting would cause fcntl() to return -1 - rate limit and put under netmap.verbose some messages that occur when threads use concurrently the same file descriptor. Notes: svn path=/head/; revision=262149
* This new version of netmap brings you the following:Luigi Rizzo2014-02-159-459/+2358
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* netmap_user.h:Luigi Rizzo2014-01-163-24/+33
| | | | | | | | | | | | | | | | | | | | | add separate rx/tx ring indexes add ring specifier in nm_open device name netmap.c, netmap_vale.c more consistent errno numbers netmap_generic.c correctly handle failure in registering interfaces. tools/tools/netmap/ massive cleanup of the example programs (a lot of common code is now in netmap_user.h.) nm_util.[ch] are going away soon. pcap.c will also go when i commit the native netmap support for libpcap. Notes: svn path=/head/; revision=260700