From 8d55e507d24c6db7eb012c379c62912e642eb75e Mon Sep 17 00:00:00 2001 From: Robert Love Date: Tue, 22 May 2012 19:06:26 -0700 Subject: [SCSI] fcoe, bnx2fc, libfcoe: SW FCoE and bnx2fc use FCoE Syfs This patch has the SW FCoE driver and the bnx2fc driver make use of the new fcoe_sysfs API added earlier in this patch series. After this patch a fcoe_ctlr_device is allocated with private data in this order. +------------------+ +------------------+ | fcoe_ctlr_device | | fcoe_ctlr_device | +------------------+ +------------------+ | fcoe_ctlr | | fcoe_ctlr | +------------------+ +------------------+ | fcoe_interface | | bnx2fc_interface | +------------------+ +------------------+ libfcoe also takes part in this new model since it discovers and manages fcoe_fcf instances. The memory allocation is different for FCFs. I didn't want to impact libfcoe's fcoe_fcf processing, so this patch creates fcoe_fcf_device instances for each discovered fcoe_fcf. The two are paired using a (void * priv) member of the fcoe_ctlr_device. This allows libfcoe to continue maintaining its list of fcoe_fcf instances and simply attaches and detaches them from existing or new fcoe_fcf_device instances. Signed-off-by: Robert Love Tested-by: Ross Brattain Signed-off-by: James Bottomley --- include/scsi/libfcoe.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/scsi') diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index 7b93f211b935..22b07cc99808 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h @@ -168,9 +168,16 @@ static inline void *fcoe_ctlr_priv(const struct fcoe_ctlr *ctlr) return (void *)(ctlr + 1); } +#define fcoe_ctlr_to_ctlr_dev(x) \ + (struct fcoe_ctlr_device *)(((struct fcoe_ctlr_device *)(x)) - 1) + /** * struct fcoe_fcf - Fibre-Channel Forwarder * @list: list linkage + * @event_work: Work for FC Transport actions queue + * @event: The event to be processed + * @fip: The controller that the FCF was discovered on + * @fcf_dev: The associated fcoe_fcf_device instance * @time: system time (jiffies) when an advertisement was last received * @switch_name: WWN of switch from advertisement * @fabric_name: WWN of fabric from advertisement @@ -192,6 +199,9 @@ static inline void *fcoe_ctlr_priv(const struct fcoe_ctlr *ctlr) */ struct fcoe_fcf { struct list_head list; + struct work_struct event_work; + struct fcoe_ctlr *fip; + struct fcoe_fcf_device *fcf_dev; unsigned long time; u64 switch_name; @@ -208,6 +218,9 @@ struct fcoe_fcf { u8 fd_flags:1; }; +#define fcoe_fcf_to_fcf_dev(x) \ + ((x)->fcf_dev) + /** * struct fcoe_rport - VN2VN remote port * @time: time of create or last beacon packet received from node @@ -343,6 +356,10 @@ void fcoe_queue_timer(ulong lport); int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen, struct fcoe_percpu_s *fps); +/* FCoE Sysfs helpers */ +void fcoe_fcf_get_selected(struct fcoe_fcf_device *); +void fcoe_ctlr_get_fip_mode(struct fcoe_ctlr_device *); + /** * struct netdev_list * A mapping from netdevice to fcoe_transport -- cgit v1.2.2