FreeBSD/sys/dev/isci/scil/scif_sas_smp_io_request.c
/**
 * @brief This method retry the external smp request.
 *
 * @param[in] fw_device This parameter specifies the remote device for
 *            which the internal IO request is destined.
 * @param[in] old_internal_io This parameter specifies the old smp request to be
 *            retried.
 *
 * @return none.
 */
@brief This method retry the external smp request.
@param[in] fw_device This parameter specifies the remote device for
which the internal IO request is destined.
@param[in] old_internal_io This parameter specifies the old smp request to be
retried.

@return none.
@brief This method retry the external smp request . @param [ in ] fw_device This parameter specifies the remote device for which the internal IO request is destined . @param [ in ] old_internal_io This parameter specifies the old smp request to be retried . @return none .
SCI_STATUS scif_sas_smp_external_request_retry(
   SCIF_SAS_IO_REQUEST_T    * old_io
)
{
   SCIF_SAS_REMOTE_DEVICE_T * fw_device = old_io->parent.device;
   SCIF_SAS_CONTROLLER_T * fw_controller;
   SCIF_SAS_IO_REQUEST_T * new_io;
   void                  * new_request_memory = NULL;
   U8                      retry_count = old_io->retry_count;
   SCIF_LOG_TRACE((
      sci_base_object_get_logger(fw_device),
      SCIF_LOG_OBJECT_IO_REQUEST | SCIF_LOG_OBJECT_DOMAIN_DISCOVERY,
      "scif_sas_smp_external_request_retry(0x%x) time %d!\n",
      old_io
   ));
   fw_controller = fw_device->domain->controller;
   sci_fast_list_remove_element(&old_io->parent.list_element);
   switch (fw_device->protocol_device.smp_device.current_smp_request)
   {
      case SMP_FUNCTION_DISCOVER:
         new_request_memory = scif_sas_smp_request_construct_discover(
            fw_controller, fw_device,
            fw_device->protocol_device.smp_device.current_activity_phy_index,
            (void *)sci_object_get_association(old_io),
            (void *)old_io
         );
         break;
      case SMP_FUNCTION_PHY_CONTROL:
         new_request_memory = scif_sas_smp_request_construct_phy_control(
            fw_controller, fw_device, PHY_OPERATION_HARD_RESET,
            fw_device->protocol_device.smp_device.current_activity_phy_index,
            (void *)sci_object_get_association(old_io),
            (void *)old_io
         );
         break;
      default:
         return SCI_FAILURE;
   } 
   new_io = (SCIF_SAS_IO_REQUEST_T *) new_request_memory;
   new_io->retry_count = ++retry_count;
   sci_pool_put(fw_controller->hprq.pool, (POINTER_UINT) new_request_memory);
   scif_cb_start_internal_io_task_schedule(
      fw_controller, scif_sas_controller_start_high_priority_io, fw_controller
   );
   return SCI_SUCCESS;
}
SCI_STATUS scif_sas_smp_external_request_retry ( SCIF_SAS_IO_REQUEST_T * old_io ) { SCIF_SAS_REMOTE_DEVICE_T * fw_device = old_io -> parent . device ; SCIF_SAS_CONTROLLER_T * fw_controller ; SCIF_SAS_IO_REQUEST_T * new_io ; void * new_request_memory = NULL ; U8 retry_count = old_io -> retry_count ; SCIF_LOG_TRACE ( ( sci_base_object_get_logger ( fw_device ) , SCIF_LOG_OBJECT_IO_REQUEST | SCIF_LOG_OBJECT_DOMAIN_DISCOVERY , " \n " , old_io ) ) ; fw_controller = fw_device -> domain -> controller ; sci_fast_list_remove_element ( & old_io -> parent . list_element ) ; switch ( fw_device -> protocol_device . smp_device . current_smp_request ) { case SMP_FUNCTION_DISCOVER : new_request_memory = scif_sas_smp_request_construct_discover ( fw_controller , fw_device , fw_device -> protocol_device . smp_device . current_activity_phy_index , ( void * ) sci_object_get_association ( old_io ) , ( void * ) old_io ) ; break ; case SMP_FUNCTION_PHY_CONTROL : new_request_memory = scif_sas_smp_request_construct_phy_control ( fw_controller , fw_device , PHY_OPERATION_HARD_RESET , fw_device -> protocol_device . smp_device . current_activity_phy_index , ( void * ) sci_object_get_association ( old_io ) , ( void * ) old_io ) ; break ; default : return SCI_FAILURE ; } new_io = ( SCIF_SAS_IO_REQUEST_T * ) new_request_memory ; new_io -> retry_count = ++ retry_count ; sci_pool_put ( fw_controller -> hprq . pool , ( POINTER_UINT ) new_request_memory ) ; scif_cb_start_internal_io_task_schedule ( fw_controller , scif_sas_controller_start_high_priority_io , fw_controller ) ; return SCI_SUCCESS ; }
@brief This method retry the external smp request.
@brief This method retry the external smp request .
// Before we construct new io using the same memory, we need to // remove the IO from the list of outstanding requests on the domain // so that we don't damage the domain's fast list of request. //we are retrying an external io, we are going to reuse the //old io's memory. new_request_memory is same as old_io. //Phy Control command always uses external io memory. //unsupported case, TBD //end of switch //set the retry count to new built smp request. //put into the high priority queue. //schedule the DPC to start new io.