From nobody Wed Jul 17 14:24:38 2024 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 4WPJ9L4KYPz5RPwt; Wed, 17 Jul 2024 14:24:38 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WPJ9L2X86z40yb; Wed, 17 Jul 2024 14:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721226278; 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=kQb2fh1rDixI96Zg9GGlbYLEeQlLM4ePw4op492qCDo=; b=ZV1XHDrT/4FRLfeLx8Ho49dV4pYzwbyXjgpRFWWJF2mhZy7l2hB9wPn5y4TIC0uFz8EPJo ujZIpCpSW/SPU7SqVQpLtVaHTcbtqwqqLkFLztejr1jVt8y19bfm7cNDPx0Zol+X9tsHMu mUhivxkIzJzGccnFeTiWjpJJZgdY+aENtlLqRduNsLHLgmqp2bsqPwm9b0bpiqcJ6UFH/c 92CYuVCBEP71sk2DoxWK5gVa/m3taUHeVgsFeSiq1T3n5ZlMzQUHVL4qJUToZxFzkuksHj t3pBbeusECzwHpiYVsE2hlfUH2HdqkBnsOj8mzBaZa+UhCXSd5QtVm1XPaQ45A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721226278; a=rsa-sha256; cv=none; b=tC/mmuaopL6JjeD99ftz1L0xPW7nCCuiHhckuKWvAIEKoSaysQFRTPfj+kJWD9lw0RY9UM AGrm7lEvtzoPcOTbrHJEsUIrf8z8bdlvlGReVmFkBzki8KX7p3jdSRngt0GkITWQ/FPtvE Cuen0v0grnC8JRcIS7mhJpY4rjwA1frtbbXUPefWzP8PZoR8AcJH/jCZx23MQdmbCalin0 N9rKmYJFWQs1GdIyDpkHwkMwMNkm1rjciNiT1URjwRAW1mZkD5cmI4B8rj88KcvlrQGkuV x/Twho9Rk7awZHsVV/2Y9q98Sl9Vhsk8JF9+ZypFYMaPa0kf5IHUFbAHqFwg9w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721226278; 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=kQb2fh1rDixI96Zg9GGlbYLEeQlLM4ePw4op492qCDo=; b=aABORgNjLN3+s7hfV/fTc6mwbIH5Z2MUblUB+kZiQrf5SuWzVLtuTDKIfjRCwXO8LeKkbn fcsgRkjYA5gKBfYxSQHXLauPWhHxuXo6KPcfYLk0oxp7FyjSSh9pJqelfvE2m8Zq/lCCsp HqxAN+AnNQmt8B5QcqHIbkrgh68oK3fktfiyRLj6WAmBcKiLJn6ao5LXFLpNyCRIa8s7fj wFefYcwX495uSua0Vy+DTqfQyi1vkyxmQyupjKz5cJKqXZ9+qGEc6OjmJBs/QlNCs4U+MU 0m+GIPjj7YyQRGbkX7St7trEUdKcfsqunVwNzAhK1mTyU4QZxA0XAPwPe1wLyw== 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 4WPJ9L27lJz1MHm; Wed, 17 Jul 2024 14:24:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46HEOc5s033118; Wed, 17 Jul 2024 14:24:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46HEOcH9033115; Wed, 17 Jul 2024 14:24:38 GMT (envelope-from git) Date: Wed, 17 Jul 2024 14:24:38 GMT Message-Id: <202407171424.46HEOcH9033115@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: b52a25051796 - stable/13 - cxgbe(4): Allocate a taskqueue per port instead of per channel. 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: b52a25051796a930b2eb8985180744bb676df928 Auto-Submitted: auto-generated The branch stable/13 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=b52a25051796a930b2eb8985180744bb676df928 commit b52a25051796a930b2eb8985180744bb676df928 Author: Navdeep Parhar AuthorDate: 2024-04-30 17:51:45 +0000 Commit: Navdeep Parhar CommitDate: 2024-07-17 07:14:27 +0000 cxgbe(4): Allocate a taskqueue per port instead of per channel. All the channels are not used on all boards and there's no point allocating taskqueues that will never be used. Sponsored by: Chelsio Communications (cherry picked from commit 857d74b6340e418396d79a46b264ce0eedd760e4) --- sys/dev/cxgbe/adapter.h | 3 ++- sys/dev/cxgbe/t4_main.c | 7 +++++-- sys/dev/cxgbe/t4_sge.c | 19 ++++++++++--------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 648182fe31c4..8d70e840d3f2 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -475,6 +475,7 @@ struct sge_eq { unsigned int abs_id; /* absolute SGE id for the eq */ uint8_t type; /* EQ_CTRL/EQ_ETH/EQ_OFLD */ uint8_t doorbells; + uint8_t port_id; /* port_id of the port associated with the eq */ uint8_t tx_chan; /* tx channel used by the eq */ struct mtx eq_lock; @@ -930,7 +931,7 @@ struct adapter { int nrawf; u_int vlan_id; - struct taskqueue *tq[MAX_NCHAN]; /* General purpose taskqueues */ + struct taskqueue *tq[MAX_NPORTS]; /* General purpose taskqueues */ struct port_info *port[MAX_NPORTS]; uint8_t chan_map[MAX_NCHAN]; /* channel -> port */ diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index dd7552a50e4f..8895e22d18ac 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -6745,7 +6745,8 @@ adapter_full_init(struct adapter *sc) if (rc != 0) return (rc); - for (i = 0; i < nitems(sc->tq); i++) { + MPASS(sc->params.nports <= nitems(sc->tq)); + for (i = 0; i < sc->params.nports; i++) { if (sc->tq[i] != NULL) continue; sc->tq[i] = taskqueue_create("t4 taskq", M_NOWAIT, @@ -6794,7 +6795,9 @@ adapter_full_uninit(struct adapter *sc) t4_teardown_adapter_queues(sc); - for (i = 0; i < nitems(sc->tq) && sc->tq[i]; i++) { + for (i = 0; i < nitems(sc->tq); i++) { + if (sc->tq[i] == NULL) + continue; taskqueue_free(sc->tq[i]); sc->tq[i] = NULL; } diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 93f914c3e2c5..cc8a0cc652b2 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -3462,13 +3462,14 @@ init_fl(struct adapter *sc, struct sge_fl *fl, int qsize, int maxp, char *name) static inline void init_eq(struct adapter *sc, struct sge_eq *eq, int eqtype, int qsize, - uint8_t tx_chan, struct sge_iq *iq, char *name) + uint8_t port_id, struct sge_iq *iq, char *name) { KASSERT(eqtype >= EQ_CTRL && eqtype <= EQ_OFLD, ("%s: bad qtype %d", __func__, eqtype)); eq->type = eqtype; - eq->tx_chan = tx_chan; + eq->port_id = port_id; + eq->tx_chan = sc->port[port_id]->tx_chan; eq->iq = iq; eq->sidx = qsize - sc->params.sge.spg_len / EQ_ESIZE; strlcpy(eq->lockname, name, sizeof(eq->lockname)); @@ -3909,8 +3910,8 @@ alloc_ctrlq(struct adapter *sc, int idx) snprintf(name, sizeof(name), "%s ctrlq%d", device_get_nameunit(sc->dev), idx); - init_eq(sc, &ctrlq->eq, EQ_CTRL, CTRL_EQ_QSIZE, - sc->port[idx]->tx_chan, &sc->sge.fwq, name); + init_eq(sc, &ctrlq->eq, EQ_CTRL, CTRL_EQ_QSIZE, idx, + &sc->sge.fwq, name); rc = alloc_wrq(sc, NULL, ctrlq, &sc->ctx, oid); if (rc != 0) { CH_ERR(sc, "failed to allocate ctrlq%d: %d\n", idx, rc); @@ -4656,7 +4657,7 @@ alloc_txq(struct vi_info *vi, struct sge_txq *txq, int idx) iqidx = vi->first_rxq + (idx % vi->nrxq); snprintf(name, sizeof(name), "%s txq%d", device_get_nameunit(vi->dev), idx); - init_eq(sc, &txq->eq, EQ_ETH, vi->qsize_txq, pi->tx_chan, + init_eq(sc, &txq->eq, EQ_ETH, vi->qsize_txq, pi->port_id, &sc->sge.rxq[iqidx].iq, name); rc = mp_ring_alloc(&txq->r, eq->sidx, txq, eth_tx, @@ -4873,11 +4874,11 @@ alloc_ofld_txq(struct vi_info *vi, struct sge_ofld_txq *ofld_txq, int idx) device_get_nameunit(vi->dev), idx); if (vi->nofldrxq > 0) { iqidx = vi->first_ofld_rxq + (idx % vi->nofldrxq); - init_eq(sc, eq, EQ_OFLD, vi->qsize_txq, pi->tx_chan, + init_eq(sc, eq, EQ_OFLD, vi->qsize_txq, pi->port_id, &sc->sge.ofld_rxq[iqidx].iq, name); } else { iqidx = vi->first_rxq + (idx % vi->nrxq); - init_eq(sc, eq, EQ_OFLD, vi->qsize_txq, pi->tx_chan, + init_eq(sc, eq, EQ_OFLD, vi->qsize_txq, pi->port_id, &sc->sge.rxq[iqidx].iq, name); } @@ -6392,7 +6393,7 @@ handle_wrq_egr_update(struct adapter *sc, struct sge_eq *eq) struct sge_wrq *wrq = (void *)eq; atomic_readandclear_int(&eq->equiq); - taskqueue_enqueue(sc->tq[eq->tx_chan], &wrq->wrq_tx_task); + taskqueue_enqueue(sc->tq[eq->port_id], &wrq->wrq_tx_task); } static void @@ -6404,7 +6405,7 @@ handle_eth_egr_update(struct adapter *sc, struct sge_eq *eq) atomic_readandclear_int(&eq->equiq); if (mp_ring_is_idle(txq->r)) - taskqueue_enqueue(sc->tq[eq->tx_chan], &txq->tx_reclaim_task); + taskqueue_enqueue(sc->tq[eq->port_id], &txq->tx_reclaim_task); else mp_ring_check_drainage(txq->r, 64); }