From owner-svn-src-projects@freebsd.org Tue Sep 29 21:07:35 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 1E504A0C07E for ; Tue, 29 Sep 2015 21:07:35 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::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 0EF1E1843; Tue, 29 Sep 2015 21:07:35 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8TL7YCt080700; Tue, 29 Sep 2015 21:07:34 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8TL7YqT080698; Tue, 29 Sep 2015 21:07:34 GMT (envelope-from np@FreeBSD.org) Message-Id: <201509292107.t8TL7YqT080698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 29 Sep 2015 21:07:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r288394 - 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: Tue, 29 Sep 2015 21:07:35 -0000 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 */