H A D | ibmvscsi.c | 593 static void init_event_struct(struct srp_event_struct *evt_struct, init_event_struct() argument 598 evt_struct->cmnd = NULL; init_event_struct() 599 evt_struct->cmnd_done = NULL; init_event_struct() 600 evt_struct->sync_srp = NULL; init_event_struct() 601 evt_struct->crq.format = format; init_event_struct() 602 evt_struct->crq.timeout = cpu_to_be16(timeout); init_event_struct() 603 evt_struct->done = done; init_event_struct() 649 struct srp_event_struct *evt_struct, unmap_cmd_data() 660 if (evt_struct->cmnd) unmap_cmd_data() 661 scsi_dma_unmap(evt_struct->cmnd); unmap_cmd_data() 691 struct srp_event_struct *evt_struct, map_sg_data() 729 if (!evt_struct->ext_list) { map_sg_data() 730 evt_struct->ext_list = (struct srp_direct_buf *) map_sg_data() 733 &evt_struct->ext_list_token, 0); map_sg_data() 734 if (!evt_struct->ext_list) { map_sg_data() 744 total_length = map_sg_list(cmd, sg_mapped, evt_struct->ext_list); map_sg_data() 747 indirect->table_desc.va = cpu_to_be64(evt_struct->ext_list_token); map_sg_data() 750 memcpy(indirect->desc_list, evt_struct->ext_list, map_sg_data() 765 struct srp_event_struct *evt_struct, map_data_for_srp_cmd() 785 return map_sg_data(cmd, evt_struct, srp_cmd, dev); map_data_for_srp_cmd() 835 * @evt_struct: struct srp_event_struct that timed out 839 static void ibmvscsi_timeout(struct srp_event_struct *evt_struct) ibmvscsi_timeout() argument 841 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata; ibmvscsi_timeout() 844 evt_struct->iu.srp.cmd.opcode); ibmvscsi_timeout() 855 * @evt_struct: evt_struct to be sent 862 static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, ibmvscsi_send_srp_event() argument 866 __be64 *crq_as_u64 = (__be64 *)&evt_struct->crq; ibmvscsi_send_srp_event() 877 if (evt_struct->crq.format == VIOSRP_SRP_FORMAT) { ibmvscsi_send_srp_event() 892 evt_struct->iu.srp.login_req.opcode != SRP_LOGIN_REQ) ibmvscsi_send_srp_event() 899 evt_struct->iu.srp.cmd.opcode != SRP_TSK_MGMT) { ibmvscsi_send_srp_event() 920 *evt_struct->xfer_iu = evt_struct->iu; ibmvscsi_send_srp_event() 921 evt_struct->xfer_iu->srp.rsp.tag = (u64)evt_struct; ibmvscsi_send_srp_event() 927 list_add_tail(&evt_struct->list, &hostdata->sent); ibmvscsi_send_srp_event() 929 init_timer(&evt_struct->timer); ibmvscsi_send_srp_event() 931 evt_struct->timer.data = (unsigned long) evt_struct; ibmvscsi_send_srp_event() 932 evt_struct->timer.expires = jiffies + (timeout * HZ); ibmvscsi_send_srp_event() 933 evt_struct->timer.function = (void (*)(unsigned long))ibmvscsi_timeout; ibmvscsi_send_srp_event() 934 add_timer(&evt_struct->timer); ibmvscsi_send_srp_event() 940 list_del(&evt_struct->list); ibmvscsi_send_srp_event() 941 del_timer(&evt_struct->timer); ibmvscsi_send_srp_event() 962 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); ibmvscsi_send_srp_event() 964 free_event_struct(&hostdata->pool, evt_struct); ibmvscsi_send_srp_event() 970 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); ibmvscsi_send_srp_event() 972 if (evt_struct->cmnd != NULL) { ibmvscsi_send_srp_event() 973 evt_struct->cmnd->result = DID_ERROR << 16; ibmvscsi_send_srp_event() 974 evt_struct->cmnd_done(evt_struct->cmnd); ibmvscsi_send_srp_event() 975 } else if (evt_struct->done) ibmvscsi_send_srp_event() 976 evt_struct->done(evt_struct); ibmvscsi_send_srp_event() 978 free_event_struct(&hostdata->pool, evt_struct); ibmvscsi_send_srp_event() 984 * @evt_struct: srp_event_struct to be handled 989 static void handle_cmd_rsp(struct srp_event_struct *evt_struct) handle_cmd_rsp() argument 991 struct srp_rsp *rsp = &evt_struct->xfer_iu->srp.rsp; handle_cmd_rsp() 992 struct scsi_cmnd *cmnd = evt_struct->cmnd; handle_cmd_rsp() 996 dev_warn(evt_struct->hostdata->dev, handle_cmd_rsp() 1006 unmap_cmd_data(&evt_struct->iu.srp.cmd, handle_cmd_rsp() 1007 evt_struct, handle_cmd_rsp() 1008 evt_struct->hostdata->dev); handle_cmd_rsp() 1017 if (evt_struct->cmnd_done) handle_cmd_rsp() 1018 evt_struct->cmnd_done(cmnd); handle_cmd_rsp() 1040 struct srp_event_struct *evt_struct; ibmvscsi_queuecommand_lck() local 1047 evt_struct = get_event_struct(&hostdata->pool); ibmvscsi_queuecommand_lck() 1048 if (!evt_struct) ibmvscsi_queuecommand_lck() 1052 srp_cmd = &evt_struct->iu.srp.cmd; ibmvscsi_queuecommand_lck() 1058 if (!map_data_for_srp_cmd(cmnd, evt_struct, srp_cmd, hostdata->dev)) { ibmvscsi_queuecommand_lck() 1062 free_event_struct(&hostdata->pool, evt_struct); ibmvscsi_queuecommand_lck() 1066 init_event_struct(evt_struct, ibmvscsi_queuecommand_lck() 1071 evt_struct->cmnd = cmnd; ibmvscsi_queuecommand_lck() 1072 evt_struct->cmnd_done = done; ibmvscsi_queuecommand_lck() 1082 cpu_to_be64(be64_to_cpu(evt_struct->crq.IU_data_ptr) + ibmvscsi_queuecommand_lck() 1087 return ibmvscsi_send_srp_event(evt_struct, hostdata, 0); ibmvscsi_queuecommand_lck() 1145 * @evt_struct: srp_event_struct with the response 1150 static void login_rsp(struct srp_event_struct *evt_struct) login_rsp() argument 1152 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata; login_rsp() 1153 switch (evt_struct->xfer_iu->srp.login_rsp.opcode) { login_rsp() 1158 evt_struct->xfer_iu->srp.login_rej.reason); login_rsp() 1164 evt_struct->xfer_iu->srp.login_rsp.opcode); login_rsp() 1178 be32_to_cpu(evt_struct->xfer_iu->srp.login_rsp.req_lim_delta)); login_rsp() 1195 struct srp_event_struct *evt_struct = get_event_struct(&hostdata->pool); send_srp_login() local 1197 BUG_ON(!evt_struct); send_srp_login() 1198 init_event_struct(evt_struct, login_rsp, send_srp_login() 1201 login = &evt_struct->iu.srp.login_req; send_srp_login() 1215 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, login_timeout * 2); send_srp_login() 1223 * @evt_struct: srp_event_struct with the response 1227 static void capabilities_rsp(struct srp_event_struct *evt_struct) capabilities_rsp() argument 1229 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata; capabilities_rsp() 1231 if (evt_struct->xfer_iu->mad.capabilities.common.status) { capabilities_rsp() 1233 evt_struct->xfer_iu->mad.capabilities.common.status); capabilities_rsp() 1259 struct srp_event_struct *evt_struct; send_mad_capabilities() local 1264 evt_struct = get_event_struct(&hostdata->pool); send_mad_capabilities() 1265 BUG_ON(!evt_struct); send_mad_capabilities() 1267 init_event_struct(evt_struct, capabilities_rsp, send_mad_capabilities() 1270 req = &evt_struct->iu.mad.capabilities; send_mad_capabilities() 1313 if (ibmvscsi_send_srp_event(evt_struct, hostdata, info_timeout * 2)) send_mad_capabilities() 1320 * @evt_struct: srp_event_struct with the response 1325 static void fast_fail_rsp(struct srp_event_struct *evt_struct) fast_fail_rsp() argument 1327 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata; fast_fail_rsp() 1328 u16 status = be16_to_cpu(evt_struct->xfer_iu->mad.fast_fail.common.status); fast_fail_rsp() 1351 struct srp_event_struct *evt_struct; enable_fast_fail() local 1358 evt_struct = get_event_struct(&hostdata->pool); enable_fast_fail() 1359 BUG_ON(!evt_struct); enable_fast_fail() 1361 init_event_struct(evt_struct, fast_fail_rsp, VIOSRP_MAD_FORMAT, info_timeout); enable_fast_fail() 1363 fast_fail_mad = &evt_struct->iu.mad.fast_fail; enable_fast_fail() 1369 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, info_timeout * 2); enable_fast_fail() 1376 * @evt_struct: srp_event_struct with the response 1381 static void adapter_info_rsp(struct srp_event_struct *evt_struct) adapter_info_rsp() argument 1383 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata; adapter_info_rsp() 1385 if (evt_struct->xfer_iu->mad.adapter_info.common.status) { adapter_info_rsp() 1387 evt_struct->xfer_iu->mad.adapter_info.common.status); adapter_info_rsp() 1431 struct srp_event_struct *evt_struct; send_mad_adapter_info() local 1434 evt_struct = get_event_struct(&hostdata->pool); send_mad_adapter_info() 1435 BUG_ON(!evt_struct); send_mad_adapter_info() 1437 init_event_struct(evt_struct, send_mad_adapter_info() 1442 req = &evt_struct->iu.mad.adapter_info; send_mad_adapter_info() 1450 if (ibmvscsi_send_srp_event(evt_struct, hostdata, info_timeout * 2)) send_mad_adapter_info() 1466 * Note that after returning from this call, the evt_struct is freed. 1467 * the caller waiting on this completion shouldn't touch the evt_struct 1470 static void sync_completion(struct srp_event_struct *evt_struct) sync_completion() argument 1473 if (evt_struct->sync_srp) sync_completion() 1474 *evt_struct->sync_srp = *evt_struct->xfer_iu; sync_completion() 1476 complete(&evt_struct->comp); sync_completion() 1767 struct srp_event_struct *evt_struct = ibmvscsi_handle_crq() local 1822 if (!valid_event_struct(&hostdata->pool, evt_struct)) { ibmvscsi_handle_crq() 1824 evt_struct); ibmvscsi_handle_crq() 1828 if (atomic_read(&evt_struct->free)) { ibmvscsi_handle_crq() 1830 evt_struct); ibmvscsi_handle_crq() 1835 atomic_add(be32_to_cpu(evt_struct->xfer_iu->srp.rsp.req_lim_delta), ibmvscsi_handle_crq() 1838 del_timer(&evt_struct->timer); ibmvscsi_handle_crq() 1840 if ((crq->status != VIOSRP_OK && crq->status != VIOSRP_OK2) && evt_struct->cmnd) ibmvscsi_handle_crq() 1841 evt_struct->cmnd->result = DID_ERROR << 16; ibmvscsi_handle_crq() 1842 if (evt_struct->done) ibmvscsi_handle_crq() 1843 evt_struct->done(evt_struct); ibmvscsi_handle_crq() 1851 spin_lock_irqsave(evt_struct->hostdata->host->host_lock, flags); ibmvscsi_handle_crq() 1852 list_del(&evt_struct->list); ibmvscsi_handle_crq() 1853 free_event_struct(&evt_struct->hostdata->pool, evt_struct); ibmvscsi_handle_crq() 1854 spin_unlock_irqrestore(evt_struct->hostdata->host->host_lock, flags); ibmvscsi_handle_crq() 1865 struct srp_event_struct *evt_struct; ibmvscsi_do_host_config() local 1870 evt_struct = get_event_struct(&hostdata->pool); ibmvscsi_do_host_config() 1871 if (!evt_struct) { ibmvscsi_do_host_config() 1876 init_event_struct(evt_struct, ibmvscsi_do_host_config() 1881 host_config = &evt_struct->iu.mad.host_config; ibmvscsi_do_host_config() 1896 free_event_struct(&hostdata->pool, evt_struct); ibmvscsi_do_host_config() 1902 init_completion(&evt_struct->comp); ibmvscsi_do_host_config() 1904 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, info_timeout * 2); ibmvscsi_do_host_config() 1907 wait_for_completion(&evt_struct->comp); ibmvscsi_do_host_config() 648 unmap_cmd_data(struct srp_cmd *cmd, struct srp_event_struct *evt_struct, struct device *dev) unmap_cmd_data() argument 690 map_sg_data(struct scsi_cmnd *cmd, struct srp_event_struct *evt_struct, struct srp_cmd *srp_cmd, struct device *dev) map_sg_data() argument 764 map_data_for_srp_cmd(struct scsi_cmnd *cmd, struct srp_event_struct *evt_struct, struct srp_cmd *srp_cmd, struct device *dev) map_data_for_srp_cmd() argument
|