aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi/be_main.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/be2iscsi/be_main.h')
-rw-r--r--drivers/scsi/be2iscsi/be_main.h85
1 files changed, 48 insertions, 37 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 53c9b70ac7ac..87ec21280a37 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -1,5 +1,5 @@
1/** 1/**
2 * Copyright (C) 2005 - 2009 ServerEngines 2 * Copyright (C) 2005 - 2010 ServerEngines
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -21,11 +21,9 @@
21#ifndef _BEISCSI_MAIN_ 21#ifndef _BEISCSI_MAIN_
22#define _BEISCSI_MAIN_ 22#define _BEISCSI_MAIN_
23 23
24
25#include <linux/kernel.h> 24#include <linux/kernel.h>
26#include <linux/pci.h> 25#include <linux/pci.h>
27#include <linux/in.h> 26#include <linux/in.h>
28#include <linux/blk-iopoll.h>
29#include <scsi/scsi.h> 27#include <scsi/scsi.h>
30#include <scsi/scsi_cmnd.h> 28#include <scsi/scsi_cmnd.h>
31#include <scsi/scsi_device.h> 29#include <scsi/scsi_device.h>
@@ -35,39 +33,36 @@
35#include <scsi/scsi_transport_iscsi.h> 33#include <scsi/scsi_transport_iscsi.h>
36 34
37#include "be.h" 35#include "be.h"
38
39
40
41#define DRV_NAME "be2iscsi" 36#define DRV_NAME "be2iscsi"
42#define BUILD_STR "2.0.527.0" 37#define BUILD_STR "2.0.527.0"
43
44#define BE_NAME "ServerEngines BladeEngine2" \ 38#define BE_NAME "ServerEngines BladeEngine2" \
45 "Linux iSCSI Driver version" BUILD_STR 39 "Linux iSCSI Driver version" BUILD_STR
46#define DRV_DESC BE_NAME " " "Driver" 40#define DRV_DESC BE_NAME " " "Driver"
47 41
48#define BE_VENDOR_ID 0x19A2 42#define BE_VENDOR_ID 0x19A2
43/* DEVICE ID's for BE2 */
49#define BE_DEVICE_ID1 0x212 44#define BE_DEVICE_ID1 0x212
50#define OC_DEVICE_ID1 0x702 45#define OC_DEVICE_ID1 0x702
51#define OC_DEVICE_ID2 0x703 46#define OC_DEVICE_ID2 0x703
52 47
53#define BE2_MAX_SESSIONS 64 48/* DEVICE ID's for BE3 */
49#define BE_DEVICE_ID2 0x222
50#define OC_DEVICE_ID3 0x712
51
52#define BE2_IO_DEPTH 1024
53#define BE2_MAX_SESSIONS 256
54#define BE2_CMDS_PER_CXN 128 54#define BE2_CMDS_PER_CXN 128
55#define BE2_LOGOUTS BE2_MAX_SESSIONS
56#define BE2_TMFS 16 55#define BE2_TMFS 16
57#define BE2_NOPOUT_REQ 16 56#define BE2_NOPOUT_REQ 16
58#define BE2_ASYNCPDUS BE2_MAX_SESSIONS
59#define BE2_MAX_ICDS 2048
60#define BE2_SGE 32 57#define BE2_SGE 32
61#define BE2_DEFPDU_HDR_SZ 64 58#define BE2_DEFPDU_HDR_SZ 64
62#define BE2_DEFPDU_DATA_SZ 8192 59#define BE2_DEFPDU_DATA_SZ 8192
63#define BE2_IO_DEPTH \
64 (BE2_MAX_ICDS / 2 - (BE2_LOGOUTS + BE2_TMFS + BE2_NOPOUT_REQ))
65 60
66#define BEISCSI_SGLIST_ELEMENTS BE2_SGE 61#define MAX_CPUS 31
62#define BEISCSI_SGLIST_ELEMENTS 30
67 63
68#define BEISCSI_MAX_CMNDS 1024 /* Max IO's per Ctrlr sht->can_queue */
69#define BEISCSI_CMD_PER_LUN 128 /* scsi_host->cmd_per_lun */ 64#define BEISCSI_CMD_PER_LUN 128 /* scsi_host->cmd_per_lun */
70#define BEISCSI_MAX_SECTORS 2048 /* scsi_host->max_sectors */ 65#define BEISCSI_MAX_SECTORS 256 /* scsi_host->max_sectors */
71 66
72#define BEISCSI_MAX_CMD_LEN 16 /* scsi_host->max_cmd_len */ 67#define BEISCSI_MAX_CMD_LEN 16 /* scsi_host->max_cmd_len */
73#define BEISCSI_NUM_MAX_LUN 256 /* scsi_host->max_lun */ 68#define BEISCSI_NUM_MAX_LUN 256 /* scsi_host->max_lun */
@@ -79,7 +74,7 @@
79#define BE_SENSE_INFO_SIZE 258 74#define BE_SENSE_INFO_SIZE 258
80#define BE_ISCSI_PDU_HEADER_SIZE 64 75#define BE_ISCSI_PDU_HEADER_SIZE 64
81#define BE_MIN_MEM_SIZE 16384 76#define BE_MIN_MEM_SIZE 16384
82 77#define MAX_CMD_SZ 65536
83#define IIOC_SCSI_DATA 0x05 /* Write Operation */ 78#define IIOC_SCSI_DATA 0x05 /* Write Operation */
84 79
85#define DBG_LVL 0x00000001 80#define DBG_LVL 0x00000001
@@ -100,6 +95,8 @@ do { \
100 } \ 95 } \
101} while (0); 96} while (0);
102 97
98#define BE_ADAPTER_UP 0x00000000
99#define BE_ADAPTER_LINK_DOWN 0x00000001
103/** 100/**
104 * hardware needs the async PDU buffers to be posted in multiples of 8 101 * hardware needs the async PDU buffers to be posted in multiples of 8
105 * So have atleast 8 of them by default 102 * So have atleast 8 of them by default
@@ -160,21 +157,19 @@ do { \
160 157
161enum be_mem_enum { 158enum be_mem_enum {
162 HWI_MEM_ADDN_CONTEXT, 159 HWI_MEM_ADDN_CONTEXT,
163 HWI_MEM_CQ,
164 HWI_MEM_EQ,
165 HWI_MEM_WRB, 160 HWI_MEM_WRB,
166 HWI_MEM_WRBH, 161 HWI_MEM_WRBH,
167 HWI_MEM_SGLH, /* 5 */ 162 HWI_MEM_SGLH,
168 HWI_MEM_SGE, 163 HWI_MEM_SGE,
169 HWI_MEM_ASYNC_HEADER_BUF, 164 HWI_MEM_ASYNC_HEADER_BUF, /* 5 */
170 HWI_MEM_ASYNC_DATA_BUF, 165 HWI_MEM_ASYNC_DATA_BUF,
171 HWI_MEM_ASYNC_HEADER_RING, 166 HWI_MEM_ASYNC_HEADER_RING,
172 HWI_MEM_ASYNC_DATA_RING, /* 10 */ 167 HWI_MEM_ASYNC_DATA_RING,
173 HWI_MEM_ASYNC_HEADER_HANDLE, 168 HWI_MEM_ASYNC_HEADER_HANDLE,
174 HWI_MEM_ASYNC_DATA_HANDLE, 169 HWI_MEM_ASYNC_DATA_HANDLE, /* 10 */
175 HWI_MEM_ASYNC_PDU_CONTEXT, 170 HWI_MEM_ASYNC_PDU_CONTEXT,
176 ISCSI_MEM_GLOBAL_HEADER, 171 ISCSI_MEM_GLOBAL_HEADER,
177 SE_MEM_MAX /* 15 */ 172 SE_MEM_MAX
178}; 173};
179 174
180struct be_bus_address32 { 175struct be_bus_address32 {
@@ -212,6 +207,9 @@ struct be_mem_descriptor {
212 207
213struct sgl_handle { 208struct sgl_handle {
214 unsigned int sgl_index; 209 unsigned int sgl_index;
210 unsigned int type;
211 unsigned int cid;
212 struct iscsi_task *task;
215 struct iscsi_sge *pfrag; 213 struct iscsi_sge *pfrag;
216}; 214};
217 215
@@ -259,6 +257,11 @@ struct hba_parameters {
259 unsigned int num_sge; 257 unsigned int num_sge;
260}; 258};
261 259
260struct invalidate_command_table {
261 unsigned short icd;
262 unsigned short cid;
263} __packed;
264
262struct beiscsi_hba { 265struct beiscsi_hba {
263 struct hba_parameters params; 266 struct hba_parameters params;
264 struct hwi_controller *phwi_ctrlr; 267 struct hwi_controller *phwi_ctrlr;
@@ -274,13 +277,17 @@ struct beiscsi_hba {
274 struct pci_dev *pcidev; 277 struct pci_dev *pcidev;
275 unsigned int state; 278 unsigned int state;
276 unsigned short asic_revision; 279 unsigned short asic_revision;
277 struct blk_iopoll iopoll; 280 unsigned int num_cpus;
281 unsigned int nxt_cqid;
282 struct msix_entry msix_entries[MAX_CPUS + 1];
283 bool msix_enabled;
278 struct be_mem_descriptor *init_mem; 284 struct be_mem_descriptor *init_mem;
279 285
280 unsigned short io_sgl_alloc_index; 286 unsigned short io_sgl_alloc_index;
281 unsigned short io_sgl_free_index; 287 unsigned short io_sgl_free_index;
282 unsigned short io_sgl_hndl_avbl; 288 unsigned short io_sgl_hndl_avbl;
283 struct sgl_handle **io_sgl_hndl_base; 289 struct sgl_handle **io_sgl_hndl_base;
290 struct sgl_handle **sgl_hndl_array;
284 291
285 unsigned short eh_sgl_alloc_index; 292 unsigned short eh_sgl_alloc_index;
286 unsigned short eh_sgl_free_index; 293 unsigned short eh_sgl_free_index;
@@ -315,6 +322,7 @@ struct beiscsi_hba {
315 unsigned short cid_alloc; 322 unsigned short cid_alloc;
316 unsigned short cid_free; 323 unsigned short cid_free;
317 unsigned short avlbl_cids; 324 unsigned short avlbl_cids;
325 unsigned short iscsi_features;
318 spinlock_t cid_lock; 326 spinlock_t cid_lock;
319 } fw_config; 327 } fw_config;
320 328
@@ -325,6 +333,9 @@ struct beiscsi_hba {
325 struct workqueue_struct *wq; /* The actuak work queue */ 333 struct workqueue_struct *wq; /* The actuak work queue */
326 struct work_struct work_cqs; /* The work being queued */ 334 struct work_struct work_cqs; /* The work being queued */
327 struct be_ctrl_info ctrl; 335 struct be_ctrl_info ctrl;
336 unsigned int generation;
337 struct invalidate_command_table inv_tbl[128];
338
328}; 339};
329 340
330struct beiscsi_session { 341struct beiscsi_session {
@@ -343,6 +354,7 @@ struct beiscsi_conn {
343 unsigned short login_in_progress; 354 unsigned short login_in_progress;
344 struct sgl_handle *plogin_sgl_handle; 355 struct sgl_handle *plogin_sgl_handle;
345 struct beiscsi_session *beiscsi_sess; 356 struct beiscsi_session *beiscsi_sess;
357 struct iscsi_task *task;
346}; 358};
347 359
348/* This structure is used by the chip */ 360/* This structure is used by the chip */
@@ -390,7 +402,7 @@ struct beiscsi_io_task {
390 unsigned int flags; 402 unsigned int flags;
391 unsigned short cid; 403 unsigned short cid;
392 unsigned short header_len; 404 unsigned short header_len;
393 405 itt_t libiscsi_itt;
394 struct be_cmd_bhs *cmd_bhs; 406 struct be_cmd_bhs *cmd_bhs;
395 struct be_bus_address bhs_pa; 407 struct be_bus_address bhs_pa;
396 unsigned short bhs_len; 408 unsigned short bhs_len;
@@ -486,8 +498,6 @@ struct hwi_async_entry {
486 struct list_head data_busy_list; 498 struct list_head data_busy_list;
487}; 499};
488 500
489#define BE_MIN_ASYNC_ENTRIES 128
490
491struct hwi_async_pdu_context { 501struct hwi_async_pdu_context {
492 struct { 502 struct {
493 struct be_bus_address pa_base; 503 struct be_bus_address pa_base;
@@ -528,7 +538,7 @@ struct hwi_async_pdu_context {
528 * This is a varying size list! Do not add anything 538 * This is a varying size list! Do not add anything
529 * after this entry!! 539 * after this entry!!
530 */ 540 */
531 struct hwi_async_entry async_entry[BE_MIN_ASYNC_ENTRIES]; 541 struct hwi_async_entry async_entry[BE2_MAX_SESSIONS * 2];
532}; 542};
533 543
534#define PDUCQE_CODE_MASK 0x0000003F 544#define PDUCQE_CODE_MASK 0x0000003F
@@ -599,7 +609,6 @@ struct amap_cq_db {
599 609
600void beiscsi_process_eq(struct beiscsi_hba *phba); 610void beiscsi_process_eq(struct beiscsi_hba *phba);
601 611
602
603struct iscsi_wrb { 612struct iscsi_wrb {
604 u32 dw[16]; 613 u32 dw[16];
605} __packed; 614} __packed;
@@ -651,11 +660,12 @@ struct amap_iscsi_wrb {
651 660
652} __packed; 661} __packed;
653 662
654struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid, 663struct wrb_handle *alloc_wrb_handle(struct beiscsi_hba *phba, unsigned int cid);
655 int index);
656void 664void
657free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle); 665free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle);
658 666
667void beiscsi_process_all_cqs(struct work_struct *work);
668
659struct pdu_nop_out { 669struct pdu_nop_out {
660 u32 dw[12]; 670 u32 dw[12];
661}; 671};
@@ -797,7 +807,6 @@ struct hwi_controller {
797 struct be_ring default_pdu_hdr; 807 struct be_ring default_pdu_hdr;
798 struct be_ring default_pdu_data; 808 struct be_ring default_pdu_data;
799 struct hwi_context_memory *phwi_ctxt; 809 struct hwi_context_memory *phwi_ctxt;
800 unsigned short cq_errors[CXN_KILLED_CMND_DATA_NOT_ON_SAME_CONN];
801}; 810};
802 811
803enum hwh_type_enum { 812enum hwh_type_enum {
@@ -820,10 +829,12 @@ struct wrb_handle {
820}; 829};
821 830
822struct hwi_context_memory { 831struct hwi_context_memory {
823 struct be_eq_obj be_eq; 832 /* Adaptive interrupt coalescing (AIC) info */
824 struct be_queue_info be_cq; 833 u16 min_eqd; /* in usecs */
825 struct be_queue_info be_mcc_cq; 834 u16 max_eqd; /* in usecs */
826 struct be_queue_info be_mcc; 835 u16 cur_eqd; /* in usecs */
836 struct be_eq_obj be_eq[MAX_CPUS];
837 struct be_queue_info be_cq[MAX_CPUS];
827 838
828 struct be_queue_info be_def_hdrq; 839 struct be_queue_info be_def_hdrq;
829 struct be_queue_info be_def_dataq; 840 struct be_queue_info be_def_dataq;