From nobody Tue Jan 25 02:25:00 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 6FB33198F72A; Tue, 25 Jan 2022 02:25:00 +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 4JjW0D2gLPz3Gdh; Tue, 25 Jan 2022 02:25:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643077500; 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=O1uZwYqADEQk+EX2Fo9BA48ifACCa7mOrzlSK8DxHrw=; b=gj+ahdnGfMMKIagkI6Iat6IS3GO+ZxMgZWFLj7nNBBguiKl5soM/+2vVpxMC019ay/NHpm th46Gx3HZKSKVz+9zmaVuSUlfV67VPnZ6cMVXaqwUYt/iFZ1s10v361f2I0QX3YrzpfYKc PnbGh8cHRS2pkINOwNaKqbGo3156E7n/tM54uYDs6EvvUABxxzvKUK64F+B5wDpWTw5R8F WItoUFr5be/XQoTTDaDAQgKLLeMLzmXnOhw4SmR8AmK8wi6+ZJSBGVNbedxkrBbt7x+wXN QRnJ3rBSNkhOJlv8xn+RWafzsSSqheTWsNAjSrhkxHcUdyowCSkElEesI2AtUg== 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 3B5B4215B9; Tue, 25 Jan 2022 02:25:00 +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 20P2P0Ka009599; Tue, 25 Jan 2022 02:25:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20P2P0Gj009598; Tue, 25 Jan 2022 02:25:00 GMT (envelope-from git) Date: Tue, 25 Jan 2022 02:25:00 GMT Message-Id: <202201250225.20P2P0Gj009598@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric Joyner Subject: git: 213e91399b79 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 213e91399b7998554d787bb290109ebe602aa279 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643077500; 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=O1uZwYqADEQk+EX2Fo9BA48ifACCa7mOrzlSK8DxHrw=; b=P+waQ4xOwlNFa0sFw9xy61EAuKjPVilTViv1Vi4jd4T9wHgdhALRi2fco+D5Vqzxz1yZhS PRtStfiqwQixWYyFWhPn2QoyFO1+WvdGZO2CbAZLqwHL7EJ+2wXb+35Y4XXRIahU9Ok+zr /CYznmTy2+54y2XM6GSRRflU7nIEQVVW4RNNEDRTDyrq/S9DrqbNO7CL3zkuU5gy99+egF 4qE1tC5Rzzn0ET5XEp/SR1vGjh4OshXoGqF2Chk54VYvHqXvhg/Rf/IPQTSznqj9ZBGQYD KmMU24Ji6al4/2psWGjSrSdu5m5p4h5rxRU2B8objPT7+5qXaeHd/Dz9AXIxqg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643077500; a=rsa-sha256; cv=none; b=xo7MI0E4xNAFFH0+/+3C2V88rYO7urHHiR1qkjoor+y7SPjtNAde0bPU5H4o996qrj+oBM QEJOprMju6NdKw7B6cHj4SikMs9VPJq3IkdrMAljO64cRK6/WWdDxhG9KIfgNVJaTvV6GO yhQdDKBt1hAKAahhgpP4rjf/zVAEx5XRUgM/RVJvF+4GVuElDII/3box/ZWTPkbDnPMAZ9 91/CKgeZnEs+bVRpDy2gwe/AFAMm0g8cPRoOrnel95tL8znUJJEGs5KJ5HokerUXSgzaaA e7tvMKRjp14JcefVb1aJ7EpfGrJowfItkFgR47L7BSB9gB3O63uCHBOTsCW7XA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=213e91399b7998554d787bb290109ebe602aa279 commit 213e91399b7998554d787bb290109ebe602aa279 Author: Eric Joyner AuthorDate: 2021-07-29 23:24:14 +0000 Commit: Eric Joyner CommitDate: 2022-01-25 02:22:02 +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 --- sys/net/iflib.c | 12 ++++++++---- sys/net/iflib.h | 12 +++++++++++- sys/sys/param.h | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 88027a6dc283..2971a22d799e 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; @@ -4153,11 +4154,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 b6dcf6311d2b..be858a262706 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 { @@ -397,7 +398,6 @@ typedef enum { * emulating ethernet */ #define IFLIB_PSEUDO_ETHER 0x80000 - /* * Interface has an admin completion queue */ @@ -407,6 +407,16 @@ typedef enum { */ #define IFLIB_PRESERVE_TX_INDICES 0x200000 +/* 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 1400050 + /* * 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 b6a28f9f7d72..864007a98791 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400049 +#define __FreeBSD_version 1400050 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,