Print this page
5253 kmem_alloc/kmem_zalloc won't fail with KM_SLEEP
5254 getrbuf won't fail with KM_SLEEP


1027                 }
1028         }
1029 hard_reset:
1030         mpt->m_softstate &= ~MPTSAS_DID_MSG_UNIT_RESET;
1031         if (mptsas_kick_start(mpt) == DDI_FAILURE) {
1032                 mptsas_fm_ereport(mpt, DDI_FM_DEVICE_NO_RESPONSE);
1033                 ddi_fm_service_impact(mpt->m_dip, DDI_SERVICE_LOST);
1034                 return (MPTSAS_RESET_FAIL);
1035         }
1036         return (MPTSAS_SUCCESS_HARDRESET);
1037 }
1038 
1039 
1040 int
1041 mptsas_request_from_pool(mptsas_t *mpt, mptsas_cmd_t **cmd,
1042     struct scsi_pkt **pkt)
1043 {
1044         m_event_struct_t        *ioc_cmd = NULL;
1045 
1046         ioc_cmd = kmem_zalloc(M_EVENT_STRUCT_SIZE, KM_SLEEP);
1047         if (ioc_cmd == NULL) {
1048                 return (DDI_FAILURE);
1049         }
1050         ioc_cmd->m_event_linkp = NULL;
1051         mptsas_ioc_event_cmdq_add(mpt, ioc_cmd);
1052         *cmd = &(ioc_cmd->m_event_cmd);
1053         *pkt = &(ioc_cmd->m_event_pkt);
1054 
1055         return (DDI_SUCCESS);
1056 }
1057 
1058 void
1059 mptsas_return_to_pool(mptsas_t *mpt, mptsas_cmd_t *cmd)
1060 {
1061         m_event_struct_t        *ioc_cmd = NULL;
1062 
1063         ioc_cmd = mptsas_ioc_event_find_by_cmd(mpt, cmd);
1064         if (ioc_cmd == NULL) {
1065                 return;
1066         }
1067 
1068         mptsas_ioc_event_cmdq_delete(mpt, ioc_cmd);
1069         kmem_free(ioc_cmd, M_EVENT_STRUCT_SIZE);




1027                 }
1028         }
1029 hard_reset:
1030         mpt->m_softstate &= ~MPTSAS_DID_MSG_UNIT_RESET;
1031         if (mptsas_kick_start(mpt) == DDI_FAILURE) {
1032                 mptsas_fm_ereport(mpt, DDI_FM_DEVICE_NO_RESPONSE);
1033                 ddi_fm_service_impact(mpt->m_dip, DDI_SERVICE_LOST);
1034                 return (MPTSAS_RESET_FAIL);
1035         }
1036         return (MPTSAS_SUCCESS_HARDRESET);
1037 }
1038 
1039 
1040 int
1041 mptsas_request_from_pool(mptsas_t *mpt, mptsas_cmd_t **cmd,
1042     struct scsi_pkt **pkt)
1043 {
1044         m_event_struct_t        *ioc_cmd = NULL;
1045 
1046         ioc_cmd = kmem_zalloc(M_EVENT_STRUCT_SIZE, KM_SLEEP);



1047         ioc_cmd->m_event_linkp = NULL;
1048         mptsas_ioc_event_cmdq_add(mpt, ioc_cmd);
1049         *cmd = &(ioc_cmd->m_event_cmd);
1050         *pkt = &(ioc_cmd->m_event_pkt);
1051 
1052         return (DDI_SUCCESS);
1053 }
1054 
1055 void
1056 mptsas_return_to_pool(mptsas_t *mpt, mptsas_cmd_t *cmd)
1057 {
1058         m_event_struct_t        *ioc_cmd = NULL;
1059 
1060         ioc_cmd = mptsas_ioc_event_find_by_cmd(mpt, cmd);
1061         if (ioc_cmd == NULL) {
1062                 return;
1063         }
1064 
1065         mptsas_ioc_event_cmdq_delete(mpt, ioc_cmd);
1066         kmem_free(ioc_cmd, M_EVENT_STRUCT_SIZE);