bnx2i.h (9a64e8e0ace51b309fdcff4b4754b3649250382a) bnx2i.h (2e499d3cc13365a87815266dda59904dcb8c8d6c)
1/* bnx2i.h: Broadcom NetXtreme II iSCSI driver.
2 *
3 * Copyright (c) 2006 - 2012 Broadcom Corporation
4 * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved.
5 * Copyright (c) 2007, 2008 Mike Christie
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

--- 30 unchanged lines hidden (view full) ---

39#include <scsi/iscsi_proto.h>
40#include <scsi/libiscsi.h>
41#include <scsi/scsi_transport_iscsi.h>
42
43#include "../../net/ethernet/broadcom/cnic_if.h"
44#include "57xx_iscsi_hsi.h"
45#include "57xx_iscsi_constants.h"
46
1/* bnx2i.h: Broadcom NetXtreme II iSCSI driver.
2 *
3 * Copyright (c) 2006 - 2012 Broadcom Corporation
4 * Copyright (c) 2007, 2008 Red Hat, Inc. All rights reserved.
5 * Copyright (c) 2007, 2008 Mike Christie
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

--- 30 unchanged lines hidden (view full) ---

39#include <scsi/iscsi_proto.h>
40#include <scsi/libiscsi.h>
41#include <scsi/scsi_transport_iscsi.h>
42
43#include "../../net/ethernet/broadcom/cnic_if.h"
44#include "57xx_iscsi_hsi.h"
45#include "57xx_iscsi_constants.h"
46
47#include "../../net/ethernet/broadcom/bnx2x/bnx2x_mfw_req.h"
48
47#define BNX2_ISCSI_DRIVER_NAME "bnx2i"
48
49#define BNX2I_MAX_ADAPTERS 8
50
51#define ISCSI_MAX_CONNS_PER_HBA 128
52#define ISCSI_MAX_SESS_PER_HBA ISCSI_MAX_CONNS_PER_HBA
53#define ISCSI_MAX_CMDS_PER_SESS 128
54

--- 66 unchanged lines hidden (view full) ---

121#define CNIC_ARM_CQE_FP 2
122#define CNIC_DISARM_CQE 0
123
124#define REG_RD(__hba, offset) \
125 readl(__hba->regview + offset)
126#define REG_WR(__hba, offset, val) \
127 writel(val, __hba->regview + offset)
128
49#define BNX2_ISCSI_DRIVER_NAME "bnx2i"
50
51#define BNX2I_MAX_ADAPTERS 8
52
53#define ISCSI_MAX_CONNS_PER_HBA 128
54#define ISCSI_MAX_SESS_PER_HBA ISCSI_MAX_CONNS_PER_HBA
55#define ISCSI_MAX_CMDS_PER_SESS 128
56

--- 66 unchanged lines hidden (view full) ---

123#define CNIC_ARM_CQE_FP 2
124#define CNIC_DISARM_CQE 0
125
126#define REG_RD(__hba, offset) \
127 readl(__hba->regview + offset)
128#define REG_WR(__hba, offset, val) \
129 writel(val, __hba->regview + offset)
130
131#ifdef CONFIG_32BIT
132#define GET_STATS_64(__hba, dst, field) \
133 do { \
134 spin_lock_bh(&__hba->stat_lock); \
135 dst->field##_lo = __hba->stats.field##_lo; \
136 dst->field##_hi = __hba->stats.field##_hi; \
137 spin_unlock_bh(&__hba->stat_lock); \
138 } while (0)
129
139
140#define ADD_STATS_64(__hba, field, len) \
141 do { \
142 if (spin_trylock(&__hba->stat_lock)) { \
143 if (__hba->stats.field##_lo + len < \
144 __hba->stats.field##_lo) \
145 __hba->stats.field##_hi++; \
146 __hba->stats.field##_lo += len; \
147 spin_unlock(&__hba->stat_lock); \
148 } \
149 } while (0)
150
151#else
152#define GET_STATS_64(__hba, dst, field) \
153 do { \
154 u64 val, *out; \
155 \
156 val = __hba->bnx2i_stats.field; \
157 out = (u64 *)&__hba->stats.field##_lo; \
158 *out = cpu_to_le64(val); \
159 out = (u64 *)&dst->field##_lo; \
160 *out = cpu_to_le64(val); \
161 } while (0)
162
163#define ADD_STATS_64(__hba, field, len) \
164 do { \
165 __hba->bnx2i_stats.field += len; \
166 } while (0)
167#endif
168
130/**
131 * struct generic_pdu_resc - login pdu resource structure
132 *
133 * @req_buf: driver buffer used to stage payload associated with
134 * the login request
135 * @req_dma_addr: dma address for iscsi login request payload buffer
136 * @req_buf_size: actual login request payload length
137 * @req_wr_ptr: pointer into login request buffer when next data is

--- 145 unchanged lines hidden (view full) ---

283 u32 *cid_que;
284 u32 cid_q_prod_idx;
285 u32 cid_q_cons_idx;
286 u32 cid_q_max_idx;
287 u32 cid_free_cnt;
288 struct bnx2i_conn **conn_cid_tbl;
289};
290
169/**
170 * struct generic_pdu_resc - login pdu resource structure
171 *
172 * @req_buf: driver buffer used to stage payload associated with
173 * the login request
174 * @req_dma_addr: dma address for iscsi login request payload buffer
175 * @req_buf_size: actual login request payload length
176 * @req_wr_ptr: pointer into login request buffer when next data is

--- 145 unchanged lines hidden (view full) ---

322 u32 *cid_que;
323 u32 cid_q_prod_idx;
324 u32 cid_q_cons_idx;
325 u32 cid_q_max_idx;
326 u32 cid_free_cnt;
327 struct bnx2i_conn **conn_cid_tbl;
328};
329
330
331struct bnx2i_stats_info {
332 u64 rx_pdus;
333 u64 rx_bytes;
334 u64 tx_pdus;
335 u64 tx_bytes;
336};
337
338
291/**
292 * struct bnx2i_hba - bnx2i adapter structure
293 *
294 * @link: list head to link elements
295 * @cnic: pointer to cnic device
296 * @pcidev: pointer to pci dev
297 * @netdev: pointer to netdev structure
298 * @regview: mapped PCI register space

--- 37 unchanged lines hidden (view full) ---

336 * received
337 * @ipaddr_changed_count: statistic counter, num times IP address changed while
338 * at least one connection is offloaded
339 * @num_sess_opened: statistic counter, total num sessions opened
340 * @num_conn_opened: statistic counter, total num conns opened on this hba
341 * @ctx_ccell_tasks: captures number of ccells and tasks supported by
342 * currently offloaded connection, used to decode
343 * context memory
339/**
340 * struct bnx2i_hba - bnx2i adapter structure
341 *
342 * @link: list head to link elements
343 * @cnic: pointer to cnic device
344 * @pcidev: pointer to pci dev
345 * @netdev: pointer to netdev structure
346 * @regview: mapped PCI register space

--- 37 unchanged lines hidden (view full) ---

384 * received
385 * @ipaddr_changed_count: statistic counter, num times IP address changed while
386 * at least one connection is offloaded
387 * @num_sess_opened: statistic counter, total num sessions opened
388 * @num_conn_opened: statistic counter, total num conns opened on this hba
389 * @ctx_ccell_tasks: captures number of ccells and tasks supported by
390 * currently offloaded connection, used to decode
391 * context memory
392 * @stat_lock: spin lock used by the statistic collector (32 bit)
393 * @stats: local iSCSI statistic collection place holder
344 *
345 * Adapter Data Structure
346 */
347struct bnx2i_hba {
348 struct list_head link;
349 struct cnic_dev *cnic;
350 struct pci_dev *pcidev;
351 struct net_device *netdev;

--- 69 unchanged lines hidden (view full) ---

421 u32 num_wqe_sent;
422 u32 num_cqe_rcvd;
423 u32 num_intr_claimed;
424 u32 link_changed_count;
425 u32 ipaddr_changed_count;
426 u32 num_sess_opened;
427 u32 num_conn_opened;
428 unsigned int ctx_ccell_tasks;
394 *
395 * Adapter Data Structure
396 */
397struct bnx2i_hba {
398 struct list_head link;
399 struct cnic_dev *cnic;
400 struct pci_dev *pcidev;
401 struct net_device *netdev;

--- 69 unchanged lines hidden (view full) ---

471 u32 num_wqe_sent;
472 u32 num_cqe_rcvd;
473 u32 num_intr_claimed;
474 u32 link_changed_count;
475 u32 ipaddr_changed_count;
476 u32 num_sess_opened;
477 u32 num_conn_opened;
478 unsigned int ctx_ccell_tasks;
479
480#ifdef CONFIG_32BIT
481 spinlock_t stat_lock;
482#endif
483 struct bnx2i_stats_info bnx2i_stats;
484 struct iscsi_stats_info stats;
429};
430
431
432/*******************************************************************************
433 * QP [ SQ / RQ / CQ ] info.
434 ******************************************************************************/
435
436/*

--- 307 unchanged lines hidden (view full) ---

744 * Function Prototypes
745 */
746extern void bnx2i_identify_device(struct bnx2i_hba *hba);
747
748extern void bnx2i_ulp_init(struct cnic_dev *dev);
749extern void bnx2i_ulp_exit(struct cnic_dev *dev);
750extern void bnx2i_start(void *handle);
751extern void bnx2i_stop(void *handle);
485};
486
487
488/*******************************************************************************
489 * QP [ SQ / RQ / CQ ] info.
490 ******************************************************************************/
491
492/*

--- 307 unchanged lines hidden (view full) ---

800 * Function Prototypes
801 */
802extern void bnx2i_identify_device(struct bnx2i_hba *hba);
803
804extern void bnx2i_ulp_init(struct cnic_dev *dev);
805extern void bnx2i_ulp_exit(struct cnic_dev *dev);
806extern void bnx2i_start(void *handle);
807extern void bnx2i_stop(void *handle);
808extern int bnx2i_get_stats(void *handle);
809
752extern struct bnx2i_hba *get_adapter_list_head(void);
753
754struct bnx2i_conn *bnx2i_get_conn_from_id(struct bnx2i_hba *hba,
755 u16 iscsi_cid);
756
757int bnx2i_alloc_ep_pool(void);
758void bnx2i_release_ep_pool(void);
759struct bnx2i_endpoint *bnx2i_ep_ofld_list_next(struct bnx2i_hba *hba);

--- 62 unchanged lines hidden ---
810extern struct bnx2i_hba *get_adapter_list_head(void);
811
812struct bnx2i_conn *bnx2i_get_conn_from_id(struct bnx2i_hba *hba,
813 u16 iscsi_cid);
814
815int bnx2i_alloc_ep_pool(void);
816void bnx2i_release_ep_pool(void);
817struct bnx2i_endpoint *bnx2i_ep_ofld_list_next(struct bnx2i_hba *hba);

--- 62 unchanged lines hidden ---