162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* Copyright 2014 Cisco Systems, Inc. All rights reserved. */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef _SNIC_H_ 562306a36Sopenharmony_ci#define _SNIC_H_ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#include <linux/module.h> 862306a36Sopenharmony_ci#include <linux/netdevice.h> 962306a36Sopenharmony_ci#include <linux/workqueue.h> 1062306a36Sopenharmony_ci#include <linux/bitops.h> 1162306a36Sopenharmony_ci#include <linux/mempool.h> 1262306a36Sopenharmony_ci#include <scsi/scsi_cmnd.h> 1362306a36Sopenharmony_ci#include <scsi/scsi.h> 1462306a36Sopenharmony_ci#include <scsi/scsi_host.h> 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#include "snic_disc.h" 1762306a36Sopenharmony_ci#include "snic_io.h" 1862306a36Sopenharmony_ci#include "snic_res.h" 1962306a36Sopenharmony_ci#include "snic_trc.h" 2062306a36Sopenharmony_ci#include "snic_stats.h" 2162306a36Sopenharmony_ci#include "vnic_dev.h" 2262306a36Sopenharmony_ci#include "vnic_wq.h" 2362306a36Sopenharmony_ci#include "vnic_cq.h" 2462306a36Sopenharmony_ci#include "vnic_intr.h" 2562306a36Sopenharmony_ci#include "vnic_stats.h" 2662306a36Sopenharmony_ci#include "vnic_snic.h" 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci#define SNIC_DRV_NAME "snic" 2962306a36Sopenharmony_ci#define SNIC_DRV_DESCRIPTION "Cisco SCSI NIC Driver" 3062306a36Sopenharmony_ci#define SNIC_DRV_VERSION "0.0.1.18" 3162306a36Sopenharmony_ci#define PFX SNIC_DRV_NAME ":" 3262306a36Sopenharmony_ci#define DFX SNIC_DRV_NAME "%d: " 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#define DESC_CLEAN_LOW_WATERMARK 8 3562306a36Sopenharmony_ci#define SNIC_UCSM_DFLT_THROTTLE_CNT_BLD 16 /* UCSM default throttle count */ 3662306a36Sopenharmony_ci#define SNIC_MAX_IO_REQ 50 /* scsi_cmnd tag map entries */ 3762306a36Sopenharmony_ci#define SNIC_MIN_IO_REQ 8 /* Min IO throttle count */ 3862306a36Sopenharmony_ci#define SNIC_IO_LOCKS 64 /* IO locks: power of 2 */ 3962306a36Sopenharmony_ci#define SNIC_DFLT_QUEUE_DEPTH 32 /* Default Queue Depth */ 4062306a36Sopenharmony_ci#define SNIC_MAX_QUEUE_DEPTH 64 /* Max Queue Depth */ 4162306a36Sopenharmony_ci#define SNIC_DFLT_CMD_TIMEOUT 90 /* Extended tmo for FW */ 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci/* 4462306a36Sopenharmony_ci * Tag bits used for special requests. 4562306a36Sopenharmony_ci */ 4662306a36Sopenharmony_ci#define SNIC_TAG_ABORT BIT(30) /* Tag indicating abort */ 4762306a36Sopenharmony_ci#define SNIC_TAG_DEV_RST BIT(29) /* Tag for device reset */ 4862306a36Sopenharmony_ci#define SNIC_TAG_IOCTL_DEV_RST BIT(28) /* Tag for User Device Reset */ 4962306a36Sopenharmony_ci#define SNIC_TAG_MASK (BIT(24) - 1) /* Mask for lookup */ 5062306a36Sopenharmony_ci#define SNIC_NO_TAG -1 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci/* 5362306a36Sopenharmony_ci * Command flags to identify the type of command and for other future use 5462306a36Sopenharmony_ci */ 5562306a36Sopenharmony_ci#define SNIC_NO_FLAGS 0 5662306a36Sopenharmony_ci#define SNIC_IO_INITIALIZED BIT(0) 5762306a36Sopenharmony_ci#define SNIC_IO_ISSUED BIT(1) 5862306a36Sopenharmony_ci#define SNIC_IO_DONE BIT(2) 5962306a36Sopenharmony_ci#define SNIC_IO_REQ_NULL BIT(3) 6062306a36Sopenharmony_ci#define SNIC_IO_ABTS_PENDING BIT(4) 6162306a36Sopenharmony_ci#define SNIC_IO_ABORTED BIT(5) 6262306a36Sopenharmony_ci#define SNIC_IO_ABTS_ISSUED BIT(6) 6362306a36Sopenharmony_ci#define SNIC_IO_TERM_ISSUED BIT(7) 6462306a36Sopenharmony_ci#define SNIC_IO_ABTS_TIMEDOUT BIT(8) 6562306a36Sopenharmony_ci#define SNIC_IO_ABTS_TERM_DONE BIT(9) 6662306a36Sopenharmony_ci#define SNIC_IO_ABTS_TERM_REQ_NULL BIT(10) 6762306a36Sopenharmony_ci#define SNIC_IO_ABTS_TERM_TIMEDOUT BIT(11) 6862306a36Sopenharmony_ci#define SNIC_IO_INTERNAL_TERM_PENDING BIT(12) 6962306a36Sopenharmony_ci#define SNIC_IO_INTERNAL_TERM_ISSUED BIT(13) 7062306a36Sopenharmony_ci#define SNIC_DEVICE_RESET BIT(14) 7162306a36Sopenharmony_ci#define SNIC_DEV_RST_ISSUED BIT(15) 7262306a36Sopenharmony_ci#define SNIC_DEV_RST_TIMEDOUT BIT(16) 7362306a36Sopenharmony_ci#define SNIC_DEV_RST_ABTS_ISSUED BIT(17) 7462306a36Sopenharmony_ci#define SNIC_DEV_RST_TERM_ISSUED BIT(18) 7562306a36Sopenharmony_ci#define SNIC_DEV_RST_DONE BIT(19) 7662306a36Sopenharmony_ci#define SNIC_DEV_RST_REQ_NULL BIT(20) 7762306a36Sopenharmony_ci#define SNIC_DEV_RST_ABTS_DONE BIT(21) 7862306a36Sopenharmony_ci#define SNIC_DEV_RST_TERM_DONE BIT(22) 7962306a36Sopenharmony_ci#define SNIC_DEV_RST_ABTS_PENDING BIT(23) 8062306a36Sopenharmony_ci#define SNIC_DEV_RST_PENDING BIT(24) 8162306a36Sopenharmony_ci#define SNIC_DEV_RST_NOTSUP BIT(25) 8262306a36Sopenharmony_ci#define SNIC_SCSI_CLEANUP BIT(26) 8362306a36Sopenharmony_ci#define SNIC_HOST_RESET_ISSUED BIT(27) 8462306a36Sopenharmony_ci#define SNIC_HOST_RESET_CMD_TERM \ 8562306a36Sopenharmony_ci (SNIC_DEV_RST_NOTSUP | SNIC_SCSI_CLEANUP | SNIC_HOST_RESET_ISSUED) 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci#define SNIC_ABTS_TIMEOUT 30000 /* msec */ 8862306a36Sopenharmony_ci#define SNIC_LUN_RESET_TIMEOUT 30000 /* msec */ 8962306a36Sopenharmony_ci#define SNIC_HOST_RESET_TIMEOUT 30000 /* msec */ 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci/* 9362306a36Sopenharmony_ci * These are protected by the hashed req_lock. 9462306a36Sopenharmony_ci */ 9562306a36Sopenharmony_ci#define CMD_SP(Cmnd) \ 9662306a36Sopenharmony_ci (((struct snic_internal_io_state *)scsi_cmd_priv(Cmnd))->rqi) 9762306a36Sopenharmony_ci#define CMD_STATE(Cmnd) \ 9862306a36Sopenharmony_ci (((struct snic_internal_io_state *)scsi_cmd_priv(Cmnd))->state) 9962306a36Sopenharmony_ci#define CMD_ABTS_STATUS(Cmnd) \ 10062306a36Sopenharmony_ci (((struct snic_internal_io_state *)scsi_cmd_priv(Cmnd))->abts_status) 10162306a36Sopenharmony_ci#define CMD_LR_STATUS(Cmnd) \ 10262306a36Sopenharmony_ci (((struct snic_internal_io_state *)scsi_cmd_priv(Cmnd))->lr_status) 10362306a36Sopenharmony_ci#define CMD_FLAGS(Cmnd) \ 10462306a36Sopenharmony_ci (((struct snic_internal_io_state *)scsi_cmd_priv(Cmnd))->flags) 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci#define SNIC_INVALID_CODE 0x100 /* Hdr Status val unused by firmware */ 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci#define SNIC_MAX_TARGET 256 10962306a36Sopenharmony_ci#define SNIC_FLAGS_NONE (0) 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci/* snic module params */ 11262306a36Sopenharmony_ciextern unsigned int snic_max_qdepth; 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci/* snic debugging */ 11562306a36Sopenharmony_ciextern unsigned int snic_log_level; 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci#define SNIC_MAIN_LOGGING 0x1 11862306a36Sopenharmony_ci#define SNIC_SCSI_LOGGING 0x2 11962306a36Sopenharmony_ci#define SNIC_ISR_LOGGING 0x8 12062306a36Sopenharmony_ci#define SNIC_DESC_LOGGING 0x10 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci#define SNIC_CHECK_LOGGING(LEVEL, CMD) \ 12362306a36Sopenharmony_cido { \ 12462306a36Sopenharmony_ci if (unlikely(snic_log_level & LEVEL)) \ 12562306a36Sopenharmony_ci do { \ 12662306a36Sopenharmony_ci CMD; \ 12762306a36Sopenharmony_ci } while (0); \ 12862306a36Sopenharmony_ci} while (0) 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci#define SNIC_MAIN_DBG(host, fmt, args...) \ 13162306a36Sopenharmony_ci SNIC_CHECK_LOGGING(SNIC_MAIN_LOGGING, \ 13262306a36Sopenharmony_ci shost_printk(KERN_INFO, host, fmt, ## args);) 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci#define SNIC_SCSI_DBG(host, fmt, args...) \ 13562306a36Sopenharmony_ci SNIC_CHECK_LOGGING(SNIC_SCSI_LOGGING, \ 13662306a36Sopenharmony_ci shost_printk(KERN_INFO, host, fmt, ##args);) 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci#define SNIC_DISC_DBG(host, fmt, args...) \ 13962306a36Sopenharmony_ci SNIC_CHECK_LOGGING(SNIC_SCSI_LOGGING, \ 14062306a36Sopenharmony_ci shost_printk(KERN_INFO, host, fmt, ##args);) 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci#define SNIC_ISR_DBG(host, fmt, args...) \ 14362306a36Sopenharmony_ci SNIC_CHECK_LOGGING(SNIC_ISR_LOGGING, \ 14462306a36Sopenharmony_ci shost_printk(KERN_INFO, host, fmt, ##args);) 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci#define SNIC_HOST_ERR(host, fmt, args...) \ 14762306a36Sopenharmony_ci shost_printk(KERN_ERR, host, fmt, ##args) 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci#define SNIC_HOST_INFO(host, fmt, args...) \ 15062306a36Sopenharmony_ci shost_printk(KERN_INFO, host, fmt, ##args) 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci#define SNIC_INFO(fmt, args...) \ 15362306a36Sopenharmony_ci pr_info(PFX fmt, ## args) 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci#define SNIC_DBG(fmt, args...) \ 15662306a36Sopenharmony_ci pr_info(PFX fmt, ## args) 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci#define SNIC_ERR(fmt, args...) \ 15962306a36Sopenharmony_ci pr_err(PFX fmt, ## args) 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci#ifdef DEBUG 16262306a36Sopenharmony_ci#define SNIC_BUG_ON(EXPR) \ 16362306a36Sopenharmony_ci ({ \ 16462306a36Sopenharmony_ci if (EXPR) { \ 16562306a36Sopenharmony_ci SNIC_ERR("SNIC BUG(%s)\n", #EXPR); \ 16662306a36Sopenharmony_ci BUG_ON(EXPR); \ 16762306a36Sopenharmony_ci } \ 16862306a36Sopenharmony_ci }) 16962306a36Sopenharmony_ci#else 17062306a36Sopenharmony_ci#define SNIC_BUG_ON(EXPR) \ 17162306a36Sopenharmony_ci ({ \ 17262306a36Sopenharmony_ci if (EXPR) { \ 17362306a36Sopenharmony_ci SNIC_ERR("SNIC BUG(%s) at %s : %d\n", \ 17462306a36Sopenharmony_ci #EXPR, __func__, __LINE__); \ 17562306a36Sopenharmony_ci WARN_ON_ONCE(EXPR); \ 17662306a36Sopenharmony_ci } \ 17762306a36Sopenharmony_ci }) 17862306a36Sopenharmony_ci#endif 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci/* Soft assert */ 18162306a36Sopenharmony_ci#define SNIC_ASSERT_NOT_IMPL(EXPR) \ 18262306a36Sopenharmony_ci ({ \ 18362306a36Sopenharmony_ci if (EXPR) {\ 18462306a36Sopenharmony_ci SNIC_INFO("Functionality not impl'ed at %s:%d\n", \ 18562306a36Sopenharmony_ci __func__, __LINE__); \ 18662306a36Sopenharmony_ci WARN_ON_ONCE(EXPR); \ 18762306a36Sopenharmony_ci } \ 18862306a36Sopenharmony_ci }) 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ciextern const char *snic_state_str[]; 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_cienum snic_intx_intr_index { 19462306a36Sopenharmony_ci SNIC_INTX_WQ_RQ_COPYWQ, 19562306a36Sopenharmony_ci SNIC_INTX_ERR, 19662306a36Sopenharmony_ci SNIC_INTX_NOTIFY, 19762306a36Sopenharmony_ci SNIC_INTX_INTR_MAX, 19862306a36Sopenharmony_ci}; 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_cienum snic_msix_intr_index { 20162306a36Sopenharmony_ci SNIC_MSIX_WQ, 20262306a36Sopenharmony_ci SNIC_MSIX_IO_CMPL, 20362306a36Sopenharmony_ci SNIC_MSIX_ERR_NOTIFY, 20462306a36Sopenharmony_ci SNIC_MSIX_INTR_MAX, 20562306a36Sopenharmony_ci}; 20662306a36Sopenharmony_ci 20762306a36Sopenharmony_ci#define SNIC_INTRHDLR_NAMSZ (2 * IFNAMSIZ) 20862306a36Sopenharmony_cistruct snic_msix_entry { 20962306a36Sopenharmony_ci int requested; 21062306a36Sopenharmony_ci char devname[SNIC_INTRHDLR_NAMSZ]; 21162306a36Sopenharmony_ci irqreturn_t (*isr)(int, void *); 21262306a36Sopenharmony_ci void *devid; 21362306a36Sopenharmony_ci}; 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_cienum snic_state { 21662306a36Sopenharmony_ci SNIC_INIT = 0, 21762306a36Sopenharmony_ci SNIC_ERROR, 21862306a36Sopenharmony_ci SNIC_ONLINE, 21962306a36Sopenharmony_ci SNIC_OFFLINE, 22062306a36Sopenharmony_ci SNIC_FWRESET, 22162306a36Sopenharmony_ci}; 22262306a36Sopenharmony_ci 22362306a36Sopenharmony_ci#define SNIC_WQ_MAX 1 22462306a36Sopenharmony_ci#define SNIC_CQ_IO_CMPL_MAX 1 22562306a36Sopenharmony_ci#define SNIC_CQ_MAX (SNIC_WQ_MAX + SNIC_CQ_IO_CMPL_MAX) 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_ci/* firmware version information */ 22862306a36Sopenharmony_cistruct snic_fw_info { 22962306a36Sopenharmony_ci u32 fw_ver; 23062306a36Sopenharmony_ci u32 hid; /* u16 hid | u16 vnic id */ 23162306a36Sopenharmony_ci u32 max_concur_ios; /* max concurrent ios */ 23262306a36Sopenharmony_ci u32 max_sgs_per_cmd; /* max sgls per IO */ 23362306a36Sopenharmony_ci u32 max_io_sz; /* max io size supported */ 23462306a36Sopenharmony_ci u32 hba_cap; /* hba capabilities */ 23562306a36Sopenharmony_ci u32 max_tgts; /* max tgts supported */ 23662306a36Sopenharmony_ci u16 io_tmo; /* FW Extended timeout */ 23762306a36Sopenharmony_ci struct completion *wait; /* protected by snic lock*/ 23862306a36Sopenharmony_ci}; 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci/* 24162306a36Sopenharmony_ci * snic_work item : defined to process asynchronous events 24262306a36Sopenharmony_ci */ 24362306a36Sopenharmony_cistruct snic_work { 24462306a36Sopenharmony_ci struct work_struct work; 24562306a36Sopenharmony_ci u16 ev_id; 24662306a36Sopenharmony_ci u64 *ev_data; 24762306a36Sopenharmony_ci}; 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_ci/* 25062306a36Sopenharmony_ci * snic structure to represent SCSI vNIC 25162306a36Sopenharmony_ci */ 25262306a36Sopenharmony_cistruct snic { 25362306a36Sopenharmony_ci /* snic specific members */ 25462306a36Sopenharmony_ci struct list_head list; 25562306a36Sopenharmony_ci char name[IFNAMSIZ]; 25662306a36Sopenharmony_ci atomic_t state; 25762306a36Sopenharmony_ci spinlock_t snic_lock; 25862306a36Sopenharmony_ci struct completion *remove_wait; 25962306a36Sopenharmony_ci bool in_remove; 26062306a36Sopenharmony_ci bool stop_link_events; /* stop processing link events */ 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci /* discovery related */ 26362306a36Sopenharmony_ci struct snic_disc disc; 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_ci /* Scsi Host info */ 26662306a36Sopenharmony_ci struct Scsi_Host *shost; 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci /* vnic related structures */ 26962306a36Sopenharmony_ci struct vnic_dev_bar bar0; 27062306a36Sopenharmony_ci 27162306a36Sopenharmony_ci struct vnic_stats *stats; 27262306a36Sopenharmony_ci unsigned long stats_time; 27362306a36Sopenharmony_ci unsigned long stats_reset_time; 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_ci struct vnic_dev *vdev; 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci /* hw resource info */ 27862306a36Sopenharmony_ci unsigned int wq_count; 27962306a36Sopenharmony_ci unsigned int cq_count; 28062306a36Sopenharmony_ci unsigned int intr_count; 28162306a36Sopenharmony_ci unsigned int err_intr_offset; 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_ci int link_status; /* retrieved from svnic_dev_link_status() */ 28462306a36Sopenharmony_ci u32 link_down_cnt; 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_ci /* pci related */ 28762306a36Sopenharmony_ci struct pci_dev *pdev; 28862306a36Sopenharmony_ci struct snic_msix_entry msix[SNIC_MSIX_INTR_MAX]; 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_ci /* io related info */ 29162306a36Sopenharmony_ci mempool_t *req_pool[SNIC_REQ_MAX_CACHES]; /* (??) */ 29262306a36Sopenharmony_ci ____cacheline_aligned spinlock_t io_req_lock[SNIC_IO_LOCKS]; 29362306a36Sopenharmony_ci 29462306a36Sopenharmony_ci /* Maintain snic specific commands, cmds with no tag in spl_cmd_list */ 29562306a36Sopenharmony_ci ____cacheline_aligned spinlock_t spl_cmd_lock; 29662306a36Sopenharmony_ci struct list_head spl_cmd_list; 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci unsigned int max_tag_id; 29962306a36Sopenharmony_ci atomic_t ios_inflight; /* io in flight counter */ 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_ci struct vnic_snic_config config; 30262306a36Sopenharmony_ci 30362306a36Sopenharmony_ci struct work_struct link_work; 30462306a36Sopenharmony_ci 30562306a36Sopenharmony_ci /* firmware information */ 30662306a36Sopenharmony_ci struct snic_fw_info fwinfo; 30762306a36Sopenharmony_ci 30862306a36Sopenharmony_ci /* Work for processing Target related work */ 30962306a36Sopenharmony_ci struct work_struct tgt_work; 31062306a36Sopenharmony_ci 31162306a36Sopenharmony_ci /* Work for processing Discovery */ 31262306a36Sopenharmony_ci struct work_struct disc_work; 31362306a36Sopenharmony_ci 31462306a36Sopenharmony_ci /* stats related */ 31562306a36Sopenharmony_ci unsigned int reset_stats; 31662306a36Sopenharmony_ci atomic64_t io_cmpl_skip; 31762306a36Sopenharmony_ci struct snic_stats s_stats; /* Per SNIC driver stats */ 31862306a36Sopenharmony_ci 31962306a36Sopenharmony_ci /* platform specific */ 32062306a36Sopenharmony_ci#ifdef CONFIG_SCSI_SNIC_DEBUG_FS 32162306a36Sopenharmony_ci struct dentry *stats_host; /* Per snic debugfs root */ 32262306a36Sopenharmony_ci struct dentry *stats_file; /* Per snic debugfs file */ 32362306a36Sopenharmony_ci struct dentry *reset_stats_file;/* Per snic reset stats file */ 32462306a36Sopenharmony_ci#endif 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci /* completion queue cache line section */ 32762306a36Sopenharmony_ci ____cacheline_aligned struct vnic_cq cq[SNIC_CQ_MAX]; 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci /* work queue cache line section */ 33062306a36Sopenharmony_ci ____cacheline_aligned struct vnic_wq wq[SNIC_WQ_MAX]; 33162306a36Sopenharmony_ci spinlock_t wq_lock[SNIC_WQ_MAX]; 33262306a36Sopenharmony_ci 33362306a36Sopenharmony_ci /* interrupt resource cache line section */ 33462306a36Sopenharmony_ci ____cacheline_aligned struct vnic_intr intr[SNIC_MSIX_INTR_MAX]; 33562306a36Sopenharmony_ci}; /* end of snic structure */ 33662306a36Sopenharmony_ci 33762306a36Sopenharmony_ci/* 33862306a36Sopenharmony_ci * SNIC Driver's Global Data 33962306a36Sopenharmony_ci */ 34062306a36Sopenharmony_cistruct snic_global { 34162306a36Sopenharmony_ci struct list_head snic_list; 34262306a36Sopenharmony_ci spinlock_t snic_list_lock; 34362306a36Sopenharmony_ci 34462306a36Sopenharmony_ci struct kmem_cache *req_cache[SNIC_REQ_MAX_CACHES]; 34562306a36Sopenharmony_ci 34662306a36Sopenharmony_ci struct workqueue_struct *event_q; 34762306a36Sopenharmony_ci 34862306a36Sopenharmony_ci#ifdef CONFIG_SCSI_SNIC_DEBUG_FS 34962306a36Sopenharmony_ci /* debugfs related global data */ 35062306a36Sopenharmony_ci struct dentry *trc_root; 35162306a36Sopenharmony_ci struct dentry *stats_root; 35262306a36Sopenharmony_ci 35362306a36Sopenharmony_ci struct snic_trc trc ____cacheline_aligned; 35462306a36Sopenharmony_ci#endif 35562306a36Sopenharmony_ci}; 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_ciextern struct snic_global *snic_glob; 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_ciint snic_glob_init(void); 36062306a36Sopenharmony_civoid snic_glob_cleanup(void); 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ciextern struct workqueue_struct *snic_event_queue; 36362306a36Sopenharmony_ciextern const struct attribute_group *snic_host_groups[]; 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_ciint snic_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); 36662306a36Sopenharmony_ciint snic_abort_cmd(struct scsi_cmnd *); 36762306a36Sopenharmony_ciint snic_device_reset(struct scsi_cmnd *); 36862306a36Sopenharmony_ciint snic_host_reset(struct scsi_cmnd *); 36962306a36Sopenharmony_ciint snic_reset(struct Scsi_Host *, struct scsi_cmnd *); 37062306a36Sopenharmony_civoid snic_shutdown_scsi_cleanup(struct snic *); 37162306a36Sopenharmony_ci 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ciint snic_request_intr(struct snic *); 37462306a36Sopenharmony_civoid snic_free_intr(struct snic *); 37562306a36Sopenharmony_ciint snic_set_intr_mode(struct snic *); 37662306a36Sopenharmony_civoid snic_clear_intr_mode(struct snic *); 37762306a36Sopenharmony_ci 37862306a36Sopenharmony_ciint snic_fwcq_cmpl_handler(struct snic *, int); 37962306a36Sopenharmony_ciint snic_wq_cmpl_handler(struct snic *, int); 38062306a36Sopenharmony_civoid snic_free_wq_buf(struct vnic_wq *, struct vnic_wq_buf *); 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_ci 38362306a36Sopenharmony_civoid snic_log_q_error(struct snic *); 38462306a36Sopenharmony_civoid snic_handle_link_event(struct snic *); 38562306a36Sopenharmony_civoid snic_handle_link(struct work_struct *); 38662306a36Sopenharmony_ci 38762306a36Sopenharmony_ciint snic_queue_exch_ver_req(struct snic *); 38862306a36Sopenharmony_civoid snic_io_exch_ver_cmpl_handler(struct snic *, struct snic_fw_req *); 38962306a36Sopenharmony_ci 39062306a36Sopenharmony_ciint snic_queue_wq_desc(struct snic *, void *os_buf, u16 len); 39162306a36Sopenharmony_ci 39262306a36Sopenharmony_civoid snic_handle_untagged_req(struct snic *, struct snic_req_info *); 39362306a36Sopenharmony_civoid snic_release_untagged_req(struct snic *, struct snic_req_info *); 39462306a36Sopenharmony_civoid snic_free_all_untagged_reqs(struct snic *); 39562306a36Sopenharmony_ciint snic_get_conf(struct snic *); 39662306a36Sopenharmony_civoid snic_set_state(struct snic *, enum snic_state); 39762306a36Sopenharmony_ciint snic_get_state(struct snic *); 39862306a36Sopenharmony_ciconst char *snic_state_to_str(unsigned int); 39962306a36Sopenharmony_civoid snic_hex_dump(char *, char *, int); 40062306a36Sopenharmony_civoid snic_print_desc(const char *fn, char *os_buf, int len); 40162306a36Sopenharmony_ciconst char *show_opcode_name(int val); 40262306a36Sopenharmony_ci#endif /* _SNIC_H */ 403