13287e96aSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2ace7f46bSManish Rangankar /* 3ace7f46bSManish Rangankar * QLogic iSCSI Offload Driver 4ace7f46bSManish Rangankar * Copyright (c) 2016 Cavium Inc. 5ace7f46bSManish Rangankar */ 6ace7f46bSManish Rangankar 7ace7f46bSManish Rangankar #ifndef _QEDI_H_ 8ace7f46bSManish Rangankar #define _QEDI_H_ 9ace7f46bSManish Rangankar 10ace7f46bSManish Rangankar #define __PREVENT_QED_HSI__ 11ace7f46bSManish Rangankar 12ace7f46bSManish Rangankar #include <scsi/scsi_transport_iscsi.h> 13ace7f46bSManish Rangankar #include <scsi/libiscsi.h> 14ace7f46bSManish Rangankar #include <scsi/scsi_host.h> 15ace7f46bSManish Rangankar #include <linux/uio_driver.h> 16ace7f46bSManish Rangankar 17ace7f46bSManish Rangankar #include "qedi_hsi.h" 18ace7f46bSManish Rangankar #include <linux/qed/qed_if.h> 19ace7f46bSManish Rangankar #include "qedi_dbg.h" 20ace7f46bSManish Rangankar #include <linux/qed/qed_iscsi_if.h> 21ace7f46bSManish Rangankar #include <linux/qed/qed_ll2_if.h> 22ace7f46bSManish Rangankar #include "qedi_version.h" 23c57ec8fbSNilesh Javali #include "qedi_nvm_iscsi_cfg.h" 24ace7f46bSManish Rangankar 25ace7f46bSManish Rangankar #define QEDI_MODULE_NAME "qedi" 26ace7f46bSManish Rangankar 27ace7f46bSManish Rangankar struct qedi_endpoint; 28ace7f46bSManish Rangankar 29c57ec8fbSNilesh Javali #ifndef GET_FIELD2 30c57ec8fbSNilesh Javali #define GET_FIELD2(value, name) \ 31c57ec8fbSNilesh Javali (((value) & (name ## _MASK)) >> (name ## _OFFSET)) 32c57ec8fbSNilesh Javali #endif 33c57ec8fbSNilesh Javali 34ace7f46bSManish Rangankar /* 35ace7f46bSManish Rangankar * PCI function probe defines 36ace7f46bSManish Rangankar */ 37ace7f46bSManish Rangankar #define QEDI_MODE_NORMAL 0 38ace7f46bSManish Rangankar #define QEDI_MODE_RECOVERY 1 394f93c4bfSManish Rangankar #define QEDI_MODE_SHUTDOWN 2 40ace7f46bSManish Rangankar 41ace7f46bSManish Rangankar #define ISCSI_WQE_SET_PTU_INVALIDATE 1 42ace7f46bSManish Rangankar #define QEDI_MAX_ISCSI_TASK 4096 43ace7f46bSManish Rangankar #define QEDI_MAX_TASK_NUM 0x0FFF 44ace7f46bSManish Rangankar #define QEDI_MAX_ISCSI_CONNS_PER_HBA 1024 45fc2fbf0dSmanish.rangankar@cavium.com #define QEDI_ISCSI_MAX_BDS_PER_CMD 255 /* Firmware max BDs is 255 */ 46f853053dSNilesh Javali #define MAX_OUTSTANDING_TASKS_PER_CON 1024 47ace7f46bSManish Rangankar 48ace7f46bSManish Rangankar #define QEDI_MAX_BD_LEN 0xffff 49ace7f46bSManish Rangankar #define QEDI_BD_SPLIT_SZ 0x1000 50ace7f46bSManish Rangankar #define QEDI_PAGE_SIZE 4096 51ace7f46bSManish Rangankar #define QEDI_FAST_SGE_COUNT 4 52ace7f46bSManish Rangankar /* MAX Length for cached SGL */ 53ace7f46bSManish Rangankar #define MAX_SGLEN_FOR_CACHESGL ((1U << 16) - 1) 54ace7f46bSManish Rangankar 5542d7c10fSManish Rangankar #define MIN_NUM_CPUS_MSIX(x) min_t(u32, x->dev_info.num_cqs, \ 5642d7c10fSManish Rangankar num_online_cpus()) 57ace7f46bSManish Rangankar 58ace7f46bSManish Rangankar #define QEDI_LOCAL_PORT_MIN 60000 59ace7f46bSManish Rangankar #define QEDI_LOCAL_PORT_MAX 61024 60ace7f46bSManish Rangankar #define QEDI_LOCAL_PORT_RANGE (QEDI_LOCAL_PORT_MAX - QEDI_LOCAL_PORT_MIN) 61ace7f46bSManish Rangankar #define QEDI_LOCAL_PORT_INVALID 0xffff 62ace7f46bSManish Rangankar #define TX_RX_RING 16 63ace7f46bSManish Rangankar #define RX_RING (TX_RX_RING - 1) 64ace7f46bSManish Rangankar #define QEDI_PAGE_ALIGN(addr) ALIGN(addr, QEDI_PAGE_SIZE) 65ace7f46bSManish Rangankar #define QEDI_PAGE_MASK (~((QEDI_PAGE_SIZE) - 1)) 66ace7f46bSManish Rangankar 67d0788a52Smanish.rangankar@cavium.com #define QEDI_HW_DMA_BOUNDARY 0xfff 68ace7f46bSManish Rangankar #define QEDI_PATH_HANDLE 0xFE0000000UL 69ace7f46bSManish Rangankar 70c57ec8fbSNilesh Javali enum qedi_nvm_tgts { 71c57ec8fbSNilesh Javali QEDI_NVM_TGT_PRI, 72c57ec8fbSNilesh Javali QEDI_NVM_TGT_SEC, 73c57ec8fbSNilesh Javali }; 74c57ec8fbSNilesh Javali 75c77a2fa3SNilesh Javali struct qedi_nvm_iscsi_image { 76c77a2fa3SNilesh Javali struct nvm_iscsi_cfg iscsi_cfg; 77c77a2fa3SNilesh Javali u32 crc; 78c77a2fa3SNilesh Javali }; 79c77a2fa3SNilesh Javali 80ace7f46bSManish Rangankar struct qedi_uio_ctrl { 81ace7f46bSManish Rangankar /* meta data */ 82ace7f46bSManish Rangankar u32 uio_hsi_version; 83ace7f46bSManish Rangankar 84ace7f46bSManish Rangankar /* user writes */ 85ace7f46bSManish Rangankar u32 host_tx_prod; 86ace7f46bSManish Rangankar u32 host_rx_cons; 87ace7f46bSManish Rangankar u32 host_rx_bd_cons; 88ace7f46bSManish Rangankar u32 host_tx_pkt_len; 89ace7f46bSManish Rangankar u32 host_rx_cons_cnt; 90ace7f46bSManish Rangankar 91ace7f46bSManish Rangankar /* driver writes */ 92ace7f46bSManish Rangankar u32 hw_tx_cons; 93ace7f46bSManish Rangankar u32 hw_rx_prod; 94ace7f46bSManish Rangankar u32 hw_rx_bd_prod; 95ace7f46bSManish Rangankar u32 hw_rx_prod_cnt; 96ace7f46bSManish Rangankar 97ace7f46bSManish Rangankar /* other */ 98ace7f46bSManish Rangankar u8 mac_addr[6]; 99ace7f46bSManish Rangankar u8 reserve[2]; 100ace7f46bSManish Rangankar }; 101ace7f46bSManish Rangankar 102ace7f46bSManish Rangankar struct qedi_rx_bd { 103ace7f46bSManish Rangankar u32 rx_pkt_index; 104ace7f46bSManish Rangankar u32 rx_pkt_len; 105ace7f46bSManish Rangankar u16 vlan_id; 106ace7f46bSManish Rangankar }; 107ace7f46bSManish Rangankar 108ace7f46bSManish Rangankar #define QEDI_RX_DESC_CNT (QEDI_PAGE_SIZE / sizeof(struct qedi_rx_bd)) 109ace7f46bSManish Rangankar #define QEDI_MAX_RX_DESC_CNT (QEDI_RX_DESC_CNT - 1) 110ace7f46bSManish Rangankar #define QEDI_NUM_RX_BD (QEDI_RX_DESC_CNT * 1) 111ace7f46bSManish Rangankar #define QEDI_MAX_RX_BD (QEDI_NUM_RX_BD - 1) 112ace7f46bSManish Rangankar 113ace7f46bSManish Rangankar #define QEDI_NEXT_RX_IDX(x) ((((x) & (QEDI_MAX_RX_DESC_CNT)) == \ 114ace7f46bSManish Rangankar (QEDI_MAX_RX_DESC_CNT - 1)) ? \ 115ace7f46bSManish Rangankar (x) + 2 : (x) + 1) 116ace7f46bSManish Rangankar 117ace7f46bSManish Rangankar struct qedi_uio_dev { 118ace7f46bSManish Rangankar struct uio_info qedi_uinfo; 119ace7f46bSManish Rangankar u32 uio_dev; 120ace7f46bSManish Rangankar struct list_head list; 121ace7f46bSManish Rangankar 122ace7f46bSManish Rangankar u32 ll2_ring_size; 123ace7f46bSManish Rangankar void *ll2_ring; 124ace7f46bSManish Rangankar 125ace7f46bSManish Rangankar u32 ll2_buf_size; 126ace7f46bSManish Rangankar void *ll2_buf; 127ace7f46bSManish Rangankar 128ace7f46bSManish Rangankar void *rx_pkt; 129ace7f46bSManish Rangankar void *tx_pkt; 130ace7f46bSManish Rangankar 131ace7f46bSManish Rangankar struct qedi_ctx *qedi; 132ace7f46bSManish Rangankar struct pci_dev *pdev; 133ace7f46bSManish Rangankar void *uctrl; 134ace7f46bSManish Rangankar }; 135ace7f46bSManish Rangankar 136ace7f46bSManish Rangankar /* List to maintain the skb pointers */ 137ace7f46bSManish Rangankar struct skb_work_list { 138ace7f46bSManish Rangankar struct list_head list; 139ace7f46bSManish Rangankar struct sk_buff *skb; 140ace7f46bSManish Rangankar u16 vlan_id; 141ace7f46bSManish Rangankar }; 142ace7f46bSManish Rangankar 143ace7f46bSManish Rangankar /* Queue sizes in number of elements */ 144f853053dSNilesh Javali #define QEDI_SQ_SIZE MAX_OUTSTANDING_TASKS_PER_CON 145ace7f46bSManish Rangankar #define QEDI_CQ_SIZE 2048 146ace7f46bSManish Rangankar #define QEDI_CMDQ_SIZE QEDI_MAX_ISCSI_TASK 147ace7f46bSManish Rangankar #define QEDI_PROTO_CQ_PROD_IDX 0 148ace7f46bSManish Rangankar 149ace7f46bSManish Rangankar struct qedi_glbl_q_params { 150ace7f46bSManish Rangankar u64 hw_p_cq; /* Completion queue PBL */ 151ace7f46bSManish Rangankar u64 hw_p_rq; /* Request queue PBL */ 152ace7f46bSManish Rangankar u64 hw_p_cmdq; /* Command queue PBL */ 153ace7f46bSManish Rangankar }; 154ace7f46bSManish Rangankar 155ace7f46bSManish Rangankar struct global_queue { 156ace7f46bSManish Rangankar union iscsi_cqe *cq; 157ace7f46bSManish Rangankar dma_addr_t cq_dma; 158ace7f46bSManish Rangankar u32 cq_mem_size; 159ace7f46bSManish Rangankar u32 cq_cons_idx; /* Completion queue consumer index */ 160ace7f46bSManish Rangankar 161ace7f46bSManish Rangankar void *cq_pbl; 162ace7f46bSManish Rangankar dma_addr_t cq_pbl_dma; 163ace7f46bSManish Rangankar u32 cq_pbl_size; 164ace7f46bSManish Rangankar 165ace7f46bSManish Rangankar }; 166ace7f46bSManish Rangankar 167ace7f46bSManish Rangankar struct qedi_fastpath { 168ace7f46bSManish Rangankar struct qed_sb_info *sb_info; 169ace7f46bSManish Rangankar u16 sb_id; 170ace7f46bSManish Rangankar #define QEDI_NAME_SIZE 16 171ace7f46bSManish Rangankar char name[QEDI_NAME_SIZE]; 172ace7f46bSManish Rangankar struct qedi_ctx *qedi; 173ace7f46bSManish Rangankar }; 174ace7f46bSManish Rangankar 175ace7f46bSManish Rangankar /* Used to pass fastpath information needed to process CQEs */ 176ace7f46bSManish Rangankar struct qedi_io_work { 177ace7f46bSManish Rangankar struct list_head list; 178ace7f46bSManish Rangankar struct iscsi_cqe_solicited cqe; 179ace7f46bSManish Rangankar u16 que_idx; 180ace7f46bSManish Rangankar }; 181ace7f46bSManish Rangankar 182ace7f46bSManish Rangankar /** 183ace7f46bSManish Rangankar * struct iscsi_cid_queue - Per adapter iscsi cid queue 184ace7f46bSManish Rangankar * 185ace7f46bSManish Rangankar * @cid_que_base: queue base memory 186ace7f46bSManish Rangankar * @cid_que: queue memory pointer 187ace7f46bSManish Rangankar * @cid_q_prod_idx: produce index 188ace7f46bSManish Rangankar * @cid_q_cons_idx: consumer index 189ace7f46bSManish Rangankar * @cid_q_max_idx: max index. used to detect wrap around condition 190ace7f46bSManish Rangankar * @cid_free_cnt: queue size 191ace7f46bSManish Rangankar * @conn_cid_tbl: iscsi cid to conn structure mapping table 192ace7f46bSManish Rangankar * 193ace7f46bSManish Rangankar * Per adapter iSCSI CID Queue 194ace7f46bSManish Rangankar */ 195ace7f46bSManish Rangankar struct iscsi_cid_queue { 196ace7f46bSManish Rangankar void *cid_que_base; 197ace7f46bSManish Rangankar u32 *cid_que; 198ace7f46bSManish Rangankar u32 cid_q_prod_idx; 199ace7f46bSManish Rangankar u32 cid_q_cons_idx; 200ace7f46bSManish Rangankar u32 cid_q_max_idx; 201ace7f46bSManish Rangankar u32 cid_free_cnt; 202ace7f46bSManish Rangankar struct qedi_conn **conn_cid_tbl; 203ace7f46bSManish Rangankar }; 204ace7f46bSManish Rangankar 205ace7f46bSManish Rangankar struct qedi_portid_tbl { 206ace7f46bSManish Rangankar spinlock_t lock; /* Port id lock */ 207ace7f46bSManish Rangankar u16 start; 208ace7f46bSManish Rangankar u16 max; 209ace7f46bSManish Rangankar u16 next; 210ace7f46bSManish Rangankar unsigned long *table; 211ace7f46bSManish Rangankar }; 212ace7f46bSManish Rangankar 213ace7f46bSManish Rangankar struct qedi_itt_map { 214ace7f46bSManish Rangankar __le32 itt; 215ace7f46bSManish Rangankar struct qedi_cmd *p_cmd; 216ace7f46bSManish Rangankar }; 217ace7f46bSManish Rangankar 218ace7f46bSManish Rangankar /* I/O tracing entry */ 219ace7f46bSManish Rangankar #define QEDI_IO_TRACE_SIZE 2048 220ace7f46bSManish Rangankar struct qedi_io_log { 221ace7f46bSManish Rangankar #define QEDI_IO_TRACE_REQ 0 222ace7f46bSManish Rangankar #define QEDI_IO_TRACE_RSP 1 223ace7f46bSManish Rangankar u8 direction; 224ace7f46bSManish Rangankar u16 task_id; 225ace7f46bSManish Rangankar u32 cid; 226ace7f46bSManish Rangankar u32 port_id; /* Remote port fabric ID */ 227ace7f46bSManish Rangankar int lun; 228ace7f46bSManish Rangankar u8 op; /* SCSI CDB */ 229ace7f46bSManish Rangankar u8 lba[4]; 230ace7f46bSManish Rangankar unsigned int bufflen; /* SCSI buffer length */ 231ace7f46bSManish Rangankar unsigned int sg_count; /* Number of SG elements */ 232ace7f46bSManish Rangankar u8 fast_sgs; /* number of fast sgls */ 233ace7f46bSManish Rangankar u8 slow_sgs; /* number of slow sgls */ 234ace7f46bSManish Rangankar u8 cached_sgs; /* number of cached sgls */ 235ace7f46bSManish Rangankar int result; /* Result passed back to mid-layer */ 236ace7f46bSManish Rangankar unsigned long jiffies; /* Time stamp when I/O logged */ 237ace7f46bSManish Rangankar int refcount; /* Reference count for task id */ 238ace7f46bSManish Rangankar unsigned int blk_req_cpu; /* CPU that the task is queued on by 239ace7f46bSManish Rangankar * blk layer 240ace7f46bSManish Rangankar */ 241ace7f46bSManish Rangankar unsigned int req_cpu; /* CPU that the task is queued on */ 242ace7f46bSManish Rangankar unsigned int intr_cpu; /* Interrupt CPU that the task is received on */ 243ace7f46bSManish Rangankar unsigned int blk_rsp_cpu;/* CPU that task is actually processed and 244ace7f46bSManish Rangankar * returned to blk layer 245ace7f46bSManish Rangankar */ 246ace7f46bSManish Rangankar bool cached_sge; 247ace7f46bSManish Rangankar bool slow_sge; 248ace7f46bSManish Rangankar bool fast_sge; 249ace7f46bSManish Rangankar }; 250ace7f46bSManish Rangankar 251ace7f46bSManish Rangankar /* Number of entries in BDQ */ 252ace7f46bSManish Rangankar #define QEDI_BDQ_NUM 256 253ace7f46bSManish Rangankar #define QEDI_BDQ_BUF_SIZE 256 254ace7f46bSManish Rangankar 255ace7f46bSManish Rangankar /* DMA coherent buffers for BDQ */ 256ace7f46bSManish Rangankar struct qedi_bdq_buf { 257ace7f46bSManish Rangankar void *buf_addr; 258ace7f46bSManish Rangankar dma_addr_t buf_dma; 259ace7f46bSManish Rangankar }; 260ace7f46bSManish Rangankar 261ace7f46bSManish Rangankar /* Main port level struct */ 262ace7f46bSManish Rangankar struct qedi_ctx { 263ace7f46bSManish Rangankar struct qedi_dbg_ctx dbg_ctx; 264ace7f46bSManish Rangankar struct Scsi_Host *shost; 265ace7f46bSManish Rangankar struct pci_dev *pdev; 266ace7f46bSManish Rangankar struct qed_dev *cdev; 267ace7f46bSManish Rangankar struct qed_dev_iscsi_info dev_info; 268ace7f46bSManish Rangankar struct qed_int_info int_info; 269ace7f46bSManish Rangankar struct qedi_glbl_q_params *p_cpuq; 270ace7f46bSManish Rangankar struct global_queue **global_queues; 271ace7f46bSManish Rangankar /* uio declaration */ 272ace7f46bSManish Rangankar struct qedi_uio_dev *udev; 273ace7f46bSManish Rangankar struct list_head ll2_skb_list; 274ace7f46bSManish Rangankar spinlock_t ll2_lock; /* Light L2 lock */ 275ace7f46bSManish Rangankar spinlock_t hba_lock; /* per port lock */ 276ace7f46bSManish Rangankar struct task_struct *ll2_recv_thread; 277f4ba4e55SManish Rangankar unsigned long qedi_err_flags; 278f4ba4e55SManish Rangankar #define QEDI_ERR_ATTN_CLR_EN 0 279f4ba4e55SManish Rangankar #define QEDI_ERR_IS_RECOVERABLE 2 280f4ba4e55SManish Rangankar #define QEDI_ERR_OVERRIDE_EN 31 281ace7f46bSManish Rangankar unsigned long flags; 282ace7f46bSManish Rangankar #define UIO_DEV_OPENED 1 283ace7f46bSManish Rangankar #define QEDI_IOTHREAD_WAKE 2 284ace7f46bSManish Rangankar #define QEDI_IN_RECOVERY 5 285ace7f46bSManish Rangankar #define QEDI_IN_OFFLINE 6 2864f93c4bfSManish Rangankar #define QEDI_IN_SHUTDOWN 7 287*0c72191dSMike Christie #define QEDI_BLOCK_IO 8 288ace7f46bSManish Rangankar 289ace7f46bSManish Rangankar u8 mac[ETH_ALEN]; 290ace7f46bSManish Rangankar u32 src_ip[4]; 291ace7f46bSManish Rangankar u8 ip_type; 292ace7f46bSManish Rangankar 293ace7f46bSManish Rangankar /* Physical address of above array */ 294ace7f46bSManish Rangankar dma_addr_t hw_p_cpuq; 295ace7f46bSManish Rangankar 296ace7f46bSManish Rangankar struct qedi_bdq_buf bdq[QEDI_BDQ_NUM]; 297ace7f46bSManish Rangankar void *bdq_pbl; 298ace7f46bSManish Rangankar dma_addr_t bdq_pbl_dma; 299ace7f46bSManish Rangankar size_t bdq_pbl_mem_size; 300ace7f46bSManish Rangankar void *bdq_pbl_list; 301ace7f46bSManish Rangankar dma_addr_t bdq_pbl_list_dma; 302ace7f46bSManish Rangankar u8 bdq_pbl_list_num_entries; 303c77a2fa3SNilesh Javali struct qedi_nvm_iscsi_image *iscsi_image; 304c57ec8fbSNilesh Javali dma_addr_t nvm_buf_dma; 305ace7f46bSManish Rangankar void __iomem *bdq_primary_prod; 306ace7f46bSManish Rangankar void __iomem *bdq_secondary_prod; 307ace7f46bSManish Rangankar u16 bdq_prod_idx; 308ace7f46bSManish Rangankar u16 rq_num_entries; 309ace7f46bSManish Rangankar 310ace7f46bSManish Rangankar u32 max_sqes; 311ace7f46bSManish Rangankar u8 num_queues; 312ace7f46bSManish Rangankar u32 max_active_conns; 3133f8ad007SManish Rangankar s32 msix_count; 314ace7f46bSManish Rangankar 315ace7f46bSManish Rangankar struct iscsi_cid_queue cid_que; 316ace7f46bSManish Rangankar struct qedi_endpoint **ep_tbl; 317ace7f46bSManish Rangankar struct qedi_portid_tbl lcl_port_tbl; 318ace7f46bSManish Rangankar 319ace7f46bSManish Rangankar /* Rx fast path intr context */ 320ace7f46bSManish Rangankar struct qed_sb_info *sb_array; 321ace7f46bSManish Rangankar struct qedi_fastpath *fp_array; 322ace7f46bSManish Rangankar struct qed_iscsi_tid tasks; 323ace7f46bSManish Rangankar 324ace7f46bSManish Rangankar #define QEDI_LINK_DOWN 0 325ace7f46bSManish Rangankar #define QEDI_LINK_UP 1 326ace7f46bSManish Rangankar atomic_t link_state; 327ace7f46bSManish Rangankar 328ace7f46bSManish Rangankar #define QEDI_RESERVE_TASK_ID 0 329ace7f46bSManish Rangankar #define MAX_ISCSI_TASK_ENTRIES 4096 330ace7f46bSManish Rangankar #define QEDI_INVALID_TASK_ID (MAX_ISCSI_TASK_ENTRIES + 1) 331ace7f46bSManish Rangankar unsigned long task_idx_map[MAX_ISCSI_TASK_ENTRIES / BITS_PER_LONG]; 332ace7f46bSManish Rangankar struct qedi_itt_map *itt_map; 333ace7f46bSManish Rangankar u16 tid_reuse_count[QEDI_MAX_ISCSI_TASK]; 334ace7f46bSManish Rangankar struct qed_pf_params pf_params; 335ace7f46bSManish Rangankar 336ace7f46bSManish Rangankar struct workqueue_struct *tmf_thread; 337ace7f46bSManish Rangankar struct workqueue_struct *offload_thread; 338ace7f46bSManish Rangankar 339ace7f46bSManish Rangankar u16 ll2_mtu; 340ace7f46bSManish Rangankar 341ace7f46bSManish Rangankar struct workqueue_struct *dpc_wq; 3424b1068f5SManish Rangankar struct delayed_work recovery_work; 3437dc71ac8SManish Rangankar struct delayed_work board_disable_work; 344ace7f46bSManish Rangankar 345ace7f46bSManish Rangankar spinlock_t task_idx_lock; /* To protect gbl context */ 346ace7f46bSManish Rangankar s32 last_tidx_alloc; 347ace7f46bSManish Rangankar s32 last_tidx_clear; 348ace7f46bSManish Rangankar 349ace7f46bSManish Rangankar struct qedi_io_log io_trace_buf[QEDI_IO_TRACE_SIZE]; 350ace7f46bSManish Rangankar spinlock_t io_trace_lock; /* prtect trace Log buf */ 351ace7f46bSManish Rangankar u16 io_trace_idx; 352ace7f46bSManish Rangankar unsigned int intr_cpu; 353ace7f46bSManish Rangankar u32 cached_sgls; 354ace7f46bSManish Rangankar bool use_cached_sge; 355ace7f46bSManish Rangankar u32 slow_sgls; 356ace7f46bSManish Rangankar bool use_slow_sge; 357ace7f46bSManish Rangankar u32 fast_sgls; 358ace7f46bSManish Rangankar bool use_fast_sge; 359ace7f46bSManish Rangankar 360ace7f46bSManish Rangankar atomic_t num_offloads; 361c57ec8fbSNilesh Javali #define SYSFS_FLAG_FW_SEL_BOOT 2 362c57ec8fbSNilesh Javali #define IPV6_LEN 41 363c57ec8fbSNilesh Javali #define IPV4_LEN 17 364c57ec8fbSNilesh Javali struct iscsi_boot_kset *boot_kset; 365534bbdf8SManish Rangankar 366534bbdf8SManish Rangankar /* Used for iscsi statistics */ 367534bbdf8SManish Rangankar struct mutex stats_lock; 368ace7f46bSManish Rangankar }; 369ace7f46bSManish Rangankar 370ace7f46bSManish Rangankar struct qedi_work { 371ace7f46bSManish Rangankar struct list_head list; 372ace7f46bSManish Rangankar struct qedi_ctx *qedi; 373ace7f46bSManish Rangankar union iscsi_cqe cqe; 374ace7f46bSManish Rangankar u16 que_idx; 375ace7f46bSManish Rangankar bool is_solicited; 376ace7f46bSManish Rangankar }; 377ace7f46bSManish Rangankar 378ace7f46bSManish Rangankar struct qedi_percpu_s { 379ace7f46bSManish Rangankar struct task_struct *iothread; 380ace7f46bSManish Rangankar struct list_head work_list; 381ace7f46bSManish Rangankar spinlock_t p_work_lock; /* Per cpu worker lock */ 382ace7f46bSManish Rangankar }; 383ace7f46bSManish Rangankar qedi_get_task_mem(struct qed_iscsi_tid * info,u32 tid)384ace7f46bSManish Rangankarstatic inline void *qedi_get_task_mem(struct qed_iscsi_tid *info, u32 tid) 385ace7f46bSManish Rangankar { 386ace7f46bSManish Rangankar return (info->blocks[tid / info->num_tids_per_block] + 387ace7f46bSManish Rangankar (tid % info->num_tids_per_block) * info->size); 388ace7f46bSManish Rangankar } 389ace7f46bSManish Rangankar 390ace7f46bSManish Rangankar #define QEDI_U64_HI(val) ((u32)(((u64)(val)) >> 32)) 391ace7f46bSManish Rangankar #define QEDI_U64_LO(val) ((u32)(((u64)(val)) & 0xffffffff)) 392ace7f46bSManish Rangankar 393ace7f46bSManish Rangankar #endif /* _QEDI_H_ */ 394