From nobody Mon Sep 29 15:22:28 2025 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 4cb4gS58WMz68NkQ; Mon, 29 Sep 2025 15:22:28 +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 4cb4gS2tTfz46BT; Mon, 29 Sep 2025 15:22:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759159348; 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=nWFCXC1KB6shB/wL2SPSv6lGkf7fm8voK/IlAHkqoPE=; b=yB/ipRfYPTOa5qbo/XadfrGW3QJa2PsSU/V+gqc91I6fnLSA/rS59CzbKsaYfVfdREkF8L Ivussw31C01f/TMWSAnzzrwAPDxk+n9XldrmnV5xuMondEoN7vdqJAzoYqWjcUsqI00yzK Dt4MHs6TIJJrMH/ogo+1SdBWHkdpLmFPRTbXCZjy9jTW9irqUwFlM/WibXXgN/cOOn6KLb Wd7cTSDNJepITKO3TLPWbppc4Bgm0MLUE5qXmSZeMWhKZhfgeRc4YThqRNhh5QwJpbc8Zv LzJum7Q/AffRRn5KS6mfJFVLvIA5ZIJD9Twb75UqoDZZ6YTNeYNZvZ1UfMLBVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759159348; 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=nWFCXC1KB6shB/wL2SPSv6lGkf7fm8voK/IlAHkqoPE=; b=q+4Edlr95Q4Fhf0qkQ9afJTFaOFwx+mFyUxDQzrkpwJCdACh1Fp/Hhipsn5lhgnnYOBgj4 NKmWlAEkFjPHq9yLbXSIqkxWAypwYr1X5OlO5zxMSVDcaly6O6Z5N5kX0uRIjHpbGs5s9D W0z271GSHAU3h+ecR3dKMt8x7m8HfcrGB15+bGwhDPOe+zV+v6xS3lPz81cK6K5KxQ3Xdi 1PmPeGuXLGOjd5dUDCFiK95g9JuOtM3cyA6t2J9s/Esd2IVZdDj/iUIsfUmni155p10pem yCcy+hKQvjGka5fVRXIj84mQLdzuL3wZD2JmRM04/LgEr1K+N+Y6s7uiRBvVtg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759159348; a=rsa-sha256; cv=none; b=oykOLfUWLNTc38JGTYlQs8EMrT4Z1IbU4Ni6g1aQ2wG4eNGfzuaB/jytV5ZyBcdiaCLdrI FNSM/cAwQgSFZnv3tYqaEHEPwdAMbI96MtRinbLJTOtrr/md0bOQQsaXbcN0sOrsM6vy8d 9Kq2FKn3ZhI9wpwpahrxOdplASIHMRq+NC0espn1pxl/yU9XVr4vrm4bRJ675pP6ZKXqXS PF/z4vxUwbYEGAodoLbUT3zS03BNrDD8WaL2664KD2b87GThG1NznC2cV2XpTk9u0VYMt3 K00JXUykfA/ycSFZZkOCNIynsFvDZn8hUiKldtQ8vCYyjHkgPwFT7fz/5vMDcw== 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 4cb4gS2BWsz19gf; Mon, 29 Sep 2025 15:22:28 +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 58TFMSex011806; Mon, 29 Sep 2025 15:22:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58TFMSwZ011803; Mon, 29 Sep 2025 15:22:28 GMT (envelope-from git) Date: Mon, 29 Sep 2025 15:22:28 GMT Message-Id: <202509291522.58TFMSwZ011803@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: 35b883ccf365 - main - cxgbe: Move send_iscsi_flowc_wr to t4_tom.ko 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: 35b883ccf36521a46ba1cd959c144328cce223c5 Auto-Submitted: auto-generated The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=35b883ccf36521a46ba1cd959c144328cce223c5 commit 35b883ccf36521a46ba1cd959c144328cce223c5 Author: John Baldwin AuthorDate: 2025-09-29 14:52:18 +0000 Commit: Navdeep Parhar CommitDate: 2025-09-29 15:19:11 +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. MFC after: 3 days Sponsored by: Chelsio Communications --- 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 */