On 7/27/2012 4:57 PM, Zou, Yi wrote:

On 12-07-27 12:48 PM, Andy Grover wrote:
Hi, I'm working on improving rtslib, the userspace configuration library
for the LIO kernel target and tcm_fc fcoe fabric module.

We are getting valid WWNs for both qla2xxx and tcm_fc fabrics by looking
at /sys/class/fc_host/host*/port_name, therefore on a system with both,
rtslib would report all wwns as valid for both fabrics, which might lead
to a bad user experience.

Is there a good way in sysfs to tell fcoe hosts from fc hosts?


I have another thought that I don't think helps you, but I want to get
it out there since you were looking at port names...

There are some Ethernet adapters that build their WWNN (node_name) and
WWPN (port_name) from their MAC address. The function that does this in
the kernel is fcoe_wwn_from_mac. The routine is exported by libfcoe and
used by fcoe.ko, unless the Ethernet adapter provides the WWNN/WWPN, and
by bnx2fc.

agree with all, except that bnx2fc driver also uses ndo hook to obtain its own WWNN/WWPN provided by the adapter, if it provides. Otherwise, it builds it from MAC address as described above.


There was a comment in the code that was removed (and should probably be
re-added) that Yi helped me track down. It said,

+ /*
+ * Use NAA 1&2 (FC-FS Rev. 2.0, Sec. 15) to generate WWNN/WWPN:
+ * For WWNN, we use NAA 1 w/ bit 27-16 of word 0 as 0.
+ * For WWPN, we use NAA 2 w/ bit 27-16 of word 0 from VLAN ID
+ */

I think this comment was old and is not applicable now. We used to embed VLAN id in the WWNPN, which we do not do it any more.


Unfortunately the spec is verbose and I don't have time to go through it
carefully right now. My suspicion is that there still isn't a way to
tell from the WWN or WWPN if it's a FCoE capable host or not. You can
figure out the company who supplies the adapter and some other
identifiers, but I don't think there's going to be a way to parse that
string to determine capabilities...

One way probably is to read the symbolic_name from sysfs, which reads like '<driver> over <eth-if>'. But this may not be a fool proof way, as it is just a string, and FCoE drivers that are not netdev based may have completely different symbolic name.


//Rob
AFAIK, there really isn't a way to figure that out just from WWN, for CNA using
libfc and fcoe, and if it is not providing it's own WWN via the existing ndo
hook, then we know it's following the above convention that uses the
fcoe_wwn_from_mac() to form the wwn, we can infer. But it's never the
generic way. The NAA only governs the WWN naming convention but does
not cover or care anything about CNA or their difference. I don't see a ready
obvious solution here, ideally, hbaapi is the best to retrieving this info. but
current hbaapi does not have anything related to this.

yi


_______________________________________________
devel mailing list
devel@open-fcoe.org
https://lists.open-fcoe.org/mailman/listinfo/devel
_______________________________________________
devel mailing list
devel@open-fcoe.org
https://lists.open-fcoe.org/mailman/listinfo/devel




_______________________________________________
devel mailing list
devel@open-fcoe.org
https://lists.open-fcoe.org/mailman/listinfo/devel

Reply via email to