path: root/include/scsi
diff options
authorChris Leech <christopher.leech@intel.com>2009-11-03 11:46:29 -0800
committerJames Bottomley <James.Bottomley@suse.de>2009-12-04 12:00:58 -0600
commit11b561886643d4e23d0fd58c205d830a448dd0a2 (patch)
tree3d28650e6727589dd672ea3985d2aa2643a99549 /include/scsi
parent[SCSI] libfc, libfcoe: FDISC ELS for NPIV (diff)
[SCSI] libfcoe, fcoe: libfcoe NPIV support
The FIP code in libfcoe needed several changes to support NPIV 1) dst_src_addr needs to be managed per-n_port-ID for FPMA fabrics with NPIV enabled. Managing the MAC address is now handled in fcoe, with some slight changes to update_mac() and a new get_src_addr() function pointer. 2) The libfc elsct_send() hook is used to setup FCoE specific response handlers for FIP encapsulated ELS exchanges. This lets the FCoE specific handling know which VN_Port the exchange is for, and doesn't require tracking OX_IDs. It might be possible to roll back to the full FIP frame in these, but for now I've just stashed the contents of the MAC address descriptor in the skb context block for later use. Also, because fcoe_elsct_send() just passes control on to fc_elsct_send(), all transmits still come through the normal frame_send() path. 3) The NPIV changes added a mutex hold in the keep alive sending, the lport mutex is protecting the vport list. We can't take a mutex from a timer, so move the FIP keep alive logic to the link work struct. Signed-off-by: Chris Leech <christopher.leech@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'include/scsi')
3 files changed, 23 insertions, 5 deletions
diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
index 148126dcf9e9..ab2f8d41761b 100644
--- a/include/scsi/fc_frame.h
+++ b/include/scsi/fc_frame.h
@@ -28,6 +28,8 @@
#include <scsi/fc/fc_fcp.h>
#include <scsi/fc/fc_encaps.h>
+#include <linux/if_ether.h>
* The fc_frame interface is used to pass frame data between functions.
* The frame includes the data buffer, length, and SOF / EOF delimiter types.
@@ -67,6 +69,7 @@ struct fcoe_rcv_info {
enum fc_sof fr_sof; /* start of frame delimiter */
enum fc_eof fr_eof; /* end of frame delimiter */
u8 fr_flags; /* flags - see below */
+ u8 granted_mac[ETH_ALEN]; /* FCoE MAC address */
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index dfeb1ee4f03f..dad66ce8673d 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -900,6 +900,16 @@ void fc_fcp_destroy(struct fc_lport *);
* Initializes ELS/CT interface
int fc_elsct_init(struct fc_lport *lp);
+struct fc_seq *fc_elsct_send(struct fc_lport *lport,
+ u32 did,
+ struct fc_frame *fp,
+ unsigned int op,
+ void (*resp)(struct fc_seq *,
+ struct fc_frame *fp,
+ void *arg),
+ void *arg, u32 timer_msec);
+void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *);
+void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *);
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index b2410605b740..8ef5e209c216 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -74,11 +74,13 @@ enum fip_state {
* @last_link: last link state reported to libfc.
* @map_dest: use the FC_MAP mode for destination MAC addresses.
* @spma: supports SPMA server-provided MACs mode
+ * @send_ctlr_ka: need to send controller keep alive
+ * @send_port_ka: need to send port keep alives
* @dest_addr: MAC address of the selected FC forwarder.
* @ctl_src_addr: the native MAC address of our local port.
- * @data_src_addr: the assigned MAC address for the local port after FLOGI.
* @send: LLD-supplied function to handle sending of FIP Ethernet frames.
* @update_mac: LLD-supplied function to handle changes to MAC addresses.
+ * @get_src_addr: LLD-supplied function to supply a source MAC address.
* @lock: lock protecting this structure.
* This structure is used by all FCoE drivers. It contains information
@@ -106,12 +108,14 @@ struct fcoe_ctlr {
u8 last_link;
u8 map_dest;
u8 spma;
+ u8 send_ctlr_ka;
+ u8 send_port_ka;
u8 dest_addr[ETH_ALEN];
u8 ctl_src_addr[ETH_ALEN];
- u8 data_src_addr[ETH_ALEN];
void (*send)(struct fcoe_ctlr *, struct sk_buff *);
- void (*update_mac)(struct fcoe_ctlr *, u8 *old, u8 *new);
+ void (*update_mac)(struct fc_lport *, u8 *addr);
+ u8 * (*get_src_addr)(struct fc_lport *);
spinlock_t lock;
@@ -155,9 +159,10 @@ void fcoe_ctlr_init(struct fcoe_ctlr *);
void fcoe_ctlr_destroy(struct fcoe_ctlr *);
void fcoe_ctlr_link_up(struct fcoe_ctlr *);
int fcoe_ctlr_link_down(struct fcoe_ctlr *);
-int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct sk_buff *);
+int fcoe_ctlr_els_send(struct fcoe_ctlr *, struct fc_lport *, struct sk_buff *);
void fcoe_ctlr_recv(struct fcoe_ctlr *, struct sk_buff *);
-int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_frame *fp, u8 *sa);
+int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *lport,
+ struct fc_frame *fp, u8 *sa);
/* libfcoe funcs */
u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);