Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Sep 2015 21:07:34 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r288394 - projects/cxl_iscsi/sys/dev/cxgbe/cxgbei
Message-ID:  <201509292107.t8TL7YqT080698@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Tue Sep 29 21:07:33 2015
New Revision: 288394
URL: https://svnweb.freebsd.org/changeset/base/288394

Log:
  - Remove unused or write-only fields from ulp_mbuf_cb.
  
  - Remove write-only SBUF_ULP_FLAG_COALESCE_OFF flag.
  
  - Failure to allocate ulp_mbuf_cb during rx is a hard error.  Panic
    instead of just freeing the mbuf and pretending nothing happened.  The
    payload in the mbuf is precious because it has been ACK'ed by the TOE.
    (ulp_mbuf_cb is going to go away soon and so will these potential
    failures during rx.)

Modified:
  projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/cxgbei.c
  projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/cxgbei.h

Modified: projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/cxgbei.c
==============================================================================
--- projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/cxgbei.c	Tue Sep 29 19:15:08 2015	(r288393)
+++ projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/cxgbei.c	Tue Sep 29 21:07:33 2015	(r288394)
@@ -570,11 +570,8 @@ process_rx_iscsi_hdr(struct toepcb *toep
 
 	/* allocate m_tag to hold ulp info */
 	cb = get_ulp_mbuf_cb(m);
-	if (cb == NULL) {
-		printf("%s: Error allocation m_tag\n", __func__);
-		goto err_out1;
-	}
-	cb->seq = ntohl(cpl->seq);
+	if (cb == NULL)
+		CXGBE_UNIMPLEMENTED(__func__);
 
 	/* strip off CPL header */
 	m_adj(m, sizeof(*cpl));
@@ -585,41 +582,35 @@ process_rx_iscsi_hdr(struct toepcb *toep
 
 		isock->mbuf_ulp_lhdr = lmbuf = m;
 		lcb = cb;
-		cb->flags = SBUF_ULP_FLAG_HDR_RCVD |
-			SBUF_ULP_FLAG_COALESCE_OFF;
+		cb->flags = SBUF_ULP_FLAG_HDR_RCVD;
 		/* we only update tp->rcv_nxt once per pdu */
-		if (cb->seq != tp->rcv_nxt) {
-			CTR3(KTR_CXGBE,
-			"tid 0x%x, CPL_ISCSI_HDR, BAD seq got 0x%x exp 0x%x.",
-			toep->tid, cb->seq, tp->rcv_nxt);
-			goto err_out1;
+		if (__predict_false(ntohl(cpl->seq) != tp->rcv_nxt)) {
+			panic("%s: seq# 0x%x (expected 0x%x) for tid %u",
+			    __func__, ntohl(cpl->seq), tp->rcv_nxt, toep->tid);
 		}
 		byte = m->m_data;
 		hlen = ntohs(cpl->len);
 		dlen = ntohl(*(unsigned int *)(byte + 4)) & 0xFFFFFF;
 
 		plen = ntohs(cpl->pdu_len_ddp);
-		lcb->ulp.iscsi.pdulen = (hlen + dlen + 3) & (~0x3);
+		lcb->pdulen = (hlen + dlen + 3) & (~0x3);
 		/* workaround for cpl->pdu_len_ddp since it does not include
 		the data digest count */
 		if (dlen)
-			lcb->ulp.iscsi.pdulen += isock->s_dcrc_len;
+			lcb->pdulen += isock->s_dcrc_len;
 
-		tp->rcv_nxt += lcb->ulp.iscsi.pdulen;
-		if (tp->rcv_wnd <= lcb->ulp.iscsi.pdulen)
+		tp->rcv_nxt += lcb->pdulen;
+		if (tp->rcv_wnd <= lcb->pdulen)
 			CTR3(KTR_CXGBE, "%s: Neg rcv_wnd:0x%lx pdulen:0x%x",
-				__func__, tp->rcv_wnd, lcb->ulp.iscsi.pdulen);
-			tp->rcv_wnd -= lcb->ulp.iscsi.pdulen;
+				__func__, tp->rcv_wnd, lcb->pdulen);
+			tp->rcv_wnd -= lcb->pdulen;
 			tp->t_rcvtime = ticks;
 	} else {
 		lmbuf = isock->mbuf_ulp_lhdr;
 		lcb = find_ulp_mbuf_cb(lmbuf);
-		if (lcb == NULL) {
-			printf("%s: lmbuf:%p lcb is NULL\n", __func__, lmbuf);
-			goto err_out1;
-		}
-		lcb->flags |= SBUF_ULP_FLAG_DATA_RCVD |
-			SBUF_ULP_FLAG_COALESCE_OFF;
+		if (lcb == NULL)
+			CXGBE_UNIMPLEMENTED(__func__);
+		lcb->flags |= SBUF_ULP_FLAG_DATA_RCVD;
 		cb->flags = SBUF_ULP_FLAG_DATA_RCVD;
 
 		/* padding */
@@ -629,11 +620,6 @@ process_rx_iscsi_hdr(struct toepcb *toep
 	}
 	mbufq_enqueue(&isock->iscsi_rcvq, m);
 	mtx_unlock(&isock->iscsi_rcvq_lock);
-	return;
-
-err_out1:
-	mtx_unlock(&isock->iscsi_rcvq_lock);
-	m_freem(m);
 }
 
 /* hand over received PDU to iscsi_initiator */
@@ -663,7 +649,7 @@ iscsi_conn_receive_pdu(struct iscsi_sock
 	}
 	/* BHS */
 	mbufq_dequeue(&isock->iscsi_rcvq);
-	data_len = cb->ulp.iscsi.pdulen;
+	data_len = cb->pdulen;
 
 	CTR5(KTR_CXGBE, "%s: response:%p m:%p m_len:%d data_len:%d",
 		__func__, response, m, m->m_len, data_len);
@@ -723,15 +709,15 @@ process_rx_data_ddp(struct toepcb *toep,
 	lcb->flags |= SBUF_ULP_FLAG_STATUS_RCVD;
 	isock->mbuf_ulp_lhdr = NULL;
 
-	if (ntohs(cpl->len) != lcb->ulp.iscsi.pdulen) {
+	if (ntohs(cpl->len) != lcb->pdulen) {
 		CTR3(KTR_CXGBE, "tid 0x%x, RX_DATA_DDP pdulen %u != %u.",
-			toep->tid, ntohs(cpl->len), lcb->ulp.iscsi.pdulen);
+			toep->tid, ntohs(cpl->len), lcb->pdulen);
 		CTR4(KTR_CXGBE, "%s: lmbuf:%p lcb:%p lcb->flags:0x%x",
 			__func__, lmbuf, lcb, lcb->flags);
 	}
 
-	lcb->ulp.iscsi.ddigest = ntohl(cpl->ulp_crc);
-	pdulen = lcb->ulp.iscsi.pdulen;
+	lcb->ddigest = ntohl(cpl->ulp_crc);
+	pdulen = lcb->pdulen;
 
 	val = ntohl(cpl->ddpvld);
 	if (val & F_DDP_PADDING_ERR)

Modified: projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/cxgbei.h
==============================================================================
--- projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/cxgbei.h	Tue Sep 29 19:15:08 2015	(r288393)
+++ projects/cxl_iscsi/sys/dev/cxgbe/cxgbei/cxgbei.h	Tue Sep 29 21:07:33 2015	(r288394)
@@ -72,7 +72,6 @@ struct cxgbei_sgl {
 #define SBUF_ULP_FLAG_HDR_RCVD          0x1
 #define SBUF_ULP_FLAG_DATA_RCVD         0x2
 #define SBUF_ULP_FLAG_STATUS_RCVD       0x4
-#define SBUF_ULP_FLAG_COALESCE_OFF      0x8
 #define SBUF_ULP_FLAG_HCRC_ERROR        0x10
 #define SBUF_ULP_FLAG_DCRC_ERROR        0x20
 #define SBUF_ULP_FLAG_PAD_ERROR         0x40
@@ -83,21 +82,11 @@ struct cxgbei_sgl {
  * etc.
  */
 struct ulp_mbuf_cb {
-	uint8_t ulp_mode;                    /* ULP mode/submode of sk_buff */
-	uint8_t flags;                       /* TCP-like flags */
-	uint32_t seq;                        /* TCP sequence number */
-	union { /* ULP-specific fields */
-		struct {
-			uint32_t ddigest;    /* ULP rx_data_ddp selected field*/
-			uint32_t pdulen;     /* ULP rx_data_ddp selected field*/
-		} iscsi;
-		struct {
-			uint32_t offset;     /* ULP DDP offset notification */
-			uint8_t flags;       /* ULP DDP flags ... */
-		} ddp;
-	} ulp;
-	uint8_t ulp_data[16];                /* scratch area for ULP */
-	void *pdu;                      /* pdu pointer */
+	uint8_t ulp_mode;	/* ULP mode/submode of sk_buff */
+	uint8_t flags;		/* TCP-like flags */
+	uint32_t ddigest;	/* ULP rx_data_ddp selected field*/
+	uint32_t pdulen;	/* ULP rx_data_ddp selected field*/
+	void *pdu;		/* pdu pointer */
 };
 
 /* private data for each scsi task */



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