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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to