FreeBSD/sys/dev/isci/scil/scic_sds_stp_remote_device.c
/**
 * This method will perform the STP request completion processing common
 * to IO requests and task requests of all types
 *
 * @param[in] device This parameter specifies the device for which the
 *            request is being completed.
 * @param[in] request This parameter specifies the request being completed.
 *
 * @return This method returns an indication as to whether the request
 *         processing completed successfully.
 */
This method will perform the STP request completion processing common
to IO requests and task requests of all types

@param[in] device This parameter specifies the device for which the
request is being completed.
@param[in] request This parameter specifies the request being completed.

@return This method returns an indication as to whether the request
processing completed successfully.
This method will perform the STP request completion processing common to IO requests and task requests of all types @param [ in ] device This parameter specifies the device for which the request is being completed . @param [ in ] request This parameter specifies the request being completed . @return This method returns an indication as to whether the request processing completed successfully .
static
SCI_STATUS scic_sds_stp_remote_device_complete_request(
   SCI_BASE_REMOTE_DEVICE_T * device,
   SCI_BASE_REQUEST_T       * request
)
{
   SCIC_SDS_REMOTE_DEVICE_T * this_device = (SCIC_SDS_REMOTE_DEVICE_T *)device;
   SCIC_SDS_REQUEST_T       * the_request = (SCIC_SDS_REQUEST_T *)request;
   SCI_STATUS                 status;
   status = scic_sds_io_request_complete(the_request);
   if (status == SCI_SUCCESS)
   {
      status = scic_sds_port_complete_io(
                  this_device->owning_port, this_device, the_request
               );
      if (status == SCI_SUCCESS)
      {
         scic_sds_remote_device_decrement_request_count(this_device);
         if (the_request->sci_status == SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED)
         {
            sci_base_state_machine_change_state(
               &this_device->ready_substate_machine,
               SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET
            );
         }
         else if (scic_sds_remote_device_get_request_count(this_device) == 0)
         {
            sci_base_state_machine_change_state(
               &this_device->ready_substate_machine,
               SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE
            );
         }
      }
   }
   if (status != SCI_SUCCESS)
   {
      SCIC_LOG_ERROR((
         sci_base_object_get_logger(this_device),
         SCIC_LOG_OBJECT_STP_REMOTE_TARGET,
         "Port:0x%x Device:0x%x Request:0x%x Status:0x%x could not complete\n",
         this_device->owning_port, this_device, the_request, status
      ));
   }
   return status;
}
static SCI_STATUS scic_sds_stp_remote_device_complete_request ( SCI_BASE_REMOTE_DEVICE_T * device , SCI_BASE_REQUEST_T * request ) { SCIC_SDS_REMOTE_DEVICE_T * this_device = ( SCIC_SDS_REMOTE_DEVICE_T * ) device ; SCIC_SDS_REQUEST_T * the_request = ( SCIC_SDS_REQUEST_T * ) request ; SCI_STATUS status ; status = scic_sds_io_request_complete ( the_request ) ; if ( status == SCI_SUCCESS ) { status = scic_sds_port_complete_io ( this_device -> owning_port , this_device , the_request ) ; if ( status == SCI_SUCCESS ) { scic_sds_remote_device_decrement_request_count ( this_device ) ; if ( the_request -> sci_status == SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED ) { sci_base_state_machine_change_state ( & this_device -> ready_substate_machine , SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET ) ; } else if ( scic_sds_remote_device_get_request_count ( this_device ) == 0 ) { sci_base_state_machine_change_state ( & this_device -> ready_substate_machine , SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE ) ; } } } if ( status != SCI_SUCCESS ) { SCIC_LOG_ERROR ( ( sci_base_object_get_logger ( this_device ) , SCIC_LOG_OBJECT_STP_REMOTE_TARGET , " \n " , this_device -> owning_port , this_device , the_request , status ) ) ; } return status ; }
This method will perform the STP request completion processing common
 to IO requests and task requests of all types
This method will perform the STP request completion processing common to IO requests and task requests of all types
//This request causes hardware error, device needs to be Lun Reset. //So here we force the state machine to IDLE state so the rest IOs //can reach RNC state handler, these IOs will be completed by RNC with //status of "DEVICE_RESET_REQUIRED", instead of "INVALID STATE".