diff options
author | Krishna Gudipati <kgudipat@brocade.com> | 2010-09-15 14:50:55 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-09-16 22:54:24 -0400 |
commit | a36c61f9025b8924f99f54d518763bee7aa84085 (patch) | |
tree | e1d58c382ad31fe1ad3c5f6bccde1b9df1d9fd8c /drivers/scsi/bfa/bfad_drv.h | |
parent | edaed859e63aac174fcc3fed81886b91bb124661 (diff) |
[SCSI] bfa: cleanup driver
We have flattened the BFA hierarchy and also reduced the number of
source and header files we used to have earlier.
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bfa/bfad_drv.h')
-rw-r--r-- | drivers/scsi/bfa/bfad_drv.h | 254 |
1 files changed, 151 insertions, 103 deletions
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h index 465b8b86ec9..98420bbb4f3 100644 --- a/drivers/scsi/bfa/bfad_drv.h +++ b/drivers/scsi/bfa/bfad_drv.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2005-2009 Brocade Communications Systems, Inc. | 2 | * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. |
3 | * All rights reserved | 3 | * All rights reserved |
4 | * www.brocade.com | 4 | * www.brocade.com |
5 | * | 5 | * |
@@ -28,30 +28,27 @@ | |||
28 | 28 | ||
29 | #include "bfa_os_inc.h" | 29 | #include "bfa_os_inc.h" |
30 | 30 | ||
31 | #include <bfa.h> | 31 | #include "bfa_modules.h" |
32 | #include <bfa_svc.h> | 32 | #include "bfa_fcs.h" |
33 | #include <fcs/bfa_fcs.h> | 33 | #include "bfa_defs_fcs.h" |
34 | #include <defs/bfa_defs_pci.h> | 34 | |
35 | #include <defs/bfa_defs_port.h> | 35 | #include "bfa_plog.h" |
36 | #include <defs/bfa_defs_rport.h> | 36 | #include "bfa_cs.h" |
37 | #include <fcs/bfa_fcs_rport.h> | 37 | |
38 | #include <defs/bfa_defs_vport.h> | 38 | #define BFAD_DRIVER_NAME "bfa" |
39 | #include <fcs/bfa_fcs_vport.h> | ||
40 | |||
41 | #include <cs/bfa_plog.h> | ||
42 | #include "aen/bfa_aen.h" | ||
43 | #include <log/bfa_log_linux.h> | ||
44 | |||
45 | #define BFAD_DRIVER_NAME "bfa" | ||
46 | #ifdef BFA_DRIVER_VERSION | 39 | #ifdef BFA_DRIVER_VERSION |
47 | #define BFAD_DRIVER_VERSION BFA_DRIVER_VERSION | 40 | #define BFAD_DRIVER_VERSION BFA_DRIVER_VERSION |
48 | #else | 41 | #else |
49 | #define BFAD_DRIVER_VERSION "2.2.2.1" | 42 | #define BFAD_DRIVER_VERSION "2.3.2.0" |
50 | #endif | 43 | #endif |
51 | 44 | ||
52 | 45 | #define BFAD_PROTO_NAME FCPI_NAME | |
53 | #define BFAD_IRQ_FLAGS IRQF_SHARED | 46 | #define BFAD_IRQ_FLAGS IRQF_SHARED |
54 | 47 | ||
48 | #ifndef FC_PORTSPEED_8GBIT | ||
49 | #define FC_PORTSPEED_8GBIT 0x10 | ||
50 | #endif | ||
51 | |||
55 | /* | 52 | /* |
56 | * BFAD flags | 53 | * BFAD flags |
57 | */ | 54 | */ |
@@ -62,9 +59,9 @@ | |||
62 | #define BFAD_HAL_START_DONE 0x00000010 | 59 | #define BFAD_HAL_START_DONE 0x00000010 |
63 | #define BFAD_PORT_ONLINE 0x00000020 | 60 | #define BFAD_PORT_ONLINE 0x00000020 |
64 | #define BFAD_RPORT_ONLINE 0x00000040 | 61 | #define BFAD_RPORT_ONLINE 0x00000040 |
65 | #define BFAD_FCS_INIT_DONE 0x00000080 | 62 | #define BFAD_FCS_INIT_DONE 0x00000080 |
66 | #define BFAD_HAL_INIT_FAIL 0x00000100 | 63 | #define BFAD_HAL_INIT_FAIL 0x00000100 |
67 | #define BFAD_FC4_PROBE_DONE 0x00000200 | 64 | #define BFAD_FC4_PROBE_DONE 0x00000200 |
68 | #define BFAD_PORT_DELETE 0x00000001 | 65 | #define BFAD_PORT_DELETE 0x00000001 |
69 | 66 | ||
70 | /* | 67 | /* |
@@ -77,8 +74,8 @@ | |||
77 | /* | 74 | /* |
78 | * BFAD configuration parameter default values | 75 | * BFAD configuration parameter default values |
79 | */ | 76 | */ |
80 | #define BFAD_LUN_QUEUE_DEPTH 32 | 77 | #define BFAD_LUN_QUEUE_DEPTH 32 |
81 | #define BFAD_IO_MAX_SGE SG_ALL | 78 | #define BFAD_IO_MAX_SGE SG_ALL |
82 | 79 | ||
83 | #define bfad_isr_t irq_handler_t | 80 | #define bfad_isr_t irq_handler_t |
84 | 81 | ||
@@ -87,6 +84,16 @@ | |||
87 | struct bfad_msix_s { | 84 | struct bfad_msix_s { |
88 | struct bfad_s *bfad; | 85 | struct bfad_s *bfad; |
89 | struct msix_entry msix; | 86 | struct msix_entry msix; |
87 | char name[32]; | ||
88 | }; | ||
89 | |||
90 | /* | ||
91 | * Only append to the enums defined here to avoid any versioning | ||
92 | * needed between trace utility and driver version | ||
93 | */ | ||
94 | enum { | ||
95 | BFA_TRC_LDRV_BFAD = 1, | ||
96 | BFA_TRC_LDRV_IM = 2, | ||
90 | }; | 97 | }; |
91 | 98 | ||
92 | enum bfad_port_pvb_type { | 99 | enum bfad_port_pvb_type { |
@@ -101,17 +108,13 @@ enum bfad_port_pvb_type { | |||
101 | */ | 108 | */ |
102 | struct bfad_port_s { | 109 | struct bfad_port_s { |
103 | struct list_head list_entry; | 110 | struct list_head list_entry; |
104 | struct bfad_s *bfad; | 111 | struct bfad_s *bfad; |
105 | struct bfa_fcs_port_s *fcs_port; | 112 | struct bfa_fcs_lport_s *fcs_port; |
106 | u32 roles; | 113 | u32 roles; |
107 | s32 flags; | 114 | s32 flags; |
108 | u32 supported_fc4s; | 115 | u32 supported_fc4s; |
109 | u8 ipfc_flags; | ||
110 | enum bfad_port_pvb_type pvb_type; | 116 | enum bfad_port_pvb_type pvb_type; |
111 | struct bfad_im_port_s *im_port; /* IM specific data */ | 117 | struct bfad_im_port_s *im_port; /* IM specific data */ |
112 | struct bfad_tm_port_s *tm_port; /* TM specific data */ | ||
113 | struct bfad_ipfc_port_s *ipfc_port; /* IPFC specific data */ | ||
114 | |||
115 | /* port debugfs specific data */ | 118 | /* port debugfs specific data */ |
116 | struct dentry *port_debugfs_root; | 119 | struct dentry *port_debugfs_root; |
117 | }; | 120 | }; |
@@ -124,7 +127,6 @@ struct bfad_vport_s { | |||
124 | struct bfa_fcs_vport_s fcs_vport; | 127 | struct bfa_fcs_vport_s fcs_vport; |
125 | struct completion *comp_del; | 128 | struct completion *comp_del; |
126 | struct list_head list_entry; | 129 | struct list_head list_entry; |
127 | struct bfa_port_cfg_s port_cfg; | ||
128 | }; | 130 | }; |
129 | 131 | ||
130 | /* | 132 | /* |
@@ -137,20 +139,35 @@ struct bfad_vf_s { | |||
137 | }; | 139 | }; |
138 | 140 | ||
139 | struct bfad_cfg_param_s { | 141 | struct bfad_cfg_param_s { |
140 | u32 rport_del_timeout; | 142 | u32 rport_del_timeout; |
141 | u32 ioc_queue_depth; | 143 | u32 ioc_queue_depth; |
142 | u32 lun_queue_depth; | 144 | u32 lun_queue_depth; |
143 | u32 io_max_sge; | 145 | u32 io_max_sge; |
144 | u32 binding_method; | 146 | u32 binding_method; |
147 | }; | ||
148 | |||
149 | union bfad_tmp_buf { | ||
150 | /* From struct bfa_adapter_attr_s */ | ||
151 | char manufacturer[BFA_ADAPTER_MFG_NAME_LEN]; | ||
152 | char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN]; | ||
153 | char model[BFA_ADAPTER_MODEL_NAME_LEN]; | ||
154 | char fw_ver[BFA_VERSION_LEN]; | ||
155 | char optrom_ver[BFA_VERSION_LEN]; | ||
156 | |||
157 | /* From struct bfa_ioc_pci_attr_s */ | ||
158 | u8 chip_rev[BFA_IOC_CHIP_REV_LEN]; /* chip revision */ | ||
159 | |||
160 | wwn_t wwn[BFA_FCS_MAX_LPORTS]; | ||
145 | }; | 161 | }; |
146 | 162 | ||
147 | /* | 163 | /* |
148 | * BFAD (PCI function) data structure | 164 | * BFAD (PCI function) data structure |
149 | */ | 165 | */ |
150 | struct bfad_s { | 166 | struct bfad_s { |
167 | bfa_sm_t sm; /* state machine */ | ||
151 | struct list_head list_entry; | 168 | struct list_head list_entry; |
152 | struct bfa_s bfa; | 169 | struct bfa_s bfa; |
153 | struct bfa_fcs_s bfa_fcs; | 170 | struct bfa_fcs_s bfa_fcs; |
154 | struct pci_dev *pcidev; | 171 | struct pci_dev *pcidev; |
155 | const char *pci_name; | 172 | const char *pci_name; |
156 | struct bfa_pcidev_s hal_pcidev; | 173 | struct bfa_pcidev_s hal_pcidev; |
@@ -163,41 +180,41 @@ struct bfad_s { | |||
163 | struct bfad_port_s pport; /* physical port of the BFAD */ | 180 | struct bfad_port_s pport; /* physical port of the BFAD */ |
164 | struct bfa_meminfo_s meminfo; | 181 | struct bfa_meminfo_s meminfo; |
165 | struct bfa_iocfc_cfg_s ioc_cfg; | 182 | struct bfa_iocfc_cfg_s ioc_cfg; |
166 | u32 inst_no; /* BFAD instance number */ | 183 | u32 inst_no; /* BFAD instance number */ |
167 | u32 bfad_flags; | 184 | u32 bfad_flags; |
168 | spinlock_t bfad_lock; | 185 | spinlock_t bfad_lock; |
169 | struct task_struct *bfad_tsk; | 186 | struct task_struct *bfad_tsk; |
170 | struct bfad_cfg_param_s cfg_data; | 187 | struct bfad_cfg_param_s cfg_data; |
171 | struct bfad_msix_s msix_tab[MAX_MSIX_ENTRY]; | 188 | struct bfad_msix_s msix_tab[MAX_MSIX_ENTRY]; |
172 | int nvec; | 189 | int nvec; |
173 | char adapter_name[BFA_ADAPTER_SYM_NAME_LEN]; | 190 | char adapter_name[BFA_ADAPTER_SYM_NAME_LEN]; |
174 | char port_name[BFA_ADAPTER_SYM_NAME_LEN]; | 191 | char port_name[BFA_ADAPTER_SYM_NAME_LEN]; |
175 | struct timer_list hal_tmo; | 192 | struct timer_list hal_tmo; |
176 | unsigned long hs_start; | 193 | unsigned long hs_start; |
177 | struct bfad_im_s *im; /* IM specific data */ | 194 | struct bfad_im_s *im; /* IM specific data */ |
178 | struct bfad_tm_s *tm; /* TM specific data */ | ||
179 | struct bfad_ipfc_s *ipfc; /* IPFC specific data */ | ||
180 | struct bfa_log_mod_s log_data; | ||
181 | struct bfa_trc_mod_s *trcmod; | 195 | struct bfa_trc_mod_s *trcmod; |
182 | struct bfa_log_mod_s *logmod; | ||
183 | struct bfa_aen_s *aen; | ||
184 | struct bfa_aen_s aen_buf; | ||
185 | void *file_map[BFA_AEN_MAX_APP]; | ||
186 | struct bfa_plog_s plog_buf; | 196 | struct bfa_plog_s plog_buf; |
187 | int ref_count; | 197 | int ref_count; |
188 | bfa_boolean_t ipfc_enabled; | 198 | union bfad_tmp_buf tmp_buf; |
189 | struct fc_host_statistics link_stats; | 199 | struct fc_host_statistics link_stats; |
190 | struct list_head pbc_pcfg_list; | 200 | struct list_head pbc_vport_list; |
191 | atomic_t wq_reqcnt; | ||
192 | /* debugfs specific data */ | 201 | /* debugfs specific data */ |
193 | char *regdata; | 202 | char *regdata; |
194 | u32 reglen; | 203 | u32 reglen; |
195 | struct dentry *bfad_dentry_files[5]; | 204 | struct dentry *bfad_dentry_files[5]; |
196 | }; | 205 | }; |
197 | 206 | ||
198 | struct bfad_pcfg_s { | 207 | /* BFAD state machine events */ |
199 | struct list_head list_entry; | 208 | enum bfad_sm_event { |
200 | struct bfa_port_cfg_s port_cfg; | 209 | BFAD_E_CREATE = 1, |
210 | BFAD_E_KTHREAD_CREATE_FAILED = 2, | ||
211 | BFAD_E_INIT = 3, | ||
212 | BFAD_E_INIT_SUCCESS = 4, | ||
213 | BFAD_E_INIT_FAILED = 5, | ||
214 | BFAD_E_INTR_INIT_FAILED = 6, | ||
215 | BFAD_E_FCS_EXIT_COMP = 7, | ||
216 | BFAD_E_EXIT_COMP = 8, | ||
217 | BFAD_E_STOP = 9 | ||
201 | }; | 218 | }; |
202 | 219 | ||
203 | /* | 220 | /* |
@@ -208,30 +225,30 @@ struct bfad_rport_s { | |||
208 | }; | 225 | }; |
209 | 226 | ||
210 | struct bfad_buf_info { | 227 | struct bfad_buf_info { |
211 | void *virt; | 228 | void *virt; |
212 | dma_addr_t phys; | 229 | dma_addr_t phys; |
213 | u32 size; | 230 | u32 size; |
214 | }; | 231 | }; |
215 | 232 | ||
216 | struct bfad_fcxp { | 233 | struct bfad_fcxp { |
217 | struct bfad_port_s *port; | 234 | struct bfad_port_s *port; |
218 | struct bfa_rport_s *bfa_rport; | 235 | struct bfa_rport_s *bfa_rport; |
219 | bfa_status_t req_status; | 236 | bfa_status_t req_status; |
220 | u16 tag; | 237 | u16 tag; |
221 | u16 rsp_len; | 238 | u16 rsp_len; |
222 | u16 rsp_maxlen; | 239 | u16 rsp_maxlen; |
223 | u8 use_ireqbuf; | 240 | u8 use_ireqbuf; |
224 | u8 use_irspbuf; | 241 | u8 use_irspbuf; |
225 | u32 num_req_sgles; | 242 | u32 num_req_sgles; |
226 | u32 num_rsp_sgles; | 243 | u32 num_rsp_sgles; |
227 | struct fchs_s fchs; | 244 | struct fchs_s fchs; |
228 | void *reqbuf_info; | 245 | void *reqbuf_info; |
229 | void *rspbuf_info; | 246 | void *rspbuf_info; |
230 | struct bfa_sge_s *req_sge; | 247 | struct bfa_sge_s *req_sge; |
231 | struct bfa_sge_s *rsp_sge; | 248 | struct bfa_sge_s *rsp_sge; |
232 | fcxp_send_cb_t send_cbfn; | 249 | fcxp_send_cb_t send_cbfn; |
233 | void *send_cbarg; | 250 | void *send_cbarg; |
234 | void *bfa_fcxp; | 251 | void *bfa_fcxp; |
235 | struct completion comp; | 252 | struct completion comp; |
236 | }; | 253 | }; |
237 | 254 | ||
@@ -244,34 +261,48 @@ struct bfad_hal_comp { | |||
244 | * Macro to obtain the immediate lower power | 261 | * Macro to obtain the immediate lower power |
245 | * of two for the integer. | 262 | * of two for the integer. |
246 | */ | 263 | */ |
247 | #define nextLowerInt(x) \ | 264 | #define nextLowerInt(x) \ |
248 | do { \ | 265 | do { \ |
249 | int j; \ | 266 | int i; \ |
250 | (*x)--; \ | 267 | (*x)--; \ |
251 | for (j = 1; j < (sizeof(int) * 8); j <<= 1) \ | 268 | for (i = 1; i < (sizeof(int)*8); i <<= 1) \ |
252 | (*x) = (*x) | (*x) >> j; \ | 269 | (*x) = (*x) | (*x) >> i; \ |
253 | (*x)++; \ | 270 | (*x)++; \ |
254 | (*x) = (*x) >> 1; \ | 271 | (*x) = (*x) >> 1; \ |
255 | } while (0) | 272 | } while (0) |
256 | 273 | ||
257 | 274 | ||
258 | bfa_status_t bfad_vport_create(struct bfad_s *bfad, u16 vf_id, | 275 | #define list_remove_head(list, entry, type, member) \ |
259 | struct bfa_port_cfg_s *port_cfg, struct device *dev); | 276 | do { \ |
260 | bfa_status_t bfad_vf_create(struct bfad_s *bfad, u16 vf_id, | 277 | entry = NULL; \ |
261 | struct bfa_port_cfg_s *port_cfg); | 278 | if (!list_empty(list)) { \ |
262 | bfa_status_t bfad_cfg_pport(struct bfad_s *bfad, enum bfa_port_role role); | 279 | entry = list_entry((list)->next, type, member); \ |
263 | bfa_status_t bfad_drv_init(struct bfad_s *bfad); | 280 | list_del_init(&entry->member); \ |
264 | bfa_status_t bfad_start_ops(struct bfad_s *bfad); | 281 | } \ |
265 | void bfad_drv_start(struct bfad_s *bfad); | 282 | } while (0) |
266 | void bfad_uncfg_pport(struct bfad_s *bfad); | ||
267 | void bfad_drv_stop(struct bfad_s *bfad); | ||
268 | void bfad_remove_intr(struct bfad_s *bfad); | ||
269 | void bfad_hal_mem_release(struct bfad_s *bfad); | ||
270 | void bfad_hcb_comp(void *arg, bfa_status_t status); | ||
271 | |||
272 | int bfad_setup_intr(struct bfad_s *bfad); | ||
273 | void bfad_remove_intr(struct bfad_s *bfad); | ||
274 | 283 | ||
284 | #define list_get_first(list, type, member) \ | ||
285 | ((list_empty(list)) ? NULL : \ | ||
286 | list_entry((list)->next, type, member)) | ||
287 | |||
288 | bfa_status_t bfad_vport_create(struct bfad_s *bfad, u16 vf_id, | ||
289 | struct bfa_lport_cfg_s *port_cfg, | ||
290 | struct device *dev); | ||
291 | bfa_status_t bfad_vf_create(struct bfad_s *bfad, u16 vf_id, | ||
292 | struct bfa_lport_cfg_s *port_cfg); | ||
293 | bfa_status_t bfad_cfg_pport(struct bfad_s *bfad, enum bfa_lport_role role); | ||
294 | bfa_status_t bfad_drv_init(struct bfad_s *bfad); | ||
295 | bfa_status_t bfad_start_ops(struct bfad_s *bfad); | ||
296 | void bfad_drv_start(struct bfad_s *bfad); | ||
297 | void bfad_uncfg_pport(struct bfad_s *bfad); | ||
298 | void bfad_stop(struct bfad_s *bfad); | ||
299 | void bfad_fcs_stop(struct bfad_s *bfad); | ||
300 | void bfad_remove_intr(struct bfad_s *bfad); | ||
301 | void bfad_hal_mem_release(struct bfad_s *bfad); | ||
302 | void bfad_hcb_comp(void *arg, bfa_status_t status); | ||
303 | |||
304 | int bfad_setup_intr(struct bfad_s *bfad); | ||
305 | void bfad_remove_intr(struct bfad_s *bfad); | ||
275 | void bfad_update_hal_cfg(struct bfa_iocfc_cfg_s *bfa_cfg); | 306 | void bfad_update_hal_cfg(struct bfa_iocfc_cfg_s *bfa_cfg); |
276 | bfa_status_t bfad_hal_mem_alloc(struct bfad_s *bfad); | 307 | bfa_status_t bfad_hal_mem_alloc(struct bfad_s *bfad); |
277 | void bfad_bfa_tmo(unsigned long data); | 308 | void bfad_bfa_tmo(unsigned long data); |
@@ -280,9 +311,6 @@ int bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad); | |||
280 | void bfad_pci_uninit(struct pci_dev *pdev, struct bfad_s *bfad); | 311 | void bfad_pci_uninit(struct pci_dev *pdev, struct bfad_s *bfad); |
281 | void bfad_fcs_port_cfg(struct bfad_s *bfad); | 312 | void bfad_fcs_port_cfg(struct bfad_s *bfad); |
282 | void bfad_drv_uninit(struct bfad_s *bfad); | 313 | void bfad_drv_uninit(struct bfad_s *bfad); |
283 | void bfad_drv_log_level_set(struct bfad_s *bfad); | ||
284 | bfa_status_t bfad_fc4_module_init(void); | ||
285 | void bfad_fc4_module_exit(void); | ||
286 | int bfad_worker(void *ptr); | 314 | int bfad_worker(void *ptr); |
287 | void bfad_debugfs_init(struct bfad_port_s *port); | 315 | void bfad_debugfs_init(struct bfad_port_s *port); |
288 | void bfad_debugfs_exit(struct bfad_port_s *port); | 316 | void bfad_debugfs_exit(struct bfad_port_s *port); |
@@ -294,10 +322,30 @@ int bfad_os_get_linkup_delay(struct bfad_s *bfad); | |||
294 | int bfad_install_msix_handler(struct bfad_s *bfad); | 322 | int bfad_install_msix_handler(struct bfad_s *bfad); |
295 | 323 | ||
296 | extern struct idr bfad_im_port_index; | 324 | extern struct idr bfad_im_port_index; |
325 | extern struct pci_device_id bfad_id_table[]; | ||
297 | extern struct list_head bfad_list; | 326 | extern struct list_head bfad_list; |
298 | extern int bfa_lun_queue_depth; | 327 | extern char *os_name; |
299 | extern int bfad_supported_fc4s; | 328 | extern char *os_patch; |
300 | extern int bfa_linkup_delay; | 329 | extern char *host_name; |
330 | extern int num_rports; | ||
331 | extern int num_ios; | ||
332 | extern int num_tms; | ||
333 | extern int num_fcxps; | ||
334 | extern int num_ufbufs; | ||
335 | extern int reqq_size; | ||
336 | extern int rspq_size; | ||
337 | extern int num_sgpgs; | ||
338 | extern int rport_del_timeout; | ||
339 | extern int bfa_lun_queue_depth; | ||
340 | extern int bfa_io_max_sge; | ||
341 | extern int log_level; | ||
342 | extern int ioc_auto_recover; | ||
343 | extern int bfa_linkup_delay; | ||
344 | extern int msix_disable_cb; | ||
345 | extern int msix_disable_ct; | ||
346 | extern int fdmi_enable; | ||
347 | extern int supported_fc4s; | ||
348 | extern int pcie_max_read_reqsz; | ||
301 | extern int bfa_debugfs_enable; | 349 | extern int bfa_debugfs_enable; |
302 | extern struct mutex bfad_mutex; | 350 | extern struct mutex bfad_mutex; |
303 | 351 | ||