Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Mar 1999 20:12:33 -0500 (EST)
From:      "Matthew N. Dodd" <winter@jurai.net>
To:        "Kenneth D. Merry" <ken@plutotech.com>
Cc:        gibbs@pluto.plutotech.com, scsi@FreeBSD.ORG
Subject:   Re: CAM entry point for SCSI-to-Ethernet device.
Message-ID:  <Pine.BSF.4.02.9903211958130.2158-100000@sasami.jurai.net>
In-Reply-To: <199903220047.RAA63051@panzer.plutotech.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 21 Mar 1999, Kenneth D. Merry wrote:
> Not necessarily.  That is one path that things can go in.  In a disk
> driver, for instance, the upper level code calls the strategy routine.
> Then the strategy routine schedules the peripheral driver to get a CCB.
> When a slot becomes available, the driver's start routine is called, the
> driver dequeues the I/O transaction, stuffs it into a CCB, and then calls
> xpt_action().
> 
> When the I/O is done, the transport layer calls the peripheral driver's
> done() routine with the completed CCB.
> 
> Another way to do things, if you have a process context (e.g., in your
> open(), ioctl(), and close() routines) is to use cam_periph_getccb() to get
> a CCB, and then run cam_periph_ccbwait() to wait for it to complete.  The
> passthrough driver uses that strategy, as does the CD driver in its ioctl
> routines.
> 
> The changer driver does most of its I/O via its ioctl routine.  It only
> uses the start/done routines on probe.

Humm...

Let me tell you what I'm trying to do and how I think I need to go about
doing it and you guys can tell me if I've got an incomplete understanding
of how things work. (simple port... not!)

Sending a packet:

	The network layer calls ifp->if_start, which in my case is a
	routeine called 'se_if_start'.

	se_if_start() loops on IF_DEQUEUE() if the interface is currently
	up and not already IFF_OACTIVE.

	For each packet I aggregate the data into an linear tx buffer if
	it setup a ether_send CCB and somehow schedule it to be run (its
	not important that it be run 'now')  This is the bit I'm fuzzy on.
	I can hang the aggregated buffers (1 per packet) off of a softc
	queue and xpt_schedule() myself and setup the CCBs in my
	se_cam_start() routine, issuing xpt_schedule()'s until there are
	not more tx buffers in the queue.

	Once the scsi ether_send CCBs complete I can free the tx buffers
	(having alread freed the mbufs the system passed the packetes to
	me in se_if_start()) or I can add them back to the queue and
	reschedule a transmit if the command failed.

Is this the correct way to do things?

I'll talk about the receive routine once I've got a good understanding of
the flow of the TX routines.

Thanks for the patience.  The learning curve on CAM isn't as bad as I
thought but its still not cake either.

-- 
| Matthew N. Dodd  | 78 280Z | 75 164E | 84 245DL | FreeBSD/NetBSD/Sprite/VMS |
| winter@jurai.net |      This Space For Rent     | ix86,sparc,m68k,pmax,vax  |
| http://www.jurai.net/~winter | Are you k-rad elite enough for my webpage?   |



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.02.9903211958130.2158-100000>