From owner-svn-src-head@freebsd.org Thu Aug 25 23:06:13 2016 Return-Path: Delivered-To: svn-src-head@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 92059BC5A49; Thu, 25 Aug 2016 23:06:13 +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 52DAB16B3; Thu, 25 Aug 2016 23:06:13 +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 u7PN6C2r001041; Thu, 25 Aug 2016 23:06:12 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7PN6CHE001038; Thu, 25 Aug 2016 23:06:12 GMT (envelope-from np@FreeBSD.org) Message-Id: <201608252306.u7PN6CHE001038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 25 Aug 2016 23:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r304824 - head/sys/dev/cxgbe/cxgbei X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Aug 2016 23:06:13 -0000 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); }