From nobody Mon Jul 22 04:06:25 2024 X-Original-To: dev-commits-src-main@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 4WS6Cj1vt0z5RF8X; Mon, 22 Jul 2024 04:06:25 +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 4WS6Cj1BZhz440R; Mon, 22 Jul 2024 04:06:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721621185; 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=ztkNl83e26drTvdQG6cEuQkot2tb886xMS25doQ0EZw=; b=TooCiyNB6rJuPkNFy8itNBsLZutWPivB7Slv77x5G8J4ojtdO0X+Al4vT5xe0CzfPT4cUn v65Kdi74E/XHy1zMnCeXRSQyxAdSw5x4XPN36pw/gge4nnHZr0pqq3wATvtp7N4/HDutLN FtIWxTvLP9jeyVJwojhY639Nfo8b0l+7IC+bhYLSnfvdDLtpiy+12s65Rta98Z4kmQbDdS sUDrpDQfbPIxKP8c8HJEwTpJcgmu1/hcWnadx9SWDn+KvDrcV25CUFjxiKADqB8XSUf4C/ v4D9MbUU0T99ft4jGre9wducA2iQUZeAziyIcsQru+Rsb1B/OwpgZZ2rVtlJ2w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721621185; a=rsa-sha256; cv=none; b=U+hlW6I0f+IjHPUDq2D7xATqFmplxoAHtEgpMlmWAnlCjZrfjmhqNNu7SkiZk6fNOtlfAz YQ2RXjbnbyC5/GCrKscrJeZG7+tmvABgmuE6zjBdZmxsF6gqR6rHdLsRi3O5i3oP7SSZX2 1wT0zEvVq1BEKbbNv4aVsgoB/V5gQU3UipL5UPba3AeGJ8sPyqNdRCrF4DM5Ogg11Eub9O 1BCMrrYYiXABDIKNHGSUpb9gs2Rpydnj6F6vPBjCv+YmSVHmBVacyFAzjkJ8+2YqaIC2wU kv2nGsnTf2wXi171KzB8yu47Tzlg7C1zzQcSNNZCGb/8d51lPuBoAkWFPWsw9Q== 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=1721621185; 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=ztkNl83e26drTvdQG6cEuQkot2tb886xMS25doQ0EZw=; b=AitsB/yHRl5bBIN+cwMfzYK/6SJ3uozhmzba7hH0bhs+HenHj7MfzcKKLp4loufLWtGW94 zvcmZMc35QqEHOxA5B8l3tyjOn+rXgVVSEJCirAILFPglamPxksTsxMHN/i8c0Fk5AJr9U BtfFhXCkQa9fO9KyU1F4Ok8ZoEkKq/TeMxOZ6uvOrjLmlXEiy9UqnsYLkUoTy/jQcYRG6X Z85Jay7H93Upbp/GpceT7qw0icJzcdKFIOEe59DBWs4ynwCsXk2xugluwqP4qWiC6/nz7y VsY+B8MVyZjIOb3pfiodoc97sLe6bfFcJVqY3CmyNRUkjiPWAsG2ml4B/DOO3g== 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 4WS6Cj0p5PzTrm; Mon, 22 Jul 2024 04:06:25 +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 46M46PHu032729; Mon, 22 Jul 2024 04:06:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46M46PYQ032726; Mon, 22 Jul 2024 04:06:25 GMT (envelope-from git) Date: Mon, 22 Jul 2024 04:06:25 GMT Message-Id: <202407220406.46M46PYQ032726@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 283333c0e329 - main - cxgbe/t4_tom: Track all synq entries in a per-adapter list. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 283333c0e329fd7aceff16fa3bf2b9892744d883 Auto-Submitted: auto-generated The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=283333c0e329fd7aceff16fa3bf2b9892744d883 commit 283333c0e329fd7aceff16fa3bf2b9892744d883 Author: Navdeep Parhar AuthorDate: 2024-07-20 19:38:42 +0000 Commit: Navdeep Parhar CommitDate: 2024-07-22 04:02:34 +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. MFC after: 1 week Sponsored by: Chelsio Communications --- 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;