bnx2fc.h (aa7eb8e78d8ecd6cd0475d86ea8385ff9cb47ece) | bnx2fc.h (aea71a024914e8b5b8bed31256dae42195a0a207) |
---|---|
1#ifndef _BNX2FC_H_ 2#define _BNX2FC_H_ 3/* bnx2fc.h: Broadcom NetXtreme II Linux FCoE offload driver. 4 * 5 * Copyright (c) 2008 - 2010 Broadcom Corporation 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 48 unchanged lines hidden (view full) --- 57#include <scsi/fc/fc_fcp.h> 58 59#include "57xx_hsi_bnx2fc.h" 60#include "bnx2fc_debug.h" 61#include "../../net/cnic_if.h" 62#include "bnx2fc_constants.h" 63 64#define BNX2FC_NAME "bnx2fc" | 1#ifndef _BNX2FC_H_ 2#define _BNX2FC_H_ 3/* bnx2fc.h: Broadcom NetXtreme II Linux FCoE offload driver. 4 * 5 * Copyright (c) 2008 - 2010 Broadcom Corporation 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 48 unchanged lines hidden (view full) --- 57#include <scsi/fc/fc_fcp.h> 58 59#include "57xx_hsi_bnx2fc.h" 60#include "bnx2fc_debug.h" 61#include "../../net/cnic_if.h" 62#include "bnx2fc_constants.h" 63 64#define BNX2FC_NAME "bnx2fc" |
65#define BNX2FC_VERSION "1.0.1" | 65#define BNX2FC_VERSION "1.0.3" |
66 67#define PFX "bnx2fc: " 68 69#define BNX2X_DOORBELL_PCI_BAR 2 70 71#define BNX2FC_MAX_BD_LEN 0xffff 72#define BNX2FC_BD_SPLIT_SZ 0x8000 73#define BNX2FC_MAX_BDS_PER_CMD 256 --- 73 unchanged lines hidden (view full) --- 147extern struct workqueue_struct *bnx2fc_wq; 148 149struct bnx2fc_percpu_s { 150 struct task_struct *iothread; 151 struct list_head work_list; 152 spinlock_t fp_work_lock; 153}; 154 | 66 67#define PFX "bnx2fc: " 68 69#define BNX2X_DOORBELL_PCI_BAR 2 70 71#define BNX2FC_MAX_BD_LEN 0xffff 72#define BNX2FC_BD_SPLIT_SZ 0x8000 73#define BNX2FC_MAX_BDS_PER_CMD 256 --- 73 unchanged lines hidden (view full) --- 147extern struct workqueue_struct *bnx2fc_wq; 148 149struct bnx2fc_percpu_s { 150 struct task_struct *iothread; 151 struct list_head work_list; 152 spinlock_t fp_work_lock; 153}; 154 |
155 | |
156struct bnx2fc_hba { | 155struct bnx2fc_hba { |
157 struct list_head link; | 156 struct list_head list; |
158 struct cnic_dev *cnic; 159 struct pci_dev *pcidev; | 157 struct cnic_dev *cnic; 158 struct pci_dev *pcidev; |
160 struct net_device *netdev; | |
161 struct net_device *phys_dev; 162 unsigned long reg_with_cnic; 163 #define BNX2FC_CNIC_REGISTERED 1 | 159 struct net_device *phys_dev; 160 unsigned long reg_with_cnic; 161 #define BNX2FC_CNIC_REGISTERED 1 |
164 struct packet_type fcoe_packet_type; 165 struct packet_type fip_packet_type; | |
166 struct bnx2fc_cmd_mgr *cmd_mgr; | 162 struct bnx2fc_cmd_mgr *cmd_mgr; |
167 struct workqueue_struct *timer_work_queue; 168 struct kref kref; | |
169 spinlock_t hba_lock; 170 struct mutex hba_mutex; 171 unsigned long adapter_state; 172 #define ADAPTER_STATE_UP 0 173 #define ADAPTER_STATE_GOING_DOWN 1 174 #define ADAPTER_STATE_LINK_DOWN 2 175 #define ADAPTER_STATE_READY 3 | 163 spinlock_t hba_lock; 164 struct mutex hba_mutex; 165 unsigned long adapter_state; 166 #define ADAPTER_STATE_UP 0 167 #define ADAPTER_STATE_GOING_DOWN 1 168 #define ADAPTER_STATE_LINK_DOWN 2 169 #define ADAPTER_STATE_READY 3 |
176 u32 flags; 177 unsigned long init_done; 178 #define BNX2FC_FW_INIT_DONE 0 179 #define BNX2FC_CTLR_INIT_DONE 1 180 #define BNX2FC_CREATE_DONE 2 181 struct fcoe_ctlr ctlr; 182 u8 vlan_enabled; 183 int vlan_id; | 170 unsigned long flags; 171 #define BNX2FC_FLAG_FW_INIT_DONE 0 172 #define BNX2FC_FLAG_DESTROY_CMPL 1 |
184 u32 next_conn_id; 185 struct fcoe_task_ctx_entry **task_ctx; 186 dma_addr_t *task_ctx_dma; 187 struct regpair *task_ctx_bd_tbl; 188 dma_addr_t task_ctx_bd_dma; 189 190 int hash_tbl_segment_count; 191 void **hash_tbl_segments; 192 void *hash_tbl_pbl; 193 dma_addr_t hash_tbl_pbl_dma; 194 struct fcoe_t2_hash_table_entry *t2_hash_tbl; 195 dma_addr_t t2_hash_tbl_dma; 196 char *t2_hash_tbl_ptr; 197 dma_addr_t t2_hash_tbl_ptr_dma; 198 199 char *dummy_buffer; 200 dma_addr_t dummy_buf_dma; 201 | 173 u32 next_conn_id; 174 struct fcoe_task_ctx_entry **task_ctx; 175 dma_addr_t *task_ctx_dma; 176 struct regpair *task_ctx_bd_tbl; 177 dma_addr_t task_ctx_bd_dma; 178 179 int hash_tbl_segment_count; 180 void **hash_tbl_segments; 181 void *hash_tbl_pbl; 182 dma_addr_t hash_tbl_pbl_dma; 183 struct fcoe_t2_hash_table_entry *t2_hash_tbl; 184 dma_addr_t t2_hash_tbl_dma; 185 char *t2_hash_tbl_ptr; 186 dma_addr_t t2_hash_tbl_ptr_dma; 187 188 char *dummy_buffer; 189 dma_addr_t dummy_buf_dma; 190 |
191 /* Active list of offloaded sessions */ 192 struct bnx2fc_rport **tgt_ofld_list; 193 194 /* statistics */ |
|
202 struct fcoe_statistics_params *stats_buffer; 203 dma_addr_t stats_buf_dma; | 195 struct fcoe_statistics_params *stats_buffer; 196 dma_addr_t stats_buf_dma; |
197 struct completion stat_req_done; |
|
204 | 198 |
205 /* 206 * PCI related info. 207 */ 208 u16 pci_did; 209 u16 pci_vid; 210 u16 pci_sdid; 211 u16 pci_svid; 212 u16 pci_func; 213 u16 pci_devno; 214 215 struct task_struct *l2_thread; 216 217 /* linkdown handling */ 218 wait_queue_head_t shutdown_wait; 219 int wait_for_link_down; 220 | |
221 /*destroy handling */ 222 struct timer_list destroy_timer; 223 wait_queue_head_t destroy_wait; 224 | 199 /*destroy handling */ 200 struct timer_list destroy_timer; 201 wait_queue_head_t destroy_wait; 202 |
225 /* Active list of offloaded sessions */ 226 struct bnx2fc_rport *tgt_ofld_list[BNX2FC_NUM_MAX_SESS]; | 203 /* linkdown handling */ 204 wait_queue_head_t shutdown_wait; 205 int wait_for_link_down; |
227 int num_ofld_sess; | 206 int num_ofld_sess; |
207 struct list_head vports; 208}; |
|
228 | 209 |
229 /* statistics */ 230 struct completion stat_req_done; | 210struct bnx2fc_interface { 211 struct list_head list; 212 unsigned long if_flags; 213 #define BNX2FC_CTLR_INIT_DONE 0 214 struct bnx2fc_hba *hba; 215 struct net_device *netdev; 216 struct packet_type fcoe_packet_type; 217 struct packet_type fip_packet_type; 218 struct workqueue_struct *timer_work_queue; 219 struct kref kref; 220 struct fcoe_ctlr ctlr; 221 u8 vlan_enabled; 222 int vlan_id; |
231}; 232 | 223}; 224 |
233#define bnx2fc_from_ctlr(fip) container_of(fip, struct bnx2fc_hba, ctlr) | 225#define bnx2fc_from_ctlr(fip) container_of(fip, struct bnx2fc_interface, ctlr) |
234 | 226 |
227struct bnx2fc_lport { 228 struct list_head list; 229 struct fc_lport *lport; 230}; 231 |
|
235struct bnx2fc_cmd_mgr { 236 struct bnx2fc_hba *hba; 237 u16 next_idx; 238 struct list_head *free_list; 239 spinlock_t *free_list_lock; 240 struct io_bdt **io_bdt_pool; 241 struct bnx2fc_cmd **cmds; 242}; --- 9 unchanged lines hidden (view full) --- 252 u32 sid; 253 254 unsigned long flags; 255#define BNX2FC_FLAG_SESSION_READY 0x1 256#define BNX2FC_FLAG_OFFLOADED 0x2 257#define BNX2FC_FLAG_DISABLED 0x3 258#define BNX2FC_FLAG_DESTROYED 0x4 259#define BNX2FC_FLAG_OFLD_REQ_CMPL 0x5 | 232struct bnx2fc_cmd_mgr { 233 struct bnx2fc_hba *hba; 234 u16 next_idx; 235 struct list_head *free_list; 236 spinlock_t *free_list_lock; 237 struct io_bdt **io_bdt_pool; 238 struct bnx2fc_cmd **cmds; 239}; --- 9 unchanged lines hidden (view full) --- 249 u32 sid; 250 251 unsigned long flags; 252#define BNX2FC_FLAG_SESSION_READY 0x1 253#define BNX2FC_FLAG_OFFLOADED 0x2 254#define BNX2FC_FLAG_DISABLED 0x3 255#define BNX2FC_FLAG_DESTROYED 0x4 256#define BNX2FC_FLAG_OFLD_REQ_CMPL 0x5 |
260#define BNX2FC_FLAG_DESTROY_CMPL 0x6 261#define BNX2FC_FLAG_CTX_ALLOC_FAILURE 0x7 262#define BNX2FC_FLAG_UPLD_REQ_COMPL 0x8 263#define BNX2FC_FLAG_EXPL_LOGO 0x9 | 257#define BNX2FC_FLAG_CTX_ALLOC_FAILURE 0x6 258#define BNX2FC_FLAG_UPLD_REQ_COMPL 0x7 259#define BNX2FC_FLAG_EXPL_LOGO 0x8 |
264 | 260 |
261 u8 src_addr[ETH_ALEN]; |
|
265 u32 max_sqes; 266 u32 max_rqes; 267 u32 max_cqes; | 262 u32 max_sqes; 263 u32 max_rqes; 264 u32 max_cqes; |
265 atomic_t free_sqes; |
|
268 | 266 |
267 struct b577xx_doorbell_set_prod sq_db; 268 struct b577xx_fcoe_rx_doorbell rx_db; 269 |
|
269 struct fcoe_sqe *sq; 270 dma_addr_t sq_dma; 271 u16 sq_prod_idx; 272 u8 sq_curr_toggle_bit; 273 u32 sq_mem_size; 274 275 struct fcoe_cqe *cq; 276 dma_addr_t cq_dma; | 270 struct fcoe_sqe *sq; 271 dma_addr_t sq_dma; 272 u16 sq_prod_idx; 273 u8 sq_curr_toggle_bit; 274 u32 sq_mem_size; 275 276 struct fcoe_cqe *cq; 277 dma_addr_t cq_dma; |
277 u32 cq_cons_idx; | 278 u16 cq_cons_idx; |
278 u8 cq_curr_toggle_bit; 279 u32 cq_mem_size; 280 281 void *rq; 282 dma_addr_t rq_dma; 283 u32 rq_prod_idx; 284 u32 rq_cons_idx; 285 u32 rq_mem_size; --- 26 unchanged lines hidden (view full) --- 312 dma_addr_t ofld_req_dma[4]; 313 void *enbl_req; 314 dma_addr_t enbl_req_dma; 315 316 spinlock_t tgt_lock; 317 spinlock_t cq_lock; 318 atomic_t num_active_ios; 319 u32 flush_in_prog; | 279 u8 cq_curr_toggle_bit; 280 u32 cq_mem_size; 281 282 void *rq; 283 dma_addr_t rq_dma; 284 u32 rq_prod_idx; 285 u32 rq_cons_idx; 286 u32 rq_mem_size; --- 26 unchanged lines hidden (view full) --- 313 dma_addr_t ofld_req_dma[4]; 314 void *enbl_req; 315 dma_addr_t enbl_req_dma; 316 317 spinlock_t tgt_lock; 318 spinlock_t cq_lock; 319 atomic_t num_active_ios; 320 u32 flush_in_prog; |
320 unsigned long work_time_slice; | |
321 unsigned long timestamp; 322 struct list_head free_task_list; 323 struct bnx2fc_cmd *pending_queue[BNX2FC_SQ_WQES_MAX+1]; | 321 unsigned long timestamp; 322 struct list_head free_task_list; 323 struct bnx2fc_cmd *pending_queue[BNX2FC_SQ_WQES_MAX+1]; |
324 atomic_t pi; 325 atomic_t ci; | |
326 struct list_head active_cmd_queue; 327 struct list_head els_queue; 328 struct list_head io_retire_queue; 329 struct list_head active_tm_queue; 330 331 struct timer_list ofld_timer; 332 wait_queue_head_t ofld_wait; 333 --- 84 unchanged lines hidden (view full) --- 418struct bnx2fc_work { 419 struct list_head list; 420 struct bnx2fc_rport *tgt; 421 u16 wqe; 422}; 423struct bnx2fc_unsol_els { 424 struct fc_lport *lport; 425 struct fc_frame *fp; | 324 struct list_head active_cmd_queue; 325 struct list_head els_queue; 326 struct list_head io_retire_queue; 327 struct list_head active_tm_queue; 328 329 struct timer_list ofld_timer; 330 wait_queue_head_t ofld_wait; 331 --- 84 unchanged lines hidden (view full) --- 416struct bnx2fc_work { 417 struct list_head list; 418 struct bnx2fc_rport *tgt; 419 u16 wqe; 420}; 421struct bnx2fc_unsol_els { 422 struct fc_lport *lport; 423 struct fc_frame *fp; |
424 struct bnx2fc_hba *hba; |
|
426 struct work_struct unsol_els_work; 427}; 428 429 430 431struct bnx2fc_cmd *bnx2fc_elstm_alloc(struct bnx2fc_rport *tgt, int type); 432void bnx2fc_cmd_release(struct kref *ref); 433int bnx2fc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd); --- 66 unchanged lines hidden (view full) --- 500 501void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt); 502struct fc_seq *bnx2fc_elsct_send(struct fc_lport *lport, u32 did, 503 struct fc_frame *fp, unsigned int op, 504 void (*resp)(struct fc_seq *, 505 struct fc_frame *, 506 void *), 507 void *arg, u32 timeout); | 425 struct work_struct unsol_els_work; 426}; 427 428 429 430struct bnx2fc_cmd *bnx2fc_elstm_alloc(struct bnx2fc_rport *tgt, int type); 431void bnx2fc_cmd_release(struct kref *ref); 432int bnx2fc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd); --- 66 unchanged lines hidden (view full) --- 499 500void bnx2fc_flush_active_ios(struct bnx2fc_rport *tgt); 501struct fc_seq *bnx2fc_elsct_send(struct fc_lport *lport, u32 did, 502 struct fc_frame *fp, unsigned int op, 503 void (*resp)(struct fc_seq *, 504 struct fc_frame *, 505 void *), 506 void *arg, u32 timeout); |
507void bnx2fc_arm_cq(struct bnx2fc_rport *tgt); |
|
508int bnx2fc_process_new_cqes(struct bnx2fc_rport *tgt); 509void bnx2fc_process_cq_compl(struct bnx2fc_rport *tgt, u16 wqe); 510struct bnx2fc_rport *bnx2fc_tgt_lookup(struct fcoe_port *port, 511 u32 port_id); 512void bnx2fc_process_l2_frame_compl(struct bnx2fc_rport *tgt, 513 unsigned char *buf, 514 u32 frame_len, u16 l2_oxid); 515int bnx2fc_send_stat_req(struct bnx2fc_hba *hba); 516 517#endif | 508int bnx2fc_process_new_cqes(struct bnx2fc_rport *tgt); 509void bnx2fc_process_cq_compl(struct bnx2fc_rport *tgt, u16 wqe); 510struct bnx2fc_rport *bnx2fc_tgt_lookup(struct fcoe_port *port, 511 u32 port_id); 512void bnx2fc_process_l2_frame_compl(struct bnx2fc_rport *tgt, 513 unsigned char *buf, 514 u32 frame_len, u16 l2_oxid); 515int bnx2fc_send_stat_req(struct bnx2fc_hba *hba); 516 517#endif |