From nobody Sun Mar 20 09:07:29 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id AA36E1A2A4DE; Sun, 20 Mar 2022 09:07:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KLsMj4Dcbz3HSP; Sun, 20 Mar 2022 09:07:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647767249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LN6QZGiMudrI9EX8CQUcAnlxldxKx9+p5QzbM+h/lmY=; b=UCe3i6kO5P1w9qlcrtGog3fxYPkn/Qx+kdFb5QDLnGwl/oW5HM5dgsGtAAWHIbeyk3NTf9 59/yGlWyYCCQRXo8fN+sME4lRYuWfvl2KNevRKLvw5UbJEFV8SCt9RXnfprffyieAp6T5K oyTcn8M2R9dY8Y4r96Ql0jh1OL5h2Gog04XLEAa5ce0uo3wM/qVW71rqar6azY5gxvPWfp QGNSn0hVe2O34uMYPUPv4DYE7IuyaToWVOF5elcL6122o9FB0K/99f1UgcVgOVz2J1IGTV H0GBNM//Y19Q9fwkMPBz8sqV7e3V+Juk7maPZ9R+LXH9QcqQutZHS8/OoEBXoQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7172924784; Sun, 20 Mar 2022 09:07:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22K97Ti6029210; Sun, 20 Mar 2022 09:07:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22K97Tto029209; Sun, 20 Mar 2022 09:07:29 GMT (envelope-from git) Date: Sun, 20 Mar 2022 09:07:29 GMT Message-Id: <202203200907.22K97Tto029209@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 6e142610cef3 - stable/12 - netmap: add a tunable for the maximum number of VALE switches List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6e142610cef3c3793b7f366d606163444dbdddf3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647767249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LN6QZGiMudrI9EX8CQUcAnlxldxKx9+p5QzbM+h/lmY=; b=BRLNdjaTN8NwvcsJJFT+rbzpr97QUyQf3vzvOQHlxo2p+D1Ei7eognW9A7VMkm7ulb1xV8 jt0if3QliGCS5fX/ZCOdcjSIDZEWHIF9D+phis+lksSA0EaqX/A4P85cojPylX3vW13MMB opkOVAOECBVwUmufYae/+KtAK+GCLvst1pZ4aRrkFIbCvKxlO651jWjlMNxLqnjjl5H9OR K331L0/ZDj5lJhtlsE3k8kMZ1xQRXcTBlQV8AiMxEYb8CQuSi//l+4l+M23aTpZ2it7iZu lTLfYmB7yaxkuJJBYLJxNM69jO1C1BZncy1mt9WdZ8ddf4n9OFjRW6sCLCU46w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647767249; a=rsa-sha256; cv=none; b=lzKhMYfUl+WV+GvHq2m9/OV9z97QxaxKr2Ek3sTGhFAmBzj7EI1KkGvRl63RzQDPbRCnxr tGZ+2e1O+m/3dw7X69ZthB+zgCXObWbSZg6VZ+s2sASs42ZIH3yjhxPQt9Txmjv43I6asQ sQcntGWcLC5XG4DjDpJfmv//poWslBcG0jMu+OVXTaL/Oqwo6Kgs/EDHpm0Mqn9YmdH1g6 7jmonmPYkZKzSE7J7H9jW86Mm4MlUeCW5BCxkvx4X3mkKjTs4TPj80B2QwguIVezaJeVXT XBfVCFfYCFogBu+m3HFK6oEFoDpvfsOkX4oNDT/LGO+q6X6dIdg/TJFMpAjEeA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=6e142610cef3c3793b7f366d606163444dbdddf3 commit 6e142610cef3c3793b7f366d606163444dbdddf3 Author: Vincenzo Maffione AuthorDate: 2022-03-06 17:28:44 +0000 Commit: Vincenzo Maffione CommitDate: 2022-03-20 09:05:27 +0000 netmap: add a tunable for the maximum number of VALE switches 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) --- share/man/man4/netmap.4 | 7 ++++++- share/man/man4/vale.4 | 5 +++-- sys/dev/netmap/netmap_bdg.c | 4 ++-- sys/dev/netmap/netmap_kern.h | 4 +++- sys/dev/netmap/netmap_vale.c | 13 +++++++++---- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/share/man/man4/netmap.4 b/share/man/man4/netmap.4 index 79e707fe9cdc..e29ee1a924dd 100644 --- a/share/man/man4/netmap.4 +++ b/share/man/man4/netmap.4 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 3, 2020 +.Dd March 6, 2022 .Dt NETMAP 4 .Os .Sh NAME @@ -933,6 +933,11 @@ Batch size used when moving packets across a switch. Values above 64 generally guarantee good performance. +.It Va dev.netmap.max_bridges: 8 +Max number of +.Nm VALE +switches that can be created. This tunable can be specified +at loader time. .It Va dev.netmap.ptnet_vnet_hdr: 1 Allow ptnet devices to use virtio-net headers .El diff --git a/share/man/man4/vale.4 b/share/man/man4/vale.4 index 9128ce68e794..004a57a7e476 100644 --- a/share/man/man4/vale.4 +++ b/share/man/man4/vale.4 @@ -28,7 +28,7 @@ .\" $FreeBSD$ .\" $Id: $ .\" -.Dd February 6, 2020 +.Dd March 6, 2022 .Dt VALE 4 .Os .Sh NAME @@ -77,7 +77,8 @@ See for details on the API. .Ss LIMITS .Nm -currently supports up to 8 switches, with 254 ports per switch. +currently supports up to 254 ports per switch. The maximum +number of switches is provided by the max_bridges sysctl variable. .Sh SYSCTL VARIABLES See .Xr netmap 4 diff --git a/sys/dev/netmap/netmap_bdg.c b/sys/dev/netmap/netmap_bdg.c index 4d18859e2091..1ad540df45a9 100644 --- a/sys/dev/netmap/netmap_bdg.c +++ b/sys/dev/netmap/netmap_bdg.c @@ -1630,7 +1630,7 @@ netmap_init_bridges(void) #ifdef CONFIG_NET_NS return netmap_bns_register(); #else - nm_bridges = netmap_init_bridges2(NM_BRIDGES); + nm_bridges = netmap_init_bridges2(vale_max_bridges); if (nm_bridges == NULL) return ENOMEM; return 0; @@ -1643,6 +1643,6 @@ netmap_uninit_bridges(void) #ifdef CONFIG_NET_NS netmap_bns_unregister(); #else - netmap_uninit_bridges2(nm_bridges, NM_BRIDGES); + netmap_uninit_bridges2(nm_bridges, vale_max_bridges); #endif } diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index fd9db5842df3..297e4c25e641 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -1504,6 +1504,8 @@ int netmap_get_vale_na(struct nmreq_header *hdr, struct netmap_adapter **na, void *netmap_vale_create(const char *bdg_name, int *return_status); int netmap_vale_destroy(const char *bdg_name, void *auth_token); +extern unsigned int vale_max_bridges; + #else /* !WITH_VALE */ #define netmap_bdg_learning(_1, _2, _3, _4) 0 #define netmap_get_vale_na(_1, _2, _3, _4) 0 @@ -1551,7 +1553,7 @@ extern struct nm_bridge *nm_bridges; #define netmap_bns_get() #define netmap_bns_put(_1) #define netmap_bns_getbridges(b, n) \ - do { *b = nm_bridges; *n = NM_BRIDGES; } while (0) + do { *b = nm_bridges; *n = vale_max_bridges; } while (0) #endif /* Various prototypes */ diff --git a/sys/dev/netmap/netmap_vale.c b/sys/dev/netmap/netmap_vale.c index 50f44e410477..fc61ba49f6e8 100644 --- a/sys/dev/netmap/netmap_vale.c +++ b/sys/dev/netmap/netmap_vale.c @@ -84,10 +84,9 @@ __FBSDID("$FreeBSD$"); /* * system parameters (most of them in netmap_kern.h) - * NM_BDG_NAME prefix for switch port names, default "vale" + * NM_BDG_NAME prefix for switch port names, default "vale" * NM_BDG_MAXPORTS number of ports - * NM_BRIDGES max number of switches in the system. - * XXX should become a sysctl or tunable + * NM_BRIDGES max number of switches in the system. * * Switch ports are named valeX:Y where X is the switch name and Y * is the port. If Y matches a physical interface name, the port is @@ -115,10 +114,16 @@ __FBSDID("$FreeBSD$"); * last packet in the block may overflow the size. */ static int bridge_batch = NM_BDG_BATCH; /* bridge batch size */ + +/* Max number of vale bridges (loader tunable). */ +unsigned int vale_max_bridges = NM_BRIDGES; + SYSBEGIN(vars_vale); SYSCTL_DECL(_dev_netmap); SYSCTL_INT(_dev_netmap, OID_AUTO, bridge_batch, CTLFLAG_RW, &bridge_batch, 0, "Max batch size to be used in the bridge"); +SYSCTL_UINT(_dev_netmap, OID_AUTO, max_bridges, CTLFLAG_RDTUN, &vale_max_bridges, 0, + "Max number of vale bridges"); SYSEND; static int netmap_vale_vp_create(struct nmreq_header *hdr, struct ifnet *, @@ -364,7 +369,7 @@ netmap_vale_list(struct nmreq_header *hdr) j = req->nr_port_idx; NMG_LOCK(); - for (error = ENOENT; i < NM_BRIDGES; i++) { + for (error = ENOENT; i < vale_max_bridges; i++) { b = bridges + i; for ( ; j < NM_BDG_MAXPORTS; j++) { if (b->bdg_ports[j] == NULL)