Date: Thu, 18 Sep 2014 21:39:00 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271839 - in head/sys/cam: ctl scsi Message-ID: <201409182139.s8ILd0aT079892@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Sep 18 21:39:00 2014 New Revision: 271839 URL: http://svnweb.freebsd.org/changeset/base/271839 Log: Add support for "no Data-Out Buffer" (NDOB) flag of WRITE SAME (16) command. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_cmd_table.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Thu Sep 18 21:19:21 2014 (r271838) +++ head/sys/cam/ctl/ctl.c Thu Sep 18 21:39:00 2014 (r271839) @@ -5993,6 +5993,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 @@ -6027,7 +6035,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: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Thu Sep 18 21:19:21 2014 (r271838) +++ head/sys/cam/ctl/ctl_backend_block.c Thu Sep 18 21:39:00 2014 (r271839) @@ -1042,7 +1042,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: head/sys/cam/ctl/ctl_cmd_table.c ============================================================================== --- head/sys/cam/ctl/ctl_cmd_table.c Thu Sep 18 21:19:21 2014 (r271838) +++ head/sys/cam/ctl/ctl_cmd_table.c Thu Sep 18 21:39:00 2014 (r271839) @@ -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: head/sys/cam/scsi/scsi_all.h ============================================================================== --- head/sys/cam/scsi/scsi_all.h Thu Sep 18 21:19:21 2014 (r271838) +++ head/sys/cam/scsi/scsi_all.h Thu Sep 18 21:39:00 2014 (r271839) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409182139.s8ILd0aT079892>