Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Aug 2016 23:06:12 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r304824 - head/sys/dev/cxgbe/cxgbei
Message-ID:  <201608252306.u7PN6CHE001038@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Thu Aug 25 23:06:12 2016
New Revision: 304824
URL: https://svnweb.freebsd.org/changeset/base/304824

Log:
  cxgbe/cxgbei: Convert the driver-private PDU flags to enums and replace
  pdu_ prefix with icp_ in struct icl_cxgbei_pdu.
  
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/dev/cxgbe/cxgbei/cxgbei.c
  head/sys/dev/cxgbe/cxgbei/cxgbei.h
  head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c

Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.c
==============================================================================
--- head/sys/dev/cxgbe/cxgbei/cxgbei.c	Thu Aug 25 22:32:10 2016	(r304823)
+++ head/sys/dev/cxgbe/cxgbei/cxgbei.c	Thu Aug 25 23:06:12 2016	(r304824)
@@ -577,8 +577,8 @@ do_rx_iscsi_hdr(struct sge_iq *iq, const
 	icp = ip_to_icp(ip);
 	bcopy(mtod(m, caddr_t) + sizeof(*cpl), icp->ip.ip_bhs, sizeof(struct
 	    iscsi_bhs));
-	icp->pdu_seq = ntohl(cpl->seq);
-	icp->pdu_flags = SBUF_ULP_FLAG_HDR_RCVD;
+	icp->icp_seq = ntohl(cpl->seq);
+	icp->icp_flags = ICPF_RX_HDR;
 
 	/* This is the start of a new PDU.  There should be no old state. */
 	MPASS(toep->ulpcb2 == NULL);
@@ -606,13 +606,13 @@ do_rx_iscsi_data(struct sge_iq *iq, cons
 
 	/* Must already have received the header (but not the data). */
 	MPASS(icp != NULL);
-	MPASS(icp->pdu_flags == SBUF_ULP_FLAG_HDR_RCVD);
+	MPASS(icp->icp_flags == ICPF_RX_HDR);
 	MPASS(icp->ip.ip_data_mbuf == NULL);
 	MPASS(icp->ip.ip_data_len == 0);
 
 	m_adj(m, sizeof(*cpl));
 
-	icp->pdu_flags |= SBUF_ULP_FLAG_DATA_RCVD;
+	icp->icp_flags |= ICPF_RX_FLBUF;
 	icp->ip.ip_data_mbuf = m;
 	icp->ip.ip_data_len = m->m_pkthdr.len;
 
@@ -645,19 +645,19 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const
 
 	/* Must already be assembling a PDU. */
 	MPASS(icp != NULL);
-	MPASS(icp->pdu_flags & SBUF_ULP_FLAG_HDR_RCVD);	/* Data is optional. */
+	MPASS(icp->icp_flags & ICPF_RX_HDR);	/* Data is optional. */
 	ip = &icp->ip;
-	icp->pdu_flags |= SBUF_ULP_FLAG_STATUS_RCVD;
+	icp->icp_flags |= ICPF_RX_STATUS;
 	val = ntohl(cpl->ddpvld);
 	if (val & F_DDP_PADDING_ERR)
-		icp->pdu_flags |= SBUF_ULP_FLAG_PAD_ERROR;
+		icp->icp_flags |= ICPF_PAD_ERR;
 	if (val & F_DDP_HDRCRC_ERR)
-		icp->pdu_flags |= SBUF_ULP_FLAG_HCRC_ERROR;
+		icp->icp_flags |= ICPF_HCRC_ERR;
 	if (val & F_DDP_DATACRC_ERR)
-		icp->pdu_flags |= SBUF_ULP_FLAG_DCRC_ERROR;
+		icp->icp_flags |= ICPF_DCRC_ERR;
 	if (ip->ip_data_mbuf == NULL) {
 		/* XXXNP: what should ip->ip_data_len be, and why? */
-		icp->pdu_flags |= SBUF_ULP_FLAG_DATA_DDPED;
+		icp->icp_flags |= ICPF_RX_DDP;
 	}
 	pdu_len = ntohs(cpl->len);	/* includes everything. */
 
@@ -674,7 +674,7 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const
 	}
 
 	tp = intotcpcb(inp);
-	MPASS(icp->pdu_seq == tp->rcv_nxt);
+	MPASS(icp->icp_seq == tp->rcv_nxt);
 	MPASS(tp->rcv_wnd >= pdu_len);
 	tp->rcv_nxt += pdu_len;
 	tp->rcv_wnd -= pdu_len;
@@ -737,9 +737,8 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const
 			if (ip0 == NULL)
 				CXGBE_UNIMPLEMENTED("PDU allocation failure");
 			icp0 = ip_to_icp(ip0);
-			icp0->pdu_seq = 0; /* XXX */
-			icp0->pdu_flags = SBUF_ULP_FLAG_HDR_RCVD |
-			    SBUF_ULP_FLAG_STATUS_RCVD;
+			icp0->icp_seq = 0; /* XXX */
+			icp0->icp_flags = ICPF_RX_HDR | ICPF_RX_STATUS;
 			m_copydata(m, 0, sizeof(struct iscsi_bhs), (void *)ip0->ip_bhs);
 			STAILQ_INSERT_TAIL(&icc->rcvd_pdus, ip0, ip_next);
 		}
@@ -748,7 +747,7 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const
 
 #if 0
 	CTR4(KTR_CXGBE, "%s: tid %u, pdu_len %u, pdu_flags 0x%x",
-	    __func__, tid, pdu_len, icp->pdu_flags);
+	    __func__, tid, pdu_len, icp->icp_flags);
 #endif
 
 	STAILQ_INSERT_TAIL(&icc->rcvd_pdus, ip, ip_next);

Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.h
==============================================================================
--- head/sys/dev/cxgbe/cxgbei/cxgbei.h	Thu Aug 25 22:32:10 2016	(r304823)
+++ head/sys/dev/cxgbe/cxgbei/cxgbei.h	Thu Aug 25 23:06:12 2016	(r304824)
@@ -76,15 +76,26 @@ ic_to_icc(struct icl_conn *ic)
 	return (__containerof(ic, struct icl_cxgbei_conn, ic));
 }
 
-#define CXGBEI_PDU_SIGNATURE 0x12344321
+/* PDU flags and signature. */
+enum {
+	ICPF_RX_HDR	= 1 << 0, /* PDU header received. */
+	ICPF_RX_FLBUF	= 1 << 1, /* PDU payload received in a freelist. */
+	ICPF_RX_DDP	= 1 << 2, /* PDU payload DDP'd. */
+	ICPF_RX_STATUS	= 1 << 3, /* Rx status received. */
+	ICPF_HCRC_ERR	= 1 << 4, /* Header digest error. */
+	ICPF_DCRC_ERR	= 1 << 5, /* Data digest error. */
+	ICPF_PAD_ERR	= 1 << 6, /* Padding error. */
+
+	CXGBEI_PDU_SIGNATURE = 0x12344321
+};
 
 struct icl_cxgbei_pdu {
 	struct icl_pdu ip;
 
 	/* cxgbei specific stuff goes here. */
 	uint32_t icp_signature;
-	uint32_t pdu_seq;	/* For debug only */
-	u_int pdu_flags;
+	uint32_t icp_seq;	/* For debug only */
+	u_int icp_flags;
 };
 
 static inline struct icl_cxgbei_pdu *
@@ -111,14 +122,6 @@ struct cxgbei_sgl {
 #define sg_off(_sgel)           _sgel->sg_offset
 #define sg_next(_sgel)          _sgel + 1
 
-#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_HCRC_ERROR        0x10
-#define SBUF_ULP_FLAG_DCRC_ERROR        0x20
-#define SBUF_ULP_FLAG_PAD_ERROR         0x40
-#define SBUF_ULP_FLAG_DATA_DDPED        0x80
-
 /* private data for each scsi task */
 struct cxgbei_task_data {
 	struct cxgbei_sgl sgl[256];

Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
==============================================================================
--- head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c	Thu Aug 25 22:32:10 2016	(r304823)
+++ head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c	Thu Aug 25 23:06:12 2016	(r304824)
@@ -346,7 +346,7 @@ icl_cxgbei_conn_pdu_get_data(struct icl_
 {
 	struct icl_cxgbei_pdu *icp = ip_to_icp(ip);
 
-	if (icp->pdu_flags & SBUF_ULP_FLAG_DATA_DDPED)
+	if (icp->icp_flags & ICPF_RX_DDP)
 		return; /* data is DDP'ed, no need to copy */
 	m_copydata(ip->ip_data_mbuf, off, len, addr);
 }



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