FreeBSD/sys/dev/isci/scil/scic_sds_smp_request.c
/**
 * @brief This method processes an abnormal TC completion while the SMP
 *        request is waiting for a response frame.  It decides what
 *        happened to the IO based on TC completion status.
 *
 * @param[in] this_request This parameter specifies the request for which
 *            the TC completion was received.
 * @param[in] completion_code This parameter indicates the completion status
 *            information for the TC.
 *
 * @return Indicate if the tc completion handler was successful.
 * @retval SCI_SUCCESS currently this method always returns success.
 */
@brief This method processes an abnormal TC completion while the SMP
request is waiting for a response frame.  It decides what
happened to the IO based on TC completion status.

@param[in] this_request This parameter specifies the request for which
the TC completion was received.
@param[in] completion_code This parameter indicates the completion status
information for the TC.

@return Indicate if the tc completion handler was successful.
@retval SCI_SUCCESS currently this method always returns success.
@brief This method processes an abnormal TC completion while the SMP request is waiting for a response frame . It decides what happened to the IO based on TC completion status . @param [ in ] this_request This parameter specifies the request for which the TC completion was received . @param [ in ] completion_code This parameter indicates the completion status information for the TC . @return Indicate if the tc completion handler was successful . @retval SCI_SUCCESS currently this method always returns success .
static
SCI_STATUS scic_sds_smp_request_await_response_tc_completion_handler(
   SCIC_SDS_REQUEST_T * this_request,
   U32                  completion_code
)
{
   SCIC_LOG_TRACE((
      sci_base_object_get_logger(this_request),
      SCIC_LOG_OBJECT_SMP_IO_REQUEST,
      "scic_sds_smp_request_await_response_tc_completion_handler(0x%x, 0x%x) enter\n",
      this_request, completion_code
   ));
   switch (SCU_GET_COMPLETION_TL_STATUS(completion_code))
   {
   case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
      scic_sds_request_set_status(
         this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS
      );
      sci_base_state_machine_change_state(
         &this_request->parent.state_machine,
         SCI_BASE_REQUEST_STATE_COMPLETED
      );
   break;
   case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_RESP_TO_ERR):
   case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_UFI_ERR):
   case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_FRM_TYPE_ERR):
   case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SMP_LL_RX_ERR):
      scic_sds_request_set_status(
         this_request, SCU_TASK_DONE_SMP_RESP_TO_ERR, SCI_FAILURE_RETRY_REQUIRED
      );
      sci_base_state_machine_change_state(
         &this_request->parent.state_machine,
         SCI_BASE_REQUEST_STATE_COMPLETED
      );
   break;
   default:
      scic_sds_request_set_status(
         this_request,
         SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
         SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
      );
      sci_base_state_machine_change_state(
         &this_request->parent.state_machine,
         SCI_BASE_REQUEST_STATE_COMPLETED
      );
   break;
   }
   return SCI_SUCCESS;
}
static SCI_STATUS scic_sds_smp_request_await_response_tc_completion_handler ( SCIC_SDS_REQUEST_T * this_request , U32 completion_code ) { SCIC_LOG_TRACE ( ( sci_base_object_get_logger ( this_request ) , SCIC_LOG_OBJECT_SMP_IO_REQUEST , " \n " , this_request , completion_code ) ) ; switch ( SCU_GET_COMPLETION_TL_STATUS ( completion_code ) ) { case SCU_MAKE_COMPLETION_STATUS ( SCU_TASK_DONE_GOOD ) : scic_sds_request_set_status ( this_request , SCU_TASK_DONE_GOOD , SCI_SUCCESS ) ; sci_base_state_machine_change_state ( & this_request -> parent . state_machine , SCI_BASE_REQUEST_STATE_COMPLETED ) ; break ; case SCU_MAKE_COMPLETION_STATUS ( SCU_TASK_DONE_SMP_RESP_TO_ERR ) : case SCU_MAKE_COMPLETION_STATUS ( SCU_TASK_DONE_SMP_UFI_ERR ) : case SCU_MAKE_COMPLETION_STATUS ( SCU_TASK_DONE_SMP_FRM_TYPE_ERR ) : case SCU_MAKE_COMPLETION_STATUS ( SCU_TASK_DONE_SMP_LL_RX_ERR ) : scic_sds_request_set_status ( this_request , SCU_TASK_DONE_SMP_RESP_TO_ERR , SCI_FAILURE_RETRY_REQUIRED ) ; sci_base_state_machine_change_state ( & this_request -> parent . state_machine , SCI_BASE_REQUEST_STATE_COMPLETED ) ; break ; default : scic_sds_request_set_status ( this_request , SCU_NORMALIZE_COMPLETION_STATUS ( completion_code ) , SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR ) ; sci_base_state_machine_change_state ( & this_request -> parent . state_machine , SCI_BASE_REQUEST_STATE_COMPLETED ) ; break ; } return SCI_SUCCESS ; }
@brief This method processes an abnormal TC completion while the SMP
        request is waiting for a response frame.
@brief This method processes an abnormal TC completion while the SMP request is waiting for a response frame .
//In the AWAIT RESPONSE state, any TC completion is unexpected. //but if the TC has success status, we complete the IO anyway. //These status has been seen in a specific LSI expander, which sometimes //is not able to send smp response within 2 ms. This causes our hardware //break the connection and set TC completion with one of these SMP_XXX_XX_ERR //status. For these type of error, we ask scic user to retry the request. // All other completion status cause the IO to be complete.  If a NAK // was received, then it is up to the user to retry the request.