Go to the documentation of this file.
14 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
16 #include <linux/module.h>
18 #include <linux/kernel.h>
20 #include <linux/netdevice.h>
22 #include <linux/if_ether.h>
23 #include <linux/if_vlan.h>
27 #include <linux/types.h>
28 #include <linux/list.h>
31 #include <linux/errno.h>
32 #include <linux/pci.h>
38 #include <linux/bitops.h>
41 #include <linux/sched.h>
44 #include <scsi/scsi.h>
62 #include "../../net/ethernet/broadcom/cnic_if.h"
63 #include "../../net/ethernet/broadcom/bnx2x/bnx2x_mfw_req.h"
66 #define BNX2FC_NAME "bnx2fc"
67 #define BNX2FC_VERSION "1.0.12"
69 #define PFX "bnx2fc: "
71 #define BNX2X_DOORBELL_PCI_BAR 2
73 #define BNX2FC_MAX_BD_LEN 0xffff
74 #define BNX2FC_BD_SPLIT_SZ 0x8000
75 #define BNX2FC_MAX_BDS_PER_CMD 256
77 #define BNX2FC_SQ_WQES_MAX 256
79 #define BNX2FC_SCSI_MAX_SQES ((3 * BNX2FC_SQ_WQES_MAX) / 8)
80 #define BNX2FC_TM_MAX_SQES ((BNX2FC_SQ_WQES_MAX) / 2)
81 #define BNX2FC_ELS_MAX_SQES (BNX2FC_TM_MAX_SQES - 1)
83 #define BNX2FC_RQ_WQES_MAX 16
84 #define BNX2FC_CQ_WQES_MAX (BNX2FC_SQ_WQES_MAX + BNX2FC_RQ_WQES_MAX)
86 #define BNX2FC_NUM_MAX_SESS 1024
87 #define BNX2FC_NUM_MAX_SESS_LOG (ilog2(BNX2FC_NUM_MAX_SESS))
89 #define BNX2FC_MAX_NPIV 256
91 #define BNX2FC_MAX_OUTSTANDING_CMNDS 2048
92 #define BNX2FC_CAN_QUEUE BNX2FC_MAX_OUTSTANDING_CMNDS
93 #define BNX2FC_ELSTM_XIDS BNX2FC_CAN_QUEUE
94 #define BNX2FC_MIN_PAYLOAD 256
95 #define BNX2FC_MAX_PAYLOAD 2048
97 (BNX2FC_MAX_PAYLOAD + sizeof(struct fc_frame_header))
98 #define BNX2FC_MINI_JUMBO_MTU 2500
101 #define BNX2FC_RQ_BUF_SZ 256
102 #define BNX2FC_RQ_BUF_LOG_SZ (ilog2(BNX2FC_RQ_BUF_SZ))
104 #define BNX2FC_SQ_WQE_SIZE (sizeof(struct fcoe_sqe))
105 #define BNX2FC_CQ_WQE_SIZE (sizeof(struct fcoe_cqe))
106 #define BNX2FC_RQ_WQE_SIZE (BNX2FC_RQ_BUF_SZ)
107 #define BNX2FC_XFERQ_WQE_SIZE (sizeof(struct fcoe_xfrqe))
108 #define BNX2FC_CONFQ_WQE_SIZE (sizeof(struct fcoe_confqe))
109 #define BNX2FC_5771X_DB_PAGE_SIZE 128
111 #define BNX2FC_MAX_TASKS \
112 (BNX2FC_MAX_OUTSTANDING_CMNDS + BNX2FC_ELSTM_XIDS)
113 #define BNX2FC_TASK_SIZE 128
114 #define BNX2FC_TASKS_PER_PAGE (PAGE_SIZE/BNX2FC_TASK_SIZE)
115 #define BNX2FC_TASK_CTX_ARR_SZ (BNX2FC_MAX_TASKS/BNX2FC_TASKS_PER_PAGE)
117 #define BNX2FC_MAX_ROWS_IN_HASH_TBL 8
118 #define BNX2FC_HASH_TBL_CHUNK_SIZE (16 * 1024)
120 #define BNX2FC_MAX_SEQS 255
121 #define BNX2FC_MAX_RETRY_CNT 3
122 #define BNX2FC_MAX_RPORT_RETRY_CNT 255
124 #define BNX2FC_READ (1 << 1)
125 #define BNX2FC_WRITE (1 << 0)
127 #define BNX2FC_MIN_XID 0
128 #define BNX2FC_MAX_XID \
129 (BNX2FC_MAX_OUTSTANDING_CMNDS + BNX2FC_ELSTM_XIDS - 1)
130 #define FCOE_MAX_NUM_XIDS 0x2000
131 #define FCOE_MIN_XID (BNX2FC_MAX_XID + 1)
132 #define FCOE_MAX_XID (FCOE_MIN_XID + FCOE_MAX_NUM_XIDS - 1)
133 #define FCOE_XIDS_PER_CPU (FCOE_MIN_XID + (512 * nr_cpu_ids) - 1)
134 #define BNX2FC_MAX_LUN 0xFFFF
135 #define BNX2FC_MAX_FCP_TGT 256
136 #define BNX2FC_MAX_CMD_LEN 16
138 #define BNX2FC_TM_TIMEOUT 60
139 #define BNX2FC_IO_TIMEOUT 20000UL
141 #define BNX2FC_WAIT_CNT 1200
142 #define BNX2FC_FW_TIMEOUT (3 * HZ)
145 #define CMD_SCSI_STATUS(Cmnd) ((Cmnd)->SCp.Status)
150 #define BNX2FC_RNID_HBA 0x7
152 #define SRR_RETRY_COUNT 5
153 #define REC_RETRY_COUNT 1
154 #define BNX2FC_NUM_ERR_BITS 63
156 #define BNX2FC_RELOGIN_WAIT_TIME 200
157 #define BNX2FC_RELOGIN_WAIT_CNT 10
176 #define BNX2FC_CNIC_REGISTERED 1
181 #define ADAPTER_STATE_UP 0
182 #define ADAPTER_STATE_GOING_DOWN 1
183 #define ADAPTER_STATE_LINK_DOWN 2
184 #define ADAPTER_STATE_READY 3
186 #define BNX2FC_FLAG_FW_INIT_DONE 0
187 #define BNX2FC_FLAG_DESTROY_CMPL 1
229 #define BNX2FC_CTLR_INIT_DONE 0
241 #define bnx2fc_from_ctlr(x) \
242 ((struct bnx2fc_interface *)((x) + 1))
244 #define bnx2fc_to_ctlr(x) \
245 ((struct fcoe_ctlr *)(((struct fcoe_ctlr *)(x)) - 1))
266 #define DPM_TRIGER_TYPE 0x40
274 #define BNX2FC_FLAG_SESSION_READY 0x1
275 #define BNX2FC_FLAG_OFFLOADED 0x2
276 #define BNX2FC_FLAG_DISABLED 0x3
277 #define BNX2FC_FLAG_DESTROYED 0x4
278 #define BNX2FC_FLAG_OFLD_REQ_CMPL 0x5
279 #define BNX2FC_FLAG_CTX_ALLOC_FAILURE 0x6
280 #define BNX2FC_FLAG_UPLD_REQ_COMPL 0x7
281 #define BNX2FC_FLAG_EXPL_LOGO 0x8
282 #define BNX2FC_FLAG_DISABLE_FAILED 0x9
391 #define BNX2FC_SCSI_CMD 1
392 #define BNX2FC_TASK_MGMT_CMD 2
393 #define BNX2FC_ABTS 3
395 #define BNX2FC_CLEANUP 5
396 #define BNX2FC_SEQ_CLEANUP 6
416 #define BNX2FC_FLAG_ISSUE_RRQ 0x1
417 #define BNX2FC_FLAG_ISSUE_ABTS 0x2
418 #define BNX2FC_FLAG_ABTS_DONE 0x3
419 #define BNX2FC_FLAG_TM_COMPL 0x4
420 #define BNX2FC_FLAG_TM_TIMEOUT 0x5
421 #define BNX2FC_FLAG_IO_CLEANUP 0x6
422 #define BNX2FC_FLAG_RETIRE_OXID 0x7
423 #define BNX2FC_FLAG_EH_ABORT 0x8
424 #define BNX2FC_FLAG_IO_COMPL 0x9
425 #define BNX2FC_FLAG_ELS_DONE 0xa
426 #define BNX2FC_FLAG_ELS_TIMEOUT 0xb
427 #define BNX2FC_FLAG_CMD_LOST 0xc
428 #define BNX2FC_FLAG_SRR_SENT 0xd
483 u16 min_xid,
u16 max_xid);
496 unsigned int timer_msec);
552 u32 frame_len,
u16 l2_oxid);