xref: /kernel/linux/linux-5.10/drivers/scsi/fnic/fnic.h (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
38c2ecf20Sopenharmony_ci * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This program is free software; you may redistribute it and/or modify
68c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License as published by
78c2ecf20Sopenharmony_ci * the Free Software Foundation; version 2 of the License.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
108c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
118c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
128c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
138c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
148c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
158c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
168c2ecf20Sopenharmony_ci * SOFTWARE.
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci#ifndef _FNIC_H_
198c2ecf20Sopenharmony_ci#define _FNIC_H_
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
228c2ecf20Sopenharmony_ci#include <linux/netdevice.h>
238c2ecf20Sopenharmony_ci#include <linux/workqueue.h>
248c2ecf20Sopenharmony_ci#include <linux/bitops.h>
258c2ecf20Sopenharmony_ci#include <scsi/libfc.h>
268c2ecf20Sopenharmony_ci#include <scsi/libfcoe.h>
278c2ecf20Sopenharmony_ci#include "fnic_io.h"
288c2ecf20Sopenharmony_ci#include "fnic_res.h"
298c2ecf20Sopenharmony_ci#include "fnic_trace.h"
308c2ecf20Sopenharmony_ci#include "fnic_stats.h"
318c2ecf20Sopenharmony_ci#include "vnic_dev.h"
328c2ecf20Sopenharmony_ci#include "vnic_wq.h"
338c2ecf20Sopenharmony_ci#include "vnic_rq.h"
348c2ecf20Sopenharmony_ci#include "vnic_cq.h"
358c2ecf20Sopenharmony_ci#include "vnic_wq_copy.h"
368c2ecf20Sopenharmony_ci#include "vnic_intr.h"
378c2ecf20Sopenharmony_ci#include "vnic_stats.h"
388c2ecf20Sopenharmony_ci#include "vnic_scsi.h"
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define DRV_NAME		"fnic"
418c2ecf20Sopenharmony_ci#define DRV_DESCRIPTION		"Cisco FCoE HBA Driver"
428c2ecf20Sopenharmony_ci#define DRV_VERSION		"1.6.0.47"
438c2ecf20Sopenharmony_ci#define PFX			DRV_NAME ": "
448c2ecf20Sopenharmony_ci#define DFX                     DRV_NAME "%d: "
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define DESC_CLEAN_LOW_WATERMARK 8
478c2ecf20Sopenharmony_ci#define FNIC_UCSM_DFLT_THROTTLE_CNT_BLD	16 /* UCSM default throttle count */
488c2ecf20Sopenharmony_ci#define FNIC_MIN_IO_REQ			256 /* Min IO throttle count */
498c2ecf20Sopenharmony_ci#define FNIC_MAX_IO_REQ		1024 /* scsi_cmnd tag map entries */
508c2ecf20Sopenharmony_ci#define FNIC_DFLT_IO_REQ        256 /* Default scsi_cmnd tag map entries */
518c2ecf20Sopenharmony_ci#define	FNIC_IO_LOCKS		64 /* IO locks: power of 2 */
528c2ecf20Sopenharmony_ci#define FNIC_DFLT_QUEUE_DEPTH	256
538c2ecf20Sopenharmony_ci#define	FNIC_STATS_RATE_LIMIT	4 /* limit rate at which stats are pulled up */
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/*
568c2ecf20Sopenharmony_ci * Tag bits used for special requests.
578c2ecf20Sopenharmony_ci */
588c2ecf20Sopenharmony_ci#define FNIC_TAG_ABORT		BIT(30)		/* tag bit indicating abort */
598c2ecf20Sopenharmony_ci#define FNIC_TAG_DEV_RST	BIT(29)		/* indicates device reset */
608c2ecf20Sopenharmony_ci#define FNIC_TAG_MASK		(BIT(24) - 1)	/* mask for lookup */
618c2ecf20Sopenharmony_ci#define FNIC_NO_TAG             -1
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/*
648c2ecf20Sopenharmony_ci * Command flags to identify the type of command and for other future
658c2ecf20Sopenharmony_ci * use.
668c2ecf20Sopenharmony_ci */
678c2ecf20Sopenharmony_ci#define FNIC_NO_FLAGS                   0
688c2ecf20Sopenharmony_ci#define FNIC_IO_INITIALIZED             BIT(0)
698c2ecf20Sopenharmony_ci#define FNIC_IO_ISSUED                  BIT(1)
708c2ecf20Sopenharmony_ci#define FNIC_IO_DONE                    BIT(2)
718c2ecf20Sopenharmony_ci#define FNIC_IO_REQ_NULL                BIT(3)
728c2ecf20Sopenharmony_ci#define FNIC_IO_ABTS_PENDING            BIT(4)
738c2ecf20Sopenharmony_ci#define FNIC_IO_ABORTED                 BIT(5)
748c2ecf20Sopenharmony_ci#define FNIC_IO_ABTS_ISSUED             BIT(6)
758c2ecf20Sopenharmony_ci#define FNIC_IO_TERM_ISSUED             BIT(7)
768c2ecf20Sopenharmony_ci#define FNIC_IO_INTERNAL_TERM_ISSUED    BIT(8)
778c2ecf20Sopenharmony_ci#define FNIC_IO_ABT_TERM_DONE           BIT(9)
788c2ecf20Sopenharmony_ci#define FNIC_IO_ABT_TERM_REQ_NULL       BIT(10)
798c2ecf20Sopenharmony_ci#define FNIC_IO_ABT_TERM_TIMED_OUT      BIT(11)
808c2ecf20Sopenharmony_ci#define FNIC_DEVICE_RESET               BIT(12)  /* Device reset request */
818c2ecf20Sopenharmony_ci#define FNIC_DEV_RST_ISSUED             BIT(13)
828c2ecf20Sopenharmony_ci#define FNIC_DEV_RST_TIMED_OUT          BIT(14)
838c2ecf20Sopenharmony_ci#define FNIC_DEV_RST_ABTS_ISSUED        BIT(15)
848c2ecf20Sopenharmony_ci#define FNIC_DEV_RST_TERM_ISSUED        BIT(16)
858c2ecf20Sopenharmony_ci#define FNIC_DEV_RST_DONE               BIT(17)
868c2ecf20Sopenharmony_ci#define FNIC_DEV_RST_REQ_NULL           BIT(18)
878c2ecf20Sopenharmony_ci#define FNIC_DEV_RST_ABTS_DONE          BIT(19)
888c2ecf20Sopenharmony_ci#define FNIC_DEV_RST_TERM_DONE          BIT(20)
898c2ecf20Sopenharmony_ci#define FNIC_DEV_RST_ABTS_PENDING       BIT(21)
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci/*
928c2ecf20Sopenharmony_ci * Usage of the scsi_cmnd scratchpad.
938c2ecf20Sopenharmony_ci * These fields are locked by the hashed io_req_lock.
948c2ecf20Sopenharmony_ci */
958c2ecf20Sopenharmony_ci#define CMD_SP(Cmnd)		((Cmnd)->SCp.ptr)
968c2ecf20Sopenharmony_ci#define CMD_STATE(Cmnd)		((Cmnd)->SCp.phase)
978c2ecf20Sopenharmony_ci#define CMD_ABTS_STATUS(Cmnd)	((Cmnd)->SCp.Message)
988c2ecf20Sopenharmony_ci#define CMD_LR_STATUS(Cmnd)	((Cmnd)->SCp.have_data_in)
998c2ecf20Sopenharmony_ci#define CMD_TAG(Cmnd)           ((Cmnd)->SCp.sent_command)
1008c2ecf20Sopenharmony_ci#define CMD_FLAGS(Cmnd)         ((Cmnd)->SCp.Status)
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci#define FCPIO_INVALID_CODE 0x100 /* hdr_status value unused by firmware */
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci#define FNIC_LUN_RESET_TIMEOUT	     10000	/* mSec */
1058c2ecf20Sopenharmony_ci#define FNIC_HOST_RESET_TIMEOUT	     10000	/* mSec */
1068c2ecf20Sopenharmony_ci#define FNIC_RMDEVICE_TIMEOUT        1000       /* mSec */
1078c2ecf20Sopenharmony_ci#define FNIC_HOST_RESET_SETTLE_TIME  30         /* Sec */
1088c2ecf20Sopenharmony_ci#define FNIC_ABT_TERM_DELAY_TIMEOUT  500        /* mSec */
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#define FNIC_MAX_FCP_TARGET     256
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci/**
1138c2ecf20Sopenharmony_ci * state_flags to identify host state along along with fnic's state
1148c2ecf20Sopenharmony_ci **/
1158c2ecf20Sopenharmony_ci#define __FNIC_FLAGS_FWRESET		BIT(0) /* fwreset in progress */
1168c2ecf20Sopenharmony_ci#define __FNIC_FLAGS_BLOCK_IO		BIT(1) /* IOs are blocked */
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#define FNIC_FLAGS_NONE			(0)
1198c2ecf20Sopenharmony_ci#define FNIC_FLAGS_FWRESET		(__FNIC_FLAGS_FWRESET | \
1208c2ecf20Sopenharmony_ci					__FNIC_FLAGS_BLOCK_IO)
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci#define FNIC_FLAGS_IO_BLOCKED		(__FNIC_FLAGS_BLOCK_IO)
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci#define fnic_set_state_flags(fnicp, st_flags)	\
1258c2ecf20Sopenharmony_ci	__fnic_set_state_flags(fnicp, st_flags, 0)
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci#define fnic_clear_state_flags(fnicp, st_flags)  \
1288c2ecf20Sopenharmony_ci	__fnic_set_state_flags(fnicp, st_flags, 1)
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ciextern unsigned int fnic_log_level;
1318c2ecf20Sopenharmony_ciextern unsigned int io_completions;
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci#define FNIC_MAIN_LOGGING 0x01
1348c2ecf20Sopenharmony_ci#define FNIC_FCS_LOGGING 0x02
1358c2ecf20Sopenharmony_ci#define FNIC_SCSI_LOGGING 0x04
1368c2ecf20Sopenharmony_ci#define FNIC_ISR_LOGGING 0x08
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci#define FNIC_CHECK_LOGGING(LEVEL, CMD)				\
1398c2ecf20Sopenharmony_cido {								\
1408c2ecf20Sopenharmony_ci	if (unlikely(fnic_log_level & LEVEL))			\
1418c2ecf20Sopenharmony_ci		do {						\
1428c2ecf20Sopenharmony_ci			CMD;					\
1438c2ecf20Sopenharmony_ci		} while (0);					\
1448c2ecf20Sopenharmony_ci} while (0)
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci#define FNIC_MAIN_DBG(kern_level, host, fmt, args...)		\
1478c2ecf20Sopenharmony_ci	FNIC_CHECK_LOGGING(FNIC_MAIN_LOGGING,			\
1488c2ecf20Sopenharmony_ci			 shost_printk(kern_level, host, fmt, ##args);)
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci#define FNIC_FCS_DBG(kern_level, host, fmt, args...)		\
1518c2ecf20Sopenharmony_ci	FNIC_CHECK_LOGGING(FNIC_FCS_LOGGING,			\
1528c2ecf20Sopenharmony_ci			 shost_printk(kern_level, host, fmt, ##args);)
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci#define FNIC_SCSI_DBG(kern_level, host, fmt, args...)		\
1558c2ecf20Sopenharmony_ci	FNIC_CHECK_LOGGING(FNIC_SCSI_LOGGING,			\
1568c2ecf20Sopenharmony_ci			 shost_printk(kern_level, host, fmt, ##args);)
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci#define FNIC_ISR_DBG(kern_level, host, fmt, args...)		\
1598c2ecf20Sopenharmony_ci	FNIC_CHECK_LOGGING(FNIC_ISR_LOGGING,			\
1608c2ecf20Sopenharmony_ci			 shost_printk(kern_level, host, fmt, ##args);)
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci#define FNIC_MAIN_NOTE(kern_level, host, fmt, args...)          \
1638c2ecf20Sopenharmony_ci	shost_printk(kern_level, host, fmt, ##args)
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ciextern const char *fnic_state_str[];
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_cienum fnic_intx_intr_index {
1688c2ecf20Sopenharmony_ci	FNIC_INTX_WQ_RQ_COPYWQ,
1698c2ecf20Sopenharmony_ci	FNIC_INTX_ERR,
1708c2ecf20Sopenharmony_ci	FNIC_INTX_NOTIFY,
1718c2ecf20Sopenharmony_ci	FNIC_INTX_INTR_MAX,
1728c2ecf20Sopenharmony_ci};
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_cienum fnic_msix_intr_index {
1758c2ecf20Sopenharmony_ci	FNIC_MSIX_RQ,
1768c2ecf20Sopenharmony_ci	FNIC_MSIX_WQ,
1778c2ecf20Sopenharmony_ci	FNIC_MSIX_WQ_COPY,
1788c2ecf20Sopenharmony_ci	FNIC_MSIX_ERR_NOTIFY,
1798c2ecf20Sopenharmony_ci	FNIC_MSIX_INTR_MAX,
1808c2ecf20Sopenharmony_ci};
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_cistruct fnic_msix_entry {
1838c2ecf20Sopenharmony_ci	int requested;
1848c2ecf20Sopenharmony_ci	char devname[IFNAMSIZ + 11];
1858c2ecf20Sopenharmony_ci	irqreturn_t (*isr)(int, void *);
1868c2ecf20Sopenharmony_ci	void *devid;
1878c2ecf20Sopenharmony_ci};
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_cienum fnic_state {
1908c2ecf20Sopenharmony_ci	FNIC_IN_FC_MODE = 0,
1918c2ecf20Sopenharmony_ci	FNIC_IN_FC_TRANS_ETH_MODE,
1928c2ecf20Sopenharmony_ci	FNIC_IN_ETH_MODE,
1938c2ecf20Sopenharmony_ci	FNIC_IN_ETH_TRANS_FC_MODE,
1948c2ecf20Sopenharmony_ci};
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci#define FNIC_WQ_COPY_MAX 1
1978c2ecf20Sopenharmony_ci#define FNIC_WQ_MAX 1
1988c2ecf20Sopenharmony_ci#define FNIC_RQ_MAX 1
1998c2ecf20Sopenharmony_ci#define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX)
2008c2ecf20Sopenharmony_ci#define FNIC_DFLT_IO_COMPLETIONS 256
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_cistruct mempool;
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_cienum fnic_evt {
2058c2ecf20Sopenharmony_ci	FNIC_EVT_START_VLAN_DISC = 1,
2068c2ecf20Sopenharmony_ci	FNIC_EVT_START_FCF_DISC = 2,
2078c2ecf20Sopenharmony_ci	FNIC_EVT_MAX,
2088c2ecf20Sopenharmony_ci};
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_cistruct fnic_event {
2118c2ecf20Sopenharmony_ci	struct list_head list;
2128c2ecf20Sopenharmony_ci	struct fnic *fnic;
2138c2ecf20Sopenharmony_ci	enum fnic_evt event;
2148c2ecf20Sopenharmony_ci};
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci/* Per-instance private data structure */
2178c2ecf20Sopenharmony_cistruct fnic {
2188c2ecf20Sopenharmony_ci	struct fc_lport *lport;
2198c2ecf20Sopenharmony_ci	struct fcoe_ctlr ctlr;		/* FIP FCoE controller structure */
2208c2ecf20Sopenharmony_ci	struct vnic_dev_bar bar0;
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci	struct fnic_msix_entry msix[FNIC_MSIX_INTR_MAX];
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci	struct vnic_stats *stats;
2258c2ecf20Sopenharmony_ci	unsigned long stats_time;	/* time of stats update */
2268c2ecf20Sopenharmony_ci	unsigned long stats_reset_time; /* time of stats reset */
2278c2ecf20Sopenharmony_ci	struct vnic_nic_cfg *nic_cfg;
2288c2ecf20Sopenharmony_ci	char name[IFNAMSIZ];
2298c2ecf20Sopenharmony_ci	struct timer_list notify_timer; /* used for MSI interrupts */
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci	unsigned int fnic_max_tag_id;
2328c2ecf20Sopenharmony_ci	unsigned int err_intr_offset;
2338c2ecf20Sopenharmony_ci	unsigned int link_intr_offset;
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci	unsigned int wq_count;
2368c2ecf20Sopenharmony_ci	unsigned int cq_count;
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci	struct dentry *fnic_stats_debugfs_host;
2398c2ecf20Sopenharmony_ci	struct dentry *fnic_stats_debugfs_file;
2408c2ecf20Sopenharmony_ci	struct dentry *fnic_reset_debugfs_file;
2418c2ecf20Sopenharmony_ci	unsigned int reset_stats;
2428c2ecf20Sopenharmony_ci	atomic64_t io_cmpl_skip;
2438c2ecf20Sopenharmony_ci	struct fnic_stats fnic_stats;
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci	u32 vlan_hw_insert:1;	        /* let hw insert the tag */
2468c2ecf20Sopenharmony_ci	u32 in_remove:1;                /* fnic device in removal */
2478c2ecf20Sopenharmony_ci	u32 stop_rx_link_events:1;      /* stop proc. rx frames, link events */
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci	struct completion *remove_wait; /* device remove thread blocks */
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci	atomic_t in_flight;		/* io counter */
2528c2ecf20Sopenharmony_ci	bool internal_reset_inprogress;
2538c2ecf20Sopenharmony_ci	u32 _reserved;			/* fill hole */
2548c2ecf20Sopenharmony_ci	unsigned long state_flags;	/* protected by host lock */
2558c2ecf20Sopenharmony_ci	enum fnic_state state;
2568c2ecf20Sopenharmony_ci	spinlock_t fnic_lock;
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci	u16 vlan_id;	                /* VLAN tag including priority */
2598c2ecf20Sopenharmony_ci	u8 data_src_addr[ETH_ALEN];
2608c2ecf20Sopenharmony_ci	u64 fcp_input_bytes;		/* internal statistic */
2618c2ecf20Sopenharmony_ci	u64 fcp_output_bytes;		/* internal statistic */
2628c2ecf20Sopenharmony_ci	u32 link_down_cnt;
2638c2ecf20Sopenharmony_ci	int link_status;
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci	struct list_head list;
2668c2ecf20Sopenharmony_ci	struct pci_dev *pdev;
2678c2ecf20Sopenharmony_ci	struct vnic_fc_config config;
2688c2ecf20Sopenharmony_ci	struct vnic_dev *vdev;
2698c2ecf20Sopenharmony_ci	unsigned int raw_wq_count;
2708c2ecf20Sopenharmony_ci	unsigned int wq_copy_count;
2718c2ecf20Sopenharmony_ci	unsigned int rq_count;
2728c2ecf20Sopenharmony_ci	int fw_ack_index[FNIC_WQ_COPY_MAX];
2738c2ecf20Sopenharmony_ci	unsigned short fw_ack_recd[FNIC_WQ_COPY_MAX];
2748c2ecf20Sopenharmony_ci	unsigned short wq_copy_desc_low[FNIC_WQ_COPY_MAX];
2758c2ecf20Sopenharmony_ci	unsigned int intr_count;
2768c2ecf20Sopenharmony_ci	u32 __iomem *legacy_pba;
2778c2ecf20Sopenharmony_ci	struct fnic_host_tag *tags;
2788c2ecf20Sopenharmony_ci	mempool_t *io_req_pool;
2798c2ecf20Sopenharmony_ci	mempool_t *io_sgl_pool[FNIC_SGL_NUM_CACHES];
2808c2ecf20Sopenharmony_ci	spinlock_t io_req_lock[FNIC_IO_LOCKS];	/* locks for scsi cmnds */
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci	struct work_struct link_work;
2838c2ecf20Sopenharmony_ci	struct work_struct frame_work;
2848c2ecf20Sopenharmony_ci	struct sk_buff_head frame_queue;
2858c2ecf20Sopenharmony_ci	struct sk_buff_head tx_queue;
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci	/*** FIP related data members  -- start ***/
2888c2ecf20Sopenharmony_ci	void (*set_vlan)(struct fnic *, u16 vlan);
2898c2ecf20Sopenharmony_ci	struct work_struct      fip_frame_work;
2908c2ecf20Sopenharmony_ci	struct sk_buff_head     fip_frame_queue;
2918c2ecf20Sopenharmony_ci	struct timer_list       fip_timer;
2928c2ecf20Sopenharmony_ci	struct list_head        vlans;
2938c2ecf20Sopenharmony_ci	spinlock_t              vlans_lock;
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci	struct work_struct      event_work;
2968c2ecf20Sopenharmony_ci	struct list_head        evlist;
2978c2ecf20Sopenharmony_ci	/*** FIP related data members  -- end ***/
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci	/* copy work queue cache line section */
3008c2ecf20Sopenharmony_ci	____cacheline_aligned struct vnic_wq_copy wq_copy[FNIC_WQ_COPY_MAX];
3018c2ecf20Sopenharmony_ci	/* completion queue cache line section */
3028c2ecf20Sopenharmony_ci	____cacheline_aligned struct vnic_cq cq[FNIC_CQ_MAX];
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci	spinlock_t wq_copy_lock[FNIC_WQ_COPY_MAX];
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ci	/* work queue cache line section */
3078c2ecf20Sopenharmony_ci	____cacheline_aligned struct vnic_wq wq[FNIC_WQ_MAX];
3088c2ecf20Sopenharmony_ci	spinlock_t wq_lock[FNIC_WQ_MAX];
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_ci	/* receive queue cache line section */
3118c2ecf20Sopenharmony_ci	____cacheline_aligned struct vnic_rq rq[FNIC_RQ_MAX];
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci	/* interrupt resource cache line section */
3148c2ecf20Sopenharmony_ci	____cacheline_aligned struct vnic_intr intr[FNIC_MSIX_INTR_MAX];
3158c2ecf20Sopenharmony_ci};
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_cistatic inline struct fnic *fnic_from_ctlr(struct fcoe_ctlr *fip)
3188c2ecf20Sopenharmony_ci{
3198c2ecf20Sopenharmony_ci	return container_of(fip, struct fnic, ctlr);
3208c2ecf20Sopenharmony_ci}
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ciextern struct workqueue_struct *fnic_event_queue;
3238c2ecf20Sopenharmony_ciextern struct workqueue_struct *fnic_fip_queue;
3248c2ecf20Sopenharmony_ciextern struct device_attribute *fnic_attrs[];
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_civoid fnic_clear_intr_mode(struct fnic *fnic);
3278c2ecf20Sopenharmony_ciint fnic_set_intr_mode(struct fnic *fnic);
3288c2ecf20Sopenharmony_civoid fnic_free_intr(struct fnic *fnic);
3298c2ecf20Sopenharmony_ciint fnic_request_intr(struct fnic *fnic);
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ciint fnic_send(struct fc_lport *, struct fc_frame *);
3328c2ecf20Sopenharmony_civoid fnic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf);
3338c2ecf20Sopenharmony_civoid fnic_handle_frame(struct work_struct *work);
3348c2ecf20Sopenharmony_civoid fnic_handle_link(struct work_struct *work);
3358c2ecf20Sopenharmony_civoid fnic_handle_event(struct work_struct *work);
3368c2ecf20Sopenharmony_ciint fnic_rq_cmpl_handler(struct fnic *fnic, int);
3378c2ecf20Sopenharmony_ciint fnic_alloc_rq_frame(struct vnic_rq *rq);
3388c2ecf20Sopenharmony_civoid fnic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf);
3398c2ecf20Sopenharmony_civoid fnic_flush_tx(struct fnic *);
3408c2ecf20Sopenharmony_civoid fnic_eth_send(struct fcoe_ctlr *, struct sk_buff *skb);
3418c2ecf20Sopenharmony_civoid fnic_set_port_id(struct fc_lport *, u32, struct fc_frame *);
3428c2ecf20Sopenharmony_civoid fnic_update_mac(struct fc_lport *, u8 *new);
3438c2ecf20Sopenharmony_civoid fnic_update_mac_locked(struct fnic *, u8 *new);
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ciint fnic_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
3468c2ecf20Sopenharmony_ciint fnic_abort_cmd(struct scsi_cmnd *);
3478c2ecf20Sopenharmony_ciint fnic_device_reset(struct scsi_cmnd *);
3488c2ecf20Sopenharmony_ciint fnic_host_reset(struct scsi_cmnd *);
3498c2ecf20Sopenharmony_ciint fnic_reset(struct Scsi_Host *);
3508c2ecf20Sopenharmony_civoid fnic_scsi_cleanup(struct fc_lport *);
3518c2ecf20Sopenharmony_civoid fnic_scsi_abort_io(struct fc_lport *);
3528c2ecf20Sopenharmony_civoid fnic_empty_scsi_cleanup(struct fc_lport *);
3538c2ecf20Sopenharmony_civoid fnic_exch_mgr_reset(struct fc_lport *, u32, u32);
3548c2ecf20Sopenharmony_ciint fnic_wq_copy_cmpl_handler(struct fnic *fnic, int);
3558c2ecf20Sopenharmony_ciint fnic_wq_cmpl_handler(struct fnic *fnic, int);
3568c2ecf20Sopenharmony_ciint fnic_flogi_reg_handler(struct fnic *fnic, u32);
3578c2ecf20Sopenharmony_civoid fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
3588c2ecf20Sopenharmony_ci				  struct fcpio_host_req *desc);
3598c2ecf20Sopenharmony_ciint fnic_fw_reset_handler(struct fnic *fnic);
3608c2ecf20Sopenharmony_civoid fnic_terminate_rport_io(struct fc_rport *);
3618c2ecf20Sopenharmony_ciconst char *fnic_state_to_str(unsigned int state);
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_civoid fnic_log_q_error(struct fnic *fnic);
3648c2ecf20Sopenharmony_civoid fnic_handle_link_event(struct fnic *fnic);
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ciint fnic_is_abts_pending(struct fnic *, struct scsi_cmnd *);
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_civoid fnic_handle_fip_frame(struct work_struct *work);
3698c2ecf20Sopenharmony_civoid fnic_handle_fip_event(struct fnic *fnic);
3708c2ecf20Sopenharmony_civoid fnic_fcoe_reset_vlans(struct fnic *fnic);
3718c2ecf20Sopenharmony_civoid fnic_fcoe_evlist_free(struct fnic *fnic);
3728c2ecf20Sopenharmony_ciextern void fnic_handle_fip_timer(struct fnic *fnic);
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_cistatic inline int
3758c2ecf20Sopenharmony_cifnic_chk_state_flags_locked(struct fnic *fnic, unsigned long st_flags)
3768c2ecf20Sopenharmony_ci{
3778c2ecf20Sopenharmony_ci	return ((fnic->state_flags & st_flags) == st_flags);
3788c2ecf20Sopenharmony_ci}
3798c2ecf20Sopenharmony_civoid __fnic_set_state_flags(struct fnic *, unsigned long, unsigned long);
3808c2ecf20Sopenharmony_civoid fnic_dump_fchost_stats(struct Scsi_Host *, struct fc_host_statistics *);
3818c2ecf20Sopenharmony_ci#endif /* _FNIC_H_ */
382