Skip to content

Commit

Permalink
[SCSI] libfcoe: Add fcoe_sysfs
Browse files Browse the repository at this point in the history
This patch adds a 'fcoe bus' infrastructure to the kernel
that is driven by changes to libfcoe which allow LLDs to
present FIP (FCoE Initialization Protocol) discovered
entities and their attributes to user space via sysfs.

This patch adds the following APIs-

fcoe_ctlr_device_add
fcoe_ctlr_device_delete
fcoe_fcf_device_add
fcoe_fcf_device_delete

They allow the LLD to expose the FCoE ENode Controller
and any discovered FCFs (Fibre Channel Forwarders, e.g.
FCoE switches) to the user. Each of these new devices
has their own bus_type so that they are grouped together
for easy lookup from a user space application. Each
new class has an attribute_group to expose attributes
for any created instances. The attributes are-

fcoe_ctlr_device
* fcf_dev_loss_tmo
* lesb_link_fail
* lesb_vlink_fail
* lesb_miss_fka
* lesb_symb_err
* lesb_err_block
* lesb_fcs_error

fcoe_fcf_device
* fabric_name
* switch_name
* priority
* selected
* fc_map
* vfid
* mac
* fka_peroid
* fabric_state
* dev_loss_tmo

A device loss infrastructre similar to the FC Transport's
is also added by this patch. It is nice to have so that a
link flapping adapter doesn't continually advance the count
used to identify the discovered FCF. FCFs will exist in a
"Disconnected" state until either the timer expires or the
FCF is rediscovered and becomes "Connected."

This patch generates a few checkpatch.pl WARNINGS that
I'm not sure what to do about. They're macros modeled
around the FC Transport attribute building macros, which
have the same 'feature' where the caller can ommit a cast
in the argument list and no cast occurs in the code. I'm
not sure how to keep the code condensed while keeping the
macros. Any advice would be appreciated.

Signed-off-by: Robert Love <robert.w.love@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
  • Loading branch information
Robert Love authored and James Bottomley committed May 23, 2012
1 parent fd8f890 commit 9a74e88
Show file tree
Hide file tree
Showing 6 changed files with 1,046 additions and 3 deletions.
77 changes: 77 additions & 0 deletions Documentation/ABI/testing/sysfs-bus-fcoe
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
What: /sys/bus/fcoe/ctlr_X
Date: March 2012
KernelVersion: TBD
Contact: Robert Love <robert.w.love@intel.com>, devel@open-fcoe.org
Description: 'FCoE Controller' instances on the fcoe bus
Attributes:

fcf_dev_loss_tmo: Device loss timeout peroid (see below). Changing
this value will change the dev_loss_tmo for all
FCFs discovered by this controller.

lesb_link_fail: Link Error Status Block (LESB) link failure count.

lesb_vlink_fail: Link Error Status Block (LESB) virtual link
failure count.

lesb_miss_fka: Link Error Status Block (LESB) missed FCoE
Initialization Protocol (FIP) Keep-Alives (FKA).

lesb_symb_err: Link Error Status Block (LESB) symbolic error count.

lesb_err_block: Link Error Status Block (LESB) block error count.

lesb_fcs_error: Link Error Status Block (LESB) Fibre Channel
Serivces error count.

Notes: ctlr_X (global increment starting at 0)

What: /sys/bus/fcoe/fcf_X
Date: March 2012
KernelVersion: TBD
Contact: Robert Love <robert.w.love@intel.com>, devel@open-fcoe.org
Description: 'FCoE FCF' instances on the fcoe bus. A FCF is a Fibre Channel
Forwarder, which is a FCoE switch that can accept FCoE
(Ethernet) packets, unpack them, and forward the embedded
Fibre Channel frames into a FC fabric. It can also take
outbound FC frames and pack them in Ethernet packets to
be sent to their destination on the Ethernet segment.
Attributes:

fabric_name: Identifies the fabric that the FCF services.

switch_name: Identifies the FCF.

priority: The switch's priority amongst other FCFs on the same
fabric.

selected: 1 indicates that the switch has been selected for use;
0 indicates that the swich will not be used.

fc_map: The Fibre Channel MAP

vfid: The Virtual Fabric ID

mac: The FCF's MAC address

fka_peroid: The FIP Keep-Alive peroid

fabric_state: The internal kernel state
"Unknown" - Initialization value
"Disconnected" - No link to the FCF/fabric
"Connected" - Host is connected to the FCF
"Deleted" - FCF is being removed from the system

dev_loss_tmo: The device loss timeout peroid for this FCF.

Notes: A device loss infrastructre similar to the FC Transport's
is present in fcoe_sysfs. It is nice to have so that a
link flapping adapter doesn't continually advance the count
used to identify the discovered FCF. FCFs will exist in a
"Disconnected" state until either the timer expires and the
FCF becomes "Deleted" or the FCF is rediscovered and becomes
"Connected."


Users: The first user of this interface will be the fcoeadm application,
which is commonly packaged in the fcoe-utils package.
2 changes: 1 addition & 1 deletion drivers/scsi/fcoe/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
obj-$(CONFIG_FCOE) += fcoe.o
obj-$(CONFIG_LIBFCOE) += libfcoe.o

libfcoe-objs := fcoe_ctlr.o fcoe_transport.o
libfcoe-objs := fcoe_ctlr.o fcoe_transport.o fcoe_sysfs.o
Loading

0 comments on commit 9a74e88

Please sign in to comment.