diff mbox series

[v2] scsi: target: core: Set MULTIP bit for se_device with multiple ports

Message ID 20220912125457.22573-2-d.bogdanov@yadro.com (mailing list archive)
State Accepted
Headers show
Series [v2] scsi: target: core: Set MULTIP bit for se_device with multiple ports | expand

Commit Message

Dmitry Bogdanov Sept. 12, 2022, 12:54 p.m. UTC
SAM-5 4.8.3 (SCSI target device with multiple SCSI ports structure)
obligates to set MULTIP bit when there's multiple SCSI target ports:

> Each device server shall indicate the presence of multiple SCSI target
> ports by setting the MULTIP bit to one in its standard INQUIRY data
> (see SPC-4).

The change sets MULTIP bit automatically to indicate the presence of
multiple SCSI target ports within standard inquiry response data if
there are multiple target ports in all target port groups of the
se_device.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
---
v2:
  use existing counter dev->export_count
---
 drivers/target/target_core_spc.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Mike Christie Sept. 12, 2022, 5:50 p.m. UTC | #1
On 9/12/22 7:54 AM, Dmitry Bogdanov wrote:
> SAM-5 4.8.3 (SCSI target device with multiple SCSI ports structure)
> obligates to set MULTIP bit when there's multiple SCSI target ports:
> 
>> Each device server shall indicate the presence of multiple SCSI target
>> ports by setting the MULTIP bit to one in its standard INQUIRY data
>> (see SPC-4).
> 
> The change sets MULTIP bit automatically to indicate the presence of
> multiple SCSI target ports within standard inquiry response data if
> there are multiple target ports in all target port groups of the
> se_device.
> 
> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>

Reviewed-by: Mike Christie <michael.christie@oracle.com>
Martin K. Petersen Sept. 16, 2022, 1:40 a.m. UTC | #2
Dmitry,

> SAM-5 4.8.3 (SCSI target device with multiple SCSI ports structure)
> obligates to set MULTIP bit when there's multiple SCSI target ports:

Applied to 6.1/scsi-staging, thanks!
diff mbox series

Patch

diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index c14441c89bed..7cca3b15472b 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -115,6 +115,12 @@  spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf)
 			buf[5] |= 0x1;
 	}
 
+	/*
+	 * Set MULTIP bit to indicate presence of multiple SCSI target ports
+	 */
+	if (dev->export_count > 1)
+		buf[6] |= 0x10;
+
 	buf[7] = 0x2; /* CmdQue=1 */
 
 	/*