From nobody Tue Mar 08 00:21:38 2022 X-Original-To: dev-commits-src-branches@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 D23B919FABCF; Tue, 8 Mar 2022 00:21:39 +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 4KCGGV4jWMz4m2C; Tue, 8 Mar 2022 00:21:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646698898; 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=hyU/Ml80GReKduMJBMOM3YlZFrREidfOLBSAN5FEY8w=; b=EBbT7Zu7zljRWndDs2+P9+32ga513+b1J09CfGbswxRrip1xBjQ87fNoGfN1myX/KGk863 Ty8QGD+H2OClZUTQwoFWkuZhGII9OtmpXbDwsl2IN0Bf2FW6vZrHQUKUTvheBNrlmyDAym fSxcMw5x+wnCU9hQxpm3zGgOJmUAOmnoo+bf96e8qXC1p7iruQodJdegiY8DpSD61QcNF1 8dONbCVkYQ0EX2IPagsAqLIFVAVtn0vWUOxDEh+77ny6NRC+2ArRaOdJaQ3m7wkG/n66sk /E1jcA18OzDz6MgI30CEMojeGe/ypJG0uT35zLo/8wXbIlPIjc69uNp36dXh6w== 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 6FC121299D; Tue, 8 Mar 2022 00:21:38 +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 2280LcV8072714; Tue, 8 Mar 2022 00:21:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2280Lcru072713; Tue, 8 Mar 2022 00:21:38 GMT (envelope-from git) Date: Tue, 8 Mar 2022 00:21:38 GMT Message-Id: <202203080021.2280Lcru072713@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: bde1cafb7c2b - stable/13 - iflib: Allow drivers to determine which queue to TX on List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bde1cafb7c2b65c111e4da33f578844bc25404cd Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646698898; 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=hyU/Ml80GReKduMJBMOM3YlZFrREidfOLBSAN5FEY8w=; b=Fs5hwXw3xRAaVmbDTvE/YrtzqLrenZ69jMKjPF8D5HLcktgJLZpS5o7zC+XjH65fFksN66 y0AChhwckuRC8Wt0jG4MxS7L3geqhu+rovy9rLBaPLD3OaaLSURcPcOIk9gbXb+g0NLHny 1rVD4CRwzco5tn0xQ2THJmfb9CXTyNDDNH7NYEDzdtRD5O4PP1GculQ2kodDLQq1Rlg/Zs 3Xno+lfPcJ10xPkFfAL3rhZA0yNftgTYli2/x8rCB3Q5p6ZmKobvZVZ5feDFoxscvqKhhc iIzFVi7RRHBkjFKj9GTjcqlgQ8AIvNF6zAxTSQk3h7YQ7pIQ8M9qmG6PaqDT/w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646698898; a=rsa-sha256; cv=none; b=nD6OKUhDYl0ymqgd85UUg79Rfx+5RXYn9+N6oHgC5qsgwlXvoDYfn4LbbizwAOeNVwai4W eFtilsWO3dlSgGEM9GhUrdGfg68sywvYx5QQqzbqcsLEnfg80N355dHdFWf0DjfuZOKVuL TEyK+7TNLolpsxuqUd6kztISclJ/03eqlLEgjDZiwil24BmD7W5sqHs15flk45Ta8pCGzJ OBp2tKOH+fkC7tLoeiR15EJermFtD3sB4mmzZ6G3UbnTKtxNO9oG+3OO+UEfsBLilHqEbq j8kungynT3M/2br7IZXNvTu9Q5AfTwGnkl/IQU9q/9bwfddT46CUbIQp6Fckxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=bde1cafb7c2b65c111e4da33f578844bc25404cd commit bde1cafb7c2b65c111e4da33f578844bc25404cd Author: Eric Joyner AuthorDate: 2021-07-29 23:24:14 +0000 Commit: Eric Joyner CommitDate: 2022-03-08 00:10:27 +0000 iflib: Allow drivers to determine which queue to TX on Adds a new function pointer to struct if_txrx in order to allow drivers to set their own function that will determine which queue a packet should be sent on. Since this includes a kernel ABI change, bump the __FreeBSD_version as well. (This motivation behind this is to allow the driver to examine the UP in the VLAN tag and determine which queue to TX on based on that, in support of HW TX traffic shaping.) Signed-off-by: Eric Joyner Reviewed by: kbowling@, stallamr@netapp.com Tested by: jeffrey.e.pieper@intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D31485 (cherry picked from commit 213e91399b7998554d787bb290109ebe602aa279) --- sys/net/iflib.c | 12 ++++++++---- sys/net/iflib.h | 11 +++++++++++ sys/sys/param.h | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 81cb66738454..aba3baaa1e50 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -209,6 +209,7 @@ struct iflib_ctx { #define isc_rxd_refill ifc_txrx.ift_rxd_refill #define isc_rxd_flush ifc_txrx.ift_rxd_flush #define isc_legacy_intr ifc_txrx.ift_legacy_intr +#define isc_txq_select ifc_txrx.ift_txq_select eventhandler_tag ifc_vlan_attach_event; eventhandler_tag ifc_vlan_detach_event; struct ether_addr ifc_mac; @@ -4127,11 +4128,14 @@ iflib_if_transmit(if_t ifp, struct mbuf *m) MPASS(m->m_nextpkt == NULL); /* ALTQ-enabled interfaces always use queue 0. */ qidx = 0; - if ((NTXQSETS(ctx) > 1) && M_HASHTYPE_GET(m) && !ALTQ_IS_ENABLED(&ifp->if_snd)) + /* Use driver-supplied queue selection method if it exists */ + if (ctx->isc_txq_select) + qidx = ctx->isc_txq_select(ctx->ifc_softc, m); + /* If not, use iflib's standard method */ + else if ((NTXQSETS(ctx) > 1) && M_HASHTYPE_GET(m) && !ALTQ_IS_ENABLED(&ifp->if_snd)) qidx = QIDX(ctx, m); - /* - * XXX calculate buf_ring based on flowid (divvy up bits?) - */ + + /* Set TX queue */ txq = &ctx->ifc_txqs[qidx]; #ifdef DRIVER_BACKPRESSURE diff --git a/sys/net/iflib.h b/sys/net/iflib.h index fcf96215d398..42cab766a2fa 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -187,6 +187,7 @@ typedef struct if_txrx { void (*ift_rxd_refill) (void * , if_rxd_update_t iru); void (*ift_rxd_flush) (void *, uint16_t qsidx, uint8_t flidx, qidx_t pidx); int (*ift_legacy_intr) (void *); + qidx_t (*ift_txq_select) (void *, struct mbuf *); } *if_txrx_t; typedef struct if_softc_ctx { @@ -396,6 +397,16 @@ typedef enum { */ #define IFLIB_PSEUDO_ETHER 0x80000 +/* The following IFLIB_FEATURE_* defines are for driver modules to determine + * what features this version of iflib supports. They shall be defined to the + * first __FreeBSD_version that introduced the feature. + */ +/* + * Driver can set its own TX queue selection function + * as ift_txq_select in struct if_txrx + */ +#define IFLIB_FEATURE_QUEUE_SELECT 1300527 + /* * These enum values are used in iflib_needs_restart to indicate to iflib * functions whether or not the interface needs restarting when certain events diff --git a/sys/sys/param.h b/sys/sys/param.h index 86ad3d3a4cfc..1d2f1154e655 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300526 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300527 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,