The branch stable/14 has been updated by np:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fcda529bf01aa1ad2dd44c5209b92992b5531f24

commit fcda529bf01aa1ad2dd44c5209b92992b5531f24
Author:     Navdeep Parhar <n...@freebsd.org>
AuthorDate: 2024-07-20 19:38:42 +0000
Commit:     Navdeep Parhar <n...@freebsd.org>
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;

Reply via email to