Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 01 Mar 2000 13:26:48 +0530
From:      Nanda Kumar <nanda@procsys.com>
To:        Mike Smith <msmith@freebsd.org>
Cc:        freebsd-scsi@FreeBSD.ORG
Subject:   Re: IOCTL support in SCSI block driver
Message-ID:  <38BCCD40.355A@procsys.com>
References:  <200003010544.VAA03274@mass.cdrom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

>Mike Smith wrote:
> 
> > 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?
> 

Our RAID device takes SCSI commands. Typically the parameters passed to
the firmware includes SCSI CDB,path id,target id,LUN number,data
direction flag,SCSI tag queing attribute,data buffer pointers etc.
Status returned consists of SCSI status and sense information.

But my driver should also handle the IOCTL support for proprietary
communication which will be used by a JAVA based Array Manager program
for the purpose of getting statistics and configuring the card. Can i
pass IOCTLs directly to the HAB SCSI CAM driver ? 

I want to avoid writing another character driver just for the sake of
IOCTL handling we could do this in Linux and Windows NT.

> > 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,
Nandan


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?38BCCD40.355A>