Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 1 | /* cnic.h: Broadcom CNIC core network driver. |
| 2 | * |
Michael Chan | 1d9cfc4 | 2010-02-24 14:42:09 +0000 | [diff] [blame] | 3 | * Copyright (c) 2006-2010 Broadcom Corporation |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation. |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | |
| 12 | #ifndef CNIC_H |
| 13 | #define CNIC_H |
| 14 | |
Dmitry Kravkov | 523224a | 2010-10-06 03:23:26 +0000 | [diff] [blame] | 15 | #define HC_INDEX_ISCSI_EQ_CONS 6 |
| 16 | |
| 17 | #define HC_INDEX_FCOE_EQ_CONS 3 |
| 18 | |
| 19 | #define HC_SP_INDEX_ETH_ISCSI_CQ_CONS 5 |
| 20 | #define HC_SP_INDEX_ETH_ISCSI_RX_CQ_CONS 1 |
| 21 | |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 22 | #define KWQ_PAGE_CNT 4 |
| 23 | #define KCQ_PAGE_CNT 16 |
| 24 | |
| 25 | #define KWQ_CID 24 |
| 26 | #define KCQ_CID 25 |
| 27 | |
| 28 | /* |
| 29 | * krnlq_context definition |
| 30 | */ |
| 31 | #define L5_KRNLQ_FLAGS 0x00000000 |
| 32 | #define L5_KRNLQ_SIZE 0x00000000 |
| 33 | #define L5_KRNLQ_TYPE 0x00000000 |
| 34 | #define KRNLQ_FLAGS_PG_SZ (0xf<<0) |
| 35 | #define KRNLQ_FLAGS_PG_SZ_256 (0<<0) |
| 36 | #define KRNLQ_FLAGS_PG_SZ_512 (1<<0) |
| 37 | #define KRNLQ_FLAGS_PG_SZ_1K (2<<0) |
| 38 | #define KRNLQ_FLAGS_PG_SZ_2K (3<<0) |
| 39 | #define KRNLQ_FLAGS_PG_SZ_4K (4<<0) |
| 40 | #define KRNLQ_FLAGS_PG_SZ_8K (5<<0) |
| 41 | #define KRNLQ_FLAGS_PG_SZ_16K (6<<0) |
| 42 | #define KRNLQ_FLAGS_PG_SZ_32K (7<<0) |
| 43 | #define KRNLQ_FLAGS_PG_SZ_64K (8<<0) |
| 44 | #define KRNLQ_FLAGS_PG_SZ_128K (9<<0) |
| 45 | #define KRNLQ_FLAGS_PG_SZ_256K (10<<0) |
| 46 | #define KRNLQ_FLAGS_PG_SZ_512K (11<<0) |
| 47 | #define KRNLQ_FLAGS_PG_SZ_1M (12<<0) |
| 48 | #define KRNLQ_FLAGS_PG_SZ_2M (13<<0) |
| 49 | #define KRNLQ_FLAGS_QE_SELF_SEQ (1<<15) |
| 50 | #define KRNLQ_SIZE_TYPE_SIZE ((((0x28 + 0x1f) & ~0x1f) / 0x20) << 16) |
| 51 | #define KRNLQ_TYPE_TYPE (0xf<<28) |
| 52 | #define KRNLQ_TYPE_TYPE_EMPTY (0<<28) |
| 53 | #define KRNLQ_TYPE_TYPE_KRNLQ (6<<28) |
| 54 | |
| 55 | #define L5_KRNLQ_HOST_QIDX 0x00000004 |
| 56 | #define L5_KRNLQ_HOST_FW_QIDX 0x00000008 |
| 57 | #define L5_KRNLQ_NX_QE_SELF_SEQ 0x0000000c |
| 58 | #define L5_KRNLQ_QE_SELF_SEQ_MAX 0x0000000c |
| 59 | #define L5_KRNLQ_NX_QE_HADDR_HI 0x00000010 |
| 60 | #define L5_KRNLQ_NX_QE_HADDR_LO 0x00000014 |
| 61 | #define L5_KRNLQ_PGTBL_PGIDX 0x00000018 |
| 62 | #define L5_KRNLQ_NX_PG_QIDX 0x00000018 |
| 63 | #define L5_KRNLQ_PGTBL_NPAGES 0x0000001c |
| 64 | #define L5_KRNLQ_QIDX_INCR 0x0000001c |
| 65 | #define L5_KRNLQ_PGTBL_HADDR_HI 0x00000020 |
| 66 | #define L5_KRNLQ_PGTBL_HADDR_LO 0x00000024 |
| 67 | |
| 68 | #define BNX2_PG_CTX_MAP 0x1a0034 |
| 69 | #define BNX2_ISCSI_CTX_MAP 0x1a0074 |
| 70 | |
| 71 | struct cnic_redirect_entry { |
| 72 | struct dst_entry *old_dst; |
| 73 | struct dst_entry *new_dst; |
| 74 | }; |
| 75 | |
| 76 | #define MAX_COMPLETED_KCQE 64 |
| 77 | |
| 78 | #define MAX_CNIC_L5_CONTEXT 256 |
| 79 | |
| 80 | #define MAX_CM_SK_TBL_SZ MAX_CNIC_L5_CONTEXT |
| 81 | |
| 82 | #define MAX_ISCSI_TBL_SZ 256 |
| 83 | |
| 84 | #define CNIC_LOCAL_PORT_MIN 60000 |
| 85 | #define CNIC_LOCAL_PORT_MAX 61000 |
| 86 | #define CNIC_LOCAL_PORT_RANGE (CNIC_LOCAL_PORT_MAX - CNIC_LOCAL_PORT_MIN) |
| 87 | |
| 88 | #define KWQE_CNT (BCM_PAGE_SIZE / sizeof(struct kwqe)) |
| 89 | #define KCQE_CNT (BCM_PAGE_SIZE / sizeof(struct kcqe)) |
| 90 | #define MAX_KWQE_CNT (KWQE_CNT - 1) |
| 91 | #define MAX_KCQE_CNT (KCQE_CNT - 1) |
| 92 | |
| 93 | #define MAX_KWQ_IDX ((KWQ_PAGE_CNT * KWQE_CNT) - 1) |
| 94 | #define MAX_KCQ_IDX ((KCQ_PAGE_CNT * KCQE_CNT) - 1) |
| 95 | |
| 96 | #define KWQ_PG(x) (((x) & ~MAX_KWQE_CNT) >> (BCM_PAGE_BITS - 5)) |
| 97 | #define KWQ_IDX(x) ((x) & MAX_KWQE_CNT) |
| 98 | |
| 99 | #define KCQ_PG(x) (((x) & ~MAX_KCQE_CNT) >> (BCM_PAGE_BITS - 5)) |
| 100 | #define KCQ_IDX(x) ((x) & MAX_KCQE_CNT) |
| 101 | |
| 102 | #define BNX2X_NEXT_KCQE(x) (((x) & (MAX_KCQE_CNT - 1)) == \ |
| 103 | (MAX_KCQE_CNT - 1)) ? \ |
| 104 | (x) + 2 : (x) + 1 |
| 105 | |
| 106 | #define BNX2X_KWQ_DATA_PG(cp, x) ((x) / (cp)->kwq_16_data_pp) |
| 107 | #define BNX2X_KWQ_DATA_IDX(cp, x) ((x) % (cp)->kwq_16_data_pp) |
| 108 | #define BNX2X_KWQ_DATA(cp, x) \ |
| 109 | &(cp)->kwq_16_data[BNX2X_KWQ_DATA_PG(cp, x)][BNX2X_KWQ_DATA_IDX(cp, x)] |
| 110 | |
Eddie Wai | a9736c0 | 2010-02-24 14:42:04 +0000 | [diff] [blame] | 111 | #define DEF_IPID_START 0x8000 |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 112 | |
| 113 | #define DEF_KA_TIMEOUT 10000 |
| 114 | #define DEF_KA_INTERVAL 300000 |
| 115 | #define DEF_KA_MAX_PROBE_COUNT 3 |
| 116 | #define DEF_TOS 0 |
| 117 | #define DEF_TTL 0xfe |
| 118 | #define DEF_SND_SEQ_SCALE 0 |
| 119 | #define DEF_RCV_BUF 0xffff |
| 120 | #define DEF_SND_BUF 0xffff |
| 121 | #define DEF_SEED 0 |
| 122 | #define DEF_MAX_RT_TIME 500 |
| 123 | #define DEF_MAX_DA_COUNT 2 |
| 124 | #define DEF_SWS_TIMER 1000 |
| 125 | #define DEF_MAX_CWND 0xffff |
| 126 | |
| 127 | struct cnic_ctx { |
| 128 | u32 cid; |
| 129 | void *ctx; |
| 130 | dma_addr_t mapping; |
| 131 | }; |
| 132 | |
| 133 | #define BNX2_MAX_CID 0x2000 |
| 134 | |
| 135 | struct cnic_dma { |
| 136 | int num_pages; |
| 137 | void **pg_arr; |
| 138 | dma_addr_t *pg_map_arr; |
| 139 | int pgtbl_size; |
| 140 | u32 *pgtbl; |
| 141 | dma_addr_t pgtbl_map; |
| 142 | }; |
| 143 | |
| 144 | struct cnic_id_tbl { |
| 145 | spinlock_t lock; |
| 146 | u32 start; |
| 147 | u32 max; |
| 148 | u32 next; |
| 149 | unsigned long *table; |
| 150 | }; |
| 151 | |
| 152 | #define CNIC_KWQ16_DATA_SIZE 128 |
| 153 | |
| 154 | struct kwqe_16_data { |
| 155 | u8 data[CNIC_KWQ16_DATA_SIZE]; |
| 156 | }; |
| 157 | |
| 158 | struct cnic_iscsi { |
| 159 | struct cnic_dma task_array_info; |
| 160 | struct cnic_dma r2tq_info; |
| 161 | struct cnic_dma hq_info; |
| 162 | }; |
| 163 | |
| 164 | struct cnic_context { |
| 165 | u32 cid; |
| 166 | struct kwqe_16_data *kwqe_data; |
| 167 | dma_addr_t kwqe_data_mapping; |
| 168 | wait_queue_head_t waitq; |
| 169 | int wait_cond; |
| 170 | unsigned long timestamp; |
Michael Chan | 6e0dda0 | 2010-10-13 14:06:45 +0000 | [diff] [blame] | 171 | unsigned long ctx_flags; |
| 172 | #define CTX_FL_OFFLD_START 0 |
Michael Chan | fdf2408 | 2010-10-13 14:06:47 +0000 | [diff] [blame] | 173 | #define CTX_FL_DELETE_WAIT 1 |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 174 | u8 ulp_proto_id; |
| 175 | union { |
| 176 | struct cnic_iscsi *iscsi; |
| 177 | } proto; |
| 178 | }; |
| 179 | |
Michael Chan | e6c2889 | 2010-06-24 14:58:39 +0000 | [diff] [blame] | 180 | struct kcq_info { |
| 181 | struct cnic_dma dma; |
| 182 | struct kcqe **kcq; |
| 183 | |
| 184 | u16 *hw_prod_idx_ptr; |
| 185 | u16 sw_prod_idx; |
| 186 | u16 *status_idx_ptr; |
| 187 | u32 io_addr; |
| 188 | }; |
| 189 | |
Dmitry Kravkov | 523224a | 2010-10-06 03:23:26 +0000 | [diff] [blame] | 190 | struct iro { |
| 191 | u32 base; |
| 192 | u16 m1; |
| 193 | u16 m2; |
| 194 | u16 m3; |
| 195 | u16 size; |
| 196 | }; |
| 197 | |
Michael Chan | cd80153 | 2010-10-13 14:06:49 +0000 | [diff] [blame^] | 198 | struct cnic_uio_dev { |
| 199 | struct uio_info cnic_uinfo; |
| 200 | u32 uio_dev; |
| 201 | |
| 202 | int l2_ring_size; |
| 203 | void *l2_ring; |
| 204 | dma_addr_t l2_ring_map; |
| 205 | |
| 206 | int l2_buf_size; |
| 207 | void *l2_buf; |
| 208 | dma_addr_t l2_buf_map; |
| 209 | |
| 210 | struct cnic_dev *dev; |
| 211 | struct pci_dev *pdev; |
| 212 | struct list_head list; |
| 213 | }; |
| 214 | |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 215 | struct cnic_local { |
| 216 | |
| 217 | spinlock_t cnic_ulp_lock; |
| 218 | void *ulp_handle[MAX_CNIC_ULP_TYPE]; |
| 219 | unsigned long ulp_flags[MAX_CNIC_ULP_TYPE]; |
| 220 | #define ULP_F_INIT 0 |
| 221 | #define ULP_F_START 1 |
Michael Chan | 681dbd7 | 2009-08-14 15:49:46 +0000 | [diff] [blame] | 222 | #define ULP_F_CALL_PENDING 2 |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 223 | struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; |
| 224 | |
Michael Chan | 1f1332a | 2010-05-18 11:32:52 +0000 | [diff] [blame] | 225 | unsigned long cnic_local_flags; |
| 226 | #define CNIC_LCL_FL_KWQ_INIT 0x0 |
Michael Chan | 48f753d | 2010-05-18 11:32:53 +0000 | [diff] [blame] | 227 | #define CNIC_LCL_FL_L2_WAIT 0x1 |
Michael Chan | 541a781 | 2010-10-06 03:17:22 +0000 | [diff] [blame] | 228 | #define CNIC_LCL_FL_RINGS_INITED 0x2 |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 229 | |
| 230 | struct cnic_dev *dev; |
| 231 | |
| 232 | struct cnic_eth_dev *ethdev; |
| 233 | |
Michael Chan | cd80153 | 2010-10-13 14:06:49 +0000 | [diff] [blame^] | 234 | struct cnic_uio_dev *udev; |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 235 | |
Michael Chan | cd80153 | 2010-10-13 14:06:49 +0000 | [diff] [blame^] | 236 | int l2_rx_ring_size; |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 237 | int l2_single_buf_size; |
| 238 | |
| 239 | u16 *rx_cons_ptr; |
| 240 | u16 *tx_cons_ptr; |
| 241 | u16 rx_cons; |
| 242 | u16 tx_cons; |
| 243 | |
Dmitry Kravkov | 523224a | 2010-10-06 03:23:26 +0000 | [diff] [blame] | 244 | struct iro *iro_arr; |
| 245 | #define IRO (((struct cnic_local *) dev->cnic_priv)->iro_arr) |
| 246 | |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 247 | struct cnic_dma kwq_info; |
| 248 | struct kwqe **kwq; |
| 249 | |
| 250 | struct cnic_dma kwq_16_data_info; |
| 251 | |
| 252 | u16 max_kwq_idx; |
| 253 | |
| 254 | u16 kwq_prod_idx; |
| 255 | u32 kwq_io_addr; |
| 256 | |
| 257 | u16 *kwq_con_idx_ptr; |
| 258 | u16 kwq_con_idx; |
| 259 | |
Michael Chan | e6c2889 | 2010-06-24 14:58:39 +0000 | [diff] [blame] | 260 | struct kcq_info kcq1; |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 261 | |
Michael Chan | a4dde3a | 2010-02-24 14:42:08 +0000 | [diff] [blame] | 262 | union { |
| 263 | void *gen; |
| 264 | struct status_block_msix *bnx2; |
Dmitry Kravkov | 523224a | 2010-10-06 03:23:26 +0000 | [diff] [blame] | 265 | struct host_hc_status_block_e1x *bnx2x_e1x; |
| 266 | /* index values - which counter to update */ |
| 267 | #define SM_RX_ID 0 |
| 268 | #define SM_TX_ID 1 |
Michael Chan | a4dde3a | 2010-02-24 14:42:08 +0000 | [diff] [blame] | 269 | } status_blk; |
| 270 | |
Dmitry Kravkov | 523224a | 2010-10-06 03:23:26 +0000 | [diff] [blame] | 271 | struct host_sp_status_block *bnx2x_def_status_blk; |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 272 | |
| 273 | u32 status_blk_num; |
Dmitry Kravkov | 523224a | 2010-10-06 03:23:26 +0000 | [diff] [blame] | 274 | u32 bnx2x_igu_sb_id; |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 275 | u32 int_num; |
| 276 | u32 last_status_idx; |
| 277 | struct tasklet_struct cnic_irq_task; |
| 278 | |
| 279 | struct kcqe *completed_kcq[MAX_COMPLETED_KCQE]; |
| 280 | |
| 281 | struct cnic_sock *csk_tbl; |
| 282 | struct cnic_id_tbl csk_port_tbl; |
| 283 | |
| 284 | struct cnic_dma conn_buf_info; |
| 285 | struct cnic_dma gbl_buf_info; |
| 286 | |
| 287 | struct cnic_iscsi *iscsi_tbl; |
| 288 | struct cnic_context *ctx_tbl; |
| 289 | struct cnic_id_tbl cid_tbl; |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 290 | atomic_t iscsi_conn; |
Michael Chan | 520efdf | 2010-06-24 14:58:37 +0000 | [diff] [blame] | 291 | u32 iscsi_start_cid; |
| 292 | |
| 293 | u32 max_cid_space; |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 294 | |
| 295 | /* per connection parameters */ |
| 296 | int num_iscsi_tasks; |
| 297 | int num_ccells; |
| 298 | int task_array_size; |
| 299 | int r2tq_size; |
| 300 | int hq_size; |
| 301 | int num_cqs; |
| 302 | |
Michael Chan | fdf2408 | 2010-10-13 14:06:47 +0000 | [diff] [blame] | 303 | struct delayed_work delete_task; |
| 304 | |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 305 | struct cnic_ctx *ctx_arr; |
| 306 | int ctx_blks; |
| 307 | int ctx_blk_size; |
Michael Chan | e251306 | 2009-10-10 13:46:58 +0000 | [diff] [blame] | 308 | unsigned long ctx_align; |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 309 | int cids_per_blk; |
| 310 | |
| 311 | u32 chip_id; |
| 312 | int func; |
Michael Chan | 1420398 | 2010-10-06 03:16:06 +0000 | [diff] [blame] | 313 | u32 pfid; |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 314 | u32 shmem_base; |
| 315 | |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 316 | struct cnic_ops *cnic_ops; |
| 317 | int (*start_hw)(struct cnic_dev *); |
| 318 | void (*stop_hw)(struct cnic_dev *); |
| 319 | void (*setup_pgtbl)(struct cnic_dev *, |
| 320 | struct cnic_dma *); |
| 321 | int (*alloc_resc)(struct cnic_dev *); |
| 322 | void (*free_resc)(struct cnic_dev *); |
| 323 | int (*start_cm)(struct cnic_dev *); |
| 324 | void (*stop_cm)(struct cnic_dev *); |
| 325 | void (*enable_int)(struct cnic_dev *); |
| 326 | void (*disable_int_sync)(struct cnic_dev *); |
| 327 | void (*ack_int)(struct cnic_dev *); |
| 328 | void (*close_conn)(struct cnic_sock *, u32 opcode); |
| 329 | u16 (*next_idx)(u16); |
| 330 | u16 (*hw_idx)(u16); |
| 331 | }; |
| 332 | |
| 333 | struct bnx2x_bd_chain_next { |
| 334 | u32 addr_lo; |
| 335 | u32 addr_hi; |
| 336 | u8 reserved[8]; |
| 337 | }; |
| 338 | |
Michael Chan | e251306 | 2009-10-10 13:46:58 +0000 | [diff] [blame] | 339 | #define ISCSI_DEFAULT_MAX_OUTSTANDING_R2T (1) |
| 340 | |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 341 | #define ISCSI_RAMROD_CMD_ID_UPDATE_CONN (ISCSI_KCQE_OPCODE_UPDATE_CONN) |
| 342 | #define ISCSI_RAMROD_CMD_ID_INIT (ISCSI_KCQE_OPCODE_INIT) |
| 343 | |
| 344 | #define CDU_REGION_NUMBER_XCM_AG 2 |
| 345 | #define CDU_REGION_NUMBER_UCM_AG 4 |
| 346 | |
Michael Chan | e251306 | 2009-10-10 13:46:58 +0000 | [diff] [blame] | 347 | #define CDU_VALID_DATA(_cid, _region, _type) \ |
| 348 | (((_cid) << 8) | (((_region)&0xf)<<4) | (((_type)&0xf))) |
| 349 | |
| 350 | #define CDU_CRC8(_cid, _region, _type) \ |
| 351 | (calc_crc8(CDU_VALID_DATA(_cid, _region, _type), 0xff)) |
| 352 | |
| 353 | #define CDU_RSRVD_VALUE_TYPE_A(_cid, _region, _type) \ |
| 354 | (0x80 | ((CDU_CRC8(_cid, _region, _type)) & 0x7f)) |
| 355 | |
| 356 | #define BNX2X_CONTEXT_MEM_SIZE 1024 |
| 357 | #define BNX2X_FCOE_CID 16 |
| 358 | |
| 359 | /* iSCSI client IDs are 17, 19, 21, 23 */ |
| 360 | #define BNX2X_ISCSI_BASE_CL_ID 17 |
| 361 | #define BNX2X_ISCSI_CL_ID(vn) (BNX2X_ISCSI_BASE_CL_ID + ((vn) << 1)) |
| 362 | |
| 363 | #define BNX2X_ISCSI_L2_CID 17 |
| 364 | #define BNX2X_ISCSI_START_CID 18 |
| 365 | #define BNX2X_ISCSI_NUM_CONNECTIONS 128 |
| 366 | #define BNX2X_ISCSI_TASK_CONTEXT_SIZE 128 |
| 367 | #define BNX2X_ISCSI_MAX_PENDING_R2TS 4 |
| 368 | #define BNX2X_ISCSI_R2TQE_SIZE 8 |
| 369 | #define BNX2X_ISCSI_HQ_BD_SIZE 64 |
| 370 | #define BNX2X_ISCSI_CONN_BUF_SIZE 64 |
| 371 | #define BNX2X_ISCSI_GLB_BUF_SIZE 64 |
| 372 | #define BNX2X_ISCSI_PBL_NOT_CACHED 0xff |
| 373 | #define BNX2X_ISCSI_PDU_HEADER_NOT_CACHED 0xff |
Michael Chan | ceb7e1c | 2010-10-06 03:14:54 +0000 | [diff] [blame] | 374 | |
Michael Chan | e251306 | 2009-10-10 13:46:58 +0000 | [diff] [blame] | 375 | #define BNX2X_CHIP_NUM_57711 0x164f |
| 376 | #define BNX2X_CHIP_NUM_57711E 0x1650 |
| 377 | #define BNX2X_CHIP_NUM(x) (x >> 16) |
| 378 | #define BNX2X_CHIP_IS_57711(x) \ |
| 379 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57711) |
| 380 | #define BNX2X_CHIP_IS_57711E(x) \ |
| 381 | (BNX2X_CHIP_NUM(x) == BNX2X_CHIP_NUM_57711E) |
| 382 | #define BNX2X_CHIP_IS_E1H(x) \ |
| 383 | (BNX2X_CHIP_IS_57711(x) || BNX2X_CHIP_IS_57711E(x)) |
| 384 | #define IS_E1H_OFFSET BNX2X_CHIP_IS_E1H(cp->chip_id) |
| 385 | |
| 386 | #define BNX2X_RX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_bd)) |
| 387 | #define BNX2X_MAX_RX_DESC_CNT (BNX2X_RX_DESC_CNT - 2) |
| 388 | #define BNX2X_RCQ_DESC_CNT (BCM_PAGE_SIZE / sizeof(union eth_rx_cqe)) |
| 389 | #define BNX2X_MAX_RCQ_DESC_CNT (BNX2X_RCQ_DESC_CNT - 1) |
| 390 | |
Michael Chan | 48f753d | 2010-05-18 11:32:53 +0000 | [diff] [blame] | 391 | #define BNX2X_NEXT_RCQE(x) (((x) & BNX2X_MAX_RCQ_DESC_CNT) == \ |
| 392 | (BNX2X_MAX_RCQ_DESC_CNT - 1)) ? \ |
| 393 | ((x) + 2) : ((x) + 1) |
| 394 | |
Dmitry Kravkov | 523224a | 2010-10-06 03:23:26 +0000 | [diff] [blame] | 395 | #define BNX2X_DEF_SB_ID HC_SP_SB_ID |
Michael Chan | e251306 | 2009-10-10 13:46:58 +0000 | [diff] [blame] | 396 | |
Dmitry Kravkov | 523224a | 2010-10-06 03:23:26 +0000 | [diff] [blame] | 397 | #define BNX2X_SHMEM_MF_BLK_OFFSET 0x7e4 |
Michael Chan | e251306 | 2009-10-10 13:46:58 +0000 | [diff] [blame] | 398 | |
| 399 | #define BNX2X_SHMEM_ADDR(base, field) (base + \ |
| 400 | offsetof(struct shmem_region, field)) |
| 401 | |
Dmitry Kravkov | 523224a | 2010-10-06 03:23:26 +0000 | [diff] [blame] | 402 | #define BNX2X_SHMEM2_ADDR(base, field) (base + \ |
| 403 | offsetof(struct shmem2_region, field)) |
Michael Chan | e251306 | 2009-10-10 13:46:58 +0000 | [diff] [blame] | 404 | |
Dmitry Kravkov | 523224a | 2010-10-06 03:23:26 +0000 | [diff] [blame] | 405 | #define BNX2X_SHMEM2_HAS(base, field) \ |
| 406 | ((base) && \ |
| 407 | (CNIC_RD(dev, BNX2X_SHMEM2_ADDR(base, size)) > \ |
| 408 | offsetof(struct shmem2_region, field))) |
| 409 | |
| 410 | #define CNIC_PORT(cp) ((cp)->pfid & 1) |
| 411 | #define CNIC_FUNC(cp) ((cp)->func) |
| 412 | #define CNIC_E1HVN(cp) ((cp)->pfid >> 1) |
| 413 | |
| 414 | #define BNX2X_HW_CID(cp, x) ((CNIC_PORT(cp) << 23) | \ |
Michael Chan | ceb7e1c | 2010-10-06 03:14:54 +0000 | [diff] [blame] | 415 | (CNIC_E1HVN(cp) << 17) | (x)) |
| 416 | |
| 417 | #define BNX2X_SW_CID(x) (x & 0x1ffff) |
| 418 | |
Dmitry Kravkov | 523224a | 2010-10-06 03:23:26 +0000 | [diff] [blame] | 419 | #define BNX2X_CL_QZONE_ID(cp, cli) \ |
| 420 | (cli + (CNIC_PORT(cp) * ETH_MAX_RX_CLIENTS_E1H)) |
| 421 | |
| 422 | #define TCP_TSTORM_OOO_DROP_AND_PROC_ACK (0<<4) |
Michael Chan | a463696 | 2009-06-08 18:14:43 -0700 | [diff] [blame] | 423 | #endif |
| 424 | |