linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: Adaptec SAS integration notes
@ 2005-10-15 14:21 James.Smart
  2005-10-15 16:01 ` Stefan Richter
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: James.Smart @ 2005-10-15 14:21 UTC (permalink / raw)
  To: ltuikov, jgarzik, linux-scsi
  Cc: andmike, luben_tuikov, James.Bottomley, hch, linux-ide

Luben,

> > * Adaptec SAS abuses Scsi_Host_Template.  The host template 
> is a set of
> > ops for various layers, and it is fine as an interface.  No need to
> > avoid it.
> 
> Neither the Host Adapter, nor the FW, implements anything which has
> to do with the scsi host template.  What the Host Adapter 
> (the hardware) and
> the FW implement is access to the transport -- that' all.
> 
> So in effect the LLDD is _access to the (SAS) transport_. Cf. 
> the USB Storage
> code and SBP code.
> 
> Putting the host template back into the LLDD is a step 
> _backwards_, i.e.
> it's just a workaround, not a step forward.

This statement absolutely amazes me....

Your first comment "Host Adapter, nor the FW ..." is true of every
adapter.

The job of a Device Driver is to map between the interface presented
by the Host Adapter/FW and the interfaces of the host os. This is true
of whatever the technology is - SCSI, Ethernet, rs232, whatever.

As the current design of the scsi subsystem has SCSI-hba's attaching
via the host template - of course the LLDD will contain the host
template.

So - if you want to change this there are only 2 options:
A) Change the scsi subsystem LLDD interface
B) Work within the existing scsi subsystem hba interface

As this list has repeatedly stated:

If you choose to do A :
  As you are the one motivated for change, you better be able to 
    back it up by effort (aka the coding).

  The resulting work had better:
    Support the midlayer and above to the same extent that
      the existing LLDD interface does.
    Be extensible to other LLDDs.
      Minimally this means at least 2 LLDDs.
      In the best world, this means any LLDD, supporting any
        type of transport.
      And what better way to prove extensible than by providing
        an example!  (a 2nd LLDD)

  As this is "new" and unproven, expect this work to evolve 
    outside of the upstream kernel (in a parallel git tree).
    It integrates upstream only when it is generally accepted by
    the community that it meets the requirements of midlayer 
    support and extensibility.

If you choose B :
  You are free to partition the implementation of your driver
    in any way you want, which can include an upper "layer" that
    contains the host template, but no hardware/fw knowledge,
    leaving that for lower "layer".

  And if other drivers can reuse those layers - great.
  
  Two thoughts to remember though:
    This really is a driver implementation choice, not a mandated
      "Specification" choice.  It may or may not be, for various
      reasons, be based on an example in an external specification.

    Every layer in the driver makes an expectation on what can
      and cannot be done at that level. It is truth that
      different adapters will have hardware/FW interfaces with
      different capabilities. Not all adapters may align well with
      all layers. Thus, the best re-use scenario is one
      in which the layers are selectable, not all mandated.
    
    For it to become part of the upstream kernel, it must meet a
      "style" that is acceptable to the community, as you will not
      be the only one that will attempt to support the driver.


> Before we start messing with what you suggest above, SCSI Core has a
> _long_ way to go.
> 
> (BTW, we're already doing this.)

I assume from this statement, you are creating an implementation for A.


> You cannot care about "remote" ports -- some types of device have _no_
> port layer, as well you only care about the port "half" on your end.
> SAS is quite clear on that.

Not quite true - you actually care about the other "half" as well. In other
words, is it a SSP Target, etc.  If you start interacting (sending i/o)
with that other half - of course you care about it.  There are functional
levels that will care about phy's, and other functional levels that care
about ports.


> > * duplicates HCIL mapping code
> 
> True.  I've been meaning to remove that somehow, but calling
> scsi_scan_target() and passing HCIL to _it_ is also ugly.
> Ideally I'd like to see struct scsi_domain_device { ... }; in place.
> My comments in sas_discover.c and sas_scsi_host.c are pretty 
> clear on that.

Agreed. But this is another example of chosing option A or option B.


> Yeah, I agree with you: the political BS is just overflowing 
> and hitting
> the fan all the time.

IMHO - if you're going to ask for "specific" answers, replies, etc,
the best way to obtain that is to lead by example....  These words
provide no value.

> A true SAM layer would be *much* _smaller_ and would have a more
> straightforward path for tasks. (as does the SAS layer)

IMHO - rarely does expectations meet reality when you go to truly
make it work. Consider CAM and CAM-3, both are SAM-based scsi
core implementations. [granted, it all depends on where you set
your boundaries]

> > * Using scsi_scan_target() would allow us to use the normal LUN scan
> 
> Again not my code.  Normal LUN "scan" is done through REPORT LUNS
> as shown in sas_discover.c as I posted both functions to this list
> in a recent email.

FYI - in looking at SAS-1.1, I see nothing that describes LUN scanning.
What I do see are things that state "may be" a SCSI Domain or SCSI
Device - and use a general "see SAM-3" as a reference. No where
do I see the spec stating that a SCSI Device "shall" be a SCSI Device
as defined by SAM-3.

Example: please look at the definition of "SCSI Target Device" and
see if that definition could not apply to a SAM-1, or even a SCSI-2
device.

It should be evident what I'm highlighting. The spec is not as literal
as your convictions. It may not be appropriate to base things on the
literal assumptions.

> You don't see the _big_ picture: ...
> ...
> "Helper libs" makes the code ugly and spaghetti like.
> ...
> Look at the big picture and how the layers interact with each other.
> You need an _overall_ picture.

Initially, I wanted to reitterate the "lead by example" statement.
But quite frankly, the language used repeatedly in these threads with
people that do not have the same opinion as you is repulsive. In this
case it's a bit subtle, in others it has not been.

Jeff is a very smart individual, as are you, and many others on this list.
Please try to treat everyone with dignity and respect. There are many
many ways to phrase things.

-- james s

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Adaptec SAS integration notes
@ 2005-10-12 18:40 Jeff Garzik
  2005-10-12 18:55 ` Jeff Garzik
  2005-10-14 18:06 ` Luben Tuikov
  0 siblings, 2 replies; 16+ messages in thread
From: Jeff Garzik @ 2005-10-12 18:40 UTC (permalink / raw)
  To: linux-scsi
  Cc: Mike Anderson, Luben Tuikov, James Bottomley, Christoph Hellwig



So, I've been looking through Adaptec's SAS stuff, trying to figure
out how to best match it up with where the SCSI core currently is.
Here's the issues as best I can describe them, and proposed solutions.
Pending discussion of course, I hope to have a first cut of the
solutions sometime early next week.

Problems (with both Adaptec SAS and existing kernel)
--------
* Adaptec SAS abuses Scsi_Host_Template.  The host template is a set of
ops for various layers, and it is fine as an interface.  No need to
avoid it.

* Way too much glue between scsi_host and the rest of SAS.
sas_scsi_host.c is just the beginning.

* struct domain_device ultimately means "an RPC message destination",
and I'm not convinced it is a useful abstraction.  Further, if people
choose to introduce this abstraction, the implementation of such should
be far more widespread.

* Adaptec SAS could certainly integrate a bit with scsi_transport_sas...
not sure if full integration will work:

* scsi_transport_sas's sas_rphy_add() digs a bit too deep into
discovery.  I would prefer that libsas call scsi_scan_target() as it
makes connections.

* Given how low-level SAS wide ports are, it really feels like we should
be dealing with things at the SAS port level, not SAS phy level.

* Thought should be given to HBAs as RPC targets, since they have WWNs etc.

* very poor SATA interface

* not sure if SMP really needs a full blown block driver abstraction.
Christoph did some experiments and wasn't terribly pleased with what he
saw.  I can see his point.

* duplicates HCIL mapping code

* existing LUN scan should be fine, with maybe a few tiny tweaks

* Consider the problem of SAS vs. SATA, and both Adaptec SAS and libata
fighting over who's host struct to use.


Nice stuff (with both Adaptec SAS and existing kernel)
----------
* Overall, the Adaptec SAS code is pretty clean and easy to read

* Having ->lldd_execute_task() and similar hooks match closely with
the hardware behavior, so those are nice.

* Adaptec SAS transport is cleanly separated from the rest of things

* SCSI core already pretty much equates to SAM, even if there is plenty
of HCIL dependency in various places (HCIL should get marginalized,
as all agree)


Solutions
---------
* Similar to libata drivers, scsi-host-template should be in the LLDD,
even if it is filled with mostly generic helper calls.

* I would tend to prefer calling scsi_scan_target() from SAS discovery
code, rather than sas_rhy_add()

* Using scsi_scan_target() would allow us to use the normal LUN scan

* Avoid writing a separate SMP driver for now, and see how things
shake out with future SAS+SATA hardware.

* Put HCIL mapping into top-level helper code, for sharing between FC
and SAS (hopefully!)

* use existing struct scsi_lun where feasible

* LONG TERM: I wouldn't mind a small "scsi_rpc" helper lib
which provided execute_task() hook and other task mgmt functions.
Authors could choose to use that interface -- sitting just underneath
Scsi_Host_Template -- if their hardware closely matches the pure SAM
TMF model.  If hardware doesn't closely match, using this interface
will simply lead to a lot of glue/simulation code.  This gets the
hardware a bit closer to scsi_execute_req() etc.



Overall
-------
Not a _ton_ of work to integrate as I have described, but I may be
missing some pertinent details.



Comments welcome -- this is basically where I plan to start coding.




^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2005-10-18 20:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-15 14:21 Adaptec SAS integration notes James.Smart
2005-10-15 16:01 ` Stefan Richter
2005-10-18 15:06 ` Luben Tuikov
2005-10-18 16:12 ` Luben Tuikov
  -- strict thread matches above, loose matches on Subject: below --
2005-10-12 18:40 Jeff Garzik
2005-10-12 18:55 ` Jeff Garzik
2005-10-14 18:06 ` Luben Tuikov
2005-10-15 14:19   ` Stefan Richter
2005-10-16  1:05     ` Douglas Gilbert
2005-10-17  6:35       ` Stefan Richter
2005-10-18 16:44   ` Jeff Garzik
2005-10-18 19:30     ` Luben Tuikov
2005-10-18 20:16       ` Jeff Garzik
2005-10-18 20:55         ` Luben Tuikov
2005-10-18 20:36     ` Stefan Richter
2005-10-18 20:51       ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).