From owner-dev-commits-src-branches@freebsd.org Mon Apr 5 08:04:21 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 613915C6324; Mon, 5 Apr 2021 08:04:21 +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 4FDNTx26czz3QLv; Mon, 5 Apr 2021 08:04:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3A1CF15416; Mon, 5 Apr 2021 08:04:21 +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 13584LrV018409; Mon, 5 Apr 2021 08:04:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13584L9G018408; Mon, 5 Apr 2021 08:04:21 GMT (envelope-from git) Date: Mon, 5 Apr 2021 08:04:21 GMT Message-Id: <202104050804.13584L9G018408@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: 75b13b151c9e - stable/13 - netmap: iflib: add nm_config callback 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/13 X-Git-Reftype: branch X-Git-Commit: 75b13b151c9e3d8fd71eab3578d4a83b067dadf6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 08:04:21 -0000 The branch stable/13 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=75b13b151c9e3d8fd71eab3578d4a83b067dadf6 commit 75b13b151c9e3d8fd71eab3578d4a83b067dadf6 Author: Vincenzo Maffione AuthorDate: 2021-03-29 09:26:12 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-05 08:04:00 +0000 netmap: iflib: add nm_config callback This per-driver callback is invoked by netmap when it wants to align the number of TX/RX netmap rings and/or the number of TX/RX netmap slots to the actual state configured in the hardware. The alignment happens when netmap mode is switched on (with no active netmap file descriptors for that netmap port), or when collecting netmap port information. MFC after: 1 week (cherry picked from commit 21d0c01226eb979556d6d792ec58eb54012fbc24) --- sys/net/iflib.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 9f3eff555728..788cc51822a1 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -829,6 +829,26 @@ iflib_netmap_register(struct netmap_adapter *na, int onoff) return (status); } +static int +iflib_netmap_config(struct netmap_adapter *na, struct nm_config_info *info) +{ + if_t ifp = na->ifp; + if_ctx_t ctx = ifp->if_softc; + iflib_rxq_t rxq = &ctx->ifc_rxqs[0]; + iflib_fl_t fl = &rxq->ifr_fl[0]; + + info->num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; + info->num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; + info->num_tx_descs = iflib_num_tx_descs(ctx); + info->num_rx_descs = iflib_num_rx_descs(ctx); + info->rx_buf_maxsize = fl->ifl_buf_size; + nm_prinf("txr %u rxr %u txd %u rxd %u rbufsz %u", + info->num_tx_rings, info->num_rx_rings, info->num_tx_descs, + info->num_rx_descs, info->rx_buf_maxsize); + + return 0; +} + static int netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init) { @@ -1279,6 +1299,7 @@ iflib_netmap_attach(if_ctx_t ctx) na.nm_rxsync = iflib_netmap_rxsync; na.nm_register = iflib_netmap_register; na.nm_intr = iflib_netmap_intr; + na.nm_config = iflib_netmap_config; na.num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; na.num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; return (netmap_attach(&na));