From owner-svn-src-projects@freebsd.org Wed Dec 2 23:33:34 2015 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9192DA3F318 for ; Wed, 2 Dec 2015 23:33:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E60910CC; Wed, 2 Dec 2015 23:33:34 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB2NXXkT066115; Wed, 2 Dec 2015 23:33:33 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB2NXXdT066114; Wed, 2 Dec 2015 23:33:33 GMT (envelope-from np@FreeBSD.org) Message-Id: <201512022333.tB2NXXdT066114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 2 Dec 2015 23:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r291660 - projects/cxl_iscsi/sys/dev/cxgbe/cxgbei X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2015 23:33:34 -0000 Author: np Date: Wed Dec 2 23:33:33 2015 New Revision: 291660 URL: https://svnweb.freebsd.org/changeset/base/291660 Log: Send a flowc to set the max tx payload length. This flowc is ignored by the firmware because the original flowc sent by t4_tom changed the firmware-internal state of the tid. For now I'm setting MAX_DSL to 8K and PDU accordingly. This will be tidied up with the next firmware update that will handle multiple flowc's correctly. Modified: projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Modified: projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/icl_cxgbei.c ============================================================================== --- projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Wed Dec 2 22:44:42 2015 (r291659) +++ projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Wed Dec 2 23:33:33 2015 (r291660) @@ -135,11 +135,15 @@ static kobj_method_t icl_cxgbei_methods[ DEFINE_CLASS(icl_cxgbei, icl_cxgbei_methods, sizeof(struct icl_cxgbei_conn)); +#if 0 /* * Subtract another 256 for AHS from MAX_DSL if AHS could be used. */ #define CXGBEI_MAX_PDU 16224 #define CXGBEI_MAX_DSL (CXGBEI_MAX_PDU - sizeof(struct iscsi_bhs) - 8) +#endif +#define CXGBEI_MAX_DSL 8192 +#define CXGBEI_MAX_PDU (CXGBEI_MAX_DSL + sizeof(struct iscsi_bhs) + 8) void icl_cxgbei_conn_pdu_free(struct icl_conn *ic, struct icl_pdu *ip) @@ -543,6 +547,46 @@ find_offload_adapter(struct adapter *sc, INP_WUNLOCK(inp); } +/* 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); + 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); + + 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, int hcrc, int dcrc) { @@ -642,8 +686,8 @@ icl_cxgbei_conn_handoff(struct icl_conn MPASS(tp->t_flags & TF_TOE); MPASS(tp->tod != NULL); MPASS(tp->t_toe != NULL); - toep = tp->t_toe; + MPASS(toep->port->adapter == icc->sc); icc->toep = toep; icc->cwt = &cwt_softc[0]; /* XXXNP */ icc->ulp_submode = 0; @@ -655,6 +699,7 @@ icl_cxgbei_conn_handoff(struct icl_conn toep->ulp_mode = ULP_MODE_ISCSI; toep->ulpcb = icc; + send_iscsi_flowc_wr(icc->sc, toep, CXGBEI_MAX_PDU); set_ulp_mode_iscsi(icc->sc, toep, ic->ic_header_crc32c, ic->ic_data_crc32c); error = 0;