cam_xpt.c (531c2d7af3cd2e64eec94aa1b19c4b2f16fce515) | cam_xpt.c (e4c9cba71ff03f0aa6daa924437208b29cffeb40) |
---|---|
1/*- 2 * Implementation of the Common Access Method Transport (XPT) layer. 3 * 4 * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs. 5 * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 41 unchanged lines hidden (view full) --- 50 51#include <sys/lock.h> 52#include <sys/mutex.h> 53#include <sys/sysctl.h> 54#include <sys/kthread.h> 55 56#include <cam/cam.h> 57#include <cam/cam_ccb.h> | 1/*- 2 * Implementation of the Common Access Method Transport (XPT) layer. 3 * 4 * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs. 5 * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 41 unchanged lines hidden (view full) --- 50 51#include <sys/lock.h> 52#include <sys/mutex.h> 53#include <sys/sysctl.h> 54#include <sys/kthread.h> 55 56#include <cam/cam.h> 57#include <cam/cam_ccb.h> |
58#include <cam/cam_iosched.h> |
|
58#include <cam/cam_periph.h> 59#include <cam/cam_queue.h> 60#include <cam/cam_sim.h> 61#include <cam/cam_xpt.h> 62#include <cam/cam_xpt_sim.h> 63#include <cam/cam_xpt_periph.h> 64#include <cam/cam_xpt_internal.h> 65#include <cam/cam_debug.h> --- 3423 unchanged lines hidden (view full) --- 3489 * queued device, rather than the one from the calling bus. 3490 */ 3491 sim = device->sim; 3492 mtx = sim->mtx; 3493 if (mtx && !mtx_owned(mtx)) 3494 mtx_lock(mtx); 3495 else 3496 mtx = NULL; | 59#include <cam/cam_periph.h> 60#include <cam/cam_queue.h> 61#include <cam/cam_sim.h> 62#include <cam/cam_xpt.h> 63#include <cam/cam_xpt_sim.h> 64#include <cam/cam_xpt_periph.h> 65#include <cam/cam_xpt_internal.h> 66#include <cam/cam_debug.h> --- 3423 unchanged lines hidden (view full) --- 3490 * queued device, rather than the one from the calling bus. 3491 */ 3492 sim = device->sim; 3493 mtx = sim->mtx; 3494 if (mtx && !mtx_owned(mtx)) 3495 mtx_lock(mtx); 3496 else 3497 mtx = NULL; |
3497 work_ccb->ccb_h.qos.sim_data = sbinuptime(); // xxx uintprt_t too small 32bit platforms | 3498 work_ccb->ccb_h.qos.periph_data = cam_iosched_now(); |
3498 (*(sim->sim_action))(sim, work_ccb); 3499 if (mtx) 3500 mtx_unlock(mtx); 3501 mtx_lock(&devq->send_mtx); 3502 } 3503 devq->send_queue.qfrozen_cnt--; 3504} 3505 --- 1130 unchanged lines hidden (view full) --- 4636 ("xpt_done: func= %#x %s status %#x\n", 4637 done_ccb->ccb_h.func_code, 4638 xpt_action_name(done_ccb->ccb_h.func_code), 4639 done_ccb->ccb_h.status)); 4640 if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) == 0) 4641 return; 4642 4643 /* Store the time the ccb was in the sim */ | 3499 (*(sim->sim_action))(sim, work_ccb); 3500 if (mtx) 3501 mtx_unlock(mtx); 3502 mtx_lock(&devq->send_mtx); 3503 } 3504 devq->send_queue.qfrozen_cnt--; 3505} 3506 --- 1130 unchanged lines hidden (view full) --- 4637 ("xpt_done: func= %#x %s status %#x\n", 4638 done_ccb->ccb_h.func_code, 4639 xpt_action_name(done_ccb->ccb_h.func_code), 4640 done_ccb->ccb_h.status)); 4641 if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) == 0) 4642 return; 4643 4644 /* Store the time the ccb was in the sim */ |
4644 done_ccb->ccb_h.qos.sim_data = sbinuptime() - done_ccb->ccb_h.qos.sim_data; | 4645 done_ccb->ccb_h.qos.periph_data = cam_iosched_delta_t(done_ccb->ccb_h.qos.periph_data); |
4645 hash = (done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id + 4646 done_ccb->ccb_h.target_lun) % cam_num_doneqs; 4647 queue = &cam_doneqs[hash]; 4648 mtx_lock(&queue->cam_doneq_mtx); 4649 run = (queue->cam_doneq_sleep && STAILQ_EMPTY(&queue->cam_doneq)); 4650 STAILQ_INSERT_TAIL(&queue->cam_doneq, &done_ccb->ccb_h, sim_links.stqe); 4651 done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; 4652 mtx_unlock(&queue->cam_doneq_mtx); --- 6 unchanged lines hidden (view full) --- 4659{ 4660 4661 CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, 4662 ("xpt_done_direct: status %#x\n", done_ccb->ccb_h.status)); 4663 if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) == 0) 4664 return; 4665 4666 /* Store the time the ccb was in the sim */ | 4646 hash = (done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id + 4647 done_ccb->ccb_h.target_lun) % cam_num_doneqs; 4648 queue = &cam_doneqs[hash]; 4649 mtx_lock(&queue->cam_doneq_mtx); 4650 run = (queue->cam_doneq_sleep && STAILQ_EMPTY(&queue->cam_doneq)); 4651 STAILQ_INSERT_TAIL(&queue->cam_doneq, &done_ccb->ccb_h, sim_links.stqe); 4652 done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; 4653 mtx_unlock(&queue->cam_doneq_mtx); --- 6 unchanged lines hidden (view full) --- 4660{ 4661 4662 CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, 4663 ("xpt_done_direct: status %#x\n", done_ccb->ccb_h.status)); 4664 if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) == 0) 4665 return; 4666 4667 /* Store the time the ccb was in the sim */ |
4667 done_ccb->ccb_h.qos.sim_data = sbinuptime() - done_ccb->ccb_h.qos.sim_data; | 4668 done_ccb->ccb_h.qos.periph_data = cam_iosched_delta_t(done_ccb->ccb_h.qos.periph_data); |
4668 xpt_done_process(&done_ccb->ccb_h); 4669} 4670 4671union ccb * 4672xpt_alloc_ccb() 4673{ 4674 union ccb *new_ccb; 4675 --- 904 unchanged lines hidden --- | 4669 xpt_done_process(&done_ccb->ccb_h); 4670} 4671 4672union ccb * 4673xpt_alloc_ccb() 4674{ 4675 union ccb *new_ccb; 4676 --- 904 unchanged lines hidden --- |