2017-11-27 14:52:40 +00:00
|
|
|
/*-
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
|
|
|
*
|
Import the current version of netmap, aligned with the one on github.
This commit, long overdue, contains contributions in the last 2 years
from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including:
+ fixes on monitor ports
+ the 'ptnet' virtual device driver, and ptnetmap backend, for
high speed virtual passthrough on VMs (bhyve fixes in an upcoming commit)
+ improved emulated netmap mode
+ more robust error handling
+ removal of stale code
+ various fixes to code and documentation (some mixup between RX and TX
parameters, and private and public variables)
We also include an additional tool, nmreplay, which is functionally
equivalent to tcpreplay but operating on netmap ports.
2016-10-16 14:13:32 +00:00
|
|
|
* Copyright (C) 2012-2014 Matteo Landi
|
|
|
|
* Copyright (C) 2012-2016 Luigi Rizzo
|
|
|
|
* Copyright (C) 2012-2016 Giuseppe Lettieri
|
|
|
|
* All rights reserved.
|
2013-11-02 00:54:47 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* $FreeBSD$
|
|
|
|
*
|
|
|
|
* (New) memory allocator for netmap
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This allocator creates three memory pools:
|
|
|
|
* nm_if_pool for the struct netmap_if
|
|
|
|
* nm_ring_pool for the struct netmap_ring
|
|
|
|
* nm_buf_pool for the packet buffers.
|
|
|
|
*
|
|
|
|
* that contain netmap objects. Each pool is made of a number of clusters,
|
|
|
|
* multiple of a page size, each containing an integer number of objects.
|
|
|
|
* The clusters are contiguous in user space but not in the kernel.
|
|
|
|
* Only nm_buf_pool needs to be dma-able,
|
|
|
|
* but for convenience use the same type of allocator for all.
|
|
|
|
*
|
|
|
|
* Once mapped, the three pools are exported to userspace
|
|
|
|
* as a contiguous block, starting from nm_if_pool. Each
|
|
|
|
* cluster (and pool) is an integral number of pages.
|
|
|
|
* [ . . . ][ . . . . . .][ . . . . . . . . . .]
|
|
|
|
* nm_if nm_ring nm_buf
|
|
|
|
*
|
|
|
|
* The userspace areas contain offsets of the objects in userspace.
|
|
|
|
* When (at init time) we write these offsets, we find out the index
|
|
|
|
* of the object, and from there locate the offset from the beginning
|
|
|
|
* of the region.
|
|
|
|
*
|
|
|
|
* The invididual allocators manage a pool of memory for objects of
|
|
|
|
* the same size.
|
|
|
|
* The pool is split into smaller clusters, whose size is a
|
|
|
|
* multiple of the page size. The cluster size is chosen
|
|
|
|
* to minimize the waste for a given max cluster size
|
|
|
|
* (we do it by brute force, as we have relatively few objects
|
|
|
|
* per cluster).
|
|
|
|
*
|
|
|
|
* Objects are aligned to the cache line (64 bytes) rounding up object
|
|
|
|
* sizes when needed. A bitmap contains the state of each object.
|
|
|
|
* Allocation scans the bitmap; this is done only on attach, so we are not
|
|
|
|
* too worried about performance
|
|
|
|
*
|
|
|
|
* For each allocator we can define (thorugh sysctl) the size and
|
|
|
|
* number of each object. Memory is allocated at the first use of a
|
|
|
|
* netmap file descriptor, and can be freed when all such descriptors
|
|
|
|
* have been released (including unmapping the memory).
|
|
|
|
* If memory is scarce, the system tries to get as much as possible
|
|
|
|
* and the sysctl values reflect the actual allocation.
|
|
|
|
* Together with desired values, the sysctl export also absolute
|
|
|
|
* min and maximum values that cannot be overridden.
|
|
|
|
*
|
|
|
|
* struct netmap_if:
|
|
|
|
* variable size, max 16 bytes per ring pair plus some fixed amount.
|
|
|
|
* 1024 bytes should be large enough in practice.
|
|
|
|
*
|
|
|
|
* In the worst case we have one netmap_if per ring in the system.
|
|
|
|
*
|
|
|
|
* struct netmap_ring
|
|
|
|
* variable size, 8 byte per slot plus some fixed amount.
|
|
|
|
* Rings can be large (e.g. 4k slots, or >32Kbytes).
|
|
|
|
* We default to 36 KB (9 pages), and a few hundred rings.
|
|
|
|
*
|
|
|
|
* struct netmap_buffer
|
|
|
|
* The more the better, both because fast interfaces tend to have
|
|
|
|
* many slots, and because we may want to use buffers to store
|
|
|
|
* packets in userspace avoiding copies.
|
|
|
|
* Must contain a full frame (eg 1518, or more for vlans, jumbo
|
|
|
|
* frames etc.) plus be nicely aligned, plus some NICs restrict
|
|
|
|
* the size to multiple of 1K or so. Default to 2K
|
|
|
|
*/
|
|
|
|
#ifndef _NET_NETMAP_MEM2_H_
|
|
|
|
#define _NET_NETMAP_MEM2_H_
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* We implement two kinds of netmap_mem_d structures:
|
|
|
|
*
|
|
|
|
* - global: used by hardware NICS;
|
|
|
|
*
|
|
|
|
* - private: used by VALE ports.
|
|
|
|
*
|
|
|
|
* In both cases, the netmap_mem_d structure has the same lifetime as the
|
|
|
|
* netmap_adapter of the corresponding NIC or port. It is the responsibility of
|
|
|
|
* the client code to delete the private allocator when the associated
|
|
|
|
* netmap_adapter is freed (this is implemented by the NAF_MEM_OWNER flag in
|
|
|
|
* netmap.c). The 'refcount' field counts the number of active users of the
|
|
|
|
* structure. The global allocator uses this information to prevent/allow
|
|
|
|
* reconfiguration. The private allocators release all their memory when there
|
|
|
|
* are no active users. By 'active user' we mean an existing netmap_priv
|
|
|
|
* structure holding a reference to the allocator.
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern struct netmap_mem_d nm_mem;
|
2017-06-12 22:53:18 +00:00
|
|
|
typedef uint16_t nm_memid_t;
|
2013-11-02 00:54:47 +00:00
|
|
|
|
Import the current version of netmap, aligned with the one on github.
This commit, long overdue, contains contributions in the last 2 years
from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including:
+ fixes on monitor ports
+ the 'ptnet' virtual device driver, and ptnetmap backend, for
high speed virtual passthrough on VMs (bhyve fixes in an upcoming commit)
+ improved emulated netmap mode
+ more robust error handling
+ removal of stale code
+ various fixes to code and documentation (some mixup between RX and TX
parameters, and private and public variables)
We also include an additional tool, nmreplay, which is functionally
equivalent to tcpreplay but operating on netmap ports.
2016-10-16 14:13:32 +00:00
|
|
|
int netmap_mem_get_lut(struct netmap_mem_d *, struct netmap_lut *);
|
2017-06-12 22:53:18 +00:00
|
|
|
nm_memid_t netmap_mem_get_id(struct netmap_mem_d *);
|
2013-11-02 00:54:47 +00:00
|
|
|
vm_paddr_t netmap_mem_ofstophys(struct netmap_mem_d *, vm_ooffset_t);
|
Import the current version of netmap, aligned with the one on github.
This commit, long overdue, contains contributions in the last 2 years
from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including:
+ fixes on monitor ports
+ the 'ptnet' virtual device driver, and ptnetmap backend, for
high speed virtual passthrough on VMs (bhyve fixes in an upcoming commit)
+ improved emulated netmap mode
+ more robust error handling
+ removal of stale code
+ various fixes to code and documentation (some mixup between RX and TX
parameters, and private and public variables)
We also include an additional tool, nmreplay, which is functionally
equivalent to tcpreplay but operating on netmap ports.
2016-10-16 14:13:32 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
PMDL win32_build_user_vm_map(struct netmap_mem_d* nmd);
|
|
|
|
#endif
|
Update to the current version of netmap.
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.
2014-08-16 15:00:01 +00:00
|
|
|
int netmap_mem_finalize(struct netmap_mem_d *, struct netmap_adapter *);
|
2013-11-02 00:54:47 +00:00
|
|
|
int netmap_mem_init(void);
|
|
|
|
void netmap_mem_fini(void);
|
2017-06-12 22:53:18 +00:00
|
|
|
struct netmap_if * netmap_mem_if_new(struct netmap_adapter *, struct netmap_priv_d *);
|
2013-12-15 08:37:24 +00:00
|
|
|
void netmap_mem_if_delete(struct netmap_adapter *, struct netmap_if *);
|
|
|
|
int netmap_mem_rings_create(struct netmap_adapter *);
|
|
|
|
void netmap_mem_rings_delete(struct netmap_adapter *);
|
2018-04-09 09:24:26 +00:00
|
|
|
int netmap_mem_deref(struct netmap_mem_d *, struct netmap_adapter *);
|
netmap: align codebase to the current upstream (commit id 3fb001303718146)
Changelist:
- Turn tx_rings and rx_rings arrays into arrays of pointers to kring
structs. This patch includes fixes for ixv, ixl, ix, re, cxgbe, iflib,
vtnet and ptnet drivers to cope with the change.
- Generalize the nm_config() callback to accept a struct containing many
parameters.
- Introduce NKR_FAKERING to support buffers sharing (used for netmap
pipes)
- Improved API for external VALE modules.
- Various bug fixes and improvements to the netmap memory allocator,
including support for externally (userspace) allocated memory.
- Refactoring of netmap pipes: now linked rings share the same netmap
buffers, with a separate set of kring pointers (rhead, rcur, rtail).
Buffer swapping does not need to happen anymore.
- Large refactoring of the control API towards an extensible solution;
the goal is to allow the addition of more commands and extension of
existing ones (with new options) without the need of hacks or the
risk of running out of configuration space.
A new NIOCCTRL ioctl has been added to handle all the requests of the
new control API, which cover all the functionalities so far supported.
The netmap API bumps from 11 to 12 with this patch. Full backward
compatibility is provided for the old control command (NIOCREGIF), by
means of a new netmap_legacy module. Many parts of the old netmap.h
header has now been moved to netmap_legacy.h (included by netmap.h).
Approved by: hrs (mentor)
2018-04-12 07:20:50 +00:00
|
|
|
int netmap_mem2_get_pool_info(struct netmap_mem_d *, u_int, u_int *, u_int *);
|
|
|
|
int netmap_mem_get_info(struct netmap_mem_d *, uint64_t *size,
|
|
|
|
u_int *memflags, nm_memid_t *id);
|
2013-12-15 08:37:24 +00:00
|
|
|
ssize_t netmap_mem_if_offset(struct netmap_mem_d *, const void *vaddr);
|
2017-06-12 22:53:18 +00:00
|
|
|
struct netmap_mem_d* netmap_mem_private_new( u_int txr, u_int txd, u_int rxr, u_int rxd,
|
|
|
|
u_int extra_bufs, u_int npipes, int* error);
|
Sync netmap sources with the version in our private tree.
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
2015-07-10 05:51:36 +00:00
|
|
|
|
2017-06-12 22:53:18 +00:00
|
|
|
#define netmap_mem_get(d) __netmap_mem_get(d, __FUNCTION__, __LINE__)
|
|
|
|
#define netmap_mem_put(d) __netmap_mem_put(d, __FUNCTION__, __LINE__)
|
|
|
|
struct netmap_mem_d* __netmap_mem_get(struct netmap_mem_d *, const char *, int);
|
Sync netmap sources with the version in our private tree.
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
2015-07-10 05:51:36 +00:00
|
|
|
void __netmap_mem_put(struct netmap_mem_d *, const char *, int);
|
2017-06-12 22:53:18 +00:00
|
|
|
struct netmap_mem_d* netmap_mem_find(nm_memid_t);
|
2018-04-09 09:24:26 +00:00
|
|
|
unsigned netmap_mem_bufsize(struct netmap_mem_d *nmd);
|
|
|
|
|
|
|
|
#ifdef WITH_EXTMEM
|
netmap: align codebase to the current upstream (commit id 3fb001303718146)
Changelist:
- Turn tx_rings and rx_rings arrays into arrays of pointers to kring
structs. This patch includes fixes for ixv, ixl, ix, re, cxgbe, iflib,
vtnet and ptnet drivers to cope with the change.
- Generalize the nm_config() callback to accept a struct containing many
parameters.
- Introduce NKR_FAKERING to support buffers sharing (used for netmap
pipes)
- Improved API for external VALE modules.
- Various bug fixes and improvements to the netmap memory allocator,
including support for externally (userspace) allocated memory.
- Refactoring of netmap pipes: now linked rings share the same netmap
buffers, with a separate set of kring pointers (rhead, rcur, rtail).
Buffer swapping does not need to happen anymore.
- Large refactoring of the control API towards an extensible solution;
the goal is to allow the addition of more commands and extension of
existing ones (with new options) without the need of hacks or the
risk of running out of configuration space.
A new NIOCCTRL ioctl has been added to handle all the requests of the
new control API, which cover all the functionalities so far supported.
The netmap API bumps from 11 to 12 with this patch. Full backward
compatibility is provided for the old control command (NIOCREGIF), by
means of a new netmap_legacy module. Many parts of the old netmap.h
header has now been moved to netmap_legacy.h (included by netmap.h).
Approved by: hrs (mentor)
2018-04-12 07:20:50 +00:00
|
|
|
struct netmap_mem_d* netmap_mem_ext_create(uint64_t, struct nmreq_pools_info *, int *);
|
2018-04-09 09:24:26 +00:00
|
|
|
#else /* !WITH_EXTMEM */
|
|
|
|
#define netmap_mem_ext_create(nmr, _perr) \
|
|
|
|
({ int *perr = _perr; if (perr) *(perr) = EOPNOTSUPP; NULL; })
|
|
|
|
#endif /* WITH_EXTMEM */
|
2013-11-02 00:54:47 +00:00
|
|
|
|
2018-12-05 11:57:16 +00:00
|
|
|
#ifdef WITH_PTNETMAP
|
Import the current version of netmap, aligned with the one on github.
This commit, long overdue, contains contributions in the last 2 years
from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including:
+ fixes on monitor ports
+ the 'ptnet' virtual device driver, and ptnetmap backend, for
high speed virtual passthrough on VMs (bhyve fixes in an upcoming commit)
+ improved emulated netmap mode
+ more robust error handling
+ removal of stale code
+ various fixes to code and documentation (some mixup between RX and TX
parameters, and private and public variables)
We also include an additional tool, nmreplay, which is functionally
equivalent to tcpreplay but operating on netmap ports.
2016-10-16 14:13:32 +00:00
|
|
|
struct netmap_mem_d* netmap_mem_pt_guest_new(struct ifnet *,
|
|
|
|
unsigned int nifp_offset,
|
2016-10-27 09:46:22 +00:00
|
|
|
unsigned int memid);
|
Import the current version of netmap, aligned with the one on github.
This commit, long overdue, contains contributions in the last 2 years
from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including:
+ fixes on monitor ports
+ the 'ptnet' virtual device driver, and ptnetmap backend, for
high speed virtual passthrough on VMs (bhyve fixes in an upcoming commit)
+ improved emulated netmap mode
+ more robust error handling
+ removal of stale code
+ various fixes to code and documentation (some mixup between RX and TX
parameters, and private and public variables)
We also include an additional tool, nmreplay, which is functionally
equivalent to tcpreplay but operating on netmap ports.
2016-10-16 14:13:32 +00:00
|
|
|
struct ptnetmap_memdev;
|
|
|
|
struct netmap_mem_d* netmap_mem_pt_guest_attach(struct ptnetmap_memdev *, uint16_t);
|
|
|
|
int netmap_mem_pt_guest_ifp_del(struct netmap_mem_d *, struct ifnet *);
|
2018-12-05 11:57:16 +00:00
|
|
|
#endif /* WITH_PTNETMAP */
|
Import the current version of netmap, aligned with the one on github.
This commit, long overdue, contains contributions in the last 2 years
from Stefano Garzarella, Giuseppe Lettieri, Vincenzo Maffione, including:
+ fixes on monitor ports
+ the 'ptnet' virtual device driver, and ptnetmap backend, for
high speed virtual passthrough on VMs (bhyve fixes in an upcoming commit)
+ improved emulated netmap mode
+ more robust error handling
+ removal of stale code
+ various fixes to code and documentation (some mixup between RX and TX
parameters, and private and public variables)
We also include an additional tool, nmreplay, which is functionally
equivalent to tcpreplay but operating on netmap ports.
2016-10-16 14:13:32 +00:00
|
|
|
|
netmap: align codebase to the current upstream (commit id 3fb001303718146)
Changelist:
- Turn tx_rings and rx_rings arrays into arrays of pointers to kring
structs. This patch includes fixes for ixv, ixl, ix, re, cxgbe, iflib,
vtnet and ptnet drivers to cope with the change.
- Generalize the nm_config() callback to accept a struct containing many
parameters.
- Introduce NKR_FAKERING to support buffers sharing (used for netmap
pipes)
- Improved API for external VALE modules.
- Various bug fixes and improvements to the netmap memory allocator,
including support for externally (userspace) allocated memory.
- Refactoring of netmap pipes: now linked rings share the same netmap
buffers, with a separate set of kring pointers (rhead, rcur, rtail).
Buffer swapping does not need to happen anymore.
- Large refactoring of the control API towards an extensible solution;
the goal is to allow the addition of more commands and extension of
existing ones (with new options) without the need of hacks or the
risk of running out of configuration space.
A new NIOCCTRL ioctl has been added to handle all the requests of the
new control API, which cover all the functionalities so far supported.
The netmap API bumps from 11 to 12 with this patch. Full backward
compatibility is provided for the old control command (NIOCREGIF), by
means of a new netmap_legacy module. Many parts of the old netmap.h
header has now been moved to netmap_legacy.h (included by netmap.h).
Approved by: hrs (mentor)
2018-04-12 07:20:50 +00:00
|
|
|
int netmap_mem_pools_info_get(struct nmreq_pools_info *,
|
|
|
|
struct netmap_mem_d *);
|
2016-10-27 09:46:22 +00:00
|
|
|
|
Update to the current version of netmap.
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.
2014-08-16 15:00:01 +00:00
|
|
|
#define NETMAP_MEM_PRIVATE 0x2 /* allocator uses private address space */
|
|
|
|
#define NETMAP_MEM_IO 0x4 /* the underlying memory is mmapped I/O */
|
2018-04-09 09:24:26 +00:00
|
|
|
#define NETMAP_MEM_EXT 0x10 /* external memory (not remappable) */
|
2013-11-02 00:54:47 +00:00
|
|
|
|
This new version of netmap brings you the following:
- 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
2014-02-15 04:53:04 +00:00
|
|
|
uint32_t netmap_extra_alloc(struct netmap_adapter *, uint32_t *, uint32_t n);
|
2013-11-02 00:54:47 +00:00
|
|
|
|
netmap: align codebase to the current upstream (commit id 3fb001303718146)
Changelist:
- Turn tx_rings and rx_rings arrays into arrays of pointers to kring
structs. This patch includes fixes for ixv, ixl, ix, re, cxgbe, iflib,
vtnet and ptnet drivers to cope with the change.
- Generalize the nm_config() callback to accept a struct containing many
parameters.
- Introduce NKR_FAKERING to support buffers sharing (used for netmap
pipes)
- Improved API for external VALE modules.
- Various bug fixes and improvements to the netmap memory allocator,
including support for externally (userspace) allocated memory.
- Refactoring of netmap pipes: now linked rings share the same netmap
buffers, with a separate set of kring pointers (rhead, rcur, rtail).
Buffer swapping does not need to happen anymore.
- Large refactoring of the control API towards an extensible solution;
the goal is to allow the addition of more commands and extension of
existing ones (with new options) without the need of hacks or the
risk of running out of configuration space.
A new NIOCCTRL ioctl has been added to handle all the requests of the
new control API, which cover all the functionalities so far supported.
The netmap API bumps from 11 to 12 with this patch. Full backward
compatibility is provided for the old control command (NIOCREGIF), by
means of a new netmap_legacy module. Many parts of the old netmap.h
header has now been moved to netmap_legacy.h (included by netmap.h).
Approved by: hrs (mentor)
2018-04-12 07:20:50 +00:00
|
|
|
#ifdef WITH_EXTMEM
|
|
|
|
#include <net/netmap_virt.h>
|
|
|
|
struct nm_os_extmem; /* opaque */
|
|
|
|
struct nm_os_extmem *nm_os_extmem_create(unsigned long, struct nmreq_pools_info *, int *perror);
|
|
|
|
char *nm_os_extmem_nextpage(struct nm_os_extmem *);
|
|
|
|
int nm_os_extmem_nr_pages(struct nm_os_extmem *);
|
|
|
|
int nm_os_extmem_isequal(struct nm_os_extmem *, struct nm_os_extmem *);
|
|
|
|
void nm_os_extmem_delete(struct nm_os_extmem *);
|
|
|
|
#endif /* WITH_EXTMEM */
|
|
|
|
|
2013-11-02 00:54:47 +00:00
|
|
|
#endif
|