Lines Matching refs:evt_struct
577 * @evt_struct: The event
582 static void init_event_struct(struct srp_event_struct *evt_struct,
587 evt_struct->cmnd = NULL;
588 evt_struct->cmnd_done = NULL;
589 evt_struct->sync_srp = NULL;
590 evt_struct->crq.format = format;
591 evt_struct->crq.timeout = cpu_to_be16(timeout);
592 evt_struct->done = done;
634 * @evt_struct: the event
638 struct srp_event_struct *evt_struct,
649 if (evt_struct->cmnd)
650 scsi_dma_unmap(evt_struct->cmnd);
673 * @evt_struct: struct srp_event_struct to map
681 struct srp_event_struct *evt_struct,
719 if (!evt_struct->ext_list) {
720 evt_struct->ext_list = dma_alloc_coherent(dev,
722 &evt_struct->ext_list_token, 0);
723 if (!evt_struct->ext_list) {
733 total_length = map_sg_list(cmd, sg_mapped, evt_struct->ext_list);
736 indirect->table_desc.va = cpu_to_be64(evt_struct->ext_list_token);
739 memcpy(indirect->desc_list, evt_struct->ext_list,
747 * @evt_struct: struct srp_event_struct to map
755 struct srp_event_struct *evt_struct,
775 return map_sg_data(cmd, evt_struct, srp_cmd, dev);
848 struct srp_event_struct *evt_struct = from_timer(evt_struct, t, timer);
849 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata;
852 evt_struct->iu.srp.cmd.opcode);
863 * @evt_struct: evt_struct to be sent
870 static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
874 __be64 *crq_as_u64 = (__be64 *)&evt_struct->crq;
885 if (evt_struct->crq.format == VIOSRP_SRP_FORMAT) {
900 evt_struct->iu.srp.login_req.opcode != SRP_LOGIN_REQ)
907 evt_struct->iu.srp.cmd.opcode != SRP_TSK_MGMT) {
928 *evt_struct->xfer_iu = evt_struct->iu;
929 evt_struct->xfer_iu->srp.rsp.tag = (u64)evt_struct;
935 list_add_tail(&evt_struct->list, &hostdata->sent);
937 timer_setup(&evt_struct->timer, ibmvscsi_timeout, 0);
939 evt_struct->timer.expires = jiffies + (timeout * HZ);
940 add_timer(&evt_struct->timer);
946 list_del(&evt_struct->list);
947 del_timer(&evt_struct->timer);
968 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev);
970 free_event_struct(&hostdata->pool, evt_struct);
976 unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev);
978 if (evt_struct->cmnd != NULL) {
979 evt_struct->cmnd->result = DID_ERROR << 16;
980 evt_struct->cmnd_done(evt_struct->cmnd);
981 } else if (evt_struct->done)
982 evt_struct->done(evt_struct);
984 free_event_struct(&hostdata->pool, evt_struct);
990 * @evt_struct: srp_event_struct to be handled
995 static void handle_cmd_rsp(struct srp_event_struct *evt_struct)
997 struct srp_rsp *rsp = &evt_struct->xfer_iu->srp.rsp;
998 struct scsi_cmnd *cmnd = evt_struct->cmnd;
1002 dev_warn(evt_struct->hostdata->dev,
1012 unmap_cmd_data(&evt_struct->iu.srp.cmd,
1013 evt_struct,
1014 evt_struct->hostdata->dev);
1023 if (evt_struct->cmnd_done)
1024 evt_struct->cmnd_done(cmnd);
1046 struct srp_event_struct *evt_struct;
1053 evt_struct = get_event_struct(&hostdata->pool);
1054 if (!evt_struct)
1058 BUILD_BUG_ON(sizeof(evt_struct->iu.srp) != SRP_MAX_IU_LEN);
1059 memset(&evt_struct->iu.srp, 0x00, sizeof(evt_struct->iu.srp));
1060 srp_cmd = &evt_struct->iu.srp.cmd;
1065 if (!map_data_for_srp_cmd(cmnd, evt_struct, srp_cmd, hostdata->dev)) {
1069 free_event_struct(&hostdata->pool, evt_struct);
1073 init_event_struct(evt_struct,
1078 evt_struct->cmnd = cmnd;
1079 evt_struct->cmnd_done = done;
1089 cpu_to_be64(be64_to_cpu(evt_struct->crq.IU_data_ptr) +
1094 return ibmvscsi_send_srp_event(evt_struct, hostdata, 0);
1152 * @evt_struct: srp_event_struct with the response
1157 static void login_rsp(struct srp_event_struct *evt_struct)
1159 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata;
1160 switch (evt_struct->xfer_iu->srp.login_rsp.opcode) {
1165 evt_struct->xfer_iu->srp.login_rej.reason);
1171 evt_struct->xfer_iu->srp.login_rsp.opcode);
1185 be32_to_cpu(evt_struct->xfer_iu->srp.login_rsp.req_lim_delta));
1203 struct srp_event_struct *evt_struct = get_event_struct(&hostdata->pool);
1205 BUG_ON(!evt_struct);
1206 init_event_struct(evt_struct, login_rsp,
1209 login = &evt_struct->iu.srp.login_req;
1223 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, login_timeout * 2);
1231 * @evt_struct: srp_event_struct with the response
1235 static void capabilities_rsp(struct srp_event_struct *evt_struct)
1237 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata;
1239 if (evt_struct->xfer_iu->mad.capabilities.common.status) {
1241 evt_struct->xfer_iu->mad.capabilities.common.status);
1267 struct srp_event_struct *evt_struct;
1272 evt_struct = get_event_struct(&hostdata->pool);
1273 BUG_ON(!evt_struct);
1275 init_event_struct(evt_struct, capabilities_rsp,
1278 req = &evt_struct->iu.mad.capabilities;
1319 if (ibmvscsi_send_srp_event(evt_struct, hostdata, info_timeout * 2))
1326 * @evt_struct: srp_event_struct with the response
1331 static void fast_fail_rsp(struct srp_event_struct *evt_struct)
1333 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata;
1334 u16 status = be16_to_cpu(evt_struct->xfer_iu->mad.fast_fail.common.status);
1357 struct srp_event_struct *evt_struct;
1364 evt_struct = get_event_struct(&hostdata->pool);
1365 BUG_ON(!evt_struct);
1367 init_event_struct(evt_struct, fast_fail_rsp, VIOSRP_MAD_FORMAT, info_timeout);
1369 fast_fail_mad = &evt_struct->iu.mad.fast_fail;
1375 rc = ibmvscsi_send_srp_event(evt_struct, hostdata, info_timeout * 2);
1382 * @evt_struct: srp_event_struct with the response
1387 static void adapter_info_rsp(struct srp_event_struct *evt_struct)
1389 struct ibmvscsi_host_data *hostdata = evt_struct->hostdata;
1391 if (evt_struct->xfer_iu->mad.adapter_info.common.status) {
1393 evt_struct->xfer_iu->mad.adapter_info.common.status);
1437 struct srp_event_struct *evt_struct;
1440 evt_struct = get_event_struct(&hostdata->pool);
1441 BUG_ON(!evt_struct);
1443 init_event_struct(evt_struct,
1448 req = &evt_struct->iu.mad.adapter_info;
1456 if (ibmvscsi_send_srp_event(evt_struct, hostdata, info_timeout * 2))
1471 * Note that after returning from this call, the evt_struct is freed.
1472 * the caller waiting on this completion shouldn't touch the evt_struct
1475 static void sync_completion(struct srp_event_struct *evt_struct)
1478 if (evt_struct->sync_srp)
1479 *evt_struct->sync_srp = *evt_struct->xfer_iu;
1481 complete(&evt_struct->comp);
1772 struct srp_event_struct *evt_struct =
1827 if (!valid_event_struct(&hostdata->pool, evt_struct)) {
1829 evt_struct);
1833 if (atomic_read(&evt_struct->free)) {
1835 evt_struct);
1840 atomic_add(be32_to_cpu(evt_struct->xfer_iu->srp.rsp.req_lim_delta),
1843 del_timer(&evt_struct->timer);
1845 if ((crq->status != VIOSRP_OK && crq->status != VIOSRP_OK2) && evt_struct->cmnd)
1846 evt_struct->cmnd->result = DID_ERROR << 16;
1847 if (evt_struct->done)
1848 evt_struct->done(evt_struct);
1856 spin_lock_irqsave(evt_struct->hostdata->host->host_lock, flags);
1857 list_del(&evt_struct->list);
1858 free_event_struct(&evt_struct->hostdata->pool, evt_struct);
1859 spin_unlock_irqrestore(evt_struct->hostdata->host->host_lock, flags);