Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Dec 2015 23:33:33 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r291660 - projects/cxl_iscsi/sys/dev/cxgbe/cxgbei
Message-ID:  <201512022333.tB2NXXdT066114@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512022333.tB2NXXdT066114>