From owner-freebsd-scsi Sun Mar 21 18: 7:35 1999 Delivered-To: freebsd-scsi@freebsd.org Received: from panzer.plutotech.com (panzer.plutotech.com [206.168.67.125]) by hub.freebsd.org (Postfix) with ESMTP id 44F9D15220 for ; Sun, 21 Mar 1999 18:05:55 -0800 (PST) (envelope-from ken@panzer.plutotech.com) Received: (from ken@localhost) by panzer.plutotech.com (8.9.3/8.8.5) id TAA63565; Sun, 21 Mar 1999 19:05:33 -0700 (MST) From: "Kenneth D. Merry" Message-Id: <199903220205.TAA63565@panzer.plutotech.com> Subject: Re: CAM entry point for SCSI-to-Ethernet device. In-Reply-To: from "Matthew N. Dodd" at "Mar 21, 1999 8:12:33 pm" To: winter@jurai.net (Matthew N. Dodd) Date: Sun, 21 Mar 1999 19:05:33 -0700 (MST) Cc: gibbs@pluto.plutotech.com, scsi@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL43 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Matthew N. Dodd wrote... > 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. That sounds reasonable, I suppose. I guess you should call xpt_schedule() once for each transaction you need to send. > 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. I'll show my ignorance about network drivers here... It looks/sounds like you can get multiple packets per invocation of se_if_start(). Each packet consists of one or more mbufs. You then cram the mbufs into one big buffer, that you have allocated, per packet. I think it might be better to wait until you have a CCB to send the buffer in before freeing the mbufs. It seems like it might be fairly easy for the system to queue lots of packets to the interface, and for you to fall behind in sending them. You may want to queue the *mbufs*, then schedule yourself for a CCB. In your CAM start() routine, you can grab one of your TX buffer(s), copy the data in, setup the CCB and xpt_action() the CCB. Does this thing support tagged queueing? You didn't include the transfer negotiation line in the dmesg output in your previous message. If it doesn't support tagged queueing, it will make things much easier, since you'll only have to have one transmit buffer to copy things into. (You'll only be able to have one oustanding transaction at a time.) I suppose this is a unique device, since you need driver-local storage space to put transactions in. > I'll talk about the receive routine once I've got a good understanding of > the flow of the TX routines. I'm curious to hear about the receive end of things. Unless this thing can act as an initiator as well as a target (and your HBA can do both as well), you'll have to be polling for incoming packets one way or another. > Thanks for the patience. The learning curve on CAM isn't as bad as I > thought but its still not cake either. Yeah, it isn't too bad. It'll eventually all make sense, you just have to understand what the various functions do. Ken -- Kenneth Merry ken@plutotech.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message