public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Luben Tuikov <ltuikov@yahoo.com>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Swen Schillig <swen@vnet.ibm.com>, Hannes Reinecke <hare@suse.de>,
	James Bottomley <James.Bottomley@steeleye.com>,
	Mike Anderson <andmike@us.ibm.com>,
	Christof Schmitt <christof.schmitt@de.ibm.com>,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH] zfcp: Report FCP LUN to SCSI midlayer
Date: Sat, 30 Jun 2007 12:07:29 -0700 (PDT)	[thread overview]
Message-ID: <712635.96237.qm@web31801.mail.mud.yahoo.com> (raw)
In-Reply-To: <4683D68B.5080702@s5r6.in-berlin.de>

--- Stefan Richter <stefanr@s5r6.in-berlin.de> wrote:
> How about:
> 
> union scsi_lun {
> 	__u8	lun[8];
> 	__be64	lun64;
> 	__be16	lun16;
> };

I'd rather not even hint that a LUN is to be viewed
as anything integer-like.  Just use u8[8] aligned.

(I.e. it is u64 only at the time when printing it,
but no one really needs to know this. It is u8[8].
Not sure why this is hard to understand.)
 
> There are two things to consider:
>   - Is ->target representing a Target Device?  Then it could have more
>     than one port, each one with a different identifier.  Or is it
>     representing a Target Port?  Or is it representing a Target Device
>     with the twist that we instantiate as many ->target objects as the
>     device is showing ports to us?

Target port.  SCSI Core has no business in multi-pathing.  MP is another
layer on top of SCSI.

>   - If the identifier is stored in ->target, and is an object known to
>     mid-layer, then we need a datatype for ->target->tpid which is
>     flexible enough for all flavors of TPID.

This isn't object oriented.  See below.

> So, if tpid ends up in objects seen by mid-layer, the datatype of ->tpid
> could be either
> 
>     __u8 target_port_identifier[233];  /* enough for all */
> 
> or
>     __u8 target_port_identifier[0];  /* variable length */
> 
> or
>     struct scsi_target_port_identifier {
> 	enum transport_protocol {
> 		SCSI_TRANSPORT_UNKNOWN = 0,
> 		SCSI_TRANSPORT_SPI,
> 		SCSI_TRANSPORT_FCP,
> 		SCSI_TRANSPORT_SRP,
> 		SCSI_TRANSPORT_ISCSI,
> 		SCSI_TRANSPORT_SBP,
> 		SCSI_TRANSPORT_SAS,
> 	} format;
> 	union {
> 		unsigned spi_tpid:4;
> 
> 		__u8 fcp_tpid[3];  /* or __be32 fcp_tpid:24; ? */
> 
> 		struct {
> 			__be64 eui64;
> 			__be64 extension;
> 		} srp_tpid;
> 
> 		struct {
> 			__u8 name[224];
> 			__32 tpgt;
> 		} iscsi_tpid;
> 
> 		struct {
> 			__be64 eui64;
> 			__be32 directory_id:24;
> 			/* SAM calls this mistakenly "Discovery ID" */
> 		} sbp_tpid;
> 
> 		__be64 sas_tpid;

Is it possible to stop with the u64 and its derivatives?
__u8 sas_tpid[8] __aligned(8) would do just fine.

> 	} value;
>     };
> 
> or something else.

Neither. Inevitably a SCSI Core representation of a target
port would contain a transport's layer opaque token (void* for
example). That opaque token uniquely identifes a target's
representation in the transport layer (target port), whose
structure stores the tpid in protocol dependent form.

SCSI Core gives you /dev/sdXYZ, that's all. It needs to get
out of knowing particulars of protocols.  This is the object
oriented approach.

> The former two require that print functions reside in transport layer
> implementations.  Note, the transport layer can easily make these print
> functions available to mid-layer so that mid-layer can print TPIDs too,
> without knowing what's in a TPID.  I.e. transport layer hands out string
> representations of TPIDs to mid-layer.

Something like that.

Imagine you could say in SCSI Core:
transport->printf("I see a problem with %T:%016llx\n", sdev->target-><name of opaque token>,
                   dev->LUN);

Where %T will be "filled" with the tpid after the opaque token has been
resolved by the transport protocol layer.

> The third variant allows to put the print function into mid-layer.

Sorry, no.

> Before you call it a heresy:  SAM says how many bits or bytes are in the

No, it does NOT.  The transport protocol does. SAM merely reproduces
this information, in an _Annex_, for informational purposes to the
reader. I.e. so that you don't have to hunt out the transport protocol
spec and search for it there yourself.

> identifiers, hence a generic SAM implementation can know how to print
> them.  It only doesn't know how the values get in there.

Hmm, this is a weak argument: "... know how to print... doesn't know
how the values get in there."

Ask yourself these questions: "What does SCSI Core provide?", "What should
SCSI Core provide?", "What should SCSI Core not provide?", "Why?".
Give good justifications to your answers.

    Luben



  reply	other threads:[~2007-06-30 19:07 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-19  8:25 [PATCH] zfcp: Report FCP LUN to SCSI midlayer Swen Schillig
2007-06-19  8:28 ` Hannes Reinecke
2007-06-19 12:19 ` Stefan Richter
2007-06-19 17:12 ` Christoph Hellwig
2007-06-20  2:46   ` James Bottomley
2007-06-21 15:03     ` Christof Schmitt
2007-06-21 16:46       ` Stefan Richter
2007-06-21 16:54         ` Stefan Richter
2007-06-22  1:41         ` James Bottomley
2007-06-22 19:01           ` Stefan Richter
2007-06-21 20:58       ` James Bottomley
2007-06-22  4:40         ` Mike Anderson
2007-06-22 11:34           ` Christof Schmitt
2007-06-22 14:11           ` James Bottomley
2007-06-22 16:16             ` Doug Maxey
2007-06-25 20:43               ` Luben Tuikov
2007-06-25 22:53                 ` Stefan Richter
2007-06-25 10:39             ` Swen Schillig
2007-06-25 14:03               ` Hannes Reinecke
2007-06-25 18:57                 ` Stefan Richter
2007-06-25 21:27                   ` Luben Tuikov
2007-06-25 21:55                     ` Stefan Richter
2007-06-26  0:35                       ` Luben Tuikov
2007-06-26 21:29                     ` Matthew Wilcox
2007-06-25 21:48                   ` James Bottomley
2007-06-25 22:27                     ` Stefan Richter
2007-06-26  1:04                       ` Luben Tuikov
2007-06-26 10:44                         ` Stefan Richter
2007-06-26 14:20                           ` James Bottomley
2007-06-26 15:47                             ` Stefan Richter
2007-06-26 17:01                               ` James Bottomley
2007-06-27  0:27                                 ` Stefan Richter
2007-06-27  0:45                                 ` [PATCH] SCSI: delete outdated comment in API reference Stefan Richter
2007-06-26  0:49                     ` [PATCH] zfcp: Report FCP LUN to SCSI midlayer Luben Tuikov
2007-06-26  9:38                       ` Stefan Richter
2007-06-27 10:27                 ` Swen Schillig
2007-06-28  4:21                   ` Luben Tuikov
2007-06-28 15:40                     ` Stefan Richter
2007-06-30 19:07                       ` Luben Tuikov [this message]
2007-06-30 21:26                         ` Stefan Richter
2007-07-01  6:27                           ` Luben Tuikov
2007-07-01 11:07                             ` Stefan Richter
2007-06-25 20:32             ` Luben Tuikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=712635.96237.qm@web31801.mail.mud.yahoo.com \
    --to=ltuikov@yahoo.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=andmike@us.ibm.com \
    --cc=christof.schmitt@de.ibm.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    --cc=swen@vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox