Add support for "no Data-Out Buffer" (NDOB) flag of WRITE SAME (16) command.
This commit is contained in:
parent
10a9d2fef6
commit
0db50d6959
@ -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;
|
||||
|
@ -1042,7 +1042,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun,
|
||||
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,
|
||||
|
@ -1085,7 +1085,7 @@ const struct ctl_cmd_entry ctl_cmd_table[256] =
|
||||
{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 */
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user