From nobody Mon Oct 21 18:39:12 2024 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 4XXPGn09S4z5Zctc; Mon, 21 Oct 2024 18:39:13 +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 4XXPGm4T5zz4FpQ; Mon, 21 Oct 2024 18:39:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535952; 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=ZwwZQSxoqXf4+ZRVjxVbs+YrudIQ5vcx0xkYUtSxhHk=; b=oZL8GbnDASkc7ShA+Ae6U12H0OBeH+FKoPMWNOQtaoShHe4LHEeeiHL2XQdRLRYrkxxMcV h/UMX32Dm+gb2GwRGvdLtRtSIyz4mx0zmLjJHqaKQiMyVknOg+dJd8rnUBogsQa3+vXQwH zarcL4MDrplFkEeKjDMuAvVSBfKsK+R9Vv+w+XgqBlTeLQbGzZXDwPu6gKzkH/f8JKIfna QpwNa+F3u6HGeiFJIc0Yx8R6AKp0LKXS8x3n0H85kdrXfA84FV6k1p+VqHf6YPvhU8MLkj nXkpSeKNdBzOgavSKwRWAdPrkvpSLN6Up6tl1ZmtCPRqLgxoSIJ8Hdur9detcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535952; 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=ZwwZQSxoqXf4+ZRVjxVbs+YrudIQ5vcx0xkYUtSxhHk=; b=VSYe5sJHd2GsCk85wDc3LXW3+3qdSUsmDc8UZR1IhoXr5hosCRfCNenfapbZA+Hay+9Mnu AjtB9ajonF7DDvCmlNtHEmr+rNmvu2aINsNdQYjSnHtCUXCqUQa9u2Geh0rvCP6hy8sv1k VPgDegD3IiDMTeZyJVaETO1stUUhC2XpuRZhvkXA61RKjbnJoA75IGt9zKcFyIR2HtOHun IfhYNOCcjwJpQNYTb6i89frHw9yoAR0e6SlOkjZoeFmWh8DMJ6bqdN+3eWeTPTLH14TU7E IwqTAbUWjcMK4SJKp4GfwSI9q7pIkVI//3in96uEACW3zKbrN0bGLV+co0w7Xw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729535952; a=rsa-sha256; cv=none; b=IDph2D2E+UK4LYb7lvGbzBkHBQqsX1obEmo/M/fscovqJOPNALlfRlBvH5aqNKjuXU9Dqh c7G/H2sSbKRu1kVHk2ckkAqkj7Zfb2geMDadTgyny/U24kAznnNApLpsLUyaPei4p29Iv6 cOEOcJwxCAMb8Q6TtQ0oRsU8PaWoQ7rdwNAHfAUCM+4scUr1Pjp9MrksRjtQXDzrKEXEEg cmw0kG9Dkw0spxjHyIagENr8nOcs87UUJIA4ojQ3Zo2McEXdht4ijLBhx327mHy9bc89R2 IaNekbdqMYm7B8zGH5rS0c97K8Y/YnWI0fOvgEnxGZJ5Oy6q5z8gGvv4y9bEvw== 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 4XXPGm44gmzhQP; Mon, 21 Oct 2024 18:39:12 +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 49LIdCNo036252; Mon, 21 Oct 2024 18:39:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LIdCpJ036249; Mon, 21 Oct 2024 18:39:12 GMT (envelope-from git) Date: Mon, 21 Oct 2024 18:39:12 GMT Message-Id: <202410211839.49LIdCpJ036249@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: fcda529bf01a - stable/14 - cxgbe/t4_tom: Track all synq entries in a per-adapter list. 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: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-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/14 X-Git-Reftype: branch X-Git-Commit: fcda529bf01aa1ad2dd44c5209b92992b5531f24 Auto-Submitted: auto-generated The branch stable/14 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=fcda529bf01aa1ad2dd44c5209b92992b5531f24 commit fcda529bf01aa1ad2dd44c5209b92992b5531f24 Author: Navdeep Parhar AuthorDate: 2024-07-20 19:38:42 +0000 Commit: Navdeep Parhar CommitDate: 2024-10-21 17:02:37 +0000 cxgbe/t4_tom: Track all synq entries in a per-adapter list. Live tid entries in tid_tab are either full fledged connections or synq entries. toep_list tracks the connections already and this change adds a synqe_list to track the synq entries. These two lists can be used to enumerate and iterate over all live tids. Sponsored by: Chelsio Communications (cherry picked from commit 283333c0e329fd7aceff16fa3bf2b9892744d883) --- sys/dev/cxgbe/tom/t4_listen.c | 12 ++++++++++++ sys/dev/cxgbe/tom/t4_tom.c | 2 ++ sys/dev/cxgbe/tom/t4_tom.h | 2 ++ 3 files changed, 16 insertions(+) diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index d25c161d3f8d..6e8361734db7 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -849,6 +849,7 @@ do_close_server_rpl(struct sge_iq *iq, const struct rss_header *rss, static void done_with_synqe(struct adapter *sc, struct synq_entry *synqe) { + struct tom_data *td = sc->tom_softc; struct listen_ctx *lctx = synqe->lctx; struct inpcb *inp = lctx->inp; struct l2t_entry *e = &sc->l2t->l2tab[synqe->params.l2t_idx]; @@ -858,6 +859,9 @@ done_with_synqe(struct adapter *sc, struct synq_entry *synqe) ntids = inp->inp_vflag & INP_IPV6 ? 2 : 1; remove_tid(sc, synqe->tid, ntids); + mtx_lock(&td->toep_list_lock); + TAILQ_REMOVE(&td->synqe_list, synqe, link); + mtx_unlock(&td->toep_list_lock); release_tid(sc, synqe->tid, lctx->ctrlq); t4_l2t_release(e); inp = release_synqe(sc, synqe); @@ -961,6 +965,7 @@ void t4_offload_socket(struct toedev *tod, void *arg, struct socket *so) { struct adapter *sc = tod->tod_softc; + struct tom_data *td = sc->tom_softc; struct synq_entry *synqe = arg; struct inpcb *inp = sotoinpcb(so); struct toepcb *toep = synqe->toep; @@ -976,6 +981,9 @@ t4_offload_socket(struct toedev *tod, void *arg, struct socket *so) toep->flags |= TPF_CPL_PENDING; update_tid(sc, synqe->tid, toep); synqe->flags |= TPF_SYNQE_EXPANDED; + mtx_lock(&td->toep_list_lock); + TAILQ_REMOVE(&td->synqe_list, synqe, link); + mtx_unlock(&td->toep_list_lock); inp->inp_flowtype = (inp->inp_vflag & INP_IPV6) ? M_HASHTYPE_RSS_TCP_IPV6 : M_HASHTYPE_RSS_TCP_IPV4; inp->inp_flowid = synqe->rss_hash; @@ -1177,6 +1185,7 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) { struct adapter *sc = iq->adapter; + struct tom_data *td = sc->tom_softc; struct toedev *tod; const struct cpl_pass_accept_req *cpl = mtod(m, const void *); unsigned int stid = G_PASS_OPEN_TID(be32toh(cpl->tos_stid)); @@ -1383,6 +1392,9 @@ found: REJECT_PASS_ACCEPT_REQ(true); } + mtx_lock(&td->toep_list_lock); + TAILQ_INSERT_TAIL(&td->synqe_list, synqe, link); + mtx_unlock(&td->toep_list_lock); CTR6(KTR_CXGBE, "%s: stid %u, tid %u, synqe %p, opt0 %#016lx, opt2 %#08x", __func__, stid, tid, synqe, be64toh(opt0), be32toh(opt2)); diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index f9d8dcd706b7..fb92c88aa358 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -1831,6 +1831,7 @@ t4_tom_activate(struct adapter *sc) /* List of TOE PCBs and associated lock */ mtx_init(&td->toep_list_lock, "PCB list lock", NULL, MTX_DEF); TAILQ_INIT(&td->toep_list); + TAILQ_INIT(&td->synqe_list); /* Listen context */ mtx_init(&td->lctx_hash_lock, "lctx hash lock", NULL, MTX_DEF); @@ -1915,6 +1916,7 @@ t4_tom_deactivate(struct adapter *sc) mtx_lock(&td->toep_list_lock); if (!TAILQ_EMPTY(&td->toep_list)) rc = EBUSY; + MPASS(TAILQ_EMPTY(&td->synqe_list)); mtx_unlock(&td->toep_list_lock); mtx_lock(&td->lctx_hash_lock); diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index fb74642d61f7..0bc368fe3d56 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -269,6 +269,7 @@ struct synq_entry { struct listen_ctx *lctx; /* backpointer to listen ctx */ struct mbuf *syn; int flags; /* same as toepcb's tp_flags */ + TAILQ_ENTRY(synq_entry) link; /* synqe_list */ volatile int ok_to_respond; volatile u_int refcnt; int tid; @@ -329,6 +330,7 @@ struct tom_data { /* toepcb's associated with this TOE device */ struct mtx toep_list_lock; TAILQ_HEAD(, toepcb) toep_list; + TAILQ_HEAD(, synq_entry) synqe_list; struct mtx lctx_hash_lock; LIST_HEAD(, listen_ctx) *listen_hash;