Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Oct 2012 16:32:03 -0600
From:      "Kenneth D. Merry" <ken@freebsd.org>
To:        Jack <jacks.1785@gmail.com>
Cc:        freebsd-scsi@freebsd.org
Subject:   Re: passstart() and immediate CCBs
Message-ID:  <20121012223203.GA68975@nargothrond.kdm.org>
In-Reply-To: <CACmXQA141ZTRDd7DxfM41hd4idDg_uQ7%2BsWc4cZ8E%2B3aLoDJRg@mail.gmail.com>
References:  <CACmXQA141ZTRDd7DxfM41hd4idDg_uQ7%2BsWc4cZ8E%2B3aLoDJRg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@FreeBSD.ORG



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121012223203.GA68975>