3.2.5.5.5 Receiving a SCSI Command Request

When the server receives a request with an OperationCode equal to RSVD_TUNNEL_SCSI_OPERATION, the request handling proceeds as follows:

If MaxOutputResponse is less than 52 (size of SVHDX_TUNNEL_OPERATION_HEADER + size of SVHDX_TUNNEL_SCSI_RESPONSE), the server MUST fail the request with STATUS_INVALID_PARAMETER.

If any of the following conditions is TRUE, the server MUST generate an error response as specified below:

  • Size of the request is less than 36

  • Length field of the request is not equal to 36 bytes

  • SenseInfoExLength is greater than (size of CDBBuffer + 4)

  • CDBLength is greater than the size of CDBBuffer

  • Disposition is 0x01 and DataTransferLength is less than the size of the DataBuffer field

  • Open.InitiatorId is zero

The SVHDX_TUNNEL_OPERATION_HEADER MUST be initialized. OperationCode and RequestId fields MUST be set to the values received in the request. If Open.InitiatorId is zero, the Status field MUST be set to STATUS_INVALID_HANDLE. Otherwise, the Status field MUST be set to STATUS_INVALID_PARAMETER. The SVHDX_TUNNEL_SCSI_RESPONSE MUST be set to the data received in SVHDX_TUNNEL_SCSI_REQUEST structure of the request. The server MUST send SVHDX_TUNNEL_OPERATION_HEADER and SVHDX_TUNNEL_SCSI_RESPONSE to the client and SHOULD NOT<19> add additional data to the response.

Otherwise, the server MUST issue a SCSI CDB command to the virtual SCSI disk in an implementation-specific manner.

If Disposition is 0 and the data returned by the virtual SCSI disk is greater than DataTransferLength in the request, the server MUST fail the request with STATUS_INVALID_PARAMETER.

If the virtual SCSI disk indicates a failure in processing the SCSI command, the server MUST return the SVHDX_TUNNEL_OPERATION_HEADER to the client initialized as below:

  • The OperationCode field MUST be set to the OperationCode value of the request.

  • The Status field MUST be set to one of the error codes specified in section 2.2.3.

  • The RequestId field MUST be set to the value received in the request.

Otherwise, the server MUST construct a SVHDX_TUNNEL_SCSI_RESPONSE structure as specified in section 2.2.4.8 with the following values:

The SVHDX_TUNNEL_OPERATION_HEADER MUST be initialized as follows:

  • The OperationCode field MUST be set to the OperationCode value of the request.

  • The Status field MUST be set to zero.

  • The RequestId field MUST be set to the value received in the request.

The SVHDX_TUNNEL_SCSI_RESPONSE is initialized as follows:

  • The SenseInfoAutoGenerated field MUST be set to the value received from the virtual SCSI disk.

  • The SrbStatus field MUST be set to one of the values specified in section 2.2.5.

  • The SCSIStatus field MUST be set to value received from the virtual SCSI disk.

  • The Disposition field MUST be set to the value received in the request.

  • The SrbFlags field MUST be set to the value received in the request.

  • The CDBLength field MUST be set to the value received in the request.

  • The Length field SHOULD<20> be set to the size, in bytes, of the SVHDX_TUNNEL_SCSI_RESPONSE structure that is constructed following the syntax specified in section 2.2.4.8.

  • The SenseInfoExLength field is set to the size of the sense information received from the virtual SCSI disk.

  • The SenseDataEx field SHOULD<21> be set to the sense information received from the virtual SCSI disk.

  • The DataTransferLength field MUST be set to the length of the additional data returned by the virtual SCSI disk, if any.

  • The DataBuffer MUST be set to the additional data returned by the virtual SCSI disk, if any.

The response MUST be sent to the client.