svn commit: r272632 - in stable/10/sys/cam: ctl scsi

Alexander Motin mav at FreeBSD.org
Mon Oct 6 13:21:15 UTC 2014


Author: mav
Date: Mon Oct  6 13:21:13 2014
New Revision: 272632
URL: https://svnweb.freebsd.org/changeset/base/272632

Log:
  MFC r271839:
  Add support for "no Data-Out Buffer" (NDOB) flag of WRITE SAME (16) command.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_backend_block.c
  stable/10/sys/cam/ctl/ctl_cmd_table.c
  stable/10/sys/cam/scsi/scsi_all.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c	Mon Oct  6 13:20:18 2014	(r272631)
+++ stable/10/sys/cam/ctl/ctl.c	Mon Oct  6 13:21:13 2014	(r272632)
@@ -5995,6 +5995,14 @@ ctl_write_same(struct ctl_scsiio *ctsio)
 		break; /* NOTREACHED */
 	}
 
+	/* NDOB flag can be used only together with UNMAP */
+	if ((byte2 & (SWS_NDOB | SWS_UNMAP)) == SWS_NDOB) {
+		ctl_set_invalid_field(ctsio, /*sks_valid*/ 1,
+		    /*command*/ 1, /*field*/ 1, /*bit_valid*/ 1, /*bit*/ 0);
+		ctl_done((union ctl_io *)ctsio);
+		return (CTL_RETVAL_COMPLETE);
+	}
+
 	/*
 	 * The first check is to make sure we're in bounds, the second
 	 * check is to catch wrap-around problems.  If the lba + num blocks
@@ -6029,7 +6037,8 @@ ctl_write_same(struct ctl_scsiio *ctsio)
 	 * If we've got a kernel request that hasn't been malloced yet,
 	 * malloc it and tell the caller the data buffer is here.
 	 */
-	if ((ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) {
+	if ((byte2 & SWS_NDOB) == 0 &&
+	    (ctsio->io_hdr.flags & CTL_FLAG_ALLOCATED) == 0) {
 		ctsio->kern_data_ptr = malloc(len, M_CTL, M_WAITOK);;
 		ctsio->kern_data_len = len;
 		ctsio->kern_total_len = len;

Modified: stable/10/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_backend_block.c	Mon Oct  6 13:20:18 2014	(r272631)
+++ stable/10/sys/cam/ctl/ctl_backend_block.c	Mon Oct  6 13:21:13 2014	(r272632)
@@ -1045,7 +1045,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b
 	softc = be_lun->softc;
 	lbalen = ARGS(beio->io);
 
-	if (lbalen->flags & ~(SWS_LBDATA | SWS_UNMAP | SWS_ANCHOR) ||
+	if (lbalen->flags & ~(SWS_LBDATA | SWS_UNMAP | SWS_ANCHOR | SWS_NDOB) ||
 	    (lbalen->flags & (SWS_UNMAP | SWS_ANCHOR) && be_lun->unmap == NULL)) {
 		ctl_free_beio(beio);
 		ctl_set_invalid_field(&io->scsiio,

Modified: stable/10/sys/cam/ctl/ctl_cmd_table.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_cmd_table.c	Mon Oct  6 13:20:18 2014	(r272631)
+++ stable/10/sys/cam/ctl/ctl_cmd_table.c	Mon Oct  6 13:21:13 2014	(r272632)
@@ -1085,7 +1085,7 @@ const struct ctl_cmd_entry ctl_cmd_table
 {ctl_write_same, CTL_SERIDX_WRITE, CTL_CMD_FLAG_OK_ON_SLUN |
 				   CTL_FLAG_DATA_OUT,
  CTL_LUN_PAT_WRITE | CTL_LUN_PAT_RANGE,
- 16, {0x1a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 16, {0x1b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
       0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0x07}},
 
 /* 94 */

Modified: stable/10/sys/cam/scsi/scsi_all.h
==============================================================================
--- stable/10/sys/cam/scsi/scsi_all.h	Mon Oct  6 13:20:18 2014	(r272631)
+++ stable/10/sys/cam/scsi/scsi_all.h	Mon Oct  6 13:21:13 2014	(r272632)
@@ -1030,6 +1030,7 @@ struct scsi_write_same_16
 {
 	uint8_t	opcode;
 	uint8_t	byte2;
+#define	SWS_NDOB	0x01
 	uint8_t	addr[8];
 	uint8_t	length[4];
 	uint8_t	group;


More information about the svn-src-stable-10 mailing list