git: c694122f3cfb - main - netmap: Let memory allocator parameters be settable via loader.conf
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 14 Dec 2025 15:49:43 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=c694122f3cfb7d52b882fa79086d49f45a2c7fd2
commit c694122f3cfb7d52b882fa79086d49f45a2c7fd2
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-12-14 15:47:48 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-12-14 15:47:48 +0000
netmap: Let memory allocator parameters be settable via loader.conf
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
---
sys/dev/netmap/netmap_mem2.c | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/sys/dev/netmap/netmap_mem2.c b/sys/dev/netmap/netmap_mem2.c
index d69e9305f6f0..865a663da364 100644
--- a/sys/dev/netmap/netmap_mem2.c
+++ b/sys/dev/netmap/netmap_mem2.c
@@ -628,22 +628,26 @@ static const struct netmap_mem_d nm_blueprint = {
#define STRINGIFY(x) #x
-#define DECLARE_SYSCTLS(id, name) \
- SYSBEGIN(mem2_ ## name); \
- SYSCTL_INT(_dev_netmap, OID_AUTO, name##_size, \
- CTLFLAG_RW, &nm_mem.params[id].size, 0, "Requested size of netmap " STRINGIFY(name) "s"); \
- SYSCTL_INT(_dev_netmap, OID_AUTO, name##_curr_size, \
- CTLFLAG_RD, &nm_mem.pools[id]._objsize, 0, "Current size of netmap " STRINGIFY(name) "s"); \
- SYSCTL_INT(_dev_netmap, OID_AUTO, name##_num, \
- CTLFLAG_RW, &nm_mem.params[id].num, 0, "Requested number of netmap " STRINGIFY(name) "s"); \
- SYSCTL_INT(_dev_netmap, OID_AUTO, name##_curr_num, \
- CTLFLAG_RD, &nm_mem.pools[id].objtotal, 0, "Current number of netmap " STRINGIFY(name) "s"); \
- SYSCTL_INT(_dev_netmap, OID_AUTO, priv_##name##_size, \
- CTLFLAG_RW, &netmap_min_priv_params[id].size, 0, \
+#define DECLARE_SYSCTLS(id, name) \
+ SYSBEGIN(mem2_ ## name); \
+ SYSCTL_INT(_dev_netmap, OID_AUTO, name##_size, \
+ CTLFLAG_RWTUN, &nm_mem.params[id].size, 0, \
+ "Requested size of netmap " STRINGIFY(name) "s"); \
+ SYSCTL_INT(_dev_netmap, OID_AUTO, name##_curr_size, \
+ CTLFLAG_RD, &nm_mem.pools[id]._objsize, 0, \
+ "Current size of netmap " STRINGIFY(name) "s"); \
+ SYSCTL_INT(_dev_netmap, OID_AUTO, name##_num, \
+ CTLFLAG_RWTUN, &nm_mem.params[id].num, 0, \
+ "Requested number of netmap " STRINGIFY(name) "s"); \
+ SYSCTL_INT(_dev_netmap, OID_AUTO, name##_curr_num, \
+ CTLFLAG_RD, &nm_mem.pools[id].objtotal, 0, \
+ "Current number of netmap " STRINGIFY(name) "s"); \
+ SYSCTL_INT(_dev_netmap, OID_AUTO, priv_##name##_size, \
+ CTLFLAG_RWTUN, &netmap_min_priv_params[id].size, 0, \
"Default size of private netmap " STRINGIFY(name) "s"); \
- SYSCTL_INT(_dev_netmap, OID_AUTO, priv_##name##_num, \
- CTLFLAG_RW, &netmap_min_priv_params[id].num, 0, \
- "Default number of private netmap " STRINGIFY(name) "s"); \
+ SYSCTL_INT(_dev_netmap, OID_AUTO, priv_##name##_num, \
+ CTLFLAG_RWTUN, &netmap_min_priv_params[id].num, 0, \
+ "Default number of private netmap " STRINGIFY(name) "s"); \
SYSEND
SYSCTL_DECL(_dev_netmap);