<feed xmlns='http://www.w3.org/2005/Atom'>
<title>freebsd-src.git/sys/dev/netmap, branch main</title>
<subtitle>FreeBSD sources</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/freebsd-src.git/'/>
<entry>
<title>netmap: silence -Wdefault-const-init-field-unsafe warning</title>
<updated>2025-12-16T20:21:45+00:00</updated>
<author>
<name>Alex Richardson</name>
<email>arichardson@FreeBSD.org</email>
</author>
<published>2025-12-16T18:09:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/freebsd-src.git/commit/?id=2ed21f90906b230476d3f12ff9dce0e2c4642af2'/>
<id>2ed21f90906b230476d3f12ff9dce0e2c4642af2</id>
<content type='text'>
The netmap_ring struct starts with various const members and rencent
clang warns about leaving them uninitialized. Having them const in the
first place is highly suspicious since they are updated with various
macros but using hand-coded __DECONST(). But fixing that is a more
invasive change that I am unable to test.

```
.../freebsd/sys/dev/netmap/netmap_kloop.c:320:21: error: default initialization of an object of type 'struct netmap_ring' with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
  320 |         struct netmap_ring shadow_ring; /* shadow copy of the netmap_ring */
      |                            ^
.../freebsd/sys/net/netmap.h:290:16: note: member 'buf_ofs' declared 'const' here
  290 |         const int64_t   buf_ofs;
      |                         ^
```

Test Plan: Compiles

Reviewed by:	vmaffione, jhb
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D52568
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The netmap_ring struct starts with various const members and rencent
clang warns about leaving them uninitialized. Having them const in the
first place is highly suspicious since they are updated with various
macros but using hand-coded __DECONST(). But fixing that is a more
invasive change that I am unable to test.

```
.../freebsd/sys/dev/netmap/netmap_kloop.c:320:21: error: default initialization of an object of type 'struct netmap_ring' with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
  320 |         struct netmap_ring shadow_ring; /* shadow copy of the netmap_ring */
      |                            ^
.../freebsd/sys/net/netmap.h:290:16: note: member 'buf_ofs' declared 'const' here
  290 |         const int64_t   buf_ofs;
      |                         ^
```

Test Plan: Compiles

Reviewed by:	vmaffione, jhb
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D52568
</pre>
</div>
</content>
</entry>
<entry>
<title>netmap: Let memory allocator parameters be settable via loader.conf</title>
<updated>2025-12-14T15:47:48+00:00</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2025-12-14T15:47:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/freebsd-src.git/commit/?id=c694122f3cfb7d52b882fa79086d49f45a2c7fd2'/>
<id>c694122f3cfb7d52b882fa79086d49f45a2c7fd2</id>
<content type='text'>
This is useful when dev.netmap.port_numa_affinity is set to 1.  When
interfaces attach, they get a memory allocator that is copied from
nm_mem.  Parameters in nm_mem can be set using sysctls, but this happens
after their values are copied.

To work around this, we can make it possible to set these memory
parameters as tunables.

Reviewed by:	vmaffione
MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D54178
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is useful when dev.netmap.port_numa_affinity is set to 1.  When
interfaces attach, they get a memory allocator that is copied from
nm_mem.  Parameters in nm_mem can be set using sysctls, but this happens
after their values are copied.

To work around this, we can make it possible to set these memory
parameters as tunables.

Reviewed by:	vmaffione
MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D54178
</pre>
</div>
</content>
</entry>
<entry>
<title>kqueue: handle copy for netmap filters</title>
<updated>2025-10-18T05:12:36+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2025-08-23T14:42:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/freebsd-src.git/commit/?id=7a72e88781ae294aae6b97e1972cb19b2a670412'/>
<id>7a72e88781ae294aae6b97e1972cb19b2a670412</id>
<content type='text'>
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:  https://reviews.freebsd.org/D52045
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:  https://reviews.freebsd.org/D52045
</pre>
</div>
</content>
</entry>
<entry>
<title>netmap: Fix error handling in nm_os_extmem_create()</title>
<updated>2025-10-17T12:55:17+00:00</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2025-10-17T12:55:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/freebsd-src.git/commit/?id=dfc1041c08ba32f24b8050b4d635a0bbbfd9b767'/>
<id>dfc1041c08ba32f24b8050b4d635a0bbbfd9b767</id>
<content type='text'>
We bump the object reference count prior to mapping it into the kernel
map, at which point the vm_map_entry owns the reference.  Then, if
vm_map_wire() fails, vm_map_remove() will release the reference, so we
should avoid decrementing it in the error path.

Reported by:	Ilja van Sprundel &lt;ivansprundel@ioactive.com&gt;
Reviewed by:	vmaffione
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53066
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We bump the object reference count prior to mapping it into the kernel
map, at which point the vm_map_entry owns the reference.  Then, if
vm_map_wire() fails, vm_map_remove() will release the reference, so we
should avoid decrementing it in the error path.

Reported by:	Ilja van Sprundel &lt;ivansprundel@ioactive.com&gt;
Reviewed by:	vmaffione
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53066
</pre>
</div>
</content>
</entry>
<entry>
<title>vtnet, ptnet: include opt_*.h files early</title>
<updated>2025-08-21T15:18:07+00:00</updated>
<author>
<name>Michael Tuexen</name>
<email>tuexen@FreeBSD.org</email>
</author>
<published>2025-08-21T15:18:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/freebsd-src.git/commit/?id=3077532b1bb2911d3012ee90bae9d9499c960569'/>
<id>3077532b1bb2911d3012ee90bae9d9499c960569</id>
<content type='text'>
Include opt_inet.h and opt_inet6.h early in the files including
virtio_net.h, since they use INET and/or INET6.
While there, remove redundant inclusion of sys/types.h, since it is
included already by sys/param.h.

There was a discussion to include opt_inet.h and opt_inet6.h also
in virtio_net.h. glebius suggested to add a mechanism for files
to check, if required opt_*.h files were included. virtio_net.h
will be the first consumer of this mechanism.

Reviewed by:		glebius, Peter Lei
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52046
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Include opt_inet.h and opt_inet6.h early in the files including
virtio_net.h, since they use INET and/or INET6.
While there, remove redundant inclusion of sys/types.h, since it is
included already by sys/param.h.

There was a discussion to include opt_inet.h and opt_inet6.h also
in virtio_net.h. glebius suggested to add a mechanism for files
to check, if required opt_*.h files were included. virtio_net.h
will be the first consumer of this mechanism.

Reviewed by:		glebius, Peter Lei
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52046
</pre>
</div>
</content>
</entry>
<entry>
<title>netmap: Add a cdev_pg_path hook that returns the name of the cdev</title>
<updated>2025-03-27T20:45:06+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2025-03-27T20:45:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/freebsd-src.git/commit/?id=7a5b9c4abcf24856b0a9bd2517373ada261ef943'/>
<id>7a5b9c4abcf24856b0a9bd2517373ada261ef943</id>
<content type='text'>
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D49337
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D49337
</pre>
</div>
</content>
</entry>
<entry>
<title>kern: Make fileops and filterops tables const where possible</title>
<updated>2024-11-26T21:04:21+00:00</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2024-11-25T22:39:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/freebsd-src.git/commit/?id=ef9ffb8594eee294334ced627755bf5b46b48f9f'/>
<id>ef9ffb8594eee294334ced627755bf5b46b48f9f</id>
<content type='text'>
No functional change intended.

MFC after:	1 week
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No functional change intended.

MFC after:	1 week
</pre>
</div>
</content>
</entry>
<entry>
<title>netmap: Make memory pools NUMA-aware</title>
<updated>2024-10-14T13:33:33+00:00</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2024-10-14T13:30:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/freebsd-src.git/commit/?id=1bae9dc584272dd75dc4e04cb5d73be0e9fb562a'/>
<id>1bae9dc584272dd75dc4e04cb5d73be0e9fb562a</id>
<content type='text'>
Each netmap adapter associated with a physical adapter is attached to a
netmap memory pool.  contigmalloc() is used to allocate physically
contiguous memory for the pool, but ideally we would ensure that all
such memory is allocated from the NUMA domain local to the adapter.

Augment netmap's memory pools with a NUMA domain ID, similar to how
IOMMU groups are handled in the Linux port.  That is, when attaching to
a physical adapter, ensure that the associated memory pools are local to
the adapter's associated memory domain, creating new pools as needed.

Some types of ifnets do not have any defined NUMA affinity; in this case
the domain ID in question is the sentinel value -1.

Add a sysctl, dev.netmap.port_numa_affinity, which can be used to enable
the new behaviour.  Keep it disabled by now to avoid surprises in case
netmap applications are relying on zero-copy optimizations to forward
packets between ports belonging to different NUMA domains.

Reviewed by:	vmaffione
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D46666
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Each netmap adapter associated with a physical adapter is attached to a
netmap memory pool.  contigmalloc() is used to allocate physically
contiguous memory for the pool, but ideally we would ensure that all
such memory is allocated from the NUMA domain local to the adapter.

Augment netmap's memory pools with a NUMA domain ID, similar to how
IOMMU groups are handled in the Linux port.  That is, when attaching to
a physical adapter, ensure that the associated memory pools are local to
the adapter's associated memory domain, creating new pools as needed.

Some types of ifnets do not have any defined NUMA affinity; in this case
the domain ID in question is the sentinel value -1.

Add a sysctl, dev.netmap.port_numa_affinity, which can be used to enable
the new behaviour.  Keep it disabled by now to avoid surprises in case
netmap applications are relying on zero-copy optimizations to forward
packets between ports belonging to different NUMA domains.

Reviewed by:	vmaffione
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D46666
</pre>
</div>
</content>
</entry>
<entry>
<title>netmap: Make the memory ops function pointer table const</title>
<updated>2024-09-19T09:56:30+00:00</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2024-09-19T09:56:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/freebsd-src.git/commit/?id=1ae4951ba7bb203d9a29892792960f0869759d35'/>
<id>1ae4951ba7bb203d9a29892792960f0869759d35</id>
<content type='text'>
No functional change intended.

Reviewed by:	vmaffione
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D46664
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No functional change intended.

Reviewed by:	vmaffione
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D46664
</pre>
</div>
</content>
</entry>
<entry>
<title>Deprecate contigfree(9) in favour of free(9)</title>
<updated>2024-07-26T10:45:01+00:00</updated>
<author>
<name>Bjoern A. Zeeb</name>
<email>bz@FreeBSD.org</email>
</author>
<published>2024-07-23T19:21:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/freebsd-src.git/commit/?id=d1bdc2821fcd416ab9b238580386eb605a6128d0'/>
<id>d1bdc2821fcd416ab9b238580386eb605a6128d0</id>
<content type='text'>
As of 9e6544dd6e02c46b805d11ab925c4f3b18ad7a4b contigfree(9) is no longer
needed and should not be used anymore.  We leave a wrapper for 3rd party
code in at least 15.x but remove (almost) all other cases from the tree.

This leaves one use of contigfree(9) untouched; that was the original
trigger for 9e6544dd6e02 and is handled in D45813 (to be committed
seperately later).

Sponsored by:	The FreeBSD Foundation
Reviewed by:	markj, kib
Tested by:	pho (10h stress test run)
Differential Revision: https://reviews.freebsd.org/D46099
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As of 9e6544dd6e02c46b805d11ab925c4f3b18ad7a4b contigfree(9) is no longer
needed and should not be used anymore.  We leave a wrapper for 3rd party
code in at least 15.x but remove (almost) all other cases from the tree.

This leaves one use of contigfree(9) untouched; that was the original
trigger for 9e6544dd6e02 and is handled in D45813 (to be committed
seperately later).

Sponsored by:	The FreeBSD Foundation
Reviewed by:	markj, kib
Tested by:	pho (10h stress test run)
Differential Revision: https://reviews.freebsd.org/D46099
</pre>
</div>
</content>
</entry>
</feed>
