Lines Matching defs:tm

123 static int mpssas_send_abort(struct mps_softc *sc, struct mps_command *tm,
224 struct mps_command *tm;
226 tm = mps_alloc_high_priority_command(sc);
227 if (tm == NULL)
230 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
232 return tm;
236 mpssas_free_tm(struct mps_softc *sc, struct mps_command *tm)
240 if (tm == NULL)
248 if (tm->cm_targ != NULL) {
249 tm->cm_targ->flags &= ~MPSSAS_TARGET_INRESET;
250 target_id = tm->cm_targ->tid;
252 if (tm->cm_ccb) {
255 xpt_release_devq(tm->cm_ccb->ccb_h.path, 1, TRUE);
256 xpt_free_path(tm->cm_ccb->ccb_h.path);
257 xpt_free_ccb(tm->cm_ccb);
260 mps_free_high_priority_command(sc, tm);
350 mpssas_remove_volume(struct mps_softc *sc, struct mps_command *tm)
358 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
359 handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
360 targ = tm->cm_targ;
367 mpssas_free_tm(sc, tm);
380 mps_free_reply(sc, tm->cm_reply_data);
381 tm->cm_reply = NULL; /* Ensures the reply won't get re-freed */
394 targ = tm->cm_targ;
405 mpssas_free_tm(sc, tm);
417 struct mps_command *tm;
446 tm = mpssas_alloc_tm(sc);
447 if (tm == NULL) {
455 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
462 tm->cm_targ = targ;
463 tm->cm_data = NULL;
464 tm->cm_complete = mpssas_remove_volume;
465 tm->cm_complete_data = (void *)(uintptr_t)handle;
469 mpssas_prepare_for_tm(sc, tm, targ, CAM_LUN_WILDCARD);
471 mps_map_command(sc, tm);
535 mpssas_remove_device(struct mps_softc *sc, struct mps_command *tm)
544 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
545 handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
546 targ = tm->cm_targ;
553 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
556 "This should not happen!\n", __func__, tm->cm_flags,
565 mpssas_free_tm(sc, tm);
578 mps_free_reply(sc, tm->cm_reply_data);
579 tm->cm_reply = NULL; /* Ensures the reply won't get re-freed */
582 req = (MPI2_SAS_IOUNIT_CONTROL_REQUEST *)tm->cm_req;
587 tm->cm_data = NULL;
588 tm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
589 tm->cm_complete = mpssas_remove_complete;
590 tm->cm_complete_data = (void *)(uintptr_t)handle;
599 mps_map_command(sc, tm);
602 targ->pending_remove_tm = tm;
610 mpssas_remove_complete(struct mps_softc *sc, struct mps_command *tm)
619 reply = (MPI2_SAS_IOUNIT_CONTROL_REPLY *)tm->cm_reply;
620 handle = (uint16_t)(uintptr_t)tm->cm_complete_data;
621 targ = tm->cm_targ;
635 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
638 "This should not happen!\n", __func__, tm->cm_flags,
640 mpssas_free_tm(sc, tm);
648 mpssas_free_tm(sc, tm);
680 mpssas_free_tm(sc, tm);
1164 struct mps_command *tm = data;
1165 struct mps_softc *sc = tm->cm_sc;
1169 mpssas_log_command(tm, MPS_INFO|MPS_RECOVERY,
1170 "task mgmt %p timed out\n", tm);
1172 KASSERT(tm->cm_state == MPS_CM_STATE_INQUEUE,
1175 tm->cm_state = MPS_CM_STATE_BUSY;
1180 mpssas_logical_unit_reset_complete(struct mps_softc *sc, struct mps_command *tm)
1188 callout_stop(&tm->cm_callout);
1190 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
1191 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
1192 targ = tm->cm_targ;
1200 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
1203 "This should not happen!\n", __func__, tm->cm_flags);
1204 mpssas_free_tm(sc, tm);
1209 mps_dprint(sc, MPS_RECOVERY, "NULL reset reply for tm %p\n",
1210 tm);
1215 targ->tm = NULL;
1216 mpssas_free_tm(sc, tm);
1238 if (cm->cm_lun == tm->cm_lun)
1247 mpssas_announce_reset(sc, AC_SENT_BDR, targ->tid, tm->cm_lun);
1259 mpssas_send_abort(sc, tm, cm);
1261 targ->tm = NULL;
1262 mpssas_free_tm(sc, tm);
1274 mpssas_send_reset(sc, tm,
1280 mpssas_target_reset_complete(struct mps_softc *sc, struct mps_command *tm)
1286 callout_stop(&tm->cm_callout);
1288 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
1289 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
1290 targ = tm->cm_targ;
1297 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
1299 "This should not happen!\n", __func__, tm->cm_flags);
1300 mpssas_free_tm(sc, tm);
1306 "NULL target reset reply for tm %pi TaskMID %u\n",
1307 tm, le16toh(req->TaskMID));
1312 targ->tm = NULL;
1313 mpssas_free_tm(sc, tm);
1335 mpssas_announce_reset(sc, AC_SENT_BDR, tm->cm_targ->tid,
1338 targ->tm = NULL;
1339 mpssas_free_tm(sc, tm);
1357 mpssas_send_reset(struct mps_softc *sc, struct mps_command *tm, uint8_t type)
1363 target = tm->cm_targ;
1370 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
1376 MPS_SET_LUN(req->LUN, tm->cm_lun);
1377 tm->cm_targ->logical_unit_resets++;
1380 target->tid, tm->cm_lun);
1381 tm->cm_complete = mpssas_logical_unit_reset_complete;
1382 mpssas_prepare_for_tm(sc, tm, target, tm->cm_lun);
1389 tm->cm_targ->target_resets++;
1392 tm->cm_complete = mpssas_target_reset_complete;
1393 mpssas_prepare_for_tm(sc, tm, target, CAM_LUN_WILDCARD);
1399 tm->cm_data = NULL;
1400 tm->cm_complete_data = (void *)tm;
1402 callout_reset(&tm->cm_callout, MPS_RESET_TIMEOUT * hz,
1403 mpssas_tm_timeout, tm);
1405 err = mps_map_command(sc, tm);
1415 mpssas_abort_complete(struct mps_softc *sc, struct mps_command *tm)
1422 callout_stop(&tm->cm_callout);
1424 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
1425 reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
1426 targ = tm->cm_targ;
1433 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
1436 tm->cm_flags, tm, le16toh(req->TaskMID));
1437 mpssas_free_tm(sc, tm);
1443 "NULL abort reply for tm %p TaskMID %u\n",
1444 tm, le16toh(req->TaskMID));
1449 targ->tm = NULL;
1450 mpssas_free_tm(sc, tm);
1466 cm = TAILQ_FIRST(&tm->cm_targ->timedout_commands);
1475 targ->tm = NULL;
1476 mpssas_free_tm(sc, tm);
1482 mpssas_send_abort(sc, tm, cm);
1491 mpssas_send_reset(sc, tm,
1499 mpssas_send_abort(struct mps_softc *sc, struct mps_command *tm, struct mps_command *cm)
1516 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
1525 tm->cm_data = NULL;
1526 tm->cm_complete = mpssas_abort_complete;
1527 tm->cm_complete_data = (void *)tm;
1528 tm->cm_targ = cm->cm_targ;
1529 tm->cm_lun = cm->cm_lun;
1531 callout_reset(&tm->cm_callout, MPS_ABORT_TIMEOUT * hz,
1532 mpssas_tm_timeout, tm);
1536 mpssas_prepare_for_tm(sc, tm, targ, tm->cm_lun);
1538 err = mps_map_command(sc, tm);
1598 if (targ->tm != NULL) {
1603 "queued timedout cm %p for processing by tm %p\n",
1604 cm, targ->tm);
1605 } else if ((targ->tm = mpssas_alloc_tm(sc)) != NULL) {
1609 mps_dprint(sc, MPS_RECOVERY, "timedout cm %p allocated tm %p\n",
1610 cm, targ->tm);
1613 mpssas_send_abort(sc, targ->tm, cm);
1625 "timedout cm %p failed to allocate a tm\n", cm);
2031 } else if (cm->cm_targ->tm != NULL) {
3043 struct mps_command *tm;
3053 tm = mpssas_alloc_tm(sc);
3054 if (tm == NULL) {
3063 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
3070 tm->cm_data = NULL;
3071 tm->cm_complete = mpssas_resetdev_complete;
3072 tm->cm_complete_data = ccb;
3073 tm->cm_targ = targ;
3075 mpssas_prepare_for_tm(sc, tm, targ, CAM_LUN_WILDCARD);
3076 mps_map_command(sc, tm);
3080 mpssas_resetdev_complete(struct mps_softc *sc, struct mps_command *tm)
3088 resp = (MPI2_SCSI_TASK_MANAGE_REPLY *)tm->cm_reply;
3089 ccb = tm->cm_complete_data;
3096 if ((tm->cm_flags & MPS_CM_FLAGS_ERROR_MASK) != 0) {
3099 req = (MPI2_SCSI_TASK_MANAGE_REQUEST *)tm->cm_req;
3103 "This should not happen!\n", __func__, tm->cm_flags,
3115 mpssas_announce_reset(sc, AC_SENT_BDR, tm->cm_targ->tid,
3123 mpssas_free_tm(sc, tm);
3253 mpssas_prepare_for_tm(struct mps_softc *sc, struct mps_command *tm,
3266 tm->cm_ccb = ccb;
3267 tm->cm_targ = target;