[PATCH] tcm: Add support for Extended INQUIRY Data VPD Page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>

Greetings all,

This small patch updates transport_generic_emulate_inquiry() to add support for
the Extended INQUIRY Data VPD Page in spc4r23 section 7.7.5.

By default, this page returns HEADSUP, ORDSUP, SIMPSUP bits enabled for
SCSI Tasks Attr emulation.  It also will set V_SUP (volatile cache supported)
when DEV_ATTRIB(dev)->emulate_write_cache is enabled for FILEIO or IBLOCK
backstores.

There is how it looks using 'sg_inq -ve $DEV' with emulate_write_cache=1:

target:/mnt/sdb/lio-core-2.6.git# sg_inq -ve /dev/sdg
VPD INQUIRY: extended INQUIRY data page
    inquiry cdb: 12 01 86 00 fc 00
    inquiry cdb: 12 01 86 3c 04 00
  SPT=0 GRD_CHK=0 APP_CHK=0 REF_CHK=0
  GRP_SUP=0 PRIOR_SUP=0 HEADSUP=1 ORDSUP=1 SIMPSUP=1
  CORR_D_SUP=0 NV_SUP=0 V_SUP=1 LUICLR=0

Signed-off-by: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx>
---
 drivers/target/target_core_transport.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index ec67cb6..fbbe9fc 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -4499,6 +4499,7 @@ after_tpgs:
 		buf[4] = 0x0;
 		buf[5] = 0x80;
 		buf[6] = 0x83;
+		buf[7] = 0x86;
 		len = 3;
 		break;
 	case 0x80: /* unit serial number */
@@ -4816,6 +4817,22 @@ set_len:
 		buf[2] = ((len >> 8) & 0xff);
 		buf[3] = (len & 0xff); /* Page Length for VPD 0x83 */
 		break;
+	case 0x86: /* Extended INQUIRY Data VPD Page */
+		/*
+		 * This page uses a hardcoded value of 60
+		 */
+		if (cmd->data_length < 60)
+			return 0;
+
+		buf[1] = 0x86;
+		buf[2] = 0x3c;
+		/* Set HEADSUP, ORDSUP, SIMPSUP */
+		buf[5] = 0x07;
+		/* If WriteCache emulation is enabled, set V_SUP */
+		if (DEV_ATTRIB(dev)->emulate_write_cache > 0)
+			buf[6] = 0x01;
+
+		break;
 	default:
 		printk(KERN_ERR "Unknown VPD Code: 0x%02x\n", cdb[2]);
 		return -1;
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux