From nobody Mon Oct 21 18:39:05 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 4XXPGf0VbSz5Zcqf; Mon, 21 Oct 2024 18:39:06 +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 4XXPGd5Vn2z4Fck; Mon, 21 Oct 2024 18:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535945; 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=purmNPisT3LcWzQShj8z5zeMlzxNDyV0xefsd0yRc5g=; b=lncxcwPwTTSfoZht7Y5p7Ea1Jr3MAbm5Al7jddZACCxTdEqNHyyK9ZVtlgCGo6Vc0aJ7+M oTYModo8Abd7HG843uLh6lRxis1xW/dJ5sCuB5OEHEesTWfjLu0xGjejjbZkG6o4DZ+BHr y/+cMPaAEnlcgs3kN5NzO2tIqZnndmE3xiJdkPtlreoj+6wEqLyLo9OElJ7qtv/x+57s8L eYj1df4PcYCTECLaSWvaIbKPvxh4RseLUa3ieJP1ZQ7vXdbyaQNGXFKuJthm3pRjvohwGk 6vcNzzcusOdt/slzdSIiWOcwm3yCj967F6qrBk+qzkXjj4sHUPYuctziQmGSXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535945; 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=purmNPisT3LcWzQShj8z5zeMlzxNDyV0xefsd0yRc5g=; b=MsluKs5PU2UdWO9V8GSl/ePHczcr+LjtsgoYuaW/IZl3zXvqHcf6qAIc94yRMhRgbugEj2 zgg+ejTcJ2HDSrMNtH7nLnJKNiRXIxcsd8bQ8GKWc6h9XtqFflsngqwoxo25LsFh1eAn93 2k5Vz4DmVCyjrlmc88w/l+JwudGwAoxj2d4aoCw9QoGu5zsBK/Ewej7NFKBFBOP09Qhw3K VtERVA5D6/6SB7WZoYJaDOYZp5WOJiq2XOU9zR7lWirBYTR1KFSfEIx1hmD6iMaZxTrz5E EAWoeFzWPMDJa3wJErDpS+AzCySiClZdejV+x3xjypEwD14Tt+91KWJPDB+ENA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729535945; a=rsa-sha256; cv=none; b=wwshjIAiN/QM672528p0S5YpEG3miV8QKKzQ4FOdw1jJDIQWuJ2zFvvF/o5LytDsnG52Ht 6JKejR9pMEbfpWCGB3H1ZXE/yjWMRPgzxuoI3WK/gBmqirSNz3jsXW6QE86mRYx4uA1fe0 fxdp17Qx4/HOXDU2vTAT6vegkgTgtHsmuCQb70kO2nKr1On4YKFj0vtOY/+tC+gmlnfPJj 0ILsT2Tarv80aafWg9WHq+bdLHNPXhMNraa8Lcvd8BmO+xjZQF5H7gq7MtuQ33As5dvmDl 5vGMF06E+bWlCy2hfhel0ItUrF3WlZs2hpkVNbdVpMa0F71A86+cS3cv+KFkWQ== 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 4XXPGd5743zh5k; Mon, 21 Oct 2024 18:39:05 +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 49LId5PG035893; Mon, 21 Oct 2024 18:39:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LId5HZ035890; Mon, 21 Oct 2024 18:39:05 GMT (envelope-from git) Date: Mon, 21 Oct 2024 18:39:05 GMT Message-Id: <202410211839.49LId5HZ035890@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: e867a2503153 - stable/14 - cxgbe/t4_tom: Free up hardware resources when the final CPL is received. 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/14 X-Git-Reftype: branch X-Git-Commit: e867a25031532f3e54d61a23c6057362c66a6584 Auto-Submitted: auto-generated The branch stable/14 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=e867a25031532f3e54d61a23c6057362c66a6584 commit e867a25031532f3e54d61a23c6057362c66a6584 Author: Navdeep Parhar AuthorDate: 2024-07-16 00:39:40 +0000 Commit: Navdeep Parhar CommitDate: 2024-10-21 16:46:30 +0000 cxgbe/t4_tom: Free up hardware resources when the final CPL is received. Final CPL means the tid is done in the hardware and other resources associated with it can be freed right away. There is no need to wait for the kernel to detach the toepcb. Reviewed by: jhb MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D45991 (cherry picked from commit 27479403a764cf3b97194887a1f819c1e35357aa) --- sys/dev/cxgbe/tom/t4_tom.c | 58 +++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 10ee78681365..645822b6f781 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -97,6 +97,7 @@ static struct uld_info tom_uld_info = { }; static void release_offload_resources(struct toepcb *); +static void done_with_toepcb(struct toepcb *); static int alloc_tid_tabs(struct tid_info *); static void free_tid_tabs(struct tid_info *); static void free_tom_data(struct adapter *, struct tom_data *); @@ -311,12 +312,42 @@ release_offload_resources(struct toepcb *toep) KASSERT(!(toep->flags & TPF_CPL_PENDING), ("%s: %p has CPL pending.", __func__, toep)); - KASSERT(!(toep->flags & TPF_ATTACHED), - ("%s: %p is still attached.", __func__, toep)); CTR5(KTR_CXGBE, "%s: toep %p (tid %d, l2te %p, ce %p)", __func__, toep, tid, toep->l2te, toep->ce); + if (toep->l2te) { + t4_l2t_release(toep->l2te); + toep->l2te = NULL; + } + if (tid >= 0) { + remove_tid(sc, tid, toep->ce ? 2 : 1); + release_tid(sc, tid, toep->ctrlq); + toep->tid = -1; + } + if (toep->ce) { + t4_release_clip_entry(sc, toep->ce); + toep->ce = NULL; + } + if (toep->params.tc_idx != -1) + t4_release_cl_rl(sc, toep->vi->pi->port_id, toep->params.tc_idx); +} + +/* + * Both the driver and kernel are done with the toepcb. + */ +static void +done_with_toepcb(struct toepcb *toep) +{ + struct tom_data *td = toep->td; + + KASSERT(!(toep->flags & TPF_CPL_PENDING), + ("%s: %p has CPL pending.", __func__, toep)); + KASSERT(!(toep->flags & TPF_ATTACHED), + ("%s: %p is still attached.", __func__, toep)); + + CTR(KTR_CXGBE, "%s: toep %p (0x%x)", __func__, toep, toep->flags); + /* * These queues should have been emptied at approximately the same time * that a normal connection's socket's so_snd would have been purged or @@ -329,20 +360,9 @@ release_offload_resources(struct toepcb *toep) ddp_assert_empty(toep); #endif MPASS(TAILQ_EMPTY(&toep->aiotx_jobq)); - - if (toep->l2te) - t4_l2t_release(toep->l2te); - - if (tid >= 0) { - remove_tid(sc, tid, toep->ce ? 2 : 1); - release_tid(sc, tid, toep->ctrlq); - } - - if (toep->ce) - t4_release_clip_entry(sc, toep->ce); - - if (toep->params.tc_idx != -1) - t4_release_cl_rl(sc, toep->vi->pi->port_id, toep->params.tc_idx); + MPASS(toep->tid == -1); + MPASS(toep->l2te == NULL); + MPASS(toep->ce == NULL); mtx_lock(&td->toep_list_lock); TAILQ_REMOVE(&td->toep_list, toep, link); @@ -392,7 +412,7 @@ t4_pcb_detach(struct toedev *tod __unused, struct tcpcb *tp) toep->flags &= ~TPF_ATTACHED; if (!(toep->flags & TPF_CPL_PENDING)) - release_offload_resources(toep); + done_with_toepcb(toep); } /* @@ -988,9 +1008,9 @@ final_cpl_received(struct toepcb *toep) toep->flags &= ~(TPF_CPL_PENDING | TPF_WAITING_FOR_FINAL); mbufq_drain(&toep->ulp_pduq); mbufq_drain(&toep->ulp_pdu_reclaimq); - + release_offload_resources(toep); if (!(toep->flags & TPF_ATTACHED)) - release_offload_resources(toep); + done_with_toepcb(toep); if (!in_pcbrele_wlocked(inp)) INP_WUNLOCK(inp);