Skip to content

Commit 78112e5

Browse files
Joe EykholtJames Bottomley
authored andcommitted
[SCSI] fnic: Add FIP support to the fnic driver
Use libfcoe as a common FIP implementation with fcoe. FIP or non-FIP mode is fully automatic if the firmware supports and enables it. Even if FIP is not supported, this uses libfcoe for the non-FIP handling of FLOGI and its response. Use the new lport_set_port_id() notification to capture successful FLOGI responses and port_id resets. While transitioning between Ethernet and FC mode, all rx and tx FC frames are queued. In Ethernet mode, all frames are passed to the exchange manager to capture FLOGI responses. Change to set data_src_addr to the ctl_src_addr whenever it would have previously been zero because we're not logged in. This seems safer so we'll never send a frame with a 0 source MAC. This also eliminates a special case for sending FLOGI frames. Signed-off-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
1 parent 386309c commit 78112e5

8 files changed

Lines changed: 382 additions & 342 deletions

File tree

‎drivers/scsi/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ config FCOE
663663
config FCOE_FNIC
664664
tristate "Cisco FNIC Driver"
665665
depends on PCI && X86
666-
select LIBFC
666+
select LIBFCOE
667667
help
668668
This is support for the Cisco PCI-Express FCoE HBA.
669669

‎drivers/scsi/fnic/fnic.h‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/netdevice.h>
2323
#include <linux/workqueue.h>
2424
#include <scsi/libfc.h>
25+
#include <scsi/libfcoe.h>
2526
#include "fnic_io.h"
2627
#include "fnic_res.h"
2728
#include "vnic_dev.h"
@@ -145,6 +146,7 @@ struct mempool;
145146
/* Per-instance private data structure */
146147
struct fnic {
147148
struct fc_lport *lport;
149+
struct fcoe_ctlr ctlr; /* FIP FCoE controller structure */
148150
struct vnic_dev_bar bar0;
149151

150152
struct msix_entry msix_entry[FNIC_MSIX_INTR_MAX];
@@ -162,23 +164,16 @@ struct fnic {
162164
unsigned int wq_count;
163165
unsigned int cq_count;
164166

165-
u32 fcoui_mode:1; /* use fcoui address*/
166167
u32 vlan_hw_insert:1; /* let hw insert the tag */
167168
u32 in_remove:1; /* fnic device in removal */
168169
u32 stop_rx_link_events:1; /* stop proc. rx frames, link events */
169170

170171
struct completion *remove_wait; /* device remove thread blocks */
171172

172-
struct fc_frame *flogi;
173-
struct fc_frame *flogi_resp;
174-
u16 flogi_oxid;
175-
unsigned long s_id;
176173
enum fnic_state state;
177174
spinlock_t fnic_lock;
178175

179176
u16 vlan_id; /* VLAN tag including priority */
180-
u8 mac_addr[ETH_ALEN];
181-
u8 dest_addr[ETH_ALEN];
182177
u8 data_src_addr[ETH_ALEN];
183178
u64 fcp_input_bytes; /* internal statistic */
184179
u64 fcp_output_bytes; /* internal statistic */
@@ -205,6 +200,7 @@ struct fnic {
205200
struct work_struct link_work;
206201
struct work_struct frame_work;
207202
struct sk_buff_head frame_queue;
203+
struct sk_buff_head tx_queue;
208204

209205
/* copy work queue cache line section */
210206
____cacheline_aligned struct vnic_wq_copy wq_copy[FNIC_WQ_COPY_MAX];
@@ -224,6 +220,11 @@ struct fnic {
224220
____cacheline_aligned struct vnic_intr intr[FNIC_MSIX_INTR_MAX];
225221
};
226222

223+
static inline struct fnic *fnic_from_ctlr(struct fcoe_ctlr *fip)
224+
{
225+
return container_of(fip, struct fnic, ctlr);
226+
}
227+
227228
extern struct workqueue_struct *fnic_event_queue;
228229
extern struct device_attribute *fnic_attrs[];
229230

@@ -239,7 +240,11 @@ void fnic_handle_link(struct work_struct *work);
239240
int fnic_rq_cmpl_handler(struct fnic *fnic, int);
240241
int fnic_alloc_rq_frame(struct vnic_rq *rq);
241242
void fnic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf);
242-
int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp);
243+
void fnic_flush_tx(struct fnic *);
244+
void fnic_eth_send(struct fcoe_ctlr *, struct sk_buff *skb);
245+
void fnic_set_port_id(struct fc_lport *, u32, struct fc_frame *);
246+
void fnic_update_mac(struct fc_lport *, u8 *new);
247+
void fnic_update_mac_locked(struct fnic *, u8 *new);
243248

244249
int fnic_queuecommand(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *));
245250
int fnic_abort_cmd(struct scsi_cmnd *);
@@ -252,7 +257,7 @@ void fnic_empty_scsi_cleanup(struct fc_lport *);
252257
void fnic_exch_mgr_reset(struct fc_lport *, u32, u32);
253258
int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int);
254259
int fnic_wq_cmpl_handler(struct fnic *fnic, int);
255-
int fnic_flogi_reg_handler(struct fnic *fnic);
260+
int fnic_flogi_reg_handler(struct fnic *fnic, u32);
256261
void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
257262
struct fcpio_host_req *desc);
258263
int fnic_fw_reset_handler(struct fnic *fnic);

0 commit comments

Comments
 (0)