Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Mar 2017 06:50:13 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r315823 - stable/11/sys/dev/mpt
Message-ID:  <201703230650.v2N6oDiK057355@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Mar 23 06:50:13 2017
New Revision: 315823
URL: https://svnweb.freebsd.org/changeset/base/315823

Log:
  MFC r315002: Improve residuals reporting in target mode.

Modified:
  stable/11/sys/dev/mpt/mpt.h
  stable/11/sys/dev/mpt/mpt_cam.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mpt/mpt.h
==============================================================================
--- stable/11/sys/dev/mpt/mpt.h	Thu Mar 23 06:49:36 2017	(r315822)
+++ stable/11/sys/dev/mpt/mpt.h	Thu Mar 23 06:50:13 2017	(r315823)
@@ -331,8 +331,8 @@ typedef struct mpt_config_params {
 /**************************** MPI Target State Info ***************************/
 typedef struct {
 	uint32_t reply_desc;	/* current reply descriptor */
-	uint32_t resid;		/* current data residual */
 	uint32_t bytes_xfered;	/* current relative offset */
+	int resid;		/* current data residual */
 	union ccb *ccb;		/* pointer to currently active ccb */
 	request_t *req;		/* pointer to currently active assist request */
 	uint32_t

Modified: stable/11/sys/dev/mpt/mpt_cam.c
==============================================================================
--- stable/11/sys/dev/mpt/mpt_cam.c	Thu Mar 23 06:49:36 2017	(r315822)
+++ stable/11/sys/dev/mpt/mpt_cam.c	Thu Mar 23 06:50:13 2017	(r315823)
@@ -4430,6 +4430,7 @@ mpt_target_start_io(struct mpt_softc *mp
 		/*
 		 * XXX Should be done after data transfer completes?
 		 */
+		csio->resid = csio->dxfer_len - ta->DataLength;
 		tgt->resid -= csio->dxfer_len;
 		tgt->bytes_xfered += csio->dxfer_len;
 
@@ -4732,7 +4733,11 @@ mpt_scsi_tgt_status(struct mpt_softc *mp
 #ifndef	WE_TRUST_AUTO_GOOD_STATUS
 		resplen = MIN_FCP_RESPONSE_SIZE;
 #endif
-		if (tgt->resid) {
+		if (tgt->resid < 0) {
+			rsp[2] |= htobe32(0x400); /* XXXX NEED MNEMONIC!!!! */
+			rsp[3] = htobe32(-tgt->resid);
+			resplen = MIN_FCP_RESPONSE_SIZE;
+		} else if (tgt->resid > 0) {
 			rsp[2] |= htobe32(0x800); /* XXXX NEED MNEMONIC!!!! */
 			rsp[3] = htobe32(tgt->resid);
 			resplen = MIN_FCP_RESPONSE_SIZE;



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