From nobody Fri Oct 3 00:04:39 2025 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 4cd86b6kbSz6BMjm; Fri, 03 Oct 2025 00:04:39 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cd86b3cMTz3sdm; Fri, 03 Oct 2025 00:04:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759449879; 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=80Tz873Dm5Pm8pjB2f2SMKc2XMyKUCEUDWSUhN9olb8=; b=LL/BNh6lznTP1wJsu45OWbWELoaCHwqxv+BT57ySnUmTMp/o8GLTmjf9dCOZGc452yQupO c7H/CukPG4z0StVTc4aOjcnOdQAnW/TEgyku8S7/q//86/utfXQotm0AHfqWZq2RLVpKF2 6PF1LoN/JfS8itAf6F81eKxmk1Q6W5/lVnGUb8ysOPTHqSun/L9DPzS2FYnQTDYAxdu4i+ k5RNB+zFaNgQv26Pvaic8ack/5qAJLwLSaVaG02b1sebttZSu7me1CFY6R0ul7zfkTFHu6 PVL0rzXIgqqJ8n2MS5I6PHr9F8zz+bDS26rO0v+H4e23ZIOz1xuSuOUH664RaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759449879; 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=80Tz873Dm5Pm8pjB2f2SMKc2XMyKUCEUDWSUhN9olb8=; b=P33XODDP6O3JVHa7WpnRi78XQSMsKNCF2cQLjAb1AxciYleVglJIHP+Ln4a11E0rVpqK51 7G7rXziGPjvqFTZBAN5S9lg93zZx8t7BqmNcZp8Z2yKETnixGJ0NoKIYFe4RinIV3ZjGWC F3VfvwaMh6SB7GOYK9aajmQYRaF54Tu0KUH8PGApRYRMiSY7R8KR4Sme8e/hOfkWPLRHcP x/uDIDKhZYIXOYncNlMbjy7vV5/jjoqRF0EosiY6Fgs4aqS2TQaXCgn6XWNdb76jHUwZmV HzE1vuH+jCk3KlaGu9GjaLzQ9N3ZLCh+fQ9E/ty2/GveCNkThVz2qCRdZa6xBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759449879; a=rsa-sha256; cv=none; b=VdpYhWSeW8fzkdm1yLNU08d4//BYJVSLBuZGYJ4K1qhBRRcilKJvEmJXtIi+JJLOwh2kTU F+vs7Z63vqCPrL1EOd5cZtREg0run1WeLD6pUruThqGpTCk7IH7AfO74sijHfVtRQ1eS0i V1X64KCpFPqCEmFMB93WkpySdc1GyDPuhZBTvlCfHs+UfrIRf7ksFYs0GmAagqkJd7uV33 J1DUE9hpJZqafG8P7hYpNI+5etn5M8TyKhvBBFCX47Q/xtWpMJBtobNmvdGhC6qtbF9Hjn 3lAQj8m/DfBJXUDytdOyCAoREDdSvrrGfQa4J2x8d5O4QqgfVHOmqK01k5AAVA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cd86b31JWzVjS; Fri, 03 Oct 2025 00:04:39 +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 59304dKA057308; Fri, 3 Oct 2025 00:04:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59304dki057305; Fri, 3 Oct 2025 00:04:39 GMT (envelope-from git) Date: Fri, 3 Oct 2025 00:04:39 GMT Message-Id: <202510030004.59304dki057305@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: daceb19407d0 - stable/15 - cxgbe: Move send_iscsi_flowc_wr to t4_tom.ko 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/15 X-Git-Reftype: branch X-Git-Commit: daceb19407d07cacd31c66150e1db46ce50a097a Auto-Submitted: auto-generated The branch stable/15 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=daceb19407d07cacd31c66150e1db46ce50a097a commit daceb19407d07cacd31c66150e1db46ce50a097a Author: John Baldwin AuthorDate: 2025-09-29 14:52:18 +0000 Commit: Navdeep Parhar CommitDate: 2025-10-02 22:09:07 +0000 cxgbe: Move send_iscsi_flowc_wr to t4_tom.ko Rename the function to send_txdataplen_max_flowc_wr to match the parameter it sets. This function will be reused by other ULP modules. Sponsored by: Chelsio Communications (cherry picked from commit 35b883ccf36521a46ba1cd959c144328cce223c5) --- sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 44 +-------------------------------------- sys/dev/cxgbe/tom/t4_tom.c | 44 +++++++++++++++++++++++++++++++++++++++ sys/dev/cxgbe/tom/t4_tom.h | 1 + 3 files changed, 46 insertions(+), 43 deletions(-) diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c index a79cc58b870c..9cdfd0fb9652 100644 --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -989,48 +989,6 @@ is_memfree(struct adapter *sc) return (true); } -/* XXXNP: move this to t4_tom. */ -static void -send_iscsi_flowc_wr(struct adapter *sc, struct toepcb *toep, int maxlen) -{ - struct wrqe *wr; - struct fw_flowc_wr *flowc; - const u_int nparams = 1; - u_int flowclen; - struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx]; - - flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval); - - wr = alloc_wrqe(roundup2(flowclen, 16), &toep->ofld_txq->wrq); - if (wr == NULL) { - /* XXX */ - panic("%s: allocation failure.", __func__); - } - flowc = wrtod(wr); - memset(flowc, 0, wr->wr_len); - - flowc->op_to_nparams = htobe32(V_FW_WR_OP(FW_FLOWC_WR) | - V_FW_FLOWC_WR_NPARAMS(nparams)); - flowc->flowid_len16 = htonl(V_FW_WR_LEN16(howmany(flowclen, 16)) | - V_FW_WR_FLOWID(toep->tid)); - - flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_TXDATAPLEN_MAX; - flowc->mnemval[0].val = htobe32(maxlen); - - KASSERT(howmany(flowclen, 16) <= MAX_OFLD_TX_SDESC_CREDITS, - ("%s: tx_credits %u too large", __func__, howmany(flowclen, 16))); - txsd->tx_credits = howmany(flowclen, 16); - txsd->plen = 0; - KASSERT(toep->tx_credits >= txsd->tx_credits && toep->txsd_avail > 0, - ("%s: not enough credits (%d)", __func__, toep->tx_credits)); - toep->tx_credits -= txsd->tx_credits; - if (__predict_false(++toep->txsd_pidx == toep->txsd_total)) - toep->txsd_pidx = 0; - toep->txsd_avail--; - - t4_wrq_tx(sc, wr); -} - static void set_ulp_mode_iscsi(struct adapter *sc, struct toepcb *toep, u_int ulp_submode) { @@ -1164,7 +1122,7 @@ icl_cxgbei_conn_handoff(struct icl_conn *ic, int fd) toep->params.ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; - send_iscsi_flowc_wr(icc->sc, toep, + send_txdataplen_max_flowc_wr(icc->sc, toep, roundup(max_iso_pdus * max_tx_pdu_len, tp->t_maxseg)); set_ulp_mode_iscsi(icc->sc, toep, icc->ulp_submode); INP_WUNLOCK(inp); diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index f6d3a31667fb..53a945f8b4cc 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -2314,6 +2314,50 @@ find_offload_adapter(struct socket *so) return (fa.sc); } +void +send_txdataplen_max_flowc_wr(struct adapter *sc, struct toepcb *toep, + int maxlen) +{ + struct wrqe *wr; + struct fw_flowc_wr *flowc; + const u_int nparams = 1; + u_int flowclen; + struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx]; + + CTR(KTR_CXGBE, "%s: tid %u maxlen=%d", __func__, toep->tid, maxlen); + + flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval); + + wr = alloc_wrqe(roundup2(flowclen, 16), &toep->ofld_txq->wrq); + if (wr == NULL) { + /* XXX */ + panic("%s: allocation failure.", __func__); + } + flowc = wrtod(wr); + memset(flowc, 0, wr->wr_len); + + flowc->op_to_nparams = htobe32(V_FW_WR_OP(FW_FLOWC_WR) | + V_FW_FLOWC_WR_NPARAMS(nparams)); + flowc->flowid_len16 = htonl(V_FW_WR_LEN16(howmany(flowclen, 16)) | + V_FW_WR_FLOWID(toep->tid)); + + flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_TXDATAPLEN_MAX; + flowc->mnemval[0].val = htobe32(maxlen); + + KASSERT(howmany(flowclen, 16) <= MAX_OFLD_TX_SDESC_CREDITS, + ("%s: tx_credits %u too large", __func__, howmany(flowclen, 16))); + txsd->tx_credits = howmany(flowclen, 16); + txsd->plen = 0; + KASSERT(toep->tx_credits >= txsd->tx_credits && toep->txsd_avail > 0, + ("%s: not enough credits (%d)", __func__, toep->tx_credits)); + toep->tx_credits -= txsd->tx_credits; + if (__predict_false(++toep->txsd_pidx == toep->txsd_total)) + toep->txsd_pidx = 0; + toep->txsd_avail--; + + t4_wrq_tx(sc, wr); +} + static int t4_tom_mod_load(void) { diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index a178c9b7ef5e..b8aba17c07bb 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -485,6 +485,7 @@ uint64_t select_ntuple(struct vi_info *, struct l2t_entry *); int negative_advice(int); int add_tid_to_history(struct adapter *, u_int); struct adapter *find_offload_adapter(struct socket *); +void send_txdataplen_max_flowc_wr(struct adapter *, struct toepcb *, int); void t4_pcb_detach(struct toedev *, struct tcpcb *); /* t4_connect.c */