diff options
author | Robert Love <robert.w.love@intel.com> | 2012-11-27 01:53:30 -0500 |
---|---|---|
committer | Robert Love <robert.w.love@intel.com> | 2012-12-14 13:38:54 -0500 |
commit | 6a891b071b640e1de44c4a5117fa2c974dcfa84a (patch) | |
tree | cd40772ab35844d21ae44ad4a16fec4246b5f21f /include/scsi | |
parent | 3993de6183885a099163b9562a2ea9c07b994a0e (diff) |
libfcoe, fcoe, bnx2fc: Add new fcoe control interface
This patch does a few things.
1) Makes /sys/bus/fcoe/ctlr_{create,destroy} interfaces.
These interfaces take an <ifname> and will either
create an FCoE Controller or destroy an FCoE
Controller depending on which file is written to.
The new FCoE Controller will start in a DISABLED
state and will not do discovery or login until it
is ENABLED. This pause will allow us to configure
the FCoE Controller before enabling it.
2) Makes the 'mode' attribute of a fcoe_ctlr_device
writale. This allows the user to configure the mode
in which the FCoE Controller will start in when it
is ENABLED.
Possible modes are 'Fabric', or 'VN2VN'.
The default mode for a fcoe_ctlr{,_device} is 'Fabric'.
Drivers must implement the set_fcoe_ctlr_mode routine
to support this feature.
libfcoe offers an exported routine to set a FCoE
Controller's mode. The mode can only be changed
when the FCoE Controller is DISABLED.
This patch also removes the get_fcoe_ctlr_mode pointer
in the fcoe_sysfs function template, the code in
fcoe_ctlr.c to get the mode and the assignment of
the fcoe_sysfs function pointer to the fcoe_ctlr.c
implementation (in fcoe and bnx2fc). fcoe_sysfs can
return that value for the mode without consulting the
LLD.
3) Make a 'enabled' attribute of a fcoe_ctlr_device. On a
read, fcoe_sysfs will return the attribute's value. On
a write, fcoe_sysfs will call the LLD (if there is a
callback) to notifiy that the enalbed state has changed.
This patch maintains the old FCoE control interfaces as
module parameters, but it adds comments pointing out that
the old interfaces are deprecated.
Signed-off-by: Robert Love <robert.w.love@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/fcoe_sysfs.h | 11 | ||||
-rw-r--r-- | include/scsi/libfcoe.h | 16 |
2 files changed, 24 insertions, 3 deletions
diff --git a/include/scsi/fcoe_sysfs.h b/include/scsi/fcoe_sysfs.h index 604cb9bb3e76..7e2314870341 100644 --- a/include/scsi/fcoe_sysfs.h +++ b/include/scsi/fcoe_sysfs.h | |||
@@ -34,7 +34,8 @@ struct fcoe_sysfs_function_template { | |||
34 | void (*get_fcoe_ctlr_symb_err)(struct fcoe_ctlr_device *); | 34 | void (*get_fcoe_ctlr_symb_err)(struct fcoe_ctlr_device *); |
35 | void (*get_fcoe_ctlr_err_block)(struct fcoe_ctlr_device *); | 35 | void (*get_fcoe_ctlr_err_block)(struct fcoe_ctlr_device *); |
36 | void (*get_fcoe_ctlr_fcs_error)(struct fcoe_ctlr_device *); | 36 | void (*get_fcoe_ctlr_fcs_error)(struct fcoe_ctlr_device *); |
37 | void (*get_fcoe_ctlr_mode)(struct fcoe_ctlr_device *); | 37 | void (*set_fcoe_ctlr_mode)(struct fcoe_ctlr_device *); |
38 | int (*set_fcoe_ctlr_enabled)(struct fcoe_ctlr_device *); | ||
38 | void (*get_fcoe_fcf_selected)(struct fcoe_fcf_device *); | 39 | void (*get_fcoe_fcf_selected)(struct fcoe_fcf_device *); |
39 | void (*get_fcoe_fcf_vlan_id)(struct fcoe_fcf_device *); | 40 | void (*get_fcoe_fcf_vlan_id)(struct fcoe_fcf_device *); |
40 | }; | 41 | }; |
@@ -48,6 +49,12 @@ enum fip_conn_type { | |||
48 | FIP_CONN_TYPE_VN2VN, | 49 | FIP_CONN_TYPE_VN2VN, |
49 | }; | 50 | }; |
50 | 51 | ||
52 | enum ctlr_enabled_state { | ||
53 | FCOE_CTLR_ENABLED, | ||
54 | FCOE_CTLR_DISABLED, | ||
55 | FCOE_CTLR_UNUSED, | ||
56 | }; | ||
57 | |||
51 | struct fcoe_ctlr_device { | 58 | struct fcoe_ctlr_device { |
52 | u32 id; | 59 | u32 id; |
53 | 60 | ||
@@ -64,6 +71,8 @@ struct fcoe_ctlr_device { | |||
64 | int fcf_dev_loss_tmo; | 71 | int fcf_dev_loss_tmo; |
65 | enum fip_conn_type mode; | 72 | enum fip_conn_type mode; |
66 | 73 | ||
74 | enum ctlr_enabled_state enabled; | ||
75 | |||
67 | /* expected in host order for displaying */ | 76 | /* expected in host order for displaying */ |
68 | struct fcoe_fc_els_lesb lesb; | 77 | struct fcoe_fc_els_lesb lesb; |
69 | }; | 78 | }; |
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index 8742d853a3b8..6add37ac8609 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h | |||
@@ -289,8 +289,11 @@ static inline bool is_fip_mode(struct fcoe_ctlr *fip) | |||
289 | * @attached: whether this transport is already attached | 289 | * @attached: whether this transport is already attached |
290 | * @list: list linkage to all attached transports | 290 | * @list: list linkage to all attached transports |
291 | * @match: handler to allow the transport driver to match up a given netdev | 291 | * @match: handler to allow the transport driver to match up a given netdev |
292 | * @alloc: handler to allocate per-instance FCoE structures | ||
293 | * (no discovery or login) | ||
292 | * @create: handler to sysfs entry of create for FCoE instances | 294 | * @create: handler to sysfs entry of create for FCoE instances |
293 | * @destroy: handler to sysfs entry of destroy for FCoE instances | 295 | * @destroy: handler to delete per-instance FCoE structures |
296 | * (frees all memory) | ||
294 | * @enable: handler to sysfs entry of enable for FCoE instances | 297 | * @enable: handler to sysfs entry of enable for FCoE instances |
295 | * @disable: handler to sysfs entry of disable for FCoE instances | 298 | * @disable: handler to sysfs entry of disable for FCoE instances |
296 | */ | 299 | */ |
@@ -299,6 +302,7 @@ struct fcoe_transport { | |||
299 | bool attached; | 302 | bool attached; |
300 | struct list_head list; | 303 | struct list_head list; |
301 | bool (*match) (struct net_device *device); | 304 | bool (*match) (struct net_device *device); |
305 | int (*alloc) (struct net_device *device); | ||
302 | int (*create) (struct net_device *device, enum fip_state fip_mode); | 306 | int (*create) (struct net_device *device, enum fip_state fip_mode); |
303 | int (*destroy) (struct net_device *device); | 307 | int (*destroy) (struct net_device *device); |
304 | int (*enable) (struct net_device *device); | 308 | int (*enable) (struct net_device *device); |
@@ -356,7 +360,7 @@ int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen, | |||
356 | 360 | ||
357 | /* FCoE Sysfs helpers */ | 361 | /* FCoE Sysfs helpers */ |
358 | void fcoe_fcf_get_selected(struct fcoe_fcf_device *); | 362 | void fcoe_fcf_get_selected(struct fcoe_fcf_device *); |
359 | void fcoe_ctlr_get_fip_mode(struct fcoe_ctlr_device *); | 363 | void fcoe_ctlr_set_fip_mode(struct fcoe_ctlr_device *); |
360 | 364 | ||
361 | /** | 365 | /** |
362 | * struct netdev_list | 366 | * struct netdev_list |
@@ -372,4 +376,12 @@ struct fcoe_netdev_mapping { | |||
372 | int fcoe_transport_attach(struct fcoe_transport *ft); | 376 | int fcoe_transport_attach(struct fcoe_transport *ft); |
373 | int fcoe_transport_detach(struct fcoe_transport *ft); | 377 | int fcoe_transport_detach(struct fcoe_transport *ft); |
374 | 378 | ||
379 | /* sysfs store handler for ctrl_control interface */ | ||
380 | ssize_t fcoe_ctlr_create_store(struct bus_type *bus, | ||
381 | const char *buf, size_t count); | ||
382 | ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus, | ||
383 | const char *buf, size_t count); | ||
384 | |||
375 | #endif /* _LIBFCOE_H */ | 385 | #endif /* _LIBFCOE_H */ |
386 | |||
387 | |||