1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * Copyright 2008 Cisco Systems, Inc. All rights reserved.
3*4882a593Smuzhiyun * Copyright 2007 Nuova Systems, Inc. All rights reserved.
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * This program is free software; you may redistribute it and/or modify
6*4882a593Smuzhiyun * it under the terms of the GNU General Public License as published by
7*4882a593Smuzhiyun * the Free Software Foundation; version 2 of the License.
8*4882a593Smuzhiyun *
9*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
10*4882a593Smuzhiyun * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11*4882a593Smuzhiyun * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
12*4882a593Smuzhiyun * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
13*4882a593Smuzhiyun * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
14*4882a593Smuzhiyun * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
15*4882a593Smuzhiyun * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16*4882a593Smuzhiyun * SOFTWARE.
17*4882a593Smuzhiyun */
18*4882a593Smuzhiyun #ifndef _FNIC_H_
19*4882a593Smuzhiyun #define _FNIC_H_
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun #include <linux/interrupt.h>
22*4882a593Smuzhiyun #include <linux/netdevice.h>
23*4882a593Smuzhiyun #include <linux/workqueue.h>
24*4882a593Smuzhiyun #include <linux/bitops.h>
25*4882a593Smuzhiyun #include <scsi/libfc.h>
26*4882a593Smuzhiyun #include <scsi/libfcoe.h>
27*4882a593Smuzhiyun #include "fnic_io.h"
28*4882a593Smuzhiyun #include "fnic_res.h"
29*4882a593Smuzhiyun #include "fnic_trace.h"
30*4882a593Smuzhiyun #include "fnic_stats.h"
31*4882a593Smuzhiyun #include "vnic_dev.h"
32*4882a593Smuzhiyun #include "vnic_wq.h"
33*4882a593Smuzhiyun #include "vnic_rq.h"
34*4882a593Smuzhiyun #include "vnic_cq.h"
35*4882a593Smuzhiyun #include "vnic_wq_copy.h"
36*4882a593Smuzhiyun #include "vnic_intr.h"
37*4882a593Smuzhiyun #include "vnic_stats.h"
38*4882a593Smuzhiyun #include "vnic_scsi.h"
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun #define DRV_NAME "fnic"
41*4882a593Smuzhiyun #define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
42*4882a593Smuzhiyun #define DRV_VERSION "1.6.0.47"
43*4882a593Smuzhiyun #define PFX DRV_NAME ": "
44*4882a593Smuzhiyun #define DFX DRV_NAME "%d: "
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun #define DESC_CLEAN_LOW_WATERMARK 8
47*4882a593Smuzhiyun #define FNIC_UCSM_DFLT_THROTTLE_CNT_BLD 16 /* UCSM default throttle count */
48*4882a593Smuzhiyun #define FNIC_MIN_IO_REQ 256 /* Min IO throttle count */
49*4882a593Smuzhiyun #define FNIC_MAX_IO_REQ 1024 /* scsi_cmnd tag map entries */
50*4882a593Smuzhiyun #define FNIC_DFLT_IO_REQ 256 /* Default scsi_cmnd tag map entries */
51*4882a593Smuzhiyun #define FNIC_IO_LOCKS 64 /* IO locks: power of 2 */
52*4882a593Smuzhiyun #define FNIC_DFLT_QUEUE_DEPTH 256
53*4882a593Smuzhiyun #define FNIC_STATS_RATE_LIMIT 4 /* limit rate at which stats are pulled up */
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun /*
56*4882a593Smuzhiyun * Tag bits used for special requests.
57*4882a593Smuzhiyun */
58*4882a593Smuzhiyun #define FNIC_TAG_ABORT BIT(30) /* tag bit indicating abort */
59*4882a593Smuzhiyun #define FNIC_TAG_DEV_RST BIT(29) /* indicates device reset */
60*4882a593Smuzhiyun #define FNIC_TAG_MASK (BIT(24) - 1) /* mask for lookup */
61*4882a593Smuzhiyun #define FNIC_NO_TAG -1
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun /*
64*4882a593Smuzhiyun * Command flags to identify the type of command and for other future
65*4882a593Smuzhiyun * use.
66*4882a593Smuzhiyun */
67*4882a593Smuzhiyun #define FNIC_NO_FLAGS 0
68*4882a593Smuzhiyun #define FNIC_IO_INITIALIZED BIT(0)
69*4882a593Smuzhiyun #define FNIC_IO_ISSUED BIT(1)
70*4882a593Smuzhiyun #define FNIC_IO_DONE BIT(2)
71*4882a593Smuzhiyun #define FNIC_IO_REQ_NULL BIT(3)
72*4882a593Smuzhiyun #define FNIC_IO_ABTS_PENDING BIT(4)
73*4882a593Smuzhiyun #define FNIC_IO_ABORTED BIT(5)
74*4882a593Smuzhiyun #define FNIC_IO_ABTS_ISSUED BIT(6)
75*4882a593Smuzhiyun #define FNIC_IO_TERM_ISSUED BIT(7)
76*4882a593Smuzhiyun #define FNIC_IO_INTERNAL_TERM_ISSUED BIT(8)
77*4882a593Smuzhiyun #define FNIC_IO_ABT_TERM_DONE BIT(9)
78*4882a593Smuzhiyun #define FNIC_IO_ABT_TERM_REQ_NULL BIT(10)
79*4882a593Smuzhiyun #define FNIC_IO_ABT_TERM_TIMED_OUT BIT(11)
80*4882a593Smuzhiyun #define FNIC_DEVICE_RESET BIT(12) /* Device reset request */
81*4882a593Smuzhiyun #define FNIC_DEV_RST_ISSUED BIT(13)
82*4882a593Smuzhiyun #define FNIC_DEV_RST_TIMED_OUT BIT(14)
83*4882a593Smuzhiyun #define FNIC_DEV_RST_ABTS_ISSUED BIT(15)
84*4882a593Smuzhiyun #define FNIC_DEV_RST_TERM_ISSUED BIT(16)
85*4882a593Smuzhiyun #define FNIC_DEV_RST_DONE BIT(17)
86*4882a593Smuzhiyun #define FNIC_DEV_RST_REQ_NULL BIT(18)
87*4882a593Smuzhiyun #define FNIC_DEV_RST_ABTS_DONE BIT(19)
88*4882a593Smuzhiyun #define FNIC_DEV_RST_TERM_DONE BIT(20)
89*4882a593Smuzhiyun #define FNIC_DEV_RST_ABTS_PENDING BIT(21)
90*4882a593Smuzhiyun
91*4882a593Smuzhiyun /*
92*4882a593Smuzhiyun * Usage of the scsi_cmnd scratchpad.
93*4882a593Smuzhiyun * These fields are locked by the hashed io_req_lock.
94*4882a593Smuzhiyun */
95*4882a593Smuzhiyun #define CMD_SP(Cmnd) ((Cmnd)->SCp.ptr)
96*4882a593Smuzhiyun #define CMD_STATE(Cmnd) ((Cmnd)->SCp.phase)
97*4882a593Smuzhiyun #define CMD_ABTS_STATUS(Cmnd) ((Cmnd)->SCp.Message)
98*4882a593Smuzhiyun #define CMD_LR_STATUS(Cmnd) ((Cmnd)->SCp.have_data_in)
99*4882a593Smuzhiyun #define CMD_TAG(Cmnd) ((Cmnd)->SCp.sent_command)
100*4882a593Smuzhiyun #define CMD_FLAGS(Cmnd) ((Cmnd)->SCp.Status)
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun #define FCPIO_INVALID_CODE 0x100 /* hdr_status value unused by firmware */
103*4882a593Smuzhiyun
104*4882a593Smuzhiyun #define FNIC_LUN_RESET_TIMEOUT 10000 /* mSec */
105*4882a593Smuzhiyun #define FNIC_HOST_RESET_TIMEOUT 10000 /* mSec */
106*4882a593Smuzhiyun #define FNIC_RMDEVICE_TIMEOUT 1000 /* mSec */
107*4882a593Smuzhiyun #define FNIC_HOST_RESET_SETTLE_TIME 30 /* Sec */
108*4882a593Smuzhiyun #define FNIC_ABT_TERM_DELAY_TIMEOUT 500 /* mSec */
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun #define FNIC_MAX_FCP_TARGET 256
111*4882a593Smuzhiyun
112*4882a593Smuzhiyun /**
113*4882a593Smuzhiyun * state_flags to identify host state along along with fnic's state
114*4882a593Smuzhiyun **/
115*4882a593Smuzhiyun #define __FNIC_FLAGS_FWRESET BIT(0) /* fwreset in progress */
116*4882a593Smuzhiyun #define __FNIC_FLAGS_BLOCK_IO BIT(1) /* IOs are blocked */
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun #define FNIC_FLAGS_NONE (0)
119*4882a593Smuzhiyun #define FNIC_FLAGS_FWRESET (__FNIC_FLAGS_FWRESET | \
120*4882a593Smuzhiyun __FNIC_FLAGS_BLOCK_IO)
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun #define FNIC_FLAGS_IO_BLOCKED (__FNIC_FLAGS_BLOCK_IO)
123*4882a593Smuzhiyun
124*4882a593Smuzhiyun #define fnic_set_state_flags(fnicp, st_flags) \
125*4882a593Smuzhiyun __fnic_set_state_flags(fnicp, st_flags, 0)
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun #define fnic_clear_state_flags(fnicp, st_flags) \
128*4882a593Smuzhiyun __fnic_set_state_flags(fnicp, st_flags, 1)
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun extern unsigned int fnic_log_level;
131*4882a593Smuzhiyun extern unsigned int io_completions;
132*4882a593Smuzhiyun
133*4882a593Smuzhiyun #define FNIC_MAIN_LOGGING 0x01
134*4882a593Smuzhiyun #define FNIC_FCS_LOGGING 0x02
135*4882a593Smuzhiyun #define FNIC_SCSI_LOGGING 0x04
136*4882a593Smuzhiyun #define FNIC_ISR_LOGGING 0x08
137*4882a593Smuzhiyun
138*4882a593Smuzhiyun #define FNIC_CHECK_LOGGING(LEVEL, CMD) \
139*4882a593Smuzhiyun do { \
140*4882a593Smuzhiyun if (unlikely(fnic_log_level & LEVEL)) \
141*4882a593Smuzhiyun do { \
142*4882a593Smuzhiyun CMD; \
143*4882a593Smuzhiyun } while (0); \
144*4882a593Smuzhiyun } while (0)
145*4882a593Smuzhiyun
146*4882a593Smuzhiyun #define FNIC_MAIN_DBG(kern_level, host, fmt, args...) \
147*4882a593Smuzhiyun FNIC_CHECK_LOGGING(FNIC_MAIN_LOGGING, \
148*4882a593Smuzhiyun shost_printk(kern_level, host, fmt, ##args);)
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun #define FNIC_FCS_DBG(kern_level, host, fmt, args...) \
151*4882a593Smuzhiyun FNIC_CHECK_LOGGING(FNIC_FCS_LOGGING, \
152*4882a593Smuzhiyun shost_printk(kern_level, host, fmt, ##args);)
153*4882a593Smuzhiyun
154*4882a593Smuzhiyun #define FNIC_SCSI_DBG(kern_level, host, fmt, args...) \
155*4882a593Smuzhiyun FNIC_CHECK_LOGGING(FNIC_SCSI_LOGGING, \
156*4882a593Smuzhiyun shost_printk(kern_level, host, fmt, ##args);)
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun #define FNIC_ISR_DBG(kern_level, host, fmt, args...) \
159*4882a593Smuzhiyun FNIC_CHECK_LOGGING(FNIC_ISR_LOGGING, \
160*4882a593Smuzhiyun shost_printk(kern_level, host, fmt, ##args);)
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun #define FNIC_MAIN_NOTE(kern_level, host, fmt, args...) \
163*4882a593Smuzhiyun shost_printk(kern_level, host, fmt, ##args)
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun extern const char *fnic_state_str[];
166*4882a593Smuzhiyun
167*4882a593Smuzhiyun enum fnic_intx_intr_index {
168*4882a593Smuzhiyun FNIC_INTX_WQ_RQ_COPYWQ,
169*4882a593Smuzhiyun FNIC_INTX_ERR,
170*4882a593Smuzhiyun FNIC_INTX_NOTIFY,
171*4882a593Smuzhiyun FNIC_INTX_INTR_MAX,
172*4882a593Smuzhiyun };
173*4882a593Smuzhiyun
174*4882a593Smuzhiyun enum fnic_msix_intr_index {
175*4882a593Smuzhiyun FNIC_MSIX_RQ,
176*4882a593Smuzhiyun FNIC_MSIX_WQ,
177*4882a593Smuzhiyun FNIC_MSIX_WQ_COPY,
178*4882a593Smuzhiyun FNIC_MSIX_ERR_NOTIFY,
179*4882a593Smuzhiyun FNIC_MSIX_INTR_MAX,
180*4882a593Smuzhiyun };
181*4882a593Smuzhiyun
182*4882a593Smuzhiyun struct fnic_msix_entry {
183*4882a593Smuzhiyun int requested;
184*4882a593Smuzhiyun char devname[IFNAMSIZ + 11];
185*4882a593Smuzhiyun irqreturn_t (*isr)(int, void *);
186*4882a593Smuzhiyun void *devid;
187*4882a593Smuzhiyun };
188*4882a593Smuzhiyun
189*4882a593Smuzhiyun enum fnic_state {
190*4882a593Smuzhiyun FNIC_IN_FC_MODE = 0,
191*4882a593Smuzhiyun FNIC_IN_FC_TRANS_ETH_MODE,
192*4882a593Smuzhiyun FNIC_IN_ETH_MODE,
193*4882a593Smuzhiyun FNIC_IN_ETH_TRANS_FC_MODE,
194*4882a593Smuzhiyun };
195*4882a593Smuzhiyun
196*4882a593Smuzhiyun #define FNIC_WQ_COPY_MAX 1
197*4882a593Smuzhiyun #define FNIC_WQ_MAX 1
198*4882a593Smuzhiyun #define FNIC_RQ_MAX 1
199*4882a593Smuzhiyun #define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX)
200*4882a593Smuzhiyun #define FNIC_DFLT_IO_COMPLETIONS 256
201*4882a593Smuzhiyun
202*4882a593Smuzhiyun struct mempool;
203*4882a593Smuzhiyun
204*4882a593Smuzhiyun enum fnic_evt {
205*4882a593Smuzhiyun FNIC_EVT_START_VLAN_DISC = 1,
206*4882a593Smuzhiyun FNIC_EVT_START_FCF_DISC = 2,
207*4882a593Smuzhiyun FNIC_EVT_MAX,
208*4882a593Smuzhiyun };
209*4882a593Smuzhiyun
210*4882a593Smuzhiyun struct fnic_event {
211*4882a593Smuzhiyun struct list_head list;
212*4882a593Smuzhiyun struct fnic *fnic;
213*4882a593Smuzhiyun enum fnic_evt event;
214*4882a593Smuzhiyun };
215*4882a593Smuzhiyun
216*4882a593Smuzhiyun /* Per-instance private data structure */
217*4882a593Smuzhiyun struct fnic {
218*4882a593Smuzhiyun struct fc_lport *lport;
219*4882a593Smuzhiyun struct fcoe_ctlr ctlr; /* FIP FCoE controller structure */
220*4882a593Smuzhiyun struct vnic_dev_bar bar0;
221*4882a593Smuzhiyun
222*4882a593Smuzhiyun struct fnic_msix_entry msix[FNIC_MSIX_INTR_MAX];
223*4882a593Smuzhiyun
224*4882a593Smuzhiyun struct vnic_stats *stats;
225*4882a593Smuzhiyun unsigned long stats_time; /* time of stats update */
226*4882a593Smuzhiyun unsigned long stats_reset_time; /* time of stats reset */
227*4882a593Smuzhiyun struct vnic_nic_cfg *nic_cfg;
228*4882a593Smuzhiyun char name[IFNAMSIZ];
229*4882a593Smuzhiyun struct timer_list notify_timer; /* used for MSI interrupts */
230*4882a593Smuzhiyun
231*4882a593Smuzhiyun unsigned int fnic_max_tag_id;
232*4882a593Smuzhiyun unsigned int err_intr_offset;
233*4882a593Smuzhiyun unsigned int link_intr_offset;
234*4882a593Smuzhiyun
235*4882a593Smuzhiyun unsigned int wq_count;
236*4882a593Smuzhiyun unsigned int cq_count;
237*4882a593Smuzhiyun
238*4882a593Smuzhiyun struct dentry *fnic_stats_debugfs_host;
239*4882a593Smuzhiyun struct dentry *fnic_stats_debugfs_file;
240*4882a593Smuzhiyun struct dentry *fnic_reset_debugfs_file;
241*4882a593Smuzhiyun unsigned int reset_stats;
242*4882a593Smuzhiyun atomic64_t io_cmpl_skip;
243*4882a593Smuzhiyun struct fnic_stats fnic_stats;
244*4882a593Smuzhiyun
245*4882a593Smuzhiyun u32 vlan_hw_insert:1; /* let hw insert the tag */
246*4882a593Smuzhiyun u32 in_remove:1; /* fnic device in removal */
247*4882a593Smuzhiyun u32 stop_rx_link_events:1; /* stop proc. rx frames, link events */
248*4882a593Smuzhiyun
249*4882a593Smuzhiyun struct completion *remove_wait; /* device remove thread blocks */
250*4882a593Smuzhiyun
251*4882a593Smuzhiyun atomic_t in_flight; /* io counter */
252*4882a593Smuzhiyun bool internal_reset_inprogress;
253*4882a593Smuzhiyun u32 _reserved; /* fill hole */
254*4882a593Smuzhiyun unsigned long state_flags; /* protected by host lock */
255*4882a593Smuzhiyun enum fnic_state state;
256*4882a593Smuzhiyun spinlock_t fnic_lock;
257*4882a593Smuzhiyun
258*4882a593Smuzhiyun u16 vlan_id; /* VLAN tag including priority */
259*4882a593Smuzhiyun u8 data_src_addr[ETH_ALEN];
260*4882a593Smuzhiyun u64 fcp_input_bytes; /* internal statistic */
261*4882a593Smuzhiyun u64 fcp_output_bytes; /* internal statistic */
262*4882a593Smuzhiyun u32 link_down_cnt;
263*4882a593Smuzhiyun int link_status;
264*4882a593Smuzhiyun
265*4882a593Smuzhiyun struct list_head list;
266*4882a593Smuzhiyun struct pci_dev *pdev;
267*4882a593Smuzhiyun struct vnic_fc_config config;
268*4882a593Smuzhiyun struct vnic_dev *vdev;
269*4882a593Smuzhiyun unsigned int raw_wq_count;
270*4882a593Smuzhiyun unsigned int wq_copy_count;
271*4882a593Smuzhiyun unsigned int rq_count;
272*4882a593Smuzhiyun int fw_ack_index[FNIC_WQ_COPY_MAX];
273*4882a593Smuzhiyun unsigned short fw_ack_recd[FNIC_WQ_COPY_MAX];
274*4882a593Smuzhiyun unsigned short wq_copy_desc_low[FNIC_WQ_COPY_MAX];
275*4882a593Smuzhiyun unsigned int intr_count;
276*4882a593Smuzhiyun u32 __iomem *legacy_pba;
277*4882a593Smuzhiyun struct fnic_host_tag *tags;
278*4882a593Smuzhiyun mempool_t *io_req_pool;
279*4882a593Smuzhiyun mempool_t *io_sgl_pool[FNIC_SGL_NUM_CACHES];
280*4882a593Smuzhiyun spinlock_t io_req_lock[FNIC_IO_LOCKS]; /* locks for scsi cmnds */
281*4882a593Smuzhiyun
282*4882a593Smuzhiyun struct work_struct link_work;
283*4882a593Smuzhiyun struct work_struct frame_work;
284*4882a593Smuzhiyun struct sk_buff_head frame_queue;
285*4882a593Smuzhiyun struct sk_buff_head tx_queue;
286*4882a593Smuzhiyun
287*4882a593Smuzhiyun /*** FIP related data members -- start ***/
288*4882a593Smuzhiyun void (*set_vlan)(struct fnic *, u16 vlan);
289*4882a593Smuzhiyun struct work_struct fip_frame_work;
290*4882a593Smuzhiyun struct sk_buff_head fip_frame_queue;
291*4882a593Smuzhiyun struct timer_list fip_timer;
292*4882a593Smuzhiyun struct list_head vlans;
293*4882a593Smuzhiyun spinlock_t vlans_lock;
294*4882a593Smuzhiyun
295*4882a593Smuzhiyun struct work_struct event_work;
296*4882a593Smuzhiyun struct list_head evlist;
297*4882a593Smuzhiyun /*** FIP related data members -- end ***/
298*4882a593Smuzhiyun
299*4882a593Smuzhiyun /* copy work queue cache line section */
300*4882a593Smuzhiyun ____cacheline_aligned struct vnic_wq_copy wq_copy[FNIC_WQ_COPY_MAX];
301*4882a593Smuzhiyun /* completion queue cache line section */
302*4882a593Smuzhiyun ____cacheline_aligned struct vnic_cq cq[FNIC_CQ_MAX];
303*4882a593Smuzhiyun
304*4882a593Smuzhiyun spinlock_t wq_copy_lock[FNIC_WQ_COPY_MAX];
305*4882a593Smuzhiyun
306*4882a593Smuzhiyun /* work queue cache line section */
307*4882a593Smuzhiyun ____cacheline_aligned struct vnic_wq wq[FNIC_WQ_MAX];
308*4882a593Smuzhiyun spinlock_t wq_lock[FNIC_WQ_MAX];
309*4882a593Smuzhiyun
310*4882a593Smuzhiyun /* receive queue cache line section */
311*4882a593Smuzhiyun ____cacheline_aligned struct vnic_rq rq[FNIC_RQ_MAX];
312*4882a593Smuzhiyun
313*4882a593Smuzhiyun /* interrupt resource cache line section */
314*4882a593Smuzhiyun ____cacheline_aligned struct vnic_intr intr[FNIC_MSIX_INTR_MAX];
315*4882a593Smuzhiyun };
316*4882a593Smuzhiyun
fnic_from_ctlr(struct fcoe_ctlr * fip)317*4882a593Smuzhiyun static inline struct fnic *fnic_from_ctlr(struct fcoe_ctlr *fip)
318*4882a593Smuzhiyun {
319*4882a593Smuzhiyun return container_of(fip, struct fnic, ctlr);
320*4882a593Smuzhiyun }
321*4882a593Smuzhiyun
322*4882a593Smuzhiyun extern struct workqueue_struct *fnic_event_queue;
323*4882a593Smuzhiyun extern struct workqueue_struct *fnic_fip_queue;
324*4882a593Smuzhiyun extern struct device_attribute *fnic_attrs[];
325*4882a593Smuzhiyun
326*4882a593Smuzhiyun void fnic_clear_intr_mode(struct fnic *fnic);
327*4882a593Smuzhiyun int fnic_set_intr_mode(struct fnic *fnic);
328*4882a593Smuzhiyun void fnic_free_intr(struct fnic *fnic);
329*4882a593Smuzhiyun int fnic_request_intr(struct fnic *fnic);
330*4882a593Smuzhiyun
331*4882a593Smuzhiyun int fnic_send(struct fc_lport *, struct fc_frame *);
332*4882a593Smuzhiyun void fnic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf);
333*4882a593Smuzhiyun void fnic_handle_frame(struct work_struct *work);
334*4882a593Smuzhiyun void fnic_handle_link(struct work_struct *work);
335*4882a593Smuzhiyun void fnic_handle_event(struct work_struct *work);
336*4882a593Smuzhiyun int fnic_rq_cmpl_handler(struct fnic *fnic, int);
337*4882a593Smuzhiyun int fnic_alloc_rq_frame(struct vnic_rq *rq);
338*4882a593Smuzhiyun void fnic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf);
339*4882a593Smuzhiyun void fnic_flush_tx(struct fnic *);
340*4882a593Smuzhiyun void fnic_eth_send(struct fcoe_ctlr *, struct sk_buff *skb);
341*4882a593Smuzhiyun void fnic_set_port_id(struct fc_lport *, u32, struct fc_frame *);
342*4882a593Smuzhiyun void fnic_update_mac(struct fc_lport *, u8 *new);
343*4882a593Smuzhiyun void fnic_update_mac_locked(struct fnic *, u8 *new);
344*4882a593Smuzhiyun
345*4882a593Smuzhiyun int fnic_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
346*4882a593Smuzhiyun int fnic_abort_cmd(struct scsi_cmnd *);
347*4882a593Smuzhiyun int fnic_device_reset(struct scsi_cmnd *);
348*4882a593Smuzhiyun int fnic_host_reset(struct scsi_cmnd *);
349*4882a593Smuzhiyun int fnic_reset(struct Scsi_Host *);
350*4882a593Smuzhiyun void fnic_scsi_cleanup(struct fc_lport *);
351*4882a593Smuzhiyun void fnic_scsi_abort_io(struct fc_lport *);
352*4882a593Smuzhiyun void fnic_empty_scsi_cleanup(struct fc_lport *);
353*4882a593Smuzhiyun void fnic_exch_mgr_reset(struct fc_lport *, u32, u32);
354*4882a593Smuzhiyun int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int);
355*4882a593Smuzhiyun int fnic_wq_cmpl_handler(struct fnic *fnic, int);
356*4882a593Smuzhiyun int fnic_flogi_reg_handler(struct fnic *fnic, u32);
357*4882a593Smuzhiyun void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
358*4882a593Smuzhiyun struct fcpio_host_req *desc);
359*4882a593Smuzhiyun int fnic_fw_reset_handler(struct fnic *fnic);
360*4882a593Smuzhiyun void fnic_terminate_rport_io(struct fc_rport *);
361*4882a593Smuzhiyun const char *fnic_state_to_str(unsigned int state);
362*4882a593Smuzhiyun
363*4882a593Smuzhiyun void fnic_log_q_error(struct fnic *fnic);
364*4882a593Smuzhiyun void fnic_handle_link_event(struct fnic *fnic);
365*4882a593Smuzhiyun
366*4882a593Smuzhiyun int fnic_is_abts_pending(struct fnic *, struct scsi_cmnd *);
367*4882a593Smuzhiyun
368*4882a593Smuzhiyun void fnic_handle_fip_frame(struct work_struct *work);
369*4882a593Smuzhiyun void fnic_handle_fip_event(struct fnic *fnic);
370*4882a593Smuzhiyun void fnic_fcoe_reset_vlans(struct fnic *fnic);
371*4882a593Smuzhiyun void fnic_fcoe_evlist_free(struct fnic *fnic);
372*4882a593Smuzhiyun extern void fnic_handle_fip_timer(struct fnic *fnic);
373*4882a593Smuzhiyun
374*4882a593Smuzhiyun static inline int
fnic_chk_state_flags_locked(struct fnic * fnic,unsigned long st_flags)375*4882a593Smuzhiyun fnic_chk_state_flags_locked(struct fnic *fnic, unsigned long st_flags)
376*4882a593Smuzhiyun {
377*4882a593Smuzhiyun return ((fnic->state_flags & st_flags) == st_flags);
378*4882a593Smuzhiyun }
379*4882a593Smuzhiyun void __fnic_set_state_flags(struct fnic *, unsigned long, unsigned long);
380*4882a593Smuzhiyun void fnic_dump_fchost_stats(struct Scsi_Host *, struct fc_host_statistics *);
381*4882a593Smuzhiyun #endif /* _FNIC_H_ */
382