/** * This method will perform the STP request (both io or task) completion * processing for await reset state. * * @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_ready_await_reset_substate_complete_request_handler( 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 (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; }
/** * 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) { //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". 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; }
/** * @brief this is the complete_io_handler for smp device at ready cmd substate. * * @param[in] device This is the device object that is receiving the IO. * @param[in] request The io to start. * * @return SCI_STATUS */ static SCI_STATUS scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler( SCI_BASE_REMOTE_DEVICE_T * device, SCI_BASE_REQUEST_T * request ) { SCI_STATUS status; SCIC_SDS_REMOTE_DEVICE_T * this_device; SCIC_SDS_REQUEST_T * the_request; this_device = (SCIC_SDS_REMOTE_DEVICE_T *)device; the_request = (SCIC_SDS_REQUEST_T *)request; 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); sci_base_state_machine_change_state( &this_device->ready_substate_machine, SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE ); } else { SCIC_LOG_ERROR(( sci_base_object_get_logger(this_device), SCIC_LOG_OBJECT_SMP_REMOTE_TARGET, "SCIC SDS Remote Device 0x%x io request 0x%x could not be completd on the port 0x%x failed with status %d.\n", this_device, the_request, this_device->owning_port, status )); } } return status; }