xref: /kernel/linux/linux-6.6/drivers/scsi/fnic/fnic.h (revision 62306a36)
162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
462306a36Sopenharmony_ci * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci#ifndef _FNIC_H_
762306a36Sopenharmony_ci#define _FNIC_H_
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/interrupt.h>
1062306a36Sopenharmony_ci#include <linux/netdevice.h>
1162306a36Sopenharmony_ci#include <linux/workqueue.h>
1262306a36Sopenharmony_ci#include <linux/bitops.h>
1362306a36Sopenharmony_ci#include <scsi/libfc.h>
1462306a36Sopenharmony_ci#include <scsi/libfcoe.h>
1562306a36Sopenharmony_ci#include "fnic_io.h"
1662306a36Sopenharmony_ci#include "fnic_res.h"
1762306a36Sopenharmony_ci#include "fnic_trace.h"
1862306a36Sopenharmony_ci#include "fnic_stats.h"
1962306a36Sopenharmony_ci#include "vnic_dev.h"
2062306a36Sopenharmony_ci#include "vnic_wq.h"
2162306a36Sopenharmony_ci#include "vnic_rq.h"
2262306a36Sopenharmony_ci#include "vnic_cq.h"
2362306a36Sopenharmony_ci#include "vnic_wq_copy.h"
2462306a36Sopenharmony_ci#include "vnic_intr.h"
2562306a36Sopenharmony_ci#include "vnic_stats.h"
2662306a36Sopenharmony_ci#include "vnic_scsi.h"
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#define DRV_NAME		"fnic"
2962306a36Sopenharmony_ci#define DRV_DESCRIPTION		"Cisco FCoE HBA Driver"
3062306a36Sopenharmony_ci#define DRV_VERSION		"1.6.0.57"
3162306a36Sopenharmony_ci#define PFX			DRV_NAME ": "
3262306a36Sopenharmony_ci#define DFX                     DRV_NAME "%d: "
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define DESC_CLEAN_LOW_WATERMARK 8
3562306a36Sopenharmony_ci#define FNIC_UCSM_DFLT_THROTTLE_CNT_BLD	16 /* UCSM default throttle count */
3662306a36Sopenharmony_ci#define FNIC_MIN_IO_REQ			256 /* Min IO throttle count */
3762306a36Sopenharmony_ci#define FNIC_MAX_IO_REQ		1024 /* scsi_cmnd tag map entries */
3862306a36Sopenharmony_ci#define FNIC_DFLT_IO_REQ        256 /* Default scsi_cmnd tag map entries */
3962306a36Sopenharmony_ci#define	FNIC_IO_LOCKS		64 /* IO locks: power of 2 */
4062306a36Sopenharmony_ci#define FNIC_DFLT_QUEUE_DEPTH	256
4162306a36Sopenharmony_ci#define	FNIC_STATS_RATE_LIMIT	4 /* limit rate at which stats are pulled up */
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/*
4462306a36Sopenharmony_ci * Tag bits used for special requests.
4562306a36Sopenharmony_ci */
4662306a36Sopenharmony_ci#define FNIC_TAG_ABORT		BIT(30)		/* tag bit indicating abort */
4762306a36Sopenharmony_ci#define FNIC_TAG_DEV_RST	BIT(29)		/* indicates device reset */
4862306a36Sopenharmony_ci#define FNIC_TAG_MASK		(BIT(24) - 1)	/* mask for lookup */
4962306a36Sopenharmony_ci#define FNIC_NO_TAG             -1
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/*
5262306a36Sopenharmony_ci * Command flags to identify the type of command and for other future
5362306a36Sopenharmony_ci * use.
5462306a36Sopenharmony_ci */
5562306a36Sopenharmony_ci#define FNIC_NO_FLAGS                   0
5662306a36Sopenharmony_ci#define FNIC_IO_INITIALIZED             BIT(0)
5762306a36Sopenharmony_ci#define FNIC_IO_ISSUED                  BIT(1)
5862306a36Sopenharmony_ci#define FNIC_IO_DONE                    BIT(2)
5962306a36Sopenharmony_ci#define FNIC_IO_REQ_NULL                BIT(3)
6062306a36Sopenharmony_ci#define FNIC_IO_ABTS_PENDING            BIT(4)
6162306a36Sopenharmony_ci#define FNIC_IO_ABORTED                 BIT(5)
6262306a36Sopenharmony_ci#define FNIC_IO_ABTS_ISSUED             BIT(6)
6362306a36Sopenharmony_ci#define FNIC_IO_TERM_ISSUED             BIT(7)
6462306a36Sopenharmony_ci#define FNIC_IO_INTERNAL_TERM_ISSUED    BIT(8)
6562306a36Sopenharmony_ci#define FNIC_IO_ABT_TERM_DONE           BIT(9)
6662306a36Sopenharmony_ci#define FNIC_IO_ABT_TERM_REQ_NULL       BIT(10)
6762306a36Sopenharmony_ci#define FNIC_IO_ABT_TERM_TIMED_OUT      BIT(11)
6862306a36Sopenharmony_ci#define FNIC_DEVICE_RESET               BIT(12)  /* Device reset request */
6962306a36Sopenharmony_ci#define FNIC_DEV_RST_ISSUED             BIT(13)
7062306a36Sopenharmony_ci#define FNIC_DEV_RST_TIMED_OUT          BIT(14)
7162306a36Sopenharmony_ci#define FNIC_DEV_RST_ABTS_ISSUED        BIT(15)
7262306a36Sopenharmony_ci#define FNIC_DEV_RST_TERM_ISSUED        BIT(16)
7362306a36Sopenharmony_ci#define FNIC_DEV_RST_DONE               BIT(17)
7462306a36Sopenharmony_ci#define FNIC_DEV_RST_REQ_NULL           BIT(18)
7562306a36Sopenharmony_ci#define FNIC_DEV_RST_ABTS_DONE          BIT(19)
7662306a36Sopenharmony_ci#define FNIC_DEV_RST_TERM_DONE          BIT(20)
7762306a36Sopenharmony_ci#define FNIC_DEV_RST_ABTS_PENDING       BIT(21)
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci/*
8062306a36Sopenharmony_ci * fnic private data per SCSI command.
8162306a36Sopenharmony_ci * These fields are locked by the hashed io_req_lock.
8262306a36Sopenharmony_ci */
8362306a36Sopenharmony_cistruct fnic_cmd_priv {
8462306a36Sopenharmony_ci	struct fnic_io_req *io_req;
8562306a36Sopenharmony_ci	enum fnic_ioreq_state state;
8662306a36Sopenharmony_ci	u32 flags;
8762306a36Sopenharmony_ci	u16 abts_status;
8862306a36Sopenharmony_ci	u16 lr_status;
8962306a36Sopenharmony_ci};
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_cistatic inline struct fnic_cmd_priv *fnic_priv(struct scsi_cmnd *cmd)
9262306a36Sopenharmony_ci{
9362306a36Sopenharmony_ci	return scsi_cmd_priv(cmd);
9462306a36Sopenharmony_ci}
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_cistatic inline u64 fnic_flags_and_state(struct scsi_cmnd *cmd)
9762306a36Sopenharmony_ci{
9862306a36Sopenharmony_ci	struct fnic_cmd_priv *fcmd = fnic_priv(cmd);
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci	return ((u64)fcmd->flags << 32) | fcmd->state;
10162306a36Sopenharmony_ci}
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#define FCPIO_INVALID_CODE 0x100 /* hdr_status value unused by firmware */
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci#define FNIC_LUN_RESET_TIMEOUT	     10000	/* mSec */
10662306a36Sopenharmony_ci#define FNIC_HOST_RESET_TIMEOUT	     10000	/* mSec */
10762306a36Sopenharmony_ci#define FNIC_RMDEVICE_TIMEOUT        1000       /* mSec */
10862306a36Sopenharmony_ci#define FNIC_HOST_RESET_SETTLE_TIME  30         /* Sec */
10962306a36Sopenharmony_ci#define FNIC_ABT_TERM_DELAY_TIMEOUT  500        /* mSec */
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci#define FNIC_MAX_FCP_TARGET     256
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci/**
11462306a36Sopenharmony_ci * state_flags to identify host state along along with fnic's state
11562306a36Sopenharmony_ci **/
11662306a36Sopenharmony_ci#define __FNIC_FLAGS_FWRESET		BIT(0) /* fwreset in progress */
11762306a36Sopenharmony_ci#define __FNIC_FLAGS_BLOCK_IO		BIT(1) /* IOs are blocked */
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci#define FNIC_FLAGS_NONE			(0)
12062306a36Sopenharmony_ci#define FNIC_FLAGS_FWRESET		(__FNIC_FLAGS_FWRESET | \
12162306a36Sopenharmony_ci					__FNIC_FLAGS_BLOCK_IO)
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#define FNIC_FLAGS_IO_BLOCKED		(__FNIC_FLAGS_BLOCK_IO)
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci#define fnic_set_state_flags(fnicp, st_flags)	\
12662306a36Sopenharmony_ci	__fnic_set_state_flags(fnicp, st_flags, 0)
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci#define fnic_clear_state_flags(fnicp, st_flags)  \
12962306a36Sopenharmony_ci	__fnic_set_state_flags(fnicp, st_flags, 1)
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ciextern unsigned int fnic_log_level;
13262306a36Sopenharmony_ciextern unsigned int io_completions;
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci#define FNIC_MAIN_LOGGING 0x01
13562306a36Sopenharmony_ci#define FNIC_FCS_LOGGING 0x02
13662306a36Sopenharmony_ci#define FNIC_SCSI_LOGGING 0x04
13762306a36Sopenharmony_ci#define FNIC_ISR_LOGGING 0x08
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci#define FNIC_CHECK_LOGGING(LEVEL, CMD)				\
14062306a36Sopenharmony_cido {								\
14162306a36Sopenharmony_ci	if (unlikely(fnic_log_level & LEVEL))			\
14262306a36Sopenharmony_ci		do {						\
14362306a36Sopenharmony_ci			CMD;					\
14462306a36Sopenharmony_ci		} while (0);					\
14562306a36Sopenharmony_ci} while (0)
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci#define FNIC_MAIN_DBG(kern_level, host, fmt, args...)		\
14862306a36Sopenharmony_ci	FNIC_CHECK_LOGGING(FNIC_MAIN_LOGGING,			\
14962306a36Sopenharmony_ci			 shost_printk(kern_level, host, fmt, ##args);)
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci#define FNIC_FCS_DBG(kern_level, host, fmt, args...)		\
15262306a36Sopenharmony_ci	FNIC_CHECK_LOGGING(FNIC_FCS_LOGGING,			\
15362306a36Sopenharmony_ci			 shost_printk(kern_level, host, fmt, ##args);)
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci#define FNIC_SCSI_DBG(kern_level, host, fmt, args...)		\
15662306a36Sopenharmony_ci	FNIC_CHECK_LOGGING(FNIC_SCSI_LOGGING,			\
15762306a36Sopenharmony_ci			 shost_printk(kern_level, host, fmt, ##args);)
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci#define FNIC_ISR_DBG(kern_level, host, fmt, args...)		\
16062306a36Sopenharmony_ci	FNIC_CHECK_LOGGING(FNIC_ISR_LOGGING,			\
16162306a36Sopenharmony_ci			 shost_printk(kern_level, host, fmt, ##args);)
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci#define FNIC_MAIN_NOTE(kern_level, host, fmt, args...)          \
16462306a36Sopenharmony_ci	shost_printk(kern_level, host, fmt, ##args)
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ciextern const char *fnic_state_str[];
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_cienum fnic_intx_intr_index {
16962306a36Sopenharmony_ci	FNIC_INTX_WQ_RQ_COPYWQ,
17062306a36Sopenharmony_ci	FNIC_INTX_ERR,
17162306a36Sopenharmony_ci	FNIC_INTX_NOTIFY,
17262306a36Sopenharmony_ci	FNIC_INTX_INTR_MAX,
17362306a36Sopenharmony_ci};
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_cienum fnic_msix_intr_index {
17662306a36Sopenharmony_ci	FNIC_MSIX_RQ,
17762306a36Sopenharmony_ci	FNIC_MSIX_WQ,
17862306a36Sopenharmony_ci	FNIC_MSIX_WQ_COPY,
17962306a36Sopenharmony_ci	FNIC_MSIX_ERR_NOTIFY,
18062306a36Sopenharmony_ci	FNIC_MSIX_INTR_MAX,
18162306a36Sopenharmony_ci};
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_cistruct fnic_msix_entry {
18462306a36Sopenharmony_ci	int requested;
18562306a36Sopenharmony_ci	char devname[IFNAMSIZ + 11];
18662306a36Sopenharmony_ci	irqreturn_t (*isr)(int, void *);
18762306a36Sopenharmony_ci	void *devid;
18862306a36Sopenharmony_ci};
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_cienum fnic_state {
19162306a36Sopenharmony_ci	FNIC_IN_FC_MODE = 0,
19262306a36Sopenharmony_ci	FNIC_IN_FC_TRANS_ETH_MODE,
19362306a36Sopenharmony_ci	FNIC_IN_ETH_MODE,
19462306a36Sopenharmony_ci	FNIC_IN_ETH_TRANS_FC_MODE,
19562306a36Sopenharmony_ci};
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_ci#define FNIC_WQ_COPY_MAX 1
19862306a36Sopenharmony_ci#define FNIC_WQ_MAX 1
19962306a36Sopenharmony_ci#define FNIC_RQ_MAX 1
20062306a36Sopenharmony_ci#define FNIC_CQ_MAX (FNIC_WQ_COPY_MAX + FNIC_WQ_MAX + FNIC_RQ_MAX)
20162306a36Sopenharmony_ci#define FNIC_DFLT_IO_COMPLETIONS 256
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_cistruct mempool;
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_cienum fnic_evt {
20662306a36Sopenharmony_ci	FNIC_EVT_START_VLAN_DISC = 1,
20762306a36Sopenharmony_ci	FNIC_EVT_START_FCF_DISC = 2,
20862306a36Sopenharmony_ci	FNIC_EVT_MAX,
20962306a36Sopenharmony_ci};
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_cistruct fnic_event {
21262306a36Sopenharmony_ci	struct list_head list;
21362306a36Sopenharmony_ci	struct fnic *fnic;
21462306a36Sopenharmony_ci	enum fnic_evt event;
21562306a36Sopenharmony_ci};
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci/* Per-instance private data structure */
21862306a36Sopenharmony_cistruct fnic {
21962306a36Sopenharmony_ci	struct fc_lport *lport;
22062306a36Sopenharmony_ci	struct fcoe_ctlr ctlr;		/* FIP FCoE controller structure */
22162306a36Sopenharmony_ci	struct vnic_dev_bar bar0;
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci	struct fnic_msix_entry msix[FNIC_MSIX_INTR_MAX];
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci	struct vnic_stats *stats;
22662306a36Sopenharmony_ci	unsigned long stats_time;	/* time of stats update */
22762306a36Sopenharmony_ci	unsigned long stats_reset_time; /* time of stats reset */
22862306a36Sopenharmony_ci	struct vnic_nic_cfg *nic_cfg;
22962306a36Sopenharmony_ci	char name[IFNAMSIZ];
23062306a36Sopenharmony_ci	struct timer_list notify_timer; /* used for MSI interrupts */
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci	unsigned int fnic_max_tag_id;
23362306a36Sopenharmony_ci	unsigned int err_intr_offset;
23462306a36Sopenharmony_ci	unsigned int link_intr_offset;
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci	unsigned int wq_count;
23762306a36Sopenharmony_ci	unsigned int cq_count;
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci	struct mutex sgreset_mutex;
24062306a36Sopenharmony_ci	spinlock_t sgreset_lock; /* lock for sgreset */
24162306a36Sopenharmony_ci	struct scsi_cmnd *sgreset_sc;
24262306a36Sopenharmony_ci	struct dentry *fnic_stats_debugfs_host;
24362306a36Sopenharmony_ci	struct dentry *fnic_stats_debugfs_file;
24462306a36Sopenharmony_ci	struct dentry *fnic_reset_debugfs_file;
24562306a36Sopenharmony_ci	unsigned int reset_stats;
24662306a36Sopenharmony_ci	atomic64_t io_cmpl_skip;
24762306a36Sopenharmony_ci	struct fnic_stats fnic_stats;
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci	u32 vlan_hw_insert:1;	        /* let hw insert the tag */
25062306a36Sopenharmony_ci	u32 in_remove:1;                /* fnic device in removal */
25162306a36Sopenharmony_ci	u32 stop_rx_link_events:1;      /* stop proc. rx frames, link events */
25262306a36Sopenharmony_ci	u32 link_events:1;              /* set when we get any link event*/
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ci	struct completion *remove_wait; /* device remove thread blocks */
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_ci	atomic_t in_flight;		/* io counter */
25762306a36Sopenharmony_ci	bool internal_reset_inprogress;
25862306a36Sopenharmony_ci	u32 _reserved;			/* fill hole */
25962306a36Sopenharmony_ci	unsigned long state_flags;	/* protected by host lock */
26062306a36Sopenharmony_ci	enum fnic_state state;
26162306a36Sopenharmony_ci	spinlock_t fnic_lock;
26262306a36Sopenharmony_ci
26362306a36Sopenharmony_ci	u16 vlan_id;	                /* VLAN tag including priority */
26462306a36Sopenharmony_ci	u8 data_src_addr[ETH_ALEN];
26562306a36Sopenharmony_ci	u64 fcp_input_bytes;		/* internal statistic */
26662306a36Sopenharmony_ci	u64 fcp_output_bytes;		/* internal statistic */
26762306a36Sopenharmony_ci	u32 link_down_cnt;
26862306a36Sopenharmony_ci	int link_status;
26962306a36Sopenharmony_ci
27062306a36Sopenharmony_ci	struct list_head list;
27162306a36Sopenharmony_ci	struct pci_dev *pdev;
27262306a36Sopenharmony_ci	struct vnic_fc_config config;
27362306a36Sopenharmony_ci	struct vnic_dev *vdev;
27462306a36Sopenharmony_ci	unsigned int raw_wq_count;
27562306a36Sopenharmony_ci	unsigned int wq_copy_count;
27662306a36Sopenharmony_ci	unsigned int rq_count;
27762306a36Sopenharmony_ci	int fw_ack_index[FNIC_WQ_COPY_MAX];
27862306a36Sopenharmony_ci	unsigned short fw_ack_recd[FNIC_WQ_COPY_MAX];
27962306a36Sopenharmony_ci	unsigned short wq_copy_desc_low[FNIC_WQ_COPY_MAX];
28062306a36Sopenharmony_ci	unsigned int intr_count;
28162306a36Sopenharmony_ci	u32 __iomem *legacy_pba;
28262306a36Sopenharmony_ci	struct fnic_host_tag *tags;
28362306a36Sopenharmony_ci	mempool_t *io_req_pool;
28462306a36Sopenharmony_ci	mempool_t *io_sgl_pool[FNIC_SGL_NUM_CACHES];
28562306a36Sopenharmony_ci	spinlock_t io_req_lock[FNIC_IO_LOCKS];	/* locks for scsi cmnds */
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_ci	struct work_struct link_work;
28862306a36Sopenharmony_ci	struct work_struct frame_work;
28962306a36Sopenharmony_ci	struct sk_buff_head frame_queue;
29062306a36Sopenharmony_ci	struct sk_buff_head tx_queue;
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci	/*** FIP related data members  -- start ***/
29362306a36Sopenharmony_ci	void (*set_vlan)(struct fnic *, u16 vlan);
29462306a36Sopenharmony_ci	struct work_struct      fip_frame_work;
29562306a36Sopenharmony_ci	struct sk_buff_head     fip_frame_queue;
29662306a36Sopenharmony_ci	struct timer_list       fip_timer;
29762306a36Sopenharmony_ci	struct list_head        vlans;
29862306a36Sopenharmony_ci	spinlock_t              vlans_lock;
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ci	struct work_struct      event_work;
30162306a36Sopenharmony_ci	struct list_head        evlist;
30262306a36Sopenharmony_ci	/*** FIP related data members  -- end ***/
30362306a36Sopenharmony_ci
30462306a36Sopenharmony_ci	/* copy work queue cache line section */
30562306a36Sopenharmony_ci	____cacheline_aligned struct vnic_wq_copy wq_copy[FNIC_WQ_COPY_MAX];
30662306a36Sopenharmony_ci	/* completion queue cache line section */
30762306a36Sopenharmony_ci	____cacheline_aligned struct vnic_cq cq[FNIC_CQ_MAX];
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci	spinlock_t wq_copy_lock[FNIC_WQ_COPY_MAX];
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci	/* work queue cache line section */
31262306a36Sopenharmony_ci	____cacheline_aligned struct vnic_wq wq[FNIC_WQ_MAX];
31362306a36Sopenharmony_ci	spinlock_t wq_lock[FNIC_WQ_MAX];
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_ci	/* receive queue cache line section */
31662306a36Sopenharmony_ci	____cacheline_aligned struct vnic_rq rq[FNIC_RQ_MAX];
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ci	/* interrupt resource cache line section */
31962306a36Sopenharmony_ci	____cacheline_aligned struct vnic_intr intr[FNIC_MSIX_INTR_MAX];
32062306a36Sopenharmony_ci};
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_cistatic inline struct fnic *fnic_from_ctlr(struct fcoe_ctlr *fip)
32362306a36Sopenharmony_ci{
32462306a36Sopenharmony_ci	return container_of(fip, struct fnic, ctlr);
32562306a36Sopenharmony_ci}
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ciextern struct workqueue_struct *fnic_event_queue;
32862306a36Sopenharmony_ciextern struct workqueue_struct *fnic_fip_queue;
32962306a36Sopenharmony_ciextern const struct attribute_group *fnic_host_groups[];
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_civoid fnic_clear_intr_mode(struct fnic *fnic);
33262306a36Sopenharmony_ciint fnic_set_intr_mode(struct fnic *fnic);
33362306a36Sopenharmony_civoid fnic_free_intr(struct fnic *fnic);
33462306a36Sopenharmony_ciint fnic_request_intr(struct fnic *fnic);
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ciint fnic_send(struct fc_lport *, struct fc_frame *);
33762306a36Sopenharmony_civoid fnic_free_wq_buf(struct vnic_wq *wq, struct vnic_wq_buf *buf);
33862306a36Sopenharmony_civoid fnic_handle_frame(struct work_struct *work);
33962306a36Sopenharmony_civoid fnic_handle_link(struct work_struct *work);
34062306a36Sopenharmony_civoid fnic_handle_event(struct work_struct *work);
34162306a36Sopenharmony_ciint fnic_rq_cmpl_handler(struct fnic *fnic, int);
34262306a36Sopenharmony_ciint fnic_alloc_rq_frame(struct vnic_rq *rq);
34362306a36Sopenharmony_civoid fnic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf);
34462306a36Sopenharmony_civoid fnic_flush_tx(struct fnic *);
34562306a36Sopenharmony_civoid fnic_eth_send(struct fcoe_ctlr *, struct sk_buff *skb);
34662306a36Sopenharmony_civoid fnic_set_port_id(struct fc_lport *, u32, struct fc_frame *);
34762306a36Sopenharmony_civoid fnic_update_mac(struct fc_lport *, u8 *new);
34862306a36Sopenharmony_civoid fnic_update_mac_locked(struct fnic *, u8 *new);
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ciint fnic_queuecommand(struct Scsi_Host *, struct scsi_cmnd *);
35162306a36Sopenharmony_ciint fnic_abort_cmd(struct scsi_cmnd *);
35262306a36Sopenharmony_ciint fnic_device_reset(struct scsi_cmnd *);
35362306a36Sopenharmony_ciint fnic_host_reset(struct scsi_cmnd *);
35462306a36Sopenharmony_ciint fnic_reset(struct Scsi_Host *);
35562306a36Sopenharmony_civoid fnic_scsi_cleanup(struct fc_lport *);
35662306a36Sopenharmony_civoid fnic_scsi_abort_io(struct fc_lport *);
35762306a36Sopenharmony_civoid fnic_empty_scsi_cleanup(struct fc_lport *);
35862306a36Sopenharmony_civoid fnic_exch_mgr_reset(struct fc_lport *, u32, u32);
35962306a36Sopenharmony_ciint fnic_wq_copy_cmpl_handler(struct fnic *fnic, int);
36062306a36Sopenharmony_ciint fnic_wq_cmpl_handler(struct fnic *fnic, int);
36162306a36Sopenharmony_ciint fnic_flogi_reg_handler(struct fnic *fnic, u32);
36262306a36Sopenharmony_civoid fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
36362306a36Sopenharmony_ci				  struct fcpio_host_req *desc);
36462306a36Sopenharmony_ciint fnic_fw_reset_handler(struct fnic *fnic);
36562306a36Sopenharmony_civoid fnic_terminate_rport_io(struct fc_rport *);
36662306a36Sopenharmony_ciconst char *fnic_state_to_str(unsigned int state);
36762306a36Sopenharmony_ci
36862306a36Sopenharmony_civoid fnic_log_q_error(struct fnic *fnic);
36962306a36Sopenharmony_civoid fnic_handle_link_event(struct fnic *fnic);
37062306a36Sopenharmony_ci
37162306a36Sopenharmony_ciint fnic_is_abts_pending(struct fnic *, struct scsi_cmnd *);
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_civoid fnic_handle_fip_frame(struct work_struct *work);
37462306a36Sopenharmony_civoid fnic_handle_fip_event(struct fnic *fnic);
37562306a36Sopenharmony_civoid fnic_fcoe_reset_vlans(struct fnic *fnic);
37662306a36Sopenharmony_civoid fnic_fcoe_evlist_free(struct fnic *fnic);
37762306a36Sopenharmony_ciextern void fnic_handle_fip_timer(struct fnic *fnic);
37862306a36Sopenharmony_ci
37962306a36Sopenharmony_cistatic inline int
38062306a36Sopenharmony_cifnic_chk_state_flags_locked(struct fnic *fnic, unsigned long st_flags)
38162306a36Sopenharmony_ci{
38262306a36Sopenharmony_ci	return ((fnic->state_flags & st_flags) == st_flags);
38362306a36Sopenharmony_ci}
38462306a36Sopenharmony_civoid __fnic_set_state_flags(struct fnic *, unsigned long, unsigned long);
38562306a36Sopenharmony_civoid fnic_dump_fchost_stats(struct Scsi_Host *, struct fc_host_statistics *);
38662306a36Sopenharmony_ci#endif /* _FNIC_H_ */
387