# \[PATCH 2/3\] net: ntb\_netdev: Make queue pair count configurable

- From: Koichiro Den \<hidden\>
- Date: 2026-02-24 15:28:19 
- List: netdev
- Page: https://ratatoskr.run/netdev/2026/02/3425075
- Thread: https://ratatoskr.run/netdev/2026/02/3425074/t.md

```text
Expose ntb_num_queues as a module parameter so users can request more
than one NTB transport queue pair.

The value is clamped to a reasonable range (1..64) to avoid unbounded
allocations. The default remains 1. Since we don't support changing the
value at runtime yet, permission is intentionally set 0444.

Signed-off-by: Koichiro Den <redacted>
---
 drivers/net/ntb_netdev.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
index d8734dfc2eee..837a2e95f06e 100644
--- a/drivers/net/ntb_netdev.c
+++ b/drivers/net/ntb_netdev.c
@@ -71,7 +71,25 @@ static unsigned int tx_start = 10;
 /* Number of descriptors still available before stop upper layer tx */
 static unsigned int tx_stop = 5;
 
+/*
+ * This is an arbitrary safety cap to avoid unbounded allocations.
+ */
+#define NTB_NETDEV_MAX_QUEUES	64
+
+static int ntb_num_queues_set(const char *val, const struct kernel_param *kp)
+{
+	return param_set_uint_minmax(val, kp, 1, NTB_NETDEV_MAX_QUEUES);
+}
+
+static const struct kernel_param_ops ntb_num_queues_ops = {
+	.set = ntb_num_queues_set,
+	.get = param_get_uint,
+};
+
 static unsigned int ntb_num_queues = 1;
+module_param_cb(ntb_num_queues, &ntb_num_queues_ops, &ntb_num_queues, 0444);
+MODULE_PARM_DESC(ntb_num_queues,
+		 "Number of NTB netdev queue pairs to use (1 by default)");
 
 struct ntb_netdev;
 
-- 
2.51.0

```
