| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Per the removed comments these fields should be loaded only once, since
they can in principle be modified concurrently, though this would be a
violation of the userspace contract with netmap.
No functional change intended.
Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38061
(cherry picked from commit 56c438fcd4a755f0abe8254779c39a0c4b530c75)
|
| |
|
|
|
|
|
|
|
|
|
| |
Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38063
(cherry picked from commit 854b2f302dcc73dfef2e4458d382f8149ce9167c)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The check is ok by default, since the default value of
netmap_generic_ringsize is 1024. But we should check against the
configured "ring" size.
Reviewed by: vmaffione
MFC after: 1 week
Sponsored by: Zenarmor
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38062
(cherry picked from commit 539437c8281d24450bacded3734276acd9983e90)
|
| |
|
|
|
|
| |
No functional changes intended.
(cherry picked from commit 45c67e8f6b56b9744f01142747fadf291fe3fad2)
|
| |
|
|
|
|
|
|
|
|
|
| |
Netmap users on FreeBSD are not supposed to import code from the
github netmap repository anymore. They should use the code that
is available in the src repo. We can therefore drop the compatibility
code.
MFC after: 7 days
(cherry picked from commit 3da494d3246e30a19d2107c8bb8a293ffd5a9da6)
|
| |
|
|
|
|
| |
MFC after: 7 days
(cherry picked from commit 95fc11577d117327e7d99a589e86ba15d0599654)
|
| |
|
|
|
|
| |
MFC after: 7 days
(cherry picked from commit 92e8b4a6301cc4ff4481e981c95c5b30b2a44506)
|
| |
|
|
|
|
|
|
|
|
| |
netmap_monitor_stop() called nm_monitor_none() after the head of
the zero-copy monitors had been reset, thus thinking that there
was nothing left to do.
MFC after: 7 days
(cherry picked from commit b41818a28a6dba6d33076fbb789442308e57a124)
|
| |
|
|
|
|
| |
MFC after: 1 week
(cherry picked from commit 4ad57c7afaca3fd94b67c00706e210f0373b8e62)
|
| |
|
|
|
|
| |
- s/the the/the/
(cherry picked from commit 591a9b5ea339feda45cd0dafaac4b581495a57d2)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With clang 15, the following -Werror warning is produced:
sys/dev/netmap/if_re_netmap.h:179:8: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
u_int n;
^
The 'n' variable appears to have been a debugging aid that has never
been used for anything, so remove it.
MFC after: 3 days
(cherry picked from commit 8bfedf5852bcb846bfdd2a54989d65cdbb16f7ef)
|
| |
|
|
|
|
|
|
|
|
| |
The new dev.netmap.max_bridges sysctl tunable can be set in
loader.conf(5) to change the default maximum number of VALE
switches that can be created. Current defaults is 8.
MFC after: 2 weeks
(cherry picked from commit dd6ab49a9aebb5fbb85973d9a859d24daa5e2165)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The total size of the user-provided nmreq was first computed and then
trusted during the copyin. This might lead to kernel memory corruption
and escape from jails/containers.
Reported by: Lucas Leong (@_wmliang_) of Trend Micro Zero Day Initiative
Security: CVE-2022-23084
MFC after: 3 days
(cherry picked from commit 393729916564ed13f966e09129a24e6931898d12)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
An unsanitized field in an option could be abused, causing an integer
overflow followed by kernel memory corruption. This might be used
to escape jails/containers.
Reported by: Reno Robert and Lucas Leong (@_wmliang_) of Trend Micro
Zero Day Initiative
Security: CVE-2022-23085
(cherry picked from commit 694ea59c7021c25417e6d516362d2f59b4e2c343)
|
| |
|
|
|
|
|
|
|
|
| |
The netmap monitor intercepts any TX/RX packets on the monitored
port. However, before this change there was no way to tell
whether an intercepted packet was being transmitted or received
on the monitored port.
A TXMON flag in the netmap slot has been added for this purpose.
(cherry picked from commit 660a47cb991d5a7ca69cd8dd9c09a5288d49e405)
|
| |
|
|
|
|
|
|
|
|
|
| |
Such type cannot be used in code that is in common between
FreeBSD and Linux. Use the FreeBSD type instead.
MFC after: 3 days
Reported by: markj
Differential Revision: https://reviews.freebsd.org/D29677
(cherry picked from commit 70275a6735df8a514f48be77418491f2f8dba817)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Call vm_object_reference() before vm_map_lookup_done().
- Use vm_mmap_to_errno() to convert vm_map_* return values to errno.
- Fix memory leak of e->obj.
Reported by: markj
Reviewed by: markj
MFC after: 1 week
(cherry picked from commit ee7ffaa2e6e08b63efb4673610875d40964d5058)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The netmap_ioctl() function has a reference counting bug in case of
NETMAP_REQ_PORT_INFO_GET command. When `hdr->nr_name[0] == '\0'`,
the function does not decrease the refcount of "nmd", which is
increased by netmap_mem_find(), causing a refcount leak.
Reported by: Xiyu Yang <sherllyyang00@gmail.com>
Submitted by: Carl Smith <carl.smith@alliedtelesis.co.nz>
MFC after: 3 days
PR: 254311
(cherry picked from commit 0ab5902e8ad93d0a9341dcce386b6c571ee02173)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
netmap is compiled into the kernel by default so initialization was
always reported, and netmap uses a formatting convention not used in the
rest of the kernel.
Reviewed by: vmaffione
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29099
(cherry picked from commit fef845097190f0ecb783d6c75a9398c4e4a4c0e1)
|
| |
|
|
|
|
| |
Changes imported from the netmap github.
(cherry picked from commit ee0005f11f2b38a714bc66b7d79832108f6fee77)
|
| |
|
|
|
|
|
| |
At device reset, we must not publish those netmap receive buffers
that are owned by userspace (nm_kr_rxspace).
MFC after: 1 week
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Restore the hwofs functionality temporarily disabled by
7ba6ecf216fb15e8b147db2 to prevent issues with iflib.
This patch brings the necessary changes to iflib to
enable howfs to allow interface restarts without
disrupting netmap applications actively using its
rings.
After this change, it becomes possible for multiple
non-cooperating netmap applications to use non-overlapping
subsets of the available netmap rings without clashing
with each other.
PR: 252453
MFC after: 1 week
|
| |
|
|
|
|
|
| |
See 3d65fd97e85ab807f3b for a detailed explanation.
PR: 252453
MFC after: 1 week
|
| |
|
|
|
|
|
|
| |
Similarly to what done for iflib in 1d238b07d5d4d9660ae0e,
this patch prevents access to the krings during the interface
reset triggered by netmap_register().
MFC after: 1 week
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The netmap_reset() function is meant to be called by the driver
when they initialize (or re-initialize) a hardware ring.
However, since the introduction of support for opening (in
netmap mode) a subset of the available rings, netmap_reset()
may be called multiple times on actively used rings, causing
both kring and netmap ring to transition to an inconsistent
state.
This changes improves the situation by resetting all the
indices fields of the kring to 0, as expected after the
reinitialization of a hardware ring.
PR: 252518
MFC after: 1 week
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When different processes open separate subsets of the
available rings of a same netmap interface, a device
reset may be performed while one of the processes
is actively using some rings (e.g., caused by another
process executing a nmport_open()).
With this patch, such situation will cause the
active process to get a POLLERR, so that it can
have a chance to detect the situation.
We also guarantee that no process is running a txsync
or rxsync (ioctl or poll) while an iflib device reset
is in progress.
PR: 252453
MFC after: 1 week
|
| |
|
|
|
|
|
|
|
|
| |
https://github.com/luigirizzo/netmap/pull/733
Submitted by: brian90013
MFC after: 3 days
Notes:
svn path=/head/; revision=366952
|
| |
|
|
|
|
|
|
|
|
| |
EPOCH calls are FreeBSD specific. Use guards to protect these, so
that the code can compile under Linux.
MFC after: 1 week
Notes:
svn path=/head/; revision=364731
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Code was checking for NETMAP_{SW,HW}_RING in req->nr_ringid which
had already been masked by NETMAP_RING_MASK. Therefore, the comparisons
always failed and set NR_REG_ALL_NIC. Check against the original nmr
structure.
Submitted by: bpoole@packetforensics.com
Reported by: bpoole@packetforensics.com
Reviewed by: giuseppe.lettieri@unipi.it
Approved by: vmaffione
MFC after: 1 week
Notes:
svn path=/head/; revision=364341
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The nm_register callback needs to call nm_set_native_flags()
or nm_clear_native_flags() once the device has been stopped.
However, in the current implementation this is not true,
as the device is stopped by vtnet_init_locked(). This causes
race conditions where the driver crashes as soon as it
dequeues netmap buffers assuming they are mbufs (or the other
way around).
To fix the issue, we extend vtnet_init_locked() with a second
argument that, if not zero, will set/clear the netmap flags.
This results in a huge simplification of the nm_register
callback itself.
Also, use netmap_reset() to check if a ring is going to be
re-initialized in netmap mode.
MFC after: 1 week
Notes:
svn path=/head/; revision=362183
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This function returns NULL if the ring identified by
queue id and direction is in netmap mode. Otherwise
return the corresponding kring.
Use this function to replace vtnet_netmap_queue_on().
MFC after: 1 week
Notes:
svn path=/head/; revision=362076
|
| |
|
|
|
|
|
| |
MFC after: 1 week
Notes:
svn path=/head/; revision=361760
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This change prevents a race that happens when rxsync dequeues
N-1 rx packets (with N being the size of the netmap rx ring).
In this situation, the loop exits without re-enabling the
rx interrupts, thus causing the VQ to stall.
MFC after: 1 week
Notes:
svn path=/head/; revision=361759
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new index tracks the next netmap slot that is going
to be enqueued into the virtqueue. The index is necessary
to prevent the receive VQ and the netmap rx ring from going
out of sync, considering that we never enqueue N slots, but
at most N-1. This change fixes a bug that causes the VQ
and the netmap ring to go out of sync after N-1 packets
have been received.
MFC after: 1 week
Notes:
svn path=/head/; revision=361758
|
| |
|
|
|
|
|
| |
MFC after: 1 week
Notes:
svn path=/head/; revision=361747
|
| |
|
|
|
|
|
| |
MFC after: 1 week
Notes:
svn path=/head/; revision=361746
|
| |
|
|
|
|
|
|
|
|
|
| |
netmap assumes the one "slot" is left unused to distinguish
the empty ring and full ring conditions. This assumption was
violated by vtnet_netmap_rxq_populate().
MFC after: 1 week
Notes:
svn path=/head/; revision=361698
|
| |
|
|
|
|
|
|
|
|
|
| |
The functionality contained in this function is duplicated,
as it is already available in vtnet_txq_free_mbufs()
and vtnet_rxq_free_mbufs().
MFC after: 1 week
Notes:
svn path=/head/; revision=361697
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The vtnet_netmap_rxq_populate() function erroneously assumed
that kring->nr_hwcur = 0, i.e. the kring was in the initial
state. However, this is not always the case: for example,
when a vtnet reinit is triggered by some changes in the
interface flags or capenable.
This patch changes the behaviour of vtnet_netmap_kring_refill()
so that it always starts publishing the netmap buffers starting
from the current value of kring->nr_hwcur.
MFC after: 1 week
Notes:
svn path=/head/; revision=361696
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.
This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.
Mark all obvious cases as MPSAFE. All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT
Approved by: kib (mentor, blanket)
Commented by: kib, gallatin, melifaro
Differential Revision: https://reviews.freebsd.org/D23718
Notes:
svn path=/head/; revision=358333
|
| |
|
|
|
|
|
|
|
|
| |
incoming packets in taskqueue context.
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D23518
Notes:
svn path=/head/; revision=357772
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Clean up obsolete sysctl descriptions and add missing ones.
PR: 243838
Reviewed by: bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23546
Notes:
svn path=/head/; revision=357663
|
| |
|
|
|
|
|
| |
MFC after: 3 days
Notes:
svn path=/head/; revision=357159
|
| |
|
|
| |
Notes:
svn path=/head/; revision=357008
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
MFC after: 3 days
Notes:
svn path=/head/; revision=356704
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
removed from objects including calls to free. Pages must not be xbusy
when freed and not on an object. Strengthen assertions to match these
expectations. In practice very little code had to change busy handling
to meet these rules but we can now make stronger guarantees to busy
holders and avoid conditionally dropping busy in free.
Refine vm_page_remove() and vm_page_replace() semantics now that we have
stronger guarantees about busy state. This removes redundant and
potentially problematic code that has proliferated.
Discussed with: markj
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D22822
Notes:
svn path=/head/; revision=356002
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The valectl(4) program is used to manage vale(4) switches.
Add it to the system commands so that it can be used right away.
This program was previously called vale-ctl, and stored in
tools/tools/netmap
Reviewed by: hrs, bcr, lwhsu, kevans
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D22146
Notes:
svn path=/head/; revision=354229
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After r353292, netmap generic adapter on if_vlan interfaces panics on
asserting the NET_EPOCH. In more detail, this happens when
nm_os_generic_xmit_frame() is called, that is in the generic txsync
routine.
Fix the issue by entering the NET_EPOCH during the generic txsync.
We amortize the cost of entering/exiting over a whole batch of
transmissions.
PR: 241489
Reported by: Aleksandr Fedorov <aleksandr.fedorov@itglobal.com>
Notes:
svn path=/head/; revision=354137
|
| |
|
|
|
|
|
|
|
|
|
| |
- use ring->head rather than ring->cur in lb(8)
- use strlcat() rather than strncat()
- fix bandwidth computation in pkt-gen(8)
MFC after: 1 week
Notes:
svn path=/head/; revision=353775
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch is part of an effort to make bhyve networking (in particular TCP)
faster. The key strategy to enhance TCP throughput is to let the whole packet
datapath work with TSO/LRO packets (up to 64KB each), so that the per-packet
overhead is amortized over a large number of bytes.
This capability is supported in the guest by means of the vtnet(4) driver,
which is able to handle TSO/LRO packets leveraging the virtio-net header
(see struct virtio_net_hdr and struct virtio_net_hdr_mrg_rxbuf).
A bhyve VM exchanges packets with the host through a network backend,
which can be vale(4) or if_tap(4).
While vale(4) supports TSO/LRO packets, if_tap(4) does not.
This patch extends if_tap(4) with the ability to understand the virtio-net
header, so that a tapX interface can process TSO/LRO packets.
A couple of ioctl commands have been added to configure and probe the
virtio-net header. Once the virtio-net header is set, the tapX interface
acquires all the IFCAP capabilities necessary for TSO/LRO.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D21263
Notes:
svn path=/head/; revision=353741
|