Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 May 2016 12:43:16 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300737 - head/sys/dev/iscsi
Message-ID:  <201605261243.u4QChGLv036215@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Thu May 26 12:43:15 2016
New Revision: 300737
URL: https://svnweb.freebsd.org/changeset/base/300737

Log:
  Add a special case for iSER data tranfers.
  
  Obtained from:	Mellanox Technologies
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/dev/iscsi/iscsi.c

Modified: head/sys/dev/iscsi/iscsi.c
==============================================================================
--- head/sys/dev/iscsi/iscsi.c	Thu May 26 12:00:14 2016	(r300736)
+++ head/sys/dev/iscsi/iscsi.c	Thu May 26 12:43:15 2016	(r300737)
@@ -866,6 +866,7 @@ iscsi_pdu_handle_scsi_response(struct ic
 	struct ccb_scsiio *csio;
 	size_t data_segment_len, received;
 	uint16_t sense_len;
+	uint32_t resid;
 
 	is = PDU_SESSION(response);
 
@@ -880,6 +881,22 @@ iscsi_pdu_handle_scsi_response(struct ic
 	}
 
 	ccb = io->io_ccb;
+
+	/*
+	 * With iSER, after getting good response we can be sure
+	 * that all the data has been successfully transferred.
+	 */
+	if (is->is_conn->ic_iser) {
+		resid = ntohl(bhssr->bhssr_residual_count);
+		if (bhssr->bhssr_flags & BHSSR_FLAGS_RESIDUAL_UNDERFLOW) {
+			io->io_received = ccb->csio.dxfer_len - resid;
+		} else if (bhssr->bhssr_flags & BHSSR_FLAGS_RESIDUAL_OVERFLOW) {
+			ISCSI_SESSION_WARN(is, "overflow: target indicates %d", resid);
+		} else {
+			io->io_received = ccb->csio.dxfer_len;
+		}
+	}
+
 	received = io->io_received;
 	iscsi_outstanding_remove(is, io);
 	ISCSI_SESSION_UNLOCK(is);



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