From owner-freebsd-scsi Thu Sep 5 9:57:40 2002 Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7124F37B400 for ; Thu, 5 Sep 2002 09:57:37 -0700 (PDT) Received: from catalepsy.pdl.cmu.edu (CATALEPSY.PDL.CMU.EDU [128.2.134.92]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD9B243E6E for ; Thu, 5 Sep 2002 09:57:36 -0700 (PDT) (envelope-from bucy@catalepsy.pdl.cmu.edu) Received: (from bucy@localhost) by catalepsy.pdl.cmu.edu (8.11.4/8.11.4) id g85GvY507532 for scsi@freebsd.org; Thu, 5 Sep 2002 12:57:34 -0400 Date: Thu, 5 Sep 2002 12:57:34 -0400 From: "John S. Bucy" To: scsi@freebsd.org Subject: Re: New scsi_target code Message-ID: <20020905165734.GE10500@catalepsy.pdl.cmu.edu> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Thu, Sep 05, 2002 at 01:54:08AM -0700, Nate Lawson wrote: > I have rewritten the scsi_target driver and usermode client with a much > simpler model suggested by Justin Gibbs. The kernel driver receives > commands in the form of CCBs via write(2) and returns completed CCBs to > usermode via read(2). The included sample client is much simpler as well, > implementing only RBC (simple hard drive command set). > > What is this useful for? It allows anyone with an HBA to emulate various > SCSI target devices for reverse engineering initiator implementations, > debugging, host-host communication, and many other uses. Because it > operates at the CAM layer, it should work with multiple transports > (parallel SCSI, FC, ...) > > Currently, the code works to the point of passing camcontrol rescan and a > few reads and writes with two Adaptec 2940U2Ws (ahc driver). However, > there is an unknown bug where after a few commands (even just TUR), the > target hangs after sending a CTIO and the initiator aborts the > command. As such, the code is ALPHA QUALITY and may hang your system. > > For more information, see the included README and manpages. Comments are > needed and appreciated. Cool! I've been working on this off and on on a research project at CMU. I believe that I've run into the same timeouts/hangs. I've wanted to use isp instead of ahc but the last time I tried it -- probably 6 months ago now -- I couldn't get isp to do target mode. I tried several different adaptec cards -- 2940UW/U2W/29160/etc -- and was never able to get rid of the timeouts. I don't remember right now but I think that there were one or two commands -- i.e. TUR -- that I handled in kernel rather than going down to userspace but I doubt that that extra latency is the cause of the timeouts.. Are you doing tagged queueing? I was in the midst of hacking on that when I got preempted to work on another project. I had sort of a hacked way of dealing with it; I pass the whole CDB through the ioctl and only pass bus-transfer data through read() and write(). I then added an ioctl to set the tag that the next read() or write() data transfer goes with and there's an array in the driver that keeps up with all of the outstanding commands. I'll be working on it again this fall and will definitely be interested in incorporating others' work with mine; my lab wants to release our code as soon as we think its stable enough to be useful to other research projects. john To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message