Changeset View
Changeset View
Standalone View
Standalone View
head/sys/cam/cam_xpt.c
Show First 20 Lines • Show All 3,305 Lines • ▼ Show 20 Lines | while ((devq->send_queue.entries > 0) | ||||
* Device queues can be shared among multiple SIM instances | * Device queues can be shared among multiple SIM instances | ||||
* that reside on different busses. Use the SIM from the | * that reside on different busses. Use the SIM from the | ||||
* queued device, rather than the one from the calling bus. | * queued device, rather than the one from the calling bus. | ||||
*/ | */ | ||||
sim = device->sim; | sim = device->sim; | ||||
lock = (mtx_owned(sim->mtx) == 0); | lock = (mtx_owned(sim->mtx) == 0); | ||||
if (lock) | if (lock) | ||||
CAM_SIM_LOCK(sim); | CAM_SIM_LOCK(sim); | ||||
work_ccb->ccb_h.qos.sim_data = sbinuptime(); // xxx uintprt_t too small 32bit platforms | |||||
(*(sim->sim_action))(sim, work_ccb); | (*(sim->sim_action))(sim, work_ccb); | ||||
if (lock) | if (lock) | ||||
CAM_SIM_UNLOCK(sim); | CAM_SIM_UNLOCK(sim); | ||||
mtx_lock(&devq->send_mtx); | mtx_lock(&devq->send_mtx); | ||||
} | } | ||||
devq->send_queue.qfrozen_cnt--; | devq->send_queue.qfrozen_cnt--; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,112 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct cam_doneq *queue; | struct cam_doneq *queue; | ||||
int run, hash; | int run, hash; | ||||
CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_done\n")); | CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_done\n")); | ||||
if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) == 0) | if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) == 0) | ||||
return; | return; | ||||
/* Store the time the ccb was in the sim */ | |||||
done_ccb->ccb_h.qos.sim_data = sbinuptime() - done_ccb->ccb_h.qos.sim_data; | |||||
hash = (done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id + | hash = (done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id + | ||||
done_ccb->ccb_h.target_lun) % cam_num_doneqs; | done_ccb->ccb_h.target_lun) % cam_num_doneqs; | ||||
queue = &cam_doneqs[hash]; | queue = &cam_doneqs[hash]; | ||||
mtx_lock(&queue->cam_doneq_mtx); | mtx_lock(&queue->cam_doneq_mtx); | ||||
run = (queue->cam_doneq_sleep && STAILQ_EMPTY(&queue->cam_doneq)); | run = (queue->cam_doneq_sleep && STAILQ_EMPTY(&queue->cam_doneq)); | ||||
STAILQ_INSERT_TAIL(&queue->cam_doneq, &done_ccb->ccb_h, sim_links.stqe); | STAILQ_INSERT_TAIL(&queue->cam_doneq, &done_ccb->ccb_h, sim_links.stqe); | ||||
done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; | done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; | ||||
mtx_unlock(&queue->cam_doneq_mtx); | mtx_unlock(&queue->cam_doneq_mtx); | ||||
if (run) | if (run) | ||||
wakeup(&queue->cam_doneq); | wakeup(&queue->cam_doneq); | ||||
} | } | ||||
void | void | ||||
xpt_done_direct(union ccb *done_ccb) | xpt_done_direct(union ccb *done_ccb) | ||||
{ | { | ||||
CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_done_direct\n")); | CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_done_direct\n")); | ||||
if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) == 0) | if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) == 0) | ||||
return; | return; | ||||
/* Store the time the ccb was in the sim */ | |||||
done_ccb->ccb_h.qos.sim_data = sbinuptime() - done_ccb->ccb_h.qos.sim_data; | |||||
xpt_done_process(&done_ccb->ccb_h); | xpt_done_process(&done_ccb->ccb_h); | ||||
} | } | ||||
union ccb * | union ccb * | ||||
xpt_alloc_ccb() | xpt_alloc_ccb() | ||||
{ | { | ||||
union ccb *new_ccb; | union ccb *new_ccb; | ||||
▲ Show 20 Lines • Show All 824 Lines • Show Last 20 Lines |