Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Feb 2000 21:44:25 -0800
From:      Mike Smith <msmith@freebsd.org>
To:        nanda@procsys.com
Cc:        freebsd-scsi@FreeBSD.ORG
Subject:   Re: IOCTL support in SCSI block driver 
Message-ID:  <200003010544.VAA03274@mass.cdrom.com>
In-Reply-To: Your message of "Tue, 29 Feb 2000 11:12:39 %2B0530." <38BB5C4F.7A9D@procsys.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Hi,
> 
> 
> >Mike Smith wrote:
> > 
> > > Hi,
> > >
> > > I had obtained some clarifications from you regarding writing a SCSI
> > > block driver. I have a few more questions ?
> > >
> > > 1). I want the SCSI block driver to support IOCTL's passed to that.
> > > Basically this is used to communicate with the firmware and get some
> > > statistics and also use some facilities like upgrading of firmware etc.
> > >
> > > 2). Is there anyway to write the SCSI block driver bypassing the CAM
> > > layer ? We are planning to write the device driver in 3.4 FreeBSD which
> > > is the stable version now.
> > 
> > >From these two questions, it's quite clear that your device should not be
> > using CAM for I/O.  Please take a few moments to look at how the Compaq
> > Smart Array, AMI MegaRAID and Mylex DAC960 drivers work; you'll discover
> > that you can achieve your goal with a lot less code and effort that way.
> 
> Actaully we were planning to write the SCSI block driver for FreeBSD
> version 3.4 (Now we are looking into 4.x after your suggestion) and i
> was going through the source code of the SCSI block device drivers of
> DPT,Qlogic and Adaptec. And i found that all of them are interfacing
> with the CAM layer. So i thaught all the SCSI block device drivers
> should interface with the CAM layer. Is this assumption true in FreeBSD
> 3.4 ?

No.  The key issue here, and one that you still haven't answered is: Does 
your RAID device take SCSI commands, or does it have a different 
interface?

> If we can bypass CAM and write a SCSI block driver which results with a
> lot of less code, then why someone has to write a driver which uses CAM
> interface ?

You use CAM if your device is or looks exactly like a SCSI device.  You do
not use CAM if your device is not a SCSI device.

> > To answer 1), look at the Mylex driver (sys/dev/mlx), which has a control
> > device (/dev/mlx) which handles per-controller ioctls as well as handling
> > per-device ioctls on the /dev/mlxd nodes.
> > 
> 
> I couldn't find these in FreeBSD 3.4 source code.

It's not in 3.4; try 4.0 or the CVS web interface at 
http://www.FreeBSD.org/cgi/cvsweb.cgi/src/sys/dev/mlx/

> > For 2), you should _definitely_ write for 4.x and backport.  Writing for
> > 3.x leaves you with a driver with no future, wheras developing for 4.x
> > means that you're already up to date with the current (soon to be stable)
> > release, and you won't have to bring your driver forwards at a later date.
> > 
> 
> Will the drivers changes significantly from 3.4 to 4.x ? So far i was
> seeing only the FreeBSD 3.4 drivers.

Yes, your driver will have to be fairly significantly modified for 4.x.  
If you write for 4.x to begin with, the process of backporting to 3.x is 
much easier.  The 4.x driver model also encourages better driver 
authoring technique, which is important if you intend to maintain your 
driver.

Regards,
-- 
\\ Give a man a fish, and you feed him for a day. \\  Mike Smith
\\ Tell him he should learn how to fish himself,  \\  msmith@freebsd.org
\\ and he'll hate you for a lifetime.             \\  msmith@cdrom.com




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?200003010544.VAA03274>