From nobody Wed Oct 19 23:23:42 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 4Mt6HL59X4z4g2fF; Wed, 19 Oct 2022 23:23:42 +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 4Mt6HL4lpQz3Vcl; Wed, 19 Oct 2022 23:23:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666221822; 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=9ksnc1FQFpDGSwU8JNOEWVPdLAxFPfLbZeBWXD/9DcI=; b=HvUhhRBDWrleGE8OP25uniKh8PQ4gNpT1EgBSrNMUVj+adJZuEKBnu+q35Mb+UsHaank+h 6FQksF1UCqDnqRaj3LR9Ei1fSrJGLnvn1X+Uvi/Oxe+yNP46uhWGkWwaiIo6LZlyiZCGL9 rvZ15Z+PZL5OcKFXFrTBXNC53RDpvtbh9ZiVwE3fhKVsQYSZhBTHNUwludS9h3ALqz7HWp PV5e8Ks84bCJFdeujlXWMqLkOxxlPb2mtYQLGurgY9LqxMSUKViRPEZKbnN0p59UIowUbQ Lwcsy/aGyMiUU7mjpSEvFRlP5dj+xSqxQG/jgYQTkrRG/pVHoZoHpV5auYj+MQ== 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 4Mt6HL3h6Czh9l; Wed, 19 Oct 2022 23:23:42 +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 29JNNgik021500; Wed, 19 Oct 2022 23:23:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29JNNgtf021499; Wed, 19 Oct 2022 23:23:42 GMT (envelope-from git) Date: Wed, 19 Oct 2022 23:23:42 GMT Message-Id: <202210192323.29JNNgtf021499@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: 6c717a28505d - stable/12 - iflib: Allow drivers to determine which queue to TX on 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: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6c717a28505d3e77a0c3780ca1f65eb85b538eb9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666221822; 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=9ksnc1FQFpDGSwU8JNOEWVPdLAxFPfLbZeBWXD/9DcI=; b=v/uhhYLatbvvuwpKZGjgkzjmfl7/X8yyeo0OzDoMzxLYFY/hHwH5E//v5sW1LcybdpohfR uDKTyRXib+DPeIBpGy78NNZwCget6gvawWR4nOvQP0bPYdBQZ+yFPUxw8lfHAOHexmwCXn gAjMeQNmpMqgf62JSAuYNBUXBcazH2j9drtau2Ba/kb4ltOJLcoJZveftI9YLu5quI7XNU gMZoz4XAZJoYHxDydJ37Sa3aHC5AiqB3lX8KHusouqeb2HxTpAW6qUYxKFkj0kCvul7ZOr WPNJ7BaKsS+M7t+mCR6cLYJaPyfJGilZT99jcbSAdgK55PXfXEfCynQZYLP8Ew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666221822; a=rsa-sha256; cv=none; b=SOj2Ue6kYty2KLN9Co1pls/uWuQvNMzRTTFw7pT/cLULplC3+r6KU3JReEYvSTpRVJtux/ JwSt8/z6ZxOqwNStp2YukM36rHdQGs/3to5Xj6zevZzGCcZyEMAOZ63Xk/tnq6Xgh0zvV3 azoCPOl2J6qfwGuTo1+8s0V3JCwYeKuWWUMCWfI4a4jubaUjQULDgjr7Gh3173HB29Z6Tc 9RwruDoSMkvRsRAQD+EnNIGAq1wI6v1+CbvFABSr/dFqLJif2xFmRjlwCyp90booaKtydr 77E8C6RSRw942Xf/zGhg8C2Cod1Q9VxMXa+zEOxkmOkhrcITwSA1G17LW7zc1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=6c717a28505d3e77a0c3780ca1f65eb85b538eb9 commit 6c717a28505d3e77a0c3780ca1f65eb85b538eb9 Author: Eric Joyner AuthorDate: 2021-07-29 23:24:14 +0000 Commit: Eric Joyner CommitDate: 2022-10-19 22:23:33 +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 | 10 ++++++++++ sys/sys/param.h | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 170e502481c8..869985857e4b 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -211,6 +211,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; uint8_t ifc_mac[ETHER_ADDR_LEN]; @@ -4147,11 +4148,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 ffbae937808c..7c1fd3703ad2 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 { @@ -391,6 +392,15 @@ 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 1203508 /* * These enum values are used in iflib_needs_restart to indicate to iflib diff --git a/sys/sys/param.h b/sys/sys/param.h index 742b91b3dc14..cb063fa347b5 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 1203507 /* Master, propagated to newvers */ +#define __FreeBSD_version 1203508 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,