linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Maier <maier@linux.vnet.ibm.com>
To: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Cc: Neerav Parikh <neerav.parikh@intel.com>,
	Ross Brattain <ross.b.brattain@intel.com>,
	Robert Love <robert.w.love@intel.com>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	Martin Peschke <mpeschke@linux.vnet.ibm.com>,
	Daniel Hansel <daniel.hansel@linux.vnet.ibm.com>
Subject: FC_PORTSPEED semantics confusion and zfcp regression
Date: Thu, 09 Aug 2012 18:15:02 +0200	[thread overview]
Message-ID: <5023E206.2080104@linux.vnet.ibm.com> (raw)

Earlier, commit
1832a5862f2e1b4e5835611ee14bc30a8ed3cad5
"[SCSI] change port speed definitions for scsi_transport_fc"
changed the semantics of FC_PORTSPEED defines to match the Report Port 
Speed Capabilities (RPSC) ELS of FC-GS/FS-LS instead of FC-HBA/SM-HBA. 
It also mentions the problem that FC-HBA/SM-HBA and FC-GS/FC-LS contain 
somewhat contradicting bit definitions for port speed.

Lately, commit
a9277e7783651d4e0a849f7988340b1c1cf748a4
"[SCSI] scsi_transport_fc: Getting FC Port Speed in sync with FC-GS"
reverted this.
(See also http://marc.info/?l=linux-scsi&m=132892310322550&w=2.)

However, there does not seem to be an explicit explanation of this.
While the source code comment of struct fc_host_attrs says its fields 
adhere to HBAAPI 2.0, the comment of the FC_PORTSPEED defines does not 
explicitly do so and a (new) user of the latter might not see the 
relation to the structure fields, esp. since there is no obvious 
relation in terms of C types other than being type compatible to a 
generic int.
The commit message also does not say so but mentions SM-HBA along with 
FC-GS without stating that they contradict themselves and FS-GS even 
within the same document since it defines both RPSC ELS and FDMI port 
attributes.

1) Is this change of semantics deliberate?

The commit message of a9277e7 states that user space is not affected 
since it only sees text strings in the corresponding sysfs attributes.

Actually, commit c3d2350a8420dbf9d48f5f8a0fb72117bfcbc1b0
"[SCSI] fc_transport: update potential link speeds"
deliberately decided against syncing the bit definitions because of a 
potential binary-incompatibility.

Is there some use of the bit definition that is not as transparent as 
the text string based sysfs interface of an fc_host? E.g. using 
scsi_transport_fc.h in user space libraries or applications (if this is 
even allowed to be exported to user space)? I could find an in-kernel 
binary use in libfc/fc_lport.c which could alternatively do a conversion 
between the old RPSC ELS format of fc_host_{supported_}speed{s}() (and 
libfc/fc_lport.c which has probably the same format as fc_host) when 
building the FDMI blob in scsi/fc_encode.h:fc_ct_ms_fill()?

2) Why did commit a9277e7 change the kernel internal bit definitions?

The zfcp LLDD has been copying the supported speeds value directly from 
what is reported by the HBA since the latter adheres to the RPSC ELS 
format for line speeds. Since commit a9277e7 this is broken now and we 
see 10 Gbit instead of 4 Gbit in the supported_speeds sysfs attribute of 
the fc_host. I don't mind converting zfcp to an explicit finite bit 
conversion based on individually defined constants, esp. since all other 
FC LLDDs (qla2xxx, bfa, lpfc, ibmvscsi, fnic, mptfc) seem to do so 
already. The only slight drawback I can see is that the code needs to be 
touched for new HBA generations supporting new port speeds.

3) Should we have port speed defines for both RPSC ELS (in 
include/fc/fc_els.h?) and FDMI port attributes (in 
include/scsi/scsi_transport_fc.h? unless the bit semantic change gets 
reverted)?

This way I could reuse the former to convert to the latter within zfcp 
and other users can reuse it with regard to RPSC ELS. I would send a 
patch if we agree on this.

4) Either way, should the port speed defines indicate RPSC ELS vs. FDMI 
more explicitly in their identifier names, in order to avoid future 
confusion?

Regards,
Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2012-08-09 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-09 16:15 Steffen Maier [this message]
2012-08-09 19:29 ` FC_PORTSPEED semantics confusion and zfcp regression Parikh, Neerav
2012-08-13 17:17   ` Steffen Maier

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=5023E206.2080104@linux.vnet.ibm.com \
    --to=maier@linux.vnet.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=daniel.hansel@linux.vnet.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mpeschke@linux.vnet.ibm.com \
    --cc=neerav.parikh@intel.com \
    --cc=robert.w.love@intel.com \
    --cc=ross.b.brattain@intel.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;
as well as URLs for NNTP newsgroup(s).