From nobody Thu Feb 2 07:39:29 2023 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 4P6rJy4XW1z3c8xy; Thu, 2 Feb 2023 07:39:30 +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 4P6rJy22Ccz3Bws; Thu, 2 Feb 2023 07:39:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675323570; 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=AQRx0JXxEwyrd9oj7J7poLqOO6UiRgNosM9v8meRzyQ=; b=fAFk4kro/73x1b/2q3EdxqwPFzl+q6F7xDJTyLaKI6C3R5h6YsU8gIZhZ79tEyhR01kpJ/ 1UEKa1ZwCjcxksR/KaTsD8+TztEXwKoS/5fmCPq1i5gVf3UnrRjCgcnvA5yzdp421dy16b FM17dSurQeBJ8pGw/BgbNT1xbF+pTXdj2g9k867R39vemOOqXnvzqv9QR059qbVq+/KgWu CRnn91tCpEXiJZ+e9qYJAj0PD5sx2DXfcucQk275MHPwUsO4E1NoAXj+Bib6kMnyx5lwtX PpIDFmUryCKxGl1Gklhqco2d9MlzzCFZo+BgmkTrA5KmwUTj7gklP1BtXOrZTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675323570; 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=AQRx0JXxEwyrd9oj7J7poLqOO6UiRgNosM9v8meRzyQ=; b=GHg0NAahC4cHAftQKt8VrEUakXKgFkE2QDvwLHIlNgkICz47A+wW+dsH+DhJKpp6+/gqRQ v2jYMLN4kn4MIExS7Qn6NUJJN9say5BLLT+Kdt9OKgRvvfsyiwn7/CirFFV1ioEcMkJhBL a+ypCWrKsCAjRWc6L5JnnDbW+LYjes6yEXqU/PCSQHcEpPaLFOAB7X2/cvd96Ynp6Qln99 PiHwYs0tzitoZHSvFtGAk4UCp93XDJv2QcGswbUscHkbh8cqtFfPS7bQLOWe/cgf3MbgL1 6I5jpDSuIOD627/fZHfcXBX0INuOSJlSauLdEvdbam5dNTiDjxUdxNSWDAjqfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675323570; a=rsa-sha256; cv=none; b=KP6EvnAE3H/5e35136JJ57o408BWSOCwzv8P1fVrxRv+CfmS6BtQovnRFEKrM3a5Cspdtq tTWBs//wwVLk5BryZq7aO6YGZMVgtX4RulXC1A7+KZqWCooVaaR2zGcjfE71vk8x3ogr9Q 8GKeF01HSFJT/iILiyiE4feIm0mokJEIohnpJqXFA77QCW+IxuPtVzmsqQq85BbzwxCAgM Fx9Q+qz/LGShbqUOn6Ei3I5aprCRQ87GIAHCABDk2EswlSIRjVLoz+VCPfOO76Y4hnpaLJ 1VhcsyQsiojJKZbT5H4kRLcqqAdzaRlYHxP7E06TS9UmDNAkiR4C1s7CIvoLtw== 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 4P6rJx6ZtszmVK; Thu, 2 Feb 2023 07:39: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 3127dTfI061979; Thu, 2 Feb 2023 07:39:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3127dTiH061978; Thu, 2 Feb 2023 07:39:29 GMT (envelope-from git) Date: Thu, 2 Feb 2023 07:39:29 GMT Message-Id: <202302020739.3127dTiH061978@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: f9cc817c17b7 - stable/13 - cxgbe/t4_tom: Support for round-robin selection of offload queues. 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: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f9cc817c17b7663e80d5418362d2da0be2c7a2a1 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=f9cc817c17b7663e80d5418362d2da0be2c7a2a1 commit f9cc817c17b7663e80d5418362d2da0be2c7a2a1 Author: Navdeep Parhar AuthorDate: 2022-04-14 22:49:58 +0000 Commit: Navdeep Parhar CommitDate: 2023-02-02 07:13:55 +0000 cxgbe/t4_tom: Support for round-robin selection of offload queues. A COP (Connection Offload Policy) rule can now specify that the tx and/or rx queue for a new tid should be selected in a round-robin manner. There is no change in default behavior. Reviewed by: jhb@ Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D34921 (cherry picked from commit db28d4a0cd1c7a8505d6cbb3e8772b794cd55e53) --- sys/dev/cxgbe/adapter.h | 2 ++ sys/dev/cxgbe/t4_ioctl.h | 5 +++++ sys/dev/cxgbe/tom/t4_tom.c | 22 ++++++++++++++-------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index b3bffcc32b52..f59fe4e7c4e4 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -255,6 +255,8 @@ struct vi_info { struct sysctl_oid *ofld_txq_oid; uint8_t hw_addr[ETHER_ADDR_LEN]; /* factory MAC address, won't change */ + u_int txq_rr; + u_int rxq_rr; }; struct tx_ch_rl_params { diff --git a/sys/dev/cxgbe/t4_ioctl.h b/sys/dev/cxgbe/t4_ioctl.h index f3bb7d8b4aa4..3ef03f7c526c 100644 --- a/sys/dev/cxgbe/t4_ioctl.h +++ b/sys/dev/cxgbe/t4_ioctl.h @@ -376,6 +376,11 @@ enum { OPEN_TYPE_DONTCARE = 'D', }; +enum { + QUEUE_RANDOM = -1, + QUEUE_ROUNDROBIN = -2, +}; + struct offload_settings { int8_t offload; int8_t rx_coalesce; diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index b36b4b934d12..8888265dd32a 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -1217,17 +1217,23 @@ init_conn_params(struct vi_info *vi , struct offload_settings *s, cp->mtu_idx = find_best_mtu_idx(sc, inc, s); /* Tx queue for this connection. */ - if (s->txq >= 0 && s->txq < vi->nofldtxq) - cp->txq_idx = s->txq; + if (s->txq == QUEUE_RANDOM) + cp->txq_idx = arc4random(); + else if (s->txq == QUEUE_ROUNDROBIN) + cp->txq_idx = atomic_fetchadd_int(&vi->txq_rr, 1); else - cp->txq_idx = arc4random() % vi->nofldtxq; + cp->txq_idx = s->txq; + cp->txq_idx %= vi->nofldtxq; cp->txq_idx += vi->first_ofld_txq; /* Rx queue for this connection. */ - if (s->rxq >= 0 && s->rxq < vi->nofldrxq) - cp->rxq_idx = s->rxq; + if (s->rxq == QUEUE_RANDOM) + cp->rxq_idx = arc4random(); + else if (s->rxq == QUEUE_ROUNDROBIN) + cp->rxq_idx = atomic_fetchadd_int(&vi->rxq_rr, 1); else - cp->rxq_idx = arc4random() % vi->nofldrxq; + cp->rxq_idx = s->rxq; + cp->rxq_idx %= vi->nofldrxq; cp->rxq_idx += vi->first_ofld_rxq; if (SOLISTENING(so)) { @@ -1587,8 +1593,8 @@ lookup_offload_policy(struct adapter *sc, int open_type, struct mbuf *m, .ecn = -1, .ddp = -1, .tls = -1, - .txq = -1, - .rxq = -1, + .txq = QUEUE_RANDOM, + .rxq = QUEUE_RANDOM, .mss = -1, }; static const struct offload_settings disallow_offloading_settings = {