passstart() and immediate CCBs
Kenneth D. Merry
ken at freebsd.org
Fri Oct 12 22:32:05 UTC 2012
On Thu, Oct 11, 2012 at 12:13:27 +0530, Jack wrote:
> Hello all,
>
> I was going through cam subsystem source(FreeBSD RELEASE 9 ),
> and tried understanding how it works.
> One thing I got stuck is, when exactly is passtart() invoked in case of
> immediate CCBs. For non-immediate CCBs, it is quite clear to me.
>
> In case of scsi pass driver(scsi_pass.c), xpt_schedule() is invoked by
> cam_periph_getccb(), and cam_periph_ioctl().
> But not in case of immediate CCBs. In case of immediate CCBs,
> xpt_alloc_ccb_nowait() is invoked and then xpt_setup_ccb().
>
> Is it that in case of immediate CCBs, passstart() is never invoked?
That is correct. passstart() is only used for non-immediate CCBs.
> If it is true then, how does the thread awakens(which is slept by calling
> cam_periph_ccbwait() inside cam_periph_runccb() ) when HBA driver
> serves interrupt, and passdone() is invoked.
The thread never sleeps in the immediate case (because the status is changed
to something other than CAM_REQ_INPROG), and the done routine isn't called.
Immediate CCBs are complete when xpt_action() returns, so no callback is
needed.
> There seems no code inside passdone(), to wakeup the thread, the
> only code being inside PASS_CCB_WAITING case is not valid
> for immediate CCBs, as passstart() is never invoked so it didn't
> set ccb type to PASS_CCB_WAITING.
>
> Do immediate and immediate CCBs have any implications on
> cam priority assignment specified in CCB header?
Immediate CCBs never go down to the hardware. The priority mechanism is
used to help determine who gets queue slots, and those are only
needed for queued CCBs.
> It seems that concept of which queues are in existence in cam subsystem
> is not clear to me.
> ie beginning from cam_periph_runccb(), how passdone() is invoked,
> how passstart() is invoked if it is, and which queues are involved,
> especially in case of immediate CCBs.
>
>
> As far as I can get, there are at least 2 queues:
> one is maintained by SCSI HBA driver for I/O requests, the other is queue
> of CCBs maintained per cam peripheral( ie struct cam_peripheral) ?? or
> cam device (ie struct cam_ed) ?? at transport layer.
There is a queue per HBA, based on how many commands the HBA can handle,
and a queue per device (struct cam_ed), based on how many commands a
particular device can handle.
Ken
--
Kenneth Merry
ken at FreeBSD.ORG
More information about the freebsd-scsi
mailing list