1

The SCSI reference manual defines two types of sense data formats - fixed and variable descriptor-based ones (chapter 2.4). The "Control Mode Page (0Ah)" (4.3.8), which is supposed to be returned as a response to the MODE SENSE SCSI command, contains a D_SENSE bit, which is defined as:

D_SENSE (DESCRIPTOR FORMAT SENSE DATA) bit

  • 0 A descriptor format sense data (D_SENSE) bit set to zero specifies that the device server shall return the fixed format sense data when returning sense data in the same I_T_L_Q nexus transaction as a CHECK CONDITION status.

  • 1 A D_SENSE bit set to one specifies that the device server shall return descriptor format sense data when returning sense data in the same I_T_L_Q nexus transaction as a CHECK CONDITION status, except as defined in 2.4.1.

My question is about this bit interpretation on the SCSI target side - is the target server obligated to return sense data in the descriptor format if this bit is 1? Or it's just a possibility to return this data in any format it wants?

The first byte of the sense data can be used to determine its format, so the SCSI initiator doesn't actually need the D_SENSE bit value to decide how to decode the received sense data.

I'm asking this question cause I'm working on some piece of software which is supposed to simulate a SCSI target, so I need to digest multiple SCSI documents to make it right.

HEKTO
  • 3,876
  • 2
  • 24
  • 45

1 Answers1

1

If the SCSI target implements the ability to set this bit it must be able to return either of the sense formats. The SCSI target may choose to only provide this bit for reading and not writing and then it dictates what format it returns.

Please also notice that to be properly SCSI compliant you also need to provide the mode page in a "mask mode" that shows which bits of a mode page are settable.

Baruch Even
  • 2,581
  • 1
  • 17
  • 23
  • "Mode page in a mask mode" - you mean bits, settable by MODE SELECT, right? I can see that the sense data should be returned by target as a response to the REQUEST SENSE as well. Fortunately this command has two variants - for fixed sense and descriptor sense. So, if D_SENSE is *not* set, then the target should return the "error in CDB", right? – HEKTO Oct 13 '14 at 15:22
  • If the D_SENSE is not set you should return sense buffers in fixed sense format. You can prevent setting this bit at all so you only need to implement the fixed sense format. – Baruch Even Oct 14 '14 at 08:38
  • I actually need to implement sense data in the descriptor format as well, because this format is needed to report such info as "formatting in progress" (as a response to the REQUEST SENSE). So I worry about how to do that without (or with minimal) disrupting all the other sense data messages, which my target is supposed to generate. – HEKTO Oct 14 '14 at 14:51
  • 1
    You can report format in progress and progress level in fixed sense too. You can look at my libscsicmd library that has full parsing of scsi sense. – Baruch Even Oct 15 '14 at 05:33
  • Thank you for the reference to your library! So - I can report the progress level in bytes 15-17 of the fixed sense data, right? – HEKTO Oct 15 '14 at 15:58