diff options
Diffstat (limited to 'drivers/scsi/bfa')
41 files changed, 1927 insertions, 3863 deletions
diff --git a/drivers/scsi/bfa/Makefile b/drivers/scsi/bfa/Makefile index d2eefd3e3bd..4ce6f494232 100644 --- a/drivers/scsi/bfa/Makefile +++ b/drivers/scsi/bfa/Makefile | |||
@@ -3,6 +3,4 @@ obj-$(CONFIG_SCSI_BFA_FC) := bfa.o | |||
3 | bfa-y := bfad.o bfad_im.o bfad_attr.o bfad_debugfs.o | 3 | bfa-y := bfad.o bfad_im.o bfad_attr.o bfad_debugfs.o |
4 | bfa-y += bfa_ioc.o bfa_ioc_cb.o bfa_ioc_ct.o bfa_hw_cb.o bfa_hw_ct.o | 4 | bfa-y += bfa_ioc.o bfa_ioc_cb.o bfa_ioc_ct.o bfa_hw_cb.o bfa_hw_ct.o |
5 | bfa-y += bfa_fcs.o bfa_fcs_lport.o bfa_fcs_rport.o bfa_fcs_fcpim.o bfa_fcbuild.o | 5 | bfa-y += bfa_fcs.o bfa_fcs_lport.o bfa_fcs_rport.o bfa_fcs_fcpim.o bfa_fcbuild.o |
6 | bfa-y += bfa_port.o bfa_fcpim.o bfa_core.o bfa_drv.o bfa_svc.o | 6 | bfa-y += bfa_port.o bfa_fcpim.o bfa_core.o bfa_svc.o |
7 | |||
8 | ccflags-y := -DBFA_PERF_BUILD | ||
diff --git a/drivers/scsi/bfa/bfa.h b/drivers/scsi/bfa/bfa.h index ff2bd07161f..7be6b5a8114 100644 --- a/drivers/scsi/bfa/bfa.h +++ b/drivers/scsi/bfa/bfa.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #ifndef __BFA_H__ | 17 | #ifndef __BFA_H__ |
18 | #define __BFA_H__ | 18 | #define __BFA_H__ |
19 | 19 | ||
20 | #include "bfa_os_inc.h" | 20 | #include "bfad_drv.h" |
21 | #include "bfa_cs.h" | 21 | #include "bfa_cs.h" |
22 | #include "bfa_plog.h" | 22 | #include "bfa_plog.h" |
23 | #include "bfa_defs_svc.h" | 23 | #include "bfa_defs_svc.h" |
@@ -33,7 +33,6 @@ typedef void (*bfa_cb_cbfn_t) (void *cbarg, bfa_boolean_t complete); | |||
33 | * Interrupt message handlers | 33 | * Interrupt message handlers |
34 | */ | 34 | */ |
35 | void bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m); | 35 | void bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m); |
36 | void bfa_isr_bind(enum bfi_mclass mc, bfa_isr_func_t isr_func); | ||
37 | 36 | ||
38 | /* | 37 | /* |
39 | * Request and response queue related defines | 38 | * Request and response queue related defines |
@@ -121,8 +120,8 @@ bfa_reqq_winit(struct bfa_reqq_wait_s *wqe, void (*qresume) (void *cbarg), | |||
121 | \ | 120 | \ |
122 | struct list_head *waitq = bfa_reqq(__bfa, __reqq); \ | 121 | struct list_head *waitq = bfa_reqq(__bfa, __reqq); \ |
123 | \ | 122 | \ |
124 | bfa_assert(((__reqq) < BFI_IOC_MAX_CQS)); \ | 123 | WARN_ON(((__reqq) >= BFI_IOC_MAX_CQS)); \ |
125 | bfa_assert((__wqe)->qresume && (__wqe)->cbarg); \ | 124 | WARN_ON(!((__wqe)->qresume && (__wqe)->cbarg)); \ |
126 | \ | 125 | \ |
127 | list_add_tail(&(__wqe)->qe, waitq); \ | 126 | list_add_tail(&(__wqe)->qe, waitq); \ |
128 | } while (0) | 127 | } while (0) |
@@ -297,7 +296,6 @@ void bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, | |||
297 | struct bfa_iocfc_cfg_s *cfg, | 296 | struct bfa_iocfc_cfg_s *cfg, |
298 | struct bfa_meminfo_s *meminfo, | 297 | struct bfa_meminfo_s *meminfo, |
299 | struct bfa_pcidev_s *pcidev); | 298 | struct bfa_pcidev_s *pcidev); |
300 | void bfa_iocfc_detach(struct bfa_s *bfa); | ||
301 | void bfa_iocfc_init(struct bfa_s *bfa); | 299 | void bfa_iocfc_init(struct bfa_s *bfa); |
302 | void bfa_iocfc_start(struct bfa_s *bfa); | 300 | void bfa_iocfc_start(struct bfa_s *bfa); |
303 | void bfa_iocfc_stop(struct bfa_s *bfa); | 301 | void bfa_iocfc_stop(struct bfa_s *bfa); |
@@ -333,12 +331,9 @@ void bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, u32 *nvecs, | |||
333 | u32 *maxvec); | 331 | u32 *maxvec); |
334 | void bfa_hwct_msix_get_rme_range(struct bfa_s *bfa, u32 *start, | 332 | void bfa_hwct_msix_get_rme_range(struct bfa_s *bfa, u32 *start, |
335 | u32 *end); | 333 | u32 *end); |
336 | void bfa_com_port_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi); | ||
337 | void bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t *wwns); | 334 | void bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t *wwns); |
338 | wwn_t bfa_iocfc_get_pwwn(struct bfa_s *bfa); | 335 | wwn_t bfa_iocfc_get_pwwn(struct bfa_s *bfa); |
339 | wwn_t bfa_iocfc_get_nwwn(struct bfa_s *bfa); | 336 | wwn_t bfa_iocfc_get_nwwn(struct bfa_s *bfa); |
340 | void bfa_iocfc_get_pbc_boot_cfg(struct bfa_s *bfa, | ||
341 | struct bfa_boot_pbc_s *pbcfg); | ||
342 | int bfa_iocfc_get_pbc_vports(struct bfa_s *bfa, | 337 | int bfa_iocfc_get_pbc_vports(struct bfa_s *bfa, |
343 | struct bfi_pbc_vport_s *pbc_vport); | 338 | struct bfi_pbc_vport_s *pbc_vport); |
344 | 339 | ||
@@ -386,19 +381,11 @@ void bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, | |||
386 | void bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | 381 | void bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, |
387 | struct bfa_meminfo_s *meminfo, | 382 | struct bfa_meminfo_s *meminfo, |
388 | struct bfa_pcidev_s *pcidev); | 383 | struct bfa_pcidev_s *pcidev); |
389 | void bfa_init_trc(struct bfa_s *bfa, struct bfa_trc_mod_s *trcmod); | ||
390 | void bfa_init_plog(struct bfa_s *bfa, struct bfa_plog_s *plog); | ||
391 | void bfa_detach(struct bfa_s *bfa); | 384 | void bfa_detach(struct bfa_s *bfa); |
392 | void bfa_init(struct bfa_s *bfa); | ||
393 | void bfa_start(struct bfa_s *bfa); | ||
394 | void bfa_stop(struct bfa_s *bfa); | ||
395 | void bfa_attach_fcs(struct bfa_s *bfa); | ||
396 | void bfa_cb_init(void *bfad, bfa_status_t status); | 385 | void bfa_cb_init(void *bfad, bfa_status_t status); |
397 | void bfa_cb_updateq(void *bfad, bfa_status_t status); | 386 | void bfa_cb_updateq(void *bfad, bfa_status_t status); |
398 | 387 | ||
399 | bfa_boolean_t bfa_intx(struct bfa_s *bfa); | 388 | bfa_boolean_t bfa_intx(struct bfa_s *bfa); |
400 | void bfa_intx_disable(struct bfa_s *bfa); | ||
401 | void bfa_intx_enable(struct bfa_s *bfa); | ||
402 | void bfa_isr_enable(struct bfa_s *bfa); | 389 | void bfa_isr_enable(struct bfa_s *bfa); |
403 | void bfa_isr_disable(struct bfa_s *bfa); | 390 | void bfa_isr_disable(struct bfa_s *bfa); |
404 | 391 | ||
@@ -408,31 +395,14 @@ void bfa_comp_free(struct bfa_s *bfa, struct list_head *comp_q); | |||
408 | 395 | ||
409 | typedef void (*bfa_cb_ioc_t) (void *cbarg, enum bfa_status status); | 396 | typedef void (*bfa_cb_ioc_t) (void *cbarg, enum bfa_status status); |
410 | void bfa_iocfc_get_attr(struct bfa_s *bfa, struct bfa_iocfc_attr_s *attr); | 397 | void bfa_iocfc_get_attr(struct bfa_s *bfa, struct bfa_iocfc_attr_s *attr); |
411 | void bfa_get_attr(struct bfa_s *bfa, struct bfa_ioc_attr_s *ioc_attr); | ||
412 | 398 | ||
413 | void bfa_adapter_get_attr(struct bfa_s *bfa, | ||
414 | struct bfa_adapter_attr_s *ad_attr); | ||
415 | u64 bfa_adapter_get_id(struct bfa_s *bfa); | ||
416 | 399 | ||
417 | bfa_status_t bfa_iocfc_israttr_set(struct bfa_s *bfa, | 400 | bfa_status_t bfa_iocfc_israttr_set(struct bfa_s *bfa, |
418 | struct bfa_iocfc_intr_attr_s *attr); | 401 | struct bfa_iocfc_intr_attr_s *attr); |
419 | 402 | ||
420 | void bfa_iocfc_enable(struct bfa_s *bfa); | 403 | void bfa_iocfc_enable(struct bfa_s *bfa); |
421 | void bfa_iocfc_disable(struct bfa_s *bfa); | 404 | void bfa_iocfc_disable(struct bfa_s *bfa); |
422 | void bfa_chip_reset(struct bfa_s *bfa); | ||
423 | void bfa_timer_tick(struct bfa_s *bfa); | ||
424 | #define bfa_timer_start(_bfa, _timer, _timercb, _arg, _timeout) \ | 405 | #define bfa_timer_start(_bfa, _timer, _timercb, _arg, _timeout) \ |
425 | bfa_timer_begin(&(_bfa)->timer_mod, _timer, _timercb, _arg, _timeout) | 406 | bfa_timer_begin(&(_bfa)->timer_mod, _timer, _timercb, _arg, _timeout) |
426 | 407 | ||
427 | /* | ||
428 | * BFA debug API functions | ||
429 | */ | ||
430 | bfa_status_t bfa_debug_fwtrc(struct bfa_s *bfa, void *trcdata, int *trclen); | ||
431 | bfa_status_t bfa_debug_fwsave(struct bfa_s *bfa, void *trcdata, int *trclen); | ||
432 | bfa_status_t bfa_debug_fwcore(struct bfa_s *bfa, void *buf, | ||
433 | u32 *offset, int *buflen); | ||
434 | void bfa_debug_fwsave_clear(struct bfa_s *bfa); | ||
435 | bfa_status_t bfa_fw_stats_get(struct bfa_s *bfa, void *data); | ||
436 | bfa_status_t bfa_fw_stats_clear(struct bfa_s *bfa); | ||
437 | |||
438 | #endif /* __BFA_H__ */ | 408 | #endif /* __BFA_H__ */ |
diff --git a/drivers/scsi/bfa/bfa_cb_ioim.h b/drivers/scsi/bfa/bfa_cb_ioim.h deleted file mode 100644 index 6f021015f1f..00000000000 --- a/drivers/scsi/bfa/bfa_cb_ioim.h +++ /dev/null | |||
@@ -1,169 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. | ||
3 | * All rights reserved | ||
4 | * www.brocade.com | ||
5 | * | ||
6 | * Linux driver for Brocade Fibre Channel Host Bus Adapter. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License (GPL) Version 2 as | ||
10 | * published by the Free Software Foundation | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #ifndef __BFA_HCB_IOIM_H__ | ||
19 | #define __BFA_HCB_IOIM_H__ | ||
20 | |||
21 | #include "bfa_os_inc.h" | ||
22 | /* | ||
23 | * task attribute values in FCP-2 FCP_CMND IU | ||
24 | */ | ||
25 | #define SIMPLE_Q 0 | ||
26 | #define HEAD_OF_Q 1 | ||
27 | #define ORDERED_Q 2 | ||
28 | #define ACA_Q 4 | ||
29 | #define UNTAGGED 5 | ||
30 | |||
31 | static inline lun_t | ||
32 | bfad_int_to_lun(u32 luno) | ||
33 | { | ||
34 | union { | ||
35 | u16 scsi_lun[4]; | ||
36 | lun_t bfa_lun; | ||
37 | } lun; | ||
38 | |||
39 | lun.bfa_lun = 0; | ||
40 | lun.scsi_lun[0] = cpu_to_be16(luno); | ||
41 | |||
42 | return lun.bfa_lun; | ||
43 | } | ||
44 | |||
45 | /* | ||
46 | * Get LUN for the I/O request | ||
47 | */ | ||
48 | #define bfa_cb_ioim_get_lun(__dio) \ | ||
49 | bfad_int_to_lun(((struct scsi_cmnd *)__dio)->device->lun) | ||
50 | |||
51 | /* | ||
52 | * Get CDB for the I/O request | ||
53 | */ | ||
54 | static inline u8 * | ||
55 | bfa_cb_ioim_get_cdb(struct bfad_ioim_s *dio) | ||
56 | { | ||
57 | struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
58 | |||
59 | return (u8 *) cmnd->cmnd; | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * Get I/O direction (read/write) for the I/O request | ||
64 | */ | ||
65 | static inline enum fcp_iodir | ||
66 | bfa_cb_ioim_get_iodir(struct bfad_ioim_s *dio) | ||
67 | { | ||
68 | struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
69 | enum dma_data_direction dmadir; | ||
70 | |||
71 | dmadir = cmnd->sc_data_direction; | ||
72 | if (dmadir == DMA_TO_DEVICE) | ||
73 | return FCP_IODIR_WRITE; | ||
74 | else if (dmadir == DMA_FROM_DEVICE) | ||
75 | return FCP_IODIR_READ; | ||
76 | else | ||
77 | return FCP_IODIR_NONE; | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * Get IO size in bytes for the I/O request | ||
82 | */ | ||
83 | static inline u32 | ||
84 | bfa_cb_ioim_get_size(struct bfad_ioim_s *dio) | ||
85 | { | ||
86 | struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
87 | |||
88 | return scsi_bufflen(cmnd); | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * Get timeout for the I/O request | ||
93 | */ | ||
94 | static inline u8 | ||
95 | bfa_cb_ioim_get_timeout(struct bfad_ioim_s *dio) | ||
96 | { | ||
97 | struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
98 | /* | ||
99 | * TBD: need a timeout for scsi passthru | ||
100 | */ | ||
101 | if (cmnd->device->host == NULL) | ||
102 | return 4; | ||
103 | |||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * Get Command Reference Number for the I/O request. 0 if none. | ||
109 | */ | ||
110 | static inline u8 | ||
111 | bfa_cb_ioim_get_crn(struct bfad_ioim_s *dio) | ||
112 | { | ||
113 | return 0; | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * Get SAM-3 priority for the I/O request. 0 is default. | ||
118 | */ | ||
119 | static inline u8 | ||
120 | bfa_cb_ioim_get_priority(struct bfad_ioim_s *dio) | ||
121 | { | ||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | /* | ||
126 | * Get task attributes for the I/O request. Default is FCP_TASK_ATTR_SIMPLE(0). | ||
127 | */ | ||
128 | static inline u8 | ||
129 | bfa_cb_ioim_get_taskattr(struct bfad_ioim_s *dio) | ||
130 | { | ||
131 | struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
132 | u8 task_attr = UNTAGGED; | ||
133 | |||
134 | if (cmnd->device->tagged_supported) { | ||
135 | switch (cmnd->tag) { | ||
136 | case HEAD_OF_QUEUE_TAG: | ||
137 | task_attr = HEAD_OF_Q; | ||
138 | break; | ||
139 | case ORDERED_QUEUE_TAG: | ||
140 | task_attr = ORDERED_Q; | ||
141 | break; | ||
142 | default: | ||
143 | task_attr = SIMPLE_Q; | ||
144 | break; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | return task_attr; | ||
149 | } | ||
150 | |||
151 | /* | ||
152 | * Get CDB length in bytes for the I/O request. Default is FCP_CMND_CDB_LEN(16). | ||
153 | */ | ||
154 | static inline u8 | ||
155 | bfa_cb_ioim_get_cdblen(struct bfad_ioim_s *dio) | ||
156 | { | ||
157 | struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio; | ||
158 | |||
159 | return cmnd->cmd_len; | ||
160 | } | ||
161 | |||
162 | /* | ||
163 | * Assign queue to be used for the I/O request. This value depends on whether | ||
164 | * the driver wants to use the queues via any specific algorithm. Currently, | ||
165 | * this is not supported. | ||
166 | */ | ||
167 | #define bfa_cb_ioim_get_reqq(__dio) BFA_FALSE | ||
168 | |||
169 | #endif /* __BFA_HCB_IOIM_H__ */ | ||
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index 2345f48dc57..1cd5c8b0618 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c | |||
@@ -15,13 +15,100 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | ||
18 | #include "bfa_modules.h" | 19 | #include "bfa_modules.h" |
19 | #include "bfi_ctreg.h" | 20 | #include "bfi_ctreg.h" |
20 | #include "bfad_drv.h" | ||
21 | 21 | ||
22 | BFA_TRC_FILE(HAL, CORE); | 22 | BFA_TRC_FILE(HAL, CORE); |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * BFA module list terminated by NULL | ||
26 | */ | ||
27 | static struct bfa_module_s *hal_mods[] = { | ||
28 | &hal_mod_sgpg, | ||
29 | &hal_mod_fcport, | ||
30 | &hal_mod_fcxp, | ||
31 | &hal_mod_lps, | ||
32 | &hal_mod_uf, | ||
33 | &hal_mod_rport, | ||
34 | &hal_mod_fcpim, | ||
35 | NULL | ||
36 | }; | ||
37 | |||
38 | /* | ||
39 | * Message handlers for various modules. | ||
40 | */ | ||
41 | static bfa_isr_func_t bfa_isrs[BFI_MC_MAX] = { | ||
42 | bfa_isr_unhandled, /* NONE */ | ||
43 | bfa_isr_unhandled, /* BFI_MC_IOC */ | ||
44 | bfa_isr_unhandled, /* BFI_MC_DIAG */ | ||
45 | bfa_isr_unhandled, /* BFI_MC_FLASH */ | ||
46 | bfa_isr_unhandled, /* BFI_MC_CEE */ | ||
47 | bfa_fcport_isr, /* BFI_MC_FCPORT */ | ||
48 | bfa_isr_unhandled, /* BFI_MC_IOCFC */ | ||
49 | bfa_isr_unhandled, /* BFI_MC_LL */ | ||
50 | bfa_uf_isr, /* BFI_MC_UF */ | ||
51 | bfa_fcxp_isr, /* BFI_MC_FCXP */ | ||
52 | bfa_lps_isr, /* BFI_MC_LPS */ | ||
53 | bfa_rport_isr, /* BFI_MC_RPORT */ | ||
54 | bfa_itnim_isr, /* BFI_MC_ITNIM */ | ||
55 | bfa_isr_unhandled, /* BFI_MC_IOIM_READ */ | ||
56 | bfa_isr_unhandled, /* BFI_MC_IOIM_WRITE */ | ||
57 | bfa_isr_unhandled, /* BFI_MC_IOIM_IO */ | ||
58 | bfa_ioim_isr, /* BFI_MC_IOIM */ | ||
59 | bfa_ioim_good_comp_isr, /* BFI_MC_IOIM_IOCOM */ | ||
60 | bfa_tskim_isr, /* BFI_MC_TSKIM */ | ||
61 | bfa_isr_unhandled, /* BFI_MC_SBOOT */ | ||
62 | bfa_isr_unhandled, /* BFI_MC_IPFC */ | ||
63 | bfa_isr_unhandled, /* BFI_MC_PORT */ | ||
64 | bfa_isr_unhandled, /* --------- */ | ||
65 | bfa_isr_unhandled, /* --------- */ | ||
66 | bfa_isr_unhandled, /* --------- */ | ||
67 | bfa_isr_unhandled, /* --------- */ | ||
68 | bfa_isr_unhandled, /* --------- */ | ||
69 | bfa_isr_unhandled, /* --------- */ | ||
70 | bfa_isr_unhandled, /* --------- */ | ||
71 | bfa_isr_unhandled, /* --------- */ | ||
72 | bfa_isr_unhandled, /* --------- */ | ||
73 | bfa_isr_unhandled, /* --------- */ | ||
74 | }; | ||
75 | /* | ||
76 | * Message handlers for mailbox command classes | ||
77 | */ | ||
78 | static bfa_ioc_mbox_mcfunc_t bfa_mbox_isrs[BFI_MC_MAX] = { | ||
79 | NULL, | ||
80 | NULL, /* BFI_MC_IOC */ | ||
81 | NULL, /* BFI_MC_DIAG */ | ||
82 | NULL, /* BFI_MC_FLASH */ | ||
83 | NULL, /* BFI_MC_CEE */ | ||
84 | NULL, /* BFI_MC_PORT */ | ||
85 | bfa_iocfc_isr, /* BFI_MC_IOCFC */ | ||
86 | NULL, | ||
87 | }; | ||
88 | |||
89 | |||
90 | |||
91 | static void | ||
92 | bfa_com_port_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi) | ||
93 | { | ||
94 | struct bfa_port_s *port = &bfa->modules.port; | ||
95 | u32 dm_len; | ||
96 | u8 *dm_kva; | ||
97 | u64 dm_pa; | ||
98 | |||
99 | dm_len = bfa_port_meminfo(); | ||
100 | dm_kva = bfa_meminfo_dma_virt(mi); | ||
101 | dm_pa = bfa_meminfo_dma_phys(mi); | ||
102 | |||
103 | memset(port, 0, sizeof(struct bfa_port_s)); | ||
104 | bfa_port_attach(port, &bfa->ioc, bfa, bfa->trcmod); | ||
105 | bfa_port_mem_claim(port, dm_kva, dm_pa); | ||
106 | |||
107 | bfa_meminfo_dma_virt(mi) = dm_kva + dm_len; | ||
108 | bfa_meminfo_dma_phys(mi) = dm_pa + dm_len; | ||
109 | } | ||
110 | |||
111 | /* | ||
25 | * BFA IOC FC related definitions | 112 | * BFA IOC FC related definitions |
26 | */ | 113 | */ |
27 | 114 | ||
@@ -67,18 +154,6 @@ static struct bfa_ioc_cbfn_s bfa_iocfc_cbfn; | |||
67 | * BFA Interrupt handling functions | 154 | * BFA Interrupt handling functions |
68 | */ | 155 | */ |
69 | static void | 156 | static void |
70 | bfa_msix_errint(struct bfa_s *bfa, u32 intr) | ||
71 | { | ||
72 | bfa_ioc_error_isr(&bfa->ioc); | ||
73 | } | ||
74 | |||
75 | static void | ||
76 | bfa_msix_lpu(struct bfa_s *bfa) | ||
77 | { | ||
78 | bfa_ioc_mbox_isr(&bfa->ioc); | ||
79 | } | ||
80 | |||
81 | static void | ||
82 | bfa_reqq_resume(struct bfa_s *bfa, int qid) | 157 | bfa_reqq_resume(struct bfa_s *bfa, int qid) |
83 | { | 158 | { |
84 | struct list_head *waitq, *qe, *qen; | 159 | struct list_head *waitq, *qe, *qen; |
@@ -104,9 +179,6 @@ bfa_msix_all(struct bfa_s *bfa, int vec) | |||
104 | bfa_intx(bfa); | 179 | bfa_intx(bfa); |
105 | } | 180 | } |
106 | 181 | ||
107 | /* | ||
108 | * hal_intr_api | ||
109 | */ | ||
110 | bfa_boolean_t | 182 | bfa_boolean_t |
111 | bfa_intx(struct bfa_s *bfa) | 183 | bfa_intx(struct bfa_s *bfa) |
112 | { | 184 | { |
@@ -151,18 +223,6 @@ bfa_intx(struct bfa_s *bfa) | |||
151 | } | 223 | } |
152 | 224 | ||
153 | void | 225 | void |
154 | bfa_intx_enable(struct bfa_s *bfa) | ||
155 | { | ||
156 | writel(bfa->iocfc.intr_mask, bfa->iocfc.bfa_regs.intr_mask); | ||
157 | } | ||
158 | |||
159 | void | ||
160 | bfa_intx_disable(struct bfa_s *bfa) | ||
161 | { | ||
162 | writel(-1L, bfa->iocfc.bfa_regs.intr_mask); | ||
163 | } | ||
164 | |||
165 | void | ||
166 | bfa_isr_enable(struct bfa_s *bfa) | 226 | bfa_isr_enable(struct bfa_s *bfa) |
167 | { | 227 | { |
168 | u32 intr_unmask; | 228 | u32 intr_unmask; |
@@ -225,7 +285,7 @@ bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
225 | bfa_trc(bfa, m->mhdr.msg_class); | 285 | bfa_trc(bfa, m->mhdr.msg_class); |
226 | bfa_trc(bfa, m->mhdr.msg_id); | 286 | bfa_trc(bfa, m->mhdr.msg_id); |
227 | bfa_trc(bfa, m->mhdr.mtag.i2htok); | 287 | bfa_trc(bfa, m->mhdr.mtag.i2htok); |
228 | bfa_assert(0); | 288 | WARN_ON(1); |
229 | bfa_trc_stop(bfa->trcmod); | 289 | bfa_trc_stop(bfa->trcmod); |
230 | } | 290 | } |
231 | 291 | ||
@@ -236,8 +296,6 @@ bfa_msix_rspq(struct bfa_s *bfa, int qid) | |||
236 | u32 pi, ci; | 296 | u32 pi, ci; |
237 | struct list_head *waitq; | 297 | struct list_head *waitq; |
238 | 298 | ||
239 | bfa_trc_fp(bfa, qid); | ||
240 | |||
241 | qid &= (BFI_IOC_MAX_CQS - 1); | 299 | qid &= (BFI_IOC_MAX_CQS - 1); |
242 | 300 | ||
243 | bfa->iocfc.hwif.hw_rspq_ack(bfa, qid); | 301 | bfa->iocfc.hwif.hw_rspq_ack(bfa, qid); |
@@ -245,16 +303,10 @@ bfa_msix_rspq(struct bfa_s *bfa, int qid) | |||
245 | ci = bfa_rspq_ci(bfa, qid); | 303 | ci = bfa_rspq_ci(bfa, qid); |
246 | pi = bfa_rspq_pi(bfa, qid); | 304 | pi = bfa_rspq_pi(bfa, qid); |
247 | 305 | ||
248 | bfa_trc_fp(bfa, ci); | ||
249 | bfa_trc_fp(bfa, pi); | ||
250 | |||
251 | if (bfa->rme_process) { | 306 | if (bfa->rme_process) { |
252 | while (ci != pi) { | 307 | while (ci != pi) { |
253 | m = bfa_rspq_elem(bfa, qid, ci); | 308 | m = bfa_rspq_elem(bfa, qid, ci); |
254 | bfa_assert_fp(m->mhdr.msg_class < BFI_MC_MAX); | ||
255 | |||
256 | bfa_isrs[m->mhdr.msg_class] (bfa, m); | 309 | bfa_isrs[m->mhdr.msg_class] (bfa, m); |
257 | |||
258 | CQ_INCR(ci, bfa->iocfc.cfg.drvcfg.num_rspq_elems); | 310 | CQ_INCR(ci, bfa->iocfc.cfg.drvcfg.num_rspq_elems); |
259 | } | 311 | } |
260 | } | 312 | } |
@@ -282,7 +334,7 @@ bfa_msix_lpu_err(struct bfa_s *bfa, int vec) | |||
282 | intr = readl(bfa->iocfc.bfa_regs.intr_status); | 334 | intr = readl(bfa->iocfc.bfa_regs.intr_status); |
283 | 335 | ||
284 | if (intr & (__HFN_INT_MBOX_LPU0 | __HFN_INT_MBOX_LPU1)) | 336 | if (intr & (__HFN_INT_MBOX_LPU0 | __HFN_INT_MBOX_LPU1)) |
285 | bfa_msix_lpu(bfa); | 337 | bfa_ioc_mbox_isr(&bfa->ioc); |
286 | 338 | ||
287 | intr &= (__HFN_INT_ERR_EMC | __HFN_INT_ERR_LPU0 | | 339 | intr &= (__HFN_INT_ERR_EMC | __HFN_INT_ERR_LPU0 | |
288 | __HFN_INT_ERR_LPU1 | __HFN_INT_ERR_PSS | __HFN_INT_LL_HALT); | 340 | __HFN_INT_ERR_LPU1 | __HFN_INT_ERR_PSS | __HFN_INT_LL_HALT); |
@@ -313,22 +365,16 @@ bfa_msix_lpu_err(struct bfa_s *bfa, int vec) | |||
313 | } | 365 | } |
314 | 366 | ||
315 | writel(intr, bfa->iocfc.bfa_regs.intr_status); | 367 | writel(intr, bfa->iocfc.bfa_regs.intr_status); |
316 | bfa_msix_errint(bfa, intr); | 368 | bfa_ioc_error_isr(&bfa->ioc); |
317 | } | 369 | } |
318 | } | 370 | } |
319 | 371 | ||
320 | void | ||
321 | bfa_isr_bind(enum bfi_mclass mc, bfa_isr_func_t isr_func) | ||
322 | { | ||
323 | bfa_isrs[mc] = isr_func; | ||
324 | } | ||
325 | |||
326 | /* | 372 | /* |
327 | * BFA IOC FC related functions | 373 | * BFA IOC FC related functions |
328 | */ | 374 | */ |
329 | 375 | ||
330 | /* | 376 | /* |
331 | * hal_ioc_pvt BFA IOC private functions | 377 | * BFA IOC private functions |
332 | */ | 378 | */ |
333 | 379 | ||
334 | static void | 380 | static void |
@@ -379,7 +425,7 @@ bfa_iocfc_send_cfg(void *bfa_arg) | |||
379 | struct bfa_iocfc_cfg_s *cfg = &iocfc->cfg; | 425 | struct bfa_iocfc_cfg_s *cfg = &iocfc->cfg; |
380 | int i; | 426 | int i; |
381 | 427 | ||
382 | bfa_assert(cfg->fwcfg.num_cqs <= BFI_IOC_MAX_CQS); | 428 | WARN_ON(cfg->fwcfg.num_cqs > BFI_IOC_MAX_CQS); |
383 | bfa_trc(bfa, cfg->fwcfg.num_cqs); | 429 | bfa_trc(bfa, cfg->fwcfg.num_cqs); |
384 | 430 | ||
385 | bfa_iocfc_reset_queues(bfa); | 431 | bfa_iocfc_reset_queues(bfa); |
@@ -488,8 +534,8 @@ bfa_iocfc_mem_claim(struct bfa_s *bfa, struct bfa_iocfc_cfg_s *cfg, | |||
488 | * First allocate dma memory for IOC. | 534 | * First allocate dma memory for IOC. |
489 | */ | 535 | */ |
490 | bfa_ioc_mem_claim(&bfa->ioc, dm_kva, dm_pa); | 536 | bfa_ioc_mem_claim(&bfa->ioc, dm_kva, dm_pa); |
491 | dm_kva += bfa_ioc_meminfo(); | 537 | dm_kva += BFA_ROUNDUP(sizeof(struct bfi_ioc_attr_s), BFA_DMA_ALIGN_SZ); |
492 | dm_pa += bfa_ioc_meminfo(); | 538 | dm_pa += BFA_ROUNDUP(sizeof(struct bfi_ioc_attr_s), BFA_DMA_ALIGN_SZ); |
493 | 539 | ||
494 | /* | 540 | /* |
495 | * Claim DMA-able memory for the request/response queues and for shadow | 541 | * Claim DMA-able memory for the request/response queues and for shadow |
@@ -552,7 +598,7 @@ bfa_iocfc_mem_claim(struct bfa_s *bfa, struct bfa_iocfc_cfg_s *cfg, | |||
552 | bfa_meminfo_dma_virt(meminfo) = dm_kva; | 598 | bfa_meminfo_dma_virt(meminfo) = dm_kva; |
553 | bfa_meminfo_dma_phys(meminfo) = dm_pa; | 599 | bfa_meminfo_dma_phys(meminfo) = dm_pa; |
554 | 600 | ||
555 | dbgsz = bfa_ioc_debug_trcsz(bfa_auto_recover); | 601 | dbgsz = (bfa_auto_recover) ? BFA_DBG_FWTRC_LEN : 0; |
556 | if (dbgsz > 0) { | 602 | if (dbgsz > 0) { |
557 | bfa_ioc_debug_memclaim(&bfa->ioc, bfa_meminfo_kva(meminfo)); | 603 | bfa_ioc_debug_memclaim(&bfa->ioc, bfa_meminfo_kva(meminfo)); |
558 | bfa_meminfo_kva(meminfo) += dbgsz; | 604 | bfa_meminfo_kva(meminfo) += dbgsz; |
@@ -699,7 +745,7 @@ bfa_iocfc_disable_cbfn(void *bfa_arg) | |||
699 | bfa_cb_queue(bfa, &bfa->iocfc.stop_hcb_qe, bfa_iocfc_stop_cb, | 745 | bfa_cb_queue(bfa, &bfa->iocfc.stop_hcb_qe, bfa_iocfc_stop_cb, |
700 | bfa); | 746 | bfa); |
701 | else { | 747 | else { |
702 | bfa_assert(bfa->iocfc.action == BFA_IOCFC_ACT_DISABLE); | 748 | WARN_ON(bfa->iocfc.action != BFA_IOCFC_ACT_DISABLE); |
703 | bfa_cb_queue(bfa, &bfa->iocfc.dis_hcb_qe, bfa_iocfc_disable_cb, | 749 | bfa_cb_queue(bfa, &bfa->iocfc.dis_hcb_qe, bfa_iocfc_disable_cb, |
704 | bfa); | 750 | bfa); |
705 | } | 751 | } |
@@ -735,9 +781,6 @@ bfa_iocfc_reset_cbfn(void *bfa_arg) | |||
735 | bfa_isr_enable(bfa); | 781 | bfa_isr_enable(bfa); |
736 | } | 782 | } |
737 | 783 | ||
738 | /* | ||
739 | * hal_ioc_public | ||
740 | */ | ||
741 | 784 | ||
742 | /* | 785 | /* |
743 | * Query IOC memory requirement information. | 786 | * Query IOC memory requirement information. |
@@ -747,11 +790,11 @@ bfa_iocfc_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, | |||
747 | u32 *dm_len) | 790 | u32 *dm_len) |
748 | { | 791 | { |
749 | /* dma memory for IOC */ | 792 | /* dma memory for IOC */ |
750 | *dm_len += bfa_ioc_meminfo(); | 793 | *dm_len += BFA_ROUNDUP(sizeof(struct bfi_ioc_attr_s), BFA_DMA_ALIGN_SZ); |
751 | 794 | ||
752 | bfa_iocfc_fw_cfg_sz(cfg, dm_len); | 795 | bfa_iocfc_fw_cfg_sz(cfg, dm_len); |
753 | bfa_iocfc_cqs_sz(cfg, dm_len); | 796 | bfa_iocfc_cqs_sz(cfg, dm_len); |
754 | *km_len += bfa_ioc_debug_trcsz(bfa_auto_recover); | 797 | *km_len += (bfa_auto_recover) ? BFA_DBG_FWTRC_LEN : 0; |
755 | } | 798 | } |
756 | 799 | ||
757 | /* | 800 | /* |
@@ -783,7 +826,7 @@ bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
783 | 826 | ||
784 | bfa_iocfc_init_mem(bfa, bfad, cfg, pcidev); | 827 | bfa_iocfc_init_mem(bfa, bfad, cfg, pcidev); |
785 | bfa_iocfc_mem_claim(bfa, cfg, meminfo); | 828 | bfa_iocfc_mem_claim(bfa, cfg, meminfo); |
786 | bfa_timer_init(&bfa->timer_mod); | 829 | INIT_LIST_HEAD(&bfa->timer_mod.timer_q); |
787 | 830 | ||
788 | INIT_LIST_HEAD(&bfa->comp_q); | 831 | INIT_LIST_HEAD(&bfa->comp_q); |
789 | for (i = 0; i < BFI_IOC_MAX_CQS; i++) | 832 | for (i = 0; i < BFI_IOC_MAX_CQS; i++) |
@@ -794,15 +837,6 @@ bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
794 | * Query IOC memory requirement information. | 837 | * Query IOC memory requirement information. |
795 | */ | 838 | */ |
796 | void | 839 | void |
797 | bfa_iocfc_detach(struct bfa_s *bfa) | ||
798 | { | ||
799 | bfa_ioc_detach(&bfa->ioc); | ||
800 | } | ||
801 | |||
802 | /* | ||
803 | * Query IOC memory requirement information. | ||
804 | */ | ||
805 | void | ||
806 | bfa_iocfc_init(struct bfa_s *bfa) | 840 | bfa_iocfc_init(struct bfa_s *bfa) |
807 | { | 841 | { |
808 | bfa->iocfc.action = BFA_IOCFC_ACT_INIT; | 842 | bfa->iocfc.action = BFA_IOCFC_ACT_INIT; |
@@ -852,23 +886,11 @@ bfa_iocfc_isr(void *bfaarg, struct bfi_mbmsg_s *m) | |||
852 | iocfc->updateq_cbfn(iocfc->updateq_cbarg, BFA_STATUS_OK); | 886 | iocfc->updateq_cbfn(iocfc->updateq_cbarg, BFA_STATUS_OK); |
853 | break; | 887 | break; |
854 | default: | 888 | default: |
855 | bfa_assert(0); | 889 | WARN_ON(1); |
856 | } | 890 | } |
857 | } | 891 | } |
858 | 892 | ||
859 | void | 893 | void |
860 | bfa_adapter_get_attr(struct bfa_s *bfa, struct bfa_adapter_attr_s *ad_attr) | ||
861 | { | ||
862 | bfa_ioc_get_adapter_attr(&bfa->ioc, ad_attr); | ||
863 | } | ||
864 | |||
865 | u64 | ||
866 | bfa_adapter_get_id(struct bfa_s *bfa) | ||
867 | { | ||
868 | return bfa_ioc_get_adid(&bfa->ioc); | ||
869 | } | ||
870 | |||
871 | void | ||
872 | bfa_iocfc_get_attr(struct bfa_s *bfa, struct bfa_iocfc_attr_s *attr) | 894 | bfa_iocfc_get_attr(struct bfa_s *bfa, struct bfa_iocfc_attr_s *attr) |
873 | { | 895 | { |
874 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; | 896 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; |
@@ -976,18 +998,6 @@ bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t *wwns) | |||
976 | memcpy(wwns, cfgrsp->bootwwns.wwn, sizeof(cfgrsp->bootwwns.wwn)); | 998 | memcpy(wwns, cfgrsp->bootwwns.wwn, sizeof(cfgrsp->bootwwns.wwn)); |
977 | } | 999 | } |
978 | 1000 | ||
979 | void | ||
980 | bfa_iocfc_get_pbc_boot_cfg(struct bfa_s *bfa, struct bfa_boot_pbc_s *pbcfg) | ||
981 | { | ||
982 | struct bfa_iocfc_s *iocfc = &bfa->iocfc; | ||
983 | struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp; | ||
984 | |||
985 | pbcfg->enable = cfgrsp->pbc_cfg.boot_enabled; | ||
986 | pbcfg->nbluns = cfgrsp->pbc_cfg.nbluns; | ||
987 | pbcfg->speed = cfgrsp->pbc_cfg.port_speed; | ||
988 | memcpy(pbcfg->pblun, cfgrsp->pbc_cfg.blun, sizeof(pbcfg->pblun)); | ||
989 | } | ||
990 | |||
991 | int | 1001 | int |
992 | bfa_iocfc_get_pbc_vports(struct bfa_s *bfa, struct bfi_pbc_vport_s *pbc_vport) | 1002 | bfa_iocfc_get_pbc_vports(struct bfa_s *bfa, struct bfi_pbc_vport_s *pbc_vport) |
993 | { | 1003 | { |
@@ -998,9 +1008,6 @@ bfa_iocfc_get_pbc_vports(struct bfa_s *bfa, struct bfi_pbc_vport_s *pbc_vport) | |||
998 | return cfgrsp->pbc_cfg.nvports; | 1008 | return cfgrsp->pbc_cfg.nvports; |
999 | } | 1009 | } |
1000 | 1010 | ||
1001 | /* | ||
1002 | * hal_api | ||
1003 | */ | ||
1004 | 1011 | ||
1005 | /* | 1012 | /* |
1006 | * Use this function query the memory requirement of the BFA library. | 1013 | * Use this function query the memory requirement of the BFA library. |
@@ -1036,7 +1043,7 @@ bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo) | |||
1036 | int i; | 1043 | int i; |
1037 | u32 km_len = 0, dm_len = 0; | 1044 | u32 km_len = 0, dm_len = 0; |
1038 | 1045 | ||
1039 | bfa_assert((cfg != NULL) && (meminfo != NULL)); | 1046 | WARN_ON((cfg == NULL) || (meminfo == NULL)); |
1040 | 1047 | ||
1041 | memset((void *)meminfo, 0, sizeof(struct bfa_meminfo_s)); | 1048 | memset((void *)meminfo, 0, sizeof(struct bfa_meminfo_s)); |
1042 | meminfo->meminfo[BFA_MEM_TYPE_KVA - 1].mem_type = | 1049 | meminfo->meminfo[BFA_MEM_TYPE_KVA - 1].mem_type = |
@@ -1090,7 +1097,7 @@ bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
1090 | 1097 | ||
1091 | bfa->fcs = BFA_FALSE; | 1098 | bfa->fcs = BFA_FALSE; |
1092 | 1099 | ||
1093 | bfa_assert((cfg != NULL) && (meminfo != NULL)); | 1100 | WARN_ON((cfg == NULL) || (meminfo == NULL)); |
1094 | 1101 | ||
1095 | /* | 1102 | /* |
1096 | * initialize all memory pointers for iterative allocation | 1103 | * initialize all memory pointers for iterative allocation |
@@ -1129,79 +1136,7 @@ bfa_detach(struct bfa_s *bfa) | |||
1129 | 1136 | ||
1130 | for (i = 0; hal_mods[i]; i++) | 1137 | for (i = 0; hal_mods[i]; i++) |
1131 | hal_mods[i]->detach(bfa); | 1138 | hal_mods[i]->detach(bfa); |
1132 | 1139 | bfa_ioc_detach(&bfa->ioc); | |
1133 | bfa_iocfc_detach(bfa); | ||
1134 | } | ||
1135 | |||
1136 | |||
1137 | void | ||
1138 | bfa_init_trc(struct bfa_s *bfa, struct bfa_trc_mod_s *trcmod) | ||
1139 | { | ||
1140 | bfa->trcmod = trcmod; | ||
1141 | } | ||
1142 | |||
1143 | void | ||
1144 | bfa_init_plog(struct bfa_s *bfa, struct bfa_plog_s *plog) | ||
1145 | { | ||
1146 | bfa->plog = plog; | ||
1147 | } | ||
1148 | |||
1149 | /* | ||
1150 | * Initialize IOC. | ||
1151 | * | ||
1152 | * This function will return immediately, when the IOC initialization is | ||
1153 | * completed, the bfa_cb_init() will be called. | ||
1154 | * | ||
1155 | * @param[in] bfa instance | ||
1156 | * | ||
1157 | * @return void | ||
1158 | * | ||
1159 | * Special Considerations: | ||
1160 | * | ||
1161 | * @note | ||
1162 | * When this function returns, the driver should register the interrupt service | ||
1163 | * routine(s) and enable the device interrupts. If this is not done, | ||
1164 | * bfa_cb_init() will never get called | ||
1165 | */ | ||
1166 | void | ||
1167 | bfa_init(struct bfa_s *bfa) | ||
1168 | { | ||
1169 | bfa_iocfc_init(bfa); | ||
1170 | } | ||
1171 | |||
1172 | /* | ||
1173 | * Use this function initiate the IOC configuration setup. This function | ||
1174 | * will return immediately. | ||
1175 | * | ||
1176 | * @param[in] bfa instance | ||
1177 | * | ||
1178 | * @return None | ||
1179 | */ | ||
1180 | void | ||
1181 | bfa_start(struct bfa_s *bfa) | ||
1182 | { | ||
1183 | bfa_iocfc_start(bfa); | ||
1184 | } | ||
1185 | |||
1186 | /* | ||
1187 | * Use this function quiese the IOC. This function will return immediately, | ||
1188 | * when the IOC is actually stopped, the bfad->comp will be set. | ||
1189 | * | ||
1190 | * @param[in]bfa - pointer to bfa_t. | ||
1191 | * | ||
1192 | * @return None | ||
1193 | * | ||
1194 | * Special Considerations: | ||
1195 | * bfad->comp can be set before or after bfa_stop() returns. | ||
1196 | * | ||
1197 | * @note | ||
1198 | * In case of any failure, we could handle it automatically by doing a | ||
1199 | * reset and then succeed the bfa_stop() call. | ||
1200 | */ | ||
1201 | void | ||
1202 | bfa_stop(struct bfa_s *bfa) | ||
1203 | { | ||
1204 | bfa_iocfc_stop(bfa); | ||
1205 | } | 1140 | } |
1206 | 1141 | ||
1207 | void | 1142 | void |
@@ -1237,20 +1172,6 @@ bfa_comp_free(struct bfa_s *bfa, struct list_head *comp_q) | |||
1237 | } | 1172 | } |
1238 | } | 1173 | } |
1239 | 1174 | ||
1240 | void | ||
1241 | bfa_attach_fcs(struct bfa_s *bfa) | ||
1242 | { | ||
1243 | bfa->fcs = BFA_TRUE; | ||
1244 | } | ||
1245 | |||
1246 | /* | ||
1247 | * Periodic timer heart beat from driver | ||
1248 | */ | ||
1249 | void | ||
1250 | bfa_timer_tick(struct bfa_s *bfa) | ||
1251 | { | ||
1252 | bfa_timer_beat(&bfa->timer_mod); | ||
1253 | } | ||
1254 | 1175 | ||
1255 | /* | 1176 | /* |
1256 | * Return the list of PCI vendor/device id lists supported by this | 1177 | * Return the list of PCI vendor/device id lists supported by this |
@@ -1321,89 +1242,3 @@ bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg) | |||
1321 | cfg->drvcfg.num_rspq_elems = BFA_RSPQ_NELEMS_MIN; | 1242 | cfg->drvcfg.num_rspq_elems = BFA_RSPQ_NELEMS_MIN; |
1322 | cfg->drvcfg.min_cfg = BFA_TRUE; | 1243 | cfg->drvcfg.min_cfg = BFA_TRUE; |
1323 | } | 1244 | } |
1324 | |||
1325 | void | ||
1326 | bfa_get_attr(struct bfa_s *bfa, struct bfa_ioc_attr_s *ioc_attr) | ||
1327 | { | ||
1328 | bfa_ioc_get_attr(&bfa->ioc, ioc_attr); | ||
1329 | } | ||
1330 | |||
1331 | /* | ||
1332 | * Retrieve firmware trace information on IOC failure. | ||
1333 | */ | ||
1334 | bfa_status_t | ||
1335 | bfa_debug_fwsave(struct bfa_s *bfa, void *trcdata, int *trclen) | ||
1336 | { | ||
1337 | return bfa_ioc_debug_fwsave(&bfa->ioc, trcdata, trclen); | ||
1338 | } | ||
1339 | |||
1340 | /* | ||
1341 | * Clear the saved firmware trace information of an IOC. | ||
1342 | */ | ||
1343 | void | ||
1344 | bfa_debug_fwsave_clear(struct bfa_s *bfa) | ||
1345 | { | ||
1346 | bfa_ioc_debug_fwsave_clear(&bfa->ioc); | ||
1347 | } | ||
1348 | |||
1349 | /* | ||
1350 | * Fetch firmware trace data. | ||
1351 | * | ||
1352 | * @param[in] bfa BFA instance | ||
1353 | * @param[out] trcdata Firmware trace buffer | ||
1354 | * @param[in,out] trclen Firmware trace buffer len | ||
1355 | * | ||
1356 | * @retval BFA_STATUS_OK Firmware trace is fetched. | ||
1357 | * @retval BFA_STATUS_INPROGRESS Firmware trace fetch is in progress. | ||
1358 | */ | ||
1359 | bfa_status_t | ||
1360 | bfa_debug_fwtrc(struct bfa_s *bfa, void *trcdata, int *trclen) | ||
1361 | { | ||
1362 | return bfa_ioc_debug_fwtrc(&bfa->ioc, trcdata, trclen); | ||
1363 | } | ||
1364 | |||
1365 | /* | ||
1366 | * Dump firmware memory. | ||
1367 | * | ||
1368 | * @param[in] bfa BFA instance | ||
1369 | * @param[out] buf buffer for dump | ||
1370 | * @param[in,out] offset smem offset to start read | ||
1371 | * @param[in,out] buflen length of buffer | ||
1372 | * | ||
1373 | * @retval BFA_STATUS_OK Firmware memory is dumped. | ||
1374 | * @retval BFA_STATUS_INPROGRESS Firmware memory dump is in progress. | ||
1375 | */ | ||
1376 | bfa_status_t | ||
1377 | bfa_debug_fwcore(struct bfa_s *bfa, void *buf, u32 *offset, int *buflen) | ||
1378 | { | ||
1379 | return bfa_ioc_debug_fwcore(&bfa->ioc, buf, offset, buflen); | ||
1380 | } | ||
1381 | /* | ||
1382 | * Reset hw semaphore & usage cnt regs and initialize. | ||
1383 | */ | ||
1384 | void | ||
1385 | bfa_chip_reset(struct bfa_s *bfa) | ||
1386 | { | ||
1387 | bfa_ioc_ownership_reset(&bfa->ioc); | ||
1388 | bfa_ioc_pll_init(&bfa->ioc); | ||
1389 | } | ||
1390 | |||
1391 | /* | ||
1392 | * Fetch firmware statistics data. | ||
1393 | * | ||
1394 | * @param[in] bfa BFA instance | ||
1395 | * @param[out] data Firmware stats buffer | ||
1396 | * | ||
1397 | * @retval BFA_STATUS_OK Firmware trace is fetched. | ||
1398 | */ | ||
1399 | bfa_status_t | ||
1400 | bfa_fw_stats_get(struct bfa_s *bfa, void *data) | ||
1401 | { | ||
1402 | return bfa_ioc_fw_stats_get(&bfa->ioc, data); | ||
1403 | } | ||
1404 | |||
1405 | bfa_status_t | ||
1406 | bfa_fw_stats_clear(struct bfa_s *bfa) | ||
1407 | { | ||
1408 | return bfa_ioc_fw_stats_clear(&bfa->ioc); | ||
1409 | } | ||
diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h index 99f242b9aa3..12bfeed268e 100644 --- a/drivers/scsi/bfa/bfa_cs.h +++ b/drivers/scsi/bfa/bfa_cs.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #ifndef __BFA_CS_H__ | 22 | #ifndef __BFA_CS_H__ |
23 | #define __BFA_CS_H__ | 23 | #define __BFA_CS_H__ |
24 | 24 | ||
25 | #include "bfa_os_inc.h" | 25 | #include "bfad_drv.h" |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * BFA TRC | 28 | * BFA TRC |
@@ -32,12 +32,20 @@ | |||
32 | #define BFA_TRC_MAX (4 * 1024) | 32 | #define BFA_TRC_MAX (4 * 1024) |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #define BFA_TRC_TS(_trcm) \ | ||
36 | ({ \ | ||
37 | struct timeval tv; \ | ||
38 | \ | ||
39 | do_gettimeofday(&tv); \ | ||
40 | (tv.tv_sec*1000000+tv.tv_usec); \ | ||
41 | }) | ||
42 | |||
35 | #ifndef BFA_TRC_TS | 43 | #ifndef BFA_TRC_TS |
36 | #define BFA_TRC_TS(_trcm) ((_trcm)->ticks++) | 44 | #define BFA_TRC_TS(_trcm) ((_trcm)->ticks++) |
37 | #endif | 45 | #endif |
38 | 46 | ||
39 | struct bfa_trc_s { | 47 | struct bfa_trc_s { |
40 | #ifdef __BIGENDIAN | 48 | #ifdef __BIG_ENDIAN |
41 | u16 fileno; | 49 | u16 fileno; |
42 | u16 line; | 50 | u16 line; |
43 | #else | 51 | #else |
@@ -99,13 +107,6 @@ bfa_trc_stop(struct bfa_trc_mod_s *trcm) | |||
99 | trcm->stopped = 1; | 107 | trcm->stopped = 1; |
100 | } | 108 | } |
101 | 109 | ||
102 | #ifdef FWTRC | ||
103 | extern void dc_flush(void *data); | ||
104 | #else | ||
105 | #define dc_flush(data) | ||
106 | #endif | ||
107 | |||
108 | |||
109 | static inline void | 110 | static inline void |
110 | __bfa_trc(struct bfa_trc_mod_s *trcm, int fileno, int line, u64 data) | 111 | __bfa_trc(struct bfa_trc_mod_s *trcm, int fileno, int line, u64 data) |
111 | { | 112 | { |
@@ -119,12 +120,10 @@ __bfa_trc(struct bfa_trc_mod_s *trcm, int fileno, int line, u64 data) | |||
119 | trc->line = (u16) line; | 120 | trc->line = (u16) line; |
120 | trc->data.u64 = data; | 121 | trc->data.u64 = data; |
121 | trc->timestamp = BFA_TRC_TS(trcm); | 122 | trc->timestamp = BFA_TRC_TS(trcm); |
122 | dc_flush(trc); | ||
123 | 123 | ||
124 | trcm->tail = (trcm->tail + 1) & (BFA_TRC_MAX - 1); | 124 | trcm->tail = (trcm->tail + 1) & (BFA_TRC_MAX - 1); |
125 | if (trcm->tail == trcm->head) | 125 | if (trcm->tail == trcm->head) |
126 | trcm->head = (trcm->head + 1) & (BFA_TRC_MAX - 1); | 126 | trcm->head = (trcm->head + 1) & (BFA_TRC_MAX - 1); |
127 | dc_flush(trcm); | ||
128 | } | 127 | } |
129 | 128 | ||
130 | 129 | ||
@@ -141,42 +140,18 @@ __bfa_trc32(struct bfa_trc_mod_s *trcm, int fileno, int line, u32 data) | |||
141 | trc->line = (u16) line; | 140 | trc->line = (u16) line; |
142 | trc->data.u32.u32 = data; | 141 | trc->data.u32.u32 = data; |
143 | trc->timestamp = BFA_TRC_TS(trcm); | 142 | trc->timestamp = BFA_TRC_TS(trcm); |
144 | dc_flush(trc); | ||
145 | 143 | ||
146 | trcm->tail = (trcm->tail + 1) & (BFA_TRC_MAX - 1); | 144 | trcm->tail = (trcm->tail + 1) & (BFA_TRC_MAX - 1); |
147 | if (trcm->tail == trcm->head) | 145 | if (trcm->tail == trcm->head) |
148 | trcm->head = (trcm->head + 1) & (BFA_TRC_MAX - 1); | 146 | trcm->head = (trcm->head + 1) & (BFA_TRC_MAX - 1); |
149 | dc_flush(trcm); | ||
150 | } | 147 | } |
151 | 148 | ||
152 | #ifndef BFA_PERF_BUILD | ||
153 | #define bfa_trc_fp(_trcp, _data) bfa_trc(_trcp, _data) | ||
154 | #else | ||
155 | #define bfa_trc_fp(_trcp, _data) | ||
156 | #endif | ||
157 | |||
158 | /* | ||
159 | * @ BFA LOG interfaces | ||
160 | */ | ||
161 | #define bfa_assert(__cond) do { \ | ||
162 | if (!(__cond)) { \ | ||
163 | printk(KERN_ERR "assert(%s) failed at %s:%d\\n", \ | ||
164 | #__cond, __FILE__, __LINE__); \ | ||
165 | } \ | ||
166 | } while (0) | ||
167 | |||
168 | #define bfa_sm_fault(__mod, __event) do { \ | 149 | #define bfa_sm_fault(__mod, __event) do { \ |
169 | bfa_trc(__mod, (((u32)0xDEAD << 16) | __event)); \ | 150 | bfa_trc(__mod, (((u32)0xDEAD << 16) | __event)); \ |
170 | printk(KERN_ERR "Assertion failure: %s:%d: %d", \ | 151 | printk(KERN_ERR "Assertion failure: %s:%d: %d", \ |
171 | __FILE__, __LINE__, (__event)); \ | 152 | __FILE__, __LINE__, (__event)); \ |
172 | } while (0) | 153 | } while (0) |
173 | 154 | ||
174 | #ifndef BFA_PERF_BUILD | ||
175 | #define bfa_assert_fp(__cond) bfa_assert(__cond) | ||
176 | #else | ||
177 | #define bfa_assert_fp(__cond) | ||
178 | #endif | ||
179 | |||
180 | /* BFA queue definitions */ | 155 | /* BFA queue definitions */ |
181 | #define bfa_q_first(_q) ((void *)(((struct list_head *) (_q))->next)) | 156 | #define bfa_q_first(_q) ((void *)(((struct list_head *) (_q))->next)) |
182 | #define bfa_q_next(_qe) (((struct list_head *) (_qe))->next) | 157 | #define bfa_q_next(_qe) (((struct list_head *) (_qe))->next) |
@@ -199,7 +174,6 @@ __bfa_trc32(struct bfa_trc_mod_s *trcm, int fileno, int line, u32 data) | |||
199 | bfa_q_prev(bfa_q_next(*((struct list_head **) _qe))) = \ | 174 | bfa_q_prev(bfa_q_next(*((struct list_head **) _qe))) = \ |
200 | (struct list_head *) (_q); \ | 175 | (struct list_head *) (_q); \ |
201 | bfa_q_next(_q) = bfa_q_next(*((struct list_head **) _qe));\ | 176 | bfa_q_next(_q) = bfa_q_next(*((struct list_head **) _qe));\ |
202 | BFA_Q_DBG_INIT(*((struct list_head **) _qe)); \ | ||
203 | } else { \ | 177 | } else { \ |
204 | *((struct list_head **) (_qe)) = (struct list_head *) NULL;\ | 178 | *((struct list_head **) (_qe)) = (struct list_head *) NULL;\ |
205 | } \ | 179 | } \ |
@@ -214,7 +188,6 @@ __bfa_trc32(struct bfa_trc_mod_s *trcm, int fileno, int line, u32 data) | |||
214 | bfa_q_next(bfa_q_prev(*((struct list_head **) _qe))) = \ | 188 | bfa_q_next(bfa_q_prev(*((struct list_head **) _qe))) = \ |
215 | (struct list_head *) (_q); \ | 189 | (struct list_head *) (_q); \ |
216 | bfa_q_prev(_q) = bfa_q_prev(*(struct list_head **) _qe);\ | 190 | bfa_q_prev(_q) = bfa_q_prev(*(struct list_head **) _qe);\ |
217 | BFA_Q_DBG_INIT(*((struct list_head **) _qe)); \ | ||
218 | } else { \ | 191 | } else { \ |
219 | *((struct list_head **) (_qe)) = (struct list_head *) NULL;\ | 192 | *((struct list_head **) (_qe)) = (struct list_head *) NULL;\ |
220 | } \ | 193 | } \ |
@@ -236,16 +209,6 @@ bfa_q_is_on_q_func(struct list_head *q, struct list_head *qe) | |||
236 | return 0; | 209 | return 0; |
237 | } | 210 | } |
238 | 211 | ||
239 | /* | ||
240 | * #ifdef BFA_DEBUG (Using bfa_assert to check for debug_build is not | ||
241 | * consistent across modules) | ||
242 | */ | ||
243 | #ifndef BFA_PERF_BUILD | ||
244 | #define BFA_Q_DBG_INIT(_qe) bfa_q_qe_init(_qe) | ||
245 | #else | ||
246 | #define BFA_Q_DBG_INIT(_qe) | ||
247 | #endif | ||
248 | |||
249 | #define bfa_q_is_on_q(_q, _qe) \ | 212 | #define bfa_q_is_on_q(_q, _qe) \ |
250 | bfa_q_is_on_q_func(_q, (struct list_head *)(_qe)) | 213 | bfa_q_is_on_q_func(_q, (struct list_head *)(_qe)) |
251 | 214 | ||
@@ -361,4 +324,43 @@ bfa_wc_wait(struct bfa_wc_s *wc) | |||
361 | bfa_wc_down(wc); | 324 | bfa_wc_down(wc); |
362 | } | 325 | } |
363 | 326 | ||
327 | static inline void | ||
328 | wwn2str(char *wwn_str, u64 wwn) | ||
329 | { | ||
330 | union { | ||
331 | u64 wwn; | ||
332 | u8 byte[8]; | ||
333 | } w; | ||
334 | |||
335 | w.wwn = wwn; | ||
336 | sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", w.byte[0], | ||
337 | w.byte[1], w.byte[2], w.byte[3], w.byte[4], w.byte[5], | ||
338 | w.byte[6], w.byte[7]); | ||
339 | } | ||
340 | |||
341 | static inline void | ||
342 | fcid2str(char *fcid_str, u32 fcid) | ||
343 | { | ||
344 | union { | ||
345 | u32 fcid; | ||
346 | u8 byte[4]; | ||
347 | } f; | ||
348 | |||
349 | f.fcid = fcid; | ||
350 | sprintf(fcid_str, "%02x:%02x:%02x", f.byte[1], f.byte[2], f.byte[3]); | ||
351 | } | ||
352 | |||
353 | #define bfa_swap_3b(_x) \ | ||
354 | ((((_x) & 0xff) << 16) | \ | ||
355 | ((_x) & 0x00ff00) | \ | ||
356 | (((_x) & 0xff0000) >> 16)) | ||
357 | |||
358 | #ifndef __BIG_ENDIAN | ||
359 | #define bfa_hton3b(_x) bfa_swap_3b(_x) | ||
360 | #else | ||
361 | #define bfa_hton3b(_x) (_x) | ||
362 | #endif | ||
363 | |||
364 | #define bfa_ntoh3b(_x) bfa_hton3b(_x) | ||
365 | |||
364 | #endif /* __BFA_CS_H__ */ | 366 | #endif /* __BFA_CS_H__ */ |
diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h index 4b5b9e35abb..d85f93aea46 100644 --- a/drivers/scsi/bfa/bfa_defs.h +++ b/drivers/scsi/bfa/bfa_defs.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #define __BFA_DEFS_H__ | 19 | #define __BFA_DEFS_H__ |
20 | 20 | ||
21 | #include "bfa_fc.h" | 21 | #include "bfa_fc.h" |
22 | #include "bfa_os_inc.h" | 22 | #include "bfad_drv.h" |
23 | 23 | ||
24 | #define BFA_MFG_SERIALNUM_SIZE 11 | 24 | #define BFA_MFG_SERIALNUM_SIZE 11 |
25 | #define STRSZ(_n) (((_n) + 4) & ~3) | 25 | #define STRSZ(_n) (((_n) + 4) & ~3) |
@@ -446,8 +446,8 @@ enum bfa_boot_bootopt { | |||
446 | * Boot lun information. | 446 | * Boot lun information. |
447 | */ | 447 | */ |
448 | struct bfa_boot_bootlun_s { | 448 | struct bfa_boot_bootlun_s { |
449 | wwn_t pwwn; /* port wwn of target */ | 449 | wwn_t pwwn; /* port wwn of target */ |
450 | lun_t lun; /* 64-bit lun */ | 450 | struct scsi_lun lun; /* 64-bit lun */ |
451 | }; | 451 | }; |
452 | #pragma pack() | 452 | #pragma pack() |
453 | 453 | ||
diff --git a/drivers/scsi/bfa/bfa_defs_svc.h b/drivers/scsi/bfa/bfa_defs_svc.h index e24e9f7ca81..648c8417672 100644 --- a/drivers/scsi/bfa/bfa_defs_svc.h +++ b/drivers/scsi/bfa/bfa_defs_svc.h | |||
@@ -34,8 +34,8 @@ | |||
34 | struct bfa_iocfc_intr_attr_s { | 34 | struct bfa_iocfc_intr_attr_s { |
35 | u8 coalesce; /* enable/disable coalescing */ | 35 | u8 coalesce; /* enable/disable coalescing */ |
36 | u8 rsvd[3]; | 36 | u8 rsvd[3]; |
37 | u16 latency; /* latency in microseconds */ | 37 | __be16 latency; /* latency in microseconds */ |
38 | u16 delay; /* delay in microseconds */ | 38 | __be16 delay; /* delay in microseconds */ |
39 | }; | 39 | }; |
40 | 40 | ||
41 | /* | 41 | /* |
@@ -743,7 +743,7 @@ struct bfa_port_cfg_s { | |||
743 | u8 qos_enabled; /* qos enabled or not */ | 743 | u8 qos_enabled; /* qos enabled or not */ |
744 | u8 cfg_hardalpa; /* is hard alpa configured */ | 744 | u8 cfg_hardalpa; /* is hard alpa configured */ |
745 | u8 hardalpa; /* configured hard alpa */ | 745 | u8 hardalpa; /* configured hard alpa */ |
746 | u16 maxfrsize; /* maximum frame size */ | 746 | __be16 maxfrsize; /* maximum frame size */ |
747 | u8 rx_bbcredit; /* receive buffer credits */ | 747 | u8 rx_bbcredit; /* receive buffer credits */ |
748 | u8 tx_bbcredit; /* transmit buffer credits */ | 748 | u8 tx_bbcredit; /* transmit buffer credits */ |
749 | u8 ratelimit; /* ratelimit enabled or not */ | 749 | u8 ratelimit; /* ratelimit enabled or not */ |
@@ -843,7 +843,7 @@ struct bfa_fcport_fcf_s { | |||
843 | u8 fka_disabled; /* FKA is disabled */ | 843 | u8 fka_disabled; /* FKA is disabled */ |
844 | u8 maxsz_verified; /* FCoE max size verified */ | 844 | u8 maxsz_verified; /* FCoE max size verified */ |
845 | u8 fc_map[3]; /* FC map */ | 845 | u8 fc_map[3]; /* FC map */ |
846 | u16 vlan; /* FCoE vlan tag/priority */ | 846 | __be16 vlan; /* FCoE vlan tag/priority */ |
847 | u32 fka_adv_per; /* FIP ka advert. period */ | 847 | u32 fka_adv_per; /* FIP ka advert. period */ |
848 | mac_t mac; /* FCF mac */ | 848 | mac_t mac; /* FCF mac */ |
849 | }; | 849 | }; |
diff --git a/drivers/scsi/bfa/bfa_drv.c b/drivers/scsi/bfa/bfa_drv.c deleted file mode 100644 index 0222d7c88a9..00000000000 --- a/drivers/scsi/bfa/bfa_drv.c +++ /dev/null | |||
@@ -1,107 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. | ||
3 | * All rights reserved | ||
4 | * www.brocade.com | ||
5 | * | ||
6 | * Linux driver for Brocade Fibre Channel Host Bus Adapter. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License (GPL) Version 2 as | ||
10 | * published by the Free Software Foundation | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #include "bfa_modules.h" | ||
19 | |||
20 | /* | ||
21 | * BFA module list terminated by NULL | ||
22 | */ | ||
23 | struct bfa_module_s *hal_mods[] = { | ||
24 | &hal_mod_sgpg, | ||
25 | &hal_mod_fcport, | ||
26 | &hal_mod_fcxp, | ||
27 | &hal_mod_lps, | ||
28 | &hal_mod_uf, | ||
29 | &hal_mod_rport, | ||
30 | &hal_mod_fcpim, | ||
31 | NULL | ||
32 | }; | ||
33 | |||
34 | /* | ||
35 | * Message handlers for various modules. | ||
36 | */ | ||
37 | bfa_isr_func_t bfa_isrs[BFI_MC_MAX] = { | ||
38 | bfa_isr_unhandled, /* NONE */ | ||
39 | bfa_isr_unhandled, /* BFI_MC_IOC */ | ||
40 | bfa_isr_unhandled, /* BFI_MC_DIAG */ | ||
41 | bfa_isr_unhandled, /* BFI_MC_FLASH */ | ||
42 | bfa_isr_unhandled, /* BFI_MC_CEE */ | ||
43 | bfa_fcport_isr, /* BFI_MC_FCPORT */ | ||
44 | bfa_isr_unhandled, /* BFI_MC_IOCFC */ | ||
45 | bfa_isr_unhandled, /* BFI_MC_LL */ | ||
46 | bfa_uf_isr, /* BFI_MC_UF */ | ||
47 | bfa_fcxp_isr, /* BFI_MC_FCXP */ | ||
48 | bfa_lps_isr, /* BFI_MC_LPS */ | ||
49 | bfa_rport_isr, /* BFI_MC_RPORT */ | ||
50 | bfa_itnim_isr, /* BFI_MC_ITNIM */ | ||
51 | bfa_isr_unhandled, /* BFI_MC_IOIM_READ */ | ||
52 | bfa_isr_unhandled, /* BFI_MC_IOIM_WRITE */ | ||
53 | bfa_isr_unhandled, /* BFI_MC_IOIM_IO */ | ||
54 | bfa_ioim_isr, /* BFI_MC_IOIM */ | ||
55 | bfa_ioim_good_comp_isr, /* BFI_MC_IOIM_IOCOM */ | ||
56 | bfa_tskim_isr, /* BFI_MC_TSKIM */ | ||
57 | bfa_isr_unhandled, /* BFI_MC_SBOOT */ | ||
58 | bfa_isr_unhandled, /* BFI_MC_IPFC */ | ||
59 | bfa_isr_unhandled, /* BFI_MC_PORT */ | ||
60 | bfa_isr_unhandled, /* --------- */ | ||
61 | bfa_isr_unhandled, /* --------- */ | ||
62 | bfa_isr_unhandled, /* --------- */ | ||
63 | bfa_isr_unhandled, /* --------- */ | ||
64 | bfa_isr_unhandled, /* --------- */ | ||
65 | bfa_isr_unhandled, /* --------- */ | ||
66 | bfa_isr_unhandled, /* --------- */ | ||
67 | bfa_isr_unhandled, /* --------- */ | ||
68 | bfa_isr_unhandled, /* --------- */ | ||
69 | bfa_isr_unhandled, /* --------- */ | ||
70 | }; | ||
71 | |||
72 | |||
73 | /* | ||
74 | * Message handlers for mailbox command classes | ||
75 | */ | ||
76 | bfa_ioc_mbox_mcfunc_t bfa_mbox_isrs[BFI_MC_MAX] = { | ||
77 | NULL, | ||
78 | NULL, /* BFI_MC_IOC */ | ||
79 | NULL, /* BFI_MC_DIAG */ | ||
80 | NULL, /* BFI_MC_FLASH */ | ||
81 | NULL, /* BFI_MC_CEE */ | ||
82 | NULL, /* BFI_MC_PORT */ | ||
83 | bfa_iocfc_isr, /* BFI_MC_IOCFC */ | ||
84 | NULL, | ||
85 | }; | ||
86 | |||
87 | |||
88 | |||
89 | void | ||
90 | bfa_com_port_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi) | ||
91 | { | ||
92 | struct bfa_port_s *port = &bfa->modules.port; | ||
93 | u32 dm_len; | ||
94 | u8 *dm_kva; | ||
95 | u64 dm_pa; | ||
96 | |||
97 | dm_len = bfa_port_meminfo(); | ||
98 | dm_kva = bfa_meminfo_dma_virt(mi); | ||
99 | dm_pa = bfa_meminfo_dma_phys(mi); | ||
100 | |||
101 | memset(port, 0, sizeof(struct bfa_port_s)); | ||
102 | bfa_port_attach(port, &bfa->ioc, bfa, bfa->trcmod); | ||
103 | bfa_port_mem_claim(port, dm_kva, dm_pa); | ||
104 | |||
105 | bfa_meminfo_dma_virt(mi) = dm_kva + dm_len; | ||
106 | bfa_meminfo_dma_phys(mi) = dm_pa + dm_len; | ||
107 | } | ||
diff --git a/drivers/scsi/bfa/bfa_fc.h b/drivers/scsi/bfa/bfa_fc.h index e929d25b09e..8e764fae8dc 100644 --- a/drivers/scsi/bfa/bfa_fc.h +++ b/drivers/scsi/bfa/bfa_fc.h | |||
@@ -18,14 +18,12 @@ | |||
18 | #ifndef __BFA_FC_H__ | 18 | #ifndef __BFA_FC_H__ |
19 | #define __BFA_FC_H__ | 19 | #define __BFA_FC_H__ |
20 | 20 | ||
21 | #include "bfa_os_inc.h" | 21 | #include "bfad_drv.h" |
22 | 22 | ||
23 | typedef u64 wwn_t; | 23 | typedef u64 wwn_t; |
24 | typedef u64 lun_t; | ||
25 | 24 | ||
26 | #define WWN_NULL (0) | 25 | #define WWN_NULL (0) |
27 | #define FC_SYMNAME_MAX 256 /* max name server symbolic name size */ | 26 | #define FC_SYMNAME_MAX 256 /* max name server symbolic name size */ |
28 | #define FC_ALPA_MAX 128 | ||
29 | 27 | ||
30 | #pragma pack(1) | 28 | #pragma pack(1) |
31 | 29 | ||
@@ -40,7 +38,6 @@ struct mac_s { u8 mac[MAC_ADDRLEN]; }; | |||
40 | struct scsi_cdb_s { | 38 | struct scsi_cdb_s { |
41 | u8 scsi_cdb[SCSI_MAX_CDBLEN]; | 39 | u8 scsi_cdb[SCSI_MAX_CDBLEN]; |
42 | }; | 40 | }; |
43 | #define scsi_cdb_t struct scsi_cdb_s | ||
44 | 41 | ||
45 | /* ------------------------------------------------------------ | 42 | /* ------------------------------------------------------------ |
46 | * SCSI status byte values | 43 | * SCSI status byte values |
@@ -63,7 +60,7 @@ struct scsi_cdb_s { | |||
63 | * Fibre Channel Header Structure (FCHS) definition | 60 | * Fibre Channel Header Structure (FCHS) definition |
64 | */ | 61 | */ |
65 | struct fchs_s { | 62 | struct fchs_s { |
66 | #ifdef __BIGENDIAN | 63 | #ifdef __BIG_ENDIAN |
67 | u32 routing:4; /* routing bits */ | 64 | u32 routing:4; /* routing bits */ |
68 | u32 cat_info:4; /* category info */ | 65 | u32 cat_info:4; /* category info */ |
69 | #else | 66 | #else |
@@ -75,34 +72,19 @@ struct fchs_s { | |||
75 | u32 cs_ctl:8; /* class specific control */ | 72 | u32 cs_ctl:8; /* class specific control */ |
76 | u32 s_id:24; /* source identifier */ | 73 | u32 s_id:24; /* source identifier */ |
77 | 74 | ||
78 | u32 type:8; /* data structure type */ | 75 | u32 type:8; /* data structure type */ |
79 | u32 f_ctl:24; /* initial frame control */ | 76 | u32 f_ctl:24; /* initial frame control */ |
80 | 77 | ||
81 | u8 seq_id; /* sequence identifier */ | 78 | u8 seq_id; /* sequence identifier */ |
82 | u8 df_ctl; /* data field control */ | 79 | u8 df_ctl; /* data field control */ |
83 | u16 seq_cnt; /* sequence count */ | 80 | u16 seq_cnt; /* sequence count */ |
84 | 81 | ||
85 | u16 ox_id; /* originator exchange ID */ | 82 | __be16 ox_id; /* originator exchange ID */ |
86 | u16 rx_id; /* responder exchange ID */ | 83 | u16 rx_id; /* responder exchange ID */ |
87 | 84 | ||
88 | u32 ro; /* relative offset */ | 85 | u32 ro; /* relative offset */ |
89 | }; | 86 | }; |
90 | 87 | ||
91 | #define FC_SOF_LEN 4 | ||
92 | #define FC_EOF_LEN 4 | ||
93 | #define FC_CRC_LEN 4 | ||
94 | |||
95 | /* | ||
96 | * Fibre Channel BB_E Header Structure | ||
97 | */ | ||
98 | struct fcbbehs_s { | ||
99 | u16 ver_rsvd; | ||
100 | u32 rsvd[2]; | ||
101 | u32 rsvd__sof; | ||
102 | }; | ||
103 | |||
104 | #define FC_SEQ_ID_MAX 256 | ||
105 | |||
106 | /* | 88 | /* |
107 | * routing bit definitions | 89 | * routing bit definitions |
108 | */ | 90 | */ |
@@ -149,22 +131,6 @@ enum { | |||
149 | }; | 131 | }; |
150 | 132 | ||
151 | /* | 133 | /* |
152 | * information category for Link Control | ||
153 | */ | ||
154 | enum { | ||
155 | FC_CAT_ACK_1 = 0x00, | ||
156 | FC_CAT_ACK_0_N = 0x01, | ||
157 | FC_CAT_P_RJT = 0x02, | ||
158 | FC_CAT_F_RJT = 0x03, | ||
159 | FC_CAT_P_BSY = 0x04, | ||
160 | FC_CAT_F_BSY_DATA = 0x05, | ||
161 | FC_CAT_F_BSY_LINK_CTL = 0x06, | ||
162 | FC_CAT_F_LCR = 0x07, | ||
163 | FC_CAT_NTY = 0x08, | ||
164 | FC_CAT_END = 0x09, | ||
165 | }; | ||
166 | |||
167 | /* | ||
168 | * Type Field Definitions. FC-PH Section 18.5 pg. 165 | 134 | * Type Field Definitions. FC-PH Section 18.5 pg. 165 |
169 | */ | 135 | */ |
170 | enum { | 136 | enum { |
@@ -182,10 +148,6 @@ enum { | |||
182 | FC_TYPE_MAX = 256, /* 256 FC-4 types */ | 148 | FC_TYPE_MAX = 256, /* 256 FC-4 types */ |
183 | }; | 149 | }; |
184 | 150 | ||
185 | struct fc_fc4types_s { | ||
186 | u8 bits[FC_TYPE_MAX / 8]; | ||
187 | }; | ||
188 | |||
189 | /* | 151 | /* |
190 | * Frame Control Definitions. FC-PH Table-45. pg. 168 | 152 | * Frame Control Definitions. FC-PH Table-45. pg. 168 |
191 | */ | 153 | */ |
@@ -288,7 +250,6 @@ enum { | |||
288 | FC_ELS_AUTH = 0x90, /* Authentication. Ref FC-SP */ | 250 | FC_ELS_AUTH = 0x90, /* Authentication. Ref FC-SP */ |
289 | FC_ELS_RFCN = 0x97, /* Request Fabric Change Notification. Ref | 251 | FC_ELS_RFCN = 0x97, /* Request Fabric Change Notification. Ref |
290 | *FC-SP */ | 252 | *FC-SP */ |
291 | |||
292 | }; | 253 | }; |
293 | 254 | ||
294 | /* | 255 | /* |
@@ -314,12 +275,12 @@ enum { | |||
314 | * FC-PH-x. Figure-76. pg. 308. | 275 | * FC-PH-x. Figure-76. pg. 308. |
315 | */ | 276 | */ |
316 | struct fc_plogi_csp_s { | 277 | struct fc_plogi_csp_s { |
317 | u8 verhi; /* FC-PH high version */ | 278 | u8 verhi; /* FC-PH high version */ |
318 | u8 verlo; /* FC-PH low version */ | 279 | u8 verlo; /* FC-PH low version */ |
319 | u16 bbcred; /* BB_Credit */ | 280 | __be16 bbcred; /* BB_Credit */ |
320 | 281 | ||
321 | #ifdef __BIGENDIAN | 282 | #ifdef __BIG_ENDIAN |
322 | u8 ciro:1, /* continuously increasing RO */ | 283 | u8 ciro:1, /* continuously increasing RO */ |
323 | rro:1, /* random relative offset */ | 284 | rro:1, /* random relative offset */ |
324 | npiv_supp:1, /* NPIV supported */ | 285 | npiv_supp:1, /* NPIV supported */ |
325 | port_type:1, /* N_Port/F_port */ | 286 | port_type:1, /* N_Port/F_port */ |
@@ -328,7 +289,7 @@ struct fc_plogi_csp_s { | |||
328 | vvl_info:1, /* VVL Info included */ | 289 | vvl_info:1, /* VVL Info included */ |
329 | reserved1:1; | 290 | reserved1:1; |
330 | 291 | ||
331 | u8 hg_supp:1, | 292 | u8 hg_supp:1, |
332 | query_dbc:1, | 293 | query_dbc:1, |
333 | security:1, | 294 | security:1, |
334 | sync_cap:1, | 295 | sync_cap:1, |
@@ -337,7 +298,7 @@ struct fc_plogi_csp_s { | |||
337 | cisc:1, /* continuously increasing seq count */ | 298 | cisc:1, /* continuously increasing seq count */ |
338 | payload:1; | 299 | payload:1; |
339 | #else | 300 | #else |
340 | u8 reserved2:2, | 301 | u8 reserved2:2, |
341 | resolution:1, /* ms/ns ED_TOV resolution */ | 302 | resolution:1, /* ms/ns ED_TOV resolution */ |
342 | altbbcred:1, /* alternate BB_Credit */ | 303 | altbbcred:1, /* alternate BB_Credit */ |
343 | port_type:1, /* N_Port/F_port */ | 304 | port_type:1, /* N_Port/F_port */ |
@@ -345,7 +306,7 @@ struct fc_plogi_csp_s { | |||
345 | rro:1, /* random relative offset */ | 306 | rro:1, /* random relative offset */ |
346 | ciro:1; /* continuously increasing RO */ | 307 | ciro:1; /* continuously increasing RO */ |
347 | 308 | ||
348 | u8 payload:1, | 309 | u8 payload:1, |
349 | cisc:1, /* continuously increasing seq count */ | 310 | cisc:1, /* continuously increasing seq count */ |
350 | dh_dup_supp:1, | 311 | dh_dup_supp:1, |
351 | r_t_tov:1, | 312 | r_t_tov:1, |
@@ -354,13 +315,10 @@ struct fc_plogi_csp_s { | |||
354 | query_dbc:1, | 315 | query_dbc:1, |
355 | hg_supp:1; | 316 | hg_supp:1; |
356 | #endif | 317 | #endif |
357 | 318 | __be16 rxsz; /* recieve data_field size */ | |
358 | u16 rxsz; /* recieve data_field size */ | 319 | __be16 conseq; |
359 | 320 | __be16 ro_bitmap; | |
360 | u16 conseq; | 321 | __be32 e_d_tov; |
361 | u16 ro_bitmap; | ||
362 | |||
363 | u32 e_d_tov; | ||
364 | }; | 322 | }; |
365 | 323 | ||
366 | /* | 324 | /* |
@@ -368,12 +326,11 @@ struct fc_plogi_csp_s { | |||
368 | * FC-PH-x. Figure 78. pg. 318. | 326 | * FC-PH-x. Figure 78. pg. 318. |
369 | */ | 327 | */ |
370 | struct fc_plogi_clp_s { | 328 | struct fc_plogi_clp_s { |
371 | #ifdef __BIGENDIAN | 329 | #ifdef __BIG_ENDIAN |
372 | u32 class_valid:1; | 330 | u32 class_valid:1; |
373 | u32 intermix:1; /* class intermix supported if set =1. | 331 | u32 intermix:1; /* class intermix supported if set =1. |
374 | * valid only for class1. Reserved for | 332 | * valid only for class1. Reserved for |
375 | * class2 & class3 | 333 | * class2 & class3 */ |
376 | */ | ||
377 | u32 reserved1:2; | 334 | u32 reserved1:2; |
378 | u32 sequential:1; | 335 | u32 sequential:1; |
379 | u32 reserved2:3; | 336 | u32 reserved2:3; |
@@ -382,12 +339,10 @@ struct fc_plogi_clp_s { | |||
382 | u32 sequential:1; | 339 | u32 sequential:1; |
383 | u32 reserved1:2; | 340 | u32 reserved1:2; |
384 | u32 intermix:1; /* class intermix supported if set =1. | 341 | u32 intermix:1; /* class intermix supported if set =1. |
385 | * valid only for class1. Reserved for | 342 | * valid only for class1. Reserved for |
386 | * class2 & class3 | 343 | * class2 & class3 */ |
387 | */ | ||
388 | u32 class_valid:1; | 344 | u32 class_valid:1; |
389 | #endif | 345 | #endif |
390 | |||
391 | u32 reserved3:24; | 346 | u32 reserved3:24; |
392 | 347 | ||
393 | u32 reserved4:16; | 348 | u32 reserved4:16; |
@@ -395,7 +350,7 @@ struct fc_plogi_clp_s { | |||
395 | 350 | ||
396 | u32 reserved5:8; | 351 | u32 reserved5:8; |
397 | u32 conseq:8; | 352 | u32 conseq:8; |
398 | u32 e2e_credit:16; /* end to end credit */ | 353 | u32 e2e_credit:16; /* end to end credit */ |
399 | 354 | ||
400 | u32 reserved7:8; | 355 | u32 reserved7:8; |
401 | u32 ospx:8; | 356 | u32 ospx:8; |
@@ -409,24 +364,24 @@ struct fc_plogi_clp_s { | |||
409 | * PLOGI els command and reply payload | 364 | * PLOGI els command and reply payload |
410 | */ | 365 | */ |
411 | struct fc_logi_s { | 366 | struct fc_logi_s { |
412 | struct fc_els_cmd_s els_cmd; /* ELS command code */ | 367 | struct fc_els_cmd_s els_cmd; /* ELS command code */ |
413 | struct fc_plogi_csp_s csp; /* common service params */ | 368 | struct fc_plogi_csp_s csp; /* common service params */ |
414 | wwn_t port_name; | 369 | wwn_t port_name; |
415 | wwn_t node_name; | 370 | wwn_t node_name; |
416 | struct fc_plogi_clp_s class1; /* class 1 service parameters */ | 371 | struct fc_plogi_clp_s class1; /* class 1 service parameters */ |
417 | struct fc_plogi_clp_s class2; /* class 2 service parameters */ | 372 | struct fc_plogi_clp_s class2; /* class 2 service parameters */ |
418 | struct fc_plogi_clp_s class3; /* class 3 service parameters */ | 373 | struct fc_plogi_clp_s class3; /* class 3 service parameters */ |
419 | struct fc_plogi_clp_s class4; /* class 4 service parameters */ | 374 | struct fc_plogi_clp_s class4; /* class 4 service parameters */ |
420 | u8 vvl[16]; /* vendor version level */ | 375 | u8 vvl[16]; /* vendor version level */ |
421 | }; | 376 | }; |
422 | 377 | ||
423 | /* | 378 | /* |
424 | * LOGO els command payload | 379 | * LOGO els command payload |
425 | */ | 380 | */ |
426 | struct fc_logo_s { | 381 | struct fc_logo_s { |
427 | struct fc_els_cmd_s els_cmd; /* ELS command code */ | 382 | struct fc_els_cmd_s els_cmd; /* ELS command code */ |
428 | u32 res1:8; | 383 | u32 res1:8; |
429 | u32 nport_id:24; /* N_Port identifier of source */ | 384 | u32 nport_id:24; /* N_Port identifier of source */ |
430 | wwn_t orig_port_name; /* Port name of the LOGO originator */ | 385 | wwn_t orig_port_name; /* Port name of the LOGO originator */ |
431 | }; | 386 | }; |
432 | 387 | ||
@@ -435,12 +390,12 @@ struct fc_logo_s { | |||
435 | */ | 390 | */ |
436 | struct fc_adisc_s { | 391 | struct fc_adisc_s { |
437 | struct fc_els_cmd_s els_cmd; /* ELS command code */ | 392 | struct fc_els_cmd_s els_cmd; /* ELS command code */ |
438 | u32 res1:8; | 393 | u32 res1:8; |
439 | u32 orig_HA:24; /* originator hard address */ | 394 | u32 orig_HA:24; /* originator hard address */ |
440 | wwn_t orig_port_name; /* originator port name */ | 395 | wwn_t orig_port_name; /* originator port name */ |
441 | wwn_t orig_node_name; /* originator node name */ | 396 | wwn_t orig_node_name; /* originator node name */ |
442 | u32 res2:8; | 397 | u32 res2:8; |
443 | u32 nport_id:24; /* originator NPortID */ | 398 | u32 nport_id:24; /* originator NPortID */ |
444 | }; | 399 | }; |
445 | 400 | ||
446 | /* | 401 | /* |
@@ -466,7 +421,7 @@ struct fc_exch_status_blk_s { | |||
466 | struct fc_res_s { | 421 | struct fc_res_s { |
467 | struct fc_els_cmd_s els_cmd; /* ELS command code */ | 422 | struct fc_els_cmd_s els_cmd; /* ELS command code */ |
468 | u32 res1:8; | 423 | u32 res1:8; |
469 | u32 nport_id:24; /* N_Port identifier of source */ | 424 | u32 nport_id:24; /* N_Port identifier of source */ |
470 | u32 oxid:16; | 425 | u32 oxid:16; |
471 | u32 rxid:16; | 426 | u32 rxid:16; |
472 | u8 assoc_hdr[32]; | 427 | u8 assoc_hdr[32]; |
@@ -512,8 +467,8 @@ struct fc_rec_acc_s { | |||
512 | u32 orig_id:24; /* N_Port id of exchange originator */ | 467 | u32 orig_id:24; /* N_Port id of exchange originator */ |
513 | u32 res2:8; | 468 | u32 res2:8; |
514 | u32 resp_id:24; /* N_Port id of exchange responder */ | 469 | u32 resp_id:24; /* N_Port id of exchange responder */ |
515 | u32 count; /* data transfer count */ | 470 | u32 count; /* data transfer count */ |
516 | u32 e_stat; /* exchange status */ | 471 | u32 e_stat; /* exchange status */ |
517 | }; | 472 | }; |
518 | 473 | ||
519 | /* | 474 | /* |
@@ -533,7 +488,7 @@ struct fc_rsi_s { | |||
533 | */ | 488 | */ |
534 | struct fc_prli_params_s { | 489 | struct fc_prli_params_s { |
535 | u32 reserved:16; | 490 | u32 reserved:16; |
536 | #ifdef __BIGENDIAN | 491 | #ifdef __BIG_ENDIAN |
537 | u32 reserved1:5; | 492 | u32 reserved1:5; |
538 | u32 rec_support:1; | 493 | u32 rec_support:1; |
539 | u32 task_retry_id:1; | 494 | u32 task_retry_id:1; |
@@ -575,7 +530,7 @@ enum { | |||
575 | struct fc_prli_params_page_s { | 530 | struct fc_prli_params_page_s { |
576 | u32 type:8; | 531 | u32 type:8; |
577 | u32 codext:8; | 532 | u32 codext:8; |
578 | #ifdef __BIGENDIAN | 533 | #ifdef __BIG_ENDIAN |
579 | u32 origprocasv:1; | 534 | u32 origprocasv:1; |
580 | u32 rsppav:1; | 535 | u32 rsppav:1; |
581 | u32 imagepair:1; | 536 | u32 imagepair:1; |
@@ -611,18 +566,14 @@ struct fc_prli_s { | |||
611 | struct fc_prlo_params_page_s { | 566 | struct fc_prlo_params_page_s { |
612 | u32 type:8; | 567 | u32 type:8; |
613 | u32 type_ext:8; | 568 | u32 type_ext:8; |
614 | #ifdef __BIGENDIAN | 569 | #ifdef __BIG_ENDIAN |
615 | u32 opa_valid:1; /* originator process associator | 570 | u32 opa_valid:1; /* originator process associator valid */ |
616 | * valid | ||
617 | */ | ||
618 | u32 rpa_valid:1; /* responder process associator valid */ | 571 | u32 rpa_valid:1; /* responder process associator valid */ |
619 | u32 res1:14; | 572 | u32 res1:14; |
620 | #else | 573 | #else |
621 | u32 res1:14; | 574 | u32 res1:14; |
622 | u32 rpa_valid:1; /* responder process associator valid */ | 575 | u32 rpa_valid:1; /* responder process associator valid */ |
623 | u32 opa_valid:1; /* originator process associator | 576 | u32 opa_valid:1; /* originator process associator valid */ |
624 | * valid | ||
625 | */ | ||
626 | #endif | 577 | #endif |
627 | u32 orig_process_assc; | 578 | u32 orig_process_assc; |
628 | u32 resp_process_assc; | 579 | u32 resp_process_assc; |
@@ -647,18 +598,14 @@ struct fc_prlo_acc_params_page_s { | |||
647 | u32 type:8; | 598 | u32 type:8; |
648 | u32 type_ext:8; | 599 | u32 type_ext:8; |
649 | 600 | ||
650 | #ifdef __BIGENDIAN | 601 | #ifdef __BIG_ENDIAN |
651 | u32 opa_valid:1; /* originator process associator | 602 | u32 opa_valid:1; /* originator process associator valid */ |
652 | * valid | ||
653 | */ | ||
654 | u32 rpa_valid:1; /* responder process associator valid */ | 603 | u32 rpa_valid:1; /* responder process associator valid */ |
655 | u32 res1:14; | 604 | u32 res1:14; |
656 | #else | 605 | #else |
657 | u32 res1:14; | 606 | u32 res1:14; |
658 | u32 rpa_valid:1; /* responder process associator valid */ | 607 | u32 rpa_valid:1; /* responder process associator valid */ |
659 | u32 opa_valid:1; /* originator process associator | 608 | u32 opa_valid:1; /* originator process associator valid */ |
660 | * valid | ||
661 | */ | ||
662 | #endif | 609 | #endif |
663 | u32 orig_process_assc; | 610 | u32 orig_process_assc; |
664 | u32 resp_process_assc; | 611 | u32 resp_process_assc; |
@@ -715,9 +662,9 @@ enum { | |||
715 | * LS_RJT els reply payload | 662 | * LS_RJT els reply payload |
716 | */ | 663 | */ |
717 | struct fc_ls_rjt_s { | 664 | struct fc_ls_rjt_s { |
718 | struct fc_els_cmd_s els_cmd; /* ELS command code */ | 665 | struct fc_els_cmd_s els_cmd; /* ELS command code */ |
719 | u32 res1:8; | 666 | u32 res1:8; |
720 | u32 reason_code:8; /* Reason code for reject */ | 667 | u32 reason_code:8; /* Reason code for reject */ |
721 | u32 reason_code_expl:8; /* Reason code explanation */ | 668 | u32 reason_code_expl:8; /* Reason code explanation */ |
722 | u32 vendor_unique:8; /* Vendor specific */ | 669 | u32 vendor_unique:8; /* Vendor specific */ |
723 | }; | 670 | }; |
@@ -779,12 +726,12 @@ struct fc_rrq_s { | |||
779 | */ | 726 | */ |
780 | struct fc_ba_acc_s { | 727 | struct fc_ba_acc_s { |
781 | u32 seq_id_valid:8; /* set to 0x00 for Abort Exchange */ | 728 | u32 seq_id_valid:8; /* set to 0x00 for Abort Exchange */ |
782 | u32 seq_id:8; /* invalid for Abort Exchange */ | 729 | u32 seq_id:8; /* invalid for Abort Exchange */ |
783 | u32 res2:16; | 730 | u32 res2:16; |
784 | u32 ox_id:16; /* OX_ID from ABTS frame */ | 731 | u32 ox_id:16; /* OX_ID from ABTS frame */ |
785 | u32 rx_id:16; /* RX_ID from ABTS frame */ | 732 | u32 rx_id:16; /* RX_ID from ABTS frame */ |
786 | u32 low_seq_cnt:16; /* set to 0x0000 for Abort Exchange */ | 733 | u32 low_seq_cnt:16; /* set to 0x0000 for Abort Exchange */ |
787 | u32 high_seq_cnt:16;/* set to 0xFFFF for Abort Exchange */ | 734 | u32 high_seq_cnt:16; /* set to 0xFFFF for Abort Exchange */ |
788 | }; | 735 | }; |
789 | 736 | ||
790 | /* | 737 | /* |
@@ -794,17 +741,17 @@ struct fc_ba_rjt_s { | |||
794 | u32 res1:8; /* Reserved */ | 741 | u32 res1:8; /* Reserved */ |
795 | u32 reason_code:8; /* reason code for reject */ | 742 | u32 reason_code:8; /* reason code for reject */ |
796 | u32 reason_expl:8; /* reason code explanation */ | 743 | u32 reason_expl:8; /* reason code explanation */ |
797 | u32 vendor_unique:8;/* vendor unique reason code,set to 0 */ | 744 | u32 vendor_unique:8; /* vendor unique reason code,set to 0 */ |
798 | }; | 745 | }; |
799 | 746 | ||
800 | /* | 747 | /* |
801 | * TPRLO logout parameter page | 748 | * TPRLO logout parameter page |
802 | */ | 749 | */ |
803 | struct fc_tprlo_params_page_s { | 750 | struct fc_tprlo_params_page_s { |
804 | u32 type:8; | 751 | u32 type:8; |
805 | u32 type_ext:8; | 752 | u32 type_ext:8; |
806 | 753 | ||
807 | #ifdef __BIGENDIAN | 754 | #ifdef __BIG_ENDIAN |
808 | u32 opa_valid:1; | 755 | u32 opa_valid:1; |
809 | u32 rpa_valid:1; | 756 | u32 rpa_valid:1; |
810 | u32 tpo_nport_valid:1; | 757 | u32 tpo_nport_valid:1; |
@@ -864,16 +811,16 @@ enum fc_rscn_format { | |||
864 | }; | 811 | }; |
865 | 812 | ||
866 | struct fc_rscn_event_s { | 813 | struct fc_rscn_event_s { |
867 | u32 format:2; | 814 | u32 format:2; |
868 | u32 qualifier:4; | 815 | u32 qualifier:4; |
869 | u32 resvd:2; | 816 | u32 resvd:2; |
870 | u32 portid:24; | 817 | u32 portid:24; |
871 | }; | 818 | }; |
872 | 819 | ||
873 | struct fc_rscn_pl_s { | 820 | struct fc_rscn_pl_s { |
874 | u8 command; | 821 | u8 command; |
875 | u8 pagelen; | 822 | u8 pagelen; |
876 | u16 payldlen; | 823 | __be16 payldlen; |
877 | struct fc_rscn_event_s event[1]; | 824 | struct fc_rscn_event_s event[1]; |
878 | }; | 825 | }; |
879 | 826 | ||
@@ -887,7 +834,6 @@ struct fc_echo_s { | |||
887 | /* | 834 | /* |
888 | * RNID els command | 835 | * RNID els command |
889 | */ | 836 | */ |
890 | |||
891 | #define RNID_NODEID_DATA_FORMAT_COMMON 0x00 | 837 | #define RNID_NODEID_DATA_FORMAT_COMMON 0x00 |
892 | #define RNID_NODEID_DATA_FORMAT_FCP3 0x08 | 838 | #define RNID_NODEID_DATA_FORMAT_FCP3 0x08 |
893 | #define RNID_NODEID_DATA_FORMAT_DISCOVERY 0xDF | 839 | #define RNID_NODEID_DATA_FORMAT_DISCOVERY 0xDF |
@@ -920,15 +866,15 @@ struct fc_rnid_cmd_s { | |||
920 | */ | 866 | */ |
921 | 867 | ||
922 | struct fc_rnid_common_id_data_s { | 868 | struct fc_rnid_common_id_data_s { |
923 | wwn_t port_name; | 869 | wwn_t port_name; |
924 | wwn_t node_name; | 870 | wwn_t node_name; |
925 | }; | 871 | }; |
926 | 872 | ||
927 | struct fc_rnid_general_topology_data_s { | 873 | struct fc_rnid_general_topology_data_s { |
928 | u32 vendor_unique[4]; | 874 | u32 vendor_unique[4]; |
929 | u32 asso_type; | 875 | __be32 asso_type; |
930 | u32 phy_port_num; | 876 | u32 phy_port_num; |
931 | u32 num_attached_nodes; | 877 | __be32 num_attached_nodes; |
932 | u32 node_mgmt:8; | 878 | u32 node_mgmt:8; |
933 | u32 ip_version:8; | 879 | u32 ip_version:8; |
934 | u32 udp_tcp_port_num:16; | 880 | u32 udp_tcp_port_num:16; |
@@ -980,59 +926,17 @@ enum fc_rpsc_op_speed { | |||
980 | RPSC_OP_SPEED_8G = 0x0800, | 926 | RPSC_OP_SPEED_8G = 0x0800, |
981 | RPSC_OP_SPEED_16G = 0x0400, | 927 | RPSC_OP_SPEED_16G = 0x0400, |
982 | 928 | ||
983 | RPSC_OP_SPEED_NOT_EST = 0x0001, /*! speed not established */ | 929 | RPSC_OP_SPEED_NOT_EST = 0x0001, /* speed not established */ |
984 | }; | 930 | }; |
985 | 931 | ||
986 | struct fc_rpsc_speed_info_s { | 932 | struct fc_rpsc_speed_info_s { |
987 | u16 port_speed_cap; /*! see enum fc_rpsc_speed_cap */ | 933 | __be16 port_speed_cap; /* see enum fc_rpsc_speed_cap */ |
988 | u16 port_op_speed; /*! see enum fc_rpsc_op_speed */ | 934 | __be16 port_op_speed; /* see enum fc_rpsc_op_speed */ |
989 | }; | ||
990 | |||
991 | enum link_e2e_beacon_subcmd { | ||
992 | LINK_E2E_BEACON_ON = 1, | ||
993 | LINK_E2E_BEACON_OFF = 2 | ||
994 | }; | ||
995 | |||
996 | enum beacon_type { | ||
997 | BEACON_TYPE_NORMAL = 1, /*! Normal Beaconing. Green */ | ||
998 | BEACON_TYPE_WARN = 2, /*! Warning Beaconing. Yellow/Amber */ | ||
999 | BEACON_TYPE_CRITICAL = 3 /*! Critical Beaconing. Red */ | ||
1000 | }; | ||
1001 | |||
1002 | struct link_e2e_beacon_param_s { | ||
1003 | u8 beacon_type; /* Beacon Type. See enum beacon_type */ | ||
1004 | u8 beacon_frequency; | ||
1005 | /* Beacon frequency. Number of blinks | ||
1006 | * per 10 seconds | ||
1007 | */ | ||
1008 | u16 beacon_duration;/* Beacon duration (in Seconds). The | ||
1009 | * command operation should be | ||
1010 | * terminated at the end of this | ||
1011 | * timeout value. | ||
1012 | * | ||
1013 | * Ignored if diag_sub_cmd is | ||
1014 | * LINK_E2E_BEACON_OFF. | ||
1015 | * | ||
1016 | * If 0, beaconing will continue till a | ||
1017 | * BEACON OFF request is received | ||
1018 | */ | ||
1019 | }; | ||
1020 | |||
1021 | /* | ||
1022 | * Link E2E beacon request/good response format. | ||
1023 | * For LS_RJTs use struct fc_ls_rjt_s | ||
1024 | */ | ||
1025 | struct link_e2e_beacon_req_s { | ||
1026 | u32 ls_code; /*! FC_ELS_E2E_LBEACON in requests * | ||
1027 | *or FC_ELS_ACC in good replies */ | ||
1028 | u32 ls_sub_cmd; /*! See enum link_e2e_beacon_subcmd */ | ||
1029 | struct link_e2e_beacon_param_s beacon_parm; | ||
1030 | }; | 935 | }; |
1031 | 936 | ||
1032 | /* | 937 | /* |
1033 | * If RPSC request is sent to the Domain Controller, the request is for | 938 | * If RPSC request is sent to the Domain Controller, the request is for |
1034 | * all the ports within that domain (TODO - I don't think FOS implements | 939 | * all the ports within that domain. |
1035 | * this...). | ||
1036 | */ | 940 | */ |
1037 | struct fc_rpsc_cmd_s { | 941 | struct fc_rpsc_cmd_s { |
1038 | struct fc_els_cmd_s els_cmd; | 942 | struct fc_els_cmd_s els_cmd; |
@@ -1056,9 +960,9 @@ struct fc_rpsc_acc_s { | |||
1056 | 960 | ||
1057 | struct fc_rpsc2_cmd_s { | 961 | struct fc_rpsc2_cmd_s { |
1058 | struct fc_els_cmd_s els_cmd; | 962 | struct fc_els_cmd_s els_cmd; |
1059 | u32 token; | 963 | __be32 token; |
1060 | u16 resvd; | 964 | u16 resvd; |
1061 | u16 num_pids; /* Number of pids in the request */ | 965 | __be16 num_pids; /* Number of pids in the request */ |
1062 | struct { | 966 | struct { |
1063 | u32 rsvd1:8; | 967 | u32 rsvd1:8; |
1064 | u32 pid:24; /* port identifier */ | 968 | u32 pid:24; /* port identifier */ |
@@ -1072,16 +976,17 @@ enum fc_rpsc2_port_type { | |||
1072 | RPSC2_PORT_TYPE_NPIV_PORT = 0x5f, | 976 | RPSC2_PORT_TYPE_NPIV_PORT = 0x5f, |
1073 | RPSC2_PORT_TYPE_NPORT_TRUNK = 0x6f, | 977 | RPSC2_PORT_TYPE_NPORT_TRUNK = 0x6f, |
1074 | }; | 978 | }; |
979 | |||
1075 | /* | 980 | /* |
1076 | * RPSC2 portInfo entry structure | 981 | * RPSC2 portInfo entry structure |
1077 | */ | 982 | */ |
1078 | struct fc_rpsc2_port_info_s { | 983 | struct fc_rpsc2_port_info_s { |
1079 | u32 pid; /* PID */ | 984 | __be32 pid; /* PID */ |
1080 | u16 resvd1; | 985 | u16 resvd1; |
1081 | u16 index; /* port number / index */ | 986 | __be16 index; /* port number / index */ |
1082 | u8 resvd2; | 987 | u8 resvd2; |
1083 | u8 type; /* port type N/NL/... */ | 988 | u8 type; /* port type N/NL/... */ |
1084 | u16 speed; /* port Operating Speed */ | 989 | __be16 speed; /* port Operating Speed */ |
1085 | }; | 990 | }; |
1086 | 991 | ||
1087 | /* | 992 | /* |
@@ -1090,8 +995,8 @@ struct fc_rpsc2_port_info_s { | |||
1090 | struct fc_rpsc2_acc_s { | 995 | struct fc_rpsc2_acc_s { |
1091 | u8 els_cmd; | 996 | u8 els_cmd; |
1092 | u8 resvd; | 997 | u8 resvd; |
1093 | u16 num_pids; /* Number of pids in the request */ | 998 | __be16 num_pids; /* Number of pids in the request */ |
1094 | struct fc_rpsc2_port_info_s port_info[1]; /* port information */ | 999 | struct fc_rpsc2_port_info_s port_info[1]; /* port information */ |
1095 | }; | 1000 | }; |
1096 | 1001 | ||
1097 | /* | 1002 | /* |
@@ -1110,18 +1015,14 @@ struct fc_symname_s { | |||
1110 | u8 symname[FC_SYMNAME_MAX]; | 1015 | u8 symname[FC_SYMNAME_MAX]; |
1111 | }; | 1016 | }; |
1112 | 1017 | ||
1113 | struct fc_alpabm_s { | ||
1114 | u8 alpa_bm[FC_ALPA_MAX / 8]; | ||
1115 | }; | ||
1116 | |||
1117 | /* | 1018 | /* |
1118 | * protocol default timeout values | 1019 | * protocol default timeout values |
1119 | */ | 1020 | */ |
1120 | #define FC_ED_TOV 2 | 1021 | #define FC_ED_TOV 2 |
1121 | #define FC_REC_TOV (FC_ED_TOV + 1) | 1022 | #define FC_REC_TOV (FC_ED_TOV + 1) |
1122 | #define FC_RA_TOV 10 | 1023 | #define FC_RA_TOV 10 |
1123 | #define FC_ELS_TOV (2 * FC_RA_TOV) | 1024 | #define FC_ELS_TOV (2 * FC_RA_TOV) |
1124 | #define FC_FCCT_TOV (3 * FC_RA_TOV) | 1025 | #define FC_FCCT_TOV (3 * FC_RA_TOV) |
1125 | 1026 | ||
1126 | /* | 1027 | /* |
1127 | * virtual fabric related defines | 1028 | * virtual fabric related defines |
@@ -1157,50 +1058,34 @@ enum { | |||
1157 | }; | 1058 | }; |
1158 | 1059 | ||
1159 | /* | 1060 | /* |
1160 | * SRR FC-4 LS payload | ||
1161 | */ | ||
1162 | struct fc_srr_s { | ||
1163 | u32 ls_cmd; | ||
1164 | u32 ox_id:16; /* ox-id */ | ||
1165 | u32 rx_id:16; /* rx-id */ | ||
1166 | u32 ro; /* relative offset */ | ||
1167 | u32 r_ctl:8; /* R_CTL for I.U. */ | ||
1168 | u32 res:24; | ||
1169 | }; | ||
1170 | |||
1171 | |||
1172 | /* | ||
1173 | * FCP_CMND definitions | 1061 | * FCP_CMND definitions |
1174 | */ | 1062 | */ |
1175 | #define FCP_CMND_CDB_LEN 16 | 1063 | #define FCP_CMND_CDB_LEN 16 |
1176 | #define FCP_CMND_LUN_LEN 8 | 1064 | #define FCP_CMND_LUN_LEN 8 |
1177 | 1065 | ||
1178 | struct fcp_cmnd_s { | 1066 | struct fcp_cmnd_s { |
1179 | lun_t lun; /* 64-bit LU number */ | 1067 | struct scsi_lun lun; /* 64-bit LU number */ |
1180 | u8 crn; /* command reference number */ | 1068 | u8 crn; /* command reference number */ |
1181 | #ifdef __BIGENDIAN | 1069 | #ifdef __BIG_ENDIAN |
1182 | u8 resvd:1, | 1070 | u8 resvd:1, |
1183 | priority:4, /* FCP-3: SAM-3 priority */ | 1071 | priority:4, /* FCP-3: SAM-3 priority */ |
1184 | taskattr:3; /* scsi task attribute */ | 1072 | taskattr:3; /* scsi task attribute */ |
1185 | #else | 1073 | #else |
1186 | u8 taskattr:3, /* scsi task attribute */ | 1074 | u8 taskattr:3, /* scsi task attribute */ |
1187 | priority:4, /* FCP-3: SAM-3 priority */ | 1075 | priority:4, /* FCP-3: SAM-3 priority */ |
1188 | resvd:1; | 1076 | resvd:1; |
1189 | #endif | 1077 | #endif |
1190 | u8 tm_flags; /* task management flags */ | 1078 | u8 tm_flags; /* task management flags */ |
1191 | #ifdef __BIGENDIAN | 1079 | #ifdef __BIG_ENDIAN |
1192 | u8 addl_cdb_len:6, /* additional CDB length words */ | 1080 | u8 addl_cdb_len:6, /* additional CDB length words */ |
1193 | iodir:2; /* read/write FCP_DATA IUs */ | 1081 | iodir:2; /* read/write FCP_DATA IUs */ |
1194 | #else | 1082 | #else |
1195 | u8 iodir:2, /* read/write FCP_DATA IUs */ | 1083 | u8 iodir:2, /* read/write FCP_DATA IUs */ |
1196 | addl_cdb_len:6; /* additional CDB length */ | 1084 | addl_cdb_len:6; /* additional CDB length */ |
1197 | #endif | 1085 | #endif |
1198 | scsi_cdb_t cdb; | 1086 | struct scsi_cdb_s cdb; |
1199 | 1087 | ||
1200 | /* | 1088 | __be32 fcp_dl; /* bytes to be transferred */ |
1201 | * !!! additional cdb bytes follows here!!! | ||
1202 | */ | ||
1203 | u32 fcp_dl; /* bytes to be transferred */ | ||
1204 | }; | 1089 | }; |
1205 | 1090 | ||
1206 | #define fcp_cmnd_cdb_len(_cmnd) ((_cmnd)->addl_cdb_len * 4 + FCP_CMND_CDB_LEN) | 1091 | #define fcp_cmnd_cdb_len(_cmnd) ((_cmnd)->addl_cdb_len * 4 + FCP_CMND_CDB_LEN) |
@@ -1210,21 +1095,10 @@ struct fcp_cmnd_s { | |||
1210 | * struct fcp_cmnd_s .iodir field values | 1095 | * struct fcp_cmnd_s .iodir field values |
1211 | */ | 1096 | */ |
1212 | enum fcp_iodir { | 1097 | enum fcp_iodir { |
1213 | FCP_IODIR_NONE = 0, | 1098 | FCP_IODIR_NONE = 0, |
1214 | FCP_IODIR_WRITE = 1, | 1099 | FCP_IODIR_WRITE = 1, |
1215 | FCP_IODIR_READ = 2, | 1100 | FCP_IODIR_READ = 2, |
1216 | FCP_IODIR_RW = 3, | 1101 | FCP_IODIR_RW = 3, |
1217 | }; | ||
1218 | |||
1219 | /* | ||
1220 | * Task attribute field | ||
1221 | */ | ||
1222 | enum { | ||
1223 | FCP_TASK_ATTR_SIMPLE = 0, | ||
1224 | FCP_TASK_ATTR_HOQ = 1, | ||
1225 | FCP_TASK_ATTR_ORDERED = 2, | ||
1226 | FCP_TASK_ATTR_ACA = 4, | ||
1227 | FCP_TASK_ATTR_UNTAGGED = 5, /* obsolete in FCP-3 */ | ||
1228 | }; | 1102 | }; |
1229 | 1103 | ||
1230 | /* | 1104 | /* |
@@ -1239,58 +1113,40 @@ enum fcp_tm_cmnd { | |||
1239 | }; | 1113 | }; |
1240 | 1114 | ||
1241 | /* | 1115 | /* |
1242 | * FCP_XFER_RDY IU defines | ||
1243 | */ | ||
1244 | struct fcp_xfer_rdy_s { | ||
1245 | u32 data_ro; | ||
1246 | u32 burst_len; | ||
1247 | u32 reserved; | ||
1248 | }; | ||
1249 | |||
1250 | /* | ||
1251 | * FCP_RSP residue flags | 1116 | * FCP_RSP residue flags |
1252 | */ | 1117 | */ |
1253 | enum fcp_residue { | 1118 | enum fcp_residue { |
1254 | FCP_NO_RESIDUE = 0, /* no residue */ | 1119 | FCP_NO_RESIDUE = 0, /* no residue */ |
1255 | FCP_RESID_OVER = 1, /* more data left that was not sent */ | 1120 | FCP_RESID_OVER = 1, /* more data left that was not sent */ |
1256 | FCP_RESID_UNDER = 2, /* less data than requested */ | 1121 | FCP_RESID_UNDER = 2, /* less data than requested */ |
1257 | }; | ||
1258 | |||
1259 | enum { | ||
1260 | FCP_RSPINFO_GOOD = 0, | ||
1261 | FCP_RSPINFO_DATALEN_MISMATCH = 1, | ||
1262 | FCP_RSPINFO_CMND_INVALID = 2, | ||
1263 | FCP_RSPINFO_ROLEN_MISMATCH = 3, | ||
1264 | FCP_RSPINFO_TM_NOT_SUPP = 4, | ||
1265 | FCP_RSPINFO_TM_FAILED = 5, | ||
1266 | }; | 1122 | }; |
1267 | 1123 | ||
1268 | struct fcp_rspinfo_s { | 1124 | struct fcp_rspinfo_s { |
1269 | u32 res0:24; | 1125 | u32 res0:24; |
1270 | u32 rsp_code:8; /* response code (as above) */ | 1126 | u32 rsp_code:8; /* response code (as above) */ |
1271 | u32 res1; | 1127 | u32 res1; |
1272 | }; | 1128 | }; |
1273 | 1129 | ||
1274 | struct fcp_resp_s { | 1130 | struct fcp_resp_s { |
1275 | u32 reserved[2]; /* 2 words reserved */ | 1131 | u32 reserved[2]; /* 2 words reserved */ |
1276 | u16 reserved2; | 1132 | u16 reserved2; |
1277 | #ifdef __BIGENDIAN | 1133 | #ifdef __BIG_ENDIAN |
1278 | u8 reserved3:3; | 1134 | u8 reserved3:3; |
1279 | u8 fcp_conf_req:1; /* FCP_CONF is requested */ | 1135 | u8 fcp_conf_req:1; /* FCP_CONF is requested */ |
1280 | u8 resid_flags:2; /* underflow/overflow */ | 1136 | u8 resid_flags:2; /* underflow/overflow */ |
1281 | u8 sns_len_valid:1;/* sense len is valid */ | 1137 | u8 sns_len_valid:1; /* sense len is valid */ |
1282 | u8 rsp_len_valid:1;/* response len is valid */ | 1138 | u8 rsp_len_valid:1; /* response len is valid */ |
1283 | #else | 1139 | #else |
1284 | u8 rsp_len_valid:1;/* response len is valid */ | 1140 | u8 rsp_len_valid:1; /* response len is valid */ |
1285 | u8 sns_len_valid:1;/* sense len is valid */ | 1141 | u8 sns_len_valid:1; /* sense len is valid */ |
1286 | u8 resid_flags:2; /* underflow/overflow */ | 1142 | u8 resid_flags:2; /* underflow/overflow */ |
1287 | u8 fcp_conf_req:1; /* FCP_CONF is requested */ | 1143 | u8 fcp_conf_req:1; /* FCP_CONF is requested */ |
1288 | u8 reserved3:3; | 1144 | u8 reserved3:3; |
1289 | #endif | 1145 | #endif |
1290 | u8 scsi_status; /* one byte SCSI status */ | 1146 | u8 scsi_status; /* one byte SCSI status */ |
1291 | u32 residue; /* residual data bytes */ | 1147 | u32 residue; /* residual data bytes */ |
1292 | u32 sns_len; /* length od sense info */ | 1148 | u32 sns_len; /* length od sense info */ |
1293 | u32 rsp_len; /* length of response info */ | 1149 | u32 rsp_len; /* length of response info */ |
1294 | }; | 1150 | }; |
1295 | 1151 | ||
1296 | #define fcp_snslen(__fcprsp) ((__fcprsp)->sns_len_valid ? \ | 1152 | #define fcp_snslen(__fcprsp) ((__fcprsp)->sns_len_valid ? \ |
@@ -1300,12 +1156,6 @@ struct fcp_resp_s { | |||
1300 | #define fcp_rspinfo(__fcprsp) ((struct fcp_rspinfo_s *)((__fcprsp) + 1)) | 1156 | #define fcp_rspinfo(__fcprsp) ((struct fcp_rspinfo_s *)((__fcprsp) + 1)) |
1301 | #define fcp_snsinfo(__fcprsp) (((u8 *)fcp_rspinfo(__fcprsp)) + \ | 1157 | #define fcp_snsinfo(__fcprsp) (((u8 *)fcp_rspinfo(__fcprsp)) + \ |
1302 | fcp_rsplen(__fcprsp)) | 1158 | fcp_rsplen(__fcprsp)) |
1303 | |||
1304 | struct fcp_cmnd_fr_s { | ||
1305 | struct fchs_s fchs; | ||
1306 | struct fcp_cmnd_s fcp; | ||
1307 | }; | ||
1308 | |||
1309 | /* | 1159 | /* |
1310 | * CT | 1160 | * CT |
1311 | */ | 1161 | */ |
@@ -1379,7 +1229,7 @@ enum { | |||
1379 | CT_RSN_LOGICAL_BUSY = 0x05, | 1229 | CT_RSN_LOGICAL_BUSY = 0x05, |
1380 | CT_RSN_PROTO_ERR = 0x07, | 1230 | CT_RSN_PROTO_ERR = 0x07, |
1381 | CT_RSN_UNABLE_TO_PERF = 0x09, | 1231 | CT_RSN_UNABLE_TO_PERF = 0x09, |
1382 | CT_RSN_NOT_SUPP = 0x0B, | 1232 | CT_RSN_NOT_SUPP = 0x0B, |
1383 | CT_RSN_SERVER_NOT_AVBL = 0x0D, | 1233 | CT_RSN_SERVER_NOT_AVBL = 0x0D, |
1384 | CT_RSN_SESSION_COULD_NOT_BE_ESTBD = 0x0E, | 1234 | CT_RSN_SESSION_COULD_NOT_BE_ESTBD = 0x0E, |
1385 | CT_RSN_VENDOR_SPECIFIC = 0xFF, | 1235 | CT_RSN_VENDOR_SPECIFIC = 0xFF, |
@@ -1419,10 +1269,10 @@ enum { | |||
1419 | * defintions for the explanation code for all servers | 1269 | * defintions for the explanation code for all servers |
1420 | */ | 1270 | */ |
1421 | enum { | 1271 | enum { |
1422 | CT_EXP_AUTH_EXCEPTION = 0xF1, | 1272 | CT_EXP_AUTH_EXCEPTION = 0xF1, |
1423 | CT_EXP_DB_FULL = 0xF2, | 1273 | CT_EXP_DB_FULL = 0xF2, |
1424 | CT_EXP_DB_EMPTY = 0xF3, | 1274 | CT_EXP_DB_EMPTY = 0xF3, |
1425 | CT_EXP_PROCESSING_REQ = 0xF4, | 1275 | CT_EXP_PROCESSING_REQ = 0xF4, |
1426 | CT_EXP_UNABLE_TO_VERIFY_CONN = 0xF5, | 1276 | CT_EXP_UNABLE_TO_VERIFY_CONN = 0xF5, |
1427 | CT_EXP_DEVICES_NOT_IN_CMN_ZONE = 0xF6 | 1277 | CT_EXP_DEVICES_NOT_IN_CMN_ZONE = 0xF6 |
1428 | }; | 1278 | }; |
@@ -1446,7 +1296,7 @@ enum { | |||
1446 | GS_RFF_ID = 0x021F, /* Register FC4 Feature */ | 1296 | GS_RFF_ID = 0x021F, /* Register FC4 Feature */ |
1447 | }; | 1297 | }; |
1448 | 1298 | ||
1449 | struct fcgs_id_req_s{ | 1299 | struct fcgs_id_req_s { |
1450 | u32 rsvd:8; | 1300 | u32 rsvd:8; |
1451 | u32 dap:24; /* port identifier */ | 1301 | u32 dap:24; /* port identifier */ |
1452 | }; | 1302 | }; |
@@ -1460,7 +1310,7 @@ struct fcgs_gidpn_req_s { | |||
1460 | 1310 | ||
1461 | struct fcgs_gidpn_resp_s { | 1311 | struct fcgs_gidpn_resp_s { |
1462 | u32 rsvd:8; | 1312 | u32 rsvd:8; |
1463 | u32 dap:24; /* port identifier */ | 1313 | u32 dap:24; /* port identifier */ |
1464 | }; | 1314 | }; |
1465 | 1315 | ||
1466 | /* | 1316 | /* |
@@ -1469,22 +1319,21 @@ struct fcgs_gidpn_resp_s { | |||
1469 | struct fcgs_rftid_req_s { | 1319 | struct fcgs_rftid_req_s { |
1470 | u32 rsvd:8; | 1320 | u32 rsvd:8; |
1471 | u32 dap:24; /* port identifier */ | 1321 | u32 dap:24; /* port identifier */ |
1472 | u32 fc4_type[8]; /* fc4 types */ | 1322 | __be32 fc4_type[8]; /* fc4 types */ |
1473 | }; | 1323 | }; |
1474 | 1324 | ||
1475 | /* | 1325 | /* |
1476 | * RFF_ID : Register FC4 features. | 1326 | * RFF_ID : Register FC4 features. |
1477 | */ | 1327 | */ |
1478 | |||
1479 | #define FC_GS_FCP_FC4_FEATURE_INITIATOR 0x02 | 1328 | #define FC_GS_FCP_FC4_FEATURE_INITIATOR 0x02 |
1480 | #define FC_GS_FCP_FC4_FEATURE_TARGET 0x01 | 1329 | #define FC_GS_FCP_FC4_FEATURE_TARGET 0x01 |
1481 | 1330 | ||
1482 | struct fcgs_rffid_req_s { | 1331 | struct fcgs_rffid_req_s { |
1483 | u32 rsvd:8; | 1332 | u32 rsvd:8; |
1484 | u32 dap:24; /* port identifier */ | 1333 | u32 dap:24; /* port identifier */ |
1485 | u32 rsvd1:16; | 1334 | u32 rsvd1:16; |
1486 | u32 fc4ftr_bits:8; /* fc4 feature bits */ | 1335 | u32 fc4ftr_bits:8; /* fc4 feature bits */ |
1487 | u32 fc4_type:8; /* corresponding FC4 Type */ | 1336 | u32 fc4_type:8; /* corresponding FC4 Type */ |
1488 | }; | 1337 | }; |
1489 | 1338 | ||
1490 | /* | 1339 | /* |
@@ -1495,16 +1344,16 @@ struct fcgs_gidft_req_s { | |||
1495 | u8 domain_id; /* domain, 0 - all fabric */ | 1344 | u8 domain_id; /* domain, 0 - all fabric */ |
1496 | u8 area_id; /* area, 0 - whole domain */ | 1345 | u8 area_id; /* area, 0 - whole domain */ |
1497 | u8 fc4_type; /* FC_TYPE_FCP for SCSI devices */ | 1346 | u8 fc4_type; /* FC_TYPE_FCP for SCSI devices */ |
1498 | }; /* GID_FT Request */ | 1347 | }; |
1499 | 1348 | ||
1500 | /* | 1349 | /* |
1501 | * GID_FT Response | 1350 | * GID_FT Response |
1502 | */ | 1351 | */ |
1503 | struct fcgs_gidft_resp_s { | 1352 | struct fcgs_gidft_resp_s { |
1504 | u8 last:1; /* last port identifier flag */ | 1353 | u8 last:1; /* last port identifier flag */ |
1505 | u8 reserved:7; | 1354 | u8 reserved:7; |
1506 | u32 pid:24; /* port identifier */ | 1355 | u32 pid:24; /* port identifier */ |
1507 | }; /* GID_FT Response */ | 1356 | }; |
1508 | 1357 | ||
1509 | /* | 1358 | /* |
1510 | * RSPN_ID | 1359 | * RSPN_ID |
@@ -1512,8 +1361,8 @@ struct fcgs_gidft_resp_s { | |||
1512 | struct fcgs_rspnid_req_s { | 1361 | struct fcgs_rspnid_req_s { |
1513 | u32 rsvd:8; | 1362 | u32 rsvd:8; |
1514 | u32 dap:24; /* port identifier */ | 1363 | u32 dap:24; /* port identifier */ |
1515 | u8 spn_len; /* symbolic port name length */ | 1364 | u8 spn_len; /* symbolic port name length */ |
1516 | u8 spn[256]; /* symbolic port name */ | 1365 | u8 spn[256]; /* symbolic port name */ |
1517 | }; | 1366 | }; |
1518 | 1367 | ||
1519 | /* | 1368 | /* |
@@ -1522,7 +1371,7 @@ struct fcgs_rspnid_req_s { | |||
1522 | struct fcgs_rpnid_req_s { | 1371 | struct fcgs_rpnid_req_s { |
1523 | u32 rsvd:8; | 1372 | u32 rsvd:8; |
1524 | u32 port_id:24; | 1373 | u32 port_id:24; |
1525 | wwn_t port_name; | 1374 | wwn_t port_name; |
1526 | }; | 1375 | }; |
1527 | 1376 | ||
1528 | /* | 1377 | /* |
@@ -1531,7 +1380,7 @@ struct fcgs_rpnid_req_s { | |||
1531 | struct fcgs_rnnid_req_s { | 1380 | struct fcgs_rnnid_req_s { |
1532 | u32 rsvd:8; | 1381 | u32 rsvd:8; |
1533 | u32 port_id:24; | 1382 | u32 port_id:24; |
1534 | wwn_t node_name; | 1383 | wwn_t node_name; |
1535 | }; | 1384 | }; |
1536 | 1385 | ||
1537 | /* | 1386 | /* |
@@ -1565,8 +1414,8 @@ struct fcgs_ganxt_req_s { | |||
1565 | * GA_NXT Response | 1414 | * GA_NXT Response |
1566 | */ | 1415 | */ |
1567 | struct fcgs_ganxt_rsp_s { | 1416 | struct fcgs_ganxt_rsp_s { |
1568 | u32 port_type:8; /* Port Type */ | 1417 | u32 port_type:8; /* Port Type */ |
1569 | u32 port_id:24; /* Port Identifier */ | 1418 | u32 port_id:24; /* Port Identifier */ |
1570 | wwn_t port_name; /* Port Name */ | 1419 | wwn_t port_name; /* Port Name */ |
1571 | u8 spn_len; /* Length of Symbolic Port Name */ | 1420 | u8 spn_len; /* Length of Symbolic Port Name */ |
1572 | char spn[255]; /* Symbolic Port Name */ | 1421 | char spn[255]; /* Symbolic Port Name */ |
@@ -1575,19 +1424,14 @@ struct fcgs_ganxt_rsp_s { | |||
1575 | char snn[255]; /* Symbolic Node Name */ | 1424 | char snn[255]; /* Symbolic Node Name */ |
1576 | u8 ipa[8]; /* Initial Process Associator */ | 1425 | u8 ipa[8]; /* Initial Process Associator */ |
1577 | u8 ip[16]; /* IP Address */ | 1426 | u8 ip[16]; /* IP Address */ |
1578 | u32 cos; /* Class of Service */ | 1427 | u32 cos; /* Class of Service */ |
1579 | u32 fc4types[8]; /* FC-4 TYPEs */ | 1428 | u32 fc4types[8]; /* FC-4 TYPEs */ |
1580 | wwn_t fabric_port_name; | 1429 | wwn_t fabric_port_name; /* Fabric Port Name */ |
1581 | /* Fabric Port Name */ | 1430 | u32 rsvd:8; /* Reserved */ |
1582 | u32 rsvd:8; /* Reserved */ | 1431 | u32 hard_addr:24; /* Hard Address */ |
1583 | u32 hard_addr:24; /* Hard Address */ | ||
1584 | }; | 1432 | }; |
1585 | 1433 | ||
1586 | /* | 1434 | /* |
1587 | * Fabric Config Server | ||
1588 | */ | ||
1589 | |||
1590 | /* | ||
1591 | * Command codes for Fabric Configuration Server | 1435 | * Command codes for Fabric Configuration Server |
1592 | */ | 1436 | */ |
1593 | enum { | 1437 | enum { |
@@ -1598,159 +1442,9 @@ enum { | |||
1598 | }; | 1442 | }; |
1599 | 1443 | ||
1600 | /* | 1444 | /* |
1601 | * Source or Destination Port Tags. | ||
1602 | */ | ||
1603 | enum { | ||
1604 | GS_FTRACE_TAG_NPORT_ID = 1, | ||
1605 | GS_FTRACE_TAG_NPORT_NAME = 2, | ||
1606 | }; | ||
1607 | |||
1608 | /* | ||
1609 | * Port Value : Could be a Port id or wwn | ||
1610 | */ | ||
1611 | union fcgs_port_val_u { | ||
1612 | u32 nport_id; | ||
1613 | wwn_t nport_wwn; | ||
1614 | }; | ||
1615 | |||
1616 | #define GS_FTRACE_MAX_HOP_COUNT 20 | ||
1617 | #define GS_FTRACE_REVISION 1 | ||
1618 | |||
1619 | /* | ||
1620 | * Ftrace Related Structures. | ||
1621 | */ | ||
1622 | |||
1623 | /* | ||
1624 | * STR (Switch Trace) Reject Reason Codes. From FC-SW. | ||
1625 | */ | ||
1626 | enum { | ||
1627 | GS_FTRACE_STR_CMD_COMPLETED_SUCC = 0, | ||
1628 | GS_FTRACE_STR_CMD_NOT_SUPP_IN_NEXT_SWITCH, | ||
1629 | GS_FTRACE_STR_NO_RESP_FROM_NEXT_SWITCH, | ||
1630 | GS_FTRACE_STR_MAX_HOP_CNT_REACHED, | ||
1631 | GS_FTRACE_STR_SRC_PORT_NOT_FOUND, | ||
1632 | GS_FTRACE_STR_DST_PORT_NOT_FOUND, | ||
1633 | GS_FTRACE_STR_DEVICES_NOT_IN_COMMON_ZONE, | ||
1634 | GS_FTRACE_STR_NO_ROUTE_BW_PORTS, | ||
1635 | GS_FTRACE_STR_NO_ADDL_EXPLN, | ||
1636 | GS_FTRACE_STR_FABRIC_BUSY, | ||
1637 | GS_FTRACE_STR_FABRIC_BUILD_IN_PROGRESS, | ||
1638 | GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_START = 0xf0, | ||
1639 | GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_END = 0xff, | ||
1640 | }; | ||
1641 | |||
1642 | /* | ||
1643 | * Ftrace Request | ||
1644 | */ | ||
1645 | struct fcgs_ftrace_req_s { | ||
1646 | u32 revision; | ||
1647 | u16 src_port_tag; /* Source Port tag */ | ||
1648 | u16 src_port_len; /* Source Port len */ | ||
1649 | union fcgs_port_val_u src_port_val; /* Source Port value */ | ||
1650 | u16 dst_port_tag; /* Destination Port tag */ | ||
1651 | u16 dst_port_len; /* Destination Port len */ | ||
1652 | union fcgs_port_val_u dst_port_val; /* Destination Port value */ | ||
1653 | u32 token; | ||
1654 | u8 vendor_id[8]; /* T10 Vendor Identifier */ | ||
1655 | u8 vendor_info[8]; /* Vendor specific Info */ | ||
1656 | u32 max_hop_cnt; /* Max Hop Count */ | ||
1657 | }; | ||
1658 | |||
1659 | /* | ||
1660 | * Path info structure | ||
1661 | */ | ||
1662 | struct fcgs_ftrace_path_info_s { | ||
1663 | wwn_t switch_name; /* Switch WWN */ | ||
1664 | u32 domain_id; | ||
1665 | wwn_t ingress_port_name; /* Ingress ports wwn */ | ||
1666 | u32 ingress_phys_port_num; /* Ingress ports physical port | ||
1667 | * number | ||
1668 | */ | ||
1669 | wwn_t egress_port_name; /* Ingress ports wwn */ | ||
1670 | u32 egress_phys_port_num; /* Ingress ports physical port | ||
1671 | * number | ||
1672 | */ | ||
1673 | }; | ||
1674 | |||
1675 | /* | ||
1676 | * Ftrace Acc Response | ||
1677 | */ | ||
1678 | struct fcgs_ftrace_resp_s { | ||
1679 | u32 revision; | ||
1680 | u32 token; | ||
1681 | u8 vendor_id[8]; /* T10 Vendor Identifier */ | ||
1682 | u8 vendor_info[8]; /* Vendor specific Info */ | ||
1683 | u32 str_rej_reason_code; /* STR Reject Reason Code */ | ||
1684 | u32 num_path_info_entries; /* No. of path info entries */ | ||
1685 | /* | ||
1686 | * path info entry/entries. | ||
1687 | */ | ||
1688 | struct fcgs_ftrace_path_info_s path_info[1]; | ||
1689 | |||
1690 | }; | ||
1691 | |||
1692 | /* | ||
1693 | * Fabric Config Server : FCPing | ||
1694 | */ | ||
1695 | |||
1696 | /* | ||
1697 | * FC Ping Request | ||
1698 | */ | ||
1699 | struct fcgs_fcping_req_s { | ||
1700 | u32 revision; | ||
1701 | u16 port_tag; | ||
1702 | u16 port_len; /* Port len */ | ||
1703 | union fcgs_port_val_u port_val; /* Port value */ | ||
1704 | u32 token; | ||
1705 | }; | ||
1706 | |||
1707 | /* | ||
1708 | * FC Ping Response | ||
1709 | */ | ||
1710 | struct fcgs_fcping_resp_s { | ||
1711 | u32 token; | ||
1712 | }; | ||
1713 | |||
1714 | /* | ||
1715 | * Command codes for zone server query. | ||
1716 | */ | ||
1717 | enum { | ||
1718 | ZS_GZME = 0x0124, /* Get zone member extended */ | ||
1719 | }; | ||
1720 | |||
1721 | /* | ||
1722 | * ZS GZME request | ||
1723 | */ | ||
1724 | #define ZS_GZME_ZNAMELEN 32 | ||
1725 | struct zs_gzme_req_s { | ||
1726 | u8 znamelen; | ||
1727 | u8 rsvd[3]; | ||
1728 | u8 zname[ZS_GZME_ZNAMELEN]; | ||
1729 | }; | ||
1730 | |||
1731 | enum zs_mbr_type { | ||
1732 | ZS_MBR_TYPE_PWWN = 1, | ||
1733 | ZS_MBR_TYPE_DOMPORT = 2, | ||
1734 | ZS_MBR_TYPE_PORTID = 3, | ||
1735 | ZS_MBR_TYPE_NWWN = 4, | ||
1736 | }; | ||
1737 | |||
1738 | struct zs_mbr_wwn_s { | ||
1739 | u8 mbr_type; | ||
1740 | u8 rsvd[3]; | ||
1741 | wwn_t wwn; | ||
1742 | }; | ||
1743 | |||
1744 | struct zs_query_resp_s { | ||
1745 | u32 nmbrs; /* number of zone members */ | ||
1746 | struct zs_mbr_wwn_s mbr[1]; | ||
1747 | }; | ||
1748 | |||
1749 | /* | ||
1750 | * GMAL Command ( Get ( interconnect Element) Management Address List) | 1445 | * GMAL Command ( Get ( interconnect Element) Management Address List) |
1751 | * To retrieve the IP Address of a Switch. | 1446 | * To retrieve the IP Address of a Switch. |
1752 | */ | 1447 | */ |
1753 | |||
1754 | #define CT_GMAL_RESP_PREFIX_TELNET "telnet://" | 1448 | #define CT_GMAL_RESP_PREFIX_TELNET "telnet://" |
1755 | #define CT_GMAL_RESP_PREFIX_HTTP "http://" | 1449 | #define CT_GMAL_RESP_PREFIX_HTTP "http://" |
1756 | 1450 | ||
@@ -1764,7 +1458,7 @@ struct fcgs_req_s { | |||
1764 | 1458 | ||
1765 | /* Accept Response to GMAL */ | 1459 | /* Accept Response to GMAL */ |
1766 | struct fcgs_gmal_resp_s { | 1460 | struct fcgs_gmal_resp_s { |
1767 | u32 ms_len; /* Num of entries */ | 1461 | __be32 ms_len; /* Num of entries */ |
1768 | u8 ms_ma[256]; | 1462 | u8 ms_ma[256]; |
1769 | }; | 1463 | }; |
1770 | 1464 | ||
@@ -1775,9 +1469,6 @@ struct fcgs_gmal_entry_s { | |||
1775 | }; | 1469 | }; |
1776 | 1470 | ||
1777 | /* | 1471 | /* |
1778 | * FDMI | ||
1779 | */ | ||
1780 | /* | ||
1781 | * FDMI Command Codes | 1472 | * FDMI Command Codes |
1782 | */ | 1473 | */ |
1783 | #define FDMI_GRHL 0x0100 | 1474 | #define FDMI_GRHL 0x0100 |
@@ -1856,8 +1547,8 @@ enum fdmi_port_attribute_type { | |||
1856 | * FDMI attribute | 1547 | * FDMI attribute |
1857 | */ | 1548 | */ |
1858 | struct fdmi_attr_s { | 1549 | struct fdmi_attr_s { |
1859 | u16 type; | 1550 | __be16 type; |
1860 | u16 len; | 1551 | __be16 len; |
1861 | u8 value[1]; | 1552 | u8 value[1]; |
1862 | }; | 1553 | }; |
1863 | 1554 | ||
@@ -1865,7 +1556,7 @@ struct fdmi_attr_s { | |||
1865 | * HBA Attribute Block | 1556 | * HBA Attribute Block |
1866 | */ | 1557 | */ |
1867 | struct fdmi_hba_attr_s { | 1558 | struct fdmi_hba_attr_s { |
1868 | u32 attr_count; /* # of attributes */ | 1559 | __be32 attr_count; /* # of attributes */ |
1869 | struct fdmi_attr_s hba_attr; /* n attributes */ | 1560 | struct fdmi_attr_s hba_attr; /* n attributes */ |
1870 | }; | 1561 | }; |
1871 | 1562 | ||
@@ -1873,15 +1564,15 @@ struct fdmi_hba_attr_s { | |||
1873 | * Registered Port List | 1564 | * Registered Port List |
1874 | */ | 1565 | */ |
1875 | struct fdmi_port_list_s { | 1566 | struct fdmi_port_list_s { |
1876 | u32 num_ports; /* number Of Port Entries */ | 1567 | __be32 num_ports; /* number Of Port Entries */ |
1877 | wwn_t port_entry; /* one or more */ | 1568 | wwn_t port_entry; /* one or more */ |
1878 | }; | 1569 | }; |
1879 | 1570 | ||
1880 | /* | 1571 | /* |
1881 | * Port Attribute Block | 1572 | * Port Attribute Block |
1882 | */ | 1573 | */ |
1883 | struct fdmi_port_attr_s { | 1574 | struct fdmi_port_attr_s { |
1884 | u32 attr_count; /* # of attributes */ | 1575 | __be32 attr_count; /* # of attributes */ |
1885 | struct fdmi_attr_s port_attr; /* n attributes */ | 1576 | struct fdmi_attr_s port_attr; /* n attributes */ |
1886 | }; | 1577 | }; |
1887 | 1578 | ||
@@ -1889,7 +1580,7 @@ struct fdmi_port_attr_s { | |||
1889 | * FDMI Register HBA Attributes | 1580 | * FDMI Register HBA Attributes |
1890 | */ | 1581 | */ |
1891 | struct fdmi_rhba_s { | 1582 | struct fdmi_rhba_s { |
1892 | wwn_t hba_id; /* HBA Identifier */ | 1583 | wwn_t hba_id; /* HBA Identifier */ |
1893 | struct fdmi_port_list_s port_list; /* Registered Port List */ | 1584 | struct fdmi_port_list_s port_list; /* Registered Port List */ |
1894 | struct fdmi_hba_attr_s hba_attr_blk; /* HBA attribute block */ | 1585 | struct fdmi_hba_attr_s hba_attr_blk; /* HBA attribute block */ |
1895 | }; | 1586 | }; |
@@ -1898,8 +1589,8 @@ struct fdmi_rhba_s { | |||
1898 | * FDMI Register Port | 1589 | * FDMI Register Port |
1899 | */ | 1590 | */ |
1900 | struct fdmi_rprt_s { | 1591 | struct fdmi_rprt_s { |
1901 | wwn_t hba_id; /* HBA Identifier */ | 1592 | wwn_t hba_id; /* HBA Identifier */ |
1902 | wwn_t port_name; /* Port wwn */ | 1593 | wwn_t port_name; /* Port wwn */ |
1903 | struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */ | 1594 | struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */ |
1904 | }; | 1595 | }; |
1905 | 1596 | ||
@@ -1907,7 +1598,7 @@ struct fdmi_rprt_s { | |||
1907 | * FDMI Register Port Attributes | 1598 | * FDMI Register Port Attributes |
1908 | */ | 1599 | */ |
1909 | struct fdmi_rpa_s { | 1600 | struct fdmi_rpa_s { |
1910 | wwn_t port_name; /* port wwn */ | 1601 | wwn_t port_name; /* port wwn */ |
1911 | struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */ | 1602 | struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */ |
1912 | }; | 1603 | }; |
1913 | 1604 | ||
diff --git a/drivers/scsi/bfa/bfa_fcbuild.c b/drivers/scsi/bfa/bfa_fcbuild.c index 9c725314b51..b7e25345165 100644 --- a/drivers/scsi/bfa/bfa_fcbuild.c +++ b/drivers/scsi/bfa/bfa_fcbuild.c | |||
@@ -18,16 +18,16 @@ | |||
18 | * fcbuild.c - FC link service frame building and parsing routines | 18 | * fcbuild.c - FC link service frame building and parsing routines |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "bfa_os_inc.h" | 21 | #include "bfad_drv.h" |
22 | #include "bfa_fcbuild.h" | 22 | #include "bfa_fcbuild.h" |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * static build functions | 25 | * static build functions |
26 | */ | 26 | */ |
27 | static void fc_els_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, | 27 | static void fc_els_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, |
28 | u16 ox_id); | 28 | __be16 ox_id); |
29 | static void fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, | 29 | static void fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, |
30 | u16 ox_id); | 30 | __be16 ox_id); |
31 | static struct fchs_s fc_els_req_tmpl; | 31 | static struct fchs_s fc_els_req_tmpl; |
32 | static struct fchs_s fc_els_rsp_tmpl; | 32 | static struct fchs_s fc_els_rsp_tmpl; |
33 | static struct fchs_s fc_bls_req_tmpl; | 33 | static struct fchs_s fc_bls_req_tmpl; |
@@ -48,7 +48,7 @@ fcbuild_init(void) | |||
48 | fc_els_req_tmpl.cat_info = FC_CAT_LD_REQUEST; | 48 | fc_els_req_tmpl.cat_info = FC_CAT_LD_REQUEST; |
49 | fc_els_req_tmpl.type = FC_TYPE_ELS; | 49 | fc_els_req_tmpl.type = FC_TYPE_ELS; |
50 | fc_els_req_tmpl.f_ctl = | 50 | fc_els_req_tmpl.f_ctl = |
51 | bfa_os_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ | | 51 | bfa_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ | |
52 | FCTL_SI_XFER); | 52 | FCTL_SI_XFER); |
53 | fc_els_req_tmpl.rx_id = FC_RXID_ANY; | 53 | fc_els_req_tmpl.rx_id = FC_RXID_ANY; |
54 | 54 | ||
@@ -59,7 +59,7 @@ fcbuild_init(void) | |||
59 | fc_els_rsp_tmpl.cat_info = FC_CAT_LD_REPLY; | 59 | fc_els_rsp_tmpl.cat_info = FC_CAT_LD_REPLY; |
60 | fc_els_rsp_tmpl.type = FC_TYPE_ELS; | 60 | fc_els_rsp_tmpl.type = FC_TYPE_ELS; |
61 | fc_els_rsp_tmpl.f_ctl = | 61 | fc_els_rsp_tmpl.f_ctl = |
62 | bfa_os_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH | | 62 | bfa_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH | |
63 | FCTL_END_SEQ | FCTL_SI_XFER); | 63 | FCTL_END_SEQ | FCTL_SI_XFER); |
64 | fc_els_rsp_tmpl.rx_id = FC_RXID_ANY; | 64 | fc_els_rsp_tmpl.rx_id = FC_RXID_ANY; |
65 | 65 | ||
@@ -68,7 +68,7 @@ fcbuild_init(void) | |||
68 | */ | 68 | */ |
69 | fc_bls_req_tmpl.routing = FC_RTG_BASIC_LINK; | 69 | fc_bls_req_tmpl.routing = FC_RTG_BASIC_LINK; |
70 | fc_bls_req_tmpl.type = FC_TYPE_BLS; | 70 | fc_bls_req_tmpl.type = FC_TYPE_BLS; |
71 | fc_bls_req_tmpl.f_ctl = bfa_os_hton3b(FCTL_END_SEQ | FCTL_SI_XFER); | 71 | fc_bls_req_tmpl.f_ctl = bfa_hton3b(FCTL_END_SEQ | FCTL_SI_XFER); |
72 | fc_bls_req_tmpl.rx_id = FC_RXID_ANY; | 72 | fc_bls_req_tmpl.rx_id = FC_RXID_ANY; |
73 | 73 | ||
74 | /* | 74 | /* |
@@ -78,7 +78,7 @@ fcbuild_init(void) | |||
78 | fc_bls_rsp_tmpl.cat_info = FC_CAT_BA_ACC; | 78 | fc_bls_rsp_tmpl.cat_info = FC_CAT_BA_ACC; |
79 | fc_bls_rsp_tmpl.type = FC_TYPE_BLS; | 79 | fc_bls_rsp_tmpl.type = FC_TYPE_BLS; |
80 | fc_bls_rsp_tmpl.f_ctl = | 80 | fc_bls_rsp_tmpl.f_ctl = |
81 | bfa_os_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH | | 81 | bfa_hton3b(FCTL_EC_RESP | FCTL_SEQ_INI | FCTL_LS_EXCH | |
82 | FCTL_END_SEQ | FCTL_SI_XFER); | 82 | FCTL_END_SEQ | FCTL_SI_XFER); |
83 | fc_bls_rsp_tmpl.rx_id = FC_RXID_ANY; | 83 | fc_bls_rsp_tmpl.rx_id = FC_RXID_ANY; |
84 | 84 | ||
@@ -129,7 +129,7 @@ fcbuild_init(void) | |||
129 | fcp_fchs_tmpl.cat_info = FC_CAT_UNSOLICIT_CMD; | 129 | fcp_fchs_tmpl.cat_info = FC_CAT_UNSOLICIT_CMD; |
130 | fcp_fchs_tmpl.type = FC_TYPE_FCP; | 130 | fcp_fchs_tmpl.type = FC_TYPE_FCP; |
131 | fcp_fchs_tmpl.f_ctl = | 131 | fcp_fchs_tmpl.f_ctl = |
132 | bfa_os_hton3b(FCTL_FS_EXCH | FCTL_END_SEQ | FCTL_SI_XFER); | 132 | bfa_hton3b(FCTL_FS_EXCH | FCTL_END_SEQ | FCTL_SI_XFER); |
133 | fcp_fchs_tmpl.seq_id = 1; | 133 | fcp_fchs_tmpl.seq_id = 1; |
134 | fcp_fchs_tmpl.rx_id = FC_RXID_ANY; | 134 | fcp_fchs_tmpl.rx_id = FC_RXID_ANY; |
135 | } | 135 | } |
@@ -143,7 +143,7 @@ fc_gs_fchdr_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u32 ox_id) | |||
143 | fchs->cat_info = FC_CAT_UNSOLICIT_CTRL; | 143 | fchs->cat_info = FC_CAT_UNSOLICIT_CTRL; |
144 | fchs->type = FC_TYPE_SERVICES; | 144 | fchs->type = FC_TYPE_SERVICES; |
145 | fchs->f_ctl = | 145 | fchs->f_ctl = |
146 | bfa_os_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ | | 146 | bfa_hton3b(FCTL_SEQ_INI | FCTL_FS_EXCH | FCTL_END_SEQ | |
147 | FCTL_SI_XFER); | 147 | FCTL_SI_XFER); |
148 | fchs->rx_id = FC_RXID_ANY; | 148 | fchs->rx_id = FC_RXID_ANY; |
149 | fchs->d_id = (d_id); | 149 | fchs->d_id = (d_id); |
@@ -157,7 +157,7 @@ fc_gs_fchdr_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u32 ox_id) | |||
157 | } | 157 | } |
158 | 158 | ||
159 | void | 159 | void |
160 | fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id) | 160 | fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id) |
161 | { | 161 | { |
162 | memcpy(fchs, &fc_els_req_tmpl, sizeof(struct fchs_s)); | 162 | memcpy(fchs, &fc_els_req_tmpl, sizeof(struct fchs_s)); |
163 | fchs->d_id = (d_id); | 163 | fchs->d_id = (d_id); |
@@ -166,7 +166,7 @@ fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id) | |||
166 | } | 166 | } |
167 | 167 | ||
168 | static void | 168 | static void |
169 | fc_els_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id) | 169 | fc_els_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id) |
170 | { | 170 | { |
171 | memcpy(fchs, &fc_els_rsp_tmpl, sizeof(struct fchs_s)); | 171 | memcpy(fchs, &fc_els_rsp_tmpl, sizeof(struct fchs_s)); |
172 | fchs->d_id = d_id; | 172 | fchs->d_id = d_id; |
@@ -196,7 +196,7 @@ fc_els_rsp_parse(struct fchs_s *fchs, int len) | |||
196 | } | 196 | } |
197 | 197 | ||
198 | static void | 198 | static void |
199 | fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id) | 199 | fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id) |
200 | { | 200 | { |
201 | memcpy(fchs, &fc_bls_rsp_tmpl, sizeof(struct fchs_s)); | 201 | memcpy(fchs, &fc_bls_rsp_tmpl, sizeof(struct fchs_s)); |
202 | fchs->d_id = d_id; | 202 | fchs->d_id = d_id; |
@@ -206,7 +206,7 @@ fc_bls_rsp_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id) | |||
206 | 206 | ||
207 | static u16 | 207 | static u16 |
208 | fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, | 208 | fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, |
209 | u16 ox_id, wwn_t port_name, wwn_t node_name, | 209 | __be16 ox_id, wwn_t port_name, wwn_t node_name, |
210 | u16 pdu_size, u8 els_code) | 210 | u16 pdu_size, u8 els_code) |
211 | { | 211 | { |
212 | struct fc_logi_s *plogi = (struct fc_logi_s *) (pld); | 212 | struct fc_logi_s *plogi = (struct fc_logi_s *) (pld); |
@@ -232,8 +232,8 @@ fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, | |||
232 | u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size, | 232 | u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size, |
233 | u8 set_npiv, u8 set_auth, u16 local_bb_credits) | 233 | u8 set_npiv, u8 set_auth, u16 local_bb_credits) |
234 | { | 234 | { |
235 | u32 d_id = bfa_os_hton3b(FC_FABRIC_PORT); | 235 | u32 d_id = bfa_hton3b(FC_FABRIC_PORT); |
236 | u32 *vvl_info; | 236 | __be32 *vvl_info; |
237 | 237 | ||
238 | memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); | 238 | memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); |
239 | 239 | ||
@@ -267,7 +267,7 @@ fc_flogi_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, | |||
267 | 267 | ||
268 | u16 | 268 | u16 |
269 | fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, | 269 | fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, |
270 | u16 ox_id, wwn_t port_name, wwn_t node_name, | 270 | __be16 ox_id, wwn_t port_name, wwn_t node_name, |
271 | u16 pdu_size, u16 local_bb_credits) | 271 | u16 pdu_size, u16 local_bb_credits) |
272 | { | 272 | { |
273 | u32 d_id = 0; | 273 | u32 d_id = 0; |
@@ -289,7 +289,7 @@ u16 | |||
289 | fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, | 289 | fc_fdisc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id, |
290 | u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size) | 290 | u16 ox_id, wwn_t port_name, wwn_t node_name, u16 pdu_size) |
291 | { | 291 | { |
292 | u32 d_id = bfa_os_hton3b(FC_FABRIC_PORT); | 292 | u32 d_id = bfa_hton3b(FC_FABRIC_PORT); |
293 | 293 | ||
294 | memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); | 294 | memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s)); |
295 | 295 | ||
@@ -392,7 +392,7 @@ fc_prli_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, | |||
392 | 392 | ||
393 | u16 | 393 | u16 |
394 | fc_prli_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, | 394 | fc_prli_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, |
395 | u16 ox_id, enum bfa_lport_role role) | 395 | __be16 ox_id, enum bfa_lport_role role) |
396 | { | 396 | { |
397 | struct fc_prli_s *prli = (struct fc_prli_s *) (pld); | 397 | struct fc_prli_s *prli = (struct fc_prli_s *) (pld); |
398 | 398 | ||
@@ -456,9 +456,9 @@ fc_logo_build(struct fchs_s *fchs, struct fc_logo_s *logo, u32 d_id, u32 s_id, | |||
456 | return sizeof(struct fc_logo_s); | 456 | return sizeof(struct fc_logo_s); |
457 | } | 457 | } |
458 | 458 | ||
459 | static u16 | 459 | static u16 |
460 | fc_adisc_x_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id, | 460 | fc_adisc_x_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id, |
461 | u32 s_id, u16 ox_id, wwn_t port_name, | 461 | u32 s_id, __be16 ox_id, wwn_t port_name, |
462 | wwn_t node_name, u8 els_code) | 462 | wwn_t node_name, u8 els_code) |
463 | { | 463 | { |
464 | memset(adisc, '\0', sizeof(struct fc_adisc_s)); | 464 | memset(adisc, '\0', sizeof(struct fc_adisc_s)); |
@@ -480,7 +480,7 @@ fc_adisc_x_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id, | |||
480 | 480 | ||
481 | u16 | 481 | u16 |
482 | fc_adisc_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id, | 482 | fc_adisc_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id, |
483 | u32 s_id, u16 ox_id, wwn_t port_name, wwn_t node_name) | 483 | u32 s_id, __be16 ox_id, wwn_t port_name, wwn_t node_name) |
484 | { | 484 | { |
485 | return fc_adisc_x_build(fchs, adisc, d_id, s_id, ox_id, port_name, | 485 | return fc_adisc_x_build(fchs, adisc, d_id, s_id, ox_id, port_name, |
486 | node_name, FC_ELS_ADISC); | 486 | node_name, FC_ELS_ADISC); |
@@ -488,7 +488,7 @@ fc_adisc_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id, | |||
488 | 488 | ||
489 | u16 | 489 | u16 |
490 | fc_adisc_acc_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id, | 490 | fc_adisc_acc_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id, |
491 | u32 s_id, u16 ox_id, wwn_t port_name, | 491 | u32 s_id, __be16 ox_id, wwn_t port_name, |
492 | wwn_t node_name) | 492 | wwn_t node_name) |
493 | { | 493 | { |
494 | return fc_adisc_x_build(fchs, adisc, d_id, s_id, ox_id, port_name, | 494 | return fc_adisc_x_build(fchs, adisc, d_id, s_id, ox_id, port_name, |
@@ -592,7 +592,7 @@ fc_rrq_build(struct fchs_s *fchs, struct fc_rrq_s *rrq, u32 d_id, u32 s_id, | |||
592 | 592 | ||
593 | u16 | 593 | u16 |
594 | fc_logo_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, | 594 | fc_logo_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, |
595 | u16 ox_id) | 595 | __be16 ox_id) |
596 | { | 596 | { |
597 | struct fc_els_cmd_s *acc = pld; | 597 | struct fc_els_cmd_s *acc = pld; |
598 | 598 | ||
@@ -606,7 +606,7 @@ fc_logo_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id, | |||
606 | 606 | ||
607 | u16 | 607 | u16 |
608 | fc_ls_rjt_build(struct fchs_s *fchs, struct fc_ls_rjt_s *ls_rjt, u32 d_id, | 608 | fc_ls_rjt_build(struct fchs_s *fchs, struct fc_ls_rjt_s *ls_rjt, u32 d_id, |
609 | u32 s_id, u16 ox_id, u8 reason_code, | 609 | u32 s_id, __be16 ox_id, u8 reason_code, |
610 | u8 reason_code_expl) | 610 | u8 reason_code_expl) |
611 | { | 611 | { |
612 | fc_els_rsp_build(fchs, d_id, s_id, ox_id); | 612 | fc_els_rsp_build(fchs, d_id, s_id, ox_id); |
@@ -622,7 +622,7 @@ fc_ls_rjt_build(struct fchs_s *fchs, struct fc_ls_rjt_s *ls_rjt, u32 d_id, | |||
622 | 622 | ||
623 | u16 | 623 | u16 |
624 | fc_ba_acc_build(struct fchs_s *fchs, struct fc_ba_acc_s *ba_acc, u32 d_id, | 624 | fc_ba_acc_build(struct fchs_s *fchs, struct fc_ba_acc_s *ba_acc, u32 d_id, |
625 | u32 s_id, u16 ox_id, u16 rx_id) | 625 | u32 s_id, __be16 ox_id, u16 rx_id) |
626 | { | 626 | { |
627 | fc_bls_rsp_build(fchs, d_id, s_id, ox_id); | 627 | fc_bls_rsp_build(fchs, d_id, s_id, ox_id); |
628 | 628 | ||
@@ -638,7 +638,7 @@ fc_ba_acc_build(struct fchs_s *fchs, struct fc_ba_acc_s *ba_acc, u32 d_id, | |||
638 | 638 | ||
639 | u16 | 639 | u16 |
640 | fc_ls_acc_build(struct fchs_s *fchs, struct fc_els_cmd_s *els_cmd, u32 d_id, | 640 | fc_ls_acc_build(struct fchs_s *fchs, struct fc_els_cmd_s *els_cmd, u32 d_id, |
641 | u32 s_id, u16 ox_id) | 641 | u32 s_id, __be16 ox_id) |
642 | { | 642 | { |
643 | fc_els_rsp_build(fchs, d_id, s_id, ox_id); | 643 | fc_els_rsp_build(fchs, d_id, s_id, ox_id); |
644 | memset(els_cmd, 0, sizeof(struct fc_els_cmd_s)); | 644 | memset(els_cmd, 0, sizeof(struct fc_els_cmd_s)); |
@@ -666,7 +666,7 @@ fc_logout_params_pages(struct fchs_s *fc_frame, u8 els_code) | |||
666 | 666 | ||
667 | u16 | 667 | u16 |
668 | fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc, | 668 | fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc, |
669 | u32 d_id, u32 s_id, u16 ox_id, int num_pages) | 669 | u32 d_id, u32 s_id, __be16 ox_id, int num_pages) |
670 | { | 670 | { |
671 | int page; | 671 | int page; |
672 | 672 | ||
@@ -690,7 +690,7 @@ fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc, | |||
690 | 690 | ||
691 | u16 | 691 | u16 |
692 | fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc, u32 d_id, | 692 | fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc, u32 d_id, |
693 | u32 s_id, u16 ox_id, int num_pages) | 693 | u32 s_id, __be16 ox_id, int num_pages) |
694 | { | 694 | { |
695 | int page; | 695 | int page; |
696 | 696 | ||
@@ -728,7 +728,7 @@ fc_rnid_build(struct fchs_s *fchs, struct fc_rnid_cmd_s *rnid, u32 d_id, | |||
728 | 728 | ||
729 | u16 | 729 | u16 |
730 | fc_rnid_acc_build(struct fchs_s *fchs, struct fc_rnid_acc_s *rnid_acc, u32 d_id, | 730 | fc_rnid_acc_build(struct fchs_s *fchs, struct fc_rnid_acc_s *rnid_acc, u32 d_id, |
731 | u32 s_id, u16 ox_id, u32 data_format, | 731 | u32 s_id, __be16 ox_id, u32 data_format, |
732 | struct fc_rnid_common_id_data_s *common_id_data, | 732 | struct fc_rnid_common_id_data_s *common_id_data, |
733 | struct fc_rnid_general_topology_data_s *gen_topo_data) | 733 | struct fc_rnid_general_topology_data_s *gen_topo_data) |
734 | { | 734 | { |
@@ -770,10 +770,10 @@ u16 | |||
770 | fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rpsc2, u32 d_id, | 770 | fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rpsc2, u32 d_id, |
771 | u32 s_id, u32 *pid_list, u16 npids) | 771 | u32 s_id, u32 *pid_list, u16 npids) |
772 | { | 772 | { |
773 | u32 dctlr_id = FC_DOMAIN_CTRLR(bfa_os_hton3b(d_id)); | 773 | u32 dctlr_id = FC_DOMAIN_CTRLR(bfa_hton3b(d_id)); |
774 | int i = 0; | 774 | int i = 0; |
775 | 775 | ||
776 | fc_els_req_build(fchs, bfa_os_hton3b(dctlr_id), s_id, 0); | 776 | fc_els_req_build(fchs, bfa_hton3b(dctlr_id), s_id, 0); |
777 | 777 | ||
778 | memset(rpsc2, 0, sizeof(struct fc_rpsc2_cmd_s)); | 778 | memset(rpsc2, 0, sizeof(struct fc_rpsc2_cmd_s)); |
779 | 779 | ||
@@ -788,7 +788,7 @@ fc_rpsc2_build(struct fchs_s *fchs, struct fc_rpsc2_cmd_s *rpsc2, u32 d_id, | |||
788 | 788 | ||
789 | u16 | 789 | u16 |
790 | fc_rpsc_acc_build(struct fchs_s *fchs, struct fc_rpsc_acc_s *rpsc_acc, | 790 | fc_rpsc_acc_build(struct fchs_s *fchs, struct fc_rpsc_acc_s *rpsc_acc, |
791 | u32 d_id, u32 s_id, u16 ox_id, | 791 | u32 d_id, u32 s_id, __be16 ox_id, |
792 | struct fc_rpsc_speed_info_s *oper_speed) | 792 | struct fc_rpsc_speed_info_s *oper_speed) |
793 | { | 793 | { |
794 | memset(rpsc_acc, 0, sizeof(struct fc_rpsc_acc_s)); | 794 | memset(rpsc_acc, 0, sizeof(struct fc_rpsc_acc_s)); |
@@ -807,11 +807,6 @@ fc_rpsc_acc_build(struct fchs_s *fchs, struct fc_rpsc_acc_s *rpsc_acc, | |||
807 | return sizeof(struct fc_rpsc_acc_s); | 807 | return sizeof(struct fc_rpsc_acc_s); |
808 | } | 808 | } |
809 | 809 | ||
810 | /* | ||
811 | * TBD - | ||
812 | * . get rid of unnecessary memsets | ||
813 | */ | ||
814 | |||
815 | u16 | 810 | u16 |
816 | fc_logo_rsp_parse(struct fchs_s *fchs, int len) | 811 | fc_logo_rsp_parse(struct fchs_s *fchs, int len) |
817 | { | 812 | { |
@@ -995,7 +990,7 @@ fc_rrq_rsp_parse(struct fchs_s *fchs, int len) | |||
995 | } | 990 | } |
996 | 991 | ||
997 | u16 | 992 | u16 |
998 | fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, u16 ox_id, | 993 | fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, __be16 ox_id, |
999 | u32 reason_code, u32 reason_expl) | 994 | u32 reason_code, u32 reason_expl) |
1000 | { | 995 | { |
1001 | struct fc_ba_rjt_s *ba_rjt = (struct fc_ba_rjt_s *) (fchs + 1); | 996 | struct fc_ba_rjt_s *ba_rjt = (struct fc_ba_rjt_s *) (fchs + 1); |
@@ -1045,7 +1040,7 @@ fc_gidpn_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, | |||
1045 | { | 1040 | { |
1046 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1041 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1047 | struct fcgs_gidpn_req_s *gidpn = (struct fcgs_gidpn_req_s *)(cthdr + 1); | 1042 | struct fcgs_gidpn_req_s *gidpn = (struct fcgs_gidpn_req_s *)(cthdr + 1); |
1048 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1043 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1049 | 1044 | ||
1050 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); | 1045 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); |
1051 | fc_gs_cthdr_build(cthdr, s_id, GS_GID_PN); | 1046 | fc_gs_cthdr_build(cthdr, s_id, GS_GID_PN); |
@@ -1061,7 +1056,7 @@ fc_gpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, | |||
1061 | { | 1056 | { |
1062 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1057 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1063 | fcgs_gpnid_req_t *gpnid = (fcgs_gpnid_req_t *) (cthdr + 1); | 1058 | fcgs_gpnid_req_t *gpnid = (fcgs_gpnid_req_t *) (cthdr + 1); |
1064 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1059 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1065 | 1060 | ||
1066 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); | 1061 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); |
1067 | fc_gs_cthdr_build(cthdr, s_id, GS_GPN_ID); | 1062 | fc_gs_cthdr_build(cthdr, s_id, GS_GPN_ID); |
@@ -1077,7 +1072,7 @@ fc_gnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, | |||
1077 | { | 1072 | { |
1078 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1073 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1079 | fcgs_gnnid_req_t *gnnid = (fcgs_gnnid_req_t *) (cthdr + 1); | 1074 | fcgs_gnnid_req_t *gnnid = (fcgs_gnnid_req_t *) (cthdr + 1); |
1080 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1075 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1081 | 1076 | ||
1082 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); | 1077 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); |
1083 | fc_gs_cthdr_build(cthdr, s_id, GS_GNN_ID); | 1078 | fc_gs_cthdr_build(cthdr, s_id, GS_GNN_ID); |
@@ -1104,7 +1099,7 @@ u16 | |||
1104 | fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr, | 1099 | fc_scr_build(struct fchs_s *fchs, struct fc_scr_s *scr, |
1105 | u8 set_br_reg, u32 s_id, u16 ox_id) | 1100 | u8 set_br_reg, u32 s_id, u16 ox_id) |
1106 | { | 1101 | { |
1107 | u32 d_id = bfa_os_hton3b(FC_FABRIC_CONTROLLER); | 1102 | u32 d_id = bfa_hton3b(FC_FABRIC_CONTROLLER); |
1108 | 1103 | ||
1109 | fc_els_req_build(fchs, d_id, s_id, ox_id); | 1104 | fc_els_req_build(fchs, d_id, s_id, ox_id); |
1110 | 1105 | ||
@@ -1121,7 +1116,7 @@ u16 | |||
1121 | fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn, | 1116 | fc_rscn_build(struct fchs_s *fchs, struct fc_rscn_pl_s *rscn, |
1122 | u32 s_id, u16 ox_id) | 1117 | u32 s_id, u16 ox_id) |
1123 | { | 1118 | { |
1124 | u32 d_id = bfa_os_hton3b(FC_FABRIC_CONTROLLER); | 1119 | u32 d_id = bfa_hton3b(FC_FABRIC_CONTROLLER); |
1125 | u16 payldlen; | 1120 | u16 payldlen; |
1126 | 1121 | ||
1127 | fc_els_req_build(fchs, d_id, s_id, ox_id); | 1122 | fc_els_req_build(fchs, d_id, s_id, ox_id); |
@@ -1143,7 +1138,7 @@ fc_rftid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, | |||
1143 | { | 1138 | { |
1144 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1139 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1145 | struct fcgs_rftid_req_s *rftid = (struct fcgs_rftid_req_s *)(cthdr + 1); | 1140 | struct fcgs_rftid_req_s *rftid = (struct fcgs_rftid_req_s *)(cthdr + 1); |
1146 | u32 type_value, d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1141 | u32 type_value, d_id = bfa_hton3b(FC_NAME_SERVER); |
1147 | u8 index; | 1142 | u8 index; |
1148 | 1143 | ||
1149 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); | 1144 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); |
@@ -1167,7 +1162,7 @@ fc_rftid_build_sol(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, | |||
1167 | { | 1162 | { |
1168 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1163 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1169 | struct fcgs_rftid_req_s *rftid = (struct fcgs_rftid_req_s *)(cthdr + 1); | 1164 | struct fcgs_rftid_req_s *rftid = (struct fcgs_rftid_req_s *)(cthdr + 1); |
1170 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1165 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1171 | 1166 | ||
1172 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); | 1167 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); |
1173 | fc_gs_cthdr_build(cthdr, s_id, GS_RFT_ID); | 1168 | fc_gs_cthdr_build(cthdr, s_id, GS_RFT_ID); |
@@ -1187,7 +1182,7 @@ fc_rffid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, | |||
1187 | { | 1182 | { |
1188 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1183 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1189 | struct fcgs_rffid_req_s *rffid = (struct fcgs_rffid_req_s *)(cthdr + 1); | 1184 | struct fcgs_rffid_req_s *rffid = (struct fcgs_rffid_req_s *)(cthdr + 1); |
1190 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1185 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1191 | 1186 | ||
1192 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); | 1187 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); |
1193 | fc_gs_cthdr_build(cthdr, s_id, GS_RFF_ID); | 1188 | fc_gs_cthdr_build(cthdr, s_id, GS_RFF_ID); |
@@ -1209,7 +1204,7 @@ fc_rspnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, | |||
1209 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1204 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1210 | struct fcgs_rspnid_req_s *rspnid = | 1205 | struct fcgs_rspnid_req_s *rspnid = |
1211 | (struct fcgs_rspnid_req_s *)(cthdr + 1); | 1206 | (struct fcgs_rspnid_req_s *)(cthdr + 1); |
1212 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1207 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1213 | 1208 | ||
1214 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); | 1209 | fc_gs_fchdr_build(fchs, d_id, s_id, ox_id); |
1215 | fc_gs_cthdr_build(cthdr, s_id, GS_RSPN_ID); | 1210 | fc_gs_cthdr_build(cthdr, s_id, GS_RSPN_ID); |
@@ -1229,7 +1224,7 @@ fc_gid_ft_build(struct fchs_s *fchs, void *pyld, u32 s_id, u8 fc4_type) | |||
1229 | 1224 | ||
1230 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1225 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1231 | struct fcgs_gidft_req_s *gidft = (struct fcgs_gidft_req_s *)(cthdr + 1); | 1226 | struct fcgs_gidft_req_s *gidft = (struct fcgs_gidft_req_s *)(cthdr + 1); |
1232 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1227 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1233 | 1228 | ||
1234 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); | 1229 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); |
1235 | 1230 | ||
@@ -1249,7 +1244,7 @@ fc_rpnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, | |||
1249 | { | 1244 | { |
1250 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1245 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1251 | struct fcgs_rpnid_req_s *rpnid = (struct fcgs_rpnid_req_s *)(cthdr + 1); | 1246 | struct fcgs_rpnid_req_s *rpnid = (struct fcgs_rpnid_req_s *)(cthdr + 1); |
1252 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1247 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1253 | 1248 | ||
1254 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); | 1249 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); |
1255 | fc_gs_cthdr_build(cthdr, s_id, GS_RPN_ID); | 1250 | fc_gs_cthdr_build(cthdr, s_id, GS_RPN_ID); |
@@ -1267,7 +1262,7 @@ fc_rnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, | |||
1267 | { | 1262 | { |
1268 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1263 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1269 | struct fcgs_rnnid_req_s *rnnid = (struct fcgs_rnnid_req_s *)(cthdr + 1); | 1264 | struct fcgs_rnnid_req_s *rnnid = (struct fcgs_rnnid_req_s *)(cthdr + 1); |
1270 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1265 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1271 | 1266 | ||
1272 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); | 1267 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); |
1273 | fc_gs_cthdr_build(cthdr, s_id, GS_RNN_ID); | 1268 | fc_gs_cthdr_build(cthdr, s_id, GS_RNN_ID); |
@@ -1286,7 +1281,7 @@ fc_rcsid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, | |||
1286 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1281 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1287 | struct fcgs_rcsid_req_s *rcsid = | 1282 | struct fcgs_rcsid_req_s *rcsid = |
1288 | (struct fcgs_rcsid_req_s *) (cthdr + 1); | 1283 | (struct fcgs_rcsid_req_s *) (cthdr + 1); |
1289 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1284 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1290 | 1285 | ||
1291 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); | 1286 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); |
1292 | fc_gs_cthdr_build(cthdr, s_id, GS_RCS_ID); | 1287 | fc_gs_cthdr_build(cthdr, s_id, GS_RCS_ID); |
@@ -1304,7 +1299,7 @@ fc_rptid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id, | |||
1304 | { | 1299 | { |
1305 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1300 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1306 | struct fcgs_rptid_req_s *rptid = (struct fcgs_rptid_req_s *)(cthdr + 1); | 1301 | struct fcgs_rptid_req_s *rptid = (struct fcgs_rptid_req_s *)(cthdr + 1); |
1307 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1302 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1308 | 1303 | ||
1309 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); | 1304 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); |
1310 | fc_gs_cthdr_build(cthdr, s_id, GS_RPT_ID); | 1305 | fc_gs_cthdr_build(cthdr, s_id, GS_RPT_ID); |
@@ -1321,7 +1316,7 @@ fc_ganxt_build(struct fchs_s *fchs, void *pyld, u32 s_id, u32 port_id) | |||
1321 | { | 1316 | { |
1322 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1317 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1323 | struct fcgs_ganxt_req_s *ganxt = (struct fcgs_ganxt_req_s *)(cthdr + 1); | 1318 | struct fcgs_ganxt_req_s *ganxt = (struct fcgs_ganxt_req_s *)(cthdr + 1); |
1324 | u32 d_id = bfa_os_hton3b(FC_NAME_SERVER); | 1319 | u32 d_id = bfa_hton3b(FC_NAME_SERVER); |
1325 | 1320 | ||
1326 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); | 1321 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); |
1327 | fc_gs_cthdr_build(cthdr, s_id, GS_GA_NXT); | 1322 | fc_gs_cthdr_build(cthdr, s_id, GS_GA_NXT); |
@@ -1341,7 +1336,7 @@ fc_fdmi_reqhdr_build(struct fchs_s *fchs, void *pyld, u32 s_id, | |||
1341 | { | 1336 | { |
1342 | 1337 | ||
1343 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1338 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1344 | u32 d_id = bfa_os_hton3b(FC_MGMT_SERVER); | 1339 | u32 d_id = bfa_hton3b(FC_MGMT_SERVER); |
1345 | 1340 | ||
1346 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); | 1341 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); |
1347 | fc_gs_fdmi_cthdr_build(cthdr, s_id, cmd_code); | 1342 | fc_gs_fdmi_cthdr_build(cthdr, s_id, cmd_code); |
@@ -1356,7 +1351,7 @@ void | |||
1356 | fc_get_fc4type_bitmask(u8 fc4_type, u8 *bit_mask) | 1351 | fc_get_fc4type_bitmask(u8 fc4_type, u8 *bit_mask) |
1357 | { | 1352 | { |
1358 | u8 index; | 1353 | u8 index; |
1359 | u32 *ptr = (u32 *) bit_mask; | 1354 | __be32 *ptr = (__be32 *) bit_mask; |
1360 | u32 type_value; | 1355 | u32 type_value; |
1361 | 1356 | ||
1362 | /* | 1357 | /* |
@@ -1377,7 +1372,7 @@ fc_gmal_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn) | |||
1377 | { | 1372 | { |
1378 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1373 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1379 | fcgs_gmal_req_t *gmal = (fcgs_gmal_req_t *) (cthdr + 1); | 1374 | fcgs_gmal_req_t *gmal = (fcgs_gmal_req_t *) (cthdr + 1); |
1380 | u32 d_id = bfa_os_hton3b(FC_MGMT_SERVER); | 1375 | u32 d_id = bfa_hton3b(FC_MGMT_SERVER); |
1381 | 1376 | ||
1382 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); | 1377 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); |
1383 | fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GMAL_CMD, | 1378 | fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GMAL_CMD, |
@@ -1397,7 +1392,7 @@ fc_gfn_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn) | |||
1397 | { | 1392 | { |
1398 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; | 1393 | struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld; |
1399 | fcgs_gfn_req_t *gfn = (fcgs_gfn_req_t *) (cthdr + 1); | 1394 | fcgs_gfn_req_t *gfn = (fcgs_gfn_req_t *) (cthdr + 1); |
1400 | u32 d_id = bfa_os_hton3b(FC_MGMT_SERVER); | 1395 | u32 d_id = bfa_hton3b(FC_MGMT_SERVER); |
1401 | 1396 | ||
1402 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); | 1397 | fc_gs_fchdr_build(fchs, d_id, s_id, 0); |
1403 | fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GFN_CMD, | 1398 | fc_gs_ms_cthdr_build(cthdr, s_id, GS_FC_GFN_CMD, |
diff --git a/drivers/scsi/bfa/bfa_fcbuild.h b/drivers/scsi/bfa/bfa_fcbuild.h index 73abd02e53c..ece51ec7620 100644 --- a/drivers/scsi/bfa/bfa_fcbuild.h +++ b/drivers/scsi/bfa/bfa_fcbuild.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #ifndef __FCBUILD_H__ | 21 | #ifndef __FCBUILD_H__ |
22 | #define __FCBUILD_H__ | 22 | #define __FCBUILD_H__ |
23 | 23 | ||
24 | #include "bfa_os_inc.h" | 24 | #include "bfad_drv.h" |
25 | #include "bfa_fc.h" | 25 | #include "bfa_fc.h" |
26 | #include "bfa_defs_fcs.h" | 26 | #include "bfa_defs_fcs.h" |
27 | 27 | ||
@@ -138,7 +138,7 @@ u16 fc_fdisc_build(struct fchs_s *buf, struct fc_logi_s *flogi, u32 s_id, | |||
138 | u16 pdu_size); | 138 | u16 pdu_size); |
139 | 139 | ||
140 | u16 fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, | 140 | u16 fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, |
141 | u32 s_id, u16 ox_id, | 141 | u32 s_id, __be16 ox_id, |
142 | wwn_t port_name, wwn_t node_name, | 142 | wwn_t port_name, wwn_t node_name, |
143 | u16 pdu_size, | 143 | u16 pdu_size, |
144 | u16 local_bb_credits); | 144 | u16 local_bb_credits); |
@@ -186,7 +186,7 @@ u16 fc_plogi_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, | |||
186 | u16 pdu_size); | 186 | u16 pdu_size); |
187 | 187 | ||
188 | u16 fc_adisc_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, | 188 | u16 fc_adisc_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, |
189 | u32 d_id, u32 s_id, u16 ox_id, wwn_t port_name, | 189 | u32 d_id, u32 s_id, __be16 ox_id, wwn_t port_name, |
190 | wwn_t node_name); | 190 | wwn_t node_name); |
191 | 191 | ||
192 | enum fc_parse_status fc_adisc_parse(struct fchs_s *fchs, void *pld, | 192 | enum fc_parse_status fc_adisc_parse(struct fchs_s *fchs, void *pld, |
@@ -196,20 +196,20 @@ enum fc_parse_status fc_adisc_rsp_parse(struct fc_adisc_s *adisc, int len, | |||
196 | wwn_t port_name, wwn_t node_name); | 196 | wwn_t port_name, wwn_t node_name); |
197 | 197 | ||
198 | u16 fc_adisc_acc_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, | 198 | u16 fc_adisc_acc_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, |
199 | u32 d_id, u32 s_id, u16 ox_id, | 199 | u32 d_id, u32 s_id, __be16 ox_id, |
200 | wwn_t port_name, wwn_t node_name); | 200 | wwn_t port_name, wwn_t node_name); |
201 | u16 fc_ls_rjt_build(struct fchs_s *fchs, struct fc_ls_rjt_s *ls_rjt, | 201 | u16 fc_ls_rjt_build(struct fchs_s *fchs, struct fc_ls_rjt_s *ls_rjt, |
202 | u32 d_id, u32 s_id, u16 ox_id, | 202 | u32 d_id, u32 s_id, __be16 ox_id, |
203 | u8 reason_code, u8 reason_code_expl); | 203 | u8 reason_code, u8 reason_code_expl); |
204 | u16 fc_ls_acc_build(struct fchs_s *fchs, struct fc_els_cmd_s *els_cmd, | 204 | u16 fc_ls_acc_build(struct fchs_s *fchs, struct fc_els_cmd_s *els_cmd, |
205 | u32 d_id, u32 s_id, u16 ox_id); | 205 | u32 d_id, u32 s_id, __be16 ox_id); |
206 | u16 fc_prli_build(struct fchs_s *fchs, void *pld, u32 d_id, | 206 | u16 fc_prli_build(struct fchs_s *fchs, void *pld, u32 d_id, |
207 | u32 s_id, u16 ox_id); | 207 | u32 s_id, u16 ox_id); |
208 | 208 | ||
209 | enum fc_parse_status fc_prli_rsp_parse(struct fc_prli_s *prli, int len); | 209 | enum fc_parse_status fc_prli_rsp_parse(struct fc_prli_s *prli, int len); |
210 | 210 | ||
211 | u16 fc_prli_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, | 211 | u16 fc_prli_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, |
212 | u32 s_id, u16 ox_id, | 212 | u32 s_id, __be16 ox_id, |
213 | enum bfa_lport_role role); | 213 | enum bfa_lport_role role); |
214 | 214 | ||
215 | u16 fc_rnid_build(struct fchs_s *fchs, struct fc_rnid_cmd_s *rnid, | 215 | u16 fc_rnid_build(struct fchs_s *fchs, struct fc_rnid_cmd_s *rnid, |
@@ -218,7 +218,7 @@ u16 fc_rnid_build(struct fchs_s *fchs, struct fc_rnid_cmd_s *rnid, | |||
218 | 218 | ||
219 | u16 fc_rnid_acc_build(struct fchs_s *fchs, | 219 | u16 fc_rnid_acc_build(struct fchs_s *fchs, |
220 | struct fc_rnid_acc_s *rnid_acc, u32 d_id, u32 s_id, | 220 | struct fc_rnid_acc_s *rnid_acc, u32 d_id, u32 s_id, |
221 | u16 ox_id, u32 data_format, | 221 | __be16 ox_id, u32 data_format, |
222 | struct fc_rnid_common_id_data_s *common_id_data, | 222 | struct fc_rnid_common_id_data_s *common_id_data, |
223 | struct fc_rnid_general_topology_data_s *gen_topo_data); | 223 | struct fc_rnid_general_topology_data_s *gen_topo_data); |
224 | 224 | ||
@@ -228,7 +228,7 @@ u16 fc_rpsc_build(struct fchs_s *fchs, struct fc_rpsc_cmd_s *rpsc, | |||
228 | u32 d_id, u32 s_id, u16 ox_id); | 228 | u32 d_id, u32 s_id, u16 ox_id); |
229 | u16 fc_rpsc_acc_build(struct fchs_s *fchs, | 229 | u16 fc_rpsc_acc_build(struct fchs_s *fchs, |
230 | struct fc_rpsc_acc_s *rpsc_acc, u32 d_id, u32 s_id, | 230 | struct fc_rpsc_acc_s *rpsc_acc, u32 d_id, u32 s_id, |
231 | u16 ox_id, struct fc_rpsc_speed_info_s *oper_speed); | 231 | __be16 ox_id, struct fc_rpsc_speed_info_s *oper_speed); |
232 | u16 fc_gid_ft_build(struct fchs_s *fchs, void *pld, u32 s_id, | 232 | u16 fc_gid_ft_build(struct fchs_s *fchs, void *pld, u32 s_id, |
233 | u8 fc4_type); | 233 | u8 fc4_type); |
234 | 234 | ||
@@ -251,7 +251,7 @@ u16 fc_logo_build(struct fchs_s *fchs, struct fc_logo_s *logo, u32 d_id, | |||
251 | u32 s_id, u16 ox_id, wwn_t port_name); | 251 | u32 s_id, u16 ox_id, wwn_t port_name); |
252 | 252 | ||
253 | u16 fc_logo_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, | 253 | u16 fc_logo_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, |
254 | u32 s_id, u16 ox_id); | 254 | u32 s_id, __be16 ox_id); |
255 | 255 | ||
256 | u16 fc_fdmi_reqhdr_build(struct fchs_s *fchs, void *pyld, u32 s_id, | 256 | u16 fc_fdmi_reqhdr_build(struct fchs_s *fchs, void *pyld, u32 s_id, |
257 | u16 cmd_code); | 257 | u16 cmd_code); |
@@ -261,7 +261,7 @@ u16 fc_gfn_req_build(struct fchs_s *fchs, void *pyld, u32 s_id, wwn_t wwn); | |||
261 | void fc_get_fc4type_bitmask(u8 fc4_type, u8 *bit_mask); | 261 | void fc_get_fc4type_bitmask(u8 fc4_type, u8 *bit_mask); |
262 | 262 | ||
263 | void fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, | 263 | void fc_els_req_build(struct fchs_s *fchs, u32 d_id, u32 s_id, |
264 | u16 ox_id); | 264 | __be16 ox_id); |
265 | 265 | ||
266 | enum fc_parse_status fc_els_rsp_parse(struct fchs_s *fchs, int len); | 266 | enum fc_parse_status fc_els_rsp_parse(struct fchs_s *fchs, int len); |
267 | 267 | ||
@@ -274,15 +274,15 @@ enum fc_parse_status fc_pdisc_parse(struct fchs_s *fchs, wwn_t node_name, | |||
274 | wwn_t port_name); | 274 | wwn_t port_name); |
275 | 275 | ||
276 | u16 fc_ba_acc_build(struct fchs_s *fchs, struct fc_ba_acc_s *ba_acc, u32 d_id, | 276 | u16 fc_ba_acc_build(struct fchs_s *fchs, struct fc_ba_acc_s *ba_acc, u32 d_id, |
277 | u32 s_id, u16 ox_id, u16 rx_id); | 277 | u32 s_id, __be16 ox_id, u16 rx_id); |
278 | 278 | ||
279 | int fc_logout_params_pages(struct fchs_s *fc_frame, u8 els_code); | 279 | int fc_logout_params_pages(struct fchs_s *fc_frame, u8 els_code); |
280 | 280 | ||
281 | u16 fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc, | 281 | u16 fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc, |
282 | u32 d_id, u32 s_id, u16 ox_id, int num_pages); | 282 | u32 d_id, u32 s_id, __be16 ox_id, int num_pages); |
283 | 283 | ||
284 | u16 fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc, | 284 | u16 fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc, |
285 | u32 d_id, u32 s_id, u16 ox_id, int num_pages); | 285 | u32 d_id, u32 s_id, __be16 ox_id, int num_pages); |
286 | 286 | ||
287 | u16 fc_logo_rsp_parse(struct fchs_s *fchs, int len); | 287 | u16 fc_logo_rsp_parse(struct fchs_s *fchs, int len); |
288 | 288 | ||
@@ -304,7 +304,7 @@ u16 fc_tprlo_build(struct fchs_s *fchs, u32 d_id, u32 s_id, | |||
304 | u16 fc_tprlo_rsp_parse(struct fchs_s *fchs, int len); | 304 | u16 fc_tprlo_rsp_parse(struct fchs_s *fchs, int len); |
305 | 305 | ||
306 | u16 fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, | 306 | u16 fc_ba_rjt_build(struct fchs_s *fchs, u32 d_id, u32 s_id, |
307 | u16 ox_id, u32 reason_code, u32 reason_expl); | 307 | __be16 ox_id, u32 reason_code, u32 reason_expl); |
308 | 308 | ||
309 | u16 fc_gnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, | 309 | u16 fc_gnnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, |
310 | u32 port_id); | 310 | u32 port_id); |
diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index 135c4427801..9c410b21db6 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c | |||
@@ -15,17 +15,12 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | ||
18 | #include "bfa_modules.h" | 19 | #include "bfa_modules.h" |
19 | #include "bfa_cb_ioim.h" | ||
20 | 20 | ||
21 | BFA_TRC_FILE(HAL, FCPIM); | 21 | BFA_TRC_FILE(HAL, FCPIM); |
22 | BFA_MODULE(fcpim); | 22 | BFA_MODULE(fcpim); |
23 | 23 | ||
24 | |||
25 | #define bfa_fcpim_add_iostats(__l, __r, __stats) \ | ||
26 | (__l->__stats += __r->__stats) | ||
27 | |||
28 | |||
29 | /* | 24 | /* |
30 | * BFA ITNIM Related definitions | 25 | * BFA ITNIM Related definitions |
31 | */ | 26 | */ |
@@ -37,12 +32,12 @@ static void bfa_itnim_update_del_itn_stats(struct bfa_itnim_s *itnim); | |||
37 | #define bfa_fcpim_additn(__itnim) \ | 32 | #define bfa_fcpim_additn(__itnim) \ |
38 | list_add_tail(&(__itnim)->qe, &(__itnim)->fcpim->itnim_q) | 33 | list_add_tail(&(__itnim)->qe, &(__itnim)->fcpim->itnim_q) |
39 | #define bfa_fcpim_delitn(__itnim) do { \ | 34 | #define bfa_fcpim_delitn(__itnim) do { \ |
40 | bfa_assert(bfa_q_is_on_q(&(__itnim)->fcpim->itnim_q, __itnim)); \ | 35 | WARN_ON(!bfa_q_is_on_q(&(__itnim)->fcpim->itnim_q, __itnim)); \ |
41 | bfa_itnim_update_del_itn_stats(__itnim); \ | 36 | bfa_itnim_update_del_itn_stats(__itnim); \ |
42 | list_del(&(__itnim)->qe); \ | 37 | list_del(&(__itnim)->qe); \ |
43 | bfa_assert(list_empty(&(__itnim)->io_q)); \ | 38 | WARN_ON(!list_empty(&(__itnim)->io_q)); \ |
44 | bfa_assert(list_empty(&(__itnim)->io_cleanup_q)); \ | 39 | WARN_ON(!list_empty(&(__itnim)->io_cleanup_q)); \ |
45 | bfa_assert(list_empty(&(__itnim)->pending_q)); \ | 40 | WARN_ON(!list_empty(&(__itnim)->pending_q)); \ |
46 | } while (0) | 41 | } while (0) |
47 | 42 | ||
48 | #define bfa_itnim_online_cb(__itnim) do { \ | 43 | #define bfa_itnim_online_cb(__itnim) do { \ |
@@ -73,10 +68,8 @@ static void bfa_itnim_update_del_itn_stats(struct bfa_itnim_s *itnim); | |||
73 | } while (0) | 68 | } while (0) |
74 | 69 | ||
75 | /* | 70 | /* |
76 | * bfa_itnim_sm BFA itnim state machine | 71 | * itnim state machine event |
77 | */ | 72 | */ |
78 | |||
79 | |||
80 | enum bfa_itnim_event { | 73 | enum bfa_itnim_event { |
81 | BFA_ITNIM_SM_CREATE = 1, /* itnim is created */ | 74 | BFA_ITNIM_SM_CREATE = 1, /* itnim is created */ |
82 | BFA_ITNIM_SM_ONLINE = 2, /* itnim is online */ | 75 | BFA_ITNIM_SM_ONLINE = 2, /* itnim is online */ |
@@ -107,9 +100,6 @@ enum bfa_itnim_event { | |||
107 | if ((__fcpim)->profile_start) \ | 100 | if ((__fcpim)->profile_start) \ |
108 | (__fcpim)->profile_start(__ioim); \ | 101 | (__fcpim)->profile_start(__ioim); \ |
109 | } while (0) | 102 | } while (0) |
110 | /* | ||
111 | * hal_ioim_sm | ||
112 | */ | ||
113 | 103 | ||
114 | /* | 104 | /* |
115 | * IO state machine events | 105 | * IO state machine events |
@@ -221,8 +211,7 @@ static void bfa_itnim_sm_deleting_qfull(struct bfa_itnim_s *itnim, | |||
221 | * forward declaration for BFA IOIM functions | 211 | * forward declaration for BFA IOIM functions |
222 | */ | 212 | */ |
223 | static bfa_boolean_t bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim); | 213 | static bfa_boolean_t bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim); |
224 | static bfa_boolean_t bfa_ioim_sge_setup(struct bfa_ioim_s *ioim); | 214 | static bfa_boolean_t bfa_ioim_sgpg_alloc(struct bfa_ioim_s *ioim); |
225 | static void bfa_ioim_sgpg_setup(struct bfa_ioim_s *ioim); | ||
226 | static bfa_boolean_t bfa_ioim_send_abort(struct bfa_ioim_s *ioim); | 215 | static bfa_boolean_t bfa_ioim_send_abort(struct bfa_ioim_s *ioim); |
227 | static void bfa_ioim_notify_cleanup(struct bfa_ioim_s *ioim); | 216 | static void bfa_ioim_notify_cleanup(struct bfa_ioim_s *ioim); |
228 | static void __bfa_cb_ioim_good_comp(void *cbarg, bfa_boolean_t complete); | 217 | static void __bfa_cb_ioim_good_comp(void *cbarg, bfa_boolean_t complete); |
@@ -232,7 +221,6 @@ static void __bfa_cb_ioim_failed(void *cbarg, bfa_boolean_t complete); | |||
232 | static void __bfa_cb_ioim_pathtov(void *cbarg, bfa_boolean_t complete); | 221 | static void __bfa_cb_ioim_pathtov(void *cbarg, bfa_boolean_t complete); |
233 | static bfa_boolean_t bfa_ioim_is_abortable(struct bfa_ioim_s *ioim); | 222 | static bfa_boolean_t bfa_ioim_is_abortable(struct bfa_ioim_s *ioim); |
234 | 223 | ||
235 | |||
236 | /* | 224 | /* |
237 | * forward declaration of BFA IO state machine | 225 | * forward declaration of BFA IO state machine |
238 | */ | 226 | */ |
@@ -260,14 +248,13 @@ static void bfa_ioim_sm_resfree(struct bfa_ioim_s *ioim, | |||
260 | enum bfa_ioim_event event); | 248 | enum bfa_ioim_event event); |
261 | static void bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, | 249 | static void bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, |
262 | enum bfa_ioim_event event); | 250 | enum bfa_ioim_event event); |
263 | |||
264 | /* | 251 | /* |
265 | * forward declaration for BFA TSKIM functions | 252 | * forward declaration for BFA TSKIM functions |
266 | */ | 253 | */ |
267 | static void __bfa_cb_tskim_done(void *cbarg, bfa_boolean_t complete); | 254 | static void __bfa_cb_tskim_done(void *cbarg, bfa_boolean_t complete); |
268 | static void __bfa_cb_tskim_failed(void *cbarg, bfa_boolean_t complete); | 255 | static void __bfa_cb_tskim_failed(void *cbarg, bfa_boolean_t complete); |
269 | static bfa_boolean_t bfa_tskim_match_scope(struct bfa_tskim_s *tskim, | 256 | static bfa_boolean_t bfa_tskim_match_scope(struct bfa_tskim_s *tskim, |
270 | lun_t lun); | 257 | struct scsi_lun lun); |
271 | static void bfa_tskim_gather_ios(struct bfa_tskim_s *tskim); | 258 | static void bfa_tskim_gather_ios(struct bfa_tskim_s *tskim); |
272 | static void bfa_tskim_cleanp_comp(void *tskim_cbarg); | 259 | static void bfa_tskim_cleanp_comp(void *tskim_cbarg); |
273 | static void bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim); | 260 | static void bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim); |
@@ -275,7 +262,6 @@ static bfa_boolean_t bfa_tskim_send(struct bfa_tskim_s *tskim); | |||
275 | static bfa_boolean_t bfa_tskim_send_abort(struct bfa_tskim_s *tskim); | 262 | static bfa_boolean_t bfa_tskim_send_abort(struct bfa_tskim_s *tskim); |
276 | static void bfa_tskim_iocdisable_ios(struct bfa_tskim_s *tskim); | 263 | static void bfa_tskim_iocdisable_ios(struct bfa_tskim_s *tskim); |
277 | 264 | ||
278 | |||
279 | /* | 265 | /* |
280 | * forward declaration of BFA TSKIM state machine | 266 | * forward declaration of BFA TSKIM state machine |
281 | */ | 267 | */ |
@@ -293,13 +279,12 @@ static void bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim, | |||
293 | enum bfa_tskim_event event); | 279 | enum bfa_tskim_event event); |
294 | static void bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, | 280 | static void bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, |
295 | enum bfa_tskim_event event); | 281 | enum bfa_tskim_event event); |
296 | |||
297 | /* | 282 | /* |
298 | * hal_fcpim_mod BFA FCP Initiator Mode module | 283 | * BFA FCP Initiator Mode module |
299 | */ | 284 | */ |
300 | 285 | ||
301 | /* | 286 | /* |
302 | * Compute and return memory needed by FCP(im) module. | 287 | * Compute and return memory needed by FCP(im) module. |
303 | */ | 288 | */ |
304 | static void | 289 | static void |
305 | bfa_fcpim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, | 290 | bfa_fcpim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, |
@@ -357,10 +342,6 @@ bfa_fcpim_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
357 | static void | 342 | static void |
358 | bfa_fcpim_detach(struct bfa_s *bfa) | 343 | bfa_fcpim_detach(struct bfa_s *bfa) |
359 | { | 344 | { |
360 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | ||
361 | |||
362 | bfa_ioim_detach(fcpim); | ||
363 | bfa_tskim_detach(fcpim); | ||
364 | } | 345 | } |
365 | 346 | ||
366 | static void | 347 | static void |
@@ -387,56 +368,6 @@ bfa_fcpim_iocdisable(struct bfa_s *bfa) | |||
387 | } | 368 | } |
388 | 369 | ||
389 | void | 370 | void |
390 | bfa_fcpim_add_stats(struct bfa_itnim_iostats_s *lstats, | ||
391 | struct bfa_itnim_iostats_s *rstats) | ||
392 | { | ||
393 | bfa_fcpim_add_iostats(lstats, rstats, total_ios); | ||
394 | bfa_fcpim_add_iostats(lstats, rstats, qresumes); | ||
395 | bfa_fcpim_add_iostats(lstats, rstats, no_iotags); | ||
396 | bfa_fcpim_add_iostats(lstats, rstats, io_aborts); | ||
397 | bfa_fcpim_add_iostats(lstats, rstats, no_tskims); | ||
398 | bfa_fcpim_add_iostats(lstats, rstats, iocomp_ok); | ||
399 | bfa_fcpim_add_iostats(lstats, rstats, iocomp_underrun); | ||
400 | bfa_fcpim_add_iostats(lstats, rstats, iocomp_overrun); | ||
401 | bfa_fcpim_add_iostats(lstats, rstats, iocomp_aborted); | ||
402 | bfa_fcpim_add_iostats(lstats, rstats, iocomp_timedout); | ||
403 | bfa_fcpim_add_iostats(lstats, rstats, iocom_nexus_abort); | ||
404 | bfa_fcpim_add_iostats(lstats, rstats, iocom_proto_err); | ||
405 | bfa_fcpim_add_iostats(lstats, rstats, iocom_dif_err); | ||
406 | bfa_fcpim_add_iostats(lstats, rstats, iocom_sqer_needed); | ||
407 | bfa_fcpim_add_iostats(lstats, rstats, iocom_res_free); | ||
408 | bfa_fcpim_add_iostats(lstats, rstats, iocom_hostabrts); | ||
409 | bfa_fcpim_add_iostats(lstats, rstats, iocom_utags); | ||
410 | bfa_fcpim_add_iostats(lstats, rstats, io_cleanups); | ||
411 | bfa_fcpim_add_iostats(lstats, rstats, io_tmaborts); | ||
412 | bfa_fcpim_add_iostats(lstats, rstats, onlines); | ||
413 | bfa_fcpim_add_iostats(lstats, rstats, offlines); | ||
414 | bfa_fcpim_add_iostats(lstats, rstats, creates); | ||
415 | bfa_fcpim_add_iostats(lstats, rstats, deletes); | ||
416 | bfa_fcpim_add_iostats(lstats, rstats, create_comps); | ||
417 | bfa_fcpim_add_iostats(lstats, rstats, delete_comps); | ||
418 | bfa_fcpim_add_iostats(lstats, rstats, sler_events); | ||
419 | bfa_fcpim_add_iostats(lstats, rstats, fw_create); | ||
420 | bfa_fcpim_add_iostats(lstats, rstats, fw_delete); | ||
421 | bfa_fcpim_add_iostats(lstats, rstats, ioc_disabled); | ||
422 | bfa_fcpim_add_iostats(lstats, rstats, cleanup_comps); | ||
423 | bfa_fcpim_add_iostats(lstats, rstats, tm_cmnds); | ||
424 | bfa_fcpim_add_iostats(lstats, rstats, tm_fw_rsps); | ||
425 | bfa_fcpim_add_iostats(lstats, rstats, tm_success); | ||
426 | bfa_fcpim_add_iostats(lstats, rstats, tm_failures); | ||
427 | bfa_fcpim_add_iostats(lstats, rstats, tm_io_comps); | ||
428 | bfa_fcpim_add_iostats(lstats, rstats, tm_qresumes); | ||
429 | bfa_fcpim_add_iostats(lstats, rstats, tm_iocdowns); | ||
430 | bfa_fcpim_add_iostats(lstats, rstats, tm_cleanups); | ||
431 | bfa_fcpim_add_iostats(lstats, rstats, tm_cleanup_comps); | ||
432 | bfa_fcpim_add_iostats(lstats, rstats, io_comps); | ||
433 | bfa_fcpim_add_iostats(lstats, rstats, input_reqs); | ||
434 | bfa_fcpim_add_iostats(lstats, rstats, output_reqs); | ||
435 | bfa_fcpim_add_iostats(lstats, rstats, rd_throughput); | ||
436 | bfa_fcpim_add_iostats(lstats, rstats, wr_throughput); | ||
437 | } | ||
438 | |||
439 | void | ||
440 | bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov) | 371 | bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov) |
441 | { | 372 | { |
442 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | 373 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); |
@@ -454,128 +385,6 @@ bfa_fcpim_path_tov_get(struct bfa_s *bfa) | |||
454 | return fcpim->path_tov / 1000; | 385 | return fcpim->path_tov / 1000; |
455 | } | 386 | } |
456 | 387 | ||
457 | bfa_status_t | ||
458 | bfa_fcpim_port_iostats(struct bfa_s *bfa, struct bfa_itnim_iostats_s *stats, | ||
459 | u8 lp_tag) | ||
460 | { | ||
461 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | ||
462 | struct list_head *qe, *qen; | ||
463 | struct bfa_itnim_s *itnim; | ||
464 | |||
465 | /* accumulate IO stats from itnim */ | ||
466 | memset(stats, 0, sizeof(struct bfa_itnim_iostats_s)); | ||
467 | list_for_each_safe(qe, qen, &fcpim->itnim_q) { | ||
468 | itnim = (struct bfa_itnim_s *) qe; | ||
469 | if (itnim->rport->rport_info.lp_tag != lp_tag) | ||
470 | continue; | ||
471 | bfa_fcpim_add_stats(stats, &(itnim->stats)); | ||
472 | } | ||
473 | return BFA_STATUS_OK; | ||
474 | } | ||
475 | bfa_status_t | ||
476 | bfa_fcpim_get_modstats(struct bfa_s *bfa, struct bfa_itnim_iostats_s *modstats) | ||
477 | { | ||
478 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | ||
479 | struct list_head *qe, *qen; | ||
480 | struct bfa_itnim_s *itnim; | ||
481 | |||
482 | /* accumulate IO stats from itnim */ | ||
483 | memset(modstats, 0, sizeof(struct bfa_itnim_iostats_s)); | ||
484 | list_for_each_safe(qe, qen, &fcpim->itnim_q) { | ||
485 | itnim = (struct bfa_itnim_s *) qe; | ||
486 | bfa_fcpim_add_stats(modstats, &(itnim->stats)); | ||
487 | } | ||
488 | return BFA_STATUS_OK; | ||
489 | } | ||
490 | |||
491 | bfa_status_t | ||
492 | bfa_fcpim_get_del_itn_stats(struct bfa_s *bfa, | ||
493 | struct bfa_fcpim_del_itn_stats_s *modstats) | ||
494 | { | ||
495 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | ||
496 | |||
497 | *modstats = fcpim->del_itn_stats; | ||
498 | |||
499 | return BFA_STATUS_OK; | ||
500 | } | ||
501 | |||
502 | |||
503 | bfa_status_t | ||
504 | bfa_fcpim_profile_on(struct bfa_s *bfa, u32 time) | ||
505 | { | ||
506 | struct bfa_itnim_s *itnim; | ||
507 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | ||
508 | struct list_head *qe, *qen; | ||
509 | |||
510 | /* accumulate IO stats from itnim */ | ||
511 | list_for_each_safe(qe, qen, &fcpim->itnim_q) { | ||
512 | itnim = (struct bfa_itnim_s *) qe; | ||
513 | bfa_itnim_clear_stats(itnim); | ||
514 | } | ||
515 | fcpim->io_profile = BFA_TRUE; | ||
516 | fcpim->io_profile_start_time = time; | ||
517 | fcpim->profile_comp = bfa_ioim_profile_comp; | ||
518 | fcpim->profile_start = bfa_ioim_profile_start; | ||
519 | |||
520 | return BFA_STATUS_OK; | ||
521 | } | ||
522 | bfa_status_t | ||
523 | bfa_fcpim_profile_off(struct bfa_s *bfa) | ||
524 | { | ||
525 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | ||
526 | fcpim->io_profile = BFA_FALSE; | ||
527 | fcpim->io_profile_start_time = 0; | ||
528 | fcpim->profile_comp = NULL; | ||
529 | fcpim->profile_start = NULL; | ||
530 | return BFA_STATUS_OK; | ||
531 | } | ||
532 | |||
533 | bfa_status_t | ||
534 | bfa_fcpim_port_clear_iostats(struct bfa_s *bfa, u8 lp_tag) | ||
535 | { | ||
536 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | ||
537 | struct list_head *qe, *qen; | ||
538 | struct bfa_itnim_s *itnim; | ||
539 | |||
540 | /* clear IO stats from all active itnims */ | ||
541 | list_for_each_safe(qe, qen, &fcpim->itnim_q) { | ||
542 | itnim = (struct bfa_itnim_s *) qe; | ||
543 | if (itnim->rport->rport_info.lp_tag != lp_tag) | ||
544 | continue; | ||
545 | bfa_itnim_clear_stats(itnim); | ||
546 | } | ||
547 | return BFA_STATUS_OK; | ||
548 | |||
549 | } | ||
550 | |||
551 | bfa_status_t | ||
552 | bfa_fcpim_clr_modstats(struct bfa_s *bfa) | ||
553 | { | ||
554 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | ||
555 | struct list_head *qe, *qen; | ||
556 | struct bfa_itnim_s *itnim; | ||
557 | |||
558 | /* clear IO stats from all active itnims */ | ||
559 | list_for_each_safe(qe, qen, &fcpim->itnim_q) { | ||
560 | itnim = (struct bfa_itnim_s *) qe; | ||
561 | bfa_itnim_clear_stats(itnim); | ||
562 | } | ||
563 | memset(&fcpim->del_itn_stats, 0, | ||
564 | sizeof(struct bfa_fcpim_del_itn_stats_s)); | ||
565 | |||
566 | return BFA_STATUS_OK; | ||
567 | } | ||
568 | |||
569 | void | ||
570 | bfa_fcpim_qdepth_set(struct bfa_s *bfa, u16 q_depth) | ||
571 | { | ||
572 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | ||
573 | |||
574 | bfa_assert(q_depth <= BFA_IOCFC_QDEPTH_MAX); | ||
575 | |||
576 | fcpim->q_depth = q_depth; | ||
577 | } | ||
578 | |||
579 | u16 | 388 | u16 |
580 | bfa_fcpim_qdepth_get(struct bfa_s *bfa) | 389 | bfa_fcpim_qdepth_get(struct bfa_s *bfa) |
581 | { | 390 | { |
@@ -584,32 +393,12 @@ bfa_fcpim_qdepth_get(struct bfa_s *bfa) | |||
584 | return fcpim->q_depth; | 393 | return fcpim->q_depth; |
585 | } | 394 | } |
586 | 395 | ||
587 | void | ||
588 | bfa_fcpim_update_ioredirect(struct bfa_s *bfa) | ||
589 | { | ||
590 | bfa_boolean_t ioredirect; | ||
591 | |||
592 | /* | ||
593 | * IO redirection is turned off when QoS is enabled and vice versa | ||
594 | */ | ||
595 | ioredirect = bfa_fcport_is_qos_enabled(bfa) ? BFA_FALSE : BFA_TRUE; | ||
596 | } | ||
597 | |||
598 | void | ||
599 | bfa_fcpim_set_ioredirect(struct bfa_s *bfa, bfa_boolean_t state) | ||
600 | { | ||
601 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | ||
602 | fcpim->ioredirect = state; | ||
603 | } | ||
604 | |||
605 | |||
606 | |||
607 | /* | 396 | /* |
608 | * BFA ITNIM module state machine functions | 397 | * BFA ITNIM module state machine functions |
609 | */ | 398 | */ |
610 | 399 | ||
611 | /* | 400 | /* |
612 | * Beginning/unallocated state - no events expected. | 401 | * Beginning/unallocated state - no events expected. |
613 | */ | 402 | */ |
614 | static void | 403 | static void |
615 | bfa_itnim_sm_uninit(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | 404 | bfa_itnim_sm_uninit(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) |
@@ -630,7 +419,7 @@ bfa_itnim_sm_uninit(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
630 | } | 419 | } |
631 | 420 | ||
632 | /* | 421 | /* |
633 | * Beginning state, only online event expected. | 422 | * Beginning state, only online event expected. |
634 | */ | 423 | */ |
635 | static void | 424 | static void |
636 | bfa_itnim_sm_created(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | 425 | bfa_itnim_sm_created(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) |
@@ -733,7 +522,7 @@ bfa_itnim_sm_fwcreate_qfull(struct bfa_itnim_s *itnim, | |||
733 | } | 522 | } |
734 | 523 | ||
735 | /* | 524 | /* |
736 | * Waiting for itnim create response from firmware, a delete is pending. | 525 | * Waiting for itnim create response from firmware, a delete is pending. |
737 | */ | 526 | */ |
738 | static void | 527 | static void |
739 | bfa_itnim_sm_delete_pending(struct bfa_itnim_s *itnim, | 528 | bfa_itnim_sm_delete_pending(struct bfa_itnim_s *itnim, |
@@ -761,7 +550,7 @@ bfa_itnim_sm_delete_pending(struct bfa_itnim_s *itnim, | |||
761 | } | 550 | } |
762 | 551 | ||
763 | /* | 552 | /* |
764 | * Online state - normal parking state. | 553 | * Online state - normal parking state. |
765 | */ | 554 | */ |
766 | static void | 555 | static void |
767 | bfa_itnim_sm_online(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | 556 | bfa_itnim_sm_online(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) |
@@ -803,7 +592,7 @@ bfa_itnim_sm_online(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
803 | } | 592 | } |
804 | 593 | ||
805 | /* | 594 | /* |
806 | * Second level error recovery need. | 595 | * Second level error recovery need. |
807 | */ | 596 | */ |
808 | static void | 597 | static void |
809 | bfa_itnim_sm_sler(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | 598 | bfa_itnim_sm_sler(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) |
@@ -834,7 +623,7 @@ bfa_itnim_sm_sler(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
834 | } | 623 | } |
835 | 624 | ||
836 | /* | 625 | /* |
837 | * Going offline. Waiting for active IO cleanup. | 626 | * Going offline. Waiting for active IO cleanup. |
838 | */ | 627 | */ |
839 | static void | 628 | static void |
840 | bfa_itnim_sm_cleanup_offline(struct bfa_itnim_s *itnim, | 629 | bfa_itnim_sm_cleanup_offline(struct bfa_itnim_s *itnim, |
@@ -871,7 +660,7 @@ bfa_itnim_sm_cleanup_offline(struct bfa_itnim_s *itnim, | |||
871 | } | 660 | } |
872 | 661 | ||
873 | /* | 662 | /* |
874 | * Deleting itnim. Waiting for active IO cleanup. | 663 | * Deleting itnim. Waiting for active IO cleanup. |
875 | */ | 664 | */ |
876 | static void | 665 | static void |
877 | bfa_itnim_sm_cleanup_delete(struct bfa_itnim_s *itnim, | 666 | bfa_itnim_sm_cleanup_delete(struct bfa_itnim_s *itnim, |
@@ -956,7 +745,7 @@ bfa_itnim_sm_fwdelete_qfull(struct bfa_itnim_s *itnim, | |||
956 | } | 745 | } |
957 | 746 | ||
958 | /* | 747 | /* |
959 | * Offline state. | 748 | * Offline state. |
960 | */ | 749 | */ |
961 | static void | 750 | static void |
962 | bfa_itnim_sm_offline(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | 751 | bfa_itnim_sm_offline(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) |
@@ -987,9 +776,6 @@ bfa_itnim_sm_offline(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
987 | } | 776 | } |
988 | } | 777 | } |
989 | 778 | ||
990 | /* | ||
991 | * IOC h/w failed state. | ||
992 | */ | ||
993 | static void | 779 | static void |
994 | bfa_itnim_sm_iocdisable(struct bfa_itnim_s *itnim, | 780 | bfa_itnim_sm_iocdisable(struct bfa_itnim_s *itnim, |
995 | enum bfa_itnim_event event) | 781 | enum bfa_itnim_event event) |
@@ -1024,7 +810,7 @@ bfa_itnim_sm_iocdisable(struct bfa_itnim_s *itnim, | |||
1024 | } | 810 | } |
1025 | 811 | ||
1026 | /* | 812 | /* |
1027 | * Itnim is deleted, waiting for firmware response to delete. | 813 | * Itnim is deleted, waiting for firmware response to delete. |
1028 | */ | 814 | */ |
1029 | static void | 815 | static void |
1030 | bfa_itnim_sm_deleting(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | 816 | bfa_itnim_sm_deleting(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) |
@@ -1069,7 +855,7 @@ bfa_itnim_sm_deleting_qfull(struct bfa_itnim_s *itnim, | |||
1069 | } | 855 | } |
1070 | 856 | ||
1071 | /* | 857 | /* |
1072 | * Initiate cleanup of all IOs on an IOC failure. | 858 | * Initiate cleanup of all IOs on an IOC failure. |
1073 | */ | 859 | */ |
1074 | static void | 860 | static void |
1075 | bfa_itnim_iocdisable_cleanup(struct bfa_itnim_s *itnim) | 861 | bfa_itnim_iocdisable_cleanup(struct bfa_itnim_s *itnim) |
@@ -1103,7 +889,7 @@ bfa_itnim_iocdisable_cleanup(struct bfa_itnim_s *itnim) | |||
1103 | } | 889 | } |
1104 | 890 | ||
1105 | /* | 891 | /* |
1106 | * IO cleanup completion | 892 | * IO cleanup completion |
1107 | */ | 893 | */ |
1108 | static void | 894 | static void |
1109 | bfa_itnim_cleanp_comp(void *itnim_cbarg) | 895 | bfa_itnim_cleanp_comp(void *itnim_cbarg) |
@@ -1115,7 +901,7 @@ bfa_itnim_cleanp_comp(void *itnim_cbarg) | |||
1115 | } | 901 | } |
1116 | 902 | ||
1117 | /* | 903 | /* |
1118 | * Initiate cleanup of all IOs. | 904 | * Initiate cleanup of all IOs. |
1119 | */ | 905 | */ |
1120 | static void | 906 | static void |
1121 | bfa_itnim_cleanup(struct bfa_itnim_s *itnim) | 907 | bfa_itnim_cleanup(struct bfa_itnim_s *itnim) |
@@ -1187,9 +973,6 @@ bfa_itnim_qresume(void *cbarg) | |||
1187 | bfa_sm_send_event(itnim, BFA_ITNIM_SM_QRESUME); | 973 | bfa_sm_send_event(itnim, BFA_ITNIM_SM_QRESUME); |
1188 | } | 974 | } |
1189 | 975 | ||
1190 | |||
1191 | |||
1192 | |||
1193 | /* | 976 | /* |
1194 | * bfa_itnim_public | 977 | * bfa_itnim_public |
1195 | */ | 978 | */ |
@@ -1401,7 +1184,7 @@ bfa_itnim_iotov_start(struct bfa_itnim_s *itnim) | |||
1401 | if (itnim->fcpim->path_tov > 0) { | 1184 | if (itnim->fcpim->path_tov > 0) { |
1402 | 1185 | ||
1403 | itnim->iotov_active = BFA_TRUE; | 1186 | itnim->iotov_active = BFA_TRUE; |
1404 | bfa_assert(bfa_itnim_hold_io(itnim)); | 1187 | WARN_ON(!bfa_itnim_hold_io(itnim)); |
1405 | bfa_timer_start(itnim->bfa, &itnim->timer, | 1188 | bfa_timer_start(itnim->bfa, &itnim->timer, |
1406 | bfa_itnim_iotov, itnim, itnim->fcpim->path_tov); | 1189 | bfa_itnim_iotov, itnim, itnim->fcpim->path_tov); |
1407 | } | 1190 | } |
@@ -1457,14 +1240,12 @@ bfa_itnim_update_del_itn_stats(struct bfa_itnim_s *itnim) | |||
1457 | fcpim->del_itn_stats.del_tm_iocdowns += itnim->stats.tm_iocdowns; | 1240 | fcpim->del_itn_stats.del_tm_iocdowns += itnim->stats.tm_iocdowns; |
1458 | } | 1241 | } |
1459 | 1242 | ||
1460 | |||
1461 | |||
1462 | /* | 1243 | /* |
1463 | * bfa_itnim_public | 1244 | * bfa_itnim_public |
1464 | */ | 1245 | */ |
1465 | 1246 | ||
1466 | /* | 1247 | /* |
1467 | * Itnim interrupt processing. | 1248 | * Itnim interrupt processing. |
1468 | */ | 1249 | */ |
1469 | void | 1250 | void |
1470 | bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | 1251 | bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) |
@@ -1481,7 +1262,7 @@ bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
1481 | case BFI_ITNIM_I2H_CREATE_RSP: | 1262 | case BFI_ITNIM_I2H_CREATE_RSP: |
1482 | itnim = BFA_ITNIM_FROM_TAG(fcpim, | 1263 | itnim = BFA_ITNIM_FROM_TAG(fcpim, |
1483 | msg.create_rsp->bfa_handle); | 1264 | msg.create_rsp->bfa_handle); |
1484 | bfa_assert(msg.create_rsp->status == BFA_STATUS_OK); | 1265 | WARN_ON(msg.create_rsp->status != BFA_STATUS_OK); |
1485 | bfa_stats(itnim, create_comps); | 1266 | bfa_stats(itnim, create_comps); |
1486 | bfa_sm_send_event(itnim, BFA_ITNIM_SM_FWRSP); | 1267 | bfa_sm_send_event(itnim, BFA_ITNIM_SM_FWRSP); |
1487 | break; | 1268 | break; |
@@ -1489,7 +1270,7 @@ bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
1489 | case BFI_ITNIM_I2H_DELETE_RSP: | 1270 | case BFI_ITNIM_I2H_DELETE_RSP: |
1490 | itnim = BFA_ITNIM_FROM_TAG(fcpim, | 1271 | itnim = BFA_ITNIM_FROM_TAG(fcpim, |
1491 | msg.delete_rsp->bfa_handle); | 1272 | msg.delete_rsp->bfa_handle); |
1492 | bfa_assert(msg.delete_rsp->status == BFA_STATUS_OK); | 1273 | WARN_ON(msg.delete_rsp->status != BFA_STATUS_OK); |
1493 | bfa_stats(itnim, delete_comps); | 1274 | bfa_stats(itnim, delete_comps); |
1494 | bfa_sm_send_event(itnim, BFA_ITNIM_SM_FWRSP); | 1275 | bfa_sm_send_event(itnim, BFA_ITNIM_SM_FWRSP); |
1495 | break; | 1276 | break; |
@@ -1503,14 +1284,12 @@ bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
1503 | 1284 | ||
1504 | default: | 1285 | default: |
1505 | bfa_trc(bfa, m->mhdr.msg_id); | 1286 | bfa_trc(bfa, m->mhdr.msg_id); |
1506 | bfa_assert(0); | 1287 | WARN_ON(1); |
1507 | } | 1288 | } |
1508 | } | 1289 | } |
1509 | 1290 | ||
1510 | |||
1511 | |||
1512 | /* | 1291 | /* |
1513 | * bfa_itnim_api | 1292 | * bfa_itnim_api |
1514 | */ | 1293 | */ |
1515 | 1294 | ||
1516 | struct bfa_itnim_s * | 1295 | struct bfa_itnim_s * |
@@ -1520,7 +1299,7 @@ bfa_itnim_create(struct bfa_s *bfa, struct bfa_rport_s *rport, void *ditn) | |||
1520 | struct bfa_itnim_s *itnim; | 1299 | struct bfa_itnim_s *itnim; |
1521 | 1300 | ||
1522 | itnim = BFA_ITNIM_FROM_TAG(fcpim, rport->rport_tag); | 1301 | itnim = BFA_ITNIM_FROM_TAG(fcpim, rport->rport_tag); |
1523 | bfa_assert(itnim->rport == rport); | 1302 | WARN_ON(itnim->rport != rport); |
1524 | 1303 | ||
1525 | itnim->ditn = ditn; | 1304 | itnim->ditn = ditn; |
1526 | 1305 | ||
@@ -1568,31 +1347,6 @@ bfa_itnim_hold_io(struct bfa_itnim_s *itnim) | |||
1568 | bfa_sm_cmp_state(itnim, bfa_itnim_sm_iocdisable)); | 1347 | bfa_sm_cmp_state(itnim, bfa_itnim_sm_iocdisable)); |
1569 | } | 1348 | } |
1570 | 1349 | ||
1571 | bfa_status_t | ||
1572 | bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim, | ||
1573 | struct bfa_itnim_ioprofile_s *ioprofile) | ||
1574 | { | ||
1575 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(itnim->bfa); | ||
1576 | if (!fcpim->io_profile) | ||
1577 | return BFA_STATUS_IOPROFILE_OFF; | ||
1578 | |||
1579 | itnim->ioprofile.index = BFA_IOBUCKET_MAX; | ||
1580 | itnim->ioprofile.io_profile_start_time = | ||
1581 | bfa_io_profile_start_time(itnim->bfa); | ||
1582 | itnim->ioprofile.clock_res_mul = bfa_io_lat_clock_res_mul; | ||
1583 | itnim->ioprofile.clock_res_div = bfa_io_lat_clock_res_div; | ||
1584 | *ioprofile = itnim->ioprofile; | ||
1585 | |||
1586 | return BFA_STATUS_OK; | ||
1587 | } | ||
1588 | |||
1589 | void | ||
1590 | bfa_itnim_get_stats(struct bfa_itnim_s *itnim, | ||
1591 | struct bfa_itnim_iostats_s *stats) | ||
1592 | { | ||
1593 | *stats = itnim->stats; | ||
1594 | } | ||
1595 | |||
1596 | void | 1350 | void |
1597 | bfa_itnim_clear_stats(struct bfa_itnim_s *itnim) | 1351 | bfa_itnim_clear_stats(struct bfa_itnim_s *itnim) |
1598 | { | 1352 | { |
@@ -1608,14 +1362,11 @@ bfa_itnim_clear_stats(struct bfa_itnim_s *itnim) | |||
1608 | */ | 1362 | */ |
1609 | 1363 | ||
1610 | /* | 1364 | /* |
1611 | * IO is not started (unallocated). | 1365 | * IO is not started (unallocated). |
1612 | */ | 1366 | */ |
1613 | static void | 1367 | static void |
1614 | bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | 1368 | bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) |
1615 | { | 1369 | { |
1616 | bfa_trc_fp(ioim->bfa, ioim->iotag); | ||
1617 | bfa_trc_fp(ioim->bfa, event); | ||
1618 | |||
1619 | switch (event) { | 1370 | switch (event) { |
1620 | case BFA_IOIM_SM_START: | 1371 | case BFA_IOIM_SM_START: |
1621 | if (!bfa_itnim_is_online(ioim->itnim)) { | 1372 | if (!bfa_itnim_is_online(ioim->itnim)) { |
@@ -1635,7 +1386,7 @@ bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
1635 | } | 1386 | } |
1636 | 1387 | ||
1637 | if (ioim->nsges > BFI_SGE_INLINE) { | 1388 | if (ioim->nsges > BFI_SGE_INLINE) { |
1638 | if (!bfa_ioim_sge_setup(ioim)) { | 1389 | if (!bfa_ioim_sgpg_alloc(ioim)) { |
1639 | bfa_sm_set_state(ioim, bfa_ioim_sm_sgalloc); | 1390 | bfa_sm_set_state(ioim, bfa_ioim_sm_sgalloc); |
1640 | return; | 1391 | return; |
1641 | } | 1392 | } |
@@ -1662,7 +1413,7 @@ bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
1662 | * requests immediately. | 1413 | * requests immediately. |
1663 | */ | 1414 | */ |
1664 | bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); | 1415 | bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); |
1665 | bfa_assert(bfa_q_is_on_q(&ioim->itnim->pending_q, ioim)); | 1416 | WARN_ON(!bfa_q_is_on_q(&ioim->itnim->pending_q, ioim)); |
1666 | bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, | 1417 | bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, |
1667 | __bfa_cb_ioim_abort, ioim); | 1418 | __bfa_cb_ioim_abort, ioim); |
1668 | break; | 1419 | break; |
@@ -1673,7 +1424,7 @@ bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
1673 | } | 1424 | } |
1674 | 1425 | ||
1675 | /* | 1426 | /* |
1676 | * IO is waiting for SG pages. | 1427 | * IO is waiting for SG pages. |
1677 | */ | 1428 | */ |
1678 | static void | 1429 | static void |
1679 | bfa_ioim_sm_sgalloc(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | 1430 | bfa_ioim_sm_sgalloc(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) |
@@ -1720,14 +1471,11 @@ bfa_ioim_sm_sgalloc(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
1720 | } | 1471 | } |
1721 | 1472 | ||
1722 | /* | 1473 | /* |
1723 | * IO is active. | 1474 | * IO is active. |
1724 | */ | 1475 | */ |
1725 | static void | 1476 | static void |
1726 | bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | 1477 | bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) |
1727 | { | 1478 | { |
1728 | bfa_trc_fp(ioim->bfa, ioim->iotag); | ||
1729 | bfa_trc_fp(ioim->bfa, event); | ||
1730 | |||
1731 | switch (event) { | 1479 | switch (event) { |
1732 | case BFA_IOIM_SM_COMP_GOOD: | 1480 | case BFA_IOIM_SM_COMP_GOOD: |
1733 | bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); | 1481 | bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); |
@@ -1786,8 +1534,8 @@ bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
1786 | break; | 1534 | break; |
1787 | 1535 | ||
1788 | case BFA_IOIM_SM_SQRETRY: | 1536 | case BFA_IOIM_SM_SQRETRY: |
1789 | if (bfa_ioim_get_iotag(ioim) != BFA_TRUE) { | 1537 | if (bfa_ioim_maxretry_reached(ioim)) { |
1790 | /* max retry completed free IO */ | 1538 | /* max retry reached, free IO */ |
1791 | bfa_sm_set_state(ioim, bfa_ioim_sm_hcb_free); | 1539 | bfa_sm_set_state(ioim, bfa_ioim_sm_hcb_free); |
1792 | bfa_ioim_move_to_comp_q(ioim); | 1540 | bfa_ioim_move_to_comp_q(ioim); |
1793 | bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, | 1541 | bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, |
@@ -1804,17 +1552,15 @@ bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
1804 | } | 1552 | } |
1805 | 1553 | ||
1806 | /* | 1554 | /* |
1807 | * IO is retried with new tag. | 1555 | * IO is retried with new tag. |
1808 | */ | 1556 | */ |
1809 | static void | 1557 | static void |
1810 | bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | 1558 | bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) |
1811 | { | 1559 | { |
1812 | bfa_trc_fp(ioim->bfa, ioim->iotag); | ||
1813 | bfa_trc_fp(ioim->bfa, event); | ||
1814 | |||
1815 | switch (event) { | 1560 | switch (event) { |
1816 | case BFA_IOIM_SM_FREE: | 1561 | case BFA_IOIM_SM_FREE: |
1817 | /* abts and rrq done. Now retry the IO with new tag */ | 1562 | /* abts and rrq done. Now retry the IO with new tag */ |
1563 | bfa_ioim_update_iotag(ioim); | ||
1818 | if (!bfa_ioim_send_ioreq(ioim)) { | 1564 | if (!bfa_ioim_send_ioreq(ioim)) { |
1819 | bfa_sm_set_state(ioim, bfa_ioim_sm_qfull); | 1565 | bfa_sm_set_state(ioim, bfa_ioim_sm_qfull); |
1820 | break; | 1566 | break; |
@@ -1858,7 +1604,7 @@ bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
1858 | } | 1604 | } |
1859 | 1605 | ||
1860 | /* | 1606 | /* |
1861 | * IO is being aborted, waiting for completion from firmware. | 1607 | * IO is being aborted, waiting for completion from firmware. |
1862 | */ | 1608 | */ |
1863 | static void | 1609 | static void |
1864 | bfa_ioim_sm_abort(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | 1610 | bfa_ioim_sm_abort(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) |
@@ -1894,7 +1640,7 @@ bfa_ioim_sm_abort(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
1894 | break; | 1640 | break; |
1895 | 1641 | ||
1896 | case BFA_IOIM_SM_CLEANUP: | 1642 | case BFA_IOIM_SM_CLEANUP: |
1897 | bfa_assert(ioim->iosp->abort_explicit == BFA_TRUE); | 1643 | WARN_ON(ioim->iosp->abort_explicit != BFA_TRUE); |
1898 | ioim->iosp->abort_explicit = BFA_FALSE; | 1644 | ioim->iosp->abort_explicit = BFA_FALSE; |
1899 | 1645 | ||
1900 | if (bfa_ioim_send_abort(ioim)) | 1646 | if (bfa_ioim_send_abort(ioim)) |
@@ -1981,7 +1727,7 @@ bfa_ioim_sm_cleanup(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
1981 | } | 1727 | } |
1982 | 1728 | ||
1983 | /* | 1729 | /* |
1984 | * IO is waiting for room in request CQ | 1730 | * IO is waiting for room in request CQ |
1985 | */ | 1731 | */ |
1986 | static void | 1732 | static void |
1987 | bfa_ioim_sm_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | 1733 | bfa_ioim_sm_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) |
@@ -2025,7 +1771,7 @@ bfa_ioim_sm_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
2025 | } | 1771 | } |
2026 | 1772 | ||
2027 | /* | 1773 | /* |
2028 | * Active IO is being aborted, waiting for room in request CQ. | 1774 | * Active IO is being aborted, waiting for room in request CQ. |
2029 | */ | 1775 | */ |
2030 | static void | 1776 | static void |
2031 | bfa_ioim_sm_abort_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | 1777 | bfa_ioim_sm_abort_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) |
@@ -2040,7 +1786,7 @@ bfa_ioim_sm_abort_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
2040 | break; | 1786 | break; |
2041 | 1787 | ||
2042 | case BFA_IOIM_SM_CLEANUP: | 1788 | case BFA_IOIM_SM_CLEANUP: |
2043 | bfa_assert(ioim->iosp->abort_explicit == BFA_TRUE); | 1789 | WARN_ON(ioim->iosp->abort_explicit != BFA_TRUE); |
2044 | ioim->iosp->abort_explicit = BFA_FALSE; | 1790 | ioim->iosp->abort_explicit = BFA_FALSE; |
2045 | bfa_sm_set_state(ioim, bfa_ioim_sm_cleanup_qfull); | 1791 | bfa_sm_set_state(ioim, bfa_ioim_sm_cleanup_qfull); |
2046 | break; | 1792 | break; |
@@ -2076,7 +1822,7 @@ bfa_ioim_sm_abort_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
2076 | } | 1822 | } |
2077 | 1823 | ||
2078 | /* | 1824 | /* |
2079 | * Active IO is being cleaned up, waiting for room in request CQ. | 1825 | * Active IO is being cleaned up, waiting for room in request CQ. |
2080 | */ | 1826 | */ |
2081 | static void | 1827 | static void |
2082 | bfa_ioim_sm_cleanup_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | 1828 | bfa_ioim_sm_cleanup_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) |
@@ -2131,9 +1877,6 @@ bfa_ioim_sm_cleanup_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
2131 | static void | 1877 | static void |
2132 | bfa_ioim_sm_hcb(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | 1878 | bfa_ioim_sm_hcb(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) |
2133 | { | 1879 | { |
2134 | bfa_trc_fp(ioim->bfa, ioim->iotag); | ||
2135 | bfa_trc_fp(ioim->bfa, event); | ||
2136 | |||
2137 | switch (event) { | 1880 | switch (event) { |
2138 | case BFA_IOIM_SM_HCB: | 1881 | case BFA_IOIM_SM_HCB: |
2139 | bfa_sm_set_state(ioim, bfa_ioim_sm_uninit); | 1882 | bfa_sm_set_state(ioim, bfa_ioim_sm_uninit); |
@@ -2213,11 +1956,6 @@ bfa_ioim_sm_resfree(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
2213 | } | 1956 | } |
2214 | 1957 | ||
2215 | 1958 | ||
2216 | |||
2217 | /* | ||
2218 | * hal_ioim_private | ||
2219 | */ | ||
2220 | |||
2221 | static void | 1959 | static void |
2222 | __bfa_cb_ioim_good_comp(void *cbarg, bfa_boolean_t complete) | 1960 | __bfa_cb_ioim_good_comp(void *cbarg, bfa_boolean_t complete) |
2223 | { | 1961 | { |
@@ -2323,7 +2061,7 @@ bfa_ioim_sgpg_alloced(void *cbarg) | |||
2323 | 2061 | ||
2324 | ioim->nsgpgs = BFA_SGPG_NPAGE(ioim->nsges); | 2062 | ioim->nsgpgs = BFA_SGPG_NPAGE(ioim->nsges); |
2325 | list_splice_tail_init(&ioim->iosp->sgpg_wqe.sgpg_q, &ioim->sgpg_q); | 2063 | list_splice_tail_init(&ioim->iosp->sgpg_wqe.sgpg_q, &ioim->sgpg_q); |
2326 | bfa_ioim_sgpg_setup(ioim); | 2064 | ioim->sgpg = bfa_q_first(&ioim->sgpg_q); |
2327 | bfa_sm_send_event(ioim, BFA_IOIM_SM_SGALLOCED); | 2065 | bfa_sm_send_event(ioim, BFA_IOIM_SM_SGALLOCED); |
2328 | } | 2066 | } |
2329 | 2067 | ||
@@ -2335,13 +2073,16 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) | |||
2335 | { | 2073 | { |
2336 | struct bfa_itnim_s *itnim = ioim->itnim; | 2074 | struct bfa_itnim_s *itnim = ioim->itnim; |
2337 | struct bfi_ioim_req_s *m; | 2075 | struct bfi_ioim_req_s *m; |
2338 | static struct fcp_cmnd_s cmnd_z0 = { 0 }; | 2076 | static struct fcp_cmnd_s cmnd_z0 = { { { 0 } } }; |
2339 | struct bfi_sge_s *sge; | 2077 | struct bfi_sge_s *sge, *sgpge; |
2340 | u32 pgdlen = 0; | 2078 | u32 pgdlen = 0; |
2341 | u32 fcp_dl; | 2079 | u32 fcp_dl; |
2342 | u64 addr; | 2080 | u64 addr; |
2343 | struct scatterlist *sg; | 2081 | struct scatterlist *sg; |
2082 | struct bfa_sgpg_s *sgpg; | ||
2344 | struct scsi_cmnd *cmnd = (struct scsi_cmnd *) ioim->dio; | 2083 | struct scsi_cmnd *cmnd = (struct scsi_cmnd *) ioim->dio; |
2084 | u32 i, sge_id, pgcumsz; | ||
2085 | enum dma_data_direction dmadir; | ||
2345 | 2086 | ||
2346 | /* | 2087 | /* |
2347 | * check for room in queue to send request now | 2088 | * check for room in queue to send request now |
@@ -2359,22 +2100,61 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) | |||
2359 | */ | 2100 | */ |
2360 | m->io_tag = cpu_to_be16(ioim->iotag); | 2101 | m->io_tag = cpu_to_be16(ioim->iotag); |
2361 | m->rport_hdl = ioim->itnim->rport->fw_handle; | 2102 | m->rport_hdl = ioim->itnim->rport->fw_handle; |
2362 | m->io_timeout = bfa_cb_ioim_get_timeout(ioim->dio); | 2103 | m->io_timeout = 0; |
2363 | 2104 | ||
2364 | /* | ||
2365 | * build inline IO SG element here | ||
2366 | */ | ||
2367 | sge = &m->sges[0]; | 2105 | sge = &m->sges[0]; |
2368 | if (ioim->nsges) { | 2106 | sgpg = ioim->sgpg; |
2369 | sg = (struct scatterlist *)scsi_sglist(cmnd); | 2107 | sge_id = 0; |
2370 | addr = bfa_os_sgaddr(sg_dma_address(sg)); | 2108 | sgpge = NULL; |
2371 | sge->sga = *(union bfi_addr_u *) &addr; | 2109 | pgcumsz = 0; |
2372 | pgdlen = sg_dma_len(sg); | 2110 | scsi_for_each_sg(cmnd, sg, ioim->nsges, i) { |
2373 | sge->sg_len = pgdlen; | 2111 | if (i == 0) { |
2374 | sge->flags = (ioim->nsges > BFI_SGE_INLINE) ? | 2112 | /* build inline IO SG element */ |
2113 | addr = bfa_sgaddr_le(sg_dma_address(sg)); | ||
2114 | sge->sga = *(union bfi_addr_u *) &addr; | ||
2115 | pgdlen = sg_dma_len(sg); | ||
2116 | sge->sg_len = pgdlen; | ||
2117 | sge->flags = (ioim->nsges > BFI_SGE_INLINE) ? | ||
2375 | BFI_SGE_DATA_CPL : BFI_SGE_DATA_LAST; | 2118 | BFI_SGE_DATA_CPL : BFI_SGE_DATA_LAST; |
2376 | bfa_sge_to_be(sge); | 2119 | bfa_sge_to_be(sge); |
2377 | sge++; | 2120 | sge++; |
2121 | } else { | ||
2122 | if (sge_id == 0) | ||
2123 | sgpge = sgpg->sgpg->sges; | ||
2124 | |||
2125 | addr = bfa_sgaddr_le(sg_dma_address(sg)); | ||
2126 | sgpge->sga = *(union bfi_addr_u *) &addr; | ||
2127 | sgpge->sg_len = sg_dma_len(sg); | ||
2128 | pgcumsz += sgpge->sg_len; | ||
2129 | |||
2130 | /* set flags */ | ||
2131 | if (i < (ioim->nsges - 1) && | ||
2132 | sge_id < (BFI_SGPG_DATA_SGES - 1)) | ||
2133 | sgpge->flags = BFI_SGE_DATA; | ||
2134 | else if (i < (ioim->nsges - 1)) | ||
2135 | sgpge->flags = BFI_SGE_DATA_CPL; | ||
2136 | else | ||
2137 | sgpge->flags = BFI_SGE_DATA_LAST; | ||
2138 | |||
2139 | bfa_sge_to_le(sgpge); | ||
2140 | |||
2141 | sgpge++; | ||
2142 | if (i == (ioim->nsges - 1)) { | ||
2143 | sgpge->flags = BFI_SGE_PGDLEN; | ||
2144 | sgpge->sga.a32.addr_lo = 0; | ||
2145 | sgpge->sga.a32.addr_hi = 0; | ||
2146 | sgpge->sg_len = pgcumsz; | ||
2147 | bfa_sge_to_le(sgpge); | ||
2148 | } else if (++sge_id == BFI_SGPG_DATA_SGES) { | ||
2149 | sgpg = (struct bfa_sgpg_s *) bfa_q_next(sgpg); | ||
2150 | sgpge->flags = BFI_SGE_LINK; | ||
2151 | sgpge->sga = sgpg->sgpg_pa; | ||
2152 | sgpge->sg_len = pgcumsz; | ||
2153 | bfa_sge_to_le(sgpge); | ||
2154 | sge_id = 0; | ||
2155 | pgcumsz = 0; | ||
2156 | } | ||
2157 | } | ||
2378 | } | 2158 | } |
2379 | 2159 | ||
2380 | if (ioim->nsges > BFI_SGE_INLINE) { | 2160 | if (ioim->nsges > BFI_SGE_INLINE) { |
@@ -2391,10 +2171,17 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) | |||
2391 | * set up I/O command parameters | 2171 | * set up I/O command parameters |
2392 | */ | 2172 | */ |
2393 | m->cmnd = cmnd_z0; | 2173 | m->cmnd = cmnd_z0; |
2394 | m->cmnd.lun = bfa_cb_ioim_get_lun(ioim->dio); | 2174 | int_to_scsilun(cmnd->device->lun, &m->cmnd.lun); |
2395 | m->cmnd.iodir = bfa_cb_ioim_get_iodir(ioim->dio); | 2175 | dmadir = cmnd->sc_data_direction; |
2396 | m->cmnd.cdb = *(scsi_cdb_t *)bfa_cb_ioim_get_cdb(ioim->dio); | 2176 | if (dmadir == DMA_TO_DEVICE) |
2397 | fcp_dl = bfa_cb_ioim_get_size(ioim->dio); | 2177 | m->cmnd.iodir = FCP_IODIR_WRITE; |
2178 | else if (dmadir == DMA_FROM_DEVICE) | ||
2179 | m->cmnd.iodir = FCP_IODIR_READ; | ||
2180 | else | ||
2181 | m->cmnd.iodir = FCP_IODIR_NONE; | ||
2182 | |||
2183 | m->cmnd.cdb = *(struct scsi_cdb_s *) cmnd->cmnd; | ||
2184 | fcp_dl = scsi_bufflen(cmnd); | ||
2398 | m->cmnd.fcp_dl = cpu_to_be32(fcp_dl); | 2185 | m->cmnd.fcp_dl = cpu_to_be32(fcp_dl); |
2399 | 2186 | ||
2400 | /* | 2187 | /* |
@@ -2418,28 +2205,9 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) | |||
2418 | bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); | 2205 | bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); |
2419 | } | 2206 | } |
2420 | if (itnim->seq_rec || | 2207 | if (itnim->seq_rec || |
2421 | (bfa_cb_ioim_get_size(ioim->dio) & (sizeof(u32) - 1))) | 2208 | (scsi_bufflen(cmnd) & (sizeof(u32) - 1))) |
2422 | bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); | 2209 | bfi_h2i_set(m->mh, BFI_MC_IOIM_IO, 0, bfa_lpuid(ioim->bfa)); |
2423 | 2210 | ||
2424 | #ifdef IOIM_ADVANCED | ||
2425 | m->cmnd.crn = bfa_cb_ioim_get_crn(ioim->dio); | ||
2426 | m->cmnd.priority = bfa_cb_ioim_get_priority(ioim->dio); | ||
2427 | m->cmnd.taskattr = bfa_cb_ioim_get_taskattr(ioim->dio); | ||
2428 | |||
2429 | /* | ||
2430 | * Handle large CDB (>16 bytes). | ||
2431 | */ | ||
2432 | m->cmnd.addl_cdb_len = (bfa_cb_ioim_get_cdblen(ioim->dio) - | ||
2433 | FCP_CMND_CDB_LEN) / sizeof(u32); | ||
2434 | if (m->cmnd.addl_cdb_len) { | ||
2435 | memcpy(&m->cmnd.cdb + 1, (scsi_cdb_t *) | ||
2436 | bfa_cb_ioim_get_cdb(ioim->dio) + 1, | ||
2437 | m->cmnd.addl_cdb_len * sizeof(u32)); | ||
2438 | fcp_cmnd_fcpdl(&m->cmnd) = | ||
2439 | cpu_to_be32(bfa_cb_ioim_get_size(ioim->dio)); | ||
2440 | } | ||
2441 | #endif | ||
2442 | |||
2443 | /* | 2211 | /* |
2444 | * queue I/O message to firmware | 2212 | * queue I/O message to firmware |
2445 | */ | 2213 | */ |
@@ -2452,11 +2220,11 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) | |||
2452 | * at queuing time. | 2220 | * at queuing time. |
2453 | */ | 2221 | */ |
2454 | static bfa_boolean_t | 2222 | static bfa_boolean_t |
2455 | bfa_ioim_sge_setup(struct bfa_ioim_s *ioim) | 2223 | bfa_ioim_sgpg_alloc(struct bfa_ioim_s *ioim) |
2456 | { | 2224 | { |
2457 | u16 nsgpgs; | 2225 | u16 nsgpgs; |
2458 | 2226 | ||
2459 | bfa_assert(ioim->nsges > BFI_SGE_INLINE); | 2227 | WARN_ON(ioim->nsges <= BFI_SGE_INLINE); |
2460 | 2228 | ||
2461 | /* | 2229 | /* |
2462 | * allocate SG pages needed | 2230 | * allocate SG pages needed |
@@ -2472,73 +2240,11 @@ bfa_ioim_sge_setup(struct bfa_ioim_s *ioim) | |||
2472 | } | 2240 | } |
2473 | 2241 | ||
2474 | ioim->nsgpgs = nsgpgs; | 2242 | ioim->nsgpgs = nsgpgs; |
2475 | bfa_ioim_sgpg_setup(ioim); | 2243 | ioim->sgpg = bfa_q_first(&ioim->sgpg_q); |
2476 | 2244 | ||
2477 | return BFA_TRUE; | 2245 | return BFA_TRUE; |
2478 | } | 2246 | } |
2479 | 2247 | ||
2480 | static void | ||
2481 | bfa_ioim_sgpg_setup(struct bfa_ioim_s *ioim) | ||
2482 | { | ||
2483 | int sgeid, nsges, i; | ||
2484 | struct bfi_sge_s *sge; | ||
2485 | struct bfa_sgpg_s *sgpg; | ||
2486 | u32 pgcumsz; | ||
2487 | u64 addr; | ||
2488 | struct scatterlist *sg; | ||
2489 | struct scsi_cmnd *cmnd = (struct scsi_cmnd *) ioim->dio; | ||
2490 | |||
2491 | sgeid = BFI_SGE_INLINE; | ||
2492 | ioim->sgpg = sgpg = bfa_q_first(&ioim->sgpg_q); | ||
2493 | |||
2494 | sg = scsi_sglist(cmnd); | ||
2495 | sg = sg_next(sg); | ||
2496 | |||
2497 | do { | ||
2498 | sge = sgpg->sgpg->sges; | ||
2499 | nsges = ioim->nsges - sgeid; | ||
2500 | if (nsges > BFI_SGPG_DATA_SGES) | ||
2501 | nsges = BFI_SGPG_DATA_SGES; | ||
2502 | |||
2503 | pgcumsz = 0; | ||
2504 | for (i = 0; i < nsges; i++, sge++, sgeid++, sg = sg_next(sg)) { | ||
2505 | addr = bfa_os_sgaddr(sg_dma_address(sg)); | ||
2506 | sge->sga = *(union bfi_addr_u *) &addr; | ||
2507 | sge->sg_len = sg_dma_len(sg); | ||
2508 | pgcumsz += sge->sg_len; | ||
2509 | |||
2510 | /* | ||
2511 | * set flags | ||
2512 | */ | ||
2513 | if (i < (nsges - 1)) | ||
2514 | sge->flags = BFI_SGE_DATA; | ||
2515 | else if (sgeid < (ioim->nsges - 1)) | ||
2516 | sge->flags = BFI_SGE_DATA_CPL; | ||
2517 | else | ||
2518 | sge->flags = BFI_SGE_DATA_LAST; | ||
2519 | |||
2520 | bfa_sge_to_le(sge); | ||
2521 | } | ||
2522 | |||
2523 | sgpg = (struct bfa_sgpg_s *) bfa_q_next(sgpg); | ||
2524 | |||
2525 | /* | ||
2526 | * set the link element of each page | ||
2527 | */ | ||
2528 | if (sgeid == ioim->nsges) { | ||
2529 | sge->flags = BFI_SGE_PGDLEN; | ||
2530 | sge->sga.a32.addr_lo = 0; | ||
2531 | sge->sga.a32.addr_hi = 0; | ||
2532 | } else { | ||
2533 | sge->flags = BFI_SGE_LINK; | ||
2534 | sge->sga = sgpg->sgpg_pa; | ||
2535 | } | ||
2536 | sge->sg_len = pgcumsz; | ||
2537 | |||
2538 | bfa_sge_to_le(sge); | ||
2539 | } while (sgeid < ioim->nsges); | ||
2540 | } | ||
2541 | |||
2542 | /* | 2248 | /* |
2543 | * Send I/O abort request to firmware. | 2249 | * Send I/O abort request to firmware. |
2544 | */ | 2250 | */ |
@@ -2605,7 +2311,7 @@ bfa_ioim_notify_cleanup(struct bfa_ioim_s *ioim) | |||
2605 | } | 2311 | } |
2606 | bfa_itnim_iodone(ioim->itnim); | 2312 | bfa_itnim_iodone(ioim->itnim); |
2607 | } else | 2313 | } else |
2608 | bfa_tskim_iodone(ioim->iosp->tskim); | 2314 | bfa_wc_down(&ioim->iosp->tskim->wc); |
2609 | } | 2315 | } |
2610 | 2316 | ||
2611 | static bfa_boolean_t | 2317 | static bfa_boolean_t |
@@ -2623,9 +2329,6 @@ bfa_ioim_is_abortable(struct bfa_ioim_s *ioim) | |||
2623 | return BFA_TRUE; | 2329 | return BFA_TRUE; |
2624 | } | 2330 | } |
2625 | 2331 | ||
2626 | /* | ||
2627 | * or after the link comes back. | ||
2628 | */ | ||
2629 | void | 2332 | void |
2630 | bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, bfa_boolean_t iotov) | 2333 | bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, bfa_boolean_t iotov) |
2631 | { | 2334 | { |
@@ -2653,11 +2356,6 @@ bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, bfa_boolean_t iotov) | |||
2653 | } | 2356 | } |
2654 | 2357 | ||
2655 | 2358 | ||
2656 | |||
2657 | /* | ||
2658 | * hal_ioim_friend | ||
2659 | */ | ||
2660 | |||
2661 | /* | 2359 | /* |
2662 | * Memory allocation and initialization. | 2360 | * Memory allocation and initialization. |
2663 | */ | 2361 | */ |
@@ -2722,14 +2420,6 @@ bfa_ioim_attach(struct bfa_fcpim_mod_s *fcpim, struct bfa_meminfo_s *minfo) | |||
2722 | } | 2420 | } |
2723 | } | 2421 | } |
2724 | 2422 | ||
2725 | /* | ||
2726 | * Driver detach time call. | ||
2727 | */ | ||
2728 | void | ||
2729 | bfa_ioim_detach(struct bfa_fcpim_mod_s *fcpim) | ||
2730 | { | ||
2731 | } | ||
2732 | |||
2733 | void | 2423 | void |
2734 | bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | 2424 | bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) |
2735 | { | 2425 | { |
@@ -2742,7 +2432,7 @@ bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
2742 | iotag = be16_to_cpu(rsp->io_tag); | 2432 | iotag = be16_to_cpu(rsp->io_tag); |
2743 | 2433 | ||
2744 | ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); | 2434 | ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); |
2745 | bfa_assert(ioim->iotag == iotag); | 2435 | WARN_ON(ioim->iotag != iotag); |
2746 | 2436 | ||
2747 | bfa_trc(ioim->bfa, ioim->iotag); | 2437 | bfa_trc(ioim->bfa, ioim->iotag); |
2748 | bfa_trc(ioim->bfa, rsp->io_status); | 2438 | bfa_trc(ioim->bfa, rsp->io_status); |
@@ -2773,13 +2463,13 @@ bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
2773 | 2463 | ||
2774 | case BFI_IOIM_STS_PROTO_ERR: | 2464 | case BFI_IOIM_STS_PROTO_ERR: |
2775 | bfa_stats(ioim->itnim, iocom_proto_err); | 2465 | bfa_stats(ioim->itnim, iocom_proto_err); |
2776 | bfa_assert(rsp->reuse_io_tag); | 2466 | WARN_ON(!rsp->reuse_io_tag); |
2777 | evt = BFA_IOIM_SM_COMP; | 2467 | evt = BFA_IOIM_SM_COMP; |
2778 | break; | 2468 | break; |
2779 | 2469 | ||
2780 | case BFI_IOIM_STS_SQER_NEEDED: | 2470 | case BFI_IOIM_STS_SQER_NEEDED: |
2781 | bfa_stats(ioim->itnim, iocom_sqer_needed); | 2471 | bfa_stats(ioim->itnim, iocom_sqer_needed); |
2782 | bfa_assert(rsp->reuse_io_tag == 0); | 2472 | WARN_ON(rsp->reuse_io_tag != 0); |
2783 | evt = BFA_IOIM_SM_SQRETRY; | 2473 | evt = BFA_IOIM_SM_SQRETRY; |
2784 | break; | 2474 | break; |
2785 | 2475 | ||
@@ -2808,7 +2498,7 @@ bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
2808 | break; | 2498 | break; |
2809 | 2499 | ||
2810 | default: | 2500 | default: |
2811 | bfa_assert(0); | 2501 | WARN_ON(1); |
2812 | } | 2502 | } |
2813 | 2503 | ||
2814 | bfa_sm_send_event(ioim, evt); | 2504 | bfa_sm_send_event(ioim, evt); |
@@ -2825,39 +2515,12 @@ bfa_ioim_good_comp_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
2825 | iotag = be16_to_cpu(rsp->io_tag); | 2515 | iotag = be16_to_cpu(rsp->io_tag); |
2826 | 2516 | ||
2827 | ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); | 2517 | ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); |
2828 | bfa_assert(ioim->iotag == iotag); | 2518 | WARN_ON(BFA_IOIM_TAG_2_ID(ioim->iotag) != iotag); |
2829 | 2519 | ||
2830 | bfa_trc_fp(ioim->bfa, ioim->iotag); | ||
2831 | bfa_ioim_cb_profile_comp(fcpim, ioim); | 2520 | bfa_ioim_cb_profile_comp(fcpim, ioim); |
2832 | |||
2833 | bfa_sm_send_event(ioim, BFA_IOIM_SM_COMP_GOOD); | 2521 | bfa_sm_send_event(ioim, BFA_IOIM_SM_COMP_GOOD); |
2834 | } | 2522 | } |
2835 | 2523 | ||
2836 | void | ||
2837 | bfa_ioim_profile_start(struct bfa_ioim_s *ioim) | ||
2838 | { | ||
2839 | ioim->start_time = jiffies; | ||
2840 | } | ||
2841 | |||
2842 | void | ||
2843 | bfa_ioim_profile_comp(struct bfa_ioim_s *ioim) | ||
2844 | { | ||
2845 | u32 fcp_dl = bfa_cb_ioim_get_size(ioim->dio); | ||
2846 | u32 index = bfa_ioim_get_index(fcp_dl); | ||
2847 | u64 end_time = jiffies; | ||
2848 | struct bfa_itnim_latency_s *io_lat = | ||
2849 | &(ioim->itnim->ioprofile.io_latency); | ||
2850 | u32 val = (u32)(end_time - ioim->start_time); | ||
2851 | |||
2852 | bfa_itnim_ioprofile_update(ioim->itnim, index); | ||
2853 | |||
2854 | io_lat->count[index]++; | ||
2855 | io_lat->min[index] = (io_lat->min[index] < val) ? | ||
2856 | io_lat->min[index] : val; | ||
2857 | io_lat->max[index] = (io_lat->max[index] > val) ? | ||
2858 | io_lat->max[index] : val; | ||
2859 | io_lat->avg[index] += val; | ||
2860 | } | ||
2861 | /* | 2524 | /* |
2862 | * Called by itnim to clean up IO while going offline. | 2525 | * Called by itnim to clean up IO while going offline. |
2863 | */ | 2526 | */ |
@@ -2903,11 +2566,6 @@ bfa_ioim_tov(struct bfa_ioim_s *ioim) | |||
2903 | } | 2566 | } |
2904 | 2567 | ||
2905 | 2568 | ||
2906 | |||
2907 | /* | ||
2908 | * hal_ioim_api | ||
2909 | */ | ||
2910 | |||
2911 | /* | 2569 | /* |
2912 | * Allocate IOIM resource for initiator mode I/O request. | 2570 | * Allocate IOIM resource for initiator mode I/O request. |
2913 | */ | 2571 | */ |
@@ -2936,7 +2594,6 @@ bfa_ioim_alloc(struct bfa_s *bfa, struct bfad_ioim_s *dio, | |||
2936 | fcpim->ios_active++; | 2594 | fcpim->ios_active++; |
2937 | 2595 | ||
2938 | list_add_tail(&ioim->qe, &itnim->io_q); | 2596 | list_add_tail(&ioim->qe, &itnim->io_q); |
2939 | bfa_trc_fp(ioim->bfa, ioim->iotag); | ||
2940 | 2597 | ||
2941 | return ioim; | 2598 | return ioim; |
2942 | } | 2599 | } |
@@ -2946,18 +2603,13 @@ bfa_ioim_free(struct bfa_ioim_s *ioim) | |||
2946 | { | 2603 | { |
2947 | struct bfa_fcpim_mod_s *fcpim = ioim->fcpim; | 2604 | struct bfa_fcpim_mod_s *fcpim = ioim->fcpim; |
2948 | 2605 | ||
2949 | bfa_trc_fp(ioim->bfa, ioim->iotag); | ||
2950 | bfa_assert_fp(bfa_sm_cmp_state(ioim, bfa_ioim_sm_uninit)); | ||
2951 | |||
2952 | bfa_assert_fp(list_empty(&ioim->sgpg_q) || | ||
2953 | (ioim->nsges > BFI_SGE_INLINE)); | ||
2954 | |||
2955 | if (ioim->nsgpgs > 0) | 2606 | if (ioim->nsgpgs > 0) |
2956 | bfa_sgpg_mfree(ioim->bfa, &ioim->sgpg_q, ioim->nsgpgs); | 2607 | bfa_sgpg_mfree(ioim->bfa, &ioim->sgpg_q, ioim->nsgpgs); |
2957 | 2608 | ||
2958 | bfa_stats(ioim->itnim, io_comps); | 2609 | bfa_stats(ioim->itnim, io_comps); |
2959 | fcpim->ios_active--; | 2610 | fcpim->ios_active--; |
2960 | 2611 | ||
2612 | ioim->iotag &= BFA_IOIM_IOTAG_MASK; | ||
2961 | list_del(&ioim->qe); | 2613 | list_del(&ioim->qe); |
2962 | list_add_tail(&ioim->qe, &fcpim->ioim_free_q); | 2614 | list_add_tail(&ioim->qe, &fcpim->ioim_free_q); |
2963 | } | 2615 | } |
@@ -2965,16 +2617,13 @@ bfa_ioim_free(struct bfa_ioim_s *ioim) | |||
2965 | void | 2617 | void |
2966 | bfa_ioim_start(struct bfa_ioim_s *ioim) | 2618 | bfa_ioim_start(struct bfa_ioim_s *ioim) |
2967 | { | 2619 | { |
2968 | bfa_trc_fp(ioim->bfa, ioim->iotag); | ||
2969 | |||
2970 | bfa_ioim_cb_profile_start(ioim->fcpim, ioim); | 2620 | bfa_ioim_cb_profile_start(ioim->fcpim, ioim); |
2971 | 2621 | ||
2972 | /* | 2622 | /* |
2973 | * Obtain the queue over which this request has to be issued | 2623 | * Obtain the queue over which this request has to be issued |
2974 | */ | 2624 | */ |
2975 | ioim->reqq = bfa_fcpim_ioredirect_enabled(ioim->bfa) ? | 2625 | ioim->reqq = bfa_fcpim_ioredirect_enabled(ioim->bfa) ? |
2976 | bfa_cb_ioim_get_reqq(ioim->dio) : | 2626 | BFA_FALSE : bfa_itnim_get_reqq(ioim); |
2977 | bfa_itnim_get_reqq(ioim); | ||
2978 | 2627 | ||
2979 | bfa_sm_send_event(ioim, BFA_IOIM_SM_START); | 2628 | bfa_sm_send_event(ioim, BFA_IOIM_SM_START); |
2980 | } | 2629 | } |
@@ -2997,13 +2646,12 @@ bfa_ioim_abort(struct bfa_ioim_s *ioim) | |||
2997 | return BFA_STATUS_OK; | 2646 | return BFA_STATUS_OK; |
2998 | } | 2647 | } |
2999 | 2648 | ||
3000 | |||
3001 | /* | 2649 | /* |
3002 | * BFA TSKIM state machine functions | 2650 | * BFA TSKIM state machine functions |
3003 | */ | 2651 | */ |
3004 | 2652 | ||
3005 | /* | 2653 | /* |
3006 | * Task management command beginning state. | 2654 | * Task management command beginning state. |
3007 | */ | 2655 | */ |
3008 | static void | 2656 | static void |
3009 | bfa_tskim_sm_uninit(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | 2657 | bfa_tskim_sm_uninit(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) |
@@ -3040,9 +2688,8 @@ bfa_tskim_sm_uninit(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | |||
3040 | } | 2688 | } |
3041 | 2689 | ||
3042 | /* | 2690 | /* |
3043 | * brief | 2691 | * TM command is active, awaiting completion from firmware to |
3044 | * TM command is active, awaiting completion from firmware to | 2692 | * cleanup IO requests in TM scope. |
3045 | * cleanup IO requests in TM scope. | ||
3046 | */ | 2693 | */ |
3047 | static void | 2694 | static void |
3048 | bfa_tskim_sm_active(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | 2695 | bfa_tskim_sm_active(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) |
@@ -3077,8 +2724,8 @@ bfa_tskim_sm_active(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | |||
3077 | } | 2724 | } |
3078 | 2725 | ||
3079 | /* | 2726 | /* |
3080 | * An active TM is being cleaned up since ITN is offline. Awaiting cleanup | 2727 | * An active TM is being cleaned up since ITN is offline. Awaiting cleanup |
3081 | * completion event from firmware. | 2728 | * completion event from firmware. |
3082 | */ | 2729 | */ |
3083 | static void | 2730 | static void |
3084 | bfa_tskim_sm_cleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | 2731 | bfa_tskim_sm_cleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) |
@@ -3138,7 +2785,7 @@ bfa_tskim_sm_iocleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | |||
3138 | } | 2785 | } |
3139 | 2786 | ||
3140 | /* | 2787 | /* |
3141 | * Task management command is waiting for room in request CQ | 2788 | * Task management command is waiting for room in request CQ |
3142 | */ | 2789 | */ |
3143 | static void | 2790 | static void |
3144 | bfa_tskim_sm_qfull(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | 2791 | bfa_tskim_sm_qfull(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) |
@@ -3173,8 +2820,8 @@ bfa_tskim_sm_qfull(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | |||
3173 | } | 2820 | } |
3174 | 2821 | ||
3175 | /* | 2822 | /* |
3176 | * Task management command is active, awaiting for room in request CQ | 2823 | * Task management command is active, awaiting for room in request CQ |
3177 | * to send clean up request. | 2824 | * to send clean up request. |
3178 | */ | 2825 | */ |
3179 | static void | 2826 | static void |
3180 | bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim, | 2827 | bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim, |
@@ -3186,10 +2833,8 @@ bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim, | |||
3186 | case BFA_TSKIM_SM_DONE: | 2833 | case BFA_TSKIM_SM_DONE: |
3187 | bfa_reqq_wcancel(&tskim->reqq_wait); | 2834 | bfa_reqq_wcancel(&tskim->reqq_wait); |
3188 | /* | 2835 | /* |
3189 | * | ||
3190 | * Fall through !!! | 2836 | * Fall through !!! |
3191 | */ | 2837 | */ |
3192 | |||
3193 | case BFA_TSKIM_SM_QRESUME: | 2838 | case BFA_TSKIM_SM_QRESUME: |
3194 | bfa_sm_set_state(tskim, bfa_tskim_sm_cleanup); | 2839 | bfa_sm_set_state(tskim, bfa_tskim_sm_cleanup); |
3195 | bfa_tskim_send_abort(tskim); | 2840 | bfa_tskim_send_abort(tskim); |
@@ -3208,7 +2853,7 @@ bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim, | |||
3208 | } | 2853 | } |
3209 | 2854 | ||
3210 | /* | 2855 | /* |
3211 | * BFA callback is pending | 2856 | * BFA callback is pending |
3212 | */ | 2857 | */ |
3213 | static void | 2858 | static void |
3214 | bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | 2859 | bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) |
@@ -3233,12 +2878,6 @@ bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | |||
3233 | } | 2878 | } |
3234 | } | 2879 | } |
3235 | 2880 | ||
3236 | |||
3237 | |||
3238 | /* | ||
3239 | * hal_tskim_private | ||
3240 | */ | ||
3241 | |||
3242 | static void | 2881 | static void |
3243 | __bfa_cb_tskim_done(void *cbarg, bfa_boolean_t complete) | 2882 | __bfa_cb_tskim_done(void *cbarg, bfa_boolean_t complete) |
3244 | { | 2883 | { |
@@ -3268,8 +2907,8 @@ __bfa_cb_tskim_failed(void *cbarg, bfa_boolean_t complete) | |||
3268 | BFI_TSKIM_STS_FAILED); | 2907 | BFI_TSKIM_STS_FAILED); |
3269 | } | 2908 | } |
3270 | 2909 | ||
3271 | static bfa_boolean_t | 2910 | static bfa_boolean_t |
3272 | bfa_tskim_match_scope(struct bfa_tskim_s *tskim, lun_t lun) | 2911 | bfa_tskim_match_scope(struct bfa_tskim_s *tskim, struct scsi_lun lun) |
3273 | { | 2912 | { |
3274 | switch (tskim->tm_cmnd) { | 2913 | switch (tskim->tm_cmnd) { |
3275 | case FCP_TM_TARGET_RESET: | 2914 | case FCP_TM_TARGET_RESET: |
@@ -3279,24 +2918,26 @@ bfa_tskim_match_scope(struct bfa_tskim_s *tskim, lun_t lun) | |||
3279 | case FCP_TM_CLEAR_TASK_SET: | 2918 | case FCP_TM_CLEAR_TASK_SET: |
3280 | case FCP_TM_LUN_RESET: | 2919 | case FCP_TM_LUN_RESET: |
3281 | case FCP_TM_CLEAR_ACA: | 2920 | case FCP_TM_CLEAR_ACA: |
3282 | return (tskim->lun == lun); | 2921 | return !memcmp(&tskim->lun, &lun, sizeof(lun)); |
3283 | 2922 | ||
3284 | default: | 2923 | default: |
3285 | bfa_assert(0); | 2924 | WARN_ON(1); |
3286 | } | 2925 | } |
3287 | 2926 | ||
3288 | return BFA_FALSE; | 2927 | return BFA_FALSE; |
3289 | } | 2928 | } |
3290 | 2929 | ||
3291 | /* | 2930 | /* |
3292 | * Gather affected IO requests and task management commands. | 2931 | * Gather affected IO requests and task management commands. |
3293 | */ | 2932 | */ |
3294 | static void | 2933 | static void |
3295 | bfa_tskim_gather_ios(struct bfa_tskim_s *tskim) | 2934 | bfa_tskim_gather_ios(struct bfa_tskim_s *tskim) |
3296 | { | 2935 | { |
3297 | struct bfa_itnim_s *itnim = tskim->itnim; | 2936 | struct bfa_itnim_s *itnim = tskim->itnim; |
3298 | struct bfa_ioim_s *ioim; | 2937 | struct bfa_ioim_s *ioim; |
3299 | struct list_head *qe, *qen; | 2938 | struct list_head *qe, *qen; |
2939 | struct scsi_cmnd *cmnd; | ||
2940 | struct scsi_lun scsilun; | ||
3300 | 2941 | ||
3301 | INIT_LIST_HEAD(&tskim->io_q); | 2942 | INIT_LIST_HEAD(&tskim->io_q); |
3302 | 2943 | ||
@@ -3305,8 +2946,9 @@ bfa_tskim_gather_ios(struct bfa_tskim_s *tskim) | |||
3305 | */ | 2946 | */ |
3306 | list_for_each_safe(qe, qen, &itnim->io_q) { | 2947 | list_for_each_safe(qe, qen, &itnim->io_q) { |
3307 | ioim = (struct bfa_ioim_s *) qe; | 2948 | ioim = (struct bfa_ioim_s *) qe; |
3308 | if (bfa_tskim_match_scope | 2949 | cmnd = (struct scsi_cmnd *) ioim->dio; |
3309 | (tskim, bfa_cb_ioim_get_lun(ioim->dio))) { | 2950 | int_to_scsilun(cmnd->device->lun, &scsilun); |
2951 | if (bfa_tskim_match_scope(tskim, scsilun)) { | ||
3310 | list_del(&ioim->qe); | 2952 | list_del(&ioim->qe); |
3311 | list_add_tail(&ioim->qe, &tskim->io_q); | 2953 | list_add_tail(&ioim->qe, &tskim->io_q); |
3312 | } | 2954 | } |
@@ -3317,8 +2959,9 @@ bfa_tskim_gather_ios(struct bfa_tskim_s *tskim) | |||
3317 | */ | 2959 | */ |
3318 | list_for_each_safe(qe, qen, &itnim->pending_q) { | 2960 | list_for_each_safe(qe, qen, &itnim->pending_q) { |
3319 | ioim = (struct bfa_ioim_s *) qe; | 2961 | ioim = (struct bfa_ioim_s *) qe; |
3320 | if (bfa_tskim_match_scope | 2962 | cmnd = (struct scsi_cmnd *) ioim->dio; |
3321 | (tskim, bfa_cb_ioim_get_lun(ioim->dio))) { | 2963 | int_to_scsilun(cmnd->device->lun, &scsilun); |
2964 | if (bfa_tskim_match_scope(tskim, scsilun)) { | ||
3322 | list_del(&ioim->qe); | 2965 | list_del(&ioim->qe); |
3323 | list_add_tail(&ioim->qe, &ioim->fcpim->ioim_comp_q); | 2966 | list_add_tail(&ioim->qe, &ioim->fcpim->ioim_comp_q); |
3324 | bfa_ioim_tov(ioim); | 2967 | bfa_ioim_tov(ioim); |
@@ -3327,7 +2970,7 @@ bfa_tskim_gather_ios(struct bfa_tskim_s *tskim) | |||
3327 | } | 2970 | } |
3328 | 2971 | ||
3329 | /* | 2972 | /* |
3330 | * IO cleanup completion | 2973 | * IO cleanup completion |
3331 | */ | 2974 | */ |
3332 | static void | 2975 | static void |
3333 | bfa_tskim_cleanp_comp(void *tskim_cbarg) | 2976 | bfa_tskim_cleanp_comp(void *tskim_cbarg) |
@@ -3339,7 +2982,7 @@ bfa_tskim_cleanp_comp(void *tskim_cbarg) | |||
3339 | } | 2982 | } |
3340 | 2983 | ||
3341 | /* | 2984 | /* |
3342 | * Gather affected IO requests and task management commands. | 2985 | * Gather affected IO requests and task management commands. |
3343 | */ | 2986 | */ |
3344 | static void | 2987 | static void |
3345 | bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim) | 2988 | bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim) |
@@ -3359,7 +3002,7 @@ bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim) | |||
3359 | } | 3002 | } |
3360 | 3003 | ||
3361 | /* | 3004 | /* |
3362 | * Send task management request to firmware. | 3005 | * Send task management request to firmware. |
3363 | */ | 3006 | */ |
3364 | static bfa_boolean_t | 3007 | static bfa_boolean_t |
3365 | bfa_tskim_send(struct bfa_tskim_s *tskim) | 3008 | bfa_tskim_send(struct bfa_tskim_s *tskim) |
@@ -3394,7 +3037,7 @@ bfa_tskim_send(struct bfa_tskim_s *tskim) | |||
3394 | } | 3037 | } |
3395 | 3038 | ||
3396 | /* | 3039 | /* |
3397 | * Send abort request to cleanup an active TM to firmware. | 3040 | * Send abort request to cleanup an active TM to firmware. |
3398 | */ | 3041 | */ |
3399 | static bfa_boolean_t | 3042 | static bfa_boolean_t |
3400 | bfa_tskim_send_abort(struct bfa_tskim_s *tskim) | 3043 | bfa_tskim_send_abort(struct bfa_tskim_s *tskim) |
@@ -3425,7 +3068,7 @@ bfa_tskim_send_abort(struct bfa_tskim_s *tskim) | |||
3425 | } | 3068 | } |
3426 | 3069 | ||
3427 | /* | 3070 | /* |
3428 | * Call to resume task management cmnd waiting for room in request queue. | 3071 | * Call to resume task management cmnd waiting for room in request queue. |
3429 | */ | 3072 | */ |
3430 | static void | 3073 | static void |
3431 | bfa_tskim_qresume(void *cbarg) | 3074 | bfa_tskim_qresume(void *cbarg) |
@@ -3451,12 +3094,6 @@ bfa_tskim_iocdisable_ios(struct bfa_tskim_s *tskim) | |||
3451 | } | 3094 | } |
3452 | } | 3095 | } |
3453 | 3096 | ||
3454 | |||
3455 | |||
3456 | /* | ||
3457 | * hal_tskim_friend | ||
3458 | */ | ||
3459 | |||
3460 | /* | 3097 | /* |
3461 | * Notification on completions from related ioim. | 3098 | * Notification on completions from related ioim. |
3462 | */ | 3099 | */ |
@@ -3489,7 +3126,7 @@ bfa_tskim_cleanup(struct bfa_tskim_s *tskim) | |||
3489 | } | 3126 | } |
3490 | 3127 | ||
3491 | /* | 3128 | /* |
3492 | * Memory allocation and initialization. | 3129 | * Memory allocation and initialization. |
3493 | */ | 3130 | */ |
3494 | void | 3131 | void |
3495 | bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, struct bfa_meminfo_s *minfo) | 3132 | bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, struct bfa_meminfo_s *minfo) |
@@ -3522,14 +3159,6 @@ bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, struct bfa_meminfo_s *minfo) | |||
3522 | } | 3159 | } |
3523 | 3160 | ||
3524 | void | 3161 | void |
3525 | bfa_tskim_detach(struct bfa_fcpim_mod_s *fcpim) | ||
3526 | { | ||
3527 | /* | ||
3528 | * @todo | ||
3529 | */ | ||
3530 | } | ||
3531 | |||
3532 | void | ||
3533 | bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | 3162 | bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) |
3534 | { | 3163 | { |
3535 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); | 3164 | struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); |
@@ -3538,7 +3167,7 @@ bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
3538 | u16 tsk_tag = be16_to_cpu(rsp->tsk_tag); | 3167 | u16 tsk_tag = be16_to_cpu(rsp->tsk_tag); |
3539 | 3168 | ||
3540 | tskim = BFA_TSKIM_FROM_TAG(fcpim, tsk_tag); | 3169 | tskim = BFA_TSKIM_FROM_TAG(fcpim, tsk_tag); |
3541 | bfa_assert(tskim->tsk_tag == tsk_tag); | 3170 | WARN_ON(tskim->tsk_tag != tsk_tag); |
3542 | 3171 | ||
3543 | tskim->tsk_status = rsp->tsk_status; | 3172 | tskim->tsk_status = rsp->tsk_status; |
3544 | 3173 | ||
@@ -3556,12 +3185,6 @@ bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
3556 | } | 3185 | } |
3557 | 3186 | ||
3558 | 3187 | ||
3559 | |||
3560 | /* | ||
3561 | * hal_tskim_api | ||
3562 | */ | ||
3563 | |||
3564 | |||
3565 | struct bfa_tskim_s * | 3188 | struct bfa_tskim_s * |
3566 | bfa_tskim_alloc(struct bfa_s *bfa, struct bfad_tskim_s *dtsk) | 3189 | bfa_tskim_alloc(struct bfa_s *bfa, struct bfad_tskim_s *dtsk) |
3567 | { | 3190 | { |
@@ -3579,13 +3202,13 @@ bfa_tskim_alloc(struct bfa_s *bfa, struct bfad_tskim_s *dtsk) | |||
3579 | void | 3202 | void |
3580 | bfa_tskim_free(struct bfa_tskim_s *tskim) | 3203 | bfa_tskim_free(struct bfa_tskim_s *tskim) |
3581 | { | 3204 | { |
3582 | bfa_assert(bfa_q_is_on_q_func(&tskim->itnim->tsk_q, &tskim->qe)); | 3205 | WARN_ON(!bfa_q_is_on_q_func(&tskim->itnim->tsk_q, &tskim->qe)); |
3583 | list_del(&tskim->qe); | 3206 | list_del(&tskim->qe); |
3584 | list_add_tail(&tskim->qe, &tskim->fcpim->tskim_free_q); | 3207 | list_add_tail(&tskim->qe, &tskim->fcpim->tskim_free_q); |
3585 | } | 3208 | } |
3586 | 3209 | ||
3587 | /* | 3210 | /* |
3588 | * Start a task management command. | 3211 | * Start a task management command. |
3589 | * | 3212 | * |
3590 | * @param[in] tskim BFA task management command instance | 3213 | * @param[in] tskim BFA task management command instance |
3591 | * @param[in] itnim i-t nexus for the task management command | 3214 | * @param[in] itnim i-t nexus for the task management command |
@@ -3596,7 +3219,8 @@ bfa_tskim_free(struct bfa_tskim_s *tskim) | |||
3596 | * @return None. | 3219 | * @return None. |
3597 | */ | 3220 | */ |
3598 | void | 3221 | void |
3599 | bfa_tskim_start(struct bfa_tskim_s *tskim, struct bfa_itnim_s *itnim, lun_t lun, | 3222 | bfa_tskim_start(struct bfa_tskim_s *tskim, struct bfa_itnim_s *itnim, |
3223 | struct scsi_lun lun, | ||
3600 | enum fcp_tm_cmnd tm_cmnd, u8 tsecs) | 3224 | enum fcp_tm_cmnd tm_cmnd, u8 tsecs) |
3601 | { | 3225 | { |
3602 | tskim->itnim = itnim; | 3226 | tskim->itnim = itnim; |
diff --git a/drivers/scsi/bfa/bfa_fcpim.h b/drivers/scsi/bfa/bfa_fcpim.h index db53717eeb4..1e38dade842 100644 --- a/drivers/scsi/bfa/bfa_fcpim.h +++ b/drivers/scsi/bfa/bfa_fcpim.h | |||
@@ -41,7 +41,7 @@ | |||
41 | (__itnim->ioprofile.iocomps[__index]++) | 41 | (__itnim->ioprofile.iocomps[__index]++) |
42 | 42 | ||
43 | #define BFA_IOIM_RETRY_TAG_OFFSET 11 | 43 | #define BFA_IOIM_RETRY_TAG_OFFSET 11 |
44 | #define BFA_IOIM_RETRY_TAG_MASK 0x07ff /* 2K IOs */ | 44 | #define BFA_IOIM_IOTAG_MASK 0x07ff /* 2K IOs */ |
45 | #define BFA_IOIM_RETRY_MAX 7 | 45 | #define BFA_IOIM_RETRY_MAX 7 |
46 | 46 | ||
47 | /* Buckets are are 512 bytes to 2MB */ | 47 | /* Buckets are are 512 bytes to 2MB */ |
@@ -94,12 +94,12 @@ struct bfa_fcpim_mod_s { | |||
94 | struct list_head ioim_resfree_q; /* IOs waiting for f/w */ | 94 | struct list_head ioim_resfree_q; /* IOs waiting for f/w */ |
95 | struct list_head ioim_comp_q; /* IO global comp Q */ | 95 | struct list_head ioim_comp_q; /* IO global comp Q */ |
96 | struct list_head tskim_free_q; | 96 | struct list_head tskim_free_q; |
97 | u32 ios_active; /* current active IOs */ | 97 | u32 ios_active; /* current active IOs */ |
98 | u32 delay_comp; | 98 | u32 delay_comp; |
99 | struct bfa_fcpim_del_itn_stats_s del_itn_stats; | 99 | struct bfa_fcpim_del_itn_stats_s del_itn_stats; |
100 | bfa_boolean_t ioredirect; | 100 | bfa_boolean_t ioredirect; |
101 | bfa_boolean_t io_profile; | 101 | bfa_boolean_t io_profile; |
102 | u32 io_profile_start_time; | 102 | u32 io_profile_start_time; |
103 | bfa_fcpim_profile_t profile_comp; | 103 | bfa_fcpim_profile_t profile_comp; |
104 | bfa_fcpim_profile_t profile_start; | 104 | bfa_fcpim_profile_t profile_start; |
105 | }; | 105 | }; |
@@ -114,25 +114,24 @@ struct bfa_ioim_s { | |||
114 | struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ | 114 | struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ |
115 | struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ | 115 | struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ |
116 | struct bfad_ioim_s *dio; /* driver IO handle */ | 116 | struct bfad_ioim_s *dio; /* driver IO handle */ |
117 | u16 iotag; /* FWI IO tag */ | 117 | u16 iotag; /* FWI IO tag */ |
118 | u16 abort_tag; /* unqiue abort request tag */ | 118 | u16 abort_tag; /* unqiue abort request tag */ |
119 | u16 nsges; /* number of SG elements */ | 119 | u16 nsges; /* number of SG elements */ |
120 | u16 nsgpgs; /* number of SG pages */ | 120 | u16 nsgpgs; /* number of SG pages */ |
121 | struct bfa_sgpg_s *sgpg; /* first SG page */ | 121 | struct bfa_sgpg_s *sgpg; /* first SG page */ |
122 | struct list_head sgpg_q; /* allocated SG pages */ | 122 | struct list_head sgpg_q; /* allocated SG pages */ |
123 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ | 123 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ |
124 | bfa_cb_cbfn_t io_cbfn; /* IO completion handler */ | 124 | bfa_cb_cbfn_t io_cbfn; /* IO completion handler */ |
125 | struct bfa_ioim_sp_s *iosp; /* slow-path IO handling */ | 125 | struct bfa_ioim_sp_s *iosp; /* slow-path IO handling */ |
126 | u8 reqq; /* Request queue for I/O */ | 126 | u8 reqq; /* Request queue for I/O */ |
127 | u64 start_time; /* IO's Profile start val */ | 127 | u64 start_time; /* IO's Profile start val */ |
128 | }; | 128 | }; |
129 | 129 | ||
130 | |||
131 | struct bfa_ioim_sp_s { | 130 | struct bfa_ioim_sp_s { |
132 | struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */ | 131 | struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */ |
133 | u8 *snsinfo; /* sense info for this IO */ | 132 | u8 *snsinfo; /* sense info for this IO */ |
134 | struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */ | 133 | struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */ |
135 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ | 134 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ |
136 | bfa_boolean_t abort_explicit; /* aborted by OS */ | 135 | bfa_boolean_t abort_explicit; /* aborted by OS */ |
137 | struct bfa_tskim_s *tskim; /* Relevant TM cmd */ | 136 | struct bfa_tskim_s *tskim; /* Relevant TM cmd */ |
138 | }; | 137 | }; |
@@ -143,35 +142,34 @@ struct bfa_ioim_sp_s { | |||
143 | struct bfa_tskim_s { | 142 | struct bfa_tskim_s { |
144 | struct list_head qe; | 143 | struct list_head qe; |
145 | bfa_sm_t sm; | 144 | bfa_sm_t sm; |
146 | struct bfa_s *bfa; /* BFA module */ | 145 | struct bfa_s *bfa; /* BFA module */ |
147 | struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ | 146 | struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ |
148 | struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ | 147 | struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ |
149 | struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ | 148 | struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ |
150 | bfa_boolean_t notify; /* notify itnim on TM comp */ | 149 | bfa_boolean_t notify; /* notify itnim on TM comp */ |
151 | lun_t lun; /* lun if applicable */ | 150 | struct scsi_lun lun; /* lun if applicable */ |
152 | enum fcp_tm_cmnd tm_cmnd; /* task management command */ | 151 | enum fcp_tm_cmnd tm_cmnd; /* task management command */ |
153 | u16 tsk_tag; /* FWI IO tag */ | 152 | u16 tsk_tag; /* FWI IO tag */ |
154 | u8 tsecs; /* timeout in seconds */ | 153 | u8 tsecs; /* timeout in seconds */ |
155 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ | 154 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ |
156 | struct list_head io_q; /* queue of affected IOs */ | 155 | struct list_head io_q; /* queue of affected IOs */ |
157 | struct bfa_wc_s wc; /* waiting counter */ | 156 | struct bfa_wc_s wc; /* waiting counter */ |
158 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ | 157 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ |
159 | enum bfi_tskim_status tsk_status; /* TM status */ | 158 | enum bfi_tskim_status tsk_status; /* TM status */ |
160 | }; | 159 | }; |
161 | 160 | ||
162 | |||
163 | /* | 161 | /* |
164 | * BFA i-t-n (initiator mode) | 162 | * BFA i-t-n (initiator mode) |
165 | */ | 163 | */ |
166 | struct bfa_itnim_s { | 164 | struct bfa_itnim_s { |
167 | struct list_head qe; /* queue element */ | 165 | struct list_head qe; /* queue element */ |
168 | bfa_sm_t sm; /* i-t-n im BFA state machine */ | 166 | bfa_sm_t sm; /* i-t-n im BFA state machine */ |
169 | struct bfa_s *bfa; /* bfa instance */ | 167 | struct bfa_s *bfa; /* bfa instance */ |
170 | struct bfa_rport_s *rport; /* bfa rport */ | 168 | struct bfa_rport_s *rport; /* bfa rport */ |
171 | void *ditn; /* driver i-t-n structure */ | 169 | void *ditn; /* driver i-t-n structure */ |
172 | struct bfi_mhdr_s mhdr; /* pre-built mhdr */ | 170 | struct bfi_mhdr_s mhdr; /* pre-built mhdr */ |
173 | u8 msg_no; /* itnim/rport firmware handle */ | 171 | u8 msg_no; /* itnim/rport firmware handle */ |
174 | u8 reqq; /* CQ for requests */ | 172 | u8 reqq; /* CQ for requests */ |
175 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ | 173 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ |
176 | struct list_head pending_q; /* queue of pending IO requests */ | 174 | struct list_head pending_q; /* queue of pending IO requests */ |
177 | struct list_head io_q; /* queue of active IO requests */ | 175 | struct list_head io_q; /* queue of active IO requests */ |
@@ -181,19 +179,19 @@ struct bfa_itnim_s { | |||
181 | bfa_boolean_t seq_rec; /* SQER supported */ | 179 | bfa_boolean_t seq_rec; /* SQER supported */ |
182 | bfa_boolean_t is_online; /* itnim is ONLINE for IO */ | 180 | bfa_boolean_t is_online; /* itnim is ONLINE for IO */ |
183 | bfa_boolean_t iotov_active; /* IO TOV timer is active */ | 181 | bfa_boolean_t iotov_active; /* IO TOV timer is active */ |
184 | struct bfa_wc_s wc; /* waiting counter */ | 182 | struct bfa_wc_s wc; /* waiting counter */ |
185 | struct bfa_timer_s timer; /* pending IO TOV */ | 183 | struct bfa_timer_s timer; /* pending IO TOV */ |
186 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ | 184 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ |
187 | struct bfa_fcpim_mod_s *fcpim; /* fcpim module */ | 185 | struct bfa_fcpim_mod_s *fcpim; /* fcpim module */ |
188 | struct bfa_itnim_iostats_s stats; | 186 | struct bfa_itnim_iostats_s stats; |
189 | struct bfa_itnim_ioprofile_s ioprofile; | 187 | struct bfa_itnim_ioprofile_s ioprofile; |
190 | }; | 188 | }; |
191 | 189 | ||
192 | |||
193 | #define bfa_itnim_is_online(_itnim) ((_itnim)->is_online) | 190 | #define bfa_itnim_is_online(_itnim) ((_itnim)->is_online) |
194 | #define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod) | 191 | #define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod) |
192 | #define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK) | ||
195 | #define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \ | 193 | #define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \ |
196 | (&fcpim->ioim_arr[(_iotag & BFA_IOIM_RETRY_TAG_MASK)]) | 194 | (&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)]) |
197 | #define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag) \ | 195 | #define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag) \ |
198 | (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)]) | 196 | (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)]) |
199 | 197 | ||
@@ -201,26 +199,26 @@ struct bfa_itnim_s { | |||
201 | (_bfa->modules.fcpim_mod.io_profile_start_time) | 199 | (_bfa->modules.fcpim_mod.io_profile_start_time) |
202 | #define bfa_fcpim_get_io_profile(_bfa) \ | 200 | #define bfa_fcpim_get_io_profile(_bfa) \ |
203 | (_bfa->modules.fcpim_mod.io_profile) | 201 | (_bfa->modules.fcpim_mod.io_profile) |
202 | #define bfa_ioim_update_iotag(__ioim) do { \ | ||
203 | uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \ | ||
204 | k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \ | ||
205 | (__ioim)->iotag |= k << BFA_IOIM_RETRY_TAG_OFFSET; \ | ||
206 | } while (0) | ||
204 | 207 | ||
205 | static inline bfa_boolean_t | 208 | static inline bfa_boolean_t |
206 | bfa_ioim_get_iotag(struct bfa_ioim_s *ioim) | 209 | bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim) |
207 | { | 210 | { |
208 | u16 k = ioim->iotag; | 211 | uint16_t k = ioim->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; |
209 | 212 | if (k < BFA_IOIM_RETRY_MAX) | |
210 | k >>= BFA_IOIM_RETRY_TAG_OFFSET; k++; | ||
211 | |||
212 | if (k > BFA_IOIM_RETRY_MAX) | ||
213 | return BFA_FALSE; | 213 | return BFA_FALSE; |
214 | ioim->iotag &= BFA_IOIM_RETRY_TAG_MASK; | ||
215 | ioim->iotag |= k<<BFA_IOIM_RETRY_TAG_OFFSET; | ||
216 | return BFA_TRUE; | 214 | return BFA_TRUE; |
217 | } | 215 | } |
216 | |||
218 | /* | 217 | /* |
219 | * function prototypes | 218 | * function prototypes |
220 | */ | 219 | */ |
221 | void bfa_ioim_attach(struct bfa_fcpim_mod_s *fcpim, | 220 | void bfa_ioim_attach(struct bfa_fcpim_mod_s *fcpim, |
222 | struct bfa_meminfo_s *minfo); | 221 | struct bfa_meminfo_s *minfo); |
223 | void bfa_ioim_detach(struct bfa_fcpim_mod_s *fcpim); | ||
224 | void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | 222 | void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); |
225 | void bfa_ioim_good_comp_isr(struct bfa_s *bfa, | 223 | void bfa_ioim_good_comp_isr(struct bfa_s *bfa, |
226 | struct bfi_msg_s *msg); | 224 | struct bfi_msg_s *msg); |
@@ -232,7 +230,6 @@ void bfa_ioim_tov(struct bfa_ioim_s *ioim); | |||
232 | 230 | ||
233 | void bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, | 231 | void bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, |
234 | struct bfa_meminfo_s *minfo); | 232 | struct bfa_meminfo_s *minfo); |
235 | void bfa_tskim_detach(struct bfa_fcpim_mod_s *fcpim); | ||
236 | void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | 233 | void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); |
237 | void bfa_tskim_iodone(struct bfa_tskim_s *tskim); | 234 | void bfa_tskim_iodone(struct bfa_tskim_s *tskim); |
238 | void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim); | 235 | void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim); |
@@ -248,32 +245,14 @@ void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | |||
248 | void bfa_itnim_iodone(struct bfa_itnim_s *itnim); | 245 | void bfa_itnim_iodone(struct bfa_itnim_s *itnim); |
249 | void bfa_itnim_tskdone(struct bfa_itnim_s *itnim); | 246 | void bfa_itnim_tskdone(struct bfa_itnim_s *itnim); |
250 | bfa_boolean_t bfa_itnim_hold_io(struct bfa_itnim_s *itnim); | 247 | bfa_boolean_t bfa_itnim_hold_io(struct bfa_itnim_s *itnim); |
251 | void bfa_ioim_profile_comp(struct bfa_ioim_s *ioim); | ||
252 | void bfa_ioim_profile_start(struct bfa_ioim_s *ioim); | ||
253 | |||
254 | 248 | ||
255 | /* | 249 | /* |
256 | * bfa fcpim module API functions | 250 | * bfa fcpim module API functions |
257 | */ | 251 | */ |
258 | void bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov); | 252 | void bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov); |
259 | u16 bfa_fcpim_path_tov_get(struct bfa_s *bfa); | 253 | u16 bfa_fcpim_path_tov_get(struct bfa_s *bfa); |
260 | void bfa_fcpim_qdepth_set(struct bfa_s *bfa, u16 q_depth); | ||
261 | u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa); | 254 | u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa); |
262 | bfa_status_t bfa_fcpim_get_modstats(struct bfa_s *bfa, | 255 | |
263 | struct bfa_itnim_iostats_s *modstats); | ||
264 | bfa_status_t bfa_fcpim_port_iostats(struct bfa_s *bfa, | ||
265 | struct bfa_itnim_iostats_s *stats, u8 lp_tag); | ||
266 | bfa_status_t bfa_fcpim_get_del_itn_stats(struct bfa_s *bfa, | ||
267 | struct bfa_fcpim_del_itn_stats_s *modstats); | ||
268 | bfa_status_t bfa_fcpim_port_clear_iostats(struct bfa_s *bfa, u8 lp_tag); | ||
269 | void bfa_fcpim_add_stats(struct bfa_itnim_iostats_s *fcpim_stats, | ||
270 | struct bfa_itnim_iostats_s *itnim_stats); | ||
271 | bfa_status_t bfa_fcpim_clr_modstats(struct bfa_s *bfa); | ||
272 | void bfa_fcpim_set_ioredirect(struct bfa_s *bfa, | ||
273 | bfa_boolean_t state); | ||
274 | void bfa_fcpim_update_ioredirect(struct bfa_s *bfa); | ||
275 | bfa_status_t bfa_fcpim_profile_on(struct bfa_s *bfa, u32 time); | ||
276 | bfa_status_t bfa_fcpim_profile_off(struct bfa_s *bfa); | ||
277 | #define bfa_fcpim_ioredirect_enabled(__bfa) \ | 256 | #define bfa_fcpim_ioredirect_enabled(__bfa) \ |
278 | (((struct bfa_fcpim_mod_s *)(BFA_FCPIM_MOD(__bfa)))->ioredirect) | 257 | (((struct bfa_fcpim_mod_s *)(BFA_FCPIM_MOD(__bfa)))->ioredirect) |
279 | 258 | ||
@@ -291,48 +270,33 @@ bfa_status_t bfa_fcpim_profile_off(struct bfa_s *bfa); | |||
291 | * bfa itnim API functions | 270 | * bfa itnim API functions |
292 | */ | 271 | */ |
293 | struct bfa_itnim_s *bfa_itnim_create(struct bfa_s *bfa, | 272 | struct bfa_itnim_s *bfa_itnim_create(struct bfa_s *bfa, |
294 | struct bfa_rport_s *rport, void *itnim); | 273 | struct bfa_rport_s *rport, void *itnim); |
295 | void bfa_itnim_delete(struct bfa_itnim_s *itnim); | 274 | void bfa_itnim_delete(struct bfa_itnim_s *itnim); |
296 | void bfa_itnim_online(struct bfa_itnim_s *itnim, | 275 | void bfa_itnim_online(struct bfa_itnim_s *itnim, bfa_boolean_t seq_rec); |
297 | bfa_boolean_t seq_rec); | 276 | void bfa_itnim_offline(struct bfa_itnim_s *itnim); |
298 | void bfa_itnim_offline(struct bfa_itnim_s *itnim); | 277 | void bfa_itnim_clear_stats(struct bfa_itnim_s *itnim); |
299 | void bfa_itnim_get_stats(struct bfa_itnim_s *itnim, | 278 | bfa_status_t bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim, |
300 | struct bfa_itnim_iostats_s *stats); | 279 | struct bfa_itnim_ioprofile_s *ioprofile); |
301 | void bfa_itnim_clear_stats(struct bfa_itnim_s *itnim); | 280 | |
302 | bfa_status_t bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim, | ||
303 | struct bfa_itnim_ioprofile_s *ioprofile); | ||
304 | #define bfa_itnim_get_reqq(__ioim) (((struct bfa_ioim_s *)__ioim)->itnim->reqq) | 281 | #define bfa_itnim_get_reqq(__ioim) (((struct bfa_ioim_s *)__ioim)->itnim->reqq) |
305 | 282 | ||
306 | /* | 283 | /* |
307 | * BFA completion callback for bfa_itnim_online(). | 284 | * BFA completion callback for bfa_itnim_online(). |
308 | * | ||
309 | * @param[in] itnim FCS or driver itnim instance | ||
310 | * | ||
311 | * return None | ||
312 | */ | 285 | */ |
313 | void bfa_cb_itnim_online(void *itnim); | 286 | void bfa_cb_itnim_online(void *itnim); |
314 | 287 | ||
315 | /* | 288 | /* |
316 | * BFA completion callback for bfa_itnim_offline(). | 289 | * BFA completion callback for bfa_itnim_offline(). |
317 | * | ||
318 | * @param[in] itnim FCS or driver itnim instance | ||
319 | * | ||
320 | * return None | ||
321 | */ | 290 | */ |
322 | void bfa_cb_itnim_offline(void *itnim); | 291 | void bfa_cb_itnim_offline(void *itnim); |
323 | void bfa_cb_itnim_tov_begin(void *itnim); | 292 | void bfa_cb_itnim_tov_begin(void *itnim); |
324 | void bfa_cb_itnim_tov(void *itnim); | 293 | void bfa_cb_itnim_tov(void *itnim); |
325 | 294 | ||
326 | /* | 295 | /* |
327 | * BFA notification to FCS/driver for second level error recovery. | 296 | * BFA notification to FCS/driver for second level error recovery. |
328 | * | ||
329 | * Atleast one I/O request has timedout and target is unresponsive to | 297 | * Atleast one I/O request has timedout and target is unresponsive to |
330 | * repeated abort requests. Second level error recovery should be initiated | 298 | * repeated abort requests. Second level error recovery should be initiated |
331 | * by starting implicit logout and recovery procedures. | 299 | * by starting implicit logout and recovery procedures. |
332 | * | ||
333 | * @param[in] itnim FCS or driver itnim instance | ||
334 | * | ||
335 | * return None | ||
336 | */ | 300 | */ |
337 | void bfa_cb_itnim_sler(void *itnim); | 301 | void bfa_cb_itnim_sler(void *itnim); |
338 | 302 | ||
@@ -349,10 +313,8 @@ void bfa_ioim_start(struct bfa_ioim_s *ioim); | |||
349 | bfa_status_t bfa_ioim_abort(struct bfa_ioim_s *ioim); | 313 | bfa_status_t bfa_ioim_abort(struct bfa_ioim_s *ioim); |
350 | void bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, | 314 | void bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, |
351 | bfa_boolean_t iotov); | 315 | bfa_boolean_t iotov); |
352 | |||
353 | |||
354 | /* | 316 | /* |
355 | * I/O completion notification. | 317 | * I/O completion notification. |
356 | * | 318 | * |
357 | * @param[in] dio driver IO structure | 319 | * @param[in] dio driver IO structure |
358 | * @param[in] io_status IO completion status | 320 | * @param[in] io_status IO completion status |
@@ -363,39 +325,31 @@ void bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, | |||
363 | * | 325 | * |
364 | * @return None | 326 | * @return None |
365 | */ | 327 | */ |
366 | void bfa_cb_ioim_done(void *bfad, struct bfad_ioim_s *dio, | 328 | void bfa_cb_ioim_done(void *bfad, struct bfad_ioim_s *dio, |
367 | enum bfi_ioim_status io_status, | 329 | enum bfi_ioim_status io_status, |
368 | u8 scsi_status, int sns_len, | 330 | u8 scsi_status, int sns_len, |
369 | u8 *sns_info, s32 residue); | 331 | u8 *sns_info, s32 residue); |
370 | 332 | ||
371 | /* | 333 | /* |
372 | * I/O good completion notification. | 334 | * I/O good completion notification. |
373 | * | ||
374 | * @param[in] dio driver IO structure | ||
375 | * | ||
376 | * @return None | ||
377 | */ | 335 | */ |
378 | void bfa_cb_ioim_good_comp(void *bfad, struct bfad_ioim_s *dio); | 336 | void bfa_cb_ioim_good_comp(void *bfad, struct bfad_ioim_s *dio); |
379 | 337 | ||
380 | /* | 338 | /* |
381 | * I/O abort completion notification | 339 | * I/O abort completion notification |
382 | * | ||
383 | * @param[in] dio driver IO that was aborted | ||
384 | * | ||
385 | * @return None | ||
386 | */ | 340 | */ |
387 | void bfa_cb_ioim_abort(void *bfad, struct bfad_ioim_s *dio); | 341 | void bfa_cb_ioim_abort(void *bfad, struct bfad_ioim_s *dio); |
388 | 342 | ||
389 | /* | 343 | /* |
390 | * bfa tskim API functions | 344 | * bfa tskim API functions |
391 | */ | 345 | */ |
392 | struct bfa_tskim_s *bfa_tskim_alloc(struct bfa_s *bfa, | 346 | struct bfa_tskim_s *bfa_tskim_alloc(struct bfa_s *bfa, |
393 | struct bfad_tskim_s *dtsk); | 347 | struct bfad_tskim_s *dtsk); |
394 | void bfa_tskim_free(struct bfa_tskim_s *tskim); | 348 | void bfa_tskim_free(struct bfa_tskim_s *tskim); |
395 | void bfa_tskim_start(struct bfa_tskim_s *tskim, | 349 | void bfa_tskim_start(struct bfa_tskim_s *tskim, |
396 | struct bfa_itnim_s *itnim, lun_t lun, | 350 | struct bfa_itnim_s *itnim, struct scsi_lun lun, |
397 | enum fcp_tm_cmnd tm, u8 t_secs); | 351 | enum fcp_tm_cmnd tm, u8 t_secs); |
398 | void bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk, | 352 | void bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk, |
399 | enum bfi_tskim_status tsk_status); | 353 | enum bfi_tskim_status tsk_status); |
400 | 354 | ||
401 | #endif /* __BFA_FCPIM_H__ */ | 355 | #endif /* __BFA_FCPIM_H__ */ |
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index 045d7e87b63..f674f931862 100644 --- a/drivers/scsi/bfa/bfa_fcs.c +++ b/drivers/scsi/bfa/bfa_fcs.c | |||
@@ -19,9 +19,9 @@ | |||
19 | * bfa_fcs.c BFA FCS main | 19 | * bfa_fcs.c BFA FCS main |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "bfad_drv.h" | ||
22 | #include "bfa_fcs.h" | 23 | #include "bfa_fcs.h" |
23 | #include "bfa_fcbuild.h" | 24 | #include "bfa_fcbuild.h" |
24 | #include "bfad_drv.h" | ||
25 | 25 | ||
26 | BFA_TRC_FILE(FCS, FCS); | 26 | BFA_TRC_FILE(FCS, FCS); |
27 | 27 | ||
@@ -76,7 +76,7 @@ bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, | |||
76 | fcs->bfad = bfad; | 76 | fcs->bfad = bfad; |
77 | fcs->min_cfg = min_cfg; | 77 | fcs->min_cfg = min_cfg; |
78 | 78 | ||
79 | bfa_attach_fcs(bfa); | 79 | bfa->fcs = BFA_TRUE; |
80 | fcbuild_init(); | 80 | fcbuild_init(); |
81 | 81 | ||
82 | for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { | 82 | for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { |
@@ -110,14 +110,6 @@ bfa_fcs_init(struct bfa_fcs_s *fcs) | |||
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | /* | ||
114 | * Start FCS operations. | ||
115 | */ | ||
116 | void | ||
117 | bfa_fcs_start(struct bfa_fcs_s *fcs) | ||
118 | { | ||
119 | bfa_fcs_fabric_modstart(fcs); | ||
120 | } | ||
121 | 113 | ||
122 | /* | 114 | /* |
123 | * brief | 115 | * brief |
@@ -140,22 +132,6 @@ bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, | |||
140 | 132 | ||
141 | /* | 133 | /* |
142 | * brief | 134 | * brief |
143 | * FCS FDMI Driver Parameter Initialization | ||
144 | * | ||
145 | * param[in] fcs FCS instance | ||
146 | * param[in] fdmi_enable TRUE/FALSE | ||
147 | * | ||
148 | * return None | ||
149 | */ | ||
150 | void | ||
151 | bfa_fcs_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable) | ||
152 | { | ||
153 | |||
154 | fcs->fdmi_enabled = fdmi_enable; | ||
155 | |||
156 | } | ||
157 | /* | ||
158 | * brief | ||
159 | * FCS instance cleanup and exit. | 135 | * FCS instance cleanup and exit. |
160 | * | 136 | * |
161 | * param[in] fcs FCS instance | 137 | * param[in] fcs FCS instance |
@@ -184,18 +160,6 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs) | |||
184 | } | 160 | } |
185 | 161 | ||
186 | 162 | ||
187 | void | ||
188 | bfa_fcs_trc_init(struct bfa_fcs_s *fcs, struct bfa_trc_mod_s *trcmod) | ||
189 | { | ||
190 | fcs->trcmod = trcmod; | ||
191 | } | ||
192 | |||
193 | void | ||
194 | bfa_fcs_modexit_comp(struct bfa_fcs_s *fcs) | ||
195 | { | ||
196 | bfa_wc_down(&fcs->wc); | ||
197 | } | ||
198 | |||
199 | /* | 163 | /* |
200 | * Fabric module implementation. | 164 | * Fabric module implementation. |
201 | */ | 165 | */ |
@@ -232,31 +196,6 @@ static void bfa_fcs_fabric_flogiacc_comp(void *fcsarg, | |||
232 | u32 rsp_len, | 196 | u32 rsp_len, |
233 | u32 resid_len, | 197 | u32 resid_len, |
234 | struct fchs_s *rspfchs); | 198 | struct fchs_s *rspfchs); |
235 | /* | ||
236 | * fcs_fabric_sm fabric state machine functions | ||
237 | */ | ||
238 | |||
239 | /* | ||
240 | * Fabric state machine events | ||
241 | */ | ||
242 | enum bfa_fcs_fabric_event { | ||
243 | BFA_FCS_FABRIC_SM_CREATE = 1, /* create from driver */ | ||
244 | BFA_FCS_FABRIC_SM_DELETE = 2, /* delete from driver */ | ||
245 | BFA_FCS_FABRIC_SM_LINK_DOWN = 3, /* link down from port */ | ||
246 | BFA_FCS_FABRIC_SM_LINK_UP = 4, /* link up from port */ | ||
247 | BFA_FCS_FABRIC_SM_CONT_OP = 5, /* flogi/auth continue op */ | ||
248 | BFA_FCS_FABRIC_SM_RETRY_OP = 6, /* flogi/auth retry op */ | ||
249 | BFA_FCS_FABRIC_SM_NO_FABRIC = 7, /* from flogi/auth */ | ||
250 | BFA_FCS_FABRIC_SM_PERF_EVFP = 8, /* from flogi/auth */ | ||
251 | BFA_FCS_FABRIC_SM_ISOLATE = 9, /* from EVFP processing */ | ||
252 | BFA_FCS_FABRIC_SM_NO_TAGGING = 10, /* no VFT tagging from EVFP */ | ||
253 | BFA_FCS_FABRIC_SM_DELAYED = 11, /* timeout delay event */ | ||
254 | BFA_FCS_FABRIC_SM_AUTH_FAILED = 12, /* auth failed */ | ||
255 | BFA_FCS_FABRIC_SM_AUTH_SUCCESS = 13, /* auth successful */ | ||
256 | BFA_FCS_FABRIC_SM_DELCOMP = 14, /* all vports deleted event */ | ||
257 | BFA_FCS_FABRIC_SM_LOOPBACK = 15, /* Received our own FLOGI */ | ||
258 | BFA_FCS_FABRIC_SM_START = 16, /* from driver */ | ||
259 | }; | ||
260 | 199 | ||
261 | static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric, | 200 | static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric, |
262 | enum bfa_fcs_fabric_event event); | 201 | enum bfa_fcs_fabric_event event); |
@@ -270,14 +209,8 @@ static void bfa_fcs_fabric_sm_flogi_retry(struct bfa_fcs_fabric_s *fabric, | |||
270 | enum bfa_fcs_fabric_event event); | 209 | enum bfa_fcs_fabric_event event); |
271 | static void bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric, | 210 | static void bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric, |
272 | enum bfa_fcs_fabric_event event); | 211 | enum bfa_fcs_fabric_event event); |
273 | static void bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric, | ||
274 | enum bfa_fcs_fabric_event event); | ||
275 | static void bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric, | ||
276 | enum bfa_fcs_fabric_event event); | ||
277 | static void bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, | 212 | static void bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, |
278 | enum bfa_fcs_fabric_event event); | 213 | enum bfa_fcs_fabric_event event); |
279 | static void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, | ||
280 | enum bfa_fcs_fabric_event event); | ||
281 | static void bfa_fcs_fabric_sm_evfp(struct bfa_fcs_fabric_s *fabric, | 214 | static void bfa_fcs_fabric_sm_evfp(struct bfa_fcs_fabric_s *fabric, |
282 | enum bfa_fcs_fabric_event event); | 215 | enum bfa_fcs_fabric_event event); |
283 | static void bfa_fcs_fabric_sm_evfp_done(struct bfa_fcs_fabric_s *fabric, | 216 | static void bfa_fcs_fabric_sm_evfp_done(struct bfa_fcs_fabric_s *fabric, |
@@ -337,7 +270,7 @@ bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric, | |||
337 | 270 | ||
338 | case BFA_FCS_FABRIC_SM_DELETE: | 271 | case BFA_FCS_FABRIC_SM_DELETE: |
339 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); | 272 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); |
340 | bfa_fcs_modexit_comp(fabric->fcs); | 273 | bfa_wc_down(&fabric->fcs->wc); |
341 | break; | 274 | break; |
342 | 275 | ||
343 | default: | 276 | default: |
@@ -410,7 +343,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, | |||
410 | 343 | ||
411 | case BFA_FCS_FABRIC_SM_LOOPBACK: | 344 | case BFA_FCS_FABRIC_SM_LOOPBACK: |
412 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_loopback); | 345 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_loopback); |
413 | bfa_lps_discard(fabric->lps); | 346 | bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); |
414 | bfa_fcs_fabric_set_opertype(fabric); | 347 | bfa_fcs_fabric_set_opertype(fabric); |
415 | break; | 348 | break; |
416 | 349 | ||
@@ -424,12 +357,12 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, | |||
424 | 357 | ||
425 | case BFA_FCS_FABRIC_SM_LINK_DOWN: | 358 | case BFA_FCS_FABRIC_SM_LINK_DOWN: |
426 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); | 359 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); |
427 | bfa_lps_discard(fabric->lps); | 360 | bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); |
428 | break; | 361 | break; |
429 | 362 | ||
430 | case BFA_FCS_FABRIC_SM_DELETE: | 363 | case BFA_FCS_FABRIC_SM_DELETE: |
431 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting); | 364 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting); |
432 | bfa_lps_discard(fabric->lps); | 365 | bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); |
433 | bfa_fcs_fabric_delete(fabric); | 366 | bfa_fcs_fabric_delete(fabric); |
434 | break; | 367 | break; |
435 | 368 | ||
@@ -481,7 +414,7 @@ bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric, | |||
481 | switch (event) { | 414 | switch (event) { |
482 | case BFA_FCS_FABRIC_SM_AUTH_FAILED: | 415 | case BFA_FCS_FABRIC_SM_AUTH_FAILED: |
483 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed); | 416 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed); |
484 | bfa_lps_discard(fabric->lps); | 417 | bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); |
485 | break; | 418 | break; |
486 | 419 | ||
487 | case BFA_FCS_FABRIC_SM_AUTH_SUCCESS: | 420 | case BFA_FCS_FABRIC_SM_AUTH_SUCCESS: |
@@ -495,7 +428,7 @@ bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric, | |||
495 | 428 | ||
496 | case BFA_FCS_FABRIC_SM_LINK_DOWN: | 429 | case BFA_FCS_FABRIC_SM_LINK_DOWN: |
497 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); | 430 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); |
498 | bfa_lps_discard(fabric->lps); | 431 | bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); |
499 | break; | 432 | break; |
500 | 433 | ||
501 | case BFA_FCS_FABRIC_SM_DELETE: | 434 | case BFA_FCS_FABRIC_SM_DELETE: |
@@ -511,7 +444,7 @@ bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric, | |||
511 | /* | 444 | /* |
512 | * Authentication failed | 445 | * Authentication failed |
513 | */ | 446 | */ |
514 | static void | 447 | void |
515 | bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric, | 448 | bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric, |
516 | enum bfa_fcs_fabric_event event) | 449 | enum bfa_fcs_fabric_event event) |
517 | { | 450 | { |
@@ -537,7 +470,7 @@ bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric, | |||
537 | /* | 470 | /* |
538 | * Port is in loopback mode. | 471 | * Port is in loopback mode. |
539 | */ | 472 | */ |
540 | static void | 473 | void |
541 | bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric, | 474 | bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric, |
542 | enum bfa_fcs_fabric_event event) | 475 | enum bfa_fcs_fabric_event event) |
543 | { | 476 | { |
@@ -573,7 +506,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, | |||
573 | switch (event) { | 506 | switch (event) { |
574 | case BFA_FCS_FABRIC_SM_LINK_DOWN: | 507 | case BFA_FCS_FABRIC_SM_LINK_DOWN: |
575 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); | 508 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); |
576 | bfa_lps_discard(fabric->lps); | 509 | bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); |
577 | bfa_fcs_fabric_notify_offline(fabric); | 510 | bfa_fcs_fabric_notify_offline(fabric); |
578 | break; | 511 | break; |
579 | 512 | ||
@@ -596,7 +529,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, | |||
596 | /* | 529 | /* |
597 | * Fabric is online - normal operating state. | 530 | * Fabric is online - normal operating state. |
598 | */ | 531 | */ |
599 | static void | 532 | void |
600 | bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, | 533 | bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, |
601 | enum bfa_fcs_fabric_event event) | 534 | enum bfa_fcs_fabric_event event) |
602 | { | 535 | { |
@@ -606,7 +539,7 @@ bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, | |||
606 | switch (event) { | 539 | switch (event) { |
607 | case BFA_FCS_FABRIC_SM_LINK_DOWN: | 540 | case BFA_FCS_FABRIC_SM_LINK_DOWN: |
608 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); | 541 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); |
609 | bfa_lps_discard(fabric->lps); | 542 | bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); |
610 | bfa_fcs_fabric_notify_offline(fabric); | 543 | bfa_fcs_fabric_notify_offline(fabric); |
611 | break; | 544 | break; |
612 | 545 | ||
@@ -617,7 +550,7 @@ bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, | |||
617 | 550 | ||
618 | case BFA_FCS_FABRIC_SM_AUTH_FAILED: | 551 | case BFA_FCS_FABRIC_SM_AUTH_FAILED: |
619 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed); | 552 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed); |
620 | bfa_lps_discard(fabric->lps); | 553 | bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); |
621 | break; | 554 | break; |
622 | 555 | ||
623 | case BFA_FCS_FABRIC_SM_AUTH_SUCCESS: | 556 | case BFA_FCS_FABRIC_SM_AUTH_SUCCESS: |
@@ -697,7 +630,7 @@ bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric, | |||
697 | switch (event) { | 630 | switch (event) { |
698 | case BFA_FCS_FABRIC_SM_DELCOMP: | 631 | case BFA_FCS_FABRIC_SM_DELCOMP: |
699 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); | 632 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); |
700 | bfa_fcs_modexit_comp(fabric->fcs); | 633 | bfa_wc_down(&fabric->fcs->wc); |
701 | break; | 634 | break; |
702 | 635 | ||
703 | case BFA_FCS_FABRIC_SM_LINK_UP: | 636 | case BFA_FCS_FABRIC_SM_LINK_UP: |
@@ -724,8 +657,8 @@ bfa_fcs_fabric_init(struct bfa_fcs_fabric_s *fabric) | |||
724 | struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg; | 657 | struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg; |
725 | 658 | ||
726 | port_cfg->roles = BFA_LPORT_ROLE_FCP_IM; | 659 | port_cfg->roles = BFA_LPORT_ROLE_FCP_IM; |
727 | port_cfg->nwwn = bfa_ioc_get_nwwn(&fabric->fcs->bfa->ioc); | 660 | port_cfg->nwwn = fabric->fcs->bfa->ioc.attr->nwwn; |
728 | port_cfg->pwwn = bfa_ioc_get_pwwn(&fabric->fcs->bfa->ioc); | 661 | port_cfg->pwwn = fabric->fcs->bfa->ioc.attr->pwwn; |
729 | } | 662 | } |
730 | 663 | ||
731 | /* | 664 | /* |
@@ -813,7 +746,7 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status) | |||
813 | return; | 746 | return; |
814 | 747 | ||
815 | case BFA_STATUS_EPROTOCOL: | 748 | case BFA_STATUS_EPROTOCOL: |
816 | switch (bfa_lps_get_extstatus(fabric->lps)) { | 749 | switch (fabric->lps->ext_status) { |
817 | case BFA_EPROTO_BAD_ACCEPT: | 750 | case BFA_EPROTO_BAD_ACCEPT: |
818 | fabric->stats.flogi_acc_err++; | 751 | fabric->stats.flogi_acc_err++; |
819 | break; | 752 | break; |
@@ -840,26 +773,26 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status) | |||
840 | return; | 773 | return; |
841 | } | 774 | } |
842 | 775 | ||
843 | fabric->bb_credit = bfa_lps_get_peer_bbcredit(fabric->lps); | 776 | fabric->bb_credit = fabric->lps->pr_bbcred; |
844 | bfa_trc(fabric->fcs, fabric->bb_credit); | 777 | bfa_trc(fabric->fcs, fabric->bb_credit); |
845 | 778 | ||
846 | if (!bfa_lps_is_brcd_fabric(fabric->lps)) | 779 | if (!(fabric->lps->brcd_switch)) |
847 | fabric->fabric_name = bfa_lps_get_peer_nwwn(fabric->lps); | 780 | fabric->fabric_name = fabric->lps->pr_nwwn; |
848 | 781 | ||
849 | /* | 782 | /* |
850 | * Check port type. It should be 1 = F-port. | 783 | * Check port type. It should be 1 = F-port. |
851 | */ | 784 | */ |
852 | if (bfa_lps_is_fport(fabric->lps)) { | 785 | if (fabric->lps->fport) { |
853 | fabric->bport.pid = bfa_lps_get_pid(fabric->lps); | 786 | fabric->bport.pid = fabric->lps->lp_pid; |
854 | fabric->is_npiv = bfa_lps_is_npiv_en(fabric->lps); | 787 | fabric->is_npiv = fabric->lps->npiv_en; |
855 | fabric->is_auth = bfa_lps_is_authreq(fabric->lps); | 788 | fabric->is_auth = fabric->lps->auth_req; |
856 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_CONT_OP); | 789 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_CONT_OP); |
857 | } else { | 790 | } else { |
858 | /* | 791 | /* |
859 | * Nport-2-Nport direct attached | 792 | * Nport-2-Nport direct attached |
860 | */ | 793 | */ |
861 | fabric->bport.port_topo.pn2n.rem_port_wwn = | 794 | fabric->bport.port_topo.pn2n.rem_port_wwn = |
862 | bfa_lps_get_peer_pwwn(fabric->lps); | 795 | fabric->lps->pr_pwwn; |
863 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_NO_FABRIC); | 796 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_NO_FABRIC); |
864 | } | 797 | } |
865 | 798 | ||
@@ -987,7 +920,7 @@ bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs) | |||
987 | INIT_LIST_HEAD(&fabric->vport_q); | 920 | INIT_LIST_HEAD(&fabric->vport_q); |
988 | INIT_LIST_HEAD(&fabric->vf_q); | 921 | INIT_LIST_HEAD(&fabric->vf_q); |
989 | fabric->lps = bfa_lps_alloc(fcs->bfa); | 922 | fabric->lps = bfa_lps_alloc(fcs->bfa); |
990 | bfa_assert(fabric->lps); | 923 | WARN_ON(!fabric->lps); |
991 | 924 | ||
992 | /* | 925 | /* |
993 | * Initialize fabric delete completion handler. Fabric deletion is | 926 | * Initialize fabric delete completion handler. Fabric deletion is |
@@ -1038,31 +971,6 @@ bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs) | |||
1038 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_START); | 971 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_START); |
1039 | } | 972 | } |
1040 | 973 | ||
1041 | /* | ||
1042 | * Suspend fabric activity as part of driver suspend. | ||
1043 | */ | ||
1044 | void | ||
1045 | bfa_fcs_fabric_modsusp(struct bfa_fcs_s *fcs) | ||
1046 | { | ||
1047 | } | ||
1048 | |||
1049 | bfa_boolean_t | ||
1050 | bfa_fcs_fabric_is_loopback(struct bfa_fcs_fabric_s *fabric) | ||
1051 | { | ||
1052 | return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_loopback); | ||
1053 | } | ||
1054 | |||
1055 | bfa_boolean_t | ||
1056 | bfa_fcs_fabric_is_auth_failed(struct bfa_fcs_fabric_s *fabric) | ||
1057 | { | ||
1058 | return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_auth_failed); | ||
1059 | } | ||
1060 | |||
1061 | enum bfa_port_type | ||
1062 | bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric) | ||
1063 | { | ||
1064 | return fabric->oper_type; | ||
1065 | } | ||
1066 | 974 | ||
1067 | /* | 975 | /* |
1068 | * Link up notification from BFA physical port module. | 976 | * Link up notification from BFA physical port module. |
@@ -1123,40 +1031,6 @@ bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric, | |||
1123 | bfa_wc_down(&fabric->wc); | 1031 | bfa_wc_down(&fabric->wc); |
1124 | } | 1032 | } |
1125 | 1033 | ||
1126 | /* | ||
1127 | * Base port is deleted. | ||
1128 | */ | ||
1129 | void | ||
1130 | bfa_fcs_fabric_port_delete_comp(struct bfa_fcs_fabric_s *fabric) | ||
1131 | { | ||
1132 | bfa_wc_down(&fabric->wc); | ||
1133 | } | ||
1134 | |||
1135 | |||
1136 | /* | ||
1137 | * Check if fabric is online. | ||
1138 | * | ||
1139 | * param[in] fabric - Fabric instance. This can be a base fabric or vf. | ||
1140 | * | ||
1141 | * @return TRUE/FALSE | ||
1142 | */ | ||
1143 | int | ||
1144 | bfa_fcs_fabric_is_online(struct bfa_fcs_fabric_s *fabric) | ||
1145 | { | ||
1146 | return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_online); | ||
1147 | } | ||
1148 | |||
1149 | /* | ||
1150 | * brief | ||
1151 | * | ||
1152 | */ | ||
1153 | bfa_status_t | ||
1154 | bfa_fcs_fabric_addvf(struct bfa_fcs_fabric_s *vf, struct bfa_fcs_s *fcs, | ||
1155 | struct bfa_lport_cfg_s *port_cfg, struct bfad_vf_s *vf_drv) | ||
1156 | { | ||
1157 | bfa_sm_set_state(vf, bfa_fcs_fabric_sm_uninit); | ||
1158 | return BFA_STATUS_OK; | ||
1159 | } | ||
1160 | 1034 | ||
1161 | /* | 1035 | /* |
1162 | * Lookup for a vport withing a fabric given its pwwn | 1036 | * Lookup for a vport withing a fabric given its pwwn |
@@ -1176,18 +1050,6 @@ bfa_fcs_fabric_vport_lookup(struct bfa_fcs_fabric_s *fabric, wwn_t pwwn) | |||
1176 | return NULL; | 1050 | return NULL; |
1177 | } | 1051 | } |
1178 | 1052 | ||
1179 | /* | ||
1180 | * In a given fabric, return the number of lports. | ||
1181 | * | ||
1182 | * param[in] fabric - Fabric instance. This can be a base fabric or vf. | ||
1183 | * | ||
1184 | * @return : 1 or more. | ||
1185 | */ | ||
1186 | u16 | ||
1187 | bfa_fcs_fabric_vport_count(struct bfa_fcs_fabric_s *fabric) | ||
1188 | { | ||
1189 | return fabric->num_vports; | ||
1190 | } | ||
1191 | 1053 | ||
1192 | /* | 1054 | /* |
1193 | * Get OUI of the attached switch. | 1055 | * Get OUI of the attached switch. |
@@ -1207,7 +1069,7 @@ bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric) | |||
1207 | u8 *tmp; | 1069 | u8 *tmp; |
1208 | u16 oui; | 1070 | u16 oui; |
1209 | 1071 | ||
1210 | fab_nwwn = bfa_lps_get_peer_nwwn(fabric->lps); | 1072 | fab_nwwn = fabric->lps->pr_nwwn; |
1211 | 1073 | ||
1212 | tmp = (u8 *)&fab_nwwn; | 1074 | tmp = (u8 *)&fab_nwwn; |
1213 | oui = (tmp[3] << 8) | tmp[4]; | 1075 | oui = (tmp[3] << 8) | tmp[4]; |
@@ -1235,7 +1097,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs, | |||
1235 | * external loopback cable is in place. Our own FLOGI frames are | 1097 | * external loopback cable is in place. Our own FLOGI frames are |
1236 | * sometimes looped back when switch port gets temporarily bypassed. | 1098 | * sometimes looped back when switch port gets temporarily bypassed. |
1237 | */ | 1099 | */ |
1238 | if ((pid == bfa_os_ntoh3b(FC_FABRIC_PORT)) && | 1100 | if ((pid == bfa_ntoh3b(FC_FABRIC_PORT)) && |
1239 | (els_cmd->els_code == FC_ELS_FLOGI) && | 1101 | (els_cmd->els_code == FC_ELS_FLOGI) && |
1240 | (flogi->port_name == bfa_fcs_lport_get_pwwn(&fabric->bport))) { | 1102 | (flogi->port_name == bfa_fcs_lport_get_pwwn(&fabric->bport))) { |
1241 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOOPBACK); | 1103 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOOPBACK); |
@@ -1245,7 +1107,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs, | |||
1245 | /* | 1107 | /* |
1246 | * FLOGI/EVFP exchanges should be consumed by base fabric. | 1108 | * FLOGI/EVFP exchanges should be consumed by base fabric. |
1247 | */ | 1109 | */ |
1248 | if (fchs->d_id == bfa_os_hton3b(FC_FABRIC_PORT)) { | 1110 | if (fchs->d_id == bfa_hton3b(FC_FABRIC_PORT)) { |
1249 | bfa_trc(fabric->fcs, pid); | 1111 | bfa_trc(fabric->fcs, pid); |
1250 | bfa_fcs_fabric_process_uf(fabric, fchs, len); | 1112 | bfa_fcs_fabric_process_uf(fabric, fchs, len); |
1251 | return; | 1113 | return; |
@@ -1358,13 +1220,13 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric) | |||
1358 | return; | 1220 | return; |
1359 | 1221 | ||
1360 | reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), | 1222 | reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), |
1361 | bfa_os_hton3b(FC_FABRIC_PORT), | 1223 | bfa_hton3b(FC_FABRIC_PORT), |
1362 | n2n_port->reply_oxid, pcfg->pwwn, | 1224 | n2n_port->reply_oxid, pcfg->pwwn, |
1363 | pcfg->nwwn, | 1225 | pcfg->nwwn, |
1364 | bfa_fcport_get_maxfrsize(bfa), | 1226 | bfa_fcport_get_maxfrsize(bfa), |
1365 | bfa_fcport_get_rx_bbcredit(bfa)); | 1227 | bfa_fcport_get_rx_bbcredit(bfa)); |
1366 | 1228 | ||
1367 | bfa_fcxp_send(fcxp, NULL, fabric->vf_id, bfa_lps_get_tag(fabric->lps), | 1229 | bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->lp_tag, |
1368 | BFA_FALSE, FC_CLASS_3, | 1230 | BFA_FALSE, FC_CLASS_3, |
1369 | reqlen, &fchs, bfa_fcs_fabric_flogiacc_comp, fabric, | 1231 | reqlen, &fchs, bfa_fcs_fabric_flogiacc_comp, fabric, |
1370 | FC_MAX_PDUSZ, 0); | 1232 | FC_MAX_PDUSZ, 0); |
@@ -1455,7 +1317,7 @@ bfa_fcs_port_event_handler(void *cbarg, enum bfa_port_linkstate event) | |||
1455 | break; | 1317 | break; |
1456 | 1318 | ||
1457 | default: | 1319 | default: |
1458 | bfa_assert(0); | 1320 | WARN_ON(1); |
1459 | } | 1321 | } |
1460 | } | 1322 | } |
1461 | 1323 | ||
@@ -1502,7 +1364,7 @@ bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf) | |||
1502 | * drop frame if vfid is unknown | 1364 | * drop frame if vfid is unknown |
1503 | */ | 1365 | */ |
1504 | if (!fabric) { | 1366 | if (!fabric) { |
1505 | bfa_assert(0); | 1367 | WARN_ON(1); |
1506 | bfa_stats(fcs, uf.vfid_unknown); | 1368 | bfa_stats(fcs, uf.vfid_unknown); |
1507 | bfa_uf_free(uf); | 1369 | bfa_uf_free(uf); |
1508 | return; | 1370 | return; |
diff --git a/drivers/scsi/bfa/bfa_fcs.h b/drivers/scsi/bfa/bfa_fcs.h index 9cb6a55977c..0fd63168573 100644 --- a/drivers/scsi/bfa/bfa_fcs.h +++ b/drivers/scsi/bfa/bfa_fcs.h | |||
@@ -27,6 +27,22 @@ | |||
27 | #define BFA_FCS_OS_STR_LEN 64 | 27 | #define BFA_FCS_OS_STR_LEN 64 |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * lps_pvt BFA LPS private functions | ||
31 | */ | ||
32 | |||
33 | enum bfa_lps_event { | ||
34 | BFA_LPS_SM_LOGIN = 1, /* login request from user */ | ||
35 | BFA_LPS_SM_LOGOUT = 2, /* logout request from user */ | ||
36 | BFA_LPS_SM_FWRSP = 3, /* f/w response to login/logout */ | ||
37 | BFA_LPS_SM_RESUME = 4, /* space present in reqq queue */ | ||
38 | BFA_LPS_SM_DELETE = 5, /* lps delete from user */ | ||
39 | BFA_LPS_SM_OFFLINE = 6, /* Link is offline */ | ||
40 | BFA_LPS_SM_RX_CVL = 7, /* Rx clear virtual link */ | ||
41 | BFA_LPS_SM_SET_N2N_PID = 8, /* Set assigned PID for n2n */ | ||
42 | }; | ||
43 | |||
44 | |||
45 | /* | ||
30 | * !!! Only append to the enums defined here to avoid any versioning | 46 | * !!! Only append to the enums defined here to avoid any versioning |
31 | * !!! needed between trace utility and driver version | 47 | * !!! needed between trace utility and driver version |
32 | */ | 48 | */ |
@@ -41,13 +57,12 @@ enum { | |||
41 | struct bfa_fcs_s; | 57 | struct bfa_fcs_s; |
42 | 58 | ||
43 | #define __fcs_min_cfg(__fcs) ((__fcs)->min_cfg) | 59 | #define __fcs_min_cfg(__fcs) ((__fcs)->min_cfg) |
44 | void bfa_fcs_modexit_comp(struct bfa_fcs_s *fcs); | ||
45 | 60 | ||
46 | #define BFA_FCS_BRCD_SWITCH_OUI 0x051e | 61 | #define BFA_FCS_BRCD_SWITCH_OUI 0x051e |
47 | #define N2N_LOCAL_PID 0x010000 | 62 | #define N2N_LOCAL_PID 0x010000 |
48 | #define N2N_REMOTE_PID 0x020000 | 63 | #define N2N_REMOTE_PID 0x020000 |
49 | #define BFA_FCS_RETRY_TIMEOUT 2000 | 64 | #define BFA_FCS_RETRY_TIMEOUT 2000 |
50 | #define BFA_FCS_PID_IS_WKA(pid) ((bfa_os_ntoh3b(pid) > 0xFFF000) ? 1 : 0) | 65 | #define BFA_FCS_PID_IS_WKA(pid) ((bfa_ntoh3b(pid) > 0xFFF000) ? 1 : 0) |
51 | 66 | ||
52 | 67 | ||
53 | 68 | ||
@@ -109,7 +124,7 @@ struct bfa_fcs_lport_loop_s { | |||
109 | 124 | ||
110 | struct bfa_fcs_lport_n2n_s { | 125 | struct bfa_fcs_lport_n2n_s { |
111 | u32 rsvd; | 126 | u32 rsvd; |
112 | u16 reply_oxid; /* ox_id from the req flogi to be | 127 | __be16 reply_oxid; /* ox_id from the req flogi to be |
113 | *used in flogi acc */ | 128 | *used in flogi acc */ |
114 | wwn_t rem_port_wwn; /* Attached port's wwn */ | 129 | wwn_t rem_port_wwn; /* Attached port's wwn */ |
115 | }; | 130 | }; |
@@ -316,8 +331,6 @@ void bfa_fcs_lport_add_rport(struct bfa_fcs_lport_s *port, | |||
316 | struct bfa_fcs_rport_s *rport); | 331 | struct bfa_fcs_rport_s *rport); |
317 | void bfa_fcs_lport_del_rport(struct bfa_fcs_lport_s *port, | 332 | void bfa_fcs_lport_del_rport(struct bfa_fcs_lport_s *port, |
318 | struct bfa_fcs_rport_s *rport); | 333 | struct bfa_fcs_rport_s *rport); |
319 | void bfa_fcs_lport_modinit(struct bfa_fcs_s *fcs); | ||
320 | void bfa_fcs_lport_modexit(struct bfa_fcs_s *fcs); | ||
321 | void bfa_fcs_lport_ns_init(struct bfa_fcs_lport_s *vport); | 334 | void bfa_fcs_lport_ns_init(struct bfa_fcs_lport_s *vport); |
322 | void bfa_fcs_lport_ns_offline(struct bfa_fcs_lport_s *vport); | 335 | void bfa_fcs_lport_ns_offline(struct bfa_fcs_lport_s *vport); |
323 | void bfa_fcs_lport_ns_online(struct bfa_fcs_lport_s *vport); | 336 | void bfa_fcs_lport_ns_online(struct bfa_fcs_lport_s *vport); |
@@ -359,9 +372,6 @@ bfa_status_t bfa_fcs_vport_start(struct bfa_fcs_vport_s *vport); | |||
359 | bfa_status_t bfa_fcs_vport_stop(struct bfa_fcs_vport_s *vport); | 372 | bfa_status_t bfa_fcs_vport_stop(struct bfa_fcs_vport_s *vport); |
360 | void bfa_fcs_vport_get_attr(struct bfa_fcs_vport_s *vport, | 373 | void bfa_fcs_vport_get_attr(struct bfa_fcs_vport_s *vport, |
361 | struct bfa_vport_attr_s *vport_attr); | 374 | struct bfa_vport_attr_s *vport_attr); |
362 | void bfa_fcs_vport_get_stats(struct bfa_fcs_vport_s *vport, | ||
363 | struct bfa_vport_stats_s *vport_stats); | ||
364 | void bfa_fcs_vport_clr_stats(struct bfa_fcs_vport_s *vport); | ||
365 | struct bfa_fcs_vport_s *bfa_fcs_vport_lookup(struct bfa_fcs_s *fcs, | 375 | struct bfa_fcs_vport_s *bfa_fcs_vport_lookup(struct bfa_fcs_s *fcs, |
366 | u16 vf_id, wwn_t vpwwn); | 376 | u16 vf_id, wwn_t vpwwn); |
367 | void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport); | 377 | void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport); |
@@ -406,7 +416,7 @@ struct bfa_fcs_rport_s { | |||
406 | struct bfad_rport_s *rp_drv; /* driver peer instance */ | 416 | struct bfad_rport_s *rp_drv; /* driver peer instance */ |
407 | u32 pid; /* port ID of rport */ | 417 | u32 pid; /* port ID of rport */ |
408 | u16 maxfrsize; /* maximum frame size */ | 418 | u16 maxfrsize; /* maximum frame size */ |
409 | u16 reply_oxid; /* OX_ID of inbound requests */ | 419 | __be16 reply_oxid; /* OX_ID of inbound requests */ |
410 | enum fc_cos fc_cos; /* FC classes of service supp */ | 420 | enum fc_cos fc_cos; /* FC classes of service supp */ |
411 | bfa_boolean_t cisc; /* CISC capable device */ | 421 | bfa_boolean_t cisc; /* CISC capable device */ |
412 | bfa_boolean_t prlo; /* processing prlo or LOGO */ | 422 | bfa_boolean_t prlo; /* processing prlo or LOGO */ |
@@ -437,32 +447,18 @@ bfa_fcs_rport_get_halrport(struct bfa_fcs_rport_s *rport) | |||
437 | /* | 447 | /* |
438 | * bfa fcs rport API functions | 448 | * bfa fcs rport API functions |
439 | */ | 449 | */ |
440 | bfa_status_t bfa_fcs_rport_add(struct bfa_fcs_lport_s *port, wwn_t *pwwn, | ||
441 | struct bfa_fcs_rport_s *rport, | ||
442 | struct bfad_rport_s *rport_drv); | ||
443 | bfa_status_t bfa_fcs_rport_remove(struct bfa_fcs_rport_s *rport); | ||
444 | void bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport, | ||
445 | struct bfa_rport_attr_s *attr); | ||
446 | void bfa_fcs_rport_get_stats(struct bfa_fcs_rport_s *rport, | ||
447 | struct bfa_rport_stats_s *stats); | ||
448 | void bfa_fcs_rport_clear_stats(struct bfa_fcs_rport_s *rport); | ||
449 | struct bfa_fcs_rport_s *bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port, | 450 | struct bfa_fcs_rport_s *bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port, |
450 | wwn_t rpwwn); | 451 | wwn_t rpwwn); |
451 | struct bfa_fcs_rport_s *bfa_fcs_rport_lookup_by_nwwn( | 452 | struct bfa_fcs_rport_s *bfa_fcs_rport_lookup_by_nwwn( |
452 | struct bfa_fcs_lport_s *port, wwn_t rnwwn); | 453 | struct bfa_fcs_lport_s *port, wwn_t rnwwn); |
453 | void bfa_fcs_rport_set_del_timeout(u8 rport_tmo); | 454 | void bfa_fcs_rport_set_del_timeout(u8 rport_tmo); |
454 | 455 | ||
455 | void bfa_fcs_rport_set_speed(struct bfa_fcs_rport_s *rport, | ||
456 | enum bfa_port_speed speed); | ||
457 | void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport, | 456 | void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport, |
458 | struct fchs_s *fchs, u16 len); | 457 | struct fchs_s *fchs, u16 len); |
459 | void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport); | 458 | void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport); |
460 | 459 | ||
461 | struct bfa_fcs_rport_s *bfa_fcs_rport_create(struct bfa_fcs_lport_s *port, | 460 | struct bfa_fcs_rport_s *bfa_fcs_rport_create(struct bfa_fcs_lport_s *port, |
462 | u32 pid); | 461 | u32 pid); |
463 | void bfa_fcs_rport_delete(struct bfa_fcs_rport_s *rport); | ||
464 | void bfa_fcs_rport_online(struct bfa_fcs_rport_s *rport); | ||
465 | void bfa_fcs_rport_offline(struct bfa_fcs_rport_s *rport); | ||
466 | void bfa_fcs_rport_start(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs, | 462 | void bfa_fcs_rport_start(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs, |
467 | struct fc_logi_s *plogi_rsp); | 463 | struct fc_logi_s *plogi_rsp); |
468 | void bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port, | 464 | void bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port, |
@@ -470,10 +466,8 @@ void bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port, | |||
470 | struct fc_logi_s *plogi); | 466 | struct fc_logi_s *plogi); |
471 | void bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs, | 467 | void bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs, |
472 | struct fc_logi_s *plogi); | 468 | struct fc_logi_s *plogi); |
473 | void bfa_fcs_rport_logo_imp(struct bfa_fcs_rport_s *rport); | 469 | void bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id); |
474 | void bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, u16 ox_id); | ||
475 | 470 | ||
476 | void bfa_fcs_rport_itnim_ack(struct bfa_fcs_rport_s *rport); | ||
477 | void bfa_fcs_rport_itntm_ack(struct bfa_fcs_rport_s *rport); | 471 | void bfa_fcs_rport_itntm_ack(struct bfa_fcs_rport_s *rport); |
478 | void bfa_fcs_rport_fcptm_offline_done(struct bfa_fcs_rport_s *rport); | 472 | void bfa_fcs_rport_fcptm_offline_done(struct bfa_fcs_rport_s *rport); |
479 | int bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport); | 473 | int bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport); |
@@ -618,7 +612,7 @@ struct bfa_fcs_fdmi_hba_attr_s { | |||
618 | u8 option_rom_ver[BFA_VERSION_LEN]; | 612 | u8 option_rom_ver[BFA_VERSION_LEN]; |
619 | u8 fw_version[8]; | 613 | u8 fw_version[8]; |
620 | u8 os_name[256]; | 614 | u8 os_name[256]; |
621 | u32 max_ct_pyld; | 615 | __be32 max_ct_pyld; |
622 | }; | 616 | }; |
623 | 617 | ||
624 | /* | 618 | /* |
@@ -626,9 +620,9 @@ struct bfa_fcs_fdmi_hba_attr_s { | |||
626 | */ | 620 | */ |
627 | struct bfa_fcs_fdmi_port_attr_s { | 621 | struct bfa_fcs_fdmi_port_attr_s { |
628 | u8 supp_fc4_types[32]; /* supported FC4 types */ | 622 | u8 supp_fc4_types[32]; /* supported FC4 types */ |
629 | u32 supp_speed; /* supported speed */ | 623 | __be32 supp_speed; /* supported speed */ |
630 | u32 curr_speed; /* current Speed */ | 624 | __be32 curr_speed; /* current Speed */ |
631 | u32 max_frm_size; /* max frame size */ | 625 | __be32 max_frm_size; /* max frame size */ |
632 | u8 os_device_name[256]; /* OS device Name */ | 626 | u8 os_device_name[256]; /* OS device Name */ |
633 | u8 host_name[256]; /* host name */ | 627 | u8 host_name[256]; /* host name */ |
634 | }; | 628 | }; |
@@ -664,6 +658,57 @@ struct bfa_fcs_s { | |||
664 | }; | 658 | }; |
665 | 659 | ||
666 | /* | 660 | /* |
661 | * fcs_fabric_sm fabric state machine functions | ||
662 | */ | ||
663 | |||
664 | /* | ||
665 | * Fabric state machine events | ||
666 | */ | ||
667 | enum bfa_fcs_fabric_event { | ||
668 | BFA_FCS_FABRIC_SM_CREATE = 1, /* create from driver */ | ||
669 | BFA_FCS_FABRIC_SM_DELETE = 2, /* delete from driver */ | ||
670 | BFA_FCS_FABRIC_SM_LINK_DOWN = 3, /* link down from port */ | ||
671 | BFA_FCS_FABRIC_SM_LINK_UP = 4, /* link up from port */ | ||
672 | BFA_FCS_FABRIC_SM_CONT_OP = 5, /* flogi/auth continue op */ | ||
673 | BFA_FCS_FABRIC_SM_RETRY_OP = 6, /* flogi/auth retry op */ | ||
674 | BFA_FCS_FABRIC_SM_NO_FABRIC = 7, /* from flogi/auth */ | ||
675 | BFA_FCS_FABRIC_SM_PERF_EVFP = 8, /* from flogi/auth */ | ||
676 | BFA_FCS_FABRIC_SM_ISOLATE = 9, /* from EVFP processing */ | ||
677 | BFA_FCS_FABRIC_SM_NO_TAGGING = 10, /* no VFT tagging from EVFP */ | ||
678 | BFA_FCS_FABRIC_SM_DELAYED = 11, /* timeout delay event */ | ||
679 | BFA_FCS_FABRIC_SM_AUTH_FAILED = 12, /* auth failed */ | ||
680 | BFA_FCS_FABRIC_SM_AUTH_SUCCESS = 13, /* auth successful */ | ||
681 | BFA_FCS_FABRIC_SM_DELCOMP = 14, /* all vports deleted event */ | ||
682 | BFA_FCS_FABRIC_SM_LOOPBACK = 15, /* Received our own FLOGI */ | ||
683 | BFA_FCS_FABRIC_SM_START = 16, /* from driver */ | ||
684 | }; | ||
685 | |||
686 | /* | ||
687 | * fcs_rport_sm FCS rport state machine events | ||
688 | */ | ||
689 | |||
690 | enum rport_event { | ||
691 | RPSM_EVENT_PLOGI_SEND = 1, /* new rport; start with PLOGI */ | ||
692 | RPSM_EVENT_PLOGI_RCVD = 2, /* Inbound PLOGI from remote port */ | ||
693 | RPSM_EVENT_PLOGI_COMP = 3, /* PLOGI completed to rport */ | ||
694 | RPSM_EVENT_LOGO_RCVD = 4, /* LOGO from remote device */ | ||
695 | RPSM_EVENT_LOGO_IMP = 5, /* implicit logo for SLER */ | ||
696 | RPSM_EVENT_FCXP_SENT = 6, /* Frame from has been sent */ | ||
697 | RPSM_EVENT_DELETE = 7, /* RPORT delete request */ | ||
698 | RPSM_EVENT_SCN = 8, /* state change notification */ | ||
699 | RPSM_EVENT_ACCEPTED = 9, /* Good response from remote device */ | ||
700 | RPSM_EVENT_FAILED = 10, /* Request to rport failed. */ | ||
701 | RPSM_EVENT_TIMEOUT = 11, /* Rport SM timeout event */ | ||
702 | RPSM_EVENT_HCB_ONLINE = 12, /* BFA rport online callback */ | ||
703 | RPSM_EVENT_HCB_OFFLINE = 13, /* BFA rport offline callback */ | ||
704 | RPSM_EVENT_FC4_OFFLINE = 14, /* FC-4 offline complete */ | ||
705 | RPSM_EVENT_ADDRESS_CHANGE = 15, /* Rport's PID has changed */ | ||
706 | RPSM_EVENT_ADDRESS_DISC = 16, /* Need to Discover rport's PID */ | ||
707 | RPSM_EVENT_PRLO_RCVD = 17, /* PRLO from remote device */ | ||
708 | RPSM_EVENT_PLOGI_RETRY = 18, /* Retry PLOGI continously */ | ||
709 | }; | ||
710 | |||
711 | /* | ||
667 | * bfa fcs API functions | 712 | * bfa fcs API functions |
668 | */ | 713 | */ |
669 | void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, | 714 | void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, |
@@ -672,16 +717,12 @@ void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, | |||
672 | void bfa_fcs_init(struct bfa_fcs_s *fcs); | 717 | void bfa_fcs_init(struct bfa_fcs_s *fcs); |
673 | void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, | 718 | void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, |
674 | struct bfa_fcs_driver_info_s *driver_info); | 719 | struct bfa_fcs_driver_info_s *driver_info); |
675 | void bfa_fcs_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable); | ||
676 | void bfa_fcs_exit(struct bfa_fcs_s *fcs); | 720 | void bfa_fcs_exit(struct bfa_fcs_s *fcs); |
677 | void bfa_fcs_trc_init(struct bfa_fcs_s *fcs, struct bfa_trc_mod_s *trcmod); | ||
678 | void bfa_fcs_start(struct bfa_fcs_s *fcs); | ||
679 | 721 | ||
680 | /* | 722 | /* |
681 | * bfa fcs vf public functions | 723 | * bfa fcs vf public functions |
682 | */ | 724 | */ |
683 | bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id); | 725 | bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id); |
684 | u16 bfa_fcs_fabric_vport_count(struct bfa_fcs_fabric_s *fabric); | ||
685 | 726 | ||
686 | /* | 727 | /* |
687 | * fabric protected interface functions | 728 | * fabric protected interface functions |
@@ -689,32 +730,29 @@ u16 bfa_fcs_fabric_vport_count(struct bfa_fcs_fabric_s *fabric); | |||
689 | void bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs); | 730 | void bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs); |
690 | void bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs); | 731 | void bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs); |
691 | void bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs); | 732 | void bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs); |
692 | void bfa_fcs_fabric_modsusp(struct bfa_fcs_s *fcs); | ||
693 | void bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric); | 733 | void bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric); |
694 | void bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric); | 734 | void bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric); |
695 | void bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric, | 735 | void bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric, |
696 | struct bfa_fcs_vport_s *vport); | 736 | struct bfa_fcs_vport_s *vport); |
697 | void bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric, | 737 | void bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric, |
698 | struct bfa_fcs_vport_s *vport); | 738 | struct bfa_fcs_vport_s *vport); |
699 | int bfa_fcs_fabric_is_online(struct bfa_fcs_fabric_s *fabric); | ||
700 | struct bfa_fcs_vport_s *bfa_fcs_fabric_vport_lookup( | 739 | struct bfa_fcs_vport_s *bfa_fcs_fabric_vport_lookup( |
701 | struct bfa_fcs_fabric_s *fabric, wwn_t pwwn); | 740 | struct bfa_fcs_fabric_s *fabric, wwn_t pwwn); |
702 | void bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs); | 741 | void bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs); |
703 | void bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, | 742 | void bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, |
704 | struct fchs_s *fchs, u16 len); | 743 | struct fchs_s *fchs, u16 len); |
705 | bfa_boolean_t bfa_fcs_fabric_is_loopback(struct bfa_fcs_fabric_s *fabric); | ||
706 | bfa_boolean_t bfa_fcs_fabric_is_auth_failed(struct bfa_fcs_fabric_s *fabric); | ||
707 | enum bfa_port_type bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric); | ||
708 | void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric); | 744 | void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric); |
709 | void bfa_fcs_fabric_port_delete_comp(struct bfa_fcs_fabric_s *fabric); | ||
710 | bfa_status_t bfa_fcs_fabric_addvf(struct bfa_fcs_fabric_s *vf, | ||
711 | struct bfa_fcs_s *fcs, struct bfa_lport_cfg_s *port_cfg, | ||
712 | struct bfad_vf_s *vf_drv); | ||
713 | void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric, | 745 | void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric, |
714 | wwn_t fabric_name); | 746 | wwn_t fabric_name); |
715 | u16 bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric); | 747 | u16 bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric); |
716 | void bfa_fcs_uf_attach(struct bfa_fcs_s *fcs); | 748 | void bfa_fcs_uf_attach(struct bfa_fcs_s *fcs); |
717 | void bfa_fcs_port_attach(struct bfa_fcs_s *fcs); | 749 | void bfa_fcs_port_attach(struct bfa_fcs_s *fcs); |
750 | void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, | ||
751 | enum bfa_fcs_fabric_event event); | ||
752 | void bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric, | ||
753 | enum bfa_fcs_fabric_event event); | ||
754 | void bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric, | ||
755 | enum bfa_fcs_fabric_event event); | ||
718 | 756 | ||
719 | /* | 757 | /* |
720 | * BFA FCS callback interfaces | 758 | * BFA FCS callback interfaces |
diff --git a/drivers/scsi/bfa/bfa_fcs_fcpim.c b/drivers/scsi/bfa/bfa_fcs_fcpim.c index 413b58eef93..e7b49f4cb51 100644 --- a/drivers/scsi/bfa/bfa_fcs_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcs_fcpim.c | |||
@@ -19,9 +19,9 @@ | |||
19 | * fcpim.c - FCP initiator mode i-t nexus state machine | 19 | * fcpim.c - FCP initiator mode i-t nexus state machine |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "bfad_drv.h" | ||
22 | #include "bfa_fcs.h" | 23 | #include "bfa_fcs.h" |
23 | #include "bfa_fcbuild.h" | 24 | #include "bfa_fcbuild.h" |
24 | #include "bfad_drv.h" | ||
25 | #include "bfad_im.h" | 25 | #include "bfad_im.h" |
26 | 26 | ||
27 | BFA_TRC_FILE(FCS, FCPIM); | 27 | BFA_TRC_FILE(FCS, FCPIM); |
@@ -103,7 +103,7 @@ bfa_fcs_itnim_sm_offline(struct bfa_fcs_itnim_s *itnim, | |||
103 | break; | 103 | break; |
104 | 104 | ||
105 | case BFA_FCS_ITNIM_SM_OFFLINE: | 105 | case BFA_FCS_ITNIM_SM_OFFLINE: |
106 | bfa_fcs_rport_itnim_ack(itnim->rport); | 106 | bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); |
107 | break; | 107 | break; |
108 | 108 | ||
109 | case BFA_FCS_ITNIM_SM_INITIATOR: | 109 | case BFA_FCS_ITNIM_SM_INITIATOR: |
@@ -140,7 +140,7 @@ bfa_fcs_itnim_sm_prli_send(struct bfa_fcs_itnim_s *itnim, | |||
140 | case BFA_FCS_ITNIM_SM_OFFLINE: | 140 | case BFA_FCS_ITNIM_SM_OFFLINE: |
141 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); | 141 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); |
142 | bfa_fcxp_walloc_cancel(itnim->fcs->bfa, &itnim->fcxp_wqe); | 142 | bfa_fcxp_walloc_cancel(itnim->fcs->bfa, &itnim->fcxp_wqe); |
143 | bfa_fcs_rport_itnim_ack(itnim->rport); | 143 | bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); |
144 | break; | 144 | break; |
145 | 145 | ||
146 | case BFA_FCS_ITNIM_SM_DELETE: | 146 | case BFA_FCS_ITNIM_SM_DELETE: |
@@ -181,7 +181,7 @@ bfa_fcs_itnim_sm_prli(struct bfa_fcs_itnim_s *itnim, | |||
181 | case BFA_FCS_ITNIM_SM_OFFLINE: | 181 | case BFA_FCS_ITNIM_SM_OFFLINE: |
182 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); | 182 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); |
183 | bfa_fcxp_discard(itnim->fcxp); | 183 | bfa_fcxp_discard(itnim->fcxp); |
184 | bfa_fcs_rport_itnim_ack(itnim->rport); | 184 | bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); |
185 | break; | 185 | break; |
186 | 186 | ||
187 | case BFA_FCS_ITNIM_SM_INITIATOR: | 187 | case BFA_FCS_ITNIM_SM_INITIATOR: |
@@ -217,7 +217,7 @@ bfa_fcs_itnim_sm_prli_retry(struct bfa_fcs_itnim_s *itnim, | |||
217 | } else { | 217 | } else { |
218 | /* invoke target offline */ | 218 | /* invoke target offline */ |
219 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); | 219 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); |
220 | bfa_fcs_rport_logo_imp(itnim->rport); | 220 | bfa_sm_send_event(itnim->rport, RPSM_EVENT_LOGO_IMP); |
221 | } | 221 | } |
222 | break; | 222 | break; |
223 | 223 | ||
@@ -225,7 +225,7 @@ bfa_fcs_itnim_sm_prli_retry(struct bfa_fcs_itnim_s *itnim, | |||
225 | case BFA_FCS_ITNIM_SM_OFFLINE: | 225 | case BFA_FCS_ITNIM_SM_OFFLINE: |
226 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); | 226 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); |
227 | bfa_timer_stop(&itnim->timer); | 227 | bfa_timer_stop(&itnim->timer); |
228 | bfa_fcs_rport_itnim_ack(itnim->rport); | 228 | bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); |
229 | break; | 229 | break; |
230 | 230 | ||
231 | case BFA_FCS_ITNIM_SM_INITIATOR: | 231 | case BFA_FCS_ITNIM_SM_INITIATOR: |
@@ -269,7 +269,7 @@ bfa_fcs_itnim_sm_hcb_online(struct bfa_fcs_itnim_s *itnim, | |||
269 | case BFA_FCS_ITNIM_SM_OFFLINE: | 269 | case BFA_FCS_ITNIM_SM_OFFLINE: |
270 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); | 270 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); |
271 | bfa_itnim_offline(itnim->bfa_itnim); | 271 | bfa_itnim_offline(itnim->bfa_itnim); |
272 | bfa_fcs_rport_itnim_ack(itnim->rport); | 272 | bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); |
273 | break; | 273 | break; |
274 | 274 | ||
275 | case BFA_FCS_ITNIM_SM_DELETE: | 275 | case BFA_FCS_ITNIM_SM_DELETE: |
@@ -330,7 +330,7 @@ bfa_fcs_itnim_sm_hcb_offline(struct bfa_fcs_itnim_s *itnim, | |||
330 | switch (event) { | 330 | switch (event) { |
331 | case BFA_FCS_ITNIM_SM_HCB_OFFLINE: | 331 | case BFA_FCS_ITNIM_SM_HCB_OFFLINE: |
332 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); | 332 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); |
333 | bfa_fcs_rport_itnim_ack(itnim->rport); | 333 | bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); |
334 | break; | 334 | break; |
335 | 335 | ||
336 | case BFA_FCS_ITNIM_SM_DELETE: | 336 | case BFA_FCS_ITNIM_SM_DELETE: |
@@ -358,7 +358,7 @@ bfa_fcs_itnim_sm_initiator(struct bfa_fcs_itnim_s *itnim, | |||
358 | switch (event) { | 358 | switch (event) { |
359 | case BFA_FCS_ITNIM_SM_OFFLINE: | 359 | case BFA_FCS_ITNIM_SM_OFFLINE: |
360 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); | 360 | bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline); |
361 | bfa_fcs_rport_itnim_ack(itnim->rport); | 361 | bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE); |
362 | break; | 362 | break; |
363 | 363 | ||
364 | case BFA_FCS_ITNIM_SM_RSP_ERROR: | 364 | case BFA_FCS_ITNIM_SM_RSP_ERROR: |
@@ -536,7 +536,7 @@ bfa_fcs_itnim_create(struct bfa_fcs_rport_s *rport) | |||
536 | if (bfa_itnim == NULL) { | 536 | if (bfa_itnim == NULL) { |
537 | bfa_trc(port->fcs, rport->pwwn); | 537 | bfa_trc(port->fcs, rport->pwwn); |
538 | bfa_fcb_itnim_free(port->fcs->bfad, itnim_drv); | 538 | bfa_fcb_itnim_free(port->fcs->bfad, itnim_drv); |
539 | bfa_assert(0); | 539 | WARN_ON(1); |
540 | return NULL; | 540 | return NULL; |
541 | } | 541 | } |
542 | 542 | ||
@@ -688,7 +688,7 @@ bfa_cb_itnim_sler(void *cb_arg) | |||
688 | 688 | ||
689 | itnim->stats.sler++; | 689 | itnim->stats.sler++; |
690 | bfa_trc(itnim->fcs, itnim->rport->pwwn); | 690 | bfa_trc(itnim->fcs, itnim->rport->pwwn); |
691 | bfa_fcs_rport_logo_imp(itnim->rport); | 691 | bfa_sm_send_event(itnim->rport, RPSM_EVENT_LOGO_IMP); |
692 | } | 692 | } |
693 | 693 | ||
694 | struct bfa_fcs_itnim_s * | 694 | struct bfa_fcs_itnim_s * |
@@ -700,7 +700,7 @@ bfa_fcs_itnim_lookup(struct bfa_fcs_lport_s *port, wwn_t rpwwn) | |||
700 | if (!rport) | 700 | if (!rport) |
701 | return NULL; | 701 | return NULL; |
702 | 702 | ||
703 | bfa_assert(rport->itnim != NULL); | 703 | WARN_ON(rport->itnim == NULL); |
704 | return rport->itnim; | 704 | return rport->itnim; |
705 | } | 705 | } |
706 | 706 | ||
@@ -729,7 +729,7 @@ bfa_fcs_itnim_stats_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn, | |||
729 | { | 729 | { |
730 | struct bfa_fcs_itnim_s *itnim = NULL; | 730 | struct bfa_fcs_itnim_s *itnim = NULL; |
731 | 731 | ||
732 | bfa_assert(port != NULL); | 732 | WARN_ON(port == NULL); |
733 | 733 | ||
734 | itnim = bfa_fcs_itnim_lookup(port, rpwwn); | 734 | itnim = bfa_fcs_itnim_lookup(port, rpwwn); |
735 | 735 | ||
@@ -746,7 +746,7 @@ bfa_fcs_itnim_stats_clear(struct bfa_fcs_lport_s *port, wwn_t rpwwn) | |||
746 | { | 746 | { |
747 | struct bfa_fcs_itnim_s *itnim = NULL; | 747 | struct bfa_fcs_itnim_s *itnim = NULL; |
748 | 748 | ||
749 | bfa_assert(port != NULL); | 749 | WARN_ON(port == NULL); |
750 | 750 | ||
751 | itnim = bfa_fcs_itnim_lookup(port, rpwwn); | 751 | itnim = bfa_fcs_itnim_lookup(port, rpwwn); |
752 | 752 | ||
@@ -778,6 +778,6 @@ bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim, | |||
778 | break; | 778 | break; |
779 | 779 | ||
780 | default: | 780 | default: |
781 | bfa_assert(0); | 781 | WARN_ON(1); |
782 | } | 782 | } |
783 | } | 783 | } |
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index 8d651309302..4e2eb92ba02 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c | |||
@@ -15,10 +15,10 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | ||
18 | #include "bfa_fcs.h" | 19 | #include "bfa_fcs.h" |
19 | #include "bfa_fcbuild.h" | 20 | #include "bfa_fcbuild.h" |
20 | #include "bfa_fc.h" | 21 | #include "bfa_fc.h" |
21 | #include "bfad_drv.h" | ||
22 | 22 | ||
23 | BFA_TRC_FILE(FCS, PORT); | 23 | BFA_TRC_FILE(FCS, PORT); |
24 | 24 | ||
@@ -159,7 +159,7 @@ bfa_fcs_lport_sm_online( | |||
159 | bfa_sm_set_state(port, bfa_fcs_lport_sm_deleting); | 159 | bfa_sm_set_state(port, bfa_fcs_lport_sm_deleting); |
160 | list_for_each_safe(qe, qen, &port->rport_q) { | 160 | list_for_each_safe(qe, qen, &port->rport_q) { |
161 | rport = (struct bfa_fcs_rport_s *) qe; | 161 | rport = (struct bfa_fcs_rport_s *) qe; |
162 | bfa_fcs_rport_delete(rport); | 162 | bfa_sm_send_event(rport, RPSM_EVENT_DELETE); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | break; | 165 | break; |
@@ -197,7 +197,7 @@ bfa_fcs_lport_sm_offline( | |||
197 | bfa_sm_set_state(port, bfa_fcs_lport_sm_deleting); | 197 | bfa_sm_set_state(port, bfa_fcs_lport_sm_deleting); |
198 | list_for_each_safe(qe, qen, &port->rport_q) { | 198 | list_for_each_safe(qe, qen, &port->rport_q) { |
199 | rport = (struct bfa_fcs_rport_s *) qe; | 199 | rport = (struct bfa_fcs_rport_s *) qe; |
200 | bfa_fcs_rport_delete(rport); | 200 | bfa_sm_send_event(rport, RPSM_EVENT_DELETE); |
201 | } | 201 | } |
202 | } | 202 | } |
203 | break; | 203 | break; |
@@ -309,6 +309,7 @@ bfa_fcs_lport_plogi(struct bfa_fcs_lport_s *port, | |||
309 | return; | 309 | return; |
310 | } | 310 | } |
311 | port->pid = rx_fchs->d_id; | 311 | port->pid = rx_fchs->d_id; |
312 | bfa_lps_set_n2n_pid(port->fabric->lps, rx_fchs->d_id); | ||
312 | } | 313 | } |
313 | 314 | ||
314 | /* | 315 | /* |
@@ -323,6 +324,7 @@ bfa_fcs_lport_plogi(struct bfa_fcs_lport_s *port, | |||
323 | (memcmp((void *)&bfa_fcs_lport_get_pwwn(port), | 324 | (memcmp((void *)&bfa_fcs_lport_get_pwwn(port), |
324 | (void *)&plogi->port_name, sizeof(wwn_t)) < 0)) { | 325 | (void *)&plogi->port_name, sizeof(wwn_t)) < 0)) { |
325 | port->pid = rx_fchs->d_id; | 326 | port->pid = rx_fchs->d_id; |
327 | bfa_lps_set_n2n_pid(port->fabric->lps, rx_fchs->d_id); | ||
326 | rport->pid = rx_fchs->s_id; | 328 | rport->pid = rx_fchs->s_id; |
327 | } | 329 | } |
328 | bfa_fcs_rport_plogi(rport, rx_fchs, plogi); | 330 | bfa_fcs_rport_plogi(rport, rx_fchs, plogi); |
@@ -349,8 +351,8 @@ bfa_fcs_lport_plogi(struct bfa_fcs_lport_s *port, | |||
349 | * This is a different device with the same pid. Old device | 351 | * This is a different device with the same pid. Old device |
350 | * disappeared. Send implicit LOGO to old device. | 352 | * disappeared. Send implicit LOGO to old device. |
351 | */ | 353 | */ |
352 | bfa_assert(rport->pwwn != plogi->port_name); | 354 | WARN_ON(rport->pwwn == plogi->port_name); |
353 | bfa_fcs_rport_logo_imp(rport); | 355 | bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP); |
354 | 356 | ||
355 | /* | 357 | /* |
356 | * Inbound PLOGI from a new device (with old PID). | 358 | * Inbound PLOGI from a new device (with old PID). |
@@ -362,7 +364,7 @@ bfa_fcs_lport_plogi(struct bfa_fcs_lport_s *port, | |||
362 | /* | 364 | /* |
363 | * PLOGI crossing each other. | 365 | * PLOGI crossing each other. |
364 | */ | 366 | */ |
365 | bfa_assert(rport->pwwn == WWN_NULL); | 367 | WARN_ON(rport->pwwn != WWN_NULL); |
366 | bfa_fcs_rport_plogi(rport, rx_fchs, plogi); | 368 | bfa_fcs_rport_plogi(rport, rx_fchs, plogi); |
367 | } | 369 | } |
368 | 370 | ||
@@ -511,7 +513,8 @@ bfa_fcs_lport_offline_actions(struct bfa_fcs_lport_s *port) | |||
511 | __port_action[port->fabric->fab_type].offline(port); | 513 | __port_action[port->fabric->fab_type].offline(port); |
512 | 514 | ||
513 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); | 515 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); |
514 | if (bfa_fcs_fabric_is_online(port->fabric) == BFA_TRUE) | 516 | if (bfa_sm_cmp_state(port->fabric, |
517 | bfa_fcs_fabric_sm_online) == BFA_TRUE) | ||
515 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, | 518 | BFA_LOG(KERN_ERR, bfad, bfa_log_level, |
516 | "Logical port lost fabric connectivity: WWN = %s Role = %s\n", | 519 | "Logical port lost fabric connectivity: WWN = %s Role = %s\n", |
517 | lpwwn_buf, "Initiator"); | 520 | lpwwn_buf, "Initiator"); |
@@ -522,26 +525,26 @@ bfa_fcs_lport_offline_actions(struct bfa_fcs_lport_s *port) | |||
522 | 525 | ||
523 | list_for_each_safe(qe, qen, &port->rport_q) { | 526 | list_for_each_safe(qe, qen, &port->rport_q) { |
524 | rport = (struct bfa_fcs_rport_s *) qe; | 527 | rport = (struct bfa_fcs_rport_s *) qe; |
525 | bfa_fcs_rport_offline(rport); | 528 | bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP); |
526 | } | 529 | } |
527 | } | 530 | } |
528 | 531 | ||
529 | static void | 532 | static void |
530 | bfa_fcs_lport_unknown_init(struct bfa_fcs_lport_s *port) | 533 | bfa_fcs_lport_unknown_init(struct bfa_fcs_lport_s *port) |
531 | { | 534 | { |
532 | bfa_assert(0); | 535 | WARN_ON(1); |
533 | } | 536 | } |
534 | 537 | ||
535 | static void | 538 | static void |
536 | bfa_fcs_lport_unknown_online(struct bfa_fcs_lport_s *port) | 539 | bfa_fcs_lport_unknown_online(struct bfa_fcs_lport_s *port) |
537 | { | 540 | { |
538 | bfa_assert(0); | 541 | WARN_ON(1); |
539 | } | 542 | } |
540 | 543 | ||
541 | static void | 544 | static void |
542 | bfa_fcs_lport_unknown_offline(struct bfa_fcs_lport_s *port) | 545 | bfa_fcs_lport_unknown_offline(struct bfa_fcs_lport_s *port) |
543 | { | 546 | { |
544 | bfa_assert(0); | 547 | WARN_ON(1); |
545 | } | 548 | } |
546 | 549 | ||
547 | static void | 550 | static void |
@@ -584,33 +587,11 @@ bfa_fcs_lport_deleted(struct bfa_fcs_lport_s *port) | |||
584 | port->vport ? port->vport->vport_drv : NULL); | 587 | port->vport ? port->vport->vport_drv : NULL); |
585 | bfa_fcs_vport_delete_comp(port->vport); | 588 | bfa_fcs_vport_delete_comp(port->vport); |
586 | } else { | 589 | } else { |
587 | bfa_fcs_fabric_port_delete_comp(port->fabric); | 590 | bfa_wc_down(&port->fabric->wc); |
588 | } | 591 | } |
589 | } | 592 | } |
590 | 593 | ||
591 | 594 | ||
592 | |||
593 | /* | ||
594 | * fcs_lport_api BFA FCS port API | ||
595 | */ | ||
596 | /* | ||
597 | * Module initialization | ||
598 | */ | ||
599 | void | ||
600 | bfa_fcs_lport_modinit(struct bfa_fcs_s *fcs) | ||
601 | { | ||
602 | |||
603 | } | ||
604 | |||
605 | /* | ||
606 | * Module cleanup | ||
607 | */ | ||
608 | void | ||
609 | bfa_fcs_lport_modexit(struct bfa_fcs_s *fcs) | ||
610 | { | ||
611 | bfa_fcs_modexit_comp(fcs); | ||
612 | } | ||
613 | |||
614 | /* | 595 | /* |
615 | * Unsolicited frame receive handling. | 596 | * Unsolicited frame receive handling. |
616 | */ | 597 | */ |
@@ -623,6 +604,7 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, | |||
623 | struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1); | 604 | struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1); |
624 | 605 | ||
625 | bfa_stats(lport, uf_recvs); | 606 | bfa_stats(lport, uf_recvs); |
607 | bfa_trc(lport->fcs, fchs->type); | ||
626 | 608 | ||
627 | if (!bfa_fcs_lport_is_online(lport)) { | 609 | if (!bfa_fcs_lport_is_online(lport)) { |
628 | bfa_stats(lport, uf_recv_drops); | 610 | bfa_stats(lport, uf_recv_drops); |
@@ -682,8 +664,11 @@ bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, | |||
682 | * Only handles ELS frames for now. | 664 | * Only handles ELS frames for now. |
683 | */ | 665 | */ |
684 | if (fchs->type != FC_TYPE_ELS) { | 666 | if (fchs->type != FC_TYPE_ELS) { |
685 | bfa_trc(lport->fcs, fchs->type); | 667 | bfa_trc(lport->fcs, fchs->s_id); |
686 | bfa_assert(0); | 668 | bfa_trc(lport->fcs, fchs->d_id); |
669 | /* ignore type FC_TYPE_FC_FSS */ | ||
670 | if (fchs->type != FC_TYPE_FC_FSS) | ||
671 | bfa_sm_fault(lport->fcs, fchs->type); | ||
687 | return; | 672 | return; |
688 | } | 673 | } |
689 | 674 | ||
@@ -792,7 +777,7 @@ bfa_fcs_lport_del_rport( | |||
792 | struct bfa_fcs_lport_s *port, | 777 | struct bfa_fcs_lport_s *port, |
793 | struct bfa_fcs_rport_s *rport) | 778 | struct bfa_fcs_rport_s *rport) |
794 | { | 779 | { |
795 | bfa_assert(bfa_q_is_on_q(&port->rport_q, rport)); | 780 | WARN_ON(!bfa_q_is_on_q(&port->rport_q, rport)); |
796 | list_del(&rport->qe); | 781 | list_del(&rport->qe); |
797 | port->num_rports--; | 782 | port->num_rports--; |
798 | 783 | ||
@@ -850,8 +835,8 @@ bfa_fcs_lport_attach(struct bfa_fcs_lport_s *lport, struct bfa_fcs_s *fcs, | |||
850 | lport->fcs = fcs; | 835 | lport->fcs = fcs; |
851 | lport->fabric = bfa_fcs_vf_lookup(fcs, vf_id); | 836 | lport->fabric = bfa_fcs_vf_lookup(fcs, vf_id); |
852 | lport->vport = vport; | 837 | lport->vport = vport; |
853 | lport->lp_tag = (vport) ? bfa_lps_get_tag(vport->lps) : | 838 | lport->lp_tag = (vport) ? vport->lps->lp_tag : |
854 | bfa_lps_get_tag(lport->fabric->lps); | 839 | lport->fabric->lps->lp_tag; |
855 | 840 | ||
856 | INIT_LIST_HEAD(&lport->rport_q); | 841 | INIT_LIST_HEAD(&lport->rport_q); |
857 | lport->num_rports = 0; | 842 | lport->num_rports = 0; |
@@ -903,10 +888,12 @@ bfa_fcs_lport_get_attr( | |||
903 | port_attr->port_cfg = port->port_cfg; | 888 | port_attr->port_cfg = port->port_cfg; |
904 | 889 | ||
905 | if (port->fabric) { | 890 | if (port->fabric) { |
906 | port_attr->port_type = bfa_fcs_fabric_port_type(port->fabric); | 891 | port_attr->port_type = port->fabric->oper_type; |
907 | port_attr->loopback = bfa_fcs_fabric_is_loopback(port->fabric); | 892 | port_attr->loopback = bfa_sm_cmp_state(port->fabric, |
893 | bfa_fcs_fabric_sm_loopback); | ||
908 | port_attr->authfail = | 894 | port_attr->authfail = |
909 | bfa_fcs_fabric_is_auth_failed(port->fabric); | 895 | bfa_sm_cmp_state(port->fabric, |
896 | bfa_fcs_fabric_sm_auth_failed); | ||
910 | port_attr->fabric_name = bfa_fcs_lport_get_fabric_name(port); | 897 | port_attr->fabric_name = bfa_fcs_lport_get_fabric_name(port); |
911 | memcpy(port_attr->fabric_ip_addr, | 898 | memcpy(port_attr->fabric_ip_addr, |
912 | bfa_fcs_lport_get_fabric_ipaddr(port), | 899 | bfa_fcs_lport_get_fabric_ipaddr(port), |
@@ -915,10 +902,10 @@ bfa_fcs_lport_get_attr( | |||
915 | if (port->vport != NULL) { | 902 | if (port->vport != NULL) { |
916 | port_attr->port_type = BFA_PORT_TYPE_VPORT; | 903 | port_attr->port_type = BFA_PORT_TYPE_VPORT; |
917 | port_attr->fpma_mac = | 904 | port_attr->fpma_mac = |
918 | bfa_lps_get_lp_mac(port->vport->lps); | 905 | port->vport->lps->lp_mac; |
919 | } else { | 906 | } else { |
920 | port_attr->fpma_mac = | 907 | port_attr->fpma_mac = |
921 | bfa_lps_get_lp_mac(port->fabric->lps); | 908 | port->fabric->lps->lp_mac; |
922 | } | 909 | } |
923 | } else { | 910 | } else { |
924 | port_attr->port_type = BFA_PORT_TYPE_UNKNOWN; | 911 | port_attr->port_type = BFA_PORT_TYPE_UNKNOWN; |
@@ -998,6 +985,7 @@ bfa_fcs_lport_n2n_online(struct bfa_fcs_lport_s *port) | |||
998 | ((void *)&pcfg->pwwn, (void *)&n2n_port->rem_port_wwn, | 985 | ((void *)&pcfg->pwwn, (void *)&n2n_port->rem_port_wwn, |
999 | sizeof(wwn_t)) > 0) { | 986 | sizeof(wwn_t)) > 0) { |
1000 | port->pid = N2N_LOCAL_PID; | 987 | port->pid = N2N_LOCAL_PID; |
988 | bfa_lps_set_n2n_pid(port->fabric->lps, N2N_LOCAL_PID); | ||
1001 | /* | 989 | /* |
1002 | * First, check if we know the device by pwwn. | 990 | * First, check if we know the device by pwwn. |
1003 | */ | 991 | */ |
@@ -1007,7 +995,7 @@ bfa_fcs_lport_n2n_online(struct bfa_fcs_lport_s *port) | |||
1007 | bfa_trc(port->fcs, rport->pid); | 995 | bfa_trc(port->fcs, rport->pid); |
1008 | bfa_trc(port->fcs, rport->pwwn); | 996 | bfa_trc(port->fcs, rport->pwwn); |
1009 | rport->pid = N2N_REMOTE_PID; | 997 | rport->pid = N2N_REMOTE_PID; |
1010 | bfa_fcs_rport_online(rport); | 998 | bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_SEND); |
1011 | return; | 999 | return; |
1012 | } | 1000 | } |
1013 | 1001 | ||
@@ -1017,10 +1005,10 @@ bfa_fcs_lport_n2n_online(struct bfa_fcs_lport_s *port) | |||
1017 | */ | 1005 | */ |
1018 | if (port->num_rports > 0) { | 1006 | if (port->num_rports > 0) { |
1019 | rport = bfa_fcs_lport_get_rport_by_pid(port, 0); | 1007 | rport = bfa_fcs_lport_get_rport_by_pid(port, 0); |
1020 | bfa_assert(rport != NULL); | 1008 | WARN_ON(rport == NULL); |
1021 | if (rport) { | 1009 | if (rport) { |
1022 | bfa_trc(port->fcs, rport->pwwn); | 1010 | bfa_trc(port->fcs, rport->pwwn); |
1023 | bfa_fcs_rport_delete(rport); | 1011 | bfa_sm_send_event(rport, RPSM_EVENT_DELETE); |
1024 | } | 1012 | } |
1025 | } | 1013 | } |
1026 | bfa_fcs_rport_create(port, N2N_REMOTE_PID); | 1014 | bfa_fcs_rport_create(port, N2N_REMOTE_PID); |
@@ -1569,6 +1557,7 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1569 | struct fdmi_attr_s *attr; | 1557 | struct fdmi_attr_s *attr; |
1570 | u8 *curr_ptr; | 1558 | u8 *curr_ptr; |
1571 | u16 len, count; | 1559 | u16 len, count; |
1560 | u16 templen; | ||
1572 | 1561 | ||
1573 | /* | 1562 | /* |
1574 | * get hba attributes | 1563 | * get hba attributes |
@@ -1594,69 +1583,69 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1594 | */ | 1583 | */ |
1595 | attr = (struct fdmi_attr_s *) curr_ptr; | 1584 | attr = (struct fdmi_attr_s *) curr_ptr; |
1596 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NODENAME); | 1585 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_NODENAME); |
1597 | attr->len = sizeof(wwn_t); | 1586 | templen = sizeof(wwn_t); |
1598 | memcpy(attr->value, &bfa_fcs_lport_get_nwwn(port), attr->len); | 1587 | memcpy(attr->value, &bfa_fcs_lport_get_nwwn(port), templen); |
1599 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1588 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1600 | len += attr->len; | 1589 | len += templen; |
1601 | count++; | 1590 | count++; |
1602 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1591 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1603 | sizeof(attr->len)); | 1592 | sizeof(templen)); |
1604 | 1593 | ||
1605 | /* | 1594 | /* |
1606 | * Manufacturer | 1595 | * Manufacturer |
1607 | */ | 1596 | */ |
1608 | attr = (struct fdmi_attr_s *) curr_ptr; | 1597 | attr = (struct fdmi_attr_s *) curr_ptr; |
1609 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MANUFACTURER); | 1598 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MANUFACTURER); |
1610 | attr->len = (u16) strlen(fcs_hba_attr->manufacturer); | 1599 | templen = (u16) strlen(fcs_hba_attr->manufacturer); |
1611 | memcpy(attr->value, fcs_hba_attr->manufacturer, attr->len); | 1600 | memcpy(attr->value, fcs_hba_attr->manufacturer, templen); |
1612 | attr->len = fc_roundup(attr->len, sizeof(u32)); | 1601 | templen = fc_roundup(templen, sizeof(u32)); |
1613 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1602 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1614 | len += attr->len; | 1603 | len += templen; |
1615 | count++; | 1604 | count++; |
1616 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1605 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1617 | sizeof(attr->len)); | 1606 | sizeof(templen)); |
1618 | 1607 | ||
1619 | /* | 1608 | /* |
1620 | * Serial Number | 1609 | * Serial Number |
1621 | */ | 1610 | */ |
1622 | attr = (struct fdmi_attr_s *) curr_ptr; | 1611 | attr = (struct fdmi_attr_s *) curr_ptr; |
1623 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_SERIALNUM); | 1612 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_SERIALNUM); |
1624 | attr->len = (u16) strlen(fcs_hba_attr->serial_num); | 1613 | templen = (u16) strlen(fcs_hba_attr->serial_num); |
1625 | memcpy(attr->value, fcs_hba_attr->serial_num, attr->len); | 1614 | memcpy(attr->value, fcs_hba_attr->serial_num, templen); |
1626 | attr->len = fc_roundup(attr->len, sizeof(u32)); | 1615 | templen = fc_roundup(templen, sizeof(u32)); |
1627 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1616 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1628 | len += attr->len; | 1617 | len += templen; |
1629 | count++; | 1618 | count++; |
1630 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1619 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1631 | sizeof(attr->len)); | 1620 | sizeof(templen)); |
1632 | 1621 | ||
1633 | /* | 1622 | /* |
1634 | * Model | 1623 | * Model |
1635 | */ | 1624 | */ |
1636 | attr = (struct fdmi_attr_s *) curr_ptr; | 1625 | attr = (struct fdmi_attr_s *) curr_ptr; |
1637 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL); | 1626 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL); |
1638 | attr->len = (u16) strlen(fcs_hba_attr->model); | 1627 | templen = (u16) strlen(fcs_hba_attr->model); |
1639 | memcpy(attr->value, fcs_hba_attr->model, attr->len); | 1628 | memcpy(attr->value, fcs_hba_attr->model, templen); |
1640 | attr->len = fc_roundup(attr->len, sizeof(u32)); | 1629 | templen = fc_roundup(templen, sizeof(u32)); |
1641 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1630 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1642 | len += attr->len; | 1631 | len += templen; |
1643 | count++; | 1632 | count++; |
1644 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1633 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1645 | sizeof(attr->len)); | 1634 | sizeof(templen)); |
1646 | 1635 | ||
1647 | /* | 1636 | /* |
1648 | * Model Desc | 1637 | * Model Desc |
1649 | */ | 1638 | */ |
1650 | attr = (struct fdmi_attr_s *) curr_ptr; | 1639 | attr = (struct fdmi_attr_s *) curr_ptr; |
1651 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL_DESC); | 1640 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MODEL_DESC); |
1652 | attr->len = (u16) strlen(fcs_hba_attr->model_desc); | 1641 | templen = (u16) strlen(fcs_hba_attr->model_desc); |
1653 | memcpy(attr->value, fcs_hba_attr->model_desc, attr->len); | 1642 | memcpy(attr->value, fcs_hba_attr->model_desc, templen); |
1654 | attr->len = fc_roundup(attr->len, sizeof(u32)); | 1643 | templen = fc_roundup(templen, sizeof(u32)); |
1655 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1644 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1656 | len += attr->len; | 1645 | len += templen; |
1657 | count++; | 1646 | count++; |
1658 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1647 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1659 | sizeof(attr->len)); | 1648 | sizeof(templen)); |
1660 | 1649 | ||
1661 | /* | 1650 | /* |
1662 | * H/W Version | 1651 | * H/W Version |
@@ -1664,14 +1653,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1664 | if (fcs_hba_attr->hw_version[0] != '\0') { | 1653 | if (fcs_hba_attr->hw_version[0] != '\0') { |
1665 | attr = (struct fdmi_attr_s *) curr_ptr; | 1654 | attr = (struct fdmi_attr_s *) curr_ptr; |
1666 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_HW_VERSION); | 1655 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_HW_VERSION); |
1667 | attr->len = (u16) strlen(fcs_hba_attr->hw_version); | 1656 | templen = (u16) strlen(fcs_hba_attr->hw_version); |
1668 | memcpy(attr->value, fcs_hba_attr->hw_version, attr->len); | 1657 | memcpy(attr->value, fcs_hba_attr->hw_version, templen); |
1669 | attr->len = fc_roundup(attr->len, sizeof(u32)); | 1658 | templen = fc_roundup(templen, sizeof(u32)); |
1670 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1659 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1671 | len += attr->len; | 1660 | len += templen; |
1672 | count++; | 1661 | count++; |
1673 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1662 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1674 | sizeof(attr->len)); | 1663 | sizeof(templen)); |
1675 | } | 1664 | } |
1676 | 1665 | ||
1677 | /* | 1666 | /* |
@@ -1679,14 +1668,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1679 | */ | 1668 | */ |
1680 | attr = (struct fdmi_attr_s *) curr_ptr; | 1669 | attr = (struct fdmi_attr_s *) curr_ptr; |
1681 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_DRIVER_VERSION); | 1670 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_DRIVER_VERSION); |
1682 | attr->len = (u16) strlen(fcs_hba_attr->driver_version); | 1671 | templen = (u16) strlen(fcs_hba_attr->driver_version); |
1683 | memcpy(attr->value, fcs_hba_attr->driver_version, attr->len); | 1672 | memcpy(attr->value, fcs_hba_attr->driver_version, templen); |
1684 | attr->len = fc_roundup(attr->len, sizeof(u32)); | 1673 | templen = fc_roundup(templen, sizeof(u32)); |
1685 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1674 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1686 | len += attr->len;; | 1675 | len += templen;; |
1687 | count++; | 1676 | count++; |
1688 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1677 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1689 | sizeof(attr->len)); | 1678 | sizeof(templen)); |
1690 | 1679 | ||
1691 | /* | 1680 | /* |
1692 | * Option Rom Version | 1681 | * Option Rom Version |
@@ -1694,14 +1683,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1694 | if (fcs_hba_attr->option_rom_ver[0] != '\0') { | 1683 | if (fcs_hba_attr->option_rom_ver[0] != '\0') { |
1695 | attr = (struct fdmi_attr_s *) curr_ptr; | 1684 | attr = (struct fdmi_attr_s *) curr_ptr; |
1696 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_ROM_VERSION); | 1685 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_ROM_VERSION); |
1697 | attr->len = (u16) strlen(fcs_hba_attr->option_rom_ver); | 1686 | templen = (u16) strlen(fcs_hba_attr->option_rom_ver); |
1698 | memcpy(attr->value, fcs_hba_attr->option_rom_ver, attr->len); | 1687 | memcpy(attr->value, fcs_hba_attr->option_rom_ver, templen); |
1699 | attr->len = fc_roundup(attr->len, sizeof(u32)); | 1688 | templen = fc_roundup(templen, sizeof(u32)); |
1700 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1689 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1701 | len += attr->len; | 1690 | len += templen; |
1702 | count++; | 1691 | count++; |
1703 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1692 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1704 | sizeof(attr->len)); | 1693 | sizeof(templen)); |
1705 | } | 1694 | } |
1706 | 1695 | ||
1707 | /* | 1696 | /* |
@@ -1709,14 +1698,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1709 | */ | 1698 | */ |
1710 | attr = (struct fdmi_attr_s *) curr_ptr; | 1699 | attr = (struct fdmi_attr_s *) curr_ptr; |
1711 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_FW_VERSION); | 1700 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_FW_VERSION); |
1712 | attr->len = (u16) strlen(fcs_hba_attr->driver_version); | 1701 | templen = (u16) strlen(fcs_hba_attr->driver_version); |
1713 | memcpy(attr->value, fcs_hba_attr->driver_version, attr->len); | 1702 | memcpy(attr->value, fcs_hba_attr->driver_version, templen); |
1714 | attr->len = fc_roundup(attr->len, sizeof(u32)); | 1703 | templen = fc_roundup(templen, sizeof(u32)); |
1715 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1704 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1716 | len += attr->len; | 1705 | len += templen; |
1717 | count++; | 1706 | count++; |
1718 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1707 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1719 | sizeof(attr->len)); | 1708 | sizeof(templen)); |
1720 | 1709 | ||
1721 | /* | 1710 | /* |
1722 | * OS Name | 1711 | * OS Name |
@@ -1724,14 +1713,14 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1724 | if (fcs_hba_attr->os_name[0] != '\0') { | 1713 | if (fcs_hba_attr->os_name[0] != '\0') { |
1725 | attr = (struct fdmi_attr_s *) curr_ptr; | 1714 | attr = (struct fdmi_attr_s *) curr_ptr; |
1726 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_OS_NAME); | 1715 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_OS_NAME); |
1727 | attr->len = (u16) strlen(fcs_hba_attr->os_name); | 1716 | templen = (u16) strlen(fcs_hba_attr->os_name); |
1728 | memcpy(attr->value, fcs_hba_attr->os_name, attr->len); | 1717 | memcpy(attr->value, fcs_hba_attr->os_name, templen); |
1729 | attr->len = fc_roundup(attr->len, sizeof(u32)); | 1718 | templen = fc_roundup(templen, sizeof(u32)); |
1730 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1719 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1731 | len += attr->len; | 1720 | len += templen; |
1732 | count++; | 1721 | count++; |
1733 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1722 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1734 | sizeof(attr->len)); | 1723 | sizeof(templen)); |
1735 | } | 1724 | } |
1736 | 1725 | ||
1737 | /* | 1726 | /* |
@@ -1739,12 +1728,12 @@ bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld) | |||
1739 | */ | 1728 | */ |
1740 | attr = (struct fdmi_attr_s *) curr_ptr; | 1729 | attr = (struct fdmi_attr_s *) curr_ptr; |
1741 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MAX_CT); | 1730 | attr->type = cpu_to_be16(FDMI_HBA_ATTRIB_MAX_CT); |
1742 | attr->len = sizeof(fcs_hba_attr->max_ct_pyld); | 1731 | templen = sizeof(fcs_hba_attr->max_ct_pyld); |
1743 | memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, attr->len); | 1732 | memcpy(attr->value, &fcs_hba_attr->max_ct_pyld, templen); |
1744 | len += attr->len; | 1733 | len += templen; |
1745 | count++; | 1734 | count++; |
1746 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1735 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1747 | sizeof(attr->len)); | 1736 | sizeof(templen)); |
1748 | 1737 | ||
1749 | /* | 1738 | /* |
1750 | * Update size of payload | 1739 | * Update size of payload |
@@ -1845,6 +1834,7 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
1845 | u8 *curr_ptr; | 1834 | u8 *curr_ptr; |
1846 | u16 len; | 1835 | u16 len; |
1847 | u8 count = 0; | 1836 | u8 count = 0; |
1837 | u16 templen; | ||
1848 | 1838 | ||
1849 | /* | 1839 | /* |
1850 | * get port attributes | 1840 | * get port attributes |
@@ -1863,54 +1853,54 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
1863 | */ | 1853 | */ |
1864 | attr = (struct fdmi_attr_s *) curr_ptr; | 1854 | attr = (struct fdmi_attr_s *) curr_ptr; |
1865 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_FC4_TYPES); | 1855 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_FC4_TYPES); |
1866 | attr->len = sizeof(fcs_port_attr.supp_fc4_types); | 1856 | templen = sizeof(fcs_port_attr.supp_fc4_types); |
1867 | memcpy(attr->value, fcs_port_attr.supp_fc4_types, attr->len); | 1857 | memcpy(attr->value, fcs_port_attr.supp_fc4_types, templen); |
1868 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1858 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1869 | len += attr->len; | 1859 | len += templen; |
1870 | ++count; | 1860 | ++count; |
1871 | attr->len = | 1861 | attr->len = |
1872 | cpu_to_be16(attr->len + sizeof(attr->type) + | 1862 | cpu_to_be16(templen + sizeof(attr->type) + |
1873 | sizeof(attr->len)); | 1863 | sizeof(templen)); |
1874 | 1864 | ||
1875 | /* | 1865 | /* |
1876 | * Supported Speed | 1866 | * Supported Speed |
1877 | */ | 1867 | */ |
1878 | attr = (struct fdmi_attr_s *) curr_ptr; | 1868 | attr = (struct fdmi_attr_s *) curr_ptr; |
1879 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_SUPP_SPEED); | 1869 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_SUPP_SPEED); |
1880 | attr->len = sizeof(fcs_port_attr.supp_speed); | 1870 | templen = sizeof(fcs_port_attr.supp_speed); |
1881 | memcpy(attr->value, &fcs_port_attr.supp_speed, attr->len); | 1871 | memcpy(attr->value, &fcs_port_attr.supp_speed, templen); |
1882 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1872 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1883 | len += attr->len; | 1873 | len += templen; |
1884 | ++count; | 1874 | ++count; |
1885 | attr->len = | 1875 | attr->len = |
1886 | cpu_to_be16(attr->len + sizeof(attr->type) + | 1876 | cpu_to_be16(templen + sizeof(attr->type) + |
1887 | sizeof(attr->len)); | 1877 | sizeof(templen)); |
1888 | 1878 | ||
1889 | /* | 1879 | /* |
1890 | * current Port Speed | 1880 | * current Port Speed |
1891 | */ | 1881 | */ |
1892 | attr = (struct fdmi_attr_s *) curr_ptr; | 1882 | attr = (struct fdmi_attr_s *) curr_ptr; |
1893 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_SPEED); | 1883 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_PORT_SPEED); |
1894 | attr->len = sizeof(fcs_port_attr.curr_speed); | 1884 | templen = sizeof(fcs_port_attr.curr_speed); |
1895 | memcpy(attr->value, &fcs_port_attr.curr_speed, attr->len); | 1885 | memcpy(attr->value, &fcs_port_attr.curr_speed, templen); |
1896 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1886 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1897 | len += attr->len; | 1887 | len += templen; |
1898 | ++count; | 1888 | ++count; |
1899 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1889 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1900 | sizeof(attr->len)); | 1890 | sizeof(templen)); |
1901 | 1891 | ||
1902 | /* | 1892 | /* |
1903 | * max frame size | 1893 | * max frame size |
1904 | */ | 1894 | */ |
1905 | attr = (struct fdmi_attr_s *) curr_ptr; | 1895 | attr = (struct fdmi_attr_s *) curr_ptr; |
1906 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_FRAME_SIZE); | 1896 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_FRAME_SIZE); |
1907 | attr->len = sizeof(fcs_port_attr.max_frm_size); | 1897 | templen = sizeof(fcs_port_attr.max_frm_size); |
1908 | memcpy(attr->value, &fcs_port_attr.max_frm_size, attr->len); | 1898 | memcpy(attr->value, &fcs_port_attr.max_frm_size, templen); |
1909 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1899 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1910 | len += attr->len; | 1900 | len += templen; |
1911 | ++count; | 1901 | ++count; |
1912 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1902 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1913 | sizeof(attr->len)); | 1903 | sizeof(templen)); |
1914 | 1904 | ||
1915 | /* | 1905 | /* |
1916 | * OS Device Name | 1906 | * OS Device Name |
@@ -1918,14 +1908,14 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
1918 | if (fcs_port_attr.os_device_name[0] != '\0') { | 1908 | if (fcs_port_attr.os_device_name[0] != '\0') { |
1919 | attr = (struct fdmi_attr_s *) curr_ptr; | 1909 | attr = (struct fdmi_attr_s *) curr_ptr; |
1920 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_DEV_NAME); | 1910 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_DEV_NAME); |
1921 | attr->len = (u16) strlen(fcs_port_attr.os_device_name); | 1911 | templen = (u16) strlen(fcs_port_attr.os_device_name); |
1922 | memcpy(attr->value, fcs_port_attr.os_device_name, attr->len); | 1912 | memcpy(attr->value, fcs_port_attr.os_device_name, templen); |
1923 | attr->len = fc_roundup(attr->len, sizeof(u32)); | 1913 | templen = fc_roundup(templen, sizeof(u32)); |
1924 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1914 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1925 | len += attr->len; | 1915 | len += templen; |
1926 | ++count; | 1916 | ++count; |
1927 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1917 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1928 | sizeof(attr->len)); | 1918 | sizeof(templen)); |
1929 | } | 1919 | } |
1930 | /* | 1920 | /* |
1931 | * Host Name | 1921 | * Host Name |
@@ -1933,14 +1923,14 @@ bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
1933 | if (fcs_port_attr.host_name[0] != '\0') { | 1923 | if (fcs_port_attr.host_name[0] != '\0') { |
1934 | attr = (struct fdmi_attr_s *) curr_ptr; | 1924 | attr = (struct fdmi_attr_s *) curr_ptr; |
1935 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_HOST_NAME); | 1925 | attr->type = cpu_to_be16(FDMI_PORT_ATTRIB_HOST_NAME); |
1936 | attr->len = (u16) strlen(fcs_port_attr.host_name); | 1926 | templen = (u16) strlen(fcs_port_attr.host_name); |
1937 | memcpy(attr->value, fcs_port_attr.host_name, attr->len); | 1927 | memcpy(attr->value, fcs_port_attr.host_name, templen); |
1938 | attr->len = fc_roundup(attr->len, sizeof(u32)); | 1928 | templen = fc_roundup(templen, sizeof(u32)); |
1939 | curr_ptr += sizeof(attr->type) + sizeof(attr->len) + attr->len; | 1929 | curr_ptr += sizeof(attr->type) + sizeof(templen) + templen; |
1940 | len += attr->len; | 1930 | len += templen; |
1941 | ++count; | 1931 | ++count; |
1942 | attr->len = cpu_to_be16(attr->len + sizeof(attr->type) + | 1932 | attr->len = cpu_to_be16(templen + sizeof(attr->type) + |
1943 | sizeof(attr->len)); | 1933 | sizeof(templen)); |
1944 | } | 1934 | } |
1945 | 1935 | ||
1946 | /* | 1936 | /* |
@@ -2103,7 +2093,7 @@ bfa_fcs_lport_fdmi_timeout(void *arg) | |||
2103 | bfa_sm_send_event(fdmi, FDMISM_EVENT_TIMEOUT); | 2093 | bfa_sm_send_event(fdmi, FDMISM_EVENT_TIMEOUT); |
2104 | } | 2094 | } |
2105 | 2095 | ||
2106 | void | 2096 | static void |
2107 | bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, | 2097 | bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, |
2108 | struct bfa_fcs_fdmi_hba_attr_s *hba_attr) | 2098 | struct bfa_fcs_fdmi_hba_attr_s *hba_attr) |
2109 | { | 2099 | { |
@@ -2147,7 +2137,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, | |||
2147 | hba_attr->max_ct_pyld = cpu_to_be32(FC_MAX_PDUSZ); | 2137 | hba_attr->max_ct_pyld = cpu_to_be32(FC_MAX_PDUSZ); |
2148 | } | 2138 | } |
2149 | 2139 | ||
2150 | void | 2140 | static void |
2151 | bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, | 2141 | bfa_fcs_fdmi_get_portattr(struct bfa_fcs_lport_fdmi_s *fdmi, |
2152 | struct bfa_fcs_fdmi_port_attr_s *port_attr) | 2142 | struct bfa_fcs_fdmi_port_attr_s *port_attr) |
2153 | { | 2143 | { |
@@ -2560,7 +2550,7 @@ bfa_fcs_lport_ms_send_gmal(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
2560 | 2550 | ||
2561 | len = fc_gmal_req_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), | 2551 | len = fc_gmal_req_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), |
2562 | bfa_fcs_lport_get_fcid(port), | 2552 | bfa_fcs_lport_get_fcid(port), |
2563 | bfa_lps_get_peer_nwwn(port->fabric->lps)); | 2553 | port->fabric->lps->pr_nwwn); |
2564 | 2554 | ||
2565 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, | 2555 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, |
2566 | FC_CLASS_3, len, &fchs, | 2556 | FC_CLASS_3, len, &fchs, |
@@ -2760,7 +2750,7 @@ bfa_fcs_lport_ms_send_gfn(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
2760 | 2750 | ||
2761 | len = fc_gfn_req_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), | 2751 | len = fc_gfn_req_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), |
2762 | bfa_fcs_lport_get_fcid(port), | 2752 | bfa_fcs_lport_get_fcid(port), |
2763 | bfa_lps_get_peer_nwwn(port->fabric->lps)); | 2753 | port->fabric->lps->pr_nwwn); |
2764 | 2754 | ||
2765 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, | 2755 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, |
2766 | FC_CLASS_3, len, &fchs, | 2756 | FC_CLASS_3, len, &fchs, |
@@ -2836,7 +2826,7 @@ bfa_fcs_lport_ms_send_plogi(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
2836 | ms->fcxp = fcxp; | 2826 | ms->fcxp = fcxp; |
2837 | 2827 | ||
2838 | len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), | 2828 | len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), |
2839 | bfa_os_hton3b(FC_MGMT_SERVER), | 2829 | bfa_hton3b(FC_MGMT_SERVER), |
2840 | bfa_fcs_lport_get_fcid(port), 0, | 2830 | bfa_fcs_lport_get_fcid(port), 0, |
2841 | port->port_cfg.pwwn, port->port_cfg.nwwn, | 2831 | port->port_cfg.pwwn, port->port_cfg.nwwn, |
2842 | bfa_fcport_get_maxfrsize(port->fcs->bfa)); | 2832 | bfa_fcport_get_maxfrsize(port->fcs->bfa)); |
@@ -3593,7 +3583,7 @@ fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs); | |||
3593 | ns->fcxp = fcxp; | 3583 | ns->fcxp = fcxp; |
3594 | 3584 | ||
3595 | len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), | 3585 | len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), |
3596 | bfa_os_hton3b(FC_NAME_SERVER), | 3586 | bfa_hton3b(FC_NAME_SERVER), |
3597 | bfa_fcs_lport_get_fcid(port), 0, | 3587 | bfa_fcs_lport_get_fcid(port), 0, |
3598 | port->port_cfg.pwwn, port->port_cfg.nwwn, | 3588 | port->port_cfg.pwwn, port->port_cfg.nwwn, |
3599 | bfa_fcport_get_maxfrsize(port->fcs->bfa)); | 3589 | bfa_fcport_get_maxfrsize(port->fcs->bfa)); |
@@ -4150,7 +4140,7 @@ bfa_fcs_lport_ns_query(struct bfa_fcs_lport_s *port) | |||
4150 | bfa_sm_send_event(ns, NSSM_EVENT_NS_QUERY); | 4140 | bfa_sm_send_event(ns, NSSM_EVENT_NS_QUERY); |
4151 | } | 4141 | } |
4152 | 4142 | ||
4153 | void | 4143 | static void |
4154 | bfa_fcs_lport_ns_boot_target_disc(bfa_fcs_lport_t *port) | 4144 | bfa_fcs_lport_ns_boot_target_disc(bfa_fcs_lport_t *port) |
4155 | { | 4145 | { |
4156 | 4146 | ||
@@ -4163,7 +4153,7 @@ bfa_fcs_lport_ns_boot_target_disc(bfa_fcs_lport_t *port) | |||
4163 | 4153 | ||
4164 | for (ii = 0 ; ii < nwwns; ++ii) { | 4154 | for (ii = 0 ; ii < nwwns; ++ii) { |
4165 | rport = bfa_fcs_rport_create_by_wwn(port, wwns[ii]); | 4155 | rport = bfa_fcs_rport_create_by_wwn(port, wwns[ii]); |
4166 | bfa_assert(rport); | 4156 | WARN_ON(!rport); |
4167 | } | 4157 | } |
4168 | } | 4158 | } |
4169 | 4159 | ||
@@ -4352,8 +4342,8 @@ bfa_fcs_lport_scn_send_scr(void *scn_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
4352 | /* Handle VU registrations for Base port only */ | 4342 | /* Handle VU registrations for Base port only */ |
4353 | if ((!port->vport) && bfa_ioc_get_fcmode(&port->fcs->bfa->ioc)) { | 4343 | if ((!port->vport) && bfa_ioc_get_fcmode(&port->fcs->bfa->ioc)) { |
4354 | len = fc_scr_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), | 4344 | len = fc_scr_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), |
4355 | bfa_lps_is_brcd_fabric(port->fabric->lps), | 4345 | port->fabric->lps->brcd_switch, |
4356 | port->pid, 0); | 4346 | port->pid, 0); |
4357 | } else { | 4347 | } else { |
4358 | len = fc_scr_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), | 4348 | len = fc_scr_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), |
4359 | BFA_FALSE, | 4349 | BFA_FALSE, |
@@ -4626,7 +4616,7 @@ bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port, | |||
4626 | 4616 | ||
4627 | 4617 | ||
4628 | default: | 4618 | default: |
4629 | bfa_assert(0); | 4619 | WARN_ON(1); |
4630 | nsquery = BFA_TRUE; | 4620 | nsquery = BFA_TRUE; |
4631 | } | 4621 | } |
4632 | } | 4622 | } |
@@ -4672,7 +4662,7 @@ bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn, int index, | |||
4672 | 4662 | ||
4673 | while ((qe != qh) && (i < nrports)) { | 4663 | while ((qe != qh) && (i < nrports)) { |
4674 | rport = (struct bfa_fcs_rport_s *) qe; | 4664 | rport = (struct bfa_fcs_rport_s *) qe; |
4675 | if (bfa_os_ntoh3b(rport->pid) > 0xFFF000) { | 4665 | if (bfa_ntoh3b(rport->pid) > 0xFFF000) { |
4676 | qe = bfa_q_next(qe); | 4666 | qe = bfa_q_next(qe); |
4677 | bfa_trc(fcs, (u32) rport->pwwn); | 4667 | bfa_trc(fcs, (u32) rport->pwwn); |
4678 | bfa_trc(fcs, rport->pid); | 4668 | bfa_trc(fcs, rport->pid); |
@@ -4720,7 +4710,7 @@ bfa_fcs_lport_get_rports(struct bfa_fcs_lport_s *port, | |||
4720 | 4710 | ||
4721 | while ((qe != qh) && (i < *nrports)) { | 4711 | while ((qe != qh) && (i < *nrports)) { |
4722 | rport = (struct bfa_fcs_rport_s *) qe; | 4712 | rport = (struct bfa_fcs_rport_s *) qe; |
4723 | if (bfa_os_ntoh3b(rport->pid) > 0xFFF000) { | 4713 | if (bfa_ntoh3b(rport->pid) > 0xFFF000) { |
4724 | qe = bfa_q_next(qe); | 4714 | qe = bfa_q_next(qe); |
4725 | bfa_trc(fcs, (u32) rport->pwwn); | 4715 | bfa_trc(fcs, (u32) rport->pwwn); |
4726 | bfa_trc(fcs, rport->pid); | 4716 | bfa_trc(fcs, rport->pid); |
@@ -4771,7 +4761,7 @@ bfa_fcs_lport_get_rport_max_speed(bfa_fcs_lport_t *port) | |||
4771 | 4761 | ||
4772 | while (qe != qh) { | 4762 | while (qe != qh) { |
4773 | rport = (struct bfa_fcs_rport_s *) qe; | 4763 | rport = (struct bfa_fcs_rport_s *) qe; |
4774 | if ((bfa_os_ntoh3b(rport->pid) > 0xFFF000) || | 4764 | if ((bfa_ntoh3b(rport->pid) > 0xFFF000) || |
4775 | (bfa_fcs_rport_get_state(rport) == | 4765 | (bfa_fcs_rport_get_state(rport) == |
4776 | BFA_RPORT_OFFLINE)) { | 4766 | BFA_RPORT_OFFLINE)) { |
4777 | qe = bfa_q_next(qe); | 4767 | qe = bfa_q_next(qe); |
@@ -4807,7 +4797,7 @@ bfa_fcs_lookup_port(struct bfa_fcs_s *fcs, u16 vf_id, wwn_t lpwwn) | |||
4807 | struct bfa_fcs_vport_s *vport; | 4797 | struct bfa_fcs_vport_s *vport; |
4808 | bfa_fcs_vf_t *vf; | 4798 | bfa_fcs_vf_t *vf; |
4809 | 4799 | ||
4810 | bfa_assert(fcs != NULL); | 4800 | WARN_ON(fcs == NULL); |
4811 | 4801 | ||
4812 | vf = bfa_fcs_vf_lookup(fcs, vf_id); | 4802 | vf = bfa_fcs_vf_lookup(fcs, vf_id); |
4813 | if (vf == NULL) { | 4803 | if (vf == NULL) { |
@@ -4853,7 +4843,7 @@ bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port, | |||
4853 | port_info->max_vports_supp = | 4843 | port_info->max_vports_supp = |
4854 | bfa_lps_get_max_vport(port->fcs->bfa); | 4844 | bfa_lps_get_max_vport(port->fcs->bfa); |
4855 | port_info->num_vports_inuse = | 4845 | port_info->num_vports_inuse = |
4856 | bfa_fcs_fabric_vport_count(port->fabric); | 4846 | port->fabric->num_vports; |
4857 | port_info->max_rports_supp = BFA_FCS_MAX_RPORTS_SUPP; | 4847 | port_info->max_rports_supp = BFA_FCS_MAX_RPORTS_SUPP; |
4858 | port_info->num_rports_inuse = port->num_rports; | 4848 | port_info->num_rports_inuse = port->num_rports; |
4859 | } else { | 4849 | } else { |
@@ -4997,7 +4987,8 @@ bfa_fcs_vport_sm_created(struct bfa_fcs_vport_s *vport, | |||
4997 | 4987 | ||
4998 | switch (event) { | 4988 | switch (event) { |
4999 | case BFA_FCS_VPORT_SM_START: | 4989 | case BFA_FCS_VPORT_SM_START: |
5000 | if (bfa_fcs_fabric_is_online(__vport_fabric(vport)) | 4990 | if (bfa_sm_cmp_state(__vport_fabric(vport), |
4991 | bfa_fcs_fabric_sm_online) | ||
5001 | && bfa_fcs_fabric_npiv_capable(__vport_fabric(vport))) { | 4992 | && bfa_fcs_fabric_npiv_capable(__vport_fabric(vport))) { |
5002 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_fdisc); | 4993 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_fdisc); |
5003 | bfa_fcs_vport_do_fdisc(vport); | 4994 | bfa_fcs_vport_do_fdisc(vport); |
@@ -5080,13 +5071,13 @@ bfa_fcs_vport_sm_fdisc(struct bfa_fcs_vport_s *vport, | |||
5080 | switch (event) { | 5071 | switch (event) { |
5081 | case BFA_FCS_VPORT_SM_DELETE: | 5072 | case BFA_FCS_VPORT_SM_DELETE: |
5082 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_cleanup); | 5073 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_cleanup); |
5083 | bfa_lps_discard(vport->lps); | 5074 | bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); |
5084 | bfa_fcs_lport_delete(&vport->lport); | 5075 | bfa_fcs_lport_delete(&vport->lport); |
5085 | break; | 5076 | break; |
5086 | 5077 | ||
5087 | case BFA_FCS_VPORT_SM_OFFLINE: | 5078 | case BFA_FCS_VPORT_SM_OFFLINE: |
5088 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_offline); | 5079 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_offline); |
5089 | bfa_lps_discard(vport->lps); | 5080 | bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); |
5090 | break; | 5081 | break; |
5091 | 5082 | ||
5092 | case BFA_FCS_VPORT_SM_RSP_OK: | 5083 | case BFA_FCS_VPORT_SM_RSP_OK: |
@@ -5166,7 +5157,7 @@ bfa_fcs_vport_sm_online(struct bfa_fcs_vport_s *vport, | |||
5166 | 5157 | ||
5167 | case BFA_FCS_VPORT_SM_OFFLINE: | 5158 | case BFA_FCS_VPORT_SM_OFFLINE: |
5168 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_offline); | 5159 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_offline); |
5169 | bfa_lps_discard(vport->lps); | 5160 | bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); |
5170 | bfa_fcs_lport_offline(&vport->lport); | 5161 | bfa_fcs_lport_offline(&vport->lport); |
5171 | break; | 5162 | break; |
5172 | 5163 | ||
@@ -5266,7 +5257,7 @@ bfa_fcs_vport_sm_logo(struct bfa_fcs_vport_s *vport, | |||
5266 | 5257 | ||
5267 | switch (event) { | 5258 | switch (event) { |
5268 | case BFA_FCS_VPORT_SM_OFFLINE: | 5259 | case BFA_FCS_VPORT_SM_OFFLINE: |
5269 | bfa_lps_discard(vport->lps); | 5260 | bfa_sm_send_event(vport->lps, BFA_LPS_SM_OFFLINE); |
5270 | /* | 5261 | /* |
5271 | * !!! fall through !!! | 5262 | * !!! fall through !!! |
5272 | */ | 5263 | */ |
@@ -5305,14 +5296,14 @@ bfa_fcs_vport_do_fdisc(struct bfa_fcs_vport_s *vport) | |||
5305 | static void | 5296 | static void |
5306 | bfa_fcs_vport_fdisc_rejected(struct bfa_fcs_vport_s *vport) | 5297 | bfa_fcs_vport_fdisc_rejected(struct bfa_fcs_vport_s *vport) |
5307 | { | 5298 | { |
5308 | u8 lsrjt_rsn = bfa_lps_get_lsrjt_rsn(vport->lps); | 5299 | u8 lsrjt_rsn = vport->lps->lsrjt_rsn; |
5309 | u8 lsrjt_expl = bfa_lps_get_lsrjt_expl(vport->lps); | 5300 | u8 lsrjt_expl = vport->lps->lsrjt_expl; |
5310 | 5301 | ||
5311 | bfa_trc(__vport_fcs(vport), lsrjt_rsn); | 5302 | bfa_trc(__vport_fcs(vport), lsrjt_rsn); |
5312 | bfa_trc(__vport_fcs(vport), lsrjt_expl); | 5303 | bfa_trc(__vport_fcs(vport), lsrjt_expl); |
5313 | 5304 | ||
5314 | /* For certain reason codes, we don't want to retry. */ | 5305 | /* For certain reason codes, we don't want to retry. */ |
5315 | switch (bfa_lps_get_lsrjt_expl(vport->lps)) { | 5306 | switch (vport->lps->lsrjt_expl) { |
5316 | case FC_LS_RJT_EXP_INV_PORT_NAME: /* by brocade */ | 5307 | case FC_LS_RJT_EXP_INV_PORT_NAME: /* by brocade */ |
5317 | case FC_LS_RJT_EXP_INVALID_NPORT_ID: /* by Cisco */ | 5308 | case FC_LS_RJT_EXP_INVALID_NPORT_ID: /* by Cisco */ |
5318 | if (vport->fdisc_retries < BFA_FCS_VPORT_MAX_RETRIES) | 5309 | if (vport->fdisc_retries < BFA_FCS_VPORT_MAX_RETRIES) |
@@ -5476,7 +5467,7 @@ bfa_fcs_vport_create(struct bfa_fcs_vport_s *vport, struct bfa_fcs_s *fcs, | |||
5476 | if (bfa_fcs_vport_lookup(fcs, vf_id, vport_cfg->pwwn) != NULL) | 5467 | if (bfa_fcs_vport_lookup(fcs, vf_id, vport_cfg->pwwn) != NULL) |
5477 | return BFA_STATUS_VPORT_EXISTS; | 5468 | return BFA_STATUS_VPORT_EXISTS; |
5478 | 5469 | ||
5479 | if (bfa_fcs_fabric_vport_count(&fcs->fabric) == | 5470 | if (fcs->fabric.num_vports == |
5480 | bfa_lps_get_max_vport(fcs->bfa)) | 5471 | bfa_lps_get_max_vport(fcs->bfa)) |
5481 | return BFA_STATUS_VPORT_MAX; | 5472 | return BFA_STATUS_VPORT_MAX; |
5482 | 5473 | ||
@@ -5618,33 +5609,6 @@ bfa_fcs_vport_get_attr(struct bfa_fcs_vport_s *vport, | |||
5618 | attr->vport_state = bfa_sm_to_state(vport_sm_table, vport->sm); | 5609 | attr->vport_state = bfa_sm_to_state(vport_sm_table, vport->sm); |
5619 | } | 5610 | } |
5620 | 5611 | ||
5621 | /* | ||
5622 | * Use this function to get vport's statistics. | ||
5623 | * | ||
5624 | * param[in] vport pointer to bfa_fcs_vport_t. | ||
5625 | * param[out] stats pointer to return vport statistics in | ||
5626 | * | ||
5627 | * return None | ||
5628 | */ | ||
5629 | void | ||
5630 | bfa_fcs_vport_get_stats(struct bfa_fcs_vport_s *vport, | ||
5631 | struct bfa_vport_stats_s *stats) | ||
5632 | { | ||
5633 | *stats = vport->vport_stats; | ||
5634 | } | ||
5635 | |||
5636 | /* | ||
5637 | * Use this function to clear vport's statistics. | ||
5638 | * | ||
5639 | * param[in] vport pointer to bfa_fcs_vport_t. | ||
5640 | * | ||
5641 | * return None | ||
5642 | */ | ||
5643 | void | ||
5644 | bfa_fcs_vport_clr_stats(struct bfa_fcs_vport_s *vport) | ||
5645 | { | ||
5646 | memset(&vport->vport_stats, 0, sizeof(struct bfa_vport_stats_s)); | ||
5647 | } | ||
5648 | 5612 | ||
5649 | /* | 5613 | /* |
5650 | * Lookup a virtual port. Excludes base port from lookup. | 5614 | * Lookup a virtual port. Excludes base port from lookup. |
@@ -5684,7 +5648,7 @@ bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status) | |||
5684 | /* | 5648 | /* |
5685 | * Initialiaze the V-Port fields | 5649 | * Initialiaze the V-Port fields |
5686 | */ | 5650 | */ |
5687 | __vport_fcid(vport) = bfa_lps_get_pid(vport->lps); | 5651 | __vport_fcid(vport) = vport->lps->lp_pid; |
5688 | vport->vport_stats.fdisc_accepts++; | 5652 | vport->vport_stats.fdisc_accepts++; |
5689 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_OK); | 5653 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_OK); |
5690 | break; | 5654 | break; |
@@ -5697,7 +5661,7 @@ bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status) | |||
5697 | break; | 5661 | break; |
5698 | 5662 | ||
5699 | case BFA_STATUS_EPROTOCOL: | 5663 | case BFA_STATUS_EPROTOCOL: |
5700 | switch (bfa_lps_get_extstatus(vport->lps)) { | 5664 | switch (vport->lps->ext_status) { |
5701 | case BFA_EPROTO_BAD_ACCEPT: | 5665 | case BFA_EPROTO_BAD_ACCEPT: |
5702 | vport->vport_stats.fdisc_acc_bad++; | 5666 | vport->vport_stats.fdisc_acc_bad++; |
5703 | break; | 5667 | break; |
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c index cf4a6e73e60..caaee6f0693 100644 --- a/drivers/scsi/bfa/bfa_fcs_rport.c +++ b/drivers/scsi/bfa/bfa_fcs_rport.c | |||
@@ -19,9 +19,9 @@ | |||
19 | * rport.c Remote port implementation. | 19 | * rport.c Remote port implementation. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "bfad_drv.h" | ||
22 | #include "bfa_fcs.h" | 23 | #include "bfa_fcs.h" |
23 | #include "bfa_fcbuild.h" | 24 | #include "bfa_fcbuild.h" |
24 | #include "bfad_drv.h" | ||
25 | 25 | ||
26 | BFA_TRC_FILE(FCS, RPORT); | 26 | BFA_TRC_FILE(FCS, RPORT); |
27 | 27 | ||
@@ -75,30 +75,6 @@ static void bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport, | |||
75 | static void bfa_fcs_rport_process_adisc(struct bfa_fcs_rport_s *rport, | 75 | static void bfa_fcs_rport_process_adisc(struct bfa_fcs_rport_s *rport, |
76 | struct fchs_s *rx_fchs, u16 len); | 76 | struct fchs_s *rx_fchs, u16 len); |
77 | static void bfa_fcs_rport_send_prlo_acc(struct bfa_fcs_rport_s *rport); | 77 | static void bfa_fcs_rport_send_prlo_acc(struct bfa_fcs_rport_s *rport); |
78 | /* | ||
79 | * fcs_rport_sm FCS rport state machine events | ||
80 | */ | ||
81 | |||
82 | enum rport_event { | ||
83 | RPSM_EVENT_PLOGI_SEND = 1, /* new rport; start with PLOGI */ | ||
84 | RPSM_EVENT_PLOGI_RCVD = 2, /* Inbound PLOGI from remote port */ | ||
85 | RPSM_EVENT_PLOGI_COMP = 3, /* PLOGI completed to rport */ | ||
86 | RPSM_EVENT_LOGO_RCVD = 4, /* LOGO from remote device */ | ||
87 | RPSM_EVENT_LOGO_IMP = 5, /* implicit logo for SLER */ | ||
88 | RPSM_EVENT_FCXP_SENT = 6, /* Frame from has been sent */ | ||
89 | RPSM_EVENT_DELETE = 7, /* RPORT delete request */ | ||
90 | RPSM_EVENT_SCN = 8, /* state change notification */ | ||
91 | RPSM_EVENT_ACCEPTED = 9, /* Good response from remote device */ | ||
92 | RPSM_EVENT_FAILED = 10, /* Request to rport failed. */ | ||
93 | RPSM_EVENT_TIMEOUT = 11, /* Rport SM timeout event */ | ||
94 | RPSM_EVENT_HCB_ONLINE = 12, /* BFA rport online callback */ | ||
95 | RPSM_EVENT_HCB_OFFLINE = 13, /* BFA rport offline callback */ | ||
96 | RPSM_EVENT_FC4_OFFLINE = 14, /* FC-4 offline complete */ | ||
97 | RPSM_EVENT_ADDRESS_CHANGE = 15, /* Rport's PID has changed */ | ||
98 | RPSM_EVENT_ADDRESS_DISC = 16, /* Need to Discover rport's PID */ | ||
99 | RPSM_EVENT_PRLO_RCVD = 17, /* PRLO from remote device */ | ||
100 | RPSM_EVENT_PLOGI_RETRY = 18, /* Retry PLOGI continously */ | ||
101 | }; | ||
102 | 78 | ||
103 | static void bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport, | 79 | static void bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport, |
104 | enum rport_event event); | 80 | enum rport_event event); |
@@ -498,24 +474,24 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport, | |||
498 | 474 | ||
499 | case RPSM_EVENT_LOGO_RCVD: | 475 | case RPSM_EVENT_LOGO_RCVD: |
500 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv); | 476 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv); |
501 | bfa_rport_offline(rport->bfa_rport); | 477 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); |
502 | break; | 478 | break; |
503 | 479 | ||
504 | case RPSM_EVENT_LOGO_IMP: | 480 | case RPSM_EVENT_LOGO_IMP: |
505 | case RPSM_EVENT_ADDRESS_CHANGE: | 481 | case RPSM_EVENT_ADDRESS_CHANGE: |
506 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); | 482 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); |
507 | bfa_rport_offline(rport->bfa_rport); | 483 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); |
508 | break; | 484 | break; |
509 | 485 | ||
510 | case RPSM_EVENT_PLOGI_RCVD: | 486 | case RPSM_EVENT_PLOGI_RCVD: |
511 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending); | 487 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending); |
512 | bfa_rport_offline(rport->bfa_rport); | 488 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); |
513 | bfa_fcs_rport_send_plogiacc(rport, NULL); | 489 | bfa_fcs_rport_send_plogiacc(rport, NULL); |
514 | break; | 490 | break; |
515 | 491 | ||
516 | case RPSM_EVENT_DELETE: | 492 | case RPSM_EVENT_DELETE: |
517 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend); | 493 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend); |
518 | bfa_rport_offline(rport->bfa_rport); | 494 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); |
519 | break; | 495 | break; |
520 | 496 | ||
521 | case RPSM_EVENT_SCN: | 497 | case RPSM_EVENT_SCN: |
@@ -824,7 +800,7 @@ bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport, | |||
824 | switch (event) { | 800 | switch (event) { |
825 | case RPSM_EVENT_FC4_OFFLINE: | 801 | case RPSM_EVENT_FC4_OFFLINE: |
826 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv); | 802 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv); |
827 | bfa_rport_offline(rport->bfa_rport); | 803 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); |
828 | break; | 804 | break; |
829 | 805 | ||
830 | case RPSM_EVENT_DELETE: | 806 | case RPSM_EVENT_DELETE: |
@@ -856,7 +832,7 @@ bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport, | |||
856 | switch (event) { | 832 | switch (event) { |
857 | case RPSM_EVENT_FC4_OFFLINE: | 833 | case RPSM_EVENT_FC4_OFFLINE: |
858 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend); | 834 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend); |
859 | bfa_rport_offline(rport->bfa_rport); | 835 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); |
860 | break; | 836 | break; |
861 | 837 | ||
862 | default: | 838 | default: |
@@ -878,7 +854,7 @@ bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport, | |||
878 | switch (event) { | 854 | switch (event) { |
879 | case RPSM_EVENT_FC4_OFFLINE: | 855 | case RPSM_EVENT_FC4_OFFLINE: |
880 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); | 856 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); |
881 | bfa_rport_offline(rport->bfa_rport); | 857 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); |
882 | break; | 858 | break; |
883 | 859 | ||
884 | case RPSM_EVENT_SCN: | 860 | case RPSM_EVENT_SCN: |
@@ -1459,7 +1435,7 @@ bfa_fcs_rport_plogi_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg, | |||
1459 | twin->stats.plogi_rcvd += rport->stats.plogi_rcvd; | 1435 | twin->stats.plogi_rcvd += rport->stats.plogi_rcvd; |
1460 | twin->stats.plogi_accs++; | 1436 | twin->stats.plogi_accs++; |
1461 | 1437 | ||
1462 | bfa_fcs_rport_delete(rport); | 1438 | bfa_sm_send_event(rport, RPSM_EVENT_DELETE); |
1463 | 1439 | ||
1464 | bfa_fcs_rport_update(twin, plogi_rsp); | 1440 | bfa_fcs_rport_update(twin, plogi_rsp); |
1465 | twin->pid = rsp_fchs->s_id; | 1441 | twin->pid = rsp_fchs->s_id; |
@@ -1992,13 +1968,14 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid) | |||
1992 | /* | 1968 | /* |
1993 | * allocate FC-4s | 1969 | * allocate FC-4s |
1994 | */ | 1970 | */ |
1995 | bfa_assert(bfa_fcs_lport_is_initiator(port)); | 1971 | WARN_ON(!bfa_fcs_lport_is_initiator(port)); |
1996 | 1972 | ||
1997 | if (bfa_fcs_lport_is_initiator(port)) { | 1973 | if (bfa_fcs_lport_is_initiator(port)) { |
1998 | rport->itnim = bfa_fcs_itnim_create(rport); | 1974 | rport->itnim = bfa_fcs_itnim_create(rport); |
1999 | if (!rport->itnim) { | 1975 | if (!rport->itnim) { |
2000 | bfa_trc(fcs, rpid); | 1976 | bfa_trc(fcs, rpid); |
2001 | bfa_rport_delete(rport->bfa_rport); | 1977 | bfa_sm_send_event(rport->bfa_rport, |
1978 | BFA_RPORT_SM_DELETE); | ||
2002 | kfree(rport_drv); | 1979 | kfree(rport_drv); |
2003 | return NULL; | 1980 | return NULL; |
2004 | } | 1981 | } |
@@ -2032,7 +2009,7 @@ bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport) | |||
2032 | bfa_fcs_rpf_rport_offline(rport); | 2009 | bfa_fcs_rpf_rport_offline(rport); |
2033 | } | 2010 | } |
2034 | 2011 | ||
2035 | bfa_rport_delete(rport->bfa_rport); | 2012 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_DELETE); |
2036 | bfa_fcs_lport_del_rport(port, rport); | 2013 | bfa_fcs_lport_del_rport(port, rport); |
2037 | kfree(rport->rp_drv); | 2014 | kfree(rport->rp_drv); |
2038 | } | 2015 | } |
@@ -2307,40 +2284,8 @@ bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs, | |||
2307 | bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_RCVD); | 2284 | bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_RCVD); |
2308 | } | 2285 | } |
2309 | 2286 | ||
2310 | /* | ||
2311 | * Called by bport/vport to delete a remote port instance. | ||
2312 | * | ||
2313 | * Rport delete is called under the following conditions: | ||
2314 | * - vport is deleted | ||
2315 | * - vf is deleted | ||
2316 | * - explicit request from OS to delete rport | ||
2317 | */ | ||
2318 | void | ||
2319 | bfa_fcs_rport_delete(struct bfa_fcs_rport_s *rport) | ||
2320 | { | ||
2321 | bfa_sm_send_event(rport, RPSM_EVENT_DELETE); | ||
2322 | } | ||
2323 | 2287 | ||
2324 | /* | 2288 | /* |
2325 | * Called by bport/vport to when a target goes offline. | ||
2326 | * | ||
2327 | */ | ||
2328 | void | ||
2329 | bfa_fcs_rport_offline(struct bfa_fcs_rport_s *rport) | ||
2330 | { | ||
2331 | bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP); | ||
2332 | } | ||
2333 | |||
2334 | /* | ||
2335 | * Called by bport in n2n when a target (attached port) becomes online. | ||
2336 | * | ||
2337 | */ | ||
2338 | void | ||
2339 | bfa_fcs_rport_online(struct bfa_fcs_rport_s *rport) | ||
2340 | { | ||
2341 | bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_SEND); | ||
2342 | } | ||
2343 | /* | ||
2344 | * Called by bport/vport to notify SCN for the remote port | 2289 | * Called by bport/vport to notify SCN for the remote port |
2345 | */ | 2290 | */ |
2346 | void | 2291 | void |
@@ -2350,23 +2295,6 @@ bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport) | |||
2350 | bfa_sm_send_event(rport, RPSM_EVENT_SCN); | 2295 | bfa_sm_send_event(rport, RPSM_EVENT_SCN); |
2351 | } | 2296 | } |
2352 | 2297 | ||
2353 | /* | ||
2354 | * Called by fcpim to notify that the ITN cleanup is done. | ||
2355 | */ | ||
2356 | void | ||
2357 | bfa_fcs_rport_itnim_ack(struct bfa_fcs_rport_s *rport) | ||
2358 | { | ||
2359 | bfa_sm_send_event(rport, RPSM_EVENT_FC4_OFFLINE); | ||
2360 | } | ||
2361 | |||
2362 | /* | ||
2363 | * Called by fcptm to notify that the ITN cleanup is done. | ||
2364 | */ | ||
2365 | void | ||
2366 | bfa_fcs_rport_tin_ack(struct bfa_fcs_rport_s *rport) | ||
2367 | { | ||
2368 | bfa_sm_send_event(rport, RPSM_EVENT_FC4_OFFLINE); | ||
2369 | } | ||
2370 | 2298 | ||
2371 | /* | 2299 | /* |
2372 | * brief | 2300 | * brief |
@@ -2465,15 +2393,6 @@ bfa_cb_rport_qos_scn_prio(void *cbarg, | |||
2465 | * Called to process any unsolicted frames from this remote port | 2393 | * Called to process any unsolicted frames from this remote port |
2466 | */ | 2394 | */ |
2467 | void | 2395 | void |
2468 | bfa_fcs_rport_logo_imp(struct bfa_fcs_rport_s *rport) | ||
2469 | { | ||
2470 | bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP); | ||
2471 | } | ||
2472 | |||
2473 | /* | ||
2474 | * Called to process any unsolicted frames from this remote port | ||
2475 | */ | ||
2476 | void | ||
2477 | bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport, | 2396 | bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport, |
2478 | struct fchs_s *fchs, u16 len) | 2397 | struct fchs_s *fchs, u16 len) |
2479 | { | 2398 | { |
@@ -2586,6 +2505,7 @@ bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport) | |||
2586 | return bfa_sm_to_state(rport_sm_table, rport->sm); | 2505 | return bfa_sm_to_state(rport_sm_table, rport->sm); |
2587 | } | 2506 | } |
2588 | 2507 | ||
2508 | |||
2589 | /* | 2509 | /* |
2590 | * brief | 2510 | * brief |
2591 | * Called by the Driver to set rport delete/ageout timeout | 2511 | * Called by the Driver to set rport delete/ageout timeout |
@@ -2602,7 +2522,7 @@ bfa_fcs_rport_set_del_timeout(u8 rport_tmo) | |||
2602 | bfa_fcs_rport_del_timeout = rport_tmo * 1000; | 2522 | bfa_fcs_rport_del_timeout = rport_tmo * 1000; |
2603 | } | 2523 | } |
2604 | void | 2524 | void |
2605 | bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, u16 ox_id) | 2525 | bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id) |
2606 | { | 2526 | { |
2607 | bfa_trc(rport->fcs, rport->pid); | 2527 | bfa_trc(rport->fcs, rport->pid); |
2608 | 2528 | ||
@@ -2621,106 +2541,6 @@ bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, u16 ox_id) | |||
2621 | * fcs_rport_api FCS rport API. | 2541 | * fcs_rport_api FCS rport API. |
2622 | */ | 2542 | */ |
2623 | 2543 | ||
2624 | /* | ||
2625 | * Direct API to add a target by port wwn. This interface is used, for | ||
2626 | * example, by bios when target pwwn is known from boot lun configuration. | ||
2627 | */ | ||
2628 | bfa_status_t | ||
2629 | bfa_fcs_rport_add(struct bfa_fcs_lport_s *port, wwn_t *pwwn, | ||
2630 | struct bfa_fcs_rport_s *rport, struct bfad_rport_s *rport_drv) | ||
2631 | { | ||
2632 | bfa_trc(port->fcs, *pwwn); | ||
2633 | |||
2634 | return BFA_STATUS_OK; | ||
2635 | } | ||
2636 | |||
2637 | /* | ||
2638 | * Direct API to remove a target and its associated resources. This | ||
2639 | * interface is used, for example, by driver to remove target | ||
2640 | * ports from the target list for a VM. | ||
2641 | */ | ||
2642 | bfa_status_t | ||
2643 | bfa_fcs_rport_remove(struct bfa_fcs_rport_s *rport_in) | ||
2644 | { | ||
2645 | |||
2646 | struct bfa_fcs_rport_s *rport; | ||
2647 | |||
2648 | bfa_trc(rport_in->fcs, rport_in->pwwn); | ||
2649 | |||
2650 | rport = bfa_fcs_lport_get_rport_by_pwwn(rport_in->port, rport_in->pwwn); | ||
2651 | if (rport == NULL) { | ||
2652 | /* | ||
2653 | * TBD Error handling | ||
2654 | */ | ||
2655 | bfa_trc(rport_in->fcs, rport_in->pid); | ||
2656 | return BFA_STATUS_UNKNOWN_RWWN; | ||
2657 | } | ||
2658 | |||
2659 | /* | ||
2660 | * TBD if this remote port is online, send a logo | ||
2661 | */ | ||
2662 | return BFA_STATUS_OK; | ||
2663 | |||
2664 | } | ||
2665 | |||
2666 | /* | ||
2667 | * Remote device status for display/debug. | ||
2668 | */ | ||
2669 | void | ||
2670 | bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport, | ||
2671 | struct bfa_rport_attr_s *rport_attr) | ||
2672 | { | ||
2673 | struct bfa_rport_qos_attr_s qos_attr; | ||
2674 | bfa_fcs_lport_t *port = rport->port; | ||
2675 | bfa_port_speed_t rport_speed = rport->rpf.rpsc_speed; | ||
2676 | |||
2677 | memset(rport_attr, 0, sizeof(struct bfa_rport_attr_s)); | ||
2678 | |||
2679 | rport_attr->pid = rport->pid; | ||
2680 | rport_attr->pwwn = rport->pwwn; | ||
2681 | rport_attr->nwwn = rport->nwwn; | ||
2682 | rport_attr->cos_supported = rport->fc_cos; | ||
2683 | rport_attr->df_sz = rport->maxfrsize; | ||
2684 | rport_attr->state = bfa_fcs_rport_get_state(rport); | ||
2685 | rport_attr->fc_cos = rport->fc_cos; | ||
2686 | rport_attr->cisc = rport->cisc; | ||
2687 | rport_attr->scsi_function = rport->scsi_function; | ||
2688 | rport_attr->curr_speed = rport->rpf.rpsc_speed; | ||
2689 | rport_attr->assigned_speed = rport->rpf.assigned_speed; | ||
2690 | |||
2691 | bfa_rport_get_qos_attr(rport->bfa_rport, &qos_attr); | ||
2692 | rport_attr->qos_attr = qos_attr; | ||
2693 | |||
2694 | rport_attr->trl_enforced = BFA_FALSE; | ||
2695 | if (bfa_fcport_is_ratelim(port->fcs->bfa)) { | ||
2696 | if (rport_speed == BFA_PORT_SPEED_UNKNOWN) { | ||
2697 | /* Use default ratelim speed setting */ | ||
2698 | rport_speed = | ||
2699 | bfa_fcport_get_ratelim_speed(rport->fcs->bfa); | ||
2700 | } | ||
2701 | |||
2702 | if (rport_speed < bfa_fcs_lport_get_rport_max_speed(port)) | ||
2703 | rport_attr->trl_enforced = BFA_TRUE; | ||
2704 | } | ||
2705 | } | ||
2706 | |||
2707 | /* | ||
2708 | * Per remote device statistics. | ||
2709 | */ | ||
2710 | void | ||
2711 | bfa_fcs_rport_get_stats(struct bfa_fcs_rport_s *rport, | ||
2712 | struct bfa_rport_stats_s *stats) | ||
2713 | { | ||
2714 | *stats = rport->stats; | ||
2715 | } | ||
2716 | |||
2717 | void | ||
2718 | bfa_fcs_rport_clear_stats(struct bfa_fcs_rport_s *rport) | ||
2719 | { | ||
2720 | memset((char *)&rport->stats, 0, | ||
2721 | sizeof(struct bfa_rport_stats_s)); | ||
2722 | } | ||
2723 | |||
2724 | struct bfa_fcs_rport_s * | 2544 | struct bfa_fcs_rport_s * |
2725 | bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port, wwn_t rpwwn) | 2545 | bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port, wwn_t rpwwn) |
2726 | { | 2546 | { |
@@ -2752,22 +2572,6 @@ bfa_fcs_rport_lookup_by_nwwn(struct bfa_fcs_lport_s *port, wwn_t rnwwn) | |||
2752 | } | 2572 | } |
2753 | 2573 | ||
2754 | /* | 2574 | /* |
2755 | * This API is to set the Rport's speed. Should be used when RPSC is not | ||
2756 | * supported by the rport. | ||
2757 | */ | ||
2758 | void | ||
2759 | bfa_fcs_rport_set_speed(struct bfa_fcs_rport_s *rport, bfa_port_speed_t speed) | ||
2760 | { | ||
2761 | rport->rpf.assigned_speed = speed; | ||
2762 | |||
2763 | /* Set this speed in f/w only if the RPSC speed is not available */ | ||
2764 | if (rport->rpf.rpsc_speed == BFA_PORT_SPEED_UNKNOWN) | ||
2765 | bfa_rport_speed(rport->bfa_rport, speed); | ||
2766 | } | ||
2767 | |||
2768 | |||
2769 | |||
2770 | /* | ||
2771 | * Remote port features (RPF) implementation. | 2575 | * Remote port features (RPF) implementation. |
2772 | */ | 2576 | */ |
2773 | 2577 | ||
@@ -2827,7 +2631,7 @@ bfa_fcs_rpf_sm_uninit(struct bfa_fcs_rpf_s *rpf, enum rpf_event event) | |||
2827 | case RPFSM_EVENT_RPORT_ONLINE: | 2631 | case RPFSM_EVENT_RPORT_ONLINE: |
2828 | /* Send RPSC2 to a Brocade fabric only. */ | 2632 | /* Send RPSC2 to a Brocade fabric only. */ |
2829 | if ((!BFA_FCS_PID_IS_WKA(rport->pid)) && | 2633 | if ((!BFA_FCS_PID_IS_WKA(rport->pid)) && |
2830 | ((bfa_lps_is_brcd_fabric(rport->port->fabric->lps)) || | 2634 | ((rport->port->fabric->lps->brcd_switch) || |
2831 | (bfa_fcs_fabric_get_switch_oui(fabric) == | 2635 | (bfa_fcs_fabric_get_switch_oui(fabric) == |
2832 | BFA_FCS_BRCD_SWITCH_OUI))) { | 2636 | BFA_FCS_BRCD_SWITCH_OUI))) { |
2833 | bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc_sending); | 2637 | bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc_sending); |
@@ -3093,7 +2897,7 @@ bfa_fcs_rpf_rpsc2_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg, | |||
3093 | num_ents = be16_to_cpu(rpsc2_acc->num_pids); | 2897 | num_ents = be16_to_cpu(rpsc2_acc->num_pids); |
3094 | bfa_trc(rport->fcs, num_ents); | 2898 | bfa_trc(rport->fcs, num_ents); |
3095 | if (num_ents > 0) { | 2899 | if (num_ents > 0) { |
3096 | bfa_assert(rpsc2_acc->port_info[0].pid != rport->pid); | 2900 | WARN_ON(rpsc2_acc->port_info[0].pid == rport->pid); |
3097 | bfa_trc(rport->fcs, | 2901 | bfa_trc(rport->fcs, |
3098 | be16_to_cpu(rpsc2_acc->port_info[0].pid)); | 2902 | be16_to_cpu(rpsc2_acc->port_info[0].pid)); |
3099 | bfa_trc(rport->fcs, | 2903 | bfa_trc(rport->fcs, |
diff --git a/drivers/scsi/bfa/bfa_hw_cb.c b/drivers/scsi/bfa/bfa_hw_cb.c index d8464ae6007..977e681ec80 100644 --- a/drivers/scsi/bfa/bfa_hw_cb.c +++ b/drivers/scsi/bfa/bfa_hw_cb.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | ||
18 | #include "bfa_modules.h" | 19 | #include "bfa_modules.h" |
19 | #include "bfi_cbreg.h" | 20 | #include "bfi_cbreg.h" |
20 | 21 | ||
@@ -110,7 +111,7 @@ bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs) | |||
110 | { | 111 | { |
111 | int i; | 112 | int i; |
112 | 113 | ||
113 | bfa_assert((nvecs == 1) || (nvecs == __HFN_NUMINTS)); | 114 | WARN_ON((nvecs != 1) && (nvecs != __HFN_NUMINTS)); |
114 | 115 | ||
115 | bfa->msix.nvecs = nvecs; | 116 | bfa->msix.nvecs = nvecs; |
116 | if (nvecs == 1) { | 117 | if (nvecs == 1) { |
diff --git a/drivers/scsi/bfa/bfa_hw_ct.c b/drivers/scsi/bfa/bfa_hw_ct.c index b0efbc713ff..21018d98a07 100644 --- a/drivers/scsi/bfa/bfa_hw_ct.c +++ b/drivers/scsi/bfa/bfa_hw_ct.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | ||
18 | #include "bfa_modules.h" | 19 | #include "bfa_modules.h" |
19 | #include "bfi_ctreg.h" | 20 | #include "bfi_ctreg.h" |
20 | 21 | ||
@@ -116,7 +117,7 @@ bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *msix_vecs_bmap, | |||
116 | void | 117 | void |
117 | bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs) | 118 | bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs) |
118 | { | 119 | { |
119 | bfa_assert((nvecs == 1) || (nvecs == BFA_MSIX_CT_MAX)); | 120 | WARN_ON((nvecs != 1) && (nvecs != BFA_MSIX_CT_MAX)); |
120 | bfa_trc(bfa, nvecs); | 121 | bfa_trc(bfa, nvecs); |
121 | 122 | ||
122 | bfa->msix.nvecs = nvecs; | 123 | bfa->msix.nvecs = nvecs; |
@@ -143,7 +144,7 @@ bfa_hwct_msix_install(struct bfa_s *bfa) | |||
143 | for (; i <= BFA_MSIX_RME_Q3; i++) | 144 | for (; i <= BFA_MSIX_RME_Q3; i++) |
144 | bfa->msix.handler[i] = bfa_msix_rspq; | 145 | bfa->msix.handler[i] = bfa_msix_rspq; |
145 | 146 | ||
146 | bfa_assert(i == BFA_MSIX_LPU_ERR); | 147 | WARN_ON(i != BFA_MSIX_LPU_ERR); |
147 | bfa->msix.handler[BFA_MSIX_LPU_ERR] = bfa_msix_lpu_err; | 148 | bfa->msix.handler[BFA_MSIX_LPU_ERR] = bfa_msix_lpu_err; |
148 | } | 149 | } |
149 | 150 | ||
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 9f4aa391ea9..c1f72c49196 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c | |||
@@ -15,11 +15,11 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | ||
18 | #include "bfa_ioc.h" | 19 | #include "bfa_ioc.h" |
19 | #include "bfi_ctreg.h" | 20 | #include "bfi_ctreg.h" |
20 | #include "bfa_defs.h" | 21 | #include "bfa_defs.h" |
21 | #include "bfa_defs_svc.h" | 22 | #include "bfa_defs_svc.h" |
22 | #include "bfad_drv.h" | ||
23 | 23 | ||
24 | BFA_TRC_FILE(CNA, IOC); | 24 | BFA_TRC_FILE(CNA, IOC); |
25 | 25 | ||
@@ -29,7 +29,7 @@ BFA_TRC_FILE(CNA, IOC); | |||
29 | #define BFA_IOC_TOV 3000 /* msecs */ | 29 | #define BFA_IOC_TOV 3000 /* msecs */ |
30 | #define BFA_IOC_HWSEM_TOV 500 /* msecs */ | 30 | #define BFA_IOC_HWSEM_TOV 500 /* msecs */ |
31 | #define BFA_IOC_HB_TOV 500 /* msecs */ | 31 | #define BFA_IOC_HB_TOV 500 /* msecs */ |
32 | #define BFA_IOC_HWINIT_MAX 2 | 32 | #define BFA_IOC_HWINIT_MAX 5 |
33 | #define BFA_IOC_TOV_RECOVER BFA_IOC_HB_TOV | 33 | #define BFA_IOC_TOV_RECOVER BFA_IOC_HB_TOV |
34 | 34 | ||
35 | #define bfa_ioc_timer_start(__ioc) \ | 35 | #define bfa_ioc_timer_start(__ioc) \ |
@@ -42,11 +42,6 @@ BFA_TRC_FILE(CNA, IOC); | |||
42 | bfa_ioc_hb_check, (__ioc), BFA_IOC_HB_TOV) | 42 | bfa_ioc_hb_check, (__ioc), BFA_IOC_HB_TOV) |
43 | #define bfa_hb_timer_stop(__ioc) bfa_timer_stop(&(__ioc)->hb_timer) | 43 | #define bfa_hb_timer_stop(__ioc) bfa_timer_stop(&(__ioc)->hb_timer) |
44 | 44 | ||
45 | #define BFA_DBG_FWTRC_ENTS (BFI_IOC_TRC_ENTS) | ||
46 | #define BFA_DBG_FWTRC_LEN \ | ||
47 | (BFA_DBG_FWTRC_ENTS * sizeof(struct bfa_trc_s) + \ | ||
48 | (sizeof(struct bfa_trc_mod_s) - \ | ||
49 | BFA_TRC_MAX * sizeof(struct bfa_trc_s))) | ||
50 | #define BFA_DBG_FWTRC_OFF(_fn) (BFI_IOC_TRC_OFF + BFA_DBG_FWTRC_LEN * (_fn)) | 45 | #define BFA_DBG_FWTRC_OFF(_fn) (BFI_IOC_TRC_OFF + BFA_DBG_FWTRC_LEN * (_fn)) |
51 | 46 | ||
52 | /* | 47 | /* |
@@ -59,17 +54,16 @@ BFA_TRC_FILE(CNA, IOC); | |||
59 | ((__ioc)->ioc_hwif->ioc_firmware_unlock(__ioc)) | 54 | ((__ioc)->ioc_hwif->ioc_firmware_unlock(__ioc)) |
60 | #define bfa_ioc_reg_init(__ioc) ((__ioc)->ioc_hwif->ioc_reg_init(__ioc)) | 55 | #define bfa_ioc_reg_init(__ioc) ((__ioc)->ioc_hwif->ioc_reg_init(__ioc)) |
61 | #define bfa_ioc_map_port(__ioc) ((__ioc)->ioc_hwif->ioc_map_port(__ioc)) | 56 | #define bfa_ioc_map_port(__ioc) ((__ioc)->ioc_hwif->ioc_map_port(__ioc)) |
62 | #define bfa_ioc_notify_hbfail(__ioc) \ | 57 | #define bfa_ioc_notify_fail(__ioc) \ |
63 | ((__ioc)->ioc_hwif->ioc_notify_hbfail(__ioc)) | 58 | ((__ioc)->ioc_hwif->ioc_notify_fail(__ioc)) |
64 | 59 | #define bfa_ioc_sync_join(__ioc) \ | |
65 | #ifdef BFA_IOC_IS_UEFI | 60 | ((__ioc)->ioc_hwif->ioc_sync_join(__ioc)) |
66 | #define bfa_ioc_is_bios_optrom(__ioc) (0) | 61 | #define bfa_ioc_sync_leave(__ioc) \ |
67 | #define bfa_ioc_is_uefi(__ioc) BFA_IOC_IS_UEFI | 62 | ((__ioc)->ioc_hwif->ioc_sync_leave(__ioc)) |
68 | #else | 63 | #define bfa_ioc_sync_ack(__ioc) \ |
69 | #define bfa_ioc_is_bios_optrom(__ioc) \ | 64 | ((__ioc)->ioc_hwif->ioc_sync_ack(__ioc)) |
70 | (bfa_cb_image_get_size(BFA_IOC_FWIMG_TYPE(__ioc)) < BFA_IOC_FWIMG_MINSZ) | 65 | #define bfa_ioc_sync_complete(__ioc) \ |
71 | #define bfa_ioc_is_uefi(__ioc) (0) | 66 | ((__ioc)->ioc_hwif->ioc_sync_complete(__ioc)) |
72 | #endif | ||
73 | 67 | ||
74 | #define bfa_ioc_mbox_cmd_pending(__ioc) \ | 68 | #define bfa_ioc_mbox_cmd_pending(__ioc) \ |
75 | (!list_empty(&((__ioc)->mbox_mod.cmd_q)) || \ | 69 | (!list_empty(&((__ioc)->mbox_mod.cmd_q)) || \ |
@@ -81,29 +75,22 @@ bfa_boolean_t bfa_auto_recover = BFA_TRUE; | |||
81 | * forward declarations | 75 | * forward declarations |
82 | */ | 76 | */ |
83 | static void bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc); | 77 | static void bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc); |
84 | static void bfa_ioc_hw_sem_get_cancel(struct bfa_ioc_s *ioc); | ||
85 | static void bfa_ioc_hwinit(struct bfa_ioc_s *ioc, bfa_boolean_t force); | 78 | static void bfa_ioc_hwinit(struct bfa_ioc_s *ioc, bfa_boolean_t force); |
86 | static void bfa_ioc_timeout(void *ioc); | 79 | static void bfa_ioc_timeout(void *ioc); |
87 | static void bfa_ioc_send_enable(struct bfa_ioc_s *ioc); | 80 | static void bfa_ioc_send_enable(struct bfa_ioc_s *ioc); |
88 | static void bfa_ioc_send_disable(struct bfa_ioc_s *ioc); | 81 | static void bfa_ioc_send_disable(struct bfa_ioc_s *ioc); |
89 | static void bfa_ioc_send_getattr(struct bfa_ioc_s *ioc); | 82 | static void bfa_ioc_send_getattr(struct bfa_ioc_s *ioc); |
90 | static void bfa_ioc_hb_monitor(struct bfa_ioc_s *ioc); | 83 | static void bfa_ioc_hb_monitor(struct bfa_ioc_s *ioc); |
91 | static void bfa_ioc_hb_stop(struct bfa_ioc_s *ioc); | ||
92 | static void bfa_ioc_reset(struct bfa_ioc_s *ioc, bfa_boolean_t force); | ||
93 | static void bfa_ioc_mbox_poll(struct bfa_ioc_s *ioc); | 84 | static void bfa_ioc_mbox_poll(struct bfa_ioc_s *ioc); |
94 | static void bfa_ioc_mbox_hbfail(struct bfa_ioc_s *ioc); | 85 | static void bfa_ioc_mbox_hbfail(struct bfa_ioc_s *ioc); |
95 | static void bfa_ioc_recover(struct bfa_ioc_s *ioc); | 86 | static void bfa_ioc_recover(struct bfa_ioc_s *ioc); |
96 | static void bfa_ioc_check_attr_wwns(struct bfa_ioc_s *ioc); | 87 | static void bfa_ioc_check_attr_wwns(struct bfa_ioc_s *ioc); |
97 | static void bfa_ioc_disable_comp(struct bfa_ioc_s *ioc); | 88 | static void bfa_ioc_disable_comp(struct bfa_ioc_s *ioc); |
98 | static void bfa_ioc_lpu_stop(struct bfa_ioc_s *ioc); | 89 | static void bfa_ioc_lpu_stop(struct bfa_ioc_s *ioc); |
99 | static void bfa_ioc_pf_enabled(struct bfa_ioc_s *ioc); | 90 | static void bfa_ioc_debug_save_ftrc(struct bfa_ioc_s *ioc); |
100 | static void bfa_ioc_pf_disabled(struct bfa_ioc_s *ioc); | 91 | static void bfa_ioc_fail_notify(struct bfa_ioc_s *ioc); |
101 | static void bfa_ioc_pf_failed(struct bfa_ioc_s *ioc); | ||
102 | static void bfa_ioc_pf_fwmismatch(struct bfa_ioc_s *ioc); | 92 | static void bfa_ioc_pf_fwmismatch(struct bfa_ioc_s *ioc); |
103 | 93 | ||
104 | /* | ||
105 | * hal_ioc_sm | ||
106 | */ | ||
107 | 94 | ||
108 | /* | 95 | /* |
109 | * IOC state machine definitions/declarations | 96 | * IOC state machine definitions/declarations |
@@ -116,10 +103,11 @@ enum ioc_event { | |||
116 | IOC_E_ENABLED = 5, /* f/w enabled */ | 103 | IOC_E_ENABLED = 5, /* f/w enabled */ |
117 | IOC_E_FWRSP_GETATTR = 6, /* IOC get attribute response */ | 104 | IOC_E_FWRSP_GETATTR = 6, /* IOC get attribute response */ |
118 | IOC_E_DISABLED = 7, /* f/w disabled */ | 105 | IOC_E_DISABLED = 7, /* f/w disabled */ |
119 | IOC_E_FAILED = 8, /* failure notice by iocpf sm */ | 106 | IOC_E_INITFAILED = 8, /* failure notice by iocpf sm */ |
120 | IOC_E_HBFAIL = 9, /* heartbeat failure */ | 107 | IOC_E_PFFAILED = 9, /* failure notice by iocpf sm */ |
121 | IOC_E_HWERROR = 10, /* hardware error interrupt */ | 108 | IOC_E_HBFAIL = 10, /* heartbeat failure */ |
122 | IOC_E_TIMEOUT = 11, /* timeout */ | 109 | IOC_E_HWERROR = 11, /* hardware error interrupt */ |
110 | IOC_E_TIMEOUT = 12, /* timeout */ | ||
123 | }; | 111 | }; |
124 | 112 | ||
125 | bfa_fsm_state_decl(bfa_ioc, uninit, struct bfa_ioc_s, enum ioc_event); | 113 | bfa_fsm_state_decl(bfa_ioc, uninit, struct bfa_ioc_s, enum ioc_event); |
@@ -127,7 +115,7 @@ bfa_fsm_state_decl(bfa_ioc, reset, struct bfa_ioc_s, enum ioc_event); | |||
127 | bfa_fsm_state_decl(bfa_ioc, enabling, struct bfa_ioc_s, enum ioc_event); | 115 | bfa_fsm_state_decl(bfa_ioc, enabling, struct bfa_ioc_s, enum ioc_event); |
128 | bfa_fsm_state_decl(bfa_ioc, getattr, struct bfa_ioc_s, enum ioc_event); | 116 | bfa_fsm_state_decl(bfa_ioc, getattr, struct bfa_ioc_s, enum ioc_event); |
129 | bfa_fsm_state_decl(bfa_ioc, op, struct bfa_ioc_s, enum ioc_event); | 117 | bfa_fsm_state_decl(bfa_ioc, op, struct bfa_ioc_s, enum ioc_event); |
130 | bfa_fsm_state_decl(bfa_ioc, initfail, struct bfa_ioc_s, enum ioc_event); | 118 | bfa_fsm_state_decl(bfa_ioc, fail_retry, struct bfa_ioc_s, enum ioc_event); |
131 | bfa_fsm_state_decl(bfa_ioc, fail, struct bfa_ioc_s, enum ioc_event); | 119 | bfa_fsm_state_decl(bfa_ioc, fail, struct bfa_ioc_s, enum ioc_event); |
132 | bfa_fsm_state_decl(bfa_ioc, disabling, struct bfa_ioc_s, enum ioc_event); | 120 | bfa_fsm_state_decl(bfa_ioc, disabling, struct bfa_ioc_s, enum ioc_event); |
133 | bfa_fsm_state_decl(bfa_ioc, disabled, struct bfa_ioc_s, enum ioc_event); | 121 | bfa_fsm_state_decl(bfa_ioc, disabled, struct bfa_ioc_s, enum ioc_event); |
@@ -138,7 +126,7 @@ static struct bfa_sm_table_s ioc_sm_table[] = { | |||
138 | {BFA_SM(bfa_ioc_sm_enabling), BFA_IOC_ENABLING}, | 126 | {BFA_SM(bfa_ioc_sm_enabling), BFA_IOC_ENABLING}, |
139 | {BFA_SM(bfa_ioc_sm_getattr), BFA_IOC_GETATTR}, | 127 | {BFA_SM(bfa_ioc_sm_getattr), BFA_IOC_GETATTR}, |
140 | {BFA_SM(bfa_ioc_sm_op), BFA_IOC_OPERATIONAL}, | 128 | {BFA_SM(bfa_ioc_sm_op), BFA_IOC_OPERATIONAL}, |
141 | {BFA_SM(bfa_ioc_sm_initfail), BFA_IOC_INITFAIL}, | 129 | {BFA_SM(bfa_ioc_sm_fail_retry), BFA_IOC_INITFAIL}, |
142 | {BFA_SM(bfa_ioc_sm_fail), BFA_IOC_FAIL}, | 130 | {BFA_SM(bfa_ioc_sm_fail), BFA_IOC_FAIL}, |
143 | {BFA_SM(bfa_ioc_sm_disabling), BFA_IOC_DISABLING}, | 131 | {BFA_SM(bfa_ioc_sm_disabling), BFA_IOC_DISABLING}, |
144 | {BFA_SM(bfa_ioc_sm_disabled), BFA_IOC_DISABLED}, | 132 | {BFA_SM(bfa_ioc_sm_disabled), BFA_IOC_DISABLED}, |
@@ -165,12 +153,6 @@ static struct bfa_sm_table_s ioc_sm_table[] = { | |||
165 | /* | 153 | /* |
166 | * Forward declareations for iocpf state machine | 154 | * Forward declareations for iocpf state machine |
167 | */ | 155 | */ |
168 | static void bfa_iocpf_enable(struct bfa_ioc_s *ioc); | ||
169 | static void bfa_iocpf_disable(struct bfa_ioc_s *ioc); | ||
170 | static void bfa_iocpf_fail(struct bfa_ioc_s *ioc); | ||
171 | static void bfa_iocpf_initfail(struct bfa_ioc_s *ioc); | ||
172 | static void bfa_iocpf_getattrfail(struct bfa_ioc_s *ioc); | ||
173 | static void bfa_iocpf_stop(struct bfa_ioc_s *ioc); | ||
174 | static void bfa_iocpf_timeout(void *ioc_arg); | 156 | static void bfa_iocpf_timeout(void *ioc_arg); |
175 | static void bfa_iocpf_sem_timeout(void *ioc_arg); | 157 | static void bfa_iocpf_sem_timeout(void *ioc_arg); |
176 | 158 | ||
@@ -213,9 +195,14 @@ bfa_fsm_state_decl(bfa_iocpf, semwait, struct bfa_iocpf_s, enum iocpf_event); | |||
213 | bfa_fsm_state_decl(bfa_iocpf, hwinit, struct bfa_iocpf_s, enum iocpf_event); | 195 | bfa_fsm_state_decl(bfa_iocpf, hwinit, struct bfa_iocpf_s, enum iocpf_event); |
214 | bfa_fsm_state_decl(bfa_iocpf, enabling, struct bfa_iocpf_s, enum iocpf_event); | 196 | bfa_fsm_state_decl(bfa_iocpf, enabling, struct bfa_iocpf_s, enum iocpf_event); |
215 | bfa_fsm_state_decl(bfa_iocpf, ready, struct bfa_iocpf_s, enum iocpf_event); | 197 | bfa_fsm_state_decl(bfa_iocpf, ready, struct bfa_iocpf_s, enum iocpf_event); |
198 | bfa_fsm_state_decl(bfa_iocpf, initfail_sync, struct bfa_iocpf_s, | ||
199 | enum iocpf_event); | ||
216 | bfa_fsm_state_decl(bfa_iocpf, initfail, struct bfa_iocpf_s, enum iocpf_event); | 200 | bfa_fsm_state_decl(bfa_iocpf, initfail, struct bfa_iocpf_s, enum iocpf_event); |
201 | bfa_fsm_state_decl(bfa_iocpf, fail_sync, struct bfa_iocpf_s, enum iocpf_event); | ||
217 | bfa_fsm_state_decl(bfa_iocpf, fail, struct bfa_iocpf_s, enum iocpf_event); | 202 | bfa_fsm_state_decl(bfa_iocpf, fail, struct bfa_iocpf_s, enum iocpf_event); |
218 | bfa_fsm_state_decl(bfa_iocpf, disabling, struct bfa_iocpf_s, enum iocpf_event); | 203 | bfa_fsm_state_decl(bfa_iocpf, disabling, struct bfa_iocpf_s, enum iocpf_event); |
204 | bfa_fsm_state_decl(bfa_iocpf, disabling_sync, struct bfa_iocpf_s, | ||
205 | enum iocpf_event); | ||
219 | bfa_fsm_state_decl(bfa_iocpf, disabled, struct bfa_iocpf_s, enum iocpf_event); | 206 | bfa_fsm_state_decl(bfa_iocpf, disabled, struct bfa_iocpf_s, enum iocpf_event); |
220 | 207 | ||
221 | static struct bfa_sm_table_s iocpf_sm_table[] = { | 208 | static struct bfa_sm_table_s iocpf_sm_table[] = { |
@@ -226,9 +213,12 @@ static struct bfa_sm_table_s iocpf_sm_table[] = { | |||
226 | {BFA_SM(bfa_iocpf_sm_hwinit), BFA_IOCPF_HWINIT}, | 213 | {BFA_SM(bfa_iocpf_sm_hwinit), BFA_IOCPF_HWINIT}, |
227 | {BFA_SM(bfa_iocpf_sm_enabling), BFA_IOCPF_HWINIT}, | 214 | {BFA_SM(bfa_iocpf_sm_enabling), BFA_IOCPF_HWINIT}, |
228 | {BFA_SM(bfa_iocpf_sm_ready), BFA_IOCPF_READY}, | 215 | {BFA_SM(bfa_iocpf_sm_ready), BFA_IOCPF_READY}, |
216 | {BFA_SM(bfa_iocpf_sm_initfail_sync), BFA_IOCPF_INITFAIL}, | ||
229 | {BFA_SM(bfa_iocpf_sm_initfail), BFA_IOCPF_INITFAIL}, | 217 | {BFA_SM(bfa_iocpf_sm_initfail), BFA_IOCPF_INITFAIL}, |
218 | {BFA_SM(bfa_iocpf_sm_fail_sync), BFA_IOCPF_FAIL}, | ||
230 | {BFA_SM(bfa_iocpf_sm_fail), BFA_IOCPF_FAIL}, | 219 | {BFA_SM(bfa_iocpf_sm_fail), BFA_IOCPF_FAIL}, |
231 | {BFA_SM(bfa_iocpf_sm_disabling), BFA_IOCPF_DISABLING}, | 220 | {BFA_SM(bfa_iocpf_sm_disabling), BFA_IOCPF_DISABLING}, |
221 | {BFA_SM(bfa_iocpf_sm_disabling_sync), BFA_IOCPF_DISABLING}, | ||
232 | {BFA_SM(bfa_iocpf_sm_disabled), BFA_IOCPF_DISABLED}, | 222 | {BFA_SM(bfa_iocpf_sm_disabled), BFA_IOCPF_DISABLED}, |
233 | }; | 223 | }; |
234 | 224 | ||
@@ -301,7 +291,7 @@ bfa_ioc_sm_reset(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
301 | static void | 291 | static void |
302 | bfa_ioc_sm_enabling_entry(struct bfa_ioc_s *ioc) | 292 | bfa_ioc_sm_enabling_entry(struct bfa_ioc_s *ioc) |
303 | { | 293 | { |
304 | bfa_iocpf_enable(ioc); | 294 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_ENABLE); |
305 | } | 295 | } |
306 | 296 | ||
307 | /* | 297 | /* |
@@ -318,13 +308,13 @@ bfa_ioc_sm_enabling(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
318 | bfa_fsm_set_state(ioc, bfa_ioc_sm_getattr); | 308 | bfa_fsm_set_state(ioc, bfa_ioc_sm_getattr); |
319 | break; | 309 | break; |
320 | 310 | ||
321 | case IOC_E_FAILED: | 311 | case IOC_E_PFFAILED: |
322 | bfa_fsm_set_state(ioc, bfa_ioc_sm_initfail); | 312 | /* !!! fall through !!! */ |
323 | break; | ||
324 | |||
325 | case IOC_E_HWERROR: | 313 | case IOC_E_HWERROR: |
326 | bfa_fsm_set_state(ioc, bfa_ioc_sm_initfail); | 314 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); |
327 | bfa_iocpf_initfail(ioc); | 315 | bfa_fsm_set_state(ioc, bfa_ioc_sm_fail_retry); |
316 | if (event != IOC_E_PFFAILED) | ||
317 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_INITFAIL); | ||
328 | break; | 318 | break; |
329 | 319 | ||
330 | case IOC_E_DISABLE: | 320 | case IOC_E_DISABLE: |
@@ -333,7 +323,7 @@ bfa_ioc_sm_enabling(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
333 | 323 | ||
334 | case IOC_E_DETACH: | 324 | case IOC_E_DETACH: |
335 | bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); | 325 | bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); |
336 | bfa_iocpf_stop(ioc); | 326 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); |
337 | break; | 327 | break; |
338 | 328 | ||
339 | case IOC_E_ENABLE: | 329 | case IOC_E_ENABLE: |
@@ -367,18 +357,16 @@ bfa_ioc_sm_getattr(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
367 | bfa_fsm_set_state(ioc, bfa_ioc_sm_op); | 357 | bfa_fsm_set_state(ioc, bfa_ioc_sm_op); |
368 | break; | 358 | break; |
369 | 359 | ||
370 | case IOC_E_FAILED: | ||
371 | bfa_ioc_timer_stop(ioc); | ||
372 | bfa_fsm_set_state(ioc, bfa_ioc_sm_initfail); | ||
373 | break; | 360 | break; |
374 | 361 | case IOC_E_PFFAILED: | |
375 | case IOC_E_HWERROR: | 362 | case IOC_E_HWERROR: |
376 | bfa_ioc_timer_stop(ioc); | 363 | bfa_ioc_timer_stop(ioc); |
377 | /* fall through */ | 364 | /* !!! fall through !!! */ |
378 | |||
379 | case IOC_E_TIMEOUT: | 365 | case IOC_E_TIMEOUT: |
380 | bfa_fsm_set_state(ioc, bfa_ioc_sm_initfail); | 366 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); |
381 | bfa_iocpf_getattrfail(ioc); | 367 | bfa_fsm_set_state(ioc, bfa_ioc_sm_fail_retry); |
368 | if (event != IOC_E_PFFAILED) | ||
369 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_GETATTRFAIL); | ||
382 | break; | 370 | break; |
383 | 371 | ||
384 | case IOC_E_DISABLE: | 372 | case IOC_E_DISABLE: |
@@ -415,22 +403,24 @@ bfa_ioc_sm_op(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
415 | break; | 403 | break; |
416 | 404 | ||
417 | case IOC_E_DISABLE: | 405 | case IOC_E_DISABLE: |
418 | bfa_ioc_hb_stop(ioc); | 406 | bfa_hb_timer_stop(ioc); |
419 | bfa_fsm_set_state(ioc, bfa_ioc_sm_disabling); | 407 | bfa_fsm_set_state(ioc, bfa_ioc_sm_disabling); |
420 | break; | 408 | break; |
421 | 409 | ||
422 | case IOC_E_FAILED: | 410 | case IOC_E_PFFAILED: |
423 | bfa_ioc_hb_stop(ioc); | ||
424 | bfa_fsm_set_state(ioc, bfa_ioc_sm_fail); | ||
425 | break; | ||
426 | |||
427 | case IOC_E_HWERROR: | 411 | case IOC_E_HWERROR: |
428 | bfa_ioc_hb_stop(ioc); | 412 | bfa_hb_timer_stop(ioc); |
429 | /* !!! fall through !!! */ | 413 | /* !!! fall through !!! */ |
430 | |||
431 | case IOC_E_HBFAIL: | 414 | case IOC_E_HBFAIL: |
432 | bfa_fsm_set_state(ioc, bfa_ioc_sm_fail); | 415 | bfa_ioc_fail_notify(ioc); |
433 | bfa_iocpf_fail(ioc); | 416 | |
417 | if (ioc->iocpf.auto_recover) | ||
418 | bfa_fsm_set_state(ioc, bfa_ioc_sm_fail_retry); | ||
419 | else | ||
420 | bfa_fsm_set_state(ioc, bfa_ioc_sm_fail); | ||
421 | |||
422 | if (event != IOC_E_PFFAILED) | ||
423 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FAIL); | ||
434 | break; | 424 | break; |
435 | 425 | ||
436 | default: | 426 | default: |
@@ -443,7 +433,7 @@ static void | |||
443 | bfa_ioc_sm_disabling_entry(struct bfa_ioc_s *ioc) | 433 | bfa_ioc_sm_disabling_entry(struct bfa_ioc_s *ioc) |
444 | { | 434 | { |
445 | struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; | 435 | struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; |
446 | bfa_iocpf_disable(ioc); | 436 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_DISABLE); |
447 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "IOC disabled\n"); | 437 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "IOC disabled\n"); |
448 | } | 438 | } |
449 | 439 | ||
@@ -466,7 +456,7 @@ bfa_ioc_sm_disabling(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
466 | * after iocpf sm completes failure processing and | 456 | * after iocpf sm completes failure processing and |
467 | * moves to disabled state. | 457 | * moves to disabled state. |
468 | */ | 458 | */ |
469 | bfa_iocpf_fail(ioc); | 459 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FAIL); |
470 | break; | 460 | break; |
471 | 461 | ||
472 | default: | 462 | default: |
@@ -499,7 +489,7 @@ bfa_ioc_sm_disabled(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
499 | 489 | ||
500 | case IOC_E_DETACH: | 490 | case IOC_E_DETACH: |
501 | bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); | 491 | bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); |
502 | bfa_iocpf_stop(ioc); | 492 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); |
503 | break; | 493 | break; |
504 | 494 | ||
505 | default: | 495 | default: |
@@ -509,16 +499,16 @@ bfa_ioc_sm_disabled(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
509 | 499 | ||
510 | 500 | ||
511 | static void | 501 | static void |
512 | bfa_ioc_sm_initfail_entry(struct bfa_ioc_s *ioc) | 502 | bfa_ioc_sm_fail_retry_entry(struct bfa_ioc_s *ioc) |
513 | { | 503 | { |
514 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); | 504 | bfa_trc(ioc, 0); |
515 | } | 505 | } |
516 | 506 | ||
517 | /* | 507 | /* |
518 | * Hardware initialization failed. | 508 | * Hardware initialization retry. |
519 | */ | 509 | */ |
520 | static void | 510 | static void |
521 | bfa_ioc_sm_initfail(struct bfa_ioc_s *ioc, enum ioc_event event) | 511 | bfa_ioc_sm_fail_retry(struct bfa_ioc_s *ioc, enum ioc_event event) |
522 | { | 512 | { |
523 | bfa_trc(ioc, event); | 513 | bfa_trc(ioc, event); |
524 | 514 | ||
@@ -527,11 +517,21 @@ bfa_ioc_sm_initfail(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
527 | bfa_fsm_set_state(ioc, bfa_ioc_sm_getattr); | 517 | bfa_fsm_set_state(ioc, bfa_ioc_sm_getattr); |
528 | break; | 518 | break; |
529 | 519 | ||
530 | case IOC_E_FAILED: | 520 | case IOC_E_PFFAILED: |
521 | case IOC_E_HWERROR: | ||
531 | /* | 522 | /* |
532 | * Initialization failure during iocpf init retry. | 523 | * Initialization retry failed. |
533 | */ | 524 | */ |
534 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); | 525 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); |
526 | if (event != IOC_E_PFFAILED) | ||
527 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_INITFAIL); | ||
528 | break; | ||
529 | |||
530 | case IOC_E_INITFAILED: | ||
531 | bfa_fsm_set_state(ioc, bfa_ioc_sm_fail); | ||
532 | break; | ||
533 | |||
534 | case IOC_E_ENABLE: | ||
535 | break; | 535 | break; |
536 | 536 | ||
537 | case IOC_E_DISABLE: | 537 | case IOC_E_DISABLE: |
@@ -540,7 +540,7 @@ bfa_ioc_sm_initfail(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
540 | 540 | ||
541 | case IOC_E_DETACH: | 541 | case IOC_E_DETACH: |
542 | bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); | 542 | bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); |
543 | bfa_iocpf_stop(ioc); | 543 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); |
544 | break; | 544 | break; |
545 | 545 | ||
546 | default: | 546 | default: |
@@ -552,21 +552,7 @@ bfa_ioc_sm_initfail(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
552 | static void | 552 | static void |
553 | bfa_ioc_sm_fail_entry(struct bfa_ioc_s *ioc) | 553 | bfa_ioc_sm_fail_entry(struct bfa_ioc_s *ioc) |
554 | { | 554 | { |
555 | struct list_head *qe; | 555 | bfa_trc(ioc, 0); |
556 | struct bfa_ioc_hbfail_notify_s *notify; | ||
557 | struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; | ||
558 | |||
559 | /* | ||
560 | * Notify driver and common modules registered for notification. | ||
561 | */ | ||
562 | ioc->cbfn->hbfail_cbfn(ioc->bfa); | ||
563 | list_for_each(qe, &ioc->hb_notify_q) { | ||
564 | notify = (struct bfa_ioc_hbfail_notify_s *) qe; | ||
565 | notify->cbfn(notify->cbarg); | ||
566 | } | ||
567 | |||
568 | BFA_LOG(KERN_CRIT, bfad, bfa_log_level, | ||
569 | "Heart Beat of IOC has failed\n"); | ||
570 | } | 556 | } |
571 | 557 | ||
572 | /* | 558 | /* |
@@ -579,23 +565,19 @@ bfa_ioc_sm_fail(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
579 | 565 | ||
580 | switch (event) { | 566 | switch (event) { |
581 | 567 | ||
582 | case IOC_E_FAILED: | ||
583 | /* | ||
584 | * Initialization failure during iocpf recovery. | ||
585 | * !!! Fall through !!! | ||
586 | */ | ||
587 | case IOC_E_ENABLE: | 568 | case IOC_E_ENABLE: |
588 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); | 569 | ioc->cbfn->enable_cbfn(ioc->bfa, BFA_STATUS_IOC_FAILURE); |
589 | break; | 570 | break; |
590 | 571 | ||
591 | case IOC_E_ENABLED: | ||
592 | bfa_fsm_set_state(ioc, bfa_ioc_sm_getattr); | ||
593 | break; | ||
594 | |||
595 | case IOC_E_DISABLE: | 572 | case IOC_E_DISABLE: |
596 | bfa_fsm_set_state(ioc, bfa_ioc_sm_disabling); | 573 | bfa_fsm_set_state(ioc, bfa_ioc_sm_disabling); |
597 | break; | 574 | break; |
598 | 575 | ||
576 | case IOC_E_DETACH: | ||
577 | bfa_fsm_set_state(ioc, bfa_ioc_sm_uninit); | ||
578 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); | ||
579 | break; | ||
580 | |||
599 | case IOC_E_HWERROR: | 581 | case IOC_E_HWERROR: |
600 | /* | 582 | /* |
601 | * HB failure notification, ignore. | 583 | * HB failure notification, ignore. |
@@ -606,13 +588,10 @@ bfa_ioc_sm_fail(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
606 | } | 588 | } |
607 | } | 589 | } |
608 | 590 | ||
609 | |||
610 | |||
611 | /* | 591 | /* |
612 | * IOCPF State Machine | 592 | * IOCPF State Machine |
613 | */ | 593 | */ |
614 | 594 | ||
615 | |||
616 | /* | 595 | /* |
617 | * Reset entry actions -- initialize state machine | 596 | * Reset entry actions -- initialize state machine |
618 | */ | 597 | */ |
@@ -668,22 +647,29 @@ bfa_iocpf_sm_fwcheck(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
668 | switch (event) { | 647 | switch (event) { |
669 | case IOCPF_E_SEMLOCKED: | 648 | case IOCPF_E_SEMLOCKED: |
670 | if (bfa_ioc_firmware_lock(ioc)) { | 649 | if (bfa_ioc_firmware_lock(ioc)) { |
671 | iocpf->retry_count = 0; | 650 | if (bfa_ioc_sync_complete(ioc)) { |
672 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit); | 651 | iocpf->retry_count = 0; |
652 | bfa_ioc_sync_join(ioc); | ||
653 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit); | ||
654 | } else { | ||
655 | bfa_ioc_firmware_unlock(ioc); | ||
656 | writel(1, ioc->ioc_regs.ioc_sem_reg); | ||
657 | bfa_sem_timer_start(ioc); | ||
658 | } | ||
673 | } else { | 659 | } else { |
674 | bfa_ioc_hw_sem_release(ioc); | 660 | writel(1, ioc->ioc_regs.ioc_sem_reg); |
675 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_mismatch); | 661 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_mismatch); |
676 | } | 662 | } |
677 | break; | 663 | break; |
678 | 664 | ||
679 | case IOCPF_E_DISABLE: | 665 | case IOCPF_E_DISABLE: |
680 | bfa_ioc_hw_sem_get_cancel(ioc); | 666 | bfa_sem_timer_stop(ioc); |
681 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); | 667 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); |
682 | bfa_ioc_pf_disabled(ioc); | 668 | bfa_fsm_send_event(ioc, IOC_E_DISABLED); |
683 | break; | 669 | break; |
684 | 670 | ||
685 | case IOCPF_E_STOP: | 671 | case IOCPF_E_STOP: |
686 | bfa_ioc_hw_sem_get_cancel(ioc); | 672 | bfa_sem_timer_stop(ioc); |
687 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); | 673 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); |
688 | break; | 674 | break; |
689 | 675 | ||
@@ -726,7 +712,7 @@ bfa_iocpf_sm_mismatch(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
726 | case IOCPF_E_DISABLE: | 712 | case IOCPF_E_DISABLE: |
727 | bfa_iocpf_timer_stop(ioc); | 713 | bfa_iocpf_timer_stop(ioc); |
728 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); | 714 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); |
729 | bfa_ioc_pf_disabled(ioc); | 715 | bfa_fsm_send_event(ioc, IOC_E_DISABLED); |
730 | break; | 716 | break; |
731 | 717 | ||
732 | case IOCPF_E_STOP: | 718 | case IOCPF_E_STOP: |
@@ -760,13 +746,18 @@ bfa_iocpf_sm_semwait(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
760 | 746 | ||
761 | switch (event) { | 747 | switch (event) { |
762 | case IOCPF_E_SEMLOCKED: | 748 | case IOCPF_E_SEMLOCKED: |
763 | iocpf->retry_count = 0; | 749 | if (bfa_ioc_sync_complete(ioc)) { |
764 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit); | 750 | bfa_ioc_sync_join(ioc); |
751 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit); | ||
752 | } else { | ||
753 | writel(1, ioc->ioc_regs.ioc_sem_reg); | ||
754 | bfa_sem_timer_start(ioc); | ||
755 | } | ||
765 | break; | 756 | break; |
766 | 757 | ||
767 | case IOCPF_E_DISABLE: | 758 | case IOCPF_E_DISABLE: |
768 | bfa_ioc_hw_sem_get_cancel(ioc); | 759 | bfa_sem_timer_stop(ioc); |
769 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); | 760 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabling_sync); |
770 | break; | 761 | break; |
771 | 762 | ||
772 | default: | 763 | default: |
@@ -774,12 +765,11 @@ bfa_iocpf_sm_semwait(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
774 | } | 765 | } |
775 | } | 766 | } |
776 | 767 | ||
777 | |||
778 | static void | 768 | static void |
779 | bfa_iocpf_sm_hwinit_entry(struct bfa_iocpf_s *iocpf) | 769 | bfa_iocpf_sm_hwinit_entry(struct bfa_iocpf_s *iocpf) |
780 | { | 770 | { |
781 | bfa_iocpf_timer_start(iocpf->ioc); | 771 | bfa_iocpf_timer_start(iocpf->ioc); |
782 | bfa_ioc_reset(iocpf->ioc, BFA_FALSE); | 772 | bfa_ioc_hwinit(iocpf->ioc, BFA_FALSE); |
783 | } | 773 | } |
784 | 774 | ||
785 | /* | 775 | /* |
@@ -806,23 +796,16 @@ bfa_iocpf_sm_hwinit(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
806 | */ | 796 | */ |
807 | 797 | ||
808 | case IOCPF_E_TIMEOUT: | 798 | case IOCPF_E_TIMEOUT: |
809 | iocpf->retry_count++; | 799 | writel(1, ioc->ioc_regs.ioc_sem_reg); |
810 | if (iocpf->retry_count < BFA_IOC_HWINIT_MAX) { | ||
811 | bfa_iocpf_timer_start(ioc); | ||
812 | bfa_ioc_reset(ioc, BFA_TRUE); | ||
813 | break; | ||
814 | } | ||
815 | |||
816 | bfa_ioc_hw_sem_release(ioc); | ||
817 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail); | ||
818 | |||
819 | if (event == IOCPF_E_TIMEOUT) | 800 | if (event == IOCPF_E_TIMEOUT) |
820 | bfa_ioc_pf_failed(ioc); | 801 | bfa_fsm_send_event(ioc, IOC_E_PFFAILED); |
802 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail_sync); | ||
821 | break; | 803 | break; |
822 | 804 | ||
823 | case IOCPF_E_DISABLE: | 805 | case IOCPF_E_DISABLE: |
824 | bfa_ioc_hw_sem_release(ioc); | ||
825 | bfa_iocpf_timer_stop(ioc); | 806 | bfa_iocpf_timer_stop(ioc); |
807 | bfa_ioc_sync_leave(ioc); | ||
808 | writel(1, ioc->ioc_regs.ioc_sem_reg); | ||
826 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); | 809 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); |
827 | break; | 810 | break; |
828 | 811 | ||
@@ -831,7 +814,6 @@ bfa_iocpf_sm_hwinit(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
831 | } | 814 | } |
832 | } | 815 | } |
833 | 816 | ||
834 | |||
835 | static void | 817 | static void |
836 | bfa_iocpf_sm_enabling_entry(struct bfa_iocpf_s *iocpf) | 818 | bfa_iocpf_sm_enabling_entry(struct bfa_iocpf_s *iocpf) |
837 | { | 819 | { |
@@ -853,7 +835,7 @@ bfa_iocpf_sm_enabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
853 | switch (event) { | 835 | switch (event) { |
854 | case IOCPF_E_FWRSP_ENABLE: | 836 | case IOCPF_E_FWRSP_ENABLE: |
855 | bfa_iocpf_timer_stop(ioc); | 837 | bfa_iocpf_timer_stop(ioc); |
856 | bfa_ioc_hw_sem_release(ioc); | 838 | writel(1, ioc->ioc_regs.ioc_sem_reg); |
857 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_ready); | 839 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_ready); |
858 | break; | 840 | break; |
859 | 841 | ||
@@ -864,23 +846,15 @@ bfa_iocpf_sm_enabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
864 | */ | 846 | */ |
865 | 847 | ||
866 | case IOCPF_E_TIMEOUT: | 848 | case IOCPF_E_TIMEOUT: |
867 | iocpf->retry_count++; | 849 | writel(1, ioc->ioc_regs.ioc_sem_reg); |
868 | if (iocpf->retry_count < BFA_IOC_HWINIT_MAX) { | ||
869 | writel(BFI_IOC_UNINIT, ioc->ioc_regs.ioc_fwstate); | ||
870 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit); | ||
871 | break; | ||
872 | } | ||
873 | |||
874 | bfa_ioc_hw_sem_release(ioc); | ||
875 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail); | ||
876 | |||
877 | if (event == IOCPF_E_TIMEOUT) | 850 | if (event == IOCPF_E_TIMEOUT) |
878 | bfa_ioc_pf_failed(ioc); | 851 | bfa_fsm_send_event(ioc, IOC_E_PFFAILED); |
852 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail_sync); | ||
879 | break; | 853 | break; |
880 | 854 | ||
881 | case IOCPF_E_DISABLE: | 855 | case IOCPF_E_DISABLE: |
882 | bfa_iocpf_timer_stop(ioc); | 856 | bfa_iocpf_timer_stop(ioc); |
883 | bfa_ioc_hw_sem_release(ioc); | 857 | writel(1, ioc->ioc_regs.ioc_sem_reg); |
884 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabling); | 858 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabling); |
885 | break; | 859 | break; |
886 | 860 | ||
@@ -893,12 +867,10 @@ bfa_iocpf_sm_enabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
893 | } | 867 | } |
894 | } | 868 | } |
895 | 869 | ||
896 | |||
897 | |||
898 | static void | 870 | static void |
899 | bfa_iocpf_sm_ready_entry(struct bfa_iocpf_s *iocpf) | 871 | bfa_iocpf_sm_ready_entry(struct bfa_iocpf_s *iocpf) |
900 | { | 872 | { |
901 | bfa_ioc_pf_enabled(iocpf->ioc); | 873 | bfa_fsm_send_event(iocpf->ioc, IOC_E_ENABLED); |
902 | } | 874 | } |
903 | 875 | ||
904 | static void | 876 | static void |
@@ -914,20 +886,21 @@ bfa_iocpf_sm_ready(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
914 | break; | 886 | break; |
915 | 887 | ||
916 | case IOCPF_E_GETATTRFAIL: | 888 | case IOCPF_E_GETATTRFAIL: |
917 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail); | 889 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail_sync); |
918 | break; | 890 | break; |
919 | 891 | ||
920 | case IOCPF_E_FAIL: | 892 | case IOCPF_E_FAIL: |
921 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_fail); | 893 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_fail_sync); |
922 | break; | 894 | break; |
923 | 895 | ||
924 | case IOCPF_E_FWREADY: | 896 | case IOCPF_E_FWREADY: |
925 | if (bfa_ioc_is_operational(ioc)) | 897 | if (bfa_ioc_is_operational(ioc)) { |
926 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_fail); | 898 | bfa_fsm_send_event(ioc, IOC_E_PFFAILED); |
927 | else | 899 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_fail_sync); |
928 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail); | 900 | } else { |
929 | 901 | bfa_fsm_send_event(ioc, IOC_E_PFFAILED); | |
930 | bfa_ioc_pf_failed(ioc); | 902 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail_sync); |
903 | } | ||
931 | break; | 904 | break; |
932 | 905 | ||
933 | default: | 906 | default: |
@@ -935,7 +908,6 @@ bfa_iocpf_sm_ready(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
935 | } | 908 | } |
936 | } | 909 | } |
937 | 910 | ||
938 | |||
939 | static void | 911 | static void |
940 | bfa_iocpf_sm_disabling_entry(struct bfa_iocpf_s *iocpf) | 912 | bfa_iocpf_sm_disabling_entry(struct bfa_iocpf_s *iocpf) |
941 | { | 913 | { |
@@ -957,7 +929,7 @@ bfa_iocpf_sm_disabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
957 | case IOCPF_E_FWRSP_DISABLE: | 929 | case IOCPF_E_FWRSP_DISABLE: |
958 | case IOCPF_E_FWREADY: | 930 | case IOCPF_E_FWREADY: |
959 | bfa_iocpf_timer_stop(ioc); | 931 | bfa_iocpf_timer_stop(ioc); |
960 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); | 932 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabling_sync); |
961 | break; | 933 | break; |
962 | 934 | ||
963 | case IOCPF_E_FAIL: | 935 | case IOCPF_E_FAIL: |
@@ -968,7 +940,7 @@ bfa_iocpf_sm_disabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
968 | 940 | ||
969 | case IOCPF_E_TIMEOUT: | 941 | case IOCPF_E_TIMEOUT: |
970 | writel(BFI_IOC_FAIL, ioc->ioc_regs.ioc_fwstate); | 942 | writel(BFI_IOC_FAIL, ioc->ioc_regs.ioc_fwstate); |
971 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); | 943 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabling_sync); |
972 | break; | 944 | break; |
973 | 945 | ||
974 | case IOCPF_E_FWRSP_ENABLE: | 946 | case IOCPF_E_FWRSP_ENABLE: |
@@ -979,13 +951,44 @@ bfa_iocpf_sm_disabling(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
979 | } | 951 | } |
980 | } | 952 | } |
981 | 953 | ||
954 | static void | ||
955 | bfa_iocpf_sm_disabling_sync_entry(struct bfa_iocpf_s *iocpf) | ||
956 | { | ||
957 | bfa_ioc_hw_sem_get(iocpf->ioc); | ||
958 | } | ||
959 | |||
960 | /* | ||
961 | * IOC hb ack request is being removed. | ||
962 | */ | ||
963 | static void | ||
964 | bfa_iocpf_sm_disabling_sync(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | ||
965 | { | ||
966 | struct bfa_ioc_s *ioc = iocpf->ioc; | ||
967 | |||
968 | bfa_trc(ioc, event); | ||
969 | |||
970 | switch (event) { | ||
971 | case IOCPF_E_SEMLOCKED: | ||
972 | bfa_ioc_sync_leave(ioc); | ||
973 | writel(1, ioc->ioc_regs.ioc_sem_reg); | ||
974 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); | ||
975 | break; | ||
976 | |||
977 | case IOCPF_E_FAIL: | ||
978 | break; | ||
979 | |||
980 | default: | ||
981 | bfa_sm_fault(ioc, event); | ||
982 | } | ||
983 | } | ||
984 | |||
982 | /* | 985 | /* |
983 | * IOC disable completion entry. | 986 | * IOC disable completion entry. |
984 | */ | 987 | */ |
985 | static void | 988 | static void |
986 | bfa_iocpf_sm_disabled_entry(struct bfa_iocpf_s *iocpf) | 989 | bfa_iocpf_sm_disabled_entry(struct bfa_iocpf_s *iocpf) |
987 | { | 990 | { |
988 | bfa_ioc_pf_disabled(iocpf->ioc); | 991 | bfa_fsm_send_event(iocpf->ioc, IOC_E_DISABLED); |
989 | } | 992 | } |
990 | 993 | ||
991 | static void | 994 | static void |
@@ -997,6 +1000,7 @@ bfa_iocpf_sm_disabled(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
997 | 1000 | ||
998 | switch (event) { | 1001 | switch (event) { |
999 | case IOCPF_E_ENABLE: | 1002 | case IOCPF_E_ENABLE: |
1003 | iocpf->retry_count = 0; | ||
1000 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_semwait); | 1004 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_semwait); |
1001 | break; | 1005 | break; |
1002 | 1006 | ||
@@ -1010,11 +1014,64 @@ bfa_iocpf_sm_disabled(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
1010 | } | 1014 | } |
1011 | } | 1015 | } |
1012 | 1016 | ||
1017 | static void | ||
1018 | bfa_iocpf_sm_initfail_sync_entry(struct bfa_iocpf_s *iocpf) | ||
1019 | { | ||
1020 | bfa_ioc_hw_sem_get(iocpf->ioc); | ||
1021 | } | ||
1022 | |||
1023 | /* | ||
1024 | * Hardware initialization failed. | ||
1025 | */ | ||
1026 | static void | ||
1027 | bfa_iocpf_sm_initfail_sync(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | ||
1028 | { | ||
1029 | struct bfa_ioc_s *ioc = iocpf->ioc; | ||
1030 | |||
1031 | bfa_trc(ioc, event); | ||
1032 | |||
1033 | switch (event) { | ||
1034 | case IOCPF_E_SEMLOCKED: | ||
1035 | bfa_ioc_notify_fail(ioc); | ||
1036 | bfa_ioc_sync_ack(ioc); | ||
1037 | iocpf->retry_count++; | ||
1038 | if (iocpf->retry_count >= BFA_IOC_HWINIT_MAX) { | ||
1039 | bfa_ioc_sync_leave(ioc); | ||
1040 | writel(1, ioc->ioc_regs.ioc_sem_reg); | ||
1041 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_initfail); | ||
1042 | } else { | ||
1043 | if (bfa_ioc_sync_complete(ioc)) | ||
1044 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit); | ||
1045 | else { | ||
1046 | writel(1, ioc->ioc_regs.ioc_sem_reg); | ||
1047 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_semwait); | ||
1048 | } | ||
1049 | } | ||
1050 | break; | ||
1051 | |||
1052 | case IOCPF_E_DISABLE: | ||
1053 | bfa_sem_timer_stop(ioc); | ||
1054 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabling_sync); | ||
1055 | break; | ||
1056 | |||
1057 | case IOCPF_E_STOP: | ||
1058 | bfa_sem_timer_stop(ioc); | ||
1059 | bfa_ioc_firmware_unlock(ioc); | ||
1060 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); | ||
1061 | break; | ||
1062 | |||
1063 | case IOCPF_E_FAIL: | ||
1064 | break; | ||
1065 | |||
1066 | default: | ||
1067 | bfa_sm_fault(ioc, event); | ||
1068 | } | ||
1069 | } | ||
1013 | 1070 | ||
1014 | static void | 1071 | static void |
1015 | bfa_iocpf_sm_initfail_entry(struct bfa_iocpf_s *iocpf) | 1072 | bfa_iocpf_sm_initfail_entry(struct bfa_iocpf_s *iocpf) |
1016 | { | 1073 | { |
1017 | bfa_iocpf_timer_start(iocpf->ioc); | 1074 | bfa_fsm_send_event(iocpf->ioc, IOC_E_INITFAILED); |
1018 | } | 1075 | } |
1019 | 1076 | ||
1020 | /* | 1077 | /* |
@@ -1029,47 +1086,77 @@ bfa_iocpf_sm_initfail(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
1029 | 1086 | ||
1030 | switch (event) { | 1087 | switch (event) { |
1031 | case IOCPF_E_DISABLE: | 1088 | case IOCPF_E_DISABLE: |
1032 | bfa_iocpf_timer_stop(ioc); | ||
1033 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); | 1089 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); |
1034 | break; | 1090 | break; |
1035 | 1091 | ||
1036 | case IOCPF_E_STOP: | 1092 | case IOCPF_E_STOP: |
1037 | bfa_iocpf_timer_stop(ioc); | ||
1038 | bfa_ioc_firmware_unlock(ioc); | 1093 | bfa_ioc_firmware_unlock(ioc); |
1039 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); | 1094 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_reset); |
1040 | break; | 1095 | break; |
1041 | 1096 | ||
1042 | case IOCPF_E_TIMEOUT: | ||
1043 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_semwait); | ||
1044 | break; | ||
1045 | |||
1046 | default: | 1097 | default: |
1047 | bfa_sm_fault(ioc, event); | 1098 | bfa_sm_fault(ioc, event); |
1048 | } | 1099 | } |
1049 | } | 1100 | } |
1050 | 1101 | ||
1051 | |||
1052 | static void | 1102 | static void |
1053 | bfa_iocpf_sm_fail_entry(struct bfa_iocpf_s *iocpf) | 1103 | bfa_iocpf_sm_fail_sync_entry(struct bfa_iocpf_s *iocpf) |
1054 | { | 1104 | { |
1055 | /* | 1105 | /* |
1056 | * Mark IOC as failed in hardware and stop firmware. | 1106 | * Mark IOC as failed in hardware and stop firmware. |
1057 | */ | 1107 | */ |
1058 | bfa_ioc_lpu_stop(iocpf->ioc); | 1108 | bfa_ioc_lpu_stop(iocpf->ioc); |
1059 | writel(BFI_IOC_FAIL, iocpf->ioc->ioc_regs.ioc_fwstate); | ||
1060 | |||
1061 | /* | ||
1062 | * Notify other functions on HB failure. | ||
1063 | */ | ||
1064 | bfa_ioc_notify_hbfail(iocpf->ioc); | ||
1065 | 1109 | ||
1066 | /* | 1110 | /* |
1067 | * Flush any queued up mailbox requests. | 1111 | * Flush any queued up mailbox requests. |
1068 | */ | 1112 | */ |
1069 | bfa_ioc_mbox_hbfail(iocpf->ioc); | 1113 | bfa_ioc_mbox_hbfail(iocpf->ioc); |
1070 | 1114 | ||
1071 | if (iocpf->auto_recover) | 1115 | bfa_ioc_hw_sem_get(iocpf->ioc); |
1072 | bfa_iocpf_recovery_timer_start(iocpf->ioc); | 1116 | } |
1117 | |||
1118 | static void | ||
1119 | bfa_iocpf_sm_fail_sync(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | ||
1120 | { | ||
1121 | struct bfa_ioc_s *ioc = iocpf->ioc; | ||
1122 | |||
1123 | bfa_trc(ioc, event); | ||
1124 | |||
1125 | switch (event) { | ||
1126 | case IOCPF_E_SEMLOCKED: | ||
1127 | iocpf->retry_count = 0; | ||
1128 | bfa_ioc_sync_ack(ioc); | ||
1129 | bfa_ioc_notify_fail(ioc); | ||
1130 | if (!iocpf->auto_recover) { | ||
1131 | bfa_ioc_sync_leave(ioc); | ||
1132 | writel(1, ioc->ioc_regs.ioc_sem_reg); | ||
1133 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_fail); | ||
1134 | } else { | ||
1135 | if (bfa_ioc_sync_complete(ioc)) | ||
1136 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_hwinit); | ||
1137 | else { | ||
1138 | writel(1, ioc->ioc_regs.ioc_sem_reg); | ||
1139 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_semwait); | ||
1140 | } | ||
1141 | } | ||
1142 | break; | ||
1143 | |||
1144 | case IOCPF_E_DISABLE: | ||
1145 | bfa_sem_timer_stop(ioc); | ||
1146 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabling_sync); | ||
1147 | break; | ||
1148 | |||
1149 | case IOCPF_E_FAIL: | ||
1150 | break; | ||
1151 | |||
1152 | default: | ||
1153 | bfa_sm_fault(ioc, event); | ||
1154 | } | ||
1155 | } | ||
1156 | |||
1157 | static void | ||
1158 | bfa_iocpf_sm_fail_entry(struct bfa_iocpf_s *iocpf) | ||
1159 | { | ||
1073 | } | 1160 | } |
1074 | 1161 | ||
1075 | /* | 1162 | /* |
@@ -1084,24 +1171,16 @@ bfa_iocpf_sm_fail(struct bfa_iocpf_s *iocpf, enum iocpf_event event) | |||
1084 | 1171 | ||
1085 | switch (event) { | 1172 | switch (event) { |
1086 | case IOCPF_E_DISABLE: | 1173 | case IOCPF_E_DISABLE: |
1087 | if (iocpf->auto_recover) | ||
1088 | bfa_iocpf_timer_stop(ioc); | ||
1089 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); | 1174 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_disabled); |
1090 | break; | 1175 | break; |
1091 | 1176 | ||
1092 | case IOCPF_E_TIMEOUT: | ||
1093 | bfa_fsm_set_state(iocpf, bfa_iocpf_sm_semwait); | ||
1094 | break; | ||
1095 | |||
1096 | default: | 1177 | default: |
1097 | bfa_sm_fault(ioc, event); | 1178 | bfa_sm_fault(ioc, event); |
1098 | } | 1179 | } |
1099 | } | 1180 | } |
1100 | 1181 | ||
1101 | |||
1102 | |||
1103 | /* | 1182 | /* |
1104 | * hal_ioc_pvt BFA IOC private functions | 1183 | * BFA IOC private functions |
1105 | */ | 1184 | */ |
1106 | 1185 | ||
1107 | static void | 1186 | static void |
@@ -1139,16 +1218,10 @@ bfa_ioc_sem_get(void __iomem *sem_reg) | |||
1139 | if (r32 == 0) | 1218 | if (r32 == 0) |
1140 | return BFA_TRUE; | 1219 | return BFA_TRUE; |
1141 | 1220 | ||
1142 | bfa_assert(cnt < BFA_SEM_SPINCNT); | 1221 | WARN_ON(cnt >= BFA_SEM_SPINCNT); |
1143 | return BFA_FALSE; | 1222 | return BFA_FALSE; |
1144 | } | 1223 | } |
1145 | 1224 | ||
1146 | void | ||
1147 | bfa_ioc_sem_release(void __iomem *sem_reg) | ||
1148 | { | ||
1149 | writel(1, sem_reg); | ||
1150 | } | ||
1151 | |||
1152 | static void | 1225 | static void |
1153 | bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc) | 1226 | bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc) |
1154 | { | 1227 | { |
@@ -1167,18 +1240,6 @@ bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc) | |||
1167 | bfa_sem_timer_start(ioc); | 1240 | bfa_sem_timer_start(ioc); |
1168 | } | 1241 | } |
1169 | 1242 | ||
1170 | void | ||
1171 | bfa_ioc_hw_sem_release(struct bfa_ioc_s *ioc) | ||
1172 | { | ||
1173 | writel(1, ioc->ioc_regs.ioc_sem_reg); | ||
1174 | } | ||
1175 | |||
1176 | static void | ||
1177 | bfa_ioc_hw_sem_get_cancel(struct bfa_ioc_s *ioc) | ||
1178 | { | ||
1179 | bfa_sem_timer_stop(ioc); | ||
1180 | } | ||
1181 | |||
1182 | /* | 1243 | /* |
1183 | * Initialize LPU local memory (aka secondary memory / SRAM) | 1244 | * Initialize LPU local memory (aka secondary memory / SRAM) |
1184 | */ | 1245 | */ |
@@ -1212,7 +1273,7 @@ bfa_ioc_lmem_init(struct bfa_ioc_s *ioc) | |||
1212 | * If memory initialization is not successful, IOC timeout will catch | 1273 | * If memory initialization is not successful, IOC timeout will catch |
1213 | * such failures. | 1274 | * such failures. |
1214 | */ | 1275 | */ |
1215 | bfa_assert(pss_ctl & __PSS_LMEM_INIT_DONE); | 1276 | WARN_ON(!(pss_ctl & __PSS_LMEM_INIT_DONE)); |
1216 | bfa_trc(ioc, pss_ctl); | 1277 | bfa_trc(ioc, pss_ctl); |
1217 | 1278 | ||
1218 | pss_ctl &= ~(__PSS_LMEM_INIT_DONE | __PSS_LMEM_INIT_EN); | 1279 | pss_ctl &= ~(__PSS_LMEM_INIT_DONE | __PSS_LMEM_INIT_EN); |
@@ -1258,8 +1319,8 @@ bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr) | |||
1258 | int i; | 1319 | int i; |
1259 | u32 *fwsig = (u32 *) fwhdr; | 1320 | u32 *fwsig = (u32 *) fwhdr; |
1260 | 1321 | ||
1261 | pgnum = bfa_ioc_smem_pgnum(ioc, loff); | 1322 | pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); |
1262 | pgoff = bfa_ioc_smem_pgoff(ioc, loff); | 1323 | pgoff = PSS_SMEM_PGOFF(loff); |
1263 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); | 1324 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); |
1264 | 1325 | ||
1265 | for (i = 0; i < (sizeof(struct bfi_ioc_image_hdr_s) / sizeof(u32)); | 1326 | for (i = 0; i < (sizeof(struct bfi_ioc_image_hdr_s) / sizeof(u32)); |
@@ -1304,12 +1365,6 @@ bfa_ioc_fwver_valid(struct bfa_ioc_s *ioc, u32 boot_env) | |||
1304 | { | 1365 | { |
1305 | struct bfi_ioc_image_hdr_s fwhdr, *drv_fwhdr; | 1366 | struct bfi_ioc_image_hdr_s fwhdr, *drv_fwhdr; |
1306 | 1367 | ||
1307 | /* | ||
1308 | * If bios/efi boot (flash based) -- return true | ||
1309 | */ | ||
1310 | if (bfa_ioc_is_bios_optrom(ioc)) | ||
1311 | return BFA_TRUE; | ||
1312 | |||
1313 | bfa_ioc_fwver_get(ioc, &fwhdr); | 1368 | bfa_ioc_fwver_get(ioc, &fwhdr); |
1314 | drv_fwhdr = (struct bfi_ioc_image_hdr_s *) | 1369 | drv_fwhdr = (struct bfi_ioc_image_hdr_s *) |
1315 | bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), 0); | 1370 | bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), 0); |
@@ -1342,7 +1397,6 @@ bfa_ioc_msgflush(struct bfa_ioc_s *ioc) | |||
1342 | writel(1, ioc->ioc_regs.lpu_mbox_cmd); | 1397 | writel(1, ioc->ioc_regs.lpu_mbox_cmd); |
1343 | } | 1398 | } |
1344 | 1399 | ||
1345 | |||
1346 | static void | 1400 | static void |
1347 | bfa_ioc_hwinit(struct bfa_ioc_s *ioc, bfa_boolean_t force) | 1401 | bfa_ioc_hwinit(struct bfa_ioc_s *ioc, bfa_boolean_t force) |
1348 | { | 1402 | { |
@@ -1362,22 +1416,6 @@ bfa_ioc_hwinit(struct bfa_ioc_s *ioc, bfa_boolean_t force) | |||
1362 | boot_env = BFI_BOOT_LOADER_OS; | 1416 | boot_env = BFI_BOOT_LOADER_OS; |
1363 | 1417 | ||
1364 | /* | 1418 | /* |
1365 | * Flash based firmware boot BIOS env. | ||
1366 | */ | ||
1367 | if (bfa_ioc_is_bios_optrom(ioc)) { | ||
1368 | boot_type = BFI_BOOT_TYPE_FLASH; | ||
1369 | boot_env = BFI_BOOT_LOADER_BIOS; | ||
1370 | } | ||
1371 | |||
1372 | /* | ||
1373 | * Flash based firmware boot UEFI env. | ||
1374 | */ | ||
1375 | if (bfa_ioc_is_uefi(ioc)) { | ||
1376 | boot_type = BFI_BOOT_TYPE_FLASH; | ||
1377 | boot_env = BFI_BOOT_LOADER_UEFI; | ||
1378 | } | ||
1379 | |||
1380 | /* | ||
1381 | * check if firmware is valid | 1419 | * check if firmware is valid |
1382 | */ | 1420 | */ |
1383 | fwvalid = (ioc_fwstate == BFI_IOC_UNINIT) ? | 1421 | fwvalid = (ioc_fwstate == BFI_IOC_UNINIT) ? |
@@ -1405,8 +1443,7 @@ bfa_ioc_hwinit(struct bfa_ioc_s *ioc, bfa_boolean_t force) | |||
1405 | * convergence, IOC will be in operational state when 2nd driver | 1443 | * convergence, IOC will be in operational state when 2nd driver |
1406 | * is loaded. | 1444 | * is loaded. |
1407 | */ | 1445 | */ |
1408 | if (ioc_fwstate == BFI_IOC_DISABLED || | 1446 | if (ioc_fwstate == BFI_IOC_DISABLED || ioc_fwstate == BFI_IOC_OP) { |
1409 | (!bfa_ioc_is_bios_optrom(ioc) && ioc_fwstate == BFI_IOC_OP)) { | ||
1410 | 1447 | ||
1411 | /* | 1448 | /* |
1412 | * When using MSI-X any pending firmware ready event should | 1449 | * When using MSI-X any pending firmware ready event should |
@@ -1442,7 +1479,7 @@ bfa_ioc_mbox_send(struct bfa_ioc_s *ioc, void *ioc_msg, int len) | |||
1442 | bfa_trc(ioc, msgp[0]); | 1479 | bfa_trc(ioc, msgp[0]); |
1443 | bfa_trc(ioc, len); | 1480 | bfa_trc(ioc, len); |
1444 | 1481 | ||
1445 | bfa_assert(len <= BFI_IOC_MSGLEN_MAX); | 1482 | WARN_ON(len > BFI_IOC_MSGLEN_MAX); |
1446 | 1483 | ||
1447 | /* | 1484 | /* |
1448 | * first write msg to mailbox registers | 1485 | * first write msg to mailbox registers |
@@ -1465,12 +1502,12 @@ static void | |||
1465 | bfa_ioc_send_enable(struct bfa_ioc_s *ioc) | 1502 | bfa_ioc_send_enable(struct bfa_ioc_s *ioc) |
1466 | { | 1503 | { |
1467 | struct bfi_ioc_ctrl_req_s enable_req; | 1504 | struct bfi_ioc_ctrl_req_s enable_req; |
1468 | struct bfa_timeval_s tv; | 1505 | struct timeval tv; |
1469 | 1506 | ||
1470 | bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ, | 1507 | bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ, |
1471 | bfa_ioc_portid(ioc)); | 1508 | bfa_ioc_portid(ioc)); |
1472 | enable_req.ioc_class = ioc->ioc_mc; | 1509 | enable_req.ioc_class = ioc->ioc_mc; |
1473 | bfa_os_gettimeofday(&tv); | 1510 | do_gettimeofday(&tv); |
1474 | enable_req.tv_sec = be32_to_cpu(tv.tv_sec); | 1511 | enable_req.tv_sec = be32_to_cpu(tv.tv_sec); |
1475 | bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s)); | 1512 | bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s)); |
1476 | } | 1513 | } |
@@ -1504,7 +1541,6 @@ bfa_ioc_hb_check(void *cbarg) | |||
1504 | 1541 | ||
1505 | hb_count = readl(ioc->ioc_regs.heartbeat); | 1542 | hb_count = readl(ioc->ioc_regs.heartbeat); |
1506 | if (ioc->hb_count == hb_count) { | 1543 | if (ioc->hb_count == hb_count) { |
1507 | printk(KERN_CRIT "Firmware heartbeat failure at %d", hb_count); | ||
1508 | bfa_ioc_recover(ioc); | 1544 | bfa_ioc_recover(ioc); |
1509 | return; | 1545 | return; |
1510 | } else { | 1546 | } else { |
@@ -1522,13 +1558,6 @@ bfa_ioc_hb_monitor(struct bfa_ioc_s *ioc) | |||
1522 | bfa_hb_timer_start(ioc); | 1558 | bfa_hb_timer_start(ioc); |
1523 | } | 1559 | } |
1524 | 1560 | ||
1525 | static void | ||
1526 | bfa_ioc_hb_stop(struct bfa_ioc_s *ioc) | ||
1527 | { | ||
1528 | bfa_hb_timer_stop(ioc); | ||
1529 | } | ||
1530 | |||
1531 | |||
1532 | /* | 1561 | /* |
1533 | * Initiate a full firmware download. | 1562 | * Initiate a full firmware download. |
1534 | */ | 1563 | */ |
@@ -1550,8 +1579,8 @@ bfa_ioc_download_fw(struct bfa_ioc_s *ioc, u32 boot_type, | |||
1550 | bfa_trc(ioc, bfa_cb_image_get_size(BFA_IOC_FWIMG_TYPE(ioc))); | 1579 | bfa_trc(ioc, bfa_cb_image_get_size(BFA_IOC_FWIMG_TYPE(ioc))); |
1551 | fwimg = bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), chunkno); | 1580 | fwimg = bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), chunkno); |
1552 | 1581 | ||
1553 | pgnum = bfa_ioc_smem_pgnum(ioc, loff); | 1582 | pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, loff); |
1554 | pgoff = bfa_ioc_smem_pgoff(ioc, loff); | 1583 | pgoff = PSS_SMEM_PGOFF(loff); |
1555 | 1584 | ||
1556 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); | 1585 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); |
1557 | 1586 | ||
@@ -1581,7 +1610,8 @@ bfa_ioc_download_fw(struct bfa_ioc_s *ioc, u32 boot_type, | |||
1581 | } | 1610 | } |
1582 | } | 1611 | } |
1583 | 1612 | ||
1584 | writel(bfa_ioc_smem_pgnum(ioc, 0), ioc->ioc_regs.host_page_num_fn); | 1613 | writel(PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, 0), |
1614 | ioc->ioc_regs.host_page_num_fn); | ||
1585 | 1615 | ||
1586 | /* | 1616 | /* |
1587 | * Set boot type and boot param at the end. | 1617 | * Set boot type and boot param at the end. |
@@ -1592,11 +1622,6 @@ bfa_ioc_download_fw(struct bfa_ioc_s *ioc, u32 boot_type, | |||
1592 | swab32(boot_env)); | 1622 | swab32(boot_env)); |
1593 | } | 1623 | } |
1594 | 1624 | ||
1595 | static void | ||
1596 | bfa_ioc_reset(struct bfa_ioc_s *ioc, bfa_boolean_t force) | ||
1597 | { | ||
1598 | bfa_ioc_hwinit(ioc, force); | ||
1599 | } | ||
1600 | 1625 | ||
1601 | /* | 1626 | /* |
1602 | * Update BFA configuration from firmware configuration. | 1627 | * Update BFA configuration from firmware configuration. |
@@ -1683,12 +1708,13 @@ bfa_ioc_mbox_hbfail(struct bfa_ioc_s *ioc) | |||
1683 | static bfa_status_t | 1708 | static bfa_status_t |
1684 | bfa_ioc_smem_read(struct bfa_ioc_s *ioc, void *tbuf, u32 soff, u32 sz) | 1709 | bfa_ioc_smem_read(struct bfa_ioc_s *ioc, void *tbuf, u32 soff, u32 sz) |
1685 | { | 1710 | { |
1686 | u32 pgnum, loff, r32; | 1711 | u32 pgnum, loff; |
1712 | __be32 r32; | ||
1687 | int i, len; | 1713 | int i, len; |
1688 | u32 *buf = tbuf; | 1714 | u32 *buf = tbuf; |
1689 | 1715 | ||
1690 | pgnum = bfa_ioc_smem_pgnum(ioc, soff); | 1716 | pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, soff); |
1691 | loff = bfa_ioc_smem_pgoff(ioc, soff); | 1717 | loff = PSS_SMEM_PGOFF(soff); |
1692 | bfa_trc(ioc, pgnum); | 1718 | bfa_trc(ioc, pgnum); |
1693 | bfa_trc(ioc, loff); | 1719 | bfa_trc(ioc, loff); |
1694 | bfa_trc(ioc, sz); | 1720 | bfa_trc(ioc, sz); |
@@ -1719,11 +1745,12 @@ bfa_ioc_smem_read(struct bfa_ioc_s *ioc, void *tbuf, u32 soff, u32 sz) | |||
1719 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); | 1745 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); |
1720 | } | 1746 | } |
1721 | } | 1747 | } |
1722 | writel(bfa_ioc_smem_pgnum(ioc, 0), ioc->ioc_regs.host_page_num_fn); | 1748 | writel(PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, 0), |
1749 | ioc->ioc_regs.host_page_num_fn); | ||
1723 | /* | 1750 | /* |
1724 | * release semaphore. | 1751 | * release semaphore. |
1725 | */ | 1752 | */ |
1726 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_init_sem_reg); | 1753 | writel(1, ioc->ioc_regs.ioc_init_sem_reg); |
1727 | 1754 | ||
1728 | bfa_trc(ioc, pgnum); | 1755 | bfa_trc(ioc, pgnum); |
1729 | return BFA_STATUS_OK; | 1756 | return BFA_STATUS_OK; |
@@ -1742,8 +1769,8 @@ bfa_ioc_smem_clr(struct bfa_ioc_s *ioc, u32 soff, u32 sz) | |||
1742 | int i, len; | 1769 | int i, len; |
1743 | u32 pgnum, loff; | 1770 | u32 pgnum, loff; |
1744 | 1771 | ||
1745 | pgnum = bfa_ioc_smem_pgnum(ioc, soff); | 1772 | pgnum = PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, soff); |
1746 | loff = bfa_ioc_smem_pgoff(ioc, soff); | 1773 | loff = PSS_SMEM_PGOFF(soff); |
1747 | bfa_trc(ioc, pgnum); | 1774 | bfa_trc(ioc, pgnum); |
1748 | bfa_trc(ioc, loff); | 1775 | bfa_trc(ioc, loff); |
1749 | bfa_trc(ioc, sz); | 1776 | bfa_trc(ioc, sz); |
@@ -1773,35 +1800,38 @@ bfa_ioc_smem_clr(struct bfa_ioc_s *ioc, u32 soff, u32 sz) | |||
1773 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); | 1800 | writel(pgnum, ioc->ioc_regs.host_page_num_fn); |
1774 | } | 1801 | } |
1775 | } | 1802 | } |
1776 | writel(bfa_ioc_smem_pgnum(ioc, 0), ioc->ioc_regs.host_page_num_fn); | 1803 | writel(PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, 0), |
1804 | ioc->ioc_regs.host_page_num_fn); | ||
1777 | 1805 | ||
1778 | /* | 1806 | /* |
1779 | * release semaphore. | 1807 | * release semaphore. |
1780 | */ | 1808 | */ |
1781 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_init_sem_reg); | 1809 | writel(1, ioc->ioc_regs.ioc_init_sem_reg); |
1782 | bfa_trc(ioc, pgnum); | 1810 | bfa_trc(ioc, pgnum); |
1783 | return BFA_STATUS_OK; | 1811 | return BFA_STATUS_OK; |
1784 | } | 1812 | } |
1785 | 1813 | ||
1786 | /* | ||
1787 | * hal iocpf to ioc interface | ||
1788 | */ | ||
1789 | static void | 1814 | static void |
1790 | bfa_ioc_pf_enabled(struct bfa_ioc_s *ioc) | 1815 | bfa_ioc_fail_notify(struct bfa_ioc_s *ioc) |
1791 | { | 1816 | { |
1792 | bfa_fsm_send_event(ioc, IOC_E_ENABLED); | 1817 | struct list_head *qe; |
1793 | } | 1818 | struct bfa_ioc_hbfail_notify_s *notify; |
1819 | struct bfad_s *bfad = (struct bfad_s *)ioc->bfa->bfad; | ||
1794 | 1820 | ||
1795 | static void | 1821 | /* |
1796 | bfa_ioc_pf_disabled(struct bfa_ioc_s *ioc) | 1822 | * Notify driver and common modules registered for notification. |
1797 | { | 1823 | */ |
1798 | bfa_fsm_send_event(ioc, IOC_E_DISABLED); | 1824 | ioc->cbfn->hbfail_cbfn(ioc->bfa); |
1799 | } | 1825 | list_for_each(qe, &ioc->hb_notify_q) { |
1826 | notify = (struct bfa_ioc_hbfail_notify_s *) qe; | ||
1827 | notify->cbfn(notify->cbarg); | ||
1828 | } | ||
1829 | |||
1830 | bfa_ioc_debug_save_ftrc(ioc); | ||
1831 | |||
1832 | BFA_LOG(KERN_CRIT, bfad, bfa_log_level, | ||
1833 | "Heart Beat of IOC has failed\n"); | ||
1800 | 1834 | ||
1801 | static void | ||
1802 | bfa_ioc_pf_failed(struct bfa_ioc_s *ioc) | ||
1803 | { | ||
1804 | bfa_fsm_send_event(ioc, IOC_E_FAILED); | ||
1805 | } | 1835 | } |
1806 | 1836 | ||
1807 | static void | 1837 | static void |
@@ -1817,12 +1847,6 @@ bfa_ioc_pf_fwmismatch(struct bfa_ioc_s *ioc) | |||
1817 | "with the driver version\n"); | 1847 | "with the driver version\n"); |
1818 | } | 1848 | } |
1819 | 1849 | ||
1820 | |||
1821 | |||
1822 | /* | ||
1823 | * hal_ioc_public | ||
1824 | */ | ||
1825 | |||
1826 | bfa_status_t | 1850 | bfa_status_t |
1827 | bfa_ioc_pll_init(struct bfa_ioc_s *ioc) | 1851 | bfa_ioc_pll_init(struct bfa_ioc_s *ioc) |
1828 | { | 1852 | { |
@@ -1838,7 +1862,7 @@ bfa_ioc_pll_init(struct bfa_ioc_s *ioc) | |||
1838 | /* | 1862 | /* |
1839 | * release semaphore. | 1863 | * release semaphore. |
1840 | */ | 1864 | */ |
1841 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_init_sem_reg); | 1865 | writel(1, ioc->ioc_regs.ioc_init_sem_reg); |
1842 | 1866 | ||
1843 | return BFA_STATUS_OK; | 1867 | return BFA_STATUS_OK; |
1844 | } | 1868 | } |
@@ -1909,7 +1933,7 @@ bfa_ioc_is_initialized(struct bfa_ioc_s *ioc) | |||
1909 | void | 1933 | void |
1910 | bfa_ioc_msgget(struct bfa_ioc_s *ioc, void *mbmsg) | 1934 | bfa_ioc_msgget(struct bfa_ioc_s *ioc, void *mbmsg) |
1911 | { | 1935 | { |
1912 | u32 *msgp = mbmsg; | 1936 | __be32 *msgp = mbmsg; |
1913 | u32 r32; | 1937 | u32 r32; |
1914 | int i; | 1938 | int i; |
1915 | 1939 | ||
@@ -1962,7 +1986,7 @@ bfa_ioc_isr(struct bfa_ioc_s *ioc, struct bfi_mbmsg_s *m) | |||
1962 | 1986 | ||
1963 | default: | 1987 | default: |
1964 | bfa_trc(ioc, msg->mh.msg_id); | 1988 | bfa_trc(ioc, msg->mh.msg_id); |
1965 | bfa_assert(0); | 1989 | WARN_ON(1); |
1966 | } | 1990 | } |
1967 | } | 1991 | } |
1968 | 1992 | ||
@@ -2043,15 +2067,6 @@ bfa_ioc_mem_claim(struct bfa_ioc_s *ioc, u8 *dm_kva, u64 dm_pa) | |||
2043 | ioc->attr = (struct bfi_ioc_attr_s *) dm_kva; | 2067 | ioc->attr = (struct bfi_ioc_attr_s *) dm_kva; |
2044 | } | 2068 | } |
2045 | 2069 | ||
2046 | /* | ||
2047 | * Return size of dma memory required. | ||
2048 | */ | ||
2049 | u32 | ||
2050 | bfa_ioc_meminfo(void) | ||
2051 | { | ||
2052 | return BFA_ROUNDUP(sizeof(struct bfi_ioc_attr_s), BFA_DMA_ALIGN_SZ); | ||
2053 | } | ||
2054 | |||
2055 | void | 2070 | void |
2056 | bfa_ioc_enable(struct bfa_ioc_s *ioc) | 2071 | bfa_ioc_enable(struct bfa_ioc_s *ioc) |
2057 | { | 2072 | { |
@@ -2068,18 +2083,6 @@ bfa_ioc_disable(struct bfa_ioc_s *ioc) | |||
2068 | bfa_fsm_send_event(ioc, IOC_E_DISABLE); | 2083 | bfa_fsm_send_event(ioc, IOC_E_DISABLE); |
2069 | } | 2084 | } |
2070 | 2085 | ||
2071 | /* | ||
2072 | * Returns memory required for saving firmware trace in case of crash. | ||
2073 | * Driver must call this interface to allocate memory required for | ||
2074 | * automatic saving of firmware trace. Driver should call | ||
2075 | * bfa_ioc_debug_memclaim() right after bfa_ioc_attach() to setup this | ||
2076 | * trace memory. | ||
2077 | */ | ||
2078 | int | ||
2079 | bfa_ioc_debug_trcsz(bfa_boolean_t auto_recover) | ||
2080 | { | ||
2081 | return (auto_recover) ? BFA_DBG_FWTRC_LEN : 0; | ||
2082 | } | ||
2083 | 2086 | ||
2084 | /* | 2087 | /* |
2085 | * Initialize memory for saving firmware trace. Driver must initialize | 2088 | * Initialize memory for saving firmware trace. Driver must initialize |
@@ -2089,19 +2092,7 @@ void | |||
2089 | bfa_ioc_debug_memclaim(struct bfa_ioc_s *ioc, void *dbg_fwsave) | 2092 | bfa_ioc_debug_memclaim(struct bfa_ioc_s *ioc, void *dbg_fwsave) |
2090 | { | 2093 | { |
2091 | ioc->dbg_fwsave = dbg_fwsave; | 2094 | ioc->dbg_fwsave = dbg_fwsave; |
2092 | ioc->dbg_fwsave_len = bfa_ioc_debug_trcsz(ioc->iocpf.auto_recover); | 2095 | ioc->dbg_fwsave_len = (ioc->iocpf.auto_recover) ? BFA_DBG_FWTRC_LEN : 0; |
2093 | } | ||
2094 | |||
2095 | u32 | ||
2096 | bfa_ioc_smem_pgnum(struct bfa_ioc_s *ioc, u32 fmaddr) | ||
2097 | { | ||
2098 | return PSS_SMEM_PGNUM(ioc->ioc_regs.smem_pg0, fmaddr); | ||
2099 | } | ||
2100 | |||
2101 | u32 | ||
2102 | bfa_ioc_smem_pgoff(struct bfa_ioc_s *ioc, u32 fmaddr) | ||
2103 | { | ||
2104 | return PSS_SMEM_PGOFF(fmaddr); | ||
2105 | } | 2096 | } |
2106 | 2097 | ||
2107 | /* | 2098 | /* |
@@ -2265,14 +2256,13 @@ bfa_ioc_adapter_is_disabled(struct bfa_ioc_s *ioc) | |||
2265 | } | 2256 | } |
2266 | 2257 | ||
2267 | /* | 2258 | /* |
2268 | * Add to IOC heartbeat failure notification queue. To be used by common | 2259 | * Reset IOC fwstate registers. |
2269 | * modules such as cee, port, diag. | ||
2270 | */ | 2260 | */ |
2271 | void | 2261 | void |
2272 | bfa_ioc_hbfail_register(struct bfa_ioc_s *ioc, | 2262 | bfa_ioc_reset_fwstate(struct bfa_ioc_s *ioc) |
2273 | struct bfa_ioc_hbfail_notify_s *notify) | ||
2274 | { | 2263 | { |
2275 | list_add_tail(¬ify->qe, &ioc->hb_notify_q); | 2264 | writel(BFI_IOC_UNINIT, ioc->ioc_regs.ioc_fwstate); |
2265 | writel(BFI_IOC_UNINIT, ioc->ioc_regs.alt_ioc_fwstate); | ||
2276 | } | 2266 | } |
2277 | 2267 | ||
2278 | #define BFA_MFG_NAME "Brocade" | 2268 | #define BFA_MFG_NAME "Brocade" |
@@ -2306,7 +2296,7 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, | |||
2306 | else | 2296 | else |
2307 | ad_attr->prototype = 0; | 2297 | ad_attr->prototype = 0; |
2308 | 2298 | ||
2309 | ad_attr->pwwn = bfa_ioc_get_pwwn(ioc); | 2299 | ad_attr->pwwn = ioc->attr->pwwn; |
2310 | ad_attr->mac = bfa_ioc_get_mac(ioc); | 2300 | ad_attr->mac = bfa_ioc_get_mac(ioc); |
2311 | 2301 | ||
2312 | ad_attr->pcie_gen = ioc_attr->pcie_gen; | 2302 | ad_attr->pcie_gen = ioc_attr->pcie_gen; |
@@ -2317,7 +2307,8 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, | |||
2317 | bfa_ioc_get_pci_chip_rev(ioc, ad_attr->hw_ver); | 2307 | bfa_ioc_get_pci_chip_rev(ioc, ad_attr->hw_ver); |
2318 | 2308 | ||
2319 | ad_attr->cna_capable = ioc->cna; | 2309 | ad_attr->cna_capable = ioc->cna; |
2320 | ad_attr->trunk_capable = (ad_attr->nports > 1) && !ioc->cna; | 2310 | ad_attr->trunk_capable = (ad_attr->nports > 1) && !ioc->cna && |
2311 | !ad_attr->is_mezz; | ||
2321 | } | 2312 | } |
2322 | 2313 | ||
2323 | enum bfa_ioc_type_e | 2314 | enum bfa_ioc_type_e |
@@ -2330,7 +2321,7 @@ bfa_ioc_get_type(struct bfa_ioc_s *ioc) | |||
2330 | else if (ioc->ioc_mc == BFI_MC_LL) | 2321 | else if (ioc->ioc_mc == BFI_MC_LL) |
2331 | return BFA_IOC_TYPE_LL; | 2322 | return BFA_IOC_TYPE_LL; |
2332 | else { | 2323 | else { |
2333 | bfa_assert(ioc->ioc_mc == BFI_MC_LL); | 2324 | WARN_ON(ioc->ioc_mc != BFI_MC_LL); |
2334 | return BFA_IOC_TYPE_LL; | 2325 | return BFA_IOC_TYPE_LL; |
2335 | } | 2326 | } |
2336 | } | 2327 | } |
@@ -2354,7 +2345,7 @@ bfa_ioc_get_adapter_fw_ver(struct bfa_ioc_s *ioc, char *fw_ver) | |||
2354 | void | 2345 | void |
2355 | bfa_ioc_get_pci_chip_rev(struct bfa_ioc_s *ioc, char *chip_rev) | 2346 | bfa_ioc_get_pci_chip_rev(struct bfa_ioc_s *ioc, char *chip_rev) |
2356 | { | 2347 | { |
2357 | bfa_assert(chip_rev); | 2348 | WARN_ON(!chip_rev); |
2358 | 2349 | ||
2359 | memset((void *)chip_rev, 0, BFA_IOC_CHIP_REV_LEN); | 2350 | memset((void *)chip_rev, 0, BFA_IOC_CHIP_REV_LEN); |
2360 | 2351 | ||
@@ -2386,7 +2377,7 @@ bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model) | |||
2386 | { | 2377 | { |
2387 | struct bfi_ioc_attr_s *ioc_attr; | 2378 | struct bfi_ioc_attr_s *ioc_attr; |
2388 | 2379 | ||
2389 | bfa_assert(model); | 2380 | WARN_ON(!model); |
2390 | memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN); | 2381 | memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN); |
2391 | 2382 | ||
2392 | ioc_attr = ioc->attr; | 2383 | ioc_attr = ioc->attr; |
@@ -2455,27 +2446,6 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr) | |||
2455 | bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev); | 2446 | bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev); |
2456 | } | 2447 | } |
2457 | 2448 | ||
2458 | /* | ||
2459 | * hal_wwn_public | ||
2460 | */ | ||
2461 | wwn_t | ||
2462 | bfa_ioc_get_pwwn(struct bfa_ioc_s *ioc) | ||
2463 | { | ||
2464 | return ioc->attr->pwwn; | ||
2465 | } | ||
2466 | |||
2467 | wwn_t | ||
2468 | bfa_ioc_get_nwwn(struct bfa_ioc_s *ioc) | ||
2469 | { | ||
2470 | return ioc->attr->nwwn; | ||
2471 | } | ||
2472 | |||
2473 | u64 | ||
2474 | bfa_ioc_get_adid(struct bfa_ioc_s *ioc) | ||
2475 | { | ||
2476 | return ioc->attr->mfg_pwwn; | ||
2477 | } | ||
2478 | |||
2479 | mac_t | 2449 | mac_t |
2480 | bfa_ioc_get_mac(struct bfa_ioc_s *ioc) | 2450 | bfa_ioc_get_mac(struct bfa_ioc_s *ioc) |
2481 | { | 2451 | { |
@@ -2488,18 +2458,6 @@ bfa_ioc_get_mac(struct bfa_ioc_s *ioc) | |||
2488 | return ioc->attr->mac; | 2458 | return ioc->attr->mac; |
2489 | } | 2459 | } |
2490 | 2460 | ||
2491 | wwn_t | ||
2492 | bfa_ioc_get_mfg_pwwn(struct bfa_ioc_s *ioc) | ||
2493 | { | ||
2494 | return ioc->attr->mfg_pwwn; | ||
2495 | } | ||
2496 | |||
2497 | wwn_t | ||
2498 | bfa_ioc_get_mfg_nwwn(struct bfa_ioc_s *ioc) | ||
2499 | { | ||
2500 | return ioc->attr->mfg_nwwn; | ||
2501 | } | ||
2502 | |||
2503 | mac_t | 2461 | mac_t |
2504 | bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc) | 2462 | bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc) |
2505 | { | 2463 | { |
@@ -2541,14 +2499,6 @@ bfa_ioc_debug_fwsave(struct bfa_ioc_s *ioc, void *trcdata, int *trclen) | |||
2541 | return BFA_STATUS_OK; | 2499 | return BFA_STATUS_OK; |
2542 | } | 2500 | } |
2543 | 2501 | ||
2544 | /* | ||
2545 | * Clear saved firmware trace | ||
2546 | */ | ||
2547 | void | ||
2548 | bfa_ioc_debug_fwsave_clear(struct bfa_ioc_s *ioc) | ||
2549 | { | ||
2550 | ioc->dbg_fwsave_once = BFA_TRUE; | ||
2551 | } | ||
2552 | 2502 | ||
2553 | /* | 2503 | /* |
2554 | * Retrieve saved firmware trace from a prior IOC failure. | 2504 | * Retrieve saved firmware trace from a prior IOC failure. |
@@ -2701,13 +2651,16 @@ bfa_ioc_fw_stats_clear(struct bfa_ioc_s *ioc) | |||
2701 | * Save firmware trace if configured. | 2651 | * Save firmware trace if configured. |
2702 | */ | 2652 | */ |
2703 | static void | 2653 | static void |
2704 | bfa_ioc_debug_save(struct bfa_ioc_s *ioc) | 2654 | bfa_ioc_debug_save_ftrc(struct bfa_ioc_s *ioc) |
2705 | { | 2655 | { |
2706 | int tlen; | 2656 | int tlen; |
2707 | 2657 | ||
2708 | if (ioc->dbg_fwsave_len) { | 2658 | if (ioc->dbg_fwsave_once) { |
2709 | tlen = ioc->dbg_fwsave_len; | 2659 | ioc->dbg_fwsave_once = BFA_FALSE; |
2710 | bfa_ioc_debug_fwtrc(ioc, ioc->dbg_fwsave, &tlen); | 2660 | if (ioc->dbg_fwsave_len) { |
2661 | tlen = ioc->dbg_fwsave_len; | ||
2662 | bfa_ioc_debug_fwtrc(ioc, ioc->dbg_fwsave, &tlen); | ||
2663 | } | ||
2711 | } | 2664 | } |
2712 | } | 2665 | } |
2713 | 2666 | ||
@@ -2717,11 +2670,6 @@ bfa_ioc_debug_save(struct bfa_ioc_s *ioc) | |||
2717 | static void | 2670 | static void |
2718 | bfa_ioc_recover(struct bfa_ioc_s *ioc) | 2671 | bfa_ioc_recover(struct bfa_ioc_s *ioc) |
2719 | { | 2672 | { |
2720 | if (ioc->dbg_fwsave_once) { | ||
2721 | ioc->dbg_fwsave_once = BFA_FALSE; | ||
2722 | bfa_ioc_debug_save(ioc); | ||
2723 | } | ||
2724 | |||
2725 | bfa_ioc_stats(ioc, ioc_hbfails); | 2673 | bfa_ioc_stats(ioc, ioc_hbfails); |
2726 | bfa_fsm_send_event(ioc, IOC_E_HBFAIL); | 2674 | bfa_fsm_send_event(ioc, IOC_E_HBFAIL); |
2727 | } | 2675 | } |
@@ -2734,45 +2682,8 @@ bfa_ioc_check_attr_wwns(struct bfa_ioc_s *ioc) | |||
2734 | } | 2682 | } |
2735 | 2683 | ||
2736 | /* | 2684 | /* |
2737 | * hal_iocpf_pvt BFA IOC PF private functions | 2685 | * BFA IOC PF private functions |
2738 | */ | 2686 | */ |
2739 | |||
2740 | static void | ||
2741 | bfa_iocpf_enable(struct bfa_ioc_s *ioc) | ||
2742 | { | ||
2743 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_ENABLE); | ||
2744 | } | ||
2745 | |||
2746 | static void | ||
2747 | bfa_iocpf_disable(struct bfa_ioc_s *ioc) | ||
2748 | { | ||
2749 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_DISABLE); | ||
2750 | } | ||
2751 | |||
2752 | static void | ||
2753 | bfa_iocpf_fail(struct bfa_ioc_s *ioc) | ||
2754 | { | ||
2755 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_FAIL); | ||
2756 | } | ||
2757 | |||
2758 | static void | ||
2759 | bfa_iocpf_initfail(struct bfa_ioc_s *ioc) | ||
2760 | { | ||
2761 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_INITFAIL); | ||
2762 | } | ||
2763 | |||
2764 | static void | ||
2765 | bfa_iocpf_getattrfail(struct bfa_ioc_s *ioc) | ||
2766 | { | ||
2767 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_GETATTRFAIL); | ||
2768 | } | ||
2769 | |||
2770 | static void | ||
2771 | bfa_iocpf_stop(struct bfa_ioc_s *ioc) | ||
2772 | { | ||
2773 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_STOP); | ||
2774 | } | ||
2775 | |||
2776 | static void | 2687 | static void |
2777 | bfa_iocpf_timeout(void *ioc_arg) | 2688 | bfa_iocpf_timeout(void *ioc_arg) |
2778 | { | 2689 | { |
@@ -2794,12 +2705,6 @@ bfa_iocpf_sem_timeout(void *ioc_arg) | |||
2794 | * bfa timer function | 2705 | * bfa timer function |
2795 | */ | 2706 | */ |
2796 | void | 2707 | void |
2797 | bfa_timer_init(struct bfa_timer_mod_s *mod) | ||
2798 | { | ||
2799 | INIT_LIST_HEAD(&mod->timer_q); | ||
2800 | } | ||
2801 | |||
2802 | void | ||
2803 | bfa_timer_beat(struct bfa_timer_mod_s *mod) | 2708 | bfa_timer_beat(struct bfa_timer_mod_s *mod) |
2804 | { | 2709 | { |
2805 | struct list_head *qh = &mod->timer_q; | 2710 | struct list_head *qh = &mod->timer_q; |
@@ -2843,8 +2748,8 @@ bfa_timer_begin(struct bfa_timer_mod_s *mod, struct bfa_timer_s *timer, | |||
2843 | void (*timercb) (void *), void *arg, unsigned int timeout) | 2748 | void (*timercb) (void *), void *arg, unsigned int timeout) |
2844 | { | 2749 | { |
2845 | 2750 | ||
2846 | bfa_assert(timercb != NULL); | 2751 | WARN_ON(timercb == NULL); |
2847 | bfa_assert(!bfa_q_is_on_q(&mod->timer_q, timer)); | 2752 | WARN_ON(bfa_q_is_on_q(&mod->timer_q, timer)); |
2848 | 2753 | ||
2849 | timer->timeout = timeout; | 2754 | timer->timeout = timeout; |
2850 | timer->timercb = timercb; | 2755 | timer->timercb = timercb; |
@@ -2859,7 +2764,7 @@ bfa_timer_begin(struct bfa_timer_mod_s *mod, struct bfa_timer_s *timer, | |||
2859 | void | 2764 | void |
2860 | bfa_timer_stop(struct bfa_timer_s *timer) | 2765 | bfa_timer_stop(struct bfa_timer_s *timer) |
2861 | { | 2766 | { |
2862 | bfa_assert(!list_empty(&timer->qe)); | 2767 | WARN_ON(list_empty(&timer->qe)); |
2863 | 2768 | ||
2864 | list_del(&timer->qe); | 2769 | list_del(&timer->qe); |
2865 | } | 2770 | } |
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index 9c407a87a1a..ec9cf08b0e7 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h | |||
@@ -18,10 +18,15 @@ | |||
18 | #ifndef __BFA_IOC_H__ | 18 | #ifndef __BFA_IOC_H__ |
19 | #define __BFA_IOC_H__ | 19 | #define __BFA_IOC_H__ |
20 | 20 | ||
21 | #include "bfa_os_inc.h" | 21 | #include "bfad_drv.h" |
22 | #include "bfa_cs.h" | 22 | #include "bfa_cs.h" |
23 | #include "bfi.h" | 23 | #include "bfi.h" |
24 | 24 | ||
25 | #define BFA_DBG_FWTRC_ENTS (BFI_IOC_TRC_ENTS) | ||
26 | #define BFA_DBG_FWTRC_LEN \ | ||
27 | (BFA_DBG_FWTRC_ENTS * sizeof(struct bfa_trc_s) + \ | ||
28 | (sizeof(struct bfa_trc_mod_s) - \ | ||
29 | BFA_TRC_MAX * sizeof(struct bfa_trc_s))) | ||
25 | /* | 30 | /* |
26 | * BFA timer declarations | 31 | * BFA timer declarations |
27 | */ | 32 | */ |
@@ -47,7 +52,6 @@ struct bfa_timer_mod_s { | |||
47 | #define BFA_TIMER_FREQ 200 /* specified in millisecs */ | 52 | #define BFA_TIMER_FREQ 200 /* specified in millisecs */ |
48 | 53 | ||
49 | void bfa_timer_beat(struct bfa_timer_mod_s *mod); | 54 | void bfa_timer_beat(struct bfa_timer_mod_s *mod); |
50 | void bfa_timer_init(struct bfa_timer_mod_s *mod); | ||
51 | void bfa_timer_begin(struct bfa_timer_mod_s *mod, struct bfa_timer_s *timer, | 55 | void bfa_timer_begin(struct bfa_timer_mod_s *mod, struct bfa_timer_s *timer, |
52 | bfa_timer_cbfn_t timercb, void *arg, | 56 | bfa_timer_cbfn_t timercb, void *arg, |
53 | unsigned int timeout); | 57 | unsigned int timeout); |
@@ -70,7 +74,7 @@ struct bfa_sge_s { | |||
70 | #define bfa_swap_words(_x) ( \ | 74 | #define bfa_swap_words(_x) ( \ |
71 | ((_x) << 32) | ((_x) >> 32)) | 75 | ((_x) << 32) | ((_x) >> 32)) |
72 | 76 | ||
73 | #ifdef __BIGENDIAN | 77 | #ifdef __BIG_ENDIAN |
74 | #define bfa_sge_to_be(_x) | 78 | #define bfa_sge_to_be(_x) |
75 | #define bfa_sge_to_le(_x) bfa_sge_word_swap(_x) | 79 | #define bfa_sge_to_le(_x) bfa_sge_word_swap(_x) |
76 | #define bfa_sgaddr_le(_x) bfa_swap_words(_x) | 80 | #define bfa_sgaddr_le(_x) bfa_swap_words(_x) |
@@ -115,8 +119,8 @@ struct bfa_dma_s { | |||
115 | static inline void | 119 | static inline void |
116 | __bfa_dma_addr_set(union bfi_addr_u *dma_addr, u64 pa) | 120 | __bfa_dma_addr_set(union bfi_addr_u *dma_addr, u64 pa) |
117 | { | 121 | { |
118 | dma_addr->a32.addr_lo = (u32) pa; | 122 | dma_addr->a32.addr_lo = (__be32) pa; |
119 | dma_addr->a32.addr_hi = (u32) (bfa_os_u32(pa)); | 123 | dma_addr->a32.addr_hi = (__be32) (pa >> 32); |
120 | } | 124 | } |
121 | 125 | ||
122 | 126 | ||
@@ -125,8 +129,8 @@ __bfa_dma_addr_set(union bfi_addr_u *dma_addr, u64 pa) | |||
125 | static inline void | 129 | static inline void |
126 | __bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa) | 130 | __bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa) |
127 | { | 131 | { |
128 | dma_addr->a32.addr_lo = (u32) cpu_to_be32(pa); | 132 | dma_addr->a32.addr_lo = cpu_to_be32(pa); |
129 | dma_addr->a32.addr_hi = (u32) cpu_to_be32(bfa_os_u32(pa)); | 133 | dma_addr->a32.addr_hi = cpu_to_be32(pa >> 32); |
130 | } | 134 | } |
131 | 135 | ||
132 | struct bfa_ioc_regs_s { | 136 | struct bfa_ioc_regs_s { |
@@ -145,8 +149,11 @@ struct bfa_ioc_regs_s { | |||
145 | void __iomem *host_page_num_fn; | 149 | void __iomem *host_page_num_fn; |
146 | void __iomem *heartbeat; | 150 | void __iomem *heartbeat; |
147 | void __iomem *ioc_fwstate; | 151 | void __iomem *ioc_fwstate; |
152 | void __iomem *alt_ioc_fwstate; | ||
148 | void __iomem *ll_halt; | 153 | void __iomem *ll_halt; |
154 | void __iomem *alt_ll_halt; | ||
149 | void __iomem *err_set; | 155 | void __iomem *err_set; |
156 | void __iomem *ioc_fail_sync; | ||
150 | void __iomem *shirq_isr_next; | 157 | void __iomem *shirq_isr_next; |
151 | void __iomem *shirq_msk_next; | 158 | void __iomem *shirq_msk_next; |
152 | void __iomem *smem_page_start; | 159 | void __iomem *smem_page_start; |
@@ -254,8 +261,12 @@ struct bfa_ioc_hwif_s { | |||
254 | void (*ioc_map_port) (struct bfa_ioc_s *ioc); | 261 | void (*ioc_map_port) (struct bfa_ioc_s *ioc); |
255 | void (*ioc_isr_mode_set) (struct bfa_ioc_s *ioc, | 262 | void (*ioc_isr_mode_set) (struct bfa_ioc_s *ioc, |
256 | bfa_boolean_t msix); | 263 | bfa_boolean_t msix); |
257 | void (*ioc_notify_hbfail) (struct bfa_ioc_s *ioc); | 264 | void (*ioc_notify_fail) (struct bfa_ioc_s *ioc); |
258 | void (*ioc_ownership_reset) (struct bfa_ioc_s *ioc); | 265 | void (*ioc_ownership_reset) (struct bfa_ioc_s *ioc); |
266 | void (*ioc_sync_join) (struct bfa_ioc_s *ioc); | ||
267 | void (*ioc_sync_leave) (struct bfa_ioc_s *ioc); | ||
268 | void (*ioc_sync_ack) (struct bfa_ioc_s *ioc); | ||
269 | bfa_boolean_t (*ioc_sync_complete) (struct bfa_ioc_s *ioc); | ||
259 | }; | 270 | }; |
260 | 271 | ||
261 | #define bfa_ioc_pcifn(__ioc) ((__ioc)->pcidev.pci_func) | 272 | #define bfa_ioc_pcifn(__ioc) ((__ioc)->pcidev.pci_func) |
@@ -325,7 +336,6 @@ void bfa_ioc_auto_recover(bfa_boolean_t auto_recover); | |||
325 | void bfa_ioc_detach(struct bfa_ioc_s *ioc); | 336 | void bfa_ioc_detach(struct bfa_ioc_s *ioc); |
326 | void bfa_ioc_pci_init(struct bfa_ioc_s *ioc, struct bfa_pcidev_s *pcidev, | 337 | void bfa_ioc_pci_init(struct bfa_ioc_s *ioc, struct bfa_pcidev_s *pcidev, |
327 | enum bfi_mclass mc); | 338 | enum bfi_mclass mc); |
328 | u32 bfa_ioc_meminfo(void); | ||
329 | void bfa_ioc_mem_claim(struct bfa_ioc_s *ioc, u8 *dm_kva, u64 dm_pa); | 339 | void bfa_ioc_mem_claim(struct bfa_ioc_s *ioc, u8 *dm_kva, u64 dm_pa); |
330 | void bfa_ioc_enable(struct bfa_ioc_s *ioc); | 340 | void bfa_ioc_enable(struct bfa_ioc_s *ioc); |
331 | void bfa_ioc_disable(struct bfa_ioc_s *ioc); | 341 | void bfa_ioc_disable(struct bfa_ioc_s *ioc); |
@@ -340,6 +350,7 @@ bfa_boolean_t bfa_ioc_is_initialized(struct bfa_ioc_s *ioc); | |||
340 | bfa_boolean_t bfa_ioc_is_disabled(struct bfa_ioc_s *ioc); | 350 | bfa_boolean_t bfa_ioc_is_disabled(struct bfa_ioc_s *ioc); |
341 | bfa_boolean_t bfa_ioc_fw_mismatch(struct bfa_ioc_s *ioc); | 351 | bfa_boolean_t bfa_ioc_fw_mismatch(struct bfa_ioc_s *ioc); |
342 | bfa_boolean_t bfa_ioc_adapter_is_disabled(struct bfa_ioc_s *ioc); | 352 | bfa_boolean_t bfa_ioc_adapter_is_disabled(struct bfa_ioc_s *ioc); |
353 | void bfa_ioc_reset_fwstate(struct bfa_ioc_s *ioc); | ||
343 | enum bfa_ioc_type_e bfa_ioc_get_type(struct bfa_ioc_s *ioc); | 354 | enum bfa_ioc_type_e bfa_ioc_get_type(struct bfa_ioc_s *ioc); |
344 | void bfa_ioc_get_adapter_serial_num(struct bfa_ioc_s *ioc, char *serial_num); | 355 | void bfa_ioc_get_adapter_serial_num(struct bfa_ioc_s *ioc, char *serial_num); |
345 | void bfa_ioc_get_adapter_fw_ver(struct bfa_ioc_s *ioc, char *fw_ver); | 356 | void bfa_ioc_get_adapter_fw_ver(struct bfa_ioc_s *ioc, char *fw_ver); |
@@ -353,24 +364,16 @@ enum bfa_ioc_state bfa_ioc_get_state(struct bfa_ioc_s *ioc); | |||
353 | void bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr); | 364 | void bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr); |
354 | void bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, | 365 | void bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, |
355 | struct bfa_adapter_attr_s *ad_attr); | 366 | struct bfa_adapter_attr_s *ad_attr); |
356 | int bfa_ioc_debug_trcsz(bfa_boolean_t auto_recover); | ||
357 | void bfa_ioc_debug_memclaim(struct bfa_ioc_s *ioc, void *dbg_fwsave); | 367 | void bfa_ioc_debug_memclaim(struct bfa_ioc_s *ioc, void *dbg_fwsave); |
358 | bfa_status_t bfa_ioc_debug_fwsave(struct bfa_ioc_s *ioc, void *trcdata, | 368 | bfa_status_t bfa_ioc_debug_fwsave(struct bfa_ioc_s *ioc, void *trcdata, |
359 | int *trclen); | 369 | int *trclen); |
360 | void bfa_ioc_debug_fwsave_clear(struct bfa_ioc_s *ioc); | ||
361 | bfa_status_t bfa_ioc_debug_fwtrc(struct bfa_ioc_s *ioc, void *trcdata, | 370 | bfa_status_t bfa_ioc_debug_fwtrc(struct bfa_ioc_s *ioc, void *trcdata, |
362 | int *trclen); | 371 | int *trclen); |
363 | bfa_status_t bfa_ioc_debug_fwcore(struct bfa_ioc_s *ioc, void *buf, | 372 | bfa_status_t bfa_ioc_debug_fwcore(struct bfa_ioc_s *ioc, void *buf, |
364 | u32 *offset, int *buflen); | 373 | u32 *offset, int *buflen); |
365 | u32 bfa_ioc_smem_pgnum(struct bfa_ioc_s *ioc, u32 fmaddr); | ||
366 | u32 bfa_ioc_smem_pgoff(struct bfa_ioc_s *ioc, u32 fmaddr); | ||
367 | void bfa_ioc_set_fcmode(struct bfa_ioc_s *ioc); | 374 | void bfa_ioc_set_fcmode(struct bfa_ioc_s *ioc); |
368 | bfa_boolean_t bfa_ioc_get_fcmode(struct bfa_ioc_s *ioc); | 375 | bfa_boolean_t bfa_ioc_get_fcmode(struct bfa_ioc_s *ioc); |
369 | void bfa_ioc_hbfail_register(struct bfa_ioc_s *ioc, | ||
370 | struct bfa_ioc_hbfail_notify_s *notify); | ||
371 | bfa_boolean_t bfa_ioc_sem_get(void __iomem *sem_reg); | 376 | bfa_boolean_t bfa_ioc_sem_get(void __iomem *sem_reg); |
372 | void bfa_ioc_sem_release(void __iomem *sem_reg); | ||
373 | void bfa_ioc_hw_sem_release(struct bfa_ioc_s *ioc); | ||
374 | void bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, | 377 | void bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, |
375 | struct bfi_ioc_image_hdr_s *fwhdr); | 378 | struct bfi_ioc_image_hdr_s *fwhdr); |
376 | bfa_boolean_t bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc, | 379 | bfa_boolean_t bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc, |
@@ -381,13 +384,8 @@ bfa_status_t bfa_ioc_fw_stats_clear(struct bfa_ioc_s *ioc); | |||
381 | /* | 384 | /* |
382 | * bfa mfg wwn API functions | 385 | * bfa mfg wwn API functions |
383 | */ | 386 | */ |
384 | wwn_t bfa_ioc_get_pwwn(struct bfa_ioc_s *ioc); | ||
385 | wwn_t bfa_ioc_get_nwwn(struct bfa_ioc_s *ioc); | ||
386 | mac_t bfa_ioc_get_mac(struct bfa_ioc_s *ioc); | 387 | mac_t bfa_ioc_get_mac(struct bfa_ioc_s *ioc); |
387 | wwn_t bfa_ioc_get_mfg_pwwn(struct bfa_ioc_s *ioc); | ||
388 | wwn_t bfa_ioc_get_mfg_nwwn(struct bfa_ioc_s *ioc); | ||
389 | mac_t bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc); | 388 | mac_t bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc); |
390 | u64 bfa_ioc_get_adid(struct bfa_ioc_s *ioc); | ||
391 | 389 | ||
392 | /* | 390 | /* |
393 | * F/W Image Size & Chunk | 391 | * F/W Image Size & Chunk |
@@ -421,7 +419,7 @@ bfa_cb_image_get_chunk(int type, u32 off) | |||
421 | return bfi_image_ct_cna_get_chunk(off); break; | 419 | return bfi_image_ct_cna_get_chunk(off); break; |
422 | case BFI_IMAGE_CB_FC: | 420 | case BFI_IMAGE_CB_FC: |
423 | return bfi_image_cb_fc_get_chunk(off); break; | 421 | return bfi_image_cb_fc_get_chunk(off); break; |
424 | default: return 0; | 422 | default: return NULL; |
425 | } | 423 | } |
426 | } | 424 | } |
427 | 425 | ||
diff --git a/drivers/scsi/bfa/bfa_ioc_cb.c b/drivers/scsi/bfa/bfa_ioc_cb.c index 90994504385..e4a0713185b 100644 --- a/drivers/scsi/bfa/bfa_ioc_cb.c +++ b/drivers/scsi/bfa/bfa_ioc_cb.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | ||
18 | #include "bfa_ioc.h" | 19 | #include "bfa_ioc.h" |
19 | #include "bfi_cbreg.h" | 20 | #include "bfi_cbreg.h" |
20 | #include "bfa_defs.h" | 21 | #include "bfa_defs.h" |
@@ -29,10 +30,14 @@ static void bfa_ioc_cb_firmware_unlock(struct bfa_ioc_s *ioc); | |||
29 | static void bfa_ioc_cb_reg_init(struct bfa_ioc_s *ioc); | 30 | static void bfa_ioc_cb_reg_init(struct bfa_ioc_s *ioc); |
30 | static void bfa_ioc_cb_map_port(struct bfa_ioc_s *ioc); | 31 | static void bfa_ioc_cb_map_port(struct bfa_ioc_s *ioc); |
31 | static void bfa_ioc_cb_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); | 32 | static void bfa_ioc_cb_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); |
32 | static void bfa_ioc_cb_notify_hbfail(struct bfa_ioc_s *ioc); | 33 | static void bfa_ioc_cb_notify_fail(struct bfa_ioc_s *ioc); |
33 | static void bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc); | 34 | static void bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc); |
35 | static void bfa_ioc_cb_sync_join(struct bfa_ioc_s *ioc); | ||
36 | static void bfa_ioc_cb_sync_leave(struct bfa_ioc_s *ioc); | ||
37 | static void bfa_ioc_cb_sync_ack(struct bfa_ioc_s *ioc); | ||
38 | static bfa_boolean_t bfa_ioc_cb_sync_complete(struct bfa_ioc_s *ioc); | ||
34 | 39 | ||
35 | struct bfa_ioc_hwif_s hwif_cb; | 40 | static struct bfa_ioc_hwif_s hwif_cb; |
36 | 41 | ||
37 | /* | 42 | /* |
38 | * Called from bfa_ioc_attach() to map asic specific calls. | 43 | * Called from bfa_ioc_attach() to map asic specific calls. |
@@ -46,8 +51,12 @@ bfa_ioc_set_cb_hwif(struct bfa_ioc_s *ioc) | |||
46 | hwif_cb.ioc_reg_init = bfa_ioc_cb_reg_init; | 51 | hwif_cb.ioc_reg_init = bfa_ioc_cb_reg_init; |
47 | hwif_cb.ioc_map_port = bfa_ioc_cb_map_port; | 52 | hwif_cb.ioc_map_port = bfa_ioc_cb_map_port; |
48 | hwif_cb.ioc_isr_mode_set = bfa_ioc_cb_isr_mode_set; | 53 | hwif_cb.ioc_isr_mode_set = bfa_ioc_cb_isr_mode_set; |
49 | hwif_cb.ioc_notify_hbfail = bfa_ioc_cb_notify_hbfail; | 54 | hwif_cb.ioc_notify_fail = bfa_ioc_cb_notify_fail; |
50 | hwif_cb.ioc_ownership_reset = bfa_ioc_cb_ownership_reset; | 55 | hwif_cb.ioc_ownership_reset = bfa_ioc_cb_ownership_reset; |
56 | hwif_cb.ioc_sync_join = bfa_ioc_cb_sync_join; | ||
57 | hwif_cb.ioc_sync_leave = bfa_ioc_cb_sync_leave; | ||
58 | hwif_cb.ioc_sync_ack = bfa_ioc_cb_sync_ack; | ||
59 | hwif_cb.ioc_sync_complete = bfa_ioc_cb_sync_complete; | ||
51 | 60 | ||
52 | ioc->ioc_hwif = &hwif_cb; | 61 | ioc->ioc_hwif = &hwif_cb; |
53 | } | 62 | } |
@@ -58,6 +67,21 @@ bfa_ioc_set_cb_hwif(struct bfa_ioc_s *ioc) | |||
58 | static bfa_boolean_t | 67 | static bfa_boolean_t |
59 | bfa_ioc_cb_firmware_lock(struct bfa_ioc_s *ioc) | 68 | bfa_ioc_cb_firmware_lock(struct bfa_ioc_s *ioc) |
60 | { | 69 | { |
70 | struct bfi_ioc_image_hdr_s fwhdr; | ||
71 | uint32_t fwstate = readl(ioc->ioc_regs.ioc_fwstate); | ||
72 | |||
73 | if (fwstate == BFI_IOC_UNINIT) | ||
74 | return BFA_TRUE; | ||
75 | |||
76 | bfa_ioc_fwver_get(ioc, &fwhdr); | ||
77 | |||
78 | if (swab32(fwhdr.exec) == BFI_BOOT_TYPE_NORMAL) | ||
79 | return BFA_TRUE; | ||
80 | |||
81 | bfa_trc(ioc, fwstate); | ||
82 | bfa_trc(ioc, fwhdr.exec); | ||
83 | writel(BFI_IOC_UNINIT, ioc->ioc_regs.ioc_fwstate); | ||
84 | |||
61 | return BFA_TRUE; | 85 | return BFA_TRUE; |
62 | } | 86 | } |
63 | 87 | ||
@@ -70,7 +94,7 @@ bfa_ioc_cb_firmware_unlock(struct bfa_ioc_s *ioc) | |||
70 | * Notify other functions on HB failure. | 94 | * Notify other functions on HB failure. |
71 | */ | 95 | */ |
72 | static void | 96 | static void |
73 | bfa_ioc_cb_notify_hbfail(struct bfa_ioc_s *ioc) | 97 | bfa_ioc_cb_notify_fail(struct bfa_ioc_s *ioc) |
74 | { | 98 | { |
75 | writel(__PSS_ERR_STATUS_SET, ioc->ioc_regs.err_set); | 99 | writel(__PSS_ERR_STATUS_SET, ioc->ioc_regs.err_set); |
76 | readl(ioc->ioc_regs.err_set); | 100 | readl(ioc->ioc_regs.err_set); |
@@ -108,9 +132,11 @@ bfa_ioc_cb_reg_init(struct bfa_ioc_s *ioc) | |||
108 | if (ioc->port_id == 0) { | 132 | if (ioc->port_id == 0) { |
109 | ioc->ioc_regs.heartbeat = rb + BFA_IOC0_HBEAT_REG; | 133 | ioc->ioc_regs.heartbeat = rb + BFA_IOC0_HBEAT_REG; |
110 | ioc->ioc_regs.ioc_fwstate = rb + BFA_IOC0_STATE_REG; | 134 | ioc->ioc_regs.ioc_fwstate = rb + BFA_IOC0_STATE_REG; |
135 | ioc->ioc_regs.alt_ioc_fwstate = rb + BFA_IOC1_STATE_REG; | ||
111 | } else { | 136 | } else { |
112 | ioc->ioc_regs.heartbeat = (rb + BFA_IOC1_HBEAT_REG); | 137 | ioc->ioc_regs.heartbeat = (rb + BFA_IOC1_HBEAT_REG); |
113 | ioc->ioc_regs.ioc_fwstate = (rb + BFA_IOC1_STATE_REG); | 138 | ioc->ioc_regs.ioc_fwstate = (rb + BFA_IOC1_STATE_REG); |
139 | ioc->ioc_regs.alt_ioc_fwstate = (rb + BFA_IOC0_STATE_REG); | ||
114 | } | 140 | } |
115 | 141 | ||
116 | /* | 142 | /* |
@@ -181,10 +207,71 @@ bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc) | |||
181 | * will lock it instead of clearing it. | 207 | * will lock it instead of clearing it. |
182 | */ | 208 | */ |
183 | readl(ioc->ioc_regs.ioc_sem_reg); | 209 | readl(ioc->ioc_regs.ioc_sem_reg); |
184 | bfa_ioc_hw_sem_release(ioc); | 210 | writel(1, ioc->ioc_regs.ioc_sem_reg); |
185 | } | 211 | } |
186 | 212 | ||
213 | /* | ||
214 | * Synchronized IOC failure processing routines | ||
215 | */ | ||
216 | static void | ||
217 | bfa_ioc_cb_sync_join(struct bfa_ioc_s *ioc) | ||
218 | { | ||
219 | } | ||
187 | 220 | ||
221 | static void | ||
222 | bfa_ioc_cb_sync_leave(struct bfa_ioc_s *ioc) | ||
223 | { | ||
224 | } | ||
225 | |||
226 | static void | ||
227 | bfa_ioc_cb_sync_ack(struct bfa_ioc_s *ioc) | ||
228 | { | ||
229 | writel(BFI_IOC_FAIL, ioc->ioc_regs.ioc_fwstate); | ||
230 | } | ||
231 | |||
232 | static bfa_boolean_t | ||
233 | bfa_ioc_cb_sync_complete(struct bfa_ioc_s *ioc) | ||
234 | { | ||
235 | uint32_t fwstate, alt_fwstate; | ||
236 | fwstate = readl(ioc->ioc_regs.ioc_fwstate); | ||
237 | |||
238 | /* | ||
239 | * At this point, this IOC is hoding the hw sem in the | ||
240 | * start path (fwcheck) OR in the disable/enable path | ||
241 | * OR to check if the other IOC has acknowledged failure. | ||
242 | * | ||
243 | * So, this IOC can be in UNINIT, INITING, DISABLED, FAIL | ||
244 | * or in MEMTEST states. In a normal scenario, this IOC | ||
245 | * can not be in OP state when this function is called. | ||
246 | * | ||
247 | * However, this IOC could still be in OP state when | ||
248 | * the OS driver is starting up, if the OptROM code has | ||
249 | * left it in that state. | ||
250 | * | ||
251 | * If we had marked this IOC's fwstate as BFI_IOC_FAIL | ||
252 | * in the failure case and now, if the fwstate is not | ||
253 | * BFI_IOC_FAIL it implies that the other PCI fn have | ||
254 | * reinitialized the ASIC or this IOC got disabled, so | ||
255 | * return TRUE. | ||
256 | */ | ||
257 | if (fwstate == BFI_IOC_UNINIT || | ||
258 | fwstate == BFI_IOC_INITING || | ||
259 | fwstate == BFI_IOC_DISABLED || | ||
260 | fwstate == BFI_IOC_MEMTEST || | ||
261 | fwstate == BFI_IOC_OP) | ||
262 | return BFA_TRUE; | ||
263 | else { | ||
264 | alt_fwstate = readl(ioc->ioc_regs.alt_ioc_fwstate); | ||
265 | if (alt_fwstate == BFI_IOC_FAIL || | ||
266 | alt_fwstate == BFI_IOC_DISABLED || | ||
267 | alt_fwstate == BFI_IOC_UNINIT || | ||
268 | alt_fwstate == BFI_IOC_INITING || | ||
269 | alt_fwstate == BFI_IOC_MEMTEST) | ||
270 | return BFA_TRUE; | ||
271 | else | ||
272 | return BFA_FALSE; | ||
273 | } | ||
274 | } | ||
188 | 275 | ||
189 | bfa_status_t | 276 | bfa_status_t |
190 | bfa_ioc_cb_pll_init(void __iomem *rb, bfa_boolean_t fcmode) | 277 | bfa_ioc_cb_pll_init(void __iomem *rb, bfa_boolean_t fcmode) |
diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c index 115730c0aa7..008d129ddfc 100644 --- a/drivers/scsi/bfa/bfa_ioc_ct.c +++ b/drivers/scsi/bfa/bfa_ioc_ct.c | |||
@@ -15,12 +15,22 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | ||
18 | #include "bfa_ioc.h" | 19 | #include "bfa_ioc.h" |
19 | #include "bfi_ctreg.h" | 20 | #include "bfi_ctreg.h" |
20 | #include "bfa_defs.h" | 21 | #include "bfa_defs.h" |
21 | 22 | ||
22 | BFA_TRC_FILE(CNA, IOC_CT); | 23 | BFA_TRC_FILE(CNA, IOC_CT); |
23 | 24 | ||
25 | #define bfa_ioc_ct_sync_pos(__ioc) \ | ||
26 | ((uint32_t) (1 << bfa_ioc_pcifn(__ioc))) | ||
27 | #define BFA_IOC_SYNC_REQD_SH 16 | ||
28 | #define bfa_ioc_ct_get_sync_ackd(__val) (__val & 0x0000ffff) | ||
29 | #define bfa_ioc_ct_clear_sync_ackd(__val) (__val & 0xffff0000) | ||
30 | #define bfa_ioc_ct_get_sync_reqd(__val) (__val >> BFA_IOC_SYNC_REQD_SH) | ||
31 | #define bfa_ioc_ct_sync_reqd_pos(__ioc) \ | ||
32 | (bfa_ioc_ct_sync_pos(__ioc) << BFA_IOC_SYNC_REQD_SH) | ||
33 | |||
24 | /* | 34 | /* |
25 | * forward declarations | 35 | * forward declarations |
26 | */ | 36 | */ |
@@ -29,10 +39,14 @@ static void bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc); | |||
29 | static void bfa_ioc_ct_reg_init(struct bfa_ioc_s *ioc); | 39 | static void bfa_ioc_ct_reg_init(struct bfa_ioc_s *ioc); |
30 | static void bfa_ioc_ct_map_port(struct bfa_ioc_s *ioc); | 40 | static void bfa_ioc_ct_map_port(struct bfa_ioc_s *ioc); |
31 | static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); | 41 | static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); |
32 | static void bfa_ioc_ct_notify_hbfail(struct bfa_ioc_s *ioc); | 42 | static void bfa_ioc_ct_notify_fail(struct bfa_ioc_s *ioc); |
33 | static void bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc); | 43 | static void bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc); |
44 | static void bfa_ioc_ct_sync_join(struct bfa_ioc_s *ioc); | ||
45 | static void bfa_ioc_ct_sync_leave(struct bfa_ioc_s *ioc); | ||
46 | static void bfa_ioc_ct_sync_ack(struct bfa_ioc_s *ioc); | ||
47 | static bfa_boolean_t bfa_ioc_ct_sync_complete(struct bfa_ioc_s *ioc); | ||
34 | 48 | ||
35 | struct bfa_ioc_hwif_s hwif_ct; | 49 | static struct bfa_ioc_hwif_s hwif_ct; |
36 | 50 | ||
37 | /* | 51 | /* |
38 | * Called from bfa_ioc_attach() to map asic specific calls. | 52 | * Called from bfa_ioc_attach() to map asic specific calls. |
@@ -46,8 +60,12 @@ bfa_ioc_set_ct_hwif(struct bfa_ioc_s *ioc) | |||
46 | hwif_ct.ioc_reg_init = bfa_ioc_ct_reg_init; | 60 | hwif_ct.ioc_reg_init = bfa_ioc_ct_reg_init; |
47 | hwif_ct.ioc_map_port = bfa_ioc_ct_map_port; | 61 | hwif_ct.ioc_map_port = bfa_ioc_ct_map_port; |
48 | hwif_ct.ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set; | 62 | hwif_ct.ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set; |
49 | hwif_ct.ioc_notify_hbfail = bfa_ioc_ct_notify_hbfail; | 63 | hwif_ct.ioc_notify_fail = bfa_ioc_ct_notify_fail; |
50 | hwif_ct.ioc_ownership_reset = bfa_ioc_ct_ownership_reset; | 64 | hwif_ct.ioc_ownership_reset = bfa_ioc_ct_ownership_reset; |
65 | hwif_ct.ioc_sync_join = bfa_ioc_ct_sync_join; | ||
66 | hwif_ct.ioc_sync_leave = bfa_ioc_ct_sync_leave; | ||
67 | hwif_ct.ioc_sync_ack = bfa_ioc_ct_sync_ack; | ||
68 | hwif_ct.ioc_sync_complete = bfa_ioc_ct_sync_complete; | ||
51 | 69 | ||
52 | ioc->ioc_hwif = &hwif_ct; | 70 | ioc->ioc_hwif = &hwif_ct; |
53 | } | 71 | } |
@@ -83,7 +101,8 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) | |||
83 | */ | 101 | */ |
84 | if (usecnt == 0) { | 102 | if (usecnt == 0) { |
85 | writel(1, ioc->ioc_regs.ioc_usage_reg); | 103 | writel(1, ioc->ioc_regs.ioc_usage_reg); |
86 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); | 104 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); |
105 | writel(0, ioc->ioc_regs.ioc_fail_sync); | ||
87 | bfa_trc(ioc, usecnt); | 106 | bfa_trc(ioc, usecnt); |
88 | return BFA_TRUE; | 107 | return BFA_TRUE; |
89 | } | 108 | } |
@@ -94,14 +113,14 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) | |||
94 | /* | 113 | /* |
95 | * Use count cannot be non-zero and chip in uninitialized state. | 114 | * Use count cannot be non-zero and chip in uninitialized state. |
96 | */ | 115 | */ |
97 | bfa_assert(ioc_fwstate != BFI_IOC_UNINIT); | 116 | WARN_ON(ioc_fwstate == BFI_IOC_UNINIT); |
98 | 117 | ||
99 | /* | 118 | /* |
100 | * Check if another driver with a different firmware is active | 119 | * Check if another driver with a different firmware is active |
101 | */ | 120 | */ |
102 | bfa_ioc_fwver_get(ioc, &fwhdr); | 121 | bfa_ioc_fwver_get(ioc, &fwhdr); |
103 | if (!bfa_ioc_fwver_cmp(ioc, &fwhdr)) { | 122 | if (!bfa_ioc_fwver_cmp(ioc, &fwhdr)) { |
104 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); | 123 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); |
105 | bfa_trc(ioc, usecnt); | 124 | bfa_trc(ioc, usecnt); |
106 | return BFA_FALSE; | 125 | return BFA_FALSE; |
107 | } | 126 | } |
@@ -111,7 +130,7 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) | |||
111 | */ | 130 | */ |
112 | usecnt++; | 131 | usecnt++; |
113 | writel(usecnt, ioc->ioc_regs.ioc_usage_reg); | 132 | writel(usecnt, ioc->ioc_regs.ioc_usage_reg); |
114 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); | 133 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); |
115 | bfa_trc(ioc, usecnt); | 134 | bfa_trc(ioc, usecnt); |
116 | return BFA_TRUE; | 135 | return BFA_TRUE; |
117 | } | 136 | } |
@@ -139,25 +158,27 @@ bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc) | |||
139 | */ | 158 | */ |
140 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); | 159 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); |
141 | usecnt = readl(ioc->ioc_regs.ioc_usage_reg); | 160 | usecnt = readl(ioc->ioc_regs.ioc_usage_reg); |
142 | bfa_assert(usecnt > 0); | 161 | WARN_ON(usecnt <= 0); |
143 | 162 | ||
144 | usecnt--; | 163 | usecnt--; |
145 | writel(usecnt, ioc->ioc_regs.ioc_usage_reg); | 164 | writel(usecnt, ioc->ioc_regs.ioc_usage_reg); |
146 | bfa_trc(ioc, usecnt); | 165 | bfa_trc(ioc, usecnt); |
147 | 166 | ||
148 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); | 167 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); |
149 | } | 168 | } |
150 | 169 | ||
151 | /* | 170 | /* |
152 | * Notify other functions on HB failure. | 171 | * Notify other functions on HB failure. |
153 | */ | 172 | */ |
154 | static void | 173 | static void |
155 | bfa_ioc_ct_notify_hbfail(struct bfa_ioc_s *ioc) | 174 | bfa_ioc_ct_notify_fail(struct bfa_ioc_s *ioc) |
156 | { | 175 | { |
157 | if (ioc->cna) { | 176 | if (ioc->cna) { |
158 | writel(__FW_INIT_HALT_P, ioc->ioc_regs.ll_halt); | 177 | writel(__FW_INIT_HALT_P, ioc->ioc_regs.ll_halt); |
178 | writel(__FW_INIT_HALT_P, ioc->ioc_regs.alt_ll_halt); | ||
159 | /* Wait for halt to take effect */ | 179 | /* Wait for halt to take effect */ |
160 | readl(ioc->ioc_regs.ll_halt); | 180 | readl(ioc->ioc_regs.ll_halt); |
181 | readl(ioc->ioc_regs.alt_ll_halt); | ||
161 | } else { | 182 | } else { |
162 | writel(__PSS_ERR_STATUS_SET, ioc->ioc_regs.err_set); | 183 | writel(__PSS_ERR_STATUS_SET, ioc->ioc_regs.err_set); |
163 | readl(ioc->ioc_regs.err_set); | 184 | readl(ioc->ioc_regs.err_set); |
@@ -209,15 +230,19 @@ bfa_ioc_ct_reg_init(struct bfa_ioc_s *ioc) | |||
209 | if (ioc->port_id == 0) { | 230 | if (ioc->port_id == 0) { |
210 | ioc->ioc_regs.heartbeat = rb + BFA_IOC0_HBEAT_REG; | 231 | ioc->ioc_regs.heartbeat = rb + BFA_IOC0_HBEAT_REG; |
211 | ioc->ioc_regs.ioc_fwstate = rb + BFA_IOC0_STATE_REG; | 232 | ioc->ioc_regs.ioc_fwstate = rb + BFA_IOC0_STATE_REG; |
233 | ioc->ioc_regs.alt_ioc_fwstate = rb + BFA_IOC1_STATE_REG; | ||
212 | ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd_p0[pcifn].hfn; | 234 | ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd_p0[pcifn].hfn; |
213 | ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd_p0[pcifn].lpu; | 235 | ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd_p0[pcifn].lpu; |
214 | ioc->ioc_regs.ll_halt = rb + FW_INIT_HALT_P0; | 236 | ioc->ioc_regs.ll_halt = rb + FW_INIT_HALT_P0; |
237 | ioc->ioc_regs.alt_ll_halt = rb + FW_INIT_HALT_P1; | ||
215 | } else { | 238 | } else { |
216 | ioc->ioc_regs.heartbeat = (rb + BFA_IOC1_HBEAT_REG); | 239 | ioc->ioc_regs.heartbeat = (rb + BFA_IOC1_HBEAT_REG); |
217 | ioc->ioc_regs.ioc_fwstate = (rb + BFA_IOC1_STATE_REG); | 240 | ioc->ioc_regs.ioc_fwstate = (rb + BFA_IOC1_STATE_REG); |
241 | ioc->ioc_regs.alt_ioc_fwstate = rb + BFA_IOC0_STATE_REG; | ||
218 | ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd_p1[pcifn].hfn; | 242 | ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd_p1[pcifn].hfn; |
219 | ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd_p1[pcifn].lpu; | 243 | ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd_p1[pcifn].lpu; |
220 | ioc->ioc_regs.ll_halt = rb + FW_INIT_HALT_P1; | 244 | ioc->ioc_regs.ll_halt = rb + FW_INIT_HALT_P1; |
245 | ioc->ioc_regs.alt_ll_halt = rb + FW_INIT_HALT_P0; | ||
221 | } | 246 | } |
222 | 247 | ||
223 | /* | 248 | /* |
@@ -235,6 +260,7 @@ bfa_ioc_ct_reg_init(struct bfa_ioc_s *ioc) | |||
235 | ioc->ioc_regs.ioc_usage_sem_reg = (rb + HOST_SEM1_REG); | 260 | ioc->ioc_regs.ioc_usage_sem_reg = (rb + HOST_SEM1_REG); |
236 | ioc->ioc_regs.ioc_init_sem_reg = (rb + HOST_SEM2_REG); | 261 | ioc->ioc_regs.ioc_init_sem_reg = (rb + HOST_SEM2_REG); |
237 | ioc->ioc_regs.ioc_usage_reg = (rb + BFA_FW_USE_COUNT); | 262 | ioc->ioc_regs.ioc_usage_reg = (rb + BFA_FW_USE_COUNT); |
263 | ioc->ioc_regs.ioc_fail_sync = (rb + BFA_IOC_FAIL_SYNC); | ||
238 | 264 | ||
239 | /* | 265 | /* |
240 | * sram memory access | 266 | * sram memory access |
@@ -313,7 +339,7 @@ bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc) | |||
313 | if (ioc->cna) { | 339 | if (ioc->cna) { |
314 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); | 340 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); |
315 | writel(0, ioc->ioc_regs.ioc_usage_reg); | 341 | writel(0, ioc->ioc_regs.ioc_usage_reg); |
316 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); | 342 | writel(1, ioc->ioc_regs.ioc_usage_sem_reg); |
317 | } | 343 | } |
318 | 344 | ||
319 | /* | 345 | /* |
@@ -322,10 +348,80 @@ bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc) | |||
322 | * will lock it instead of clearing it. | 348 | * will lock it instead of clearing it. |
323 | */ | 349 | */ |
324 | readl(ioc->ioc_regs.ioc_sem_reg); | 350 | readl(ioc->ioc_regs.ioc_sem_reg); |
325 | bfa_ioc_hw_sem_release(ioc); | 351 | writel(1, ioc->ioc_regs.ioc_sem_reg); |
352 | } | ||
353 | |||
354 | /* | ||
355 | * Synchronized IOC failure processing routines | ||
356 | */ | ||
357 | static void | ||
358 | bfa_ioc_ct_sync_join(struct bfa_ioc_s *ioc) | ||
359 | { | ||
360 | uint32_t r32 = readl(ioc->ioc_regs.ioc_fail_sync); | ||
361 | uint32_t sync_pos = bfa_ioc_ct_sync_reqd_pos(ioc); | ||
362 | |||
363 | writel((r32 | sync_pos), ioc->ioc_regs.ioc_fail_sync); | ||
364 | } | ||
365 | |||
366 | static void | ||
367 | bfa_ioc_ct_sync_leave(struct bfa_ioc_s *ioc) | ||
368 | { | ||
369 | uint32_t r32 = readl(ioc->ioc_regs.ioc_fail_sync); | ||
370 | uint32_t sync_msk = bfa_ioc_ct_sync_reqd_pos(ioc) | | ||
371 | bfa_ioc_ct_sync_pos(ioc); | ||
372 | |||
373 | writel((r32 & ~sync_msk), ioc->ioc_regs.ioc_fail_sync); | ||
374 | } | ||
375 | |||
376 | static void | ||
377 | bfa_ioc_ct_sync_ack(struct bfa_ioc_s *ioc) | ||
378 | { | ||
379 | uint32_t r32 = readl(ioc->ioc_regs.ioc_fail_sync); | ||
380 | |||
381 | writel((r32 | bfa_ioc_ct_sync_pos(ioc)), | ||
382 | ioc->ioc_regs.ioc_fail_sync); | ||
326 | } | 383 | } |
327 | 384 | ||
385 | static bfa_boolean_t | ||
386 | bfa_ioc_ct_sync_complete(struct bfa_ioc_s *ioc) | ||
387 | { | ||
388 | uint32_t r32 = readl(ioc->ioc_regs.ioc_fail_sync); | ||
389 | uint32_t sync_reqd = bfa_ioc_ct_get_sync_reqd(r32); | ||
390 | uint32_t sync_ackd = bfa_ioc_ct_get_sync_ackd(r32); | ||
391 | uint32_t tmp_ackd; | ||
392 | |||
393 | if (sync_ackd == 0) | ||
394 | return BFA_TRUE; | ||
395 | |||
396 | /* | ||
397 | * The check below is to see whether any other PCI fn | ||
398 | * has reinitialized the ASIC (reset sync_ackd bits) | ||
399 | * and failed again while this IOC was waiting for hw | ||
400 | * semaphore (in bfa_iocpf_sm_semwait()). | ||
401 | */ | ||
402 | tmp_ackd = sync_ackd; | ||
403 | if ((sync_reqd & bfa_ioc_ct_sync_pos(ioc)) && | ||
404 | !(sync_ackd & bfa_ioc_ct_sync_pos(ioc))) | ||
405 | sync_ackd |= bfa_ioc_ct_sync_pos(ioc); | ||
406 | |||
407 | if (sync_reqd == sync_ackd) { | ||
408 | writel(bfa_ioc_ct_clear_sync_ackd(r32), | ||
409 | ioc->ioc_regs.ioc_fail_sync); | ||
410 | writel(BFI_IOC_FAIL, ioc->ioc_regs.ioc_fwstate); | ||
411 | writel(BFI_IOC_FAIL, ioc->ioc_regs.alt_ioc_fwstate); | ||
412 | return BFA_TRUE; | ||
413 | } | ||
414 | |||
415 | /* | ||
416 | * If another PCI fn reinitialized and failed again while | ||
417 | * this IOC was waiting for hw sem, the sync_ackd bit for | ||
418 | * this IOC need to be set again to allow reinitialization. | ||
419 | */ | ||
420 | if (tmp_ackd != sync_ackd) | ||
421 | writel((r32 | sync_ackd), ioc->ioc_regs.ioc_fail_sync); | ||
328 | 422 | ||
423 | return BFA_FALSE; | ||
424 | } | ||
329 | 425 | ||
330 | /* | 426 | /* |
331 | * Check the firmware state to know if pll_init has been completed already | 427 | * Check the firmware state to know if pll_init has been completed already |
diff --git a/drivers/scsi/bfa/bfa_modules.h b/drivers/scsi/bfa/bfa_modules.h index 15407ab39e7..ab79ff6fdee 100644 --- a/drivers/scsi/bfa/bfa_modules.h +++ b/drivers/scsi/bfa/bfa_modules.h | |||
@@ -99,7 +99,6 @@ struct bfa_module_s { | |||
99 | void (*iocdisable) (struct bfa_s *bfa); | 99 | void (*iocdisable) (struct bfa_s *bfa); |
100 | }; | 100 | }; |
101 | 101 | ||
102 | extern struct bfa_module_s *hal_mods[]; | ||
103 | 102 | ||
104 | struct bfa_s { | 103 | struct bfa_s { |
105 | void *bfad; /* BFA driver instance */ | 104 | void *bfad; /* BFA driver instance */ |
@@ -116,8 +115,6 @@ struct bfa_s { | |||
116 | struct bfa_msix_s msix; | 115 | struct bfa_msix_s msix; |
117 | }; | 116 | }; |
118 | 117 | ||
119 | extern bfa_isr_func_t bfa_isrs[BFI_MC_MAX]; | ||
120 | extern bfa_ioc_mbox_mcfunc_t bfa_mbox_isrs[]; | ||
121 | extern bfa_boolean_t bfa_auto_recover; | 118 | extern bfa_boolean_t bfa_auto_recover; |
122 | extern struct bfa_module_s hal_mod_sgpg; | 119 | extern struct bfa_module_s hal_mod_sgpg; |
123 | extern struct bfa_module_s hal_mod_fcport; | 120 | extern struct bfa_module_s hal_mod_fcport; |
diff --git a/drivers/scsi/bfa/bfa_os_inc.h b/drivers/scsi/bfa/bfa_os_inc.h deleted file mode 100644 index 65df62ef437..00000000000 --- a/drivers/scsi/bfa/bfa_os_inc.h +++ /dev/null | |||
@@ -1,143 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. | ||
3 | * All rights reserved | ||
4 | * www.brocade.com | ||
5 | * | ||
6 | * Linux driver for Brocade Fibre Channel Host Bus Adapter. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License (GPL) Version 2 as | ||
10 | * published by the Free Software Foundation | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #ifndef __BFA_OS_INC_H__ | ||
19 | #define __BFA_OS_INC_H__ | ||
20 | |||
21 | #include <linux/types.h> | ||
22 | #include <linux/version.h> | ||
23 | #include <linux/pci.h> | ||
24 | #include <linux/dma-mapping.h> | ||
25 | #include <linux/idr.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/cdev.h> | ||
28 | #include <linux/fs.h> | ||
29 | #include <linux/delay.h> | ||
30 | #include <linux/vmalloc.h> | ||
31 | #include <linux/workqueue.h> | ||
32 | #include <linux/bitops.h> | ||
33 | #include <scsi/scsi.h> | ||
34 | #include <scsi/scsi_host.h> | ||
35 | #include <scsi/scsi_tcq.h> | ||
36 | #include <scsi/scsi_transport_fc.h> | ||
37 | #include <scsi/scsi_transport.h> | ||
38 | |||
39 | #ifdef __BIG_ENDIAN | ||
40 | #define __BIGENDIAN | ||
41 | #endif | ||
42 | |||
43 | static inline u64 bfa_os_get_log_time(void) | ||
44 | { | ||
45 | u64 system_time = 0; | ||
46 | struct timeval tv; | ||
47 | do_gettimeofday(&tv); | ||
48 | |||
49 | /* We are interested in seconds only. */ | ||
50 | system_time = tv.tv_sec; | ||
51 | return system_time; | ||
52 | } | ||
53 | |||
54 | #define bfa_io_lat_clock_res_div HZ | ||
55 | #define bfa_io_lat_clock_res_mul 1000 | ||
56 | |||
57 | #define BFA_LOG(level, bfad, mask, fmt, arg...) \ | ||
58 | do { \ | ||
59 | if (((mask) == 4) || (level[1] <= '4')) \ | ||
60 | dev_printk(level, &((bfad)->pcidev)->dev, fmt, ##arg); \ | ||
61 | } while (0) | ||
62 | |||
63 | #define bfa_swap_3b(_x) \ | ||
64 | ((((_x) & 0xff) << 16) | \ | ||
65 | ((_x) & 0x00ff00) | \ | ||
66 | (((_x) & 0xff0000) >> 16)) | ||
67 | |||
68 | #define bfa_os_swap_sgaddr(_x) ((u64)( \ | ||
69 | (((u64)(_x) & (u64)0x00000000000000ffull) << 32) | \ | ||
70 | (((u64)(_x) & (u64)0x000000000000ff00ull) << 32) | \ | ||
71 | (((u64)(_x) & (u64)0x0000000000ff0000ull) << 32) | \ | ||
72 | (((u64)(_x) & (u64)0x00000000ff000000ull) << 32) | \ | ||
73 | (((u64)(_x) & (u64)0x000000ff00000000ull) >> 32) | \ | ||
74 | (((u64)(_x) & (u64)0x0000ff0000000000ull) >> 32) | \ | ||
75 | (((u64)(_x) & (u64)0x00ff000000000000ull) >> 32) | \ | ||
76 | (((u64)(_x) & (u64)0xff00000000000000ull) >> 32))) | ||
77 | |||
78 | #ifndef __BIGENDIAN | ||
79 | #define bfa_os_hton3b(_x) bfa_swap_3b(_x) | ||
80 | #define bfa_os_sgaddr(_x) (_x) | ||
81 | #else | ||
82 | #define bfa_os_hton3b(_x) (_x) | ||
83 | #define bfa_os_sgaddr(_x) bfa_os_swap_sgaddr(_x) | ||
84 | #endif | ||
85 | |||
86 | #define bfa_os_ntoh3b(_x) bfa_os_hton3b(_x) | ||
87 | #define bfa_os_u32(__pa64) ((__pa64) >> 32) | ||
88 | |||
89 | #define BFA_TRC_TS(_trcm) \ | ||
90 | ({ \ | ||
91 | struct timeval tv; \ | ||
92 | \ | ||
93 | do_gettimeofday(&tv); \ | ||
94 | (tv.tv_sec*1000000+tv.tv_usec); \ | ||
95 | }) | ||
96 | |||
97 | #define boolean_t int | ||
98 | |||
99 | /* | ||
100 | * For current time stamp, OS API will fill-in | ||
101 | */ | ||
102 | struct bfa_timeval_s { | ||
103 | u32 tv_sec; /* seconds */ | ||
104 | u32 tv_usec; /* microseconds */ | ||
105 | }; | ||
106 | |||
107 | static inline void | ||
108 | bfa_os_gettimeofday(struct bfa_timeval_s *tv) | ||
109 | { | ||
110 | struct timeval tmp_tv; | ||
111 | |||
112 | do_gettimeofday(&tmp_tv); | ||
113 | tv->tv_sec = (u32) tmp_tv.tv_sec; | ||
114 | tv->tv_usec = (u32) tmp_tv.tv_usec; | ||
115 | } | ||
116 | |||
117 | static inline void | ||
118 | wwn2str(char *wwn_str, u64 wwn) | ||
119 | { | ||
120 | union { | ||
121 | u64 wwn; | ||
122 | u8 byte[8]; | ||
123 | } w; | ||
124 | |||
125 | w.wwn = wwn; | ||
126 | sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", w.byte[0], | ||
127 | w.byte[1], w.byte[2], w.byte[3], w.byte[4], w.byte[5], | ||
128 | w.byte[6], w.byte[7]); | ||
129 | } | ||
130 | |||
131 | static inline void | ||
132 | fcid2str(char *fcid_str, u32 fcid) | ||
133 | { | ||
134 | union { | ||
135 | u32 fcid; | ||
136 | u8 byte[4]; | ||
137 | } f; | ||
138 | |||
139 | f.fcid = fcid; | ||
140 | sprintf(fcid_str, "%02x:%02x:%02x", f.byte[1], f.byte[2], f.byte[3]); | ||
141 | } | ||
142 | |||
143 | #endif /* __BFA_OS_INC_H__ */ | ||
diff --git a/drivers/scsi/bfa/bfa_plog.h b/drivers/scsi/bfa/bfa_plog.h index 501f0ed35cf..1c9baa68339 100644 --- a/drivers/scsi/bfa/bfa_plog.h +++ b/drivers/scsi/bfa/bfa_plog.h | |||
@@ -151,9 +151,5 @@ void bfa_plog_fchdr(struct bfa_plog_s *plog, enum bfa_plog_mid mid, | |||
151 | void bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid, | 151 | void bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid, |
152 | enum bfa_plog_eid event, u16 misc, | 152 | enum bfa_plog_eid event, u16 misc, |
153 | struct fchs_s *fchdr, u32 pld_w0); | 153 | struct fchs_s *fchdr, u32 pld_w0); |
154 | void bfa_plog_clear(struct bfa_plog_s *plog); | ||
155 | void bfa_plog_enable(struct bfa_plog_s *plog); | ||
156 | void bfa_plog_disable(struct bfa_plog_s *plog); | ||
157 | bfa_boolean_t bfa_plog_get_setting(struct bfa_plog_s *plog); | ||
158 | 154 | ||
159 | #endif /* __BFA_PORTLOG_H__ */ | 155 | #endif /* __BFA_PORTLOG_H__ */ |
diff --git a/drivers/scsi/bfa/bfa_port.c b/drivers/scsi/bfa/bfa_port.c index fff96226a38..3f8e9d6066e 100644 --- a/drivers/scsi/bfa/bfa_port.c +++ b/drivers/scsi/bfa/bfa_port.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfad_drv.h" | ||
18 | #include "bfa_defs_svc.h" | 19 | #include "bfa_defs_svc.h" |
19 | #include "bfa_port.h" | 20 | #include "bfa_port.h" |
20 | #include "bfi.h" | 21 | #include "bfi.h" |
@@ -29,14 +30,14 @@ static void | |||
29 | bfa_port_stats_swap(struct bfa_port_s *port, union bfa_port_stats_u *stats) | 30 | bfa_port_stats_swap(struct bfa_port_s *port, union bfa_port_stats_u *stats) |
30 | { | 31 | { |
31 | u32 *dip = (u32 *) stats; | 32 | u32 *dip = (u32 *) stats; |
32 | u32 t0, t1; | 33 | __be32 t0, t1; |
33 | int i; | 34 | int i; |
34 | 35 | ||
35 | for (i = 0; i < sizeof(union bfa_port_stats_u)/sizeof(u32); | 36 | for (i = 0; i < sizeof(union bfa_port_stats_u)/sizeof(u32); |
36 | i += 2) { | 37 | i += 2) { |
37 | t0 = dip[i]; | 38 | t0 = dip[i]; |
38 | t1 = dip[i + 1]; | 39 | t1 = dip[i + 1]; |
39 | #ifdef __BIGENDIAN | 40 | #ifdef __BIG_ENDIAN |
40 | dip[i] = be32_to_cpu(t0); | 41 | dip[i] = be32_to_cpu(t0); |
41 | dip[i + 1] = be32_to_cpu(t1); | 42 | dip[i + 1] = be32_to_cpu(t1); |
42 | #else | 43 | #else |
@@ -96,13 +97,13 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status) | |||
96 | port->stats_busy = BFA_FALSE; | 97 | port->stats_busy = BFA_FALSE; |
97 | 98 | ||
98 | if (status == BFA_STATUS_OK) { | 99 | if (status == BFA_STATUS_OK) { |
99 | struct bfa_timeval_s tv; | 100 | struct timeval tv; |
100 | 101 | ||
101 | memcpy(port->stats, port->stats_dma.kva, | 102 | memcpy(port->stats, port->stats_dma.kva, |
102 | sizeof(union bfa_port_stats_u)); | 103 | sizeof(union bfa_port_stats_u)); |
103 | bfa_port_stats_swap(port, port->stats); | 104 | bfa_port_stats_swap(port, port->stats); |
104 | 105 | ||
105 | bfa_os_gettimeofday(&tv); | 106 | do_gettimeofday(&tv); |
106 | port->stats->fc.secs_reset = tv.tv_sec - port->stats_reset_time; | 107 | port->stats->fc.secs_reset = tv.tv_sec - port->stats_reset_time; |
107 | } | 108 | } |
108 | 109 | ||
@@ -124,7 +125,7 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status) | |||
124 | static void | 125 | static void |
125 | bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status) | 126 | bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status) |
126 | { | 127 | { |
127 | struct bfa_timeval_s tv; | 128 | struct timeval tv; |
128 | 129 | ||
129 | port->stats_status = status; | 130 | port->stats_status = status; |
130 | port->stats_busy = BFA_FALSE; | 131 | port->stats_busy = BFA_FALSE; |
@@ -132,7 +133,7 @@ bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status) | |||
132 | /* | 133 | /* |
133 | * re-initialize time stamp for stats reset | 134 | * re-initialize time stamp for stats reset |
134 | */ | 135 | */ |
135 | bfa_os_gettimeofday(&tv); | 136 | do_gettimeofday(&tv); |
136 | port->stats_reset_time = tv.tv_sec; | 137 | port->stats_reset_time = tv.tv_sec; |
137 | 138 | ||
138 | if (port->stats_cbfn) { | 139 | if (port->stats_cbfn) { |
@@ -185,7 +186,7 @@ bfa_port_isr(void *cbarg, struct bfi_mbmsg_s *m) | |||
185 | break; | 186 | break; |
186 | 187 | ||
187 | default: | 188 | default: |
188 | bfa_assert(0); | 189 | WARN_ON(1); |
189 | } | 190 | } |
190 | } | 191 | } |
191 | 192 | ||
@@ -432,9 +433,9 @@ void | |||
432 | bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, | 433 | bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, |
433 | void *dev, struct bfa_trc_mod_s *trcmod) | 434 | void *dev, struct bfa_trc_mod_s *trcmod) |
434 | { | 435 | { |
435 | struct bfa_timeval_s tv; | 436 | struct timeval tv; |
436 | 437 | ||
437 | bfa_assert(port); | 438 | WARN_ON(!port); |
438 | 439 | ||
439 | port->dev = dev; | 440 | port->dev = dev; |
440 | port->ioc = ioc; | 441 | port->ioc = ioc; |
@@ -447,27 +448,13 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, | |||
447 | 448 | ||
448 | bfa_ioc_mbox_regisr(port->ioc, BFI_MC_PORT, bfa_port_isr, port); | 449 | bfa_ioc_mbox_regisr(port->ioc, BFI_MC_PORT, bfa_port_isr, port); |
449 | bfa_ioc_hbfail_init(&port->hbfail, bfa_port_hbfail, port); | 450 | bfa_ioc_hbfail_init(&port->hbfail, bfa_port_hbfail, port); |
450 | bfa_ioc_hbfail_register(port->ioc, &port->hbfail); | 451 | list_add_tail(&port->hbfail.qe, &port->ioc->hb_notify_q); |
451 | 452 | ||
452 | /* | 453 | /* |
453 | * initialize time stamp for stats reset | 454 | * initialize time stamp for stats reset |
454 | */ | 455 | */ |
455 | bfa_os_gettimeofday(&tv); | 456 | do_gettimeofday(&tv); |
456 | port->stats_reset_time = tv.tv_sec; | 457 | port->stats_reset_time = tv.tv_sec; |
457 | 458 | ||
458 | bfa_trc(port, 0); | 459 | bfa_trc(port, 0); |
459 | } | 460 | } |
460 | |||
461 | /* | ||
462 | * bfa_port_detach() | ||
463 | * | ||
464 | * | ||
465 | * @param[in] port - Pointer to the Port module data structure | ||
466 | * | ||
467 | * @return void | ||
468 | */ | ||
469 | void | ||
470 | bfa_port_detach(struct bfa_port_s *port) | ||
471 | { | ||
472 | bfa_trc(port, 0); | ||
473 | } | ||
diff --git a/drivers/scsi/bfa/bfa_port.h b/drivers/scsi/bfa/bfa_port.h index dbce9dfd056..c4ee9db6b47 100644 --- a/drivers/scsi/bfa/bfa_port.h +++ b/drivers/scsi/bfa/bfa_port.h | |||
@@ -48,7 +48,6 @@ struct bfa_port_s { | |||
48 | 48 | ||
49 | void bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, | 49 | void bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, |
50 | void *dev, struct bfa_trc_mod_s *trcmod); | 50 | void *dev, struct bfa_trc_mod_s *trcmod); |
51 | void bfa_port_detach(struct bfa_port_s *port); | ||
52 | void bfa_port_hbfail(void *arg); | 51 | void bfa_port_hbfail(void *arg); |
53 | 52 | ||
54 | bfa_status_t bfa_port_get_stats(struct bfa_port_s *port, | 53 | bfa_status_t bfa_port_get_stats(struct bfa_port_s *port, |
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index 37e16ac8f24..1d34921f88b 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c | |||
@@ -15,11 +15,10 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "bfa_os_inc.h" | 18 | #include "bfad_drv.h" |
19 | #include "bfa_plog.h" | 19 | #include "bfa_plog.h" |
20 | #include "bfa_cs.h" | 20 | #include "bfa_cs.h" |
21 | #include "bfa_modules.h" | 21 | #include "bfa_modules.h" |
22 | #include "bfad_drv.h" | ||
23 | 22 | ||
24 | BFA_TRC_FILE(HAL, FCXP); | 23 | BFA_TRC_FILE(HAL, FCXP); |
25 | BFA_MODULE(fcxp); | 24 | BFA_MODULE(fcxp); |
@@ -41,19 +40,6 @@ BFA_MODULE(uf); | |||
41 | #define BFA_LPS_MAX_VPORTS_SUPP_CB 255 | 40 | #define BFA_LPS_MAX_VPORTS_SUPP_CB 255 |
42 | #define BFA_LPS_MAX_VPORTS_SUPP_CT 190 | 41 | #define BFA_LPS_MAX_VPORTS_SUPP_CT 190 |
43 | 42 | ||
44 | /* | ||
45 | * lps_pvt BFA LPS private functions | ||
46 | */ | ||
47 | |||
48 | enum bfa_lps_event { | ||
49 | BFA_LPS_SM_LOGIN = 1, /* login request from user */ | ||
50 | BFA_LPS_SM_LOGOUT = 2, /* logout request from user */ | ||
51 | BFA_LPS_SM_FWRSP = 3, /* f/w response to login/logout */ | ||
52 | BFA_LPS_SM_RESUME = 4, /* space present in reqq queue */ | ||
53 | BFA_LPS_SM_DELETE = 5, /* lps delete from user */ | ||
54 | BFA_LPS_SM_OFFLINE = 6, /* Link is offline */ | ||
55 | BFA_LPS_SM_RX_CVL = 7, /* Rx clear virtual link */ | ||
56 | }; | ||
57 | 43 | ||
58 | /* | 44 | /* |
59 | * FC PORT related definitions | 45 | * FC PORT related definitions |
@@ -66,7 +52,6 @@ enum bfa_lps_event { | |||
66 | ((bfa_fcport_is_disabled(bfa) == BFA_TRUE) || \ | 52 | ((bfa_fcport_is_disabled(bfa) == BFA_TRUE) || \ |
67 | (bfa_ioc_is_disabled(&bfa->ioc) == BFA_TRUE)) | 53 | (bfa_ioc_is_disabled(&bfa->ioc) == BFA_TRUE)) |
68 | 54 | ||
69 | |||
70 | /* | 55 | /* |
71 | * BFA port state machine events | 56 | * BFA port state machine events |
72 | */ | 57 | */ |
@@ -113,19 +98,6 @@ enum bfa_fcport_ln_sm_event { | |||
113 | } \ | 98 | } \ |
114 | } while (0) | 99 | } while (0) |
115 | 100 | ||
116 | |||
117 | enum bfa_rport_event { | ||
118 | BFA_RPORT_SM_CREATE = 1, /* rport create event */ | ||
119 | BFA_RPORT_SM_DELETE = 2, /* deleting an existing rport */ | ||
120 | BFA_RPORT_SM_ONLINE = 3, /* rport is online */ | ||
121 | BFA_RPORT_SM_OFFLINE = 4, /* rport is offline */ | ||
122 | BFA_RPORT_SM_FWRSP = 5, /* firmware response */ | ||
123 | BFA_RPORT_SM_HWFAIL = 6, /* IOC h/w failure */ | ||
124 | BFA_RPORT_SM_QOS_SCN = 7, /* QoS SCN from firmware */ | ||
125 | BFA_RPORT_SM_SET_SPEED = 8, /* Set Rport Speed */ | ||
126 | BFA_RPORT_SM_QRESUME = 9, /* space in requeue queue */ | ||
127 | }; | ||
128 | |||
129 | /* | 101 | /* |
130 | * forward declarations FCXP related functions | 102 | * forward declarations FCXP related functions |
131 | */ | 103 | */ |
@@ -159,6 +131,7 @@ static void bfa_lps_reqq_resume(void *lps_arg); | |||
159 | static void bfa_lps_free(struct bfa_lps_s *lps); | 131 | static void bfa_lps_free(struct bfa_lps_s *lps); |
160 | static void bfa_lps_send_login(struct bfa_lps_s *lps); | 132 | static void bfa_lps_send_login(struct bfa_lps_s *lps); |
161 | static void bfa_lps_send_logout(struct bfa_lps_s *lps); | 133 | static void bfa_lps_send_logout(struct bfa_lps_s *lps); |
134 | static void bfa_lps_send_set_n2n_pid(struct bfa_lps_s *lps); | ||
162 | static void bfa_lps_login_comp(struct bfa_lps_s *lps); | 135 | static void bfa_lps_login_comp(struct bfa_lps_s *lps); |
163 | static void bfa_lps_logout_comp(struct bfa_lps_s *lps); | 136 | static void bfa_lps_logout_comp(struct bfa_lps_s *lps); |
164 | static void bfa_lps_cvl_event(struct bfa_lps_s *lps); | 137 | static void bfa_lps_cvl_event(struct bfa_lps_s *lps); |
@@ -171,6 +144,8 @@ static void bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event); | |||
171 | static void bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event | 144 | static void bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event |
172 | event); | 145 | event); |
173 | static void bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event); | 146 | static void bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event); |
147 | static void bfa_lps_sm_online_n2n_pid_wait(struct bfa_lps_s *lps, | ||
148 | enum bfa_lps_event event); | ||
174 | static void bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event); | 149 | static void bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event); |
175 | static void bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event | 150 | static void bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event |
176 | event); | 151 | event); |
@@ -312,6 +287,18 @@ plkd_validate_logrec(struct bfa_plog_rec_s *pl_rec) | |||
312 | return 0; | 287 | return 0; |
313 | } | 288 | } |
314 | 289 | ||
290 | static u64 | ||
291 | bfa_get_log_time(void) | ||
292 | { | ||
293 | u64 system_time = 0; | ||
294 | struct timeval tv; | ||
295 | do_gettimeofday(&tv); | ||
296 | |||
297 | /* We are interested in seconds only. */ | ||
298 | system_time = tv.tv_sec; | ||
299 | return system_time; | ||
300 | } | ||
301 | |||
315 | static void | 302 | static void |
316 | bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) | 303 | bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) |
317 | { | 304 | { |
@@ -322,7 +309,7 @@ bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) | |||
322 | return; | 309 | return; |
323 | 310 | ||
324 | if (plkd_validate_logrec(pl_rec)) { | 311 | if (plkd_validate_logrec(pl_rec)) { |
325 | bfa_assert(0); | 312 | WARN_ON(1); |
326 | return; | 313 | return; |
327 | } | 314 | } |
328 | 315 | ||
@@ -332,7 +319,7 @@ bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) | |||
332 | 319 | ||
333 | memcpy(pl_recp, pl_rec, sizeof(struct bfa_plog_rec_s)); | 320 | memcpy(pl_recp, pl_rec, sizeof(struct bfa_plog_rec_s)); |
334 | 321 | ||
335 | pl_recp->tv = bfa_os_get_log_time(); | 322 | pl_recp->tv = bfa_get_log_time(); |
336 | BFA_PL_LOG_REC_INCR(plog->tail); | 323 | BFA_PL_LOG_REC_INCR(plog->tail); |
337 | 324 | ||
338 | if (plog->head == plog->tail) | 325 | if (plog->head == plog->tail) |
@@ -437,29 +424,6 @@ bfa_plog_fchdr_and_pl(struct bfa_plog_s *plog, enum bfa_plog_mid mid, | |||
437 | } | 424 | } |
438 | } | 425 | } |
439 | 426 | ||
440 | void | ||
441 | bfa_plog_clear(struct bfa_plog_s *plog) | ||
442 | { | ||
443 | plog->head = plog->tail = 0; | ||
444 | } | ||
445 | |||
446 | void | ||
447 | bfa_plog_enable(struct bfa_plog_s *plog) | ||
448 | { | ||
449 | plog->plog_enabled = 1; | ||
450 | } | ||
451 | |||
452 | void | ||
453 | bfa_plog_disable(struct bfa_plog_s *plog) | ||
454 | { | ||
455 | plog->plog_enabled = 0; | ||
456 | } | ||
457 | |||
458 | bfa_boolean_t | ||
459 | bfa_plog_get_setting(struct bfa_plog_s *plog) | ||
460 | { | ||
461 | return (bfa_boolean_t)plog->plog_enabled; | ||
462 | } | ||
463 | 427 | ||
464 | /* | 428 | /* |
465 | * fcxp_pvt BFA FCXP private functions | 429 | * fcxp_pvt BFA FCXP private functions |
@@ -637,15 +601,15 @@ bfa_fcxp_init_reqrsp(struct bfa_fcxp_s *fcxp, | |||
637 | bfa_fcxp_get_sglen_t sglen_cbfn) | 601 | bfa_fcxp_get_sglen_t sglen_cbfn) |
638 | { | 602 | { |
639 | 603 | ||
640 | bfa_assert(bfa != NULL); | 604 | WARN_ON(bfa == NULL); |
641 | 605 | ||
642 | bfa_trc(bfa, fcxp->fcxp_tag); | 606 | bfa_trc(bfa, fcxp->fcxp_tag); |
643 | 607 | ||
644 | if (n_sgles == 0) { | 608 | if (n_sgles == 0) { |
645 | *use_ibuf = 1; | 609 | *use_ibuf = 1; |
646 | } else { | 610 | } else { |
647 | bfa_assert(*sga_cbfn != NULL); | 611 | WARN_ON(*sga_cbfn == NULL); |
648 | bfa_assert(*sglen_cbfn != NULL); | 612 | WARN_ON(*sglen_cbfn == NULL); |
649 | 613 | ||
650 | *use_ibuf = 0; | 614 | *use_ibuf = 0; |
651 | *r_sga_cbfn = sga_cbfn; | 615 | *r_sga_cbfn = sga_cbfn; |
@@ -657,7 +621,7 @@ bfa_fcxp_init_reqrsp(struct bfa_fcxp_s *fcxp, | |||
657 | * alloc required sgpgs | 621 | * alloc required sgpgs |
658 | */ | 622 | */ |
659 | if (n_sgles > BFI_SGE_INLINE) | 623 | if (n_sgles > BFI_SGE_INLINE) |
660 | bfa_assert(0); | 624 | WARN_ON(1); |
661 | } | 625 | } |
662 | 626 | ||
663 | } | 627 | } |
@@ -671,7 +635,7 @@ bfa_fcxp_init(struct bfa_fcxp_s *fcxp, | |||
671 | bfa_fcxp_get_sglen_t rsp_sglen_cbfn) | 635 | bfa_fcxp_get_sglen_t rsp_sglen_cbfn) |
672 | { | 636 | { |
673 | 637 | ||
674 | bfa_assert(bfa != NULL); | 638 | WARN_ON(bfa == NULL); |
675 | 639 | ||
676 | bfa_trc(bfa, fcxp->fcxp_tag); | 640 | bfa_trc(bfa, fcxp->fcxp_tag); |
677 | 641 | ||
@@ -708,7 +672,7 @@ bfa_fcxp_put(struct bfa_fcxp_s *fcxp) | |||
708 | return; | 672 | return; |
709 | } | 673 | } |
710 | 674 | ||
711 | bfa_assert(bfa_q_is_on_q(&mod->fcxp_active_q, fcxp)); | 675 | WARN_ON(!bfa_q_is_on_q(&mod->fcxp_active_q, fcxp)); |
712 | list_del(&fcxp->qe); | 676 | list_del(&fcxp->qe); |
713 | list_add_tail(&fcxp->qe, &mod->fcxp_free_q); | 677 | list_add_tail(&fcxp->qe, &mod->fcxp_free_q); |
714 | } | 678 | } |
@@ -757,7 +721,7 @@ hal_fcxp_send_comp(struct bfa_s *bfa, struct bfi_fcxp_send_rsp_s *fcxp_rsp) | |||
757 | 721 | ||
758 | fcxp = BFA_FCXP_FROM_TAG(mod, fcxp_tag); | 722 | fcxp = BFA_FCXP_FROM_TAG(mod, fcxp_tag); |
759 | 723 | ||
760 | bfa_assert(fcxp->send_cbfn != NULL); | 724 | WARN_ON(fcxp->send_cbfn == NULL); |
761 | 725 | ||
762 | hal_fcxp_rx_plog(mod->bfa, fcxp, fcxp_rsp); | 726 | hal_fcxp_rx_plog(mod->bfa, fcxp, fcxp_rsp); |
763 | 727 | ||
@@ -913,13 +877,13 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) | |||
913 | BFA_FCXP_REQ_PLD_PA(fcxp)); | 877 | BFA_FCXP_REQ_PLD_PA(fcxp)); |
914 | } else { | 878 | } else { |
915 | if (fcxp->nreq_sgles > 0) { | 879 | if (fcxp->nreq_sgles > 0) { |
916 | bfa_assert(fcxp->nreq_sgles == 1); | 880 | WARN_ON(fcxp->nreq_sgles != 1); |
917 | hal_fcxp_set_local_sges(send_req->req_sge, | 881 | hal_fcxp_set_local_sges(send_req->req_sge, |
918 | reqi->req_tot_len, | 882 | reqi->req_tot_len, |
919 | fcxp->req_sga_cbfn(fcxp->caller, | 883 | fcxp->req_sga_cbfn(fcxp->caller, |
920 | 0)); | 884 | 0)); |
921 | } else { | 885 | } else { |
922 | bfa_assert(reqi->req_tot_len == 0); | 886 | WARN_ON(reqi->req_tot_len != 0); |
923 | hal_fcxp_set_local_sges(send_req->rsp_sge, 0, 0); | 887 | hal_fcxp_set_local_sges(send_req->rsp_sge, 0, 0); |
924 | } | 888 | } |
925 | } | 889 | } |
@@ -928,20 +892,20 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) | |||
928 | * setup rsp sgles | 892 | * setup rsp sgles |
929 | */ | 893 | */ |
930 | if (fcxp->use_irspbuf == 1) { | 894 | if (fcxp->use_irspbuf == 1) { |
931 | bfa_assert(rspi->rsp_maxlen <= BFA_FCXP_MAX_LBUF_SZ); | 895 | WARN_ON(rspi->rsp_maxlen > BFA_FCXP_MAX_LBUF_SZ); |
932 | 896 | ||
933 | hal_fcxp_set_local_sges(send_req->rsp_sge, rspi->rsp_maxlen, | 897 | hal_fcxp_set_local_sges(send_req->rsp_sge, rspi->rsp_maxlen, |
934 | BFA_FCXP_RSP_PLD_PA(fcxp)); | 898 | BFA_FCXP_RSP_PLD_PA(fcxp)); |
935 | 899 | ||
936 | } else { | 900 | } else { |
937 | if (fcxp->nrsp_sgles > 0) { | 901 | if (fcxp->nrsp_sgles > 0) { |
938 | bfa_assert(fcxp->nrsp_sgles == 1); | 902 | WARN_ON(fcxp->nrsp_sgles != 1); |
939 | hal_fcxp_set_local_sges(send_req->rsp_sge, | 903 | hal_fcxp_set_local_sges(send_req->rsp_sge, |
940 | rspi->rsp_maxlen, | 904 | rspi->rsp_maxlen, |
941 | fcxp->rsp_sga_cbfn(fcxp->caller, | 905 | fcxp->rsp_sga_cbfn(fcxp->caller, |
942 | 0)); | 906 | 0)); |
943 | } else { | 907 | } else { |
944 | bfa_assert(rspi->rsp_maxlen == 0); | 908 | WARN_ON(rspi->rsp_maxlen != 0); |
945 | hal_fcxp_set_local_sges(send_req->rsp_sge, 0, 0); | 909 | hal_fcxp_set_local_sges(send_req->rsp_sge, 0, 0); |
946 | } | 910 | } |
947 | } | 911 | } |
@@ -955,10 +919,6 @@ bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) | |||
955 | } | 919 | } |
956 | 920 | ||
957 | /* | 921 | /* |
958 | * hal_fcxp_api BFA FCXP API | ||
959 | */ | ||
960 | |||
961 | /* | ||
962 | * Allocate an FCXP instance to send a response or to send a request | 922 | * Allocate an FCXP instance to send a response or to send a request |
963 | * that has a response. Request/response buffers are allocated by caller. | 923 | * that has a response. Request/response buffers are allocated by caller. |
964 | * | 924 | * |
@@ -990,7 +950,7 @@ bfa_fcxp_alloc(void *caller, struct bfa_s *bfa, int nreq_sgles, | |||
990 | { | 950 | { |
991 | struct bfa_fcxp_s *fcxp = NULL; | 951 | struct bfa_fcxp_s *fcxp = NULL; |
992 | 952 | ||
993 | bfa_assert(bfa != NULL); | 953 | WARN_ON(bfa == NULL); |
994 | 954 | ||
995 | fcxp = bfa_fcxp_get(BFA_FCXP_MOD(bfa)); | 955 | fcxp = bfa_fcxp_get(BFA_FCXP_MOD(bfa)); |
996 | if (fcxp == NULL) | 956 | if (fcxp == NULL) |
@@ -1017,7 +977,7 @@ bfa_fcxp_get_reqbuf(struct bfa_fcxp_s *fcxp) | |||
1017 | struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; | 977 | struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; |
1018 | void *reqbuf; | 978 | void *reqbuf; |
1019 | 979 | ||
1020 | bfa_assert(fcxp->use_ireqbuf == 1); | 980 | WARN_ON(fcxp->use_ireqbuf != 1); |
1021 | reqbuf = ((u8 *)mod->req_pld_list_kva) + | 981 | reqbuf = ((u8 *)mod->req_pld_list_kva) + |
1022 | fcxp->fcxp_tag * mod->req_pld_sz; | 982 | fcxp->fcxp_tag * mod->req_pld_sz; |
1023 | return reqbuf; | 983 | return reqbuf; |
@@ -1044,7 +1004,7 @@ bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp) | |||
1044 | struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; | 1004 | struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; |
1045 | void *rspbuf; | 1005 | void *rspbuf; |
1046 | 1006 | ||
1047 | bfa_assert(fcxp->use_irspbuf == 1); | 1007 | WARN_ON(fcxp->use_irspbuf != 1); |
1048 | 1008 | ||
1049 | rspbuf = ((u8 *)mod->rsp_pld_list_kva) + | 1009 | rspbuf = ((u8 *)mod->rsp_pld_list_kva) + |
1050 | fcxp->fcxp_tag * mod->rsp_pld_sz; | 1010 | fcxp->fcxp_tag * mod->rsp_pld_sz; |
@@ -1052,7 +1012,7 @@ bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp) | |||
1052 | } | 1012 | } |
1053 | 1013 | ||
1054 | /* | 1014 | /* |
1055 | * Free the BFA FCXP | 1015 | * Free the BFA FCXP |
1056 | * | 1016 | * |
1057 | * @param[in] fcxp BFA fcxp pointer | 1017 | * @param[in] fcxp BFA fcxp pointer |
1058 | * | 1018 | * |
@@ -1063,7 +1023,7 @@ bfa_fcxp_free(struct bfa_fcxp_s *fcxp) | |||
1063 | { | 1023 | { |
1064 | struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; | 1024 | struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; |
1065 | 1025 | ||
1066 | bfa_assert(fcxp != NULL); | 1026 | WARN_ON(fcxp == NULL); |
1067 | bfa_trc(mod->bfa, fcxp->fcxp_tag); | 1027 | bfa_trc(mod->bfa, fcxp->fcxp_tag); |
1068 | bfa_fcxp_put(fcxp); | 1028 | bfa_fcxp_put(fcxp); |
1069 | } | 1029 | } |
@@ -1142,7 +1102,7 @@ bfa_status_t | |||
1142 | bfa_fcxp_abort(struct bfa_fcxp_s *fcxp) | 1102 | bfa_fcxp_abort(struct bfa_fcxp_s *fcxp) |
1143 | { | 1103 | { |
1144 | bfa_trc(fcxp->fcxp_mod->bfa, fcxp->fcxp_tag); | 1104 | bfa_trc(fcxp->fcxp_mod->bfa, fcxp->fcxp_tag); |
1145 | bfa_assert(0); | 1105 | WARN_ON(1); |
1146 | return BFA_STATUS_OK; | 1106 | return BFA_STATUS_OK; |
1147 | } | 1107 | } |
1148 | 1108 | ||
@@ -1157,7 +1117,7 @@ bfa_fcxp_alloc_wait(struct bfa_s *bfa, struct bfa_fcxp_wqe_s *wqe, | |||
1157 | { | 1117 | { |
1158 | struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa); | 1118 | struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa); |
1159 | 1119 | ||
1160 | bfa_assert(list_empty(&mod->fcxp_free_q)); | 1120 | WARN_ON(!list_empty(&mod->fcxp_free_q)); |
1161 | 1121 | ||
1162 | wqe->alloc_cbfn = alloc_cbfn; | 1122 | wqe->alloc_cbfn = alloc_cbfn; |
1163 | wqe->alloc_cbarg = alloc_cbarg; | 1123 | wqe->alloc_cbarg = alloc_cbarg; |
@@ -1178,7 +1138,7 @@ bfa_fcxp_walloc_cancel(struct bfa_s *bfa, struct bfa_fcxp_wqe_s *wqe) | |||
1178 | { | 1138 | { |
1179 | struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa); | 1139 | struct bfa_fcxp_mod_s *mod = BFA_FCXP_MOD(bfa); |
1180 | 1140 | ||
1181 | bfa_assert(bfa_q_is_on_q(&mod->wait_q, wqe)); | 1141 | WARN_ON(!bfa_q_is_on_q(&mod->wait_q, wqe)); |
1182 | list_del(&wqe->qe); | 1142 | list_del(&wqe->qe); |
1183 | } | 1143 | } |
1184 | 1144 | ||
@@ -1199,12 +1159,6 @@ bfa_fcxp_discard(struct bfa_fcxp_s *fcxp) | |||
1199 | fcxp->send_cbfn = bfa_fcxp_null_comp; | 1159 | fcxp->send_cbfn = bfa_fcxp_null_comp; |
1200 | } | 1160 | } |
1201 | 1161 | ||
1202 | |||
1203 | |||
1204 | /* | ||
1205 | * hal_fcxp_public BFA FCXP public functions | ||
1206 | */ | ||
1207 | |||
1208 | void | 1162 | void |
1209 | bfa_fcxp_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) | 1163 | bfa_fcxp_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) |
1210 | { | 1164 | { |
@@ -1215,7 +1169,7 @@ bfa_fcxp_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) | |||
1215 | 1169 | ||
1216 | default: | 1170 | default: |
1217 | bfa_trc(bfa, msg->mhdr.msg_id); | 1171 | bfa_trc(bfa, msg->mhdr.msg_id); |
1218 | bfa_assert(0); | 1172 | WARN_ON(1); |
1219 | } | 1173 | } |
1220 | } | 1174 | } |
1221 | 1175 | ||
@@ -1303,6 +1257,12 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1303 | else | 1257 | else |
1304 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | 1258 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, |
1305 | BFA_PL_EID_LOGIN, 0, "FLOGI Accept"); | 1259 | BFA_PL_EID_LOGIN, 0, "FLOGI Accept"); |
1260 | /* If N2N, send the assigned PID to FW */ | ||
1261 | bfa_trc(lps->bfa, lps->fport); | ||
1262 | bfa_trc(lps->bfa, lps->lp_pid); | ||
1263 | |||
1264 | if (!lps->fport && lps->lp_pid) | ||
1265 | bfa_sm_send_event(lps, BFA_LPS_SM_SET_N2N_PID); | ||
1306 | } else { | 1266 | } else { |
1307 | bfa_sm_set_state(lps, bfa_lps_sm_init); | 1267 | bfa_sm_set_state(lps, bfa_lps_sm_init); |
1308 | if (lps->fdisc) | 1268 | if (lps->fdisc) |
@@ -1321,6 +1281,11 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1321 | bfa_sm_set_state(lps, bfa_lps_sm_init); | 1281 | bfa_sm_set_state(lps, bfa_lps_sm_init); |
1322 | break; | 1282 | break; |
1323 | 1283 | ||
1284 | case BFA_LPS_SM_SET_N2N_PID: | ||
1285 | bfa_trc(lps->bfa, lps->fport); | ||
1286 | bfa_trc(lps->bfa, lps->lp_pid); | ||
1287 | break; | ||
1288 | |||
1324 | default: | 1289 | default: |
1325 | bfa_sm_fault(lps->bfa, event); | 1290 | bfa_sm_fault(lps->bfa, event); |
1326 | } | 1291 | } |
@@ -1389,9 +1354,59 @@ bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
1389 | BFA_PL_EID_FIP_FCF_CVL, 0, "FCF Clear Virt. Link Rx"); | 1354 | BFA_PL_EID_FIP_FCF_CVL, 0, "FCF Clear Virt. Link Rx"); |
1390 | break; | 1355 | break; |
1391 | 1356 | ||
1357 | case BFA_LPS_SM_SET_N2N_PID: | ||
1358 | if (bfa_reqq_full(lps->bfa, lps->reqq)) { | ||
1359 | bfa_sm_set_state(lps, bfa_lps_sm_online_n2n_pid_wait); | ||
1360 | bfa_reqq_wait(lps->bfa, lps->reqq, &lps->wqe); | ||
1361 | } else | ||
1362 | bfa_lps_send_set_n2n_pid(lps); | ||
1363 | break; | ||
1364 | |||
1365 | case BFA_LPS_SM_OFFLINE: | ||
1366 | case BFA_LPS_SM_DELETE: | ||
1367 | bfa_sm_set_state(lps, bfa_lps_sm_init); | ||
1368 | break; | ||
1369 | |||
1370 | default: | ||
1371 | bfa_sm_fault(lps->bfa, event); | ||
1372 | } | ||
1373 | } | ||
1374 | |||
1375 | /* | ||
1376 | * login complete | ||
1377 | */ | ||
1378 | static void | ||
1379 | bfa_lps_sm_online_n2n_pid_wait(struct bfa_lps_s *lps, enum bfa_lps_event event) | ||
1380 | { | ||
1381 | bfa_trc(lps->bfa, lps->lp_tag); | ||
1382 | bfa_trc(lps->bfa, event); | ||
1383 | |||
1384 | switch (event) { | ||
1385 | case BFA_LPS_SM_RESUME: | ||
1386 | bfa_sm_set_state(lps, bfa_lps_sm_online); | ||
1387 | bfa_lps_send_set_n2n_pid(lps); | ||
1388 | break; | ||
1389 | |||
1390 | case BFA_LPS_SM_LOGOUT: | ||
1391 | bfa_sm_set_state(lps, bfa_lps_sm_logowait); | ||
1392 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
1393 | BFA_PL_EID_LOGO, 0, "Logout"); | ||
1394 | break; | ||
1395 | |||
1396 | case BFA_LPS_SM_RX_CVL: | ||
1397 | bfa_sm_set_state(lps, bfa_lps_sm_init); | ||
1398 | bfa_reqq_wcancel(&lps->wqe); | ||
1399 | |||
1400 | /* Let the vport module know about this event */ | ||
1401 | bfa_lps_cvl_event(lps); | ||
1402 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
1403 | BFA_PL_EID_FIP_FCF_CVL, 0, "FCF Clear Virt. Link Rx"); | ||
1404 | break; | ||
1405 | |||
1392 | case BFA_LPS_SM_OFFLINE: | 1406 | case BFA_LPS_SM_OFFLINE: |
1393 | case BFA_LPS_SM_DELETE: | 1407 | case BFA_LPS_SM_DELETE: |
1394 | bfa_sm_set_state(lps, bfa_lps_sm_init); | 1408 | bfa_sm_set_state(lps, bfa_lps_sm_init); |
1409 | bfa_reqq_wcancel(&lps->wqe); | ||
1395 | break; | 1410 | break; |
1396 | 1411 | ||
1397 | default: | 1412 | default: |
@@ -1540,15 +1555,16 @@ bfa_lps_login_rsp(struct bfa_s *bfa, struct bfi_lps_login_rsp_s *rsp) | |||
1540 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); | 1555 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); |
1541 | struct bfa_lps_s *lps; | 1556 | struct bfa_lps_s *lps; |
1542 | 1557 | ||
1543 | bfa_assert(rsp->lp_tag < mod->num_lps); | 1558 | WARN_ON(rsp->lp_tag >= mod->num_lps); |
1544 | lps = BFA_LPS_FROM_TAG(mod, rsp->lp_tag); | 1559 | lps = BFA_LPS_FROM_TAG(mod, rsp->lp_tag); |
1545 | 1560 | ||
1546 | lps->status = rsp->status; | 1561 | lps->status = rsp->status; |
1547 | switch (rsp->status) { | 1562 | switch (rsp->status) { |
1548 | case BFA_STATUS_OK: | 1563 | case BFA_STATUS_OK: |
1549 | lps->fport = rsp->f_port; | 1564 | lps->fport = rsp->f_port; |
1565 | if (lps->fport) | ||
1566 | lps->lp_pid = rsp->lp_pid; | ||
1550 | lps->npiv_en = rsp->npiv_en; | 1567 | lps->npiv_en = rsp->npiv_en; |
1551 | lps->lp_pid = rsp->lp_pid; | ||
1552 | lps->pr_bbcred = be16_to_cpu(rsp->bb_credit); | 1568 | lps->pr_bbcred = be16_to_cpu(rsp->bb_credit); |
1553 | lps->pr_pwwn = rsp->port_name; | 1569 | lps->pr_pwwn = rsp->port_name; |
1554 | lps->pr_nwwn = rsp->node_name; | 1570 | lps->pr_nwwn = rsp->node_name; |
@@ -1587,7 +1603,7 @@ bfa_lps_logout_rsp(struct bfa_s *bfa, struct bfi_lps_logout_rsp_s *rsp) | |||
1587 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); | 1603 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); |
1588 | struct bfa_lps_s *lps; | 1604 | struct bfa_lps_s *lps; |
1589 | 1605 | ||
1590 | bfa_assert(rsp->lp_tag < mod->num_lps); | 1606 | WARN_ON(rsp->lp_tag >= mod->num_lps); |
1591 | lps = BFA_LPS_FROM_TAG(mod, rsp->lp_tag); | 1607 | lps = BFA_LPS_FROM_TAG(mod, rsp->lp_tag); |
1592 | 1608 | ||
1593 | bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); | 1609 | bfa_sm_send_event(lps, BFA_LPS_SM_FWRSP); |
@@ -1640,7 +1656,7 @@ bfa_lps_send_login(struct bfa_lps_s *lps) | |||
1640 | struct bfi_lps_login_req_s *m; | 1656 | struct bfi_lps_login_req_s *m; |
1641 | 1657 | ||
1642 | m = bfa_reqq_next(lps->bfa, lps->reqq); | 1658 | m = bfa_reqq_next(lps->bfa, lps->reqq); |
1643 | bfa_assert(m); | 1659 | WARN_ON(!m); |
1644 | 1660 | ||
1645 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGIN_REQ, | 1661 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGIN_REQ, |
1646 | bfa_lpuid(lps->bfa)); | 1662 | bfa_lpuid(lps->bfa)); |
@@ -1665,7 +1681,7 @@ bfa_lps_send_logout(struct bfa_lps_s *lps) | |||
1665 | struct bfi_lps_logout_req_s *m; | 1681 | struct bfi_lps_logout_req_s *m; |
1666 | 1682 | ||
1667 | m = bfa_reqq_next(lps->bfa, lps->reqq); | 1683 | m = bfa_reqq_next(lps->bfa, lps->reqq); |
1668 | bfa_assert(m); | 1684 | WARN_ON(!m); |
1669 | 1685 | ||
1670 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGOUT_REQ, | 1686 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGOUT_REQ, |
1671 | bfa_lpuid(lps->bfa)); | 1687 | bfa_lpuid(lps->bfa)); |
@@ -1676,6 +1692,25 @@ bfa_lps_send_logout(struct bfa_lps_s *lps) | |||
1676 | } | 1692 | } |
1677 | 1693 | ||
1678 | /* | 1694 | /* |
1695 | * send n2n pid set request to firmware | ||
1696 | */ | ||
1697 | static void | ||
1698 | bfa_lps_send_set_n2n_pid(struct bfa_lps_s *lps) | ||
1699 | { | ||
1700 | struct bfi_lps_n2n_pid_req_s *m; | ||
1701 | |||
1702 | m = bfa_reqq_next(lps->bfa, lps->reqq); | ||
1703 | WARN_ON(!m); | ||
1704 | |||
1705 | bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_N2N_PID_REQ, | ||
1706 | bfa_lpuid(lps->bfa)); | ||
1707 | |||
1708 | m->lp_tag = lps->lp_tag; | ||
1709 | m->lp_pid = lps->lp_pid; | ||
1710 | bfa_reqq_produce(lps->bfa, lps->reqq); | ||
1711 | } | ||
1712 | |||
1713 | /* | ||
1679 | * Indirect login completion handler for non-fcs | 1714 | * Indirect login completion handler for non-fcs |
1680 | */ | 1715 | */ |
1681 | static void | 1716 | static void |
@@ -1853,14 +1888,6 @@ bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz, wwn_t pwwn, | |||
1853 | bfa_sm_send_event(lps, BFA_LPS_SM_LOGIN); | 1888 | bfa_sm_send_event(lps, BFA_LPS_SM_LOGIN); |
1854 | } | 1889 | } |
1855 | 1890 | ||
1856 | /* | ||
1857 | * Initiate a lport logout (flogi). | ||
1858 | */ | ||
1859 | void | ||
1860 | bfa_lps_flogo(struct bfa_lps_s *lps) | ||
1861 | { | ||
1862 | bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT); | ||
1863 | } | ||
1864 | 1891 | ||
1865 | /* | 1892 | /* |
1866 | * Initiate a lport FDSIC logout. | 1893 | * Initiate a lport FDSIC logout. |
@@ -1871,24 +1898,6 @@ bfa_lps_fdisclogo(struct bfa_lps_s *lps) | |||
1871 | bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT); | 1898 | bfa_sm_send_event(lps, BFA_LPS_SM_LOGOUT); |
1872 | } | 1899 | } |
1873 | 1900 | ||
1874 | /* | ||
1875 | * Discard a pending login request -- should be called only for | ||
1876 | * link down handling. | ||
1877 | */ | ||
1878 | void | ||
1879 | bfa_lps_discard(struct bfa_lps_s *lps) | ||
1880 | { | ||
1881 | bfa_sm_send_event(lps, BFA_LPS_SM_OFFLINE); | ||
1882 | } | ||
1883 | |||
1884 | /* | ||
1885 | * Return lport services tag | ||
1886 | */ | ||
1887 | u8 | ||
1888 | bfa_lps_get_tag(struct bfa_lps_s *lps) | ||
1889 | { | ||
1890 | return lps->lp_tag; | ||
1891 | } | ||
1892 | 1901 | ||
1893 | /* | 1902 | /* |
1894 | * Return lport services tag given the pid | 1903 | * Return lport services tag given the pid |
@@ -1909,55 +1918,6 @@ bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid) | |||
1909 | return 0; | 1918 | return 0; |
1910 | } | 1919 | } |
1911 | 1920 | ||
1912 | /* | ||
1913 | * return if fabric login indicates support for NPIV | ||
1914 | */ | ||
1915 | bfa_boolean_t | ||
1916 | bfa_lps_is_npiv_en(struct bfa_lps_s *lps) | ||
1917 | { | ||
1918 | return lps->npiv_en; | ||
1919 | } | ||
1920 | |||
1921 | /* | ||
1922 | * Return TRUE if attached to F-Port, else return FALSE | ||
1923 | */ | ||
1924 | bfa_boolean_t | ||
1925 | bfa_lps_is_fport(struct bfa_lps_s *lps) | ||
1926 | { | ||
1927 | return lps->fport; | ||
1928 | } | ||
1929 | |||
1930 | /* | ||
1931 | * Return TRUE if attached to a Brocade Fabric | ||
1932 | */ | ||
1933 | bfa_boolean_t | ||
1934 | bfa_lps_is_brcd_fabric(struct bfa_lps_s *lps) | ||
1935 | { | ||
1936 | return lps->brcd_switch; | ||
1937 | } | ||
1938 | /* | ||
1939 | * return TRUE if authentication is required | ||
1940 | */ | ||
1941 | bfa_boolean_t | ||
1942 | bfa_lps_is_authreq(struct bfa_lps_s *lps) | ||
1943 | { | ||
1944 | return lps->auth_req; | ||
1945 | } | ||
1946 | |||
1947 | bfa_eproto_status_t | ||
1948 | bfa_lps_get_extstatus(struct bfa_lps_s *lps) | ||
1949 | { | ||
1950 | return lps->ext_status; | ||
1951 | } | ||
1952 | |||
1953 | /* | ||
1954 | * return port id assigned to the lport | ||
1955 | */ | ||
1956 | u32 | ||
1957 | bfa_lps_get_pid(struct bfa_lps_s *lps) | ||
1958 | { | ||
1959 | return lps->lp_pid; | ||
1960 | } | ||
1961 | 1921 | ||
1962 | /* | 1922 | /* |
1963 | * return port id assigned to the base lport | 1923 | * return port id assigned to the base lport |
@@ -1971,57 +1931,16 @@ bfa_lps_get_base_pid(struct bfa_s *bfa) | |||
1971 | } | 1931 | } |
1972 | 1932 | ||
1973 | /* | 1933 | /* |
1974 | * Return bb_credit assigned in FLOGI response | 1934 | * Set PID in case of n2n (which is assigned during PLOGI) |
1975 | */ | ||
1976 | u16 | ||
1977 | bfa_lps_get_peer_bbcredit(struct bfa_lps_s *lps) | ||
1978 | { | ||
1979 | return lps->pr_bbcred; | ||
1980 | } | ||
1981 | |||
1982 | /* | ||
1983 | * Return peer port name | ||
1984 | */ | ||
1985 | wwn_t | ||
1986 | bfa_lps_get_peer_pwwn(struct bfa_lps_s *lps) | ||
1987 | { | ||
1988 | return lps->pr_pwwn; | ||
1989 | } | ||
1990 | |||
1991 | /* | ||
1992 | * Return peer node name | ||
1993 | */ | ||
1994 | wwn_t | ||
1995 | bfa_lps_get_peer_nwwn(struct bfa_lps_s *lps) | ||
1996 | { | ||
1997 | return lps->pr_nwwn; | ||
1998 | } | ||
1999 | |||
2000 | /* | ||
2001 | * return reason code if login request is rejected | ||
2002 | */ | ||
2003 | u8 | ||
2004 | bfa_lps_get_lsrjt_rsn(struct bfa_lps_s *lps) | ||
2005 | { | ||
2006 | return lps->lsrjt_rsn; | ||
2007 | } | ||
2008 | |||
2009 | /* | ||
2010 | * return explanation code if login request is rejected | ||
2011 | */ | 1935 | */ |
2012 | u8 | 1936 | void |
2013 | bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps) | 1937 | bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, uint32_t n2n_pid) |
2014 | { | 1938 | { |
2015 | return lps->lsrjt_expl; | 1939 | bfa_trc(lps->bfa, lps->lp_tag); |
2016 | } | 1940 | bfa_trc(lps->bfa, n2n_pid); |
2017 | 1941 | ||
2018 | /* | 1942 | lps->lp_pid = n2n_pid; |
2019 | * Return fpma/spma MAC for lport | 1943 | bfa_sm_send_event(lps, BFA_LPS_SM_SET_N2N_PID); |
2020 | */ | ||
2021 | mac_t | ||
2022 | bfa_lps_get_lp_mac(struct bfa_lps_s *lps) | ||
2023 | { | ||
2024 | return lps->lp_mac; | ||
2025 | } | 1944 | } |
2026 | 1945 | ||
2027 | /* | 1946 | /* |
@@ -2050,7 +1969,7 @@ bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
2050 | 1969 | ||
2051 | default: | 1970 | default: |
2052 | bfa_trc(bfa, m->mhdr.msg_id); | 1971 | bfa_trc(bfa, m->mhdr.msg_id); |
2053 | bfa_assert(0); | 1972 | WARN_ON(1); |
2054 | } | 1973 | } |
2055 | } | 1974 | } |
2056 | 1975 | ||
@@ -2068,6 +1987,8 @@ bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport, | |||
2068 | /* | 1987 | /* |
2069 | * Start event after IOC is configured and BFA is started. | 1988 | * Start event after IOC is configured and BFA is started. |
2070 | */ | 1989 | */ |
1990 | fcport->use_flash_cfg = BFA_TRUE; | ||
1991 | |||
2071 | if (bfa_fcport_send_enable(fcport)) { | 1992 | if (bfa_fcport_send_enable(fcport)) { |
2072 | bfa_trc(fcport->bfa, BFA_TRUE); | 1993 | bfa_trc(fcport->bfa, BFA_TRUE); |
2073 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling); | 1994 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling); |
@@ -2178,7 +2099,7 @@ bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport, | |||
2178 | bfa_fcport_update_linkinfo(fcport); | 2099 | bfa_fcport_update_linkinfo(fcport); |
2179 | bfa_sm_set_state(fcport, bfa_fcport_sm_linkup); | 2100 | bfa_sm_set_state(fcport, bfa_fcport_sm_linkup); |
2180 | 2101 | ||
2181 | bfa_assert(fcport->event_cbfn); | 2102 | WARN_ON(!fcport->event_cbfn); |
2182 | bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE); | 2103 | bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE); |
2183 | break; | 2104 | break; |
2184 | 2105 | ||
@@ -2229,7 +2150,7 @@ bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport, | |||
2229 | case BFA_FCPORT_SM_LINKUP: | 2150 | case BFA_FCPORT_SM_LINKUP: |
2230 | bfa_fcport_update_linkinfo(fcport); | 2151 | bfa_fcport_update_linkinfo(fcport); |
2231 | bfa_sm_set_state(fcport, bfa_fcport_sm_linkup); | 2152 | bfa_sm_set_state(fcport, bfa_fcport_sm_linkup); |
2232 | bfa_assert(fcport->event_cbfn); | 2153 | WARN_ON(!fcport->event_cbfn); |
2233 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, | 2154 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
2234 | BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkup"); | 2155 | BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkup"); |
2235 | if (!bfa_ioc_get_fcmode(&fcport->bfa->ioc)) { | 2156 | if (!bfa_ioc_get_fcmode(&fcport->bfa->ioc)) { |
@@ -2803,12 +2724,6 @@ bfa_fcport_ln_sm_up_dn_up_nf(struct bfa_fcport_ln_s *ln, | |||
2803 | } | 2724 | } |
2804 | } | 2725 | } |
2805 | 2726 | ||
2806 | |||
2807 | |||
2808 | /* | ||
2809 | * hal_port_private | ||
2810 | */ | ||
2811 | |||
2812 | static void | 2727 | static void |
2813 | __bfa_cb_fcport_event(void *cbarg, bfa_boolean_t complete) | 2728 | __bfa_cb_fcport_event(void *cbarg, bfa_boolean_t complete) |
2814 | { | 2729 | { |
@@ -2839,7 +2754,7 @@ bfa_fcport_scn(struct bfa_fcport_s *fcport, enum bfa_port_linkstate event, | |||
2839 | bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKDOWN); | 2754 | bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKDOWN); |
2840 | break; | 2755 | break; |
2841 | default: | 2756 | default: |
2842 | bfa_assert(0); | 2757 | WARN_ON(1); |
2843 | } | 2758 | } |
2844 | } | 2759 | } |
2845 | 2760 | ||
@@ -2906,7 +2821,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
2906 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | 2821 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
2907 | struct bfa_port_cfg_s *port_cfg = &fcport->cfg; | 2822 | struct bfa_port_cfg_s *port_cfg = &fcport->cfg; |
2908 | struct bfa_fcport_ln_s *ln = &fcport->ln; | 2823 | struct bfa_fcport_ln_s *ln = &fcport->ln; |
2909 | struct bfa_timeval_s tv; | 2824 | struct timeval tv; |
2910 | 2825 | ||
2911 | memset(fcport, 0, sizeof(struct bfa_fcport_s)); | 2826 | memset(fcport, 0, sizeof(struct bfa_fcport_s)); |
2912 | fcport->bfa = bfa; | 2827 | fcport->bfa = bfa; |
@@ -2920,7 +2835,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
2920 | /* | 2835 | /* |
2921 | * initialize time stamp for stats reset | 2836 | * initialize time stamp for stats reset |
2922 | */ | 2837 | */ |
2923 | bfa_os_gettimeofday(&tv); | 2838 | do_gettimeofday(&tv); |
2924 | fcport->stats_reset_time = tv.tv_sec; | 2839 | fcport->stats_reset_time = tv.tv_sec; |
2925 | 2840 | ||
2926 | /* | 2841 | /* |
@@ -3039,6 +2954,7 @@ bfa_fcport_send_enable(struct bfa_fcport_s *fcport) | |||
3039 | m->port_cfg = fcport->cfg; | 2954 | m->port_cfg = fcport->cfg; |
3040 | m->msgtag = fcport->msgtag; | 2955 | m->msgtag = fcport->msgtag; |
3041 | m->port_cfg.maxfrsize = cpu_to_be16(fcport->cfg.maxfrsize); | 2956 | m->port_cfg.maxfrsize = cpu_to_be16(fcport->cfg.maxfrsize); |
2957 | m->use_flash_cfg = fcport->use_flash_cfg; | ||
3042 | bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa); | 2958 | bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa); |
3043 | bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo); | 2959 | bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo); |
3044 | bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi); | 2960 | bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi); |
@@ -3089,8 +3005,8 @@ bfa_fcport_send_disable(struct bfa_fcport_s *fcport) | |||
3089 | static void | 3005 | static void |
3090 | bfa_fcport_set_wwns(struct bfa_fcport_s *fcport) | 3006 | bfa_fcport_set_wwns(struct bfa_fcport_s *fcport) |
3091 | { | 3007 | { |
3092 | fcport->pwwn = bfa_ioc_get_pwwn(&fcport->bfa->ioc); | 3008 | fcport->pwwn = fcport->bfa->ioc.attr->pwwn; |
3093 | fcport->nwwn = bfa_ioc_get_nwwn(&fcport->bfa->ioc); | 3009 | fcport->nwwn = fcport->bfa->ioc.attr->nwwn; |
3094 | 3010 | ||
3095 | bfa_trc(fcport->bfa, fcport->pwwn); | 3011 | bfa_trc(fcport->bfa, fcport->pwwn); |
3096 | bfa_trc(fcport->bfa, fcport->nwwn); | 3012 | bfa_trc(fcport->bfa, fcport->nwwn); |
@@ -3127,7 +3043,7 @@ bfa_fcport_qos_stats_swap(struct bfa_qos_stats_s *d, | |||
3127 | struct bfa_qos_stats_s *s) | 3043 | struct bfa_qos_stats_s *s) |
3128 | { | 3044 | { |
3129 | u32 *dip = (u32 *) d; | 3045 | u32 *dip = (u32 *) d; |
3130 | u32 *sip = (u32 *) s; | 3046 | __be32 *sip = (__be32 *) s; |
3131 | int i; | 3047 | int i; |
3132 | 3048 | ||
3133 | /* Now swap the 32 bit fields */ | 3049 | /* Now swap the 32 bit fields */ |
@@ -3140,12 +3056,12 @@ bfa_fcport_fcoe_stats_swap(struct bfa_fcoe_stats_s *d, | |||
3140 | struct bfa_fcoe_stats_s *s) | 3056 | struct bfa_fcoe_stats_s *s) |
3141 | { | 3057 | { |
3142 | u32 *dip = (u32 *) d; | 3058 | u32 *dip = (u32 *) d; |
3143 | u32 *sip = (u32 *) s; | 3059 | __be32 *sip = (__be32 *) s; |
3144 | int i; | 3060 | int i; |
3145 | 3061 | ||
3146 | for (i = 0; i < ((sizeof(struct bfa_fcoe_stats_s))/sizeof(u32)); | 3062 | for (i = 0; i < ((sizeof(struct bfa_fcoe_stats_s))/sizeof(u32)); |
3147 | i = i + 2) { | 3063 | i = i + 2) { |
3148 | #ifdef __BIGENDIAN | 3064 | #ifdef __BIG_ENDIAN |
3149 | dip[i] = be32_to_cpu(sip[i]); | 3065 | dip[i] = be32_to_cpu(sip[i]); |
3150 | dip[i + 1] = be32_to_cpu(sip[i + 1]); | 3066 | dip[i + 1] = be32_to_cpu(sip[i + 1]); |
3151 | #else | 3067 | #else |
@@ -3162,7 +3078,7 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete) | |||
3162 | 3078 | ||
3163 | if (complete) { | 3079 | if (complete) { |
3164 | if (fcport->stats_status == BFA_STATUS_OK) { | 3080 | if (fcport->stats_status == BFA_STATUS_OK) { |
3165 | struct bfa_timeval_s tv; | 3081 | struct timeval tv; |
3166 | 3082 | ||
3167 | /* Swap FC QoS or FCoE stats */ | 3083 | /* Swap FC QoS or FCoE stats */ |
3168 | if (bfa_ioc_get_fcmode(&fcport->bfa->ioc)) { | 3084 | if (bfa_ioc_get_fcmode(&fcport->bfa->ioc)) { |
@@ -3174,7 +3090,7 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete) | |||
3174 | &fcport->stats_ret->fcoe, | 3090 | &fcport->stats_ret->fcoe, |
3175 | &fcport->stats->fcoe); | 3091 | &fcport->stats->fcoe); |
3176 | 3092 | ||
3177 | bfa_os_gettimeofday(&tv); | 3093 | do_gettimeofday(&tv); |
3178 | fcport->stats_ret->fcoe.secs_reset = | 3094 | fcport->stats_ret->fcoe.secs_reset = |
3179 | tv.tv_sec - fcport->stats_reset_time; | 3095 | tv.tv_sec - fcport->stats_reset_time; |
3180 | } | 3096 | } |
@@ -3233,12 +3149,12 @@ __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete) | |||
3233 | struct bfa_fcport_s *fcport = cbarg; | 3149 | struct bfa_fcport_s *fcport = cbarg; |
3234 | 3150 | ||
3235 | if (complete) { | 3151 | if (complete) { |
3236 | struct bfa_timeval_s tv; | 3152 | struct timeval tv; |
3237 | 3153 | ||
3238 | /* | 3154 | /* |
3239 | * re-initialize time stamp for stats reset | 3155 | * re-initialize time stamp for stats reset |
3240 | */ | 3156 | */ |
3241 | bfa_os_gettimeofday(&tv); | 3157 | do_gettimeofday(&tv); |
3242 | fcport->stats_reset_time = tv.tv_sec; | 3158 | fcport->stats_reset_time = tv.tv_sec; |
3243 | 3159 | ||
3244 | fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status); | 3160 | fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status); |
@@ -3303,8 +3219,8 @@ bfa_trunk_scn(struct bfa_fcport_s *fcport, struct bfi_fcport_trunk_scn_s *scn) | |||
3303 | int link_bm = 0; | 3219 | int link_bm = 0; |
3304 | 3220 | ||
3305 | bfa_trc(fcport->bfa, fcport->cfg.trunked); | 3221 | bfa_trc(fcport->bfa, fcport->cfg.trunked); |
3306 | bfa_assert(scn->trunk_state == BFA_TRUNK_ONLINE || | 3222 | WARN_ON(scn->trunk_state != BFA_TRUNK_ONLINE && |
3307 | scn->trunk_state == BFA_TRUNK_OFFLINE); | 3223 | scn->trunk_state != BFA_TRUNK_OFFLINE); |
3308 | 3224 | ||
3309 | bfa_trc(fcport->bfa, trunk->attr.state); | 3225 | bfa_trc(fcport->bfa, trunk->attr.state); |
3310 | bfa_trc(fcport->bfa, scn->trunk_state); | 3226 | bfa_trc(fcport->bfa, scn->trunk_state); |
@@ -3396,12 +3312,6 @@ bfa_trunk_iocdisable(struct bfa_s *bfa) | |||
3396 | } | 3312 | } |
3397 | } | 3313 | } |
3398 | 3314 | ||
3399 | |||
3400 | |||
3401 | /* | ||
3402 | * hal_port_public | ||
3403 | */ | ||
3404 | |||
3405 | /* | 3315 | /* |
3406 | * Called to initialize port attributes | 3316 | * Called to initialize port attributes |
3407 | */ | 3317 | */ |
@@ -3419,9 +3329,9 @@ bfa_fcport_init(struct bfa_s *bfa) | |||
3419 | fcport->cfg.rx_bbcredit = bfa_ioc_rx_bbcredit(&bfa->ioc); | 3329 | fcport->cfg.rx_bbcredit = bfa_ioc_rx_bbcredit(&bfa->ioc); |
3420 | fcport->speed_sup = bfa_ioc_speed_sup(&bfa->ioc); | 3330 | fcport->speed_sup = bfa_ioc_speed_sup(&bfa->ioc); |
3421 | 3331 | ||
3422 | bfa_assert(fcport->cfg.maxfrsize); | 3332 | WARN_ON(!fcport->cfg.maxfrsize); |
3423 | bfa_assert(fcport->cfg.rx_bbcredit); | 3333 | WARN_ON(!fcport->cfg.rx_bbcredit); |
3424 | bfa_assert(fcport->speed_sup); | 3334 | WARN_ON(!fcport->speed_sup); |
3425 | } | 3335 | } |
3426 | 3336 | ||
3427 | /* | 3337 | /* |
@@ -3441,8 +3351,28 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) | |||
3441 | 3351 | ||
3442 | switch (msg->mhdr.msg_id) { | 3352 | switch (msg->mhdr.msg_id) { |
3443 | case BFI_FCPORT_I2H_ENABLE_RSP: | 3353 | case BFI_FCPORT_I2H_ENABLE_RSP: |
3444 | if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) | 3354 | if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) { |
3355 | |||
3356 | if (fcport->use_flash_cfg) { | ||
3357 | fcport->cfg = i2hmsg.penable_rsp->port_cfg; | ||
3358 | fcport->cfg.maxfrsize = | ||
3359 | cpu_to_be16(fcport->cfg.maxfrsize); | ||
3360 | fcport->cfg.path_tov = | ||
3361 | cpu_to_be16(fcport->cfg.path_tov); | ||
3362 | fcport->cfg.q_depth = | ||
3363 | cpu_to_be16(fcport->cfg.q_depth); | ||
3364 | |||
3365 | if (fcport->cfg.trunked) | ||
3366 | fcport->trunk.attr.state = | ||
3367 | BFA_TRUNK_OFFLINE; | ||
3368 | else | ||
3369 | fcport->trunk.attr.state = | ||
3370 | BFA_TRUNK_DISABLED; | ||
3371 | fcport->use_flash_cfg = BFA_FALSE; | ||
3372 | } | ||
3373 | |||
3445 | bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP); | 3374 | bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP); |
3375 | } | ||
3446 | break; | 3376 | break; |
3447 | 3377 | ||
3448 | case BFI_FCPORT_I2H_DISABLE_RSP: | 3378 | case BFI_FCPORT_I2H_DISABLE_RSP: |
@@ -3498,17 +3428,11 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) | |||
3498 | break; | 3428 | break; |
3499 | 3429 | ||
3500 | default: | 3430 | default: |
3501 | bfa_assert(0); | 3431 | WARN_ON(1); |
3502 | break; | 3432 | break; |
3503 | } | 3433 | } |
3504 | } | 3434 | } |
3505 | 3435 | ||
3506 | |||
3507 | |||
3508 | /* | ||
3509 | * hal_port_api | ||
3510 | */ | ||
3511 | |||
3512 | /* | 3436 | /* |
3513 | * Registered callback for port events. | 3437 | * Registered callback for port events. |
3514 | */ | 3438 | */ |
@@ -3732,8 +3656,8 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr) | |||
3732 | attr->nwwn = fcport->nwwn; | 3656 | attr->nwwn = fcport->nwwn; |
3733 | attr->pwwn = fcport->pwwn; | 3657 | attr->pwwn = fcport->pwwn; |
3734 | 3658 | ||
3735 | attr->factorypwwn = bfa_ioc_get_mfg_pwwn(&bfa->ioc); | 3659 | attr->factorypwwn = bfa->ioc.attr->mfg_pwwn; |
3736 | attr->factorynwwn = bfa_ioc_get_mfg_nwwn(&bfa->ioc); | 3660 | attr->factorynwwn = bfa->ioc.attr->mfg_nwwn; |
3737 | 3661 | ||
3738 | memcpy(&attr->pport_cfg, &fcport->cfg, | 3662 | memcpy(&attr->pport_cfg, &fcport->cfg, |
3739 | sizeof(struct bfa_port_cfg_s)); | 3663 | sizeof(struct bfa_port_cfg_s)); |
@@ -3751,7 +3675,7 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr) | |||
3751 | /* beacon attributes */ | 3675 | /* beacon attributes */ |
3752 | attr->beacon = fcport->beacon; | 3676 | attr->beacon = fcport->beacon; |
3753 | attr->link_e2e_beacon = fcport->link_e2e_beacon; | 3677 | attr->link_e2e_beacon = fcport->link_e2e_beacon; |
3754 | attr->plog_enabled = bfa_plog_get_setting(fcport->bfa->plog); | 3678 | attr->plog_enabled = (bfa_boolean_t)fcport->bfa->plog->plog_enabled; |
3755 | attr->io_profile = bfa_fcpim_get_io_profile(fcport->bfa); | 3679 | attr->io_profile = bfa_fcpim_get_io_profile(fcport->bfa); |
3756 | 3680 | ||
3757 | attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); | 3681 | attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); |
@@ -3818,89 +3742,6 @@ bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn, void *cbarg) | |||
3818 | return BFA_STATUS_OK; | 3742 | return BFA_STATUS_OK; |
3819 | } | 3743 | } |
3820 | 3744 | ||
3821 | /* | ||
3822 | * Fetch FCQoS port statistics | ||
3823 | */ | ||
3824 | bfa_status_t | ||
3825 | bfa_fcport_get_qos_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats, | ||
3826 | bfa_cb_port_t cbfn, void *cbarg) | ||
3827 | { | ||
3828 | /* Meaningful only for FC mode */ | ||
3829 | bfa_assert(bfa_ioc_get_fcmode(&bfa->ioc)); | ||
3830 | |||
3831 | return bfa_fcport_get_stats(bfa, stats, cbfn, cbarg); | ||
3832 | } | ||
3833 | |||
3834 | /* | ||
3835 | * Reset FCoE port statistics | ||
3836 | */ | ||
3837 | bfa_status_t | ||
3838 | bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn, void *cbarg) | ||
3839 | { | ||
3840 | /* Meaningful only for FC mode */ | ||
3841 | bfa_assert(bfa_ioc_get_fcmode(&bfa->ioc)); | ||
3842 | |||
3843 | return bfa_fcport_clear_stats(bfa, cbfn, cbarg); | ||
3844 | } | ||
3845 | |||
3846 | /* | ||
3847 | * Fetch FCQoS port statistics | ||
3848 | */ | ||
3849 | bfa_status_t | ||
3850 | bfa_fcport_get_fcoe_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats, | ||
3851 | bfa_cb_port_t cbfn, void *cbarg) | ||
3852 | { | ||
3853 | /* Meaningful only for FCoE mode */ | ||
3854 | bfa_assert(!bfa_ioc_get_fcmode(&bfa->ioc)); | ||
3855 | |||
3856 | return bfa_fcport_get_stats(bfa, stats, cbfn, cbarg); | ||
3857 | } | ||
3858 | |||
3859 | /* | ||
3860 | * Reset FCoE port statistics | ||
3861 | */ | ||
3862 | bfa_status_t | ||
3863 | bfa_fcport_clear_fcoe_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn, void *cbarg) | ||
3864 | { | ||
3865 | /* Meaningful only for FCoE mode */ | ||
3866 | bfa_assert(!bfa_ioc_get_fcmode(&bfa->ioc)); | ||
3867 | |||
3868 | return bfa_fcport_clear_stats(bfa, cbfn, cbarg); | ||
3869 | } | ||
3870 | |||
3871 | void | ||
3872 | bfa_fcport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr) | ||
3873 | { | ||
3874 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
3875 | |||
3876 | qos_attr->state = fcport->qos_attr.state; | ||
3877 | qos_attr->total_bb_cr = be32_to_cpu(fcport->qos_attr.total_bb_cr); | ||
3878 | } | ||
3879 | |||
3880 | void | ||
3881 | bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa, | ||
3882 | struct bfa_qos_vc_attr_s *qos_vc_attr) | ||
3883 | { | ||
3884 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
3885 | struct bfa_qos_vc_attr_s *bfa_vc_attr = &fcport->qos_vc_attr; | ||
3886 | u32 i = 0; | ||
3887 | |||
3888 | qos_vc_attr->total_vc_count = be16_to_cpu(bfa_vc_attr->total_vc_count); | ||
3889 | qos_vc_attr->shared_credit = be16_to_cpu(bfa_vc_attr->shared_credit); | ||
3890 | qos_vc_attr->elp_opmode_flags = | ||
3891 | be32_to_cpu(bfa_vc_attr->elp_opmode_flags); | ||
3892 | |||
3893 | /* Individual VC info */ | ||
3894 | while (i < qos_vc_attr->total_vc_count) { | ||
3895 | qos_vc_attr->vc_info[i].vc_credit = | ||
3896 | bfa_vc_attr->vc_info[i].vc_credit; | ||
3897 | qos_vc_attr->vc_info[i].borrow_credit = | ||
3898 | bfa_vc_attr->vc_info[i].borrow_credit; | ||
3899 | qos_vc_attr->vc_info[i].priority = | ||
3900 | bfa_vc_attr->vc_info[i].priority; | ||
3901 | ++i; | ||
3902 | } | ||
3903 | } | ||
3904 | 3745 | ||
3905 | /* | 3746 | /* |
3906 | * Fetch port attributes. | 3747 | * Fetch port attributes. |
@@ -3924,60 +3765,6 @@ bfa_fcport_is_ratelim(struct bfa_s *bfa) | |||
3924 | 3765 | ||
3925 | } | 3766 | } |
3926 | 3767 | ||
3927 | void | ||
3928 | bfa_fcport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off) | ||
3929 | { | ||
3930 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
3931 | enum bfa_ioc_type_e ioc_type = bfa_get_type(bfa); | ||
3932 | |||
3933 | bfa_trc(bfa, on_off); | ||
3934 | bfa_trc(bfa, fcport->cfg.qos_enabled); | ||
3935 | |||
3936 | bfa_trc(bfa, ioc_type); | ||
3937 | |||
3938 | if (ioc_type == BFA_IOC_TYPE_FC) { | ||
3939 | fcport->cfg.qos_enabled = on_off; | ||
3940 | /* | ||
3941 | * Notify fcpim of the change in QoS state | ||
3942 | */ | ||
3943 | bfa_fcpim_update_ioredirect(bfa); | ||
3944 | } | ||
3945 | } | ||
3946 | |||
3947 | void | ||
3948 | bfa_fcport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off) | ||
3949 | { | ||
3950 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
3951 | |||
3952 | bfa_trc(bfa, on_off); | ||
3953 | bfa_trc(bfa, fcport->cfg.ratelimit); | ||
3954 | |||
3955 | fcport->cfg.ratelimit = on_off; | ||
3956 | if (fcport->cfg.trl_def_speed == BFA_PORT_SPEED_UNKNOWN) | ||
3957 | fcport->cfg.trl_def_speed = BFA_PORT_SPEED_1GBPS; | ||
3958 | } | ||
3959 | |||
3960 | /* | ||
3961 | * Configure default minimum ratelim speed | ||
3962 | */ | ||
3963 | bfa_status_t | ||
3964 | bfa_fcport_cfg_ratelim_speed(struct bfa_s *bfa, enum bfa_port_speed speed) | ||
3965 | { | ||
3966 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
3967 | |||
3968 | bfa_trc(bfa, speed); | ||
3969 | |||
3970 | /* Auto and speeds greater than the supported speed, are invalid */ | ||
3971 | if ((speed == BFA_PORT_SPEED_AUTO) || (speed > fcport->speed_sup)) { | ||
3972 | bfa_trc(bfa, fcport->speed_sup); | ||
3973 | return BFA_STATUS_UNSUPP_SPEED; | ||
3974 | } | ||
3975 | |||
3976 | fcport->cfg.trl_def_speed = speed; | ||
3977 | |||
3978 | return BFA_STATUS_OK; | ||
3979 | } | ||
3980 | |||
3981 | /* | 3768 | /* |
3982 | * Get default minimum ratelim speed | 3769 | * Get default minimum ratelim speed |
3983 | */ | 3770 | */ |
@@ -3990,32 +3777,6 @@ bfa_fcport_get_ratelim_speed(struct bfa_s *bfa) | |||
3990 | return fcport->cfg.trl_def_speed; | 3777 | return fcport->cfg.trl_def_speed; |
3991 | 3778 | ||
3992 | } | 3779 | } |
3993 | void | ||
3994 | bfa_fcport_busy(struct bfa_s *bfa, bfa_boolean_t status) | ||
3995 | { | ||
3996 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
3997 | |||
3998 | bfa_trc(bfa, status); | ||
3999 | bfa_trc(bfa, fcport->diag_busy); | ||
4000 | |||
4001 | fcport->diag_busy = status; | ||
4002 | } | ||
4003 | |||
4004 | void | ||
4005 | bfa_fcport_beacon(void *dev, bfa_boolean_t beacon, | ||
4006 | bfa_boolean_t link_e2e_beacon) | ||
4007 | { | ||
4008 | struct bfa_s *bfa = dev; | ||
4009 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
4010 | |||
4011 | bfa_trc(bfa, beacon); | ||
4012 | bfa_trc(bfa, link_e2e_beacon); | ||
4013 | bfa_trc(bfa, fcport->beacon); | ||
4014 | bfa_trc(bfa, fcport->link_e2e_beacon); | ||
4015 | |||
4016 | fcport->beacon = beacon; | ||
4017 | fcport->link_e2e_beacon = link_e2e_beacon; | ||
4018 | } | ||
4019 | 3780 | ||
4020 | bfa_boolean_t | 3781 | bfa_boolean_t |
4021 | bfa_fcport_is_linkup(struct bfa_s *bfa) | 3782 | bfa_fcport_is_linkup(struct bfa_s *bfa) |
@@ -4036,63 +3797,6 @@ bfa_fcport_is_qos_enabled(struct bfa_s *bfa) | |||
4036 | return fcport->cfg.qos_enabled; | 3797 | return fcport->cfg.qos_enabled; |
4037 | } | 3798 | } |
4038 | 3799 | ||
4039 | bfa_status_t | ||
4040 | bfa_trunk_get_attr(struct bfa_s *bfa, struct bfa_trunk_attr_s *attr) | ||
4041 | |||
4042 | { | ||
4043 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
4044 | struct bfa_fcport_trunk_s *trunk = &fcport->trunk; | ||
4045 | |||
4046 | bfa_trc(bfa, fcport->cfg.trunked); | ||
4047 | bfa_trc(bfa, trunk->attr.state); | ||
4048 | *attr = trunk->attr; | ||
4049 | attr->port_id = bfa_lps_get_base_pid(bfa); | ||
4050 | |||
4051 | return BFA_STATUS_OK; | ||
4052 | } | ||
4053 | |||
4054 | void | ||
4055 | bfa_trunk_enable_cfg(struct bfa_s *bfa) | ||
4056 | { | ||
4057 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
4058 | struct bfa_fcport_trunk_s *trunk = &fcport->trunk; | ||
4059 | |||
4060 | bfa_trc(bfa, 1); | ||
4061 | trunk->attr.state = BFA_TRUNK_OFFLINE; | ||
4062 | fcport->cfg.trunked = BFA_TRUE; | ||
4063 | } | ||
4064 | |||
4065 | bfa_status_t | ||
4066 | bfa_trunk_enable(struct bfa_s *bfa) | ||
4067 | { | ||
4068 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
4069 | struct bfa_fcport_trunk_s *trunk = &fcport->trunk; | ||
4070 | |||
4071 | bfa_trc(bfa, 1); | ||
4072 | |||
4073 | trunk->attr.state = BFA_TRUNK_OFFLINE; | ||
4074 | bfa_fcport_disable(bfa); | ||
4075 | fcport->cfg.trunked = BFA_TRUE; | ||
4076 | bfa_fcport_enable(bfa); | ||
4077 | |||
4078 | return BFA_STATUS_OK; | ||
4079 | } | ||
4080 | |||
4081 | bfa_status_t | ||
4082 | bfa_trunk_disable(struct bfa_s *bfa) | ||
4083 | { | ||
4084 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); | ||
4085 | struct bfa_fcport_trunk_s *trunk = &fcport->trunk; | ||
4086 | |||
4087 | bfa_trc(bfa, 0); | ||
4088 | trunk->attr.state = BFA_TRUNK_DISABLED; | ||
4089 | bfa_fcport_disable(bfa); | ||
4090 | fcport->cfg.trunked = BFA_FALSE; | ||
4091 | bfa_fcport_enable(bfa); | ||
4092 | return BFA_STATUS_OK; | ||
4093 | } | ||
4094 | |||
4095 | |||
4096 | /* | 3800 | /* |
4097 | * Rport State machine functions | 3801 | * Rport State machine functions |
4098 | */ | 3802 | */ |
@@ -4606,8 +4310,8 @@ bfa_rport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
4606 | mod->rps_list = rp; | 4310 | mod->rps_list = rp; |
4607 | mod->num_rports = cfg->fwcfg.num_rports; | 4311 | mod->num_rports = cfg->fwcfg.num_rports; |
4608 | 4312 | ||
4609 | bfa_assert(mod->num_rports && | 4313 | WARN_ON(!mod->num_rports || |
4610 | !(mod->num_rports & (mod->num_rports - 1))); | 4314 | (mod->num_rports & (mod->num_rports - 1))); |
4611 | 4315 | ||
4612 | for (i = 0; i < mod->num_rports; i++, rp++) { | 4316 | for (i = 0; i < mod->num_rports; i++, rp++) { |
4613 | memset(rp, 0, sizeof(struct bfa_rport_s)); | 4317 | memset(rp, 0, sizeof(struct bfa_rport_s)); |
@@ -4675,7 +4379,7 @@ bfa_rport_free(struct bfa_rport_s *rport) | |||
4675 | { | 4379 | { |
4676 | struct bfa_rport_mod_s *mod = BFA_RPORT_MOD(rport->bfa); | 4380 | struct bfa_rport_mod_s *mod = BFA_RPORT_MOD(rport->bfa); |
4677 | 4381 | ||
4678 | bfa_assert(bfa_q_is_on_q(&mod->rp_active_q, rport)); | 4382 | WARN_ON(!bfa_q_is_on_q(&mod->rp_active_q, rport)); |
4679 | list_del(&rport->qe); | 4383 | list_del(&rport->qe); |
4680 | list_add_tail(&rport->qe, &mod->rp_free_q); | 4384 | list_add_tail(&rport->qe, &mod->rp_free_q); |
4681 | } | 4385 | } |
@@ -4788,13 +4492,13 @@ bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
4788 | rp = BFA_RPORT_FROM_TAG(bfa, msg.create_rsp->bfa_handle); | 4492 | rp = BFA_RPORT_FROM_TAG(bfa, msg.create_rsp->bfa_handle); |
4789 | rp->fw_handle = msg.create_rsp->fw_handle; | 4493 | rp->fw_handle = msg.create_rsp->fw_handle; |
4790 | rp->qos_attr = msg.create_rsp->qos_attr; | 4494 | rp->qos_attr = msg.create_rsp->qos_attr; |
4791 | bfa_assert(msg.create_rsp->status == BFA_STATUS_OK); | 4495 | WARN_ON(msg.create_rsp->status != BFA_STATUS_OK); |
4792 | bfa_sm_send_event(rp, BFA_RPORT_SM_FWRSP); | 4496 | bfa_sm_send_event(rp, BFA_RPORT_SM_FWRSP); |
4793 | break; | 4497 | break; |
4794 | 4498 | ||
4795 | case BFI_RPORT_I2H_DELETE_RSP: | 4499 | case BFI_RPORT_I2H_DELETE_RSP: |
4796 | rp = BFA_RPORT_FROM_TAG(bfa, msg.delete_rsp->bfa_handle); | 4500 | rp = BFA_RPORT_FROM_TAG(bfa, msg.delete_rsp->bfa_handle); |
4797 | bfa_assert(msg.delete_rsp->status == BFA_STATUS_OK); | 4501 | WARN_ON(msg.delete_rsp->status != BFA_STATUS_OK); |
4798 | bfa_sm_send_event(rp, BFA_RPORT_SM_FWRSP); | 4502 | bfa_sm_send_event(rp, BFA_RPORT_SM_FWRSP); |
4799 | break; | 4503 | break; |
4800 | 4504 | ||
@@ -4806,7 +4510,7 @@ bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
4806 | 4510 | ||
4807 | default: | 4511 | default: |
4808 | bfa_trc(bfa, m->mhdr.msg_id); | 4512 | bfa_trc(bfa, m->mhdr.msg_id); |
4809 | bfa_assert(0); | 4513 | WARN_ON(1); |
4810 | } | 4514 | } |
4811 | } | 4515 | } |
4812 | 4516 | ||
@@ -4828,24 +4532,18 @@ bfa_rport_create(struct bfa_s *bfa, void *rport_drv) | |||
4828 | 4532 | ||
4829 | rp->bfa = bfa; | 4533 | rp->bfa = bfa; |
4830 | rp->rport_drv = rport_drv; | 4534 | rp->rport_drv = rport_drv; |
4831 | bfa_rport_clear_stats(rp); | 4535 | memset(&rp->stats, 0, sizeof(rp->stats)); |
4832 | 4536 | ||
4833 | bfa_assert(bfa_sm_cmp_state(rp, bfa_rport_sm_uninit)); | 4537 | WARN_ON(!bfa_sm_cmp_state(rp, bfa_rport_sm_uninit)); |
4834 | bfa_sm_send_event(rp, BFA_RPORT_SM_CREATE); | 4538 | bfa_sm_send_event(rp, BFA_RPORT_SM_CREATE); |
4835 | 4539 | ||
4836 | return rp; | 4540 | return rp; |
4837 | } | 4541 | } |
4838 | 4542 | ||
4839 | void | 4543 | void |
4840 | bfa_rport_delete(struct bfa_rport_s *rport) | ||
4841 | { | ||
4842 | bfa_sm_send_event(rport, BFA_RPORT_SM_DELETE); | ||
4843 | } | ||
4844 | |||
4845 | void | ||
4846 | bfa_rport_online(struct bfa_rport_s *rport, struct bfa_rport_info_s *rport_info) | 4544 | bfa_rport_online(struct bfa_rport_s *rport, struct bfa_rport_info_s *rport_info) |
4847 | { | 4545 | { |
4848 | bfa_assert(rport_info->max_frmsz != 0); | 4546 | WARN_ON(rport_info->max_frmsz == 0); |
4849 | 4547 | ||
4850 | /* | 4548 | /* |
4851 | * Some JBODs are seen to be not setting PDU size correctly in PLOGI | 4549 | * Some JBODs are seen to be not setting PDU size correctly in PLOGI |
@@ -4861,43 +4559,15 @@ bfa_rport_online(struct bfa_rport_s *rport, struct bfa_rport_info_s *rport_info) | |||
4861 | } | 4559 | } |
4862 | 4560 | ||
4863 | void | 4561 | void |
4864 | bfa_rport_offline(struct bfa_rport_s *rport) | ||
4865 | { | ||
4866 | bfa_sm_send_event(rport, BFA_RPORT_SM_OFFLINE); | ||
4867 | } | ||
4868 | |||
4869 | void | ||
4870 | bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed) | 4562 | bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed) |
4871 | { | 4563 | { |
4872 | bfa_assert(speed != 0); | 4564 | WARN_ON(speed == 0); |
4873 | bfa_assert(speed != BFA_PORT_SPEED_AUTO); | 4565 | WARN_ON(speed == BFA_PORT_SPEED_AUTO); |
4874 | 4566 | ||
4875 | rport->rport_info.speed = speed; | 4567 | rport->rport_info.speed = speed; |
4876 | bfa_sm_send_event(rport, BFA_RPORT_SM_SET_SPEED); | 4568 | bfa_sm_send_event(rport, BFA_RPORT_SM_SET_SPEED); |
4877 | } | 4569 | } |
4878 | 4570 | ||
4879 | void | ||
4880 | bfa_rport_get_stats(struct bfa_rport_s *rport, | ||
4881 | struct bfa_rport_hal_stats_s *stats) | ||
4882 | { | ||
4883 | *stats = rport->stats; | ||
4884 | } | ||
4885 | |||
4886 | void | ||
4887 | bfa_rport_get_qos_attr(struct bfa_rport_s *rport, | ||
4888 | struct bfa_rport_qos_attr_s *qos_attr) | ||
4889 | { | ||
4890 | qos_attr->qos_priority = rport->qos_attr.qos_priority; | ||
4891 | qos_attr->qos_flow_id = be32_to_cpu(rport->qos_attr.qos_flow_id); | ||
4892 | |||
4893 | } | ||
4894 | |||
4895 | void | ||
4896 | bfa_rport_clear_stats(struct bfa_rport_s *rport) | ||
4897 | { | ||
4898 | memset(&rport->stats, 0, sizeof(rport->stats)); | ||
4899 | } | ||
4900 | |||
4901 | 4571 | ||
4902 | /* | 4572 | /* |
4903 | * SGPG related functions | 4573 | * SGPG related functions |
@@ -4952,7 +4622,7 @@ bfa_sgpg_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
4952 | sgpg_pa.pa = mod->sgpg_arr_pa; | 4622 | sgpg_pa.pa = mod->sgpg_arr_pa; |
4953 | mod->free_sgpgs = mod->num_sgpgs; | 4623 | mod->free_sgpgs = mod->num_sgpgs; |
4954 | 4624 | ||
4955 | bfa_assert(!(sgpg_pa.pa & (sizeof(struct bfi_sgpg_s) - 1))); | 4625 | WARN_ON(sgpg_pa.pa & (sizeof(struct bfi_sgpg_s) - 1)); |
4956 | 4626 | ||
4957 | for (i = 0; i < mod->num_sgpgs; i++) { | 4627 | for (i = 0; i < mod->num_sgpgs; i++) { |
4958 | memset(hsgpg, 0, sizeof(*hsgpg)); | 4628 | memset(hsgpg, 0, sizeof(*hsgpg)); |
@@ -4993,12 +4663,6 @@ bfa_sgpg_iocdisable(struct bfa_s *bfa) | |||
4993 | { | 4663 | { |
4994 | } | 4664 | } |
4995 | 4665 | ||
4996 | |||
4997 | |||
4998 | /* | ||
4999 | * hal_sgpg_public BFA SGPG public functions | ||
5000 | */ | ||
5001 | |||
5002 | bfa_status_t | 4666 | bfa_status_t |
5003 | bfa_sgpg_malloc(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpgs) | 4667 | bfa_sgpg_malloc(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpgs) |
5004 | { | 4668 | { |
@@ -5006,14 +4670,12 @@ bfa_sgpg_malloc(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpgs) | |||
5006 | struct bfa_sgpg_s *hsgpg; | 4670 | struct bfa_sgpg_s *hsgpg; |
5007 | int i; | 4671 | int i; |
5008 | 4672 | ||
5009 | bfa_trc_fp(bfa, nsgpgs); | ||
5010 | |||
5011 | if (mod->free_sgpgs < nsgpgs) | 4673 | if (mod->free_sgpgs < nsgpgs) |
5012 | return BFA_STATUS_ENOMEM; | 4674 | return BFA_STATUS_ENOMEM; |
5013 | 4675 | ||
5014 | for (i = 0; i < nsgpgs; i++) { | 4676 | for (i = 0; i < nsgpgs; i++) { |
5015 | bfa_q_deq(&mod->sgpg_q, &hsgpg); | 4677 | bfa_q_deq(&mod->sgpg_q, &hsgpg); |
5016 | bfa_assert(hsgpg); | 4678 | WARN_ON(!hsgpg); |
5017 | list_add_tail(&hsgpg->qe, sgpg_q); | 4679 | list_add_tail(&hsgpg->qe, sgpg_q); |
5018 | } | 4680 | } |
5019 | 4681 | ||
@@ -5027,10 +4689,8 @@ bfa_sgpg_mfree(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpg) | |||
5027 | struct bfa_sgpg_mod_s *mod = BFA_SGPG_MOD(bfa); | 4689 | struct bfa_sgpg_mod_s *mod = BFA_SGPG_MOD(bfa); |
5028 | struct bfa_sgpg_wqe_s *wqe; | 4690 | struct bfa_sgpg_wqe_s *wqe; |
5029 | 4691 | ||
5030 | bfa_trc_fp(bfa, nsgpg); | ||
5031 | |||
5032 | mod->free_sgpgs += nsgpg; | 4692 | mod->free_sgpgs += nsgpg; |
5033 | bfa_assert(mod->free_sgpgs <= mod->num_sgpgs); | 4693 | WARN_ON(mod->free_sgpgs > mod->num_sgpgs); |
5034 | 4694 | ||
5035 | list_splice_tail_init(sgpg_q, &mod->sgpg_q); | 4695 | list_splice_tail_init(sgpg_q, &mod->sgpg_q); |
5036 | 4696 | ||
@@ -5060,8 +4720,8 @@ bfa_sgpg_wait(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe, int nsgpg) | |||
5060 | { | 4720 | { |
5061 | struct bfa_sgpg_mod_s *mod = BFA_SGPG_MOD(bfa); | 4721 | struct bfa_sgpg_mod_s *mod = BFA_SGPG_MOD(bfa); |
5062 | 4722 | ||
5063 | bfa_assert(nsgpg > 0); | 4723 | WARN_ON(nsgpg <= 0); |
5064 | bfa_assert(nsgpg > mod->free_sgpgs); | 4724 | WARN_ON(nsgpg <= mod->free_sgpgs); |
5065 | 4725 | ||
5066 | wqe->nsgpg_total = wqe->nsgpg = nsgpg; | 4726 | wqe->nsgpg_total = wqe->nsgpg = nsgpg; |
5067 | 4727 | ||
@@ -5072,7 +4732,7 @@ bfa_sgpg_wait(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe, int nsgpg) | |||
5072 | /* | 4732 | /* |
5073 | * no one else is waiting for SGPG | 4733 | * no one else is waiting for SGPG |
5074 | */ | 4734 | */ |
5075 | bfa_assert(list_empty(&mod->sgpg_wait_q)); | 4735 | WARN_ON(!list_empty(&mod->sgpg_wait_q)); |
5076 | list_splice_tail_init(&mod->sgpg_q, &wqe->sgpg_q); | 4736 | list_splice_tail_init(&mod->sgpg_q, &wqe->sgpg_q); |
5077 | wqe->nsgpg -= mod->free_sgpgs; | 4737 | wqe->nsgpg -= mod->free_sgpgs; |
5078 | mod->free_sgpgs = 0; | 4738 | mod->free_sgpgs = 0; |
@@ -5086,7 +4746,7 @@ bfa_sgpg_wcancel(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe) | |||
5086 | { | 4746 | { |
5087 | struct bfa_sgpg_mod_s *mod = BFA_SGPG_MOD(bfa); | 4747 | struct bfa_sgpg_mod_s *mod = BFA_SGPG_MOD(bfa); |
5088 | 4748 | ||
5089 | bfa_assert(bfa_q_is_on_q(&mod->sgpg_wait_q, wqe)); | 4749 | WARN_ON(!bfa_q_is_on_q(&mod->sgpg_wait_q, wqe)); |
5090 | list_del(&wqe->qe); | 4750 | list_del(&wqe->qe); |
5091 | 4751 | ||
5092 | if (wqe->nsgpg_total != wqe->nsgpg) | 4752 | if (wqe->nsgpg_total != wqe->nsgpg) |
@@ -5318,7 +4978,7 @@ uf_recv(struct bfa_s *bfa, struct bfi_uf_frm_rcvd_s *m) | |||
5318 | uf->data_ptr = buf; | 4978 | uf->data_ptr = buf; |
5319 | uf->data_len = m->xfr_len; | 4979 | uf->data_len = m->xfr_len; |
5320 | 4980 | ||
5321 | bfa_assert(uf->data_len >= sizeof(struct fchs_s)); | 4981 | WARN_ON(uf->data_len < sizeof(struct fchs_s)); |
5322 | 4982 | ||
5323 | if (uf->data_len == sizeof(struct fchs_s)) { | 4983 | if (uf->data_len == sizeof(struct fchs_s)) { |
5324 | bfa_plog_fchdr(bfa->plog, BFA_PL_MID_HAL_UF, BFA_PL_EID_RX, | 4984 | bfa_plog_fchdr(bfa->plog, BFA_PL_MID_HAL_UF, BFA_PL_EID_RX, |
@@ -5361,12 +5021,6 @@ bfa_uf_start(struct bfa_s *bfa) | |||
5361 | bfa_uf_post_all(BFA_UF_MOD(bfa)); | 5021 | bfa_uf_post_all(BFA_UF_MOD(bfa)); |
5362 | } | 5022 | } |
5363 | 5023 | ||
5364 | |||
5365 | |||
5366 | /* | ||
5367 | * hal_uf_api | ||
5368 | */ | ||
5369 | |||
5370 | /* | 5024 | /* |
5371 | * Register handler for all unsolicted recieve frames. | 5025 | * Register handler for all unsolicted recieve frames. |
5372 | * | 5026 | * |
@@ -5414,7 +5068,7 @@ bfa_uf_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) | |||
5414 | 5068 | ||
5415 | default: | 5069 | default: |
5416 | bfa_trc(bfa, msg->mhdr.msg_id); | 5070 | bfa_trc(bfa, msg->mhdr.msg_id); |
5417 | bfa_assert(0); | 5071 | WARN_ON(1); |
5418 | } | 5072 | } |
5419 | } | 5073 | } |
5420 | 5074 | ||
diff --git a/drivers/scsi/bfa/bfa_svc.h b/drivers/scsi/bfa/bfa_svc.h index e2349d5cdb9..331ad992a58 100644 --- a/drivers/scsi/bfa/bfa_svc.h +++ b/drivers/scsi/bfa/bfa_svc.h | |||
@@ -220,6 +220,18 @@ void bfa_fcxp_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | |||
220 | /* | 220 | /* |
221 | * RPORT related defines | 221 | * RPORT related defines |
222 | */ | 222 | */ |
223 | enum bfa_rport_event { | ||
224 | BFA_RPORT_SM_CREATE = 1, /* rport create event */ | ||
225 | BFA_RPORT_SM_DELETE = 2, /* deleting an existing rport */ | ||
226 | BFA_RPORT_SM_ONLINE = 3, /* rport is online */ | ||
227 | BFA_RPORT_SM_OFFLINE = 4, /* rport is offline */ | ||
228 | BFA_RPORT_SM_FWRSP = 5, /* firmware response */ | ||
229 | BFA_RPORT_SM_HWFAIL = 6, /* IOC h/w failure */ | ||
230 | BFA_RPORT_SM_QOS_SCN = 7, /* QoS SCN from firmware */ | ||
231 | BFA_RPORT_SM_SET_SPEED = 8, /* Set Rport Speed */ | ||
232 | BFA_RPORT_SM_QRESUME = 9, /* space in requeue queue */ | ||
233 | }; | ||
234 | |||
223 | #define BFA_RPORT_MIN 4 | 235 | #define BFA_RPORT_MIN 4 |
224 | 236 | ||
225 | struct bfa_rport_mod_s { | 237 | struct bfa_rport_mod_s { |
@@ -432,6 +444,7 @@ struct bfa_fcport_s { | |||
432 | u8 myalpa; /* my ALPA in LOOP topology */ | 444 | u8 myalpa; /* my ALPA in LOOP topology */ |
433 | u8 rsvd[3]; | 445 | u8 rsvd[3]; |
434 | struct bfa_port_cfg_s cfg; /* current port configuration */ | 446 | struct bfa_port_cfg_s cfg; /* current port configuration */ |
447 | bfa_boolean_t use_flash_cfg; /* get port cfg from flash */ | ||
435 | struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ | 448 | struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ |
436 | struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */ | 449 | struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */ |
437 | struct bfa_reqq_wait_s reqq_wait; | 450 | struct bfa_reqq_wait_s reqq_wait; |
@@ -500,30 +513,9 @@ void bfa_fcport_event_register(struct bfa_s *bfa, | |||
500 | void (*event_cbfn) (void *cbarg, | 513 | void (*event_cbfn) (void *cbarg, |
501 | enum bfa_port_linkstate event), void *event_cbarg); | 514 | enum bfa_port_linkstate event), void *event_cbarg); |
502 | bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa); | 515 | bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa); |
503 | void bfa_fcport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off); | ||
504 | void bfa_fcport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off); | ||
505 | bfa_status_t bfa_fcport_cfg_ratelim_speed(struct bfa_s *bfa, | ||
506 | enum bfa_port_speed speed); | ||
507 | enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa); | 516 | enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa); |
508 | 517 | ||
509 | void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit); | 518 | void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit); |
510 | void bfa_fcport_busy(struct bfa_s *bfa, bfa_boolean_t status); | ||
511 | void bfa_fcport_beacon(void *dev, bfa_boolean_t beacon, | ||
512 | bfa_boolean_t link_e2e_beacon); | ||
513 | void bfa_fcport_qos_get_attr(struct bfa_s *bfa, | ||
514 | struct bfa_qos_attr_s *qos_attr); | ||
515 | void bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa, | ||
516 | struct bfa_qos_vc_attr_s *qos_vc_attr); | ||
517 | bfa_status_t bfa_fcport_get_qos_stats(struct bfa_s *bfa, | ||
518 | union bfa_fcport_stats_u *stats, | ||
519 | bfa_cb_port_t cbfn, void *cbarg); | ||
520 | bfa_status_t bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn, | ||
521 | void *cbarg); | ||
522 | bfa_status_t bfa_fcport_get_fcoe_stats(struct bfa_s *bfa, | ||
523 | union bfa_fcport_stats_u *stats, | ||
524 | bfa_cb_port_t cbfn, void *cbarg); | ||
525 | bfa_status_t bfa_fcport_clear_fcoe_stats(struct bfa_s *bfa, bfa_cb_port_t cbfn, | ||
526 | void *cbarg); | ||
527 | bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa); | 519 | bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa); |
528 | bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa); | 520 | bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa); |
529 | bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa, | 521 | bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa, |
@@ -537,14 +529,9 @@ bfa_boolean_t bfa_fcport_is_qos_enabled(struct bfa_s *bfa); | |||
537 | * bfa rport API functions | 529 | * bfa rport API functions |
538 | */ | 530 | */ |
539 | struct bfa_rport_s *bfa_rport_create(struct bfa_s *bfa, void *rport_drv); | 531 | struct bfa_rport_s *bfa_rport_create(struct bfa_s *bfa, void *rport_drv); |
540 | void bfa_rport_delete(struct bfa_rport_s *rport); | ||
541 | void bfa_rport_online(struct bfa_rport_s *rport, | 532 | void bfa_rport_online(struct bfa_rport_s *rport, |
542 | struct bfa_rport_info_s *rport_info); | 533 | struct bfa_rport_info_s *rport_info); |
543 | void bfa_rport_offline(struct bfa_rport_s *rport); | ||
544 | void bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed); | 534 | void bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed); |
545 | void bfa_rport_get_stats(struct bfa_rport_s *rport, | ||
546 | struct bfa_rport_hal_stats_s *stats); | ||
547 | void bfa_rport_clear_stats(struct bfa_rport_s *rport); | ||
548 | void bfa_cb_rport_online(void *rport); | 535 | void bfa_cb_rport_online(void *rport); |
549 | void bfa_cb_rport_offline(void *rport); | 536 | void bfa_cb_rport_offline(void *rport); |
550 | void bfa_cb_rport_qos_scn_flowid(void *rport, | 537 | void bfa_cb_rport_qos_scn_flowid(void *rport, |
@@ -553,8 +540,6 @@ void bfa_cb_rport_qos_scn_flowid(void *rport, | |||
553 | void bfa_cb_rport_qos_scn_prio(void *rport, | 540 | void bfa_cb_rport_qos_scn_prio(void *rport, |
554 | struct bfa_rport_qos_attr_s old_qos_attr, | 541 | struct bfa_rport_qos_attr_s old_qos_attr, |
555 | struct bfa_rport_qos_attr_s new_qos_attr); | 542 | struct bfa_rport_qos_attr_s new_qos_attr); |
556 | void bfa_rport_get_qos_attr(struct bfa_rport_s *rport, | ||
557 | struct bfa_rport_qos_attr_s *qos_attr); | ||
558 | 543 | ||
559 | /* | 544 | /* |
560 | * bfa fcxp API functions | 545 | * bfa fcxp API functions |
@@ -619,38 +604,18 @@ void bfa_uf_free(struct bfa_uf_s *uf); | |||
619 | u32 bfa_lps_get_max_vport(struct bfa_s *bfa); | 604 | u32 bfa_lps_get_max_vport(struct bfa_s *bfa); |
620 | struct bfa_lps_s *bfa_lps_alloc(struct bfa_s *bfa); | 605 | struct bfa_lps_s *bfa_lps_alloc(struct bfa_s *bfa); |
621 | void bfa_lps_delete(struct bfa_lps_s *lps); | 606 | void bfa_lps_delete(struct bfa_lps_s *lps); |
622 | void bfa_lps_discard(struct bfa_lps_s *lps); | ||
623 | void bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, | 607 | void bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, |
624 | u16 pdusz, wwn_t pwwn, wwn_t nwwn, | 608 | u16 pdusz, wwn_t pwwn, wwn_t nwwn, |
625 | bfa_boolean_t auth_en); | 609 | bfa_boolean_t auth_en); |
626 | void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz, | 610 | void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz, |
627 | wwn_t pwwn, wwn_t nwwn); | 611 | wwn_t pwwn, wwn_t nwwn); |
628 | void bfa_lps_flogo(struct bfa_lps_s *lps); | ||
629 | void bfa_lps_fdisclogo(struct bfa_lps_s *lps); | 612 | void bfa_lps_fdisclogo(struct bfa_lps_s *lps); |
630 | u8 bfa_lps_get_tag(struct bfa_lps_s *lps); | 613 | void bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, u32 n2n_pid); |
631 | bfa_boolean_t bfa_lps_is_npiv_en(struct bfa_lps_s *lps); | ||
632 | bfa_boolean_t bfa_lps_is_fport(struct bfa_lps_s *lps); | ||
633 | bfa_boolean_t bfa_lps_is_brcd_fabric(struct bfa_lps_s *lps); | ||
634 | bfa_boolean_t bfa_lps_is_authreq(struct bfa_lps_s *lps); | ||
635 | bfa_eproto_status_t bfa_lps_get_extstatus(struct bfa_lps_s *lps); | ||
636 | u32 bfa_lps_get_pid(struct bfa_lps_s *lps); | ||
637 | u32 bfa_lps_get_base_pid(struct bfa_s *bfa); | 614 | u32 bfa_lps_get_base_pid(struct bfa_s *bfa); |
638 | u8 bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid); | 615 | u8 bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid); |
639 | u16 bfa_lps_get_peer_bbcredit(struct bfa_lps_s *lps); | ||
640 | wwn_t bfa_lps_get_peer_pwwn(struct bfa_lps_s *lps); | ||
641 | wwn_t bfa_lps_get_peer_nwwn(struct bfa_lps_s *lps); | ||
642 | u8 bfa_lps_get_lsrjt_rsn(struct bfa_lps_s *lps); | ||
643 | u8 bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps); | ||
644 | mac_t bfa_lps_get_lp_mac(struct bfa_lps_s *lps); | ||
645 | void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status); | 616 | void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status); |
646 | void bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status); | 617 | void bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status); |
647 | void bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg); | 618 | void bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg); |
648 | void bfa_cb_lps_cvl_event(void *bfad, void *uarg); | 619 | void bfa_cb_lps_cvl_event(void *bfad, void *uarg); |
649 | 620 | ||
650 | void bfa_trunk_enable_cfg(struct bfa_s *bfa); | ||
651 | bfa_status_t bfa_trunk_enable(struct bfa_s *bfa); | ||
652 | bfa_status_t bfa_trunk_disable(struct bfa_s *bfa); | ||
653 | bfa_status_t bfa_trunk_get_attr(struct bfa_s *bfa, | ||
654 | struct bfa_trunk_attr_s *attr); | ||
655 | |||
656 | #endif /* __BFA_SVC_H__ */ | 621 | #endif /* __BFA_SVC_H__ */ |
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 6797720213b..44524cf55d3 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include "bfad_drv.h" | 32 | #include "bfad_drv.h" |
33 | #include "bfad_im.h" | 33 | #include "bfad_im.h" |
34 | #include "bfa_fcs.h" | 34 | #include "bfa_fcs.h" |
35 | #include "bfa_os_inc.h" | ||
36 | #include "bfa_defs.h" | 35 | #include "bfa_defs.h" |
37 | #include "bfa.h" | 36 | #include "bfa.h" |
38 | 37 | ||
@@ -61,12 +60,12 @@ int msix_disable_cb = 0, msix_disable_ct = 0; | |||
61 | u32 bfi_image_ct_fc_size, bfi_image_ct_cna_size, bfi_image_cb_fc_size; | 60 | u32 bfi_image_ct_fc_size, bfi_image_ct_cna_size, bfi_image_cb_fc_size; |
62 | u32 *bfi_image_ct_fc, *bfi_image_ct_cna, *bfi_image_cb_fc; | 61 | u32 *bfi_image_ct_fc, *bfi_image_ct_cna, *bfi_image_cb_fc; |
63 | 62 | ||
64 | const char *msix_name_ct[] = { | 63 | static const char *msix_name_ct[] = { |
65 | "cpe0", "cpe1", "cpe2", "cpe3", | 64 | "cpe0", "cpe1", "cpe2", "cpe3", |
66 | "rme0", "rme1", "rme2", "rme3", | 65 | "rme0", "rme1", "rme2", "rme3", |
67 | "ctrl" }; | 66 | "ctrl" }; |
68 | 67 | ||
69 | const char *msix_name_cb[] = { | 68 | static const char *msix_name_cb[] = { |
70 | "cpe0", "cpe1", "cpe2", "cpe3", | 69 | "cpe0", "cpe1", "cpe2", "cpe3", |
71 | "rme0", "rme1", "rme2", "rme3", | 70 | "rme0", "rme1", "rme2", "rme3", |
72 | "eemc", "elpu0", "elpu1", "epss", "mlpu" }; | 71 | "eemc", "elpu0", "elpu1", "epss", "mlpu" }; |
@@ -206,7 +205,7 @@ bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event event) | |||
206 | } | 205 | } |
207 | 206 | ||
208 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 207 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
209 | bfa_init(&bfad->bfa); | 208 | bfa_iocfc_init(&bfad->bfa); |
210 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 209 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
211 | 210 | ||
212 | /* Set up interrupt handler for each vectors */ | 211 | /* Set up interrupt handler for each vectors */ |
@@ -533,7 +532,7 @@ bfad_hal_mem_release(struct bfad_s *bfad) | |||
533 | (dma_addr_t) meminfo_elem->dma); | 532 | (dma_addr_t) meminfo_elem->dma); |
534 | break; | 533 | break; |
535 | default: | 534 | default: |
536 | bfa_assert(0); | 535 | WARN_ON(1); |
537 | break; | 536 | break; |
538 | } | 537 | } |
539 | } | 538 | } |
@@ -725,7 +724,7 @@ bfad_bfa_tmo(unsigned long data) | |||
725 | 724 | ||
726 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 725 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
727 | 726 | ||
728 | bfa_timer_tick(&bfad->bfa); | 727 | bfa_timer_beat(&bfad->bfa.timer_mod); |
729 | 728 | ||
730 | bfa_comp_deq(&bfad->bfa, &doneq); | 729 | bfa_comp_deq(&bfad->bfa, &doneq); |
731 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 730 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
@@ -882,8 +881,8 @@ bfad_drv_init(struct bfad_s *bfad) | |||
882 | goto out_hal_mem_alloc_failure; | 881 | goto out_hal_mem_alloc_failure; |
883 | } | 882 | } |
884 | 883 | ||
885 | bfa_init_trc(&bfad->bfa, bfad->trcmod); | 884 | bfad->bfa.trcmod = bfad->trcmod; |
886 | bfa_init_plog(&bfad->bfa, &bfad->plog_buf); | 885 | bfad->bfa.plog = &bfad->plog_buf; |
887 | bfa_plog_init(&bfad->plog_buf); | 886 | bfa_plog_init(&bfad->plog_buf); |
888 | bfa_plog_str(&bfad->plog_buf, BFA_PL_MID_DRVR, BFA_PL_EID_DRIVER_START, | 887 | bfa_plog_str(&bfad->plog_buf, BFA_PL_MID_DRVR, BFA_PL_EID_DRIVER_START, |
889 | 0, "Driver Attach"); | 888 | 0, "Driver Attach"); |
@@ -893,9 +892,9 @@ bfad_drv_init(struct bfad_s *bfad) | |||
893 | 892 | ||
894 | /* FCS INIT */ | 893 | /* FCS INIT */ |
895 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 894 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
896 | bfa_fcs_trc_init(&bfad->bfa_fcs, bfad->trcmod); | 895 | bfad->bfa_fcs.trcmod = bfad->trcmod; |
897 | bfa_fcs_attach(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE); | 896 | bfa_fcs_attach(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE); |
898 | bfa_fcs_set_fdmi_param(&bfad->bfa_fcs, fdmi_enable); | 897 | bfad->bfa_fcs.fdmi_enabled = fdmi_enable; |
899 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 898 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
900 | 899 | ||
901 | bfad->bfad_flags |= BFAD_DRV_INIT_DONE; | 900 | bfad->bfad_flags |= BFAD_DRV_INIT_DONE; |
@@ -913,7 +912,7 @@ bfad_drv_uninit(struct bfad_s *bfad) | |||
913 | 912 | ||
914 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 913 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
915 | init_completion(&bfad->comp); | 914 | init_completion(&bfad->comp); |
916 | bfa_stop(&bfad->bfa); | 915 | bfa_iocfc_stop(&bfad->bfa); |
917 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 916 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
918 | wait_for_completion(&bfad->comp); | 917 | wait_for_completion(&bfad->comp); |
919 | 918 | ||
@@ -932,8 +931,8 @@ bfad_drv_start(struct bfad_s *bfad) | |||
932 | unsigned long flags; | 931 | unsigned long flags; |
933 | 932 | ||
934 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 933 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
935 | bfa_start(&bfad->bfa); | 934 | bfa_iocfc_start(&bfad->bfa); |
936 | bfa_fcs_start(&bfad->bfa_fcs); | 935 | bfa_fcs_fabric_modstart(&bfad->bfa_fcs); |
937 | bfad->bfad_flags |= BFAD_HAL_START_DONE; | 936 | bfad->bfad_flags |= BFAD_HAL_START_DONE; |
938 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 937 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
939 | 938 | ||
@@ -963,7 +962,7 @@ bfad_stop(struct bfad_s *bfad) | |||
963 | 962 | ||
964 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 963 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
965 | init_completion(&bfad->comp); | 964 | init_completion(&bfad->comp); |
966 | bfa_stop(&bfad->bfa); | 965 | bfa_iocfc_stop(&bfad->bfa); |
967 | bfad->bfad_flags &= ~BFAD_HAL_START_DONE; | 966 | bfad->bfad_flags &= ~BFAD_HAL_START_DONE; |
968 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 967 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
969 | wait_for_completion(&bfad->comp); | 968 | wait_for_completion(&bfad->comp); |
@@ -1102,15 +1101,15 @@ bfad_start_ops(struct bfad_s *bfad) { | |||
1102 | 1101 | ||
1103 | /* | 1102 | /* |
1104 | * If bfa_linkup_delay is set to -1 default; try to retrive the | 1103 | * If bfa_linkup_delay is set to -1 default; try to retrive the |
1105 | * value using the bfad_os_get_linkup_delay(); else use the | 1104 | * value using the bfad_get_linkup_delay(); else use the |
1106 | * passed in module param value as the bfa_linkup_delay. | 1105 | * passed in module param value as the bfa_linkup_delay. |
1107 | */ | 1106 | */ |
1108 | if (bfa_linkup_delay < 0) { | 1107 | if (bfa_linkup_delay < 0) { |
1109 | bfa_linkup_delay = bfad_os_get_linkup_delay(bfad); | 1108 | bfa_linkup_delay = bfad_get_linkup_delay(bfad); |
1110 | bfad_os_rport_online_wait(bfad); | 1109 | bfad_rport_online_wait(bfad); |
1111 | bfa_linkup_delay = -1; | 1110 | bfa_linkup_delay = -1; |
1112 | } else | 1111 | } else |
1113 | bfad_os_rport_online_wait(bfad); | 1112 | bfad_rport_online_wait(bfad); |
1114 | 1113 | ||
1115 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "bfa device claimed\n"); | 1114 | BFA_LOG(KERN_INFO, bfad, bfa_log_level, "bfa device claimed\n"); |
1116 | 1115 | ||
@@ -1167,7 +1166,6 @@ bfad_intx(int irq, void *dev_id) | |||
1167 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 1166 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
1168 | bfa_comp_free(&bfad->bfa, &doneq); | 1167 | bfa_comp_free(&bfad->bfa, &doneq); |
1169 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 1168 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
1170 | bfa_trc_fp(bfad, irq); | ||
1171 | } | 1169 | } |
1172 | 1170 | ||
1173 | return IRQ_HANDLED; | 1171 | return IRQ_HANDLED; |
@@ -1524,7 +1522,7 @@ bfad_init(void) | |||
1524 | if (strcmp(FCPI_NAME, " fcpim") == 0) | 1522 | if (strcmp(FCPI_NAME, " fcpim") == 0) |
1525 | supported_fc4s |= BFA_LPORT_ROLE_FCP_IM; | 1523 | supported_fc4s |= BFA_LPORT_ROLE_FCP_IM; |
1526 | 1524 | ||
1527 | bfa_ioc_auto_recover(ioc_auto_recover); | 1525 | bfa_auto_recover = ioc_auto_recover; |
1528 | bfa_fcs_rport_set_del_timeout(rport_del_timeout); | 1526 | bfa_fcs_rport_set_del_timeout(rport_del_timeout); |
1529 | 1527 | ||
1530 | error = pci_register_driver(&bfad_pci_driver); | 1528 | error = pci_register_driver(&bfad_pci_driver); |
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c index ed9fff440b5..a94ea423543 100644 --- a/drivers/scsi/bfa/bfad_attr.c +++ b/drivers/scsi/bfa/bfad_attr.c | |||
@@ -25,7 +25,7 @@ | |||
25 | /* | 25 | /* |
26 | * FC transport template entry, get SCSI target port ID. | 26 | * FC transport template entry, get SCSI target port ID. |
27 | */ | 27 | */ |
28 | void | 28 | static void |
29 | bfad_im_get_starget_port_id(struct scsi_target *starget) | 29 | bfad_im_get_starget_port_id(struct scsi_target *starget) |
30 | { | 30 | { |
31 | struct Scsi_Host *shost; | 31 | struct Scsi_Host *shost; |
@@ -40,7 +40,7 @@ bfad_im_get_starget_port_id(struct scsi_target *starget) | |||
40 | bfad = im_port->bfad; | 40 | bfad = im_port->bfad; |
41 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 41 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
42 | 42 | ||
43 | itnim = bfad_os_get_itnim(im_port, starget->id); | 43 | itnim = bfad_get_itnim(im_port, starget->id); |
44 | if (itnim) | 44 | if (itnim) |
45 | fc_id = bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim); | 45 | fc_id = bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim); |
46 | 46 | ||
@@ -51,7 +51,7 @@ bfad_im_get_starget_port_id(struct scsi_target *starget) | |||
51 | /* | 51 | /* |
52 | * FC transport template entry, get SCSI target nwwn. | 52 | * FC transport template entry, get SCSI target nwwn. |
53 | */ | 53 | */ |
54 | void | 54 | static void |
55 | bfad_im_get_starget_node_name(struct scsi_target *starget) | 55 | bfad_im_get_starget_node_name(struct scsi_target *starget) |
56 | { | 56 | { |
57 | struct Scsi_Host *shost; | 57 | struct Scsi_Host *shost; |
@@ -66,7 +66,7 @@ bfad_im_get_starget_node_name(struct scsi_target *starget) | |||
66 | bfad = im_port->bfad; | 66 | bfad = im_port->bfad; |
67 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 67 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
68 | 68 | ||
69 | itnim = bfad_os_get_itnim(im_port, starget->id); | 69 | itnim = bfad_get_itnim(im_port, starget->id); |
70 | if (itnim) | 70 | if (itnim) |
71 | node_name = bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim); | 71 | node_name = bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim); |
72 | 72 | ||
@@ -77,7 +77,7 @@ bfad_im_get_starget_node_name(struct scsi_target *starget) | |||
77 | /* | 77 | /* |
78 | * FC transport template entry, get SCSI target pwwn. | 78 | * FC transport template entry, get SCSI target pwwn. |
79 | */ | 79 | */ |
80 | void | 80 | static void |
81 | bfad_im_get_starget_port_name(struct scsi_target *starget) | 81 | bfad_im_get_starget_port_name(struct scsi_target *starget) |
82 | { | 82 | { |
83 | struct Scsi_Host *shost; | 83 | struct Scsi_Host *shost; |
@@ -92,7 +92,7 @@ bfad_im_get_starget_port_name(struct scsi_target *starget) | |||
92 | bfad = im_port->bfad; | 92 | bfad = im_port->bfad; |
93 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 93 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
94 | 94 | ||
95 | itnim = bfad_os_get_itnim(im_port, starget->id); | 95 | itnim = bfad_get_itnim(im_port, starget->id); |
96 | if (itnim) | 96 | if (itnim) |
97 | port_name = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim); | 97 | port_name = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim); |
98 | 98 | ||
@@ -103,7 +103,7 @@ bfad_im_get_starget_port_name(struct scsi_target *starget) | |||
103 | /* | 103 | /* |
104 | * FC transport template entry, get SCSI host port ID. | 104 | * FC transport template entry, get SCSI host port ID. |
105 | */ | 105 | */ |
106 | void | 106 | static void |
107 | bfad_im_get_host_port_id(struct Scsi_Host *shost) | 107 | bfad_im_get_host_port_id(struct Scsi_Host *shost) |
108 | { | 108 | { |
109 | struct bfad_im_port_s *im_port = | 109 | struct bfad_im_port_s *im_port = |
@@ -111,7 +111,7 @@ bfad_im_get_host_port_id(struct Scsi_Host *shost) | |||
111 | struct bfad_port_s *port = im_port->port; | 111 | struct bfad_port_s *port = im_port->port; |
112 | 112 | ||
113 | fc_host_port_id(shost) = | 113 | fc_host_port_id(shost) = |
114 | bfa_os_hton3b(bfa_fcs_lport_get_fcid(port->fcs_port)); | 114 | bfa_hton3b(bfa_fcs_lport_get_fcid(port->fcs_port)); |
115 | } | 115 | } |
116 | 116 | ||
117 | /* | 117 | /* |
@@ -487,7 +487,7 @@ bfad_im_vport_delete(struct fc_vport *fc_vport) | |||
487 | wait_for_completion(vport->comp_del); | 487 | wait_for_completion(vport->comp_del); |
488 | 488 | ||
489 | free_scsi_host: | 489 | free_scsi_host: |
490 | bfad_os_scsi_host_free(bfad, im_port); | 490 | bfad_scsi_host_free(bfad, im_port); |
491 | 491 | ||
492 | kfree(vport); | 492 | kfree(vport); |
493 | 493 | ||
diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c index 1fedeeb4ac1..c66e32eced7 100644 --- a/drivers/scsi/bfa/bfad_debugfs.c +++ b/drivers/scsi/bfa/bfad_debugfs.c | |||
@@ -90,7 +90,7 @@ bfad_debugfs_open_fwtrc(struct inode *inode, struct file *file) | |||
90 | memset(fw_debug->debug_buffer, 0, fw_debug->buffer_len); | 90 | memset(fw_debug->debug_buffer, 0, fw_debug->buffer_len); |
91 | 91 | ||
92 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 92 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
93 | rc = bfa_debug_fwtrc(&bfad->bfa, | 93 | rc = bfa_ioc_debug_fwtrc(&bfad->bfa.ioc, |
94 | fw_debug->debug_buffer, | 94 | fw_debug->debug_buffer, |
95 | &fw_debug->buffer_len); | 95 | &fw_debug->buffer_len); |
96 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 96 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
@@ -134,7 +134,7 @@ bfad_debugfs_open_fwsave(struct inode *inode, struct file *file) | |||
134 | memset(fw_debug->debug_buffer, 0, fw_debug->buffer_len); | 134 | memset(fw_debug->debug_buffer, 0, fw_debug->buffer_len); |
135 | 135 | ||
136 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 136 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
137 | rc = bfa_debug_fwsave(&bfad->bfa, | 137 | rc = bfa_ioc_debug_fwsave(&bfad->bfa.ioc, |
138 | fw_debug->debug_buffer, | 138 | fw_debug->debug_buffer, |
139 | &fw_debug->buffer_len); | 139 | &fw_debug->buffer_len); |
140 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 140 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
@@ -208,7 +208,7 @@ bfad_debugfs_read(struct file *file, char __user *buf, | |||
208 | if (!debug || !debug->debug_buffer) | 208 | if (!debug || !debug->debug_buffer) |
209 | return 0; | 209 | return 0; |
210 | 210 | ||
211 | return memory_read_from_buffer(buf, nbytes, pos, | 211 | return simple_read_from_buffer(buf, nbytes, pos, |
212 | debug->debug_buffer, debug->buffer_len); | 212 | debug->debug_buffer, debug->buffer_len); |
213 | } | 213 | } |
214 | 214 | ||
@@ -254,7 +254,7 @@ bfad_debugfs_read_regrd(struct file *file, char __user *buf, | |||
254 | if (!bfad->regdata) | 254 | if (!bfad->regdata) |
255 | return 0; | 255 | return 0; |
256 | 256 | ||
257 | rc = memory_read_from_buffer(buf, nbytes, pos, | 257 | rc = simple_read_from_buffer(buf, nbytes, pos, |
258 | bfad->regdata, bfad->reglen); | 258 | bfad->regdata, bfad->reglen); |
259 | 259 | ||
260 | if ((*pos + nbytes) >= bfad->reglen) { | 260 | if ((*pos + nbytes) >= bfad->reglen) { |
@@ -279,15 +279,31 @@ bfad_debugfs_write_regrd(struct file *file, const char __user *buf, | |||
279 | u32 *regbuf; | 279 | u32 *regbuf; |
280 | void __iomem *rb, *reg_addr; | 280 | void __iomem *rb, *reg_addr; |
281 | unsigned long flags; | 281 | unsigned long flags; |
282 | void *kern_buf; | ||
282 | 283 | ||
283 | rc = sscanf(buf, "%x:%x", &addr, &len); | 284 | kern_buf = kzalloc(nbytes, GFP_KERNEL); |
285 | |||
286 | if (!kern_buf) { | ||
287 | printk(KERN_INFO "bfad[%d]: Failed to allocate buffer\n", | ||
288 | bfad->inst_no); | ||
289 | return -ENOMEM; | ||
290 | } | ||
291 | |||
292 | if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { | ||
293 | kfree(kern_buf); | ||
294 | return -ENOMEM; | ||
295 | } | ||
296 | |||
297 | rc = sscanf(kern_buf, "%x:%x", &addr, &len); | ||
284 | if (rc < 2) { | 298 | if (rc < 2) { |
285 | printk(KERN_INFO | 299 | printk(KERN_INFO |
286 | "bfad[%d]: %s failed to read user buf\n", | 300 | "bfad[%d]: %s failed to read user buf\n", |
287 | bfad->inst_no, __func__); | 301 | bfad->inst_no, __func__); |
302 | kfree(kern_buf); | ||
288 | return -EINVAL; | 303 | return -EINVAL; |
289 | } | 304 | } |
290 | 305 | ||
306 | kfree(kern_buf); | ||
291 | kfree(bfad->regdata); | 307 | kfree(bfad->regdata); |
292 | bfad->regdata = NULL; | 308 | bfad->regdata = NULL; |
293 | bfad->reglen = 0; | 309 | bfad->reglen = 0; |
@@ -339,14 +355,30 @@ bfad_debugfs_write_regwr(struct file *file, const char __user *buf, | |||
339 | int addr, val, rc; | 355 | int addr, val, rc; |
340 | void __iomem *reg_addr; | 356 | void __iomem *reg_addr; |
341 | unsigned long flags; | 357 | unsigned long flags; |
358 | void *kern_buf; | ||
359 | |||
360 | kern_buf = kzalloc(nbytes, GFP_KERNEL); | ||
361 | |||
362 | if (!kern_buf) { | ||
363 | printk(KERN_INFO "bfad[%d]: Failed to allocate buffer\n", | ||
364 | bfad->inst_no); | ||
365 | return -ENOMEM; | ||
366 | } | ||
367 | |||
368 | if (copy_from_user(kern_buf, (void __user *)buf, nbytes)) { | ||
369 | kfree(kern_buf); | ||
370 | return -ENOMEM; | ||
371 | } | ||
342 | 372 | ||
343 | rc = sscanf(buf, "%x:%x", &addr, &val); | 373 | rc = sscanf(kern_buf, "%x:%x", &addr, &val); |
344 | if (rc < 2) { | 374 | if (rc < 2) { |
345 | printk(KERN_INFO | 375 | printk(KERN_INFO |
346 | "bfad[%d]: %s failed to read user buf\n", | 376 | "bfad[%d]: %s failed to read user buf\n", |
347 | bfad->inst_no, __func__); | 377 | bfad->inst_no, __func__); |
378 | kfree(kern_buf); | ||
348 | return -EINVAL; | 379 | return -EINVAL; |
349 | } | 380 | } |
381 | kfree(kern_buf); | ||
350 | 382 | ||
351 | addr &= BFA_REG_ADDRMSK(bfa); /* offset only 17 bit and word align */ | 383 | addr &= BFA_REG_ADDRMSK(bfa); /* offset only 17 bit and word align */ |
352 | 384 | ||
@@ -359,7 +391,7 @@ bfad_debugfs_write_regwr(struct file *file, const char __user *buf, | |||
359 | return -EINVAL; | 391 | return -EINVAL; |
360 | } | 392 | } |
361 | 393 | ||
362 | reg_addr = (u32 *) ((u8 *) bfa_ioc_bar0(ioc) + addr); | 394 | reg_addr = (bfa_ioc_bar0(ioc)) + addr; |
363 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 395 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
364 | writel(val, reg_addr); | 396 | writel(val, reg_addr); |
365 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 397 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h index d5ce2349ac5..7f9ea90254c 100644 --- a/drivers/scsi/bfa/bfad_drv.h +++ b/drivers/scsi/bfa/bfad_drv.h | |||
@@ -26,7 +26,23 @@ | |||
26 | #ifndef __BFAD_DRV_H__ | 26 | #ifndef __BFAD_DRV_H__ |
27 | #define __BFAD_DRV_H__ | 27 | #define __BFAD_DRV_H__ |
28 | 28 | ||
29 | #include "bfa_os_inc.h" | 29 | #include <linux/types.h> |
30 | #include <linux/version.h> | ||
31 | #include <linux/pci.h> | ||
32 | #include <linux/dma-mapping.h> | ||
33 | #include <linux/idr.h> | ||
34 | #include <linux/interrupt.h> | ||
35 | #include <linux/cdev.h> | ||
36 | #include <linux/fs.h> | ||
37 | #include <linux/delay.h> | ||
38 | #include <linux/vmalloc.h> | ||
39 | #include <linux/workqueue.h> | ||
40 | #include <linux/bitops.h> | ||
41 | #include <scsi/scsi.h> | ||
42 | #include <scsi/scsi_host.h> | ||
43 | #include <scsi/scsi_tcq.h> | ||
44 | #include <scsi/scsi_transport_fc.h> | ||
45 | #include <scsi/scsi_transport.h> | ||
30 | 46 | ||
31 | #include "bfa_modules.h" | 47 | #include "bfa_modules.h" |
32 | #include "bfa_fcs.h" | 48 | #include "bfa_fcs.h" |
@@ -39,7 +55,7 @@ | |||
39 | #ifdef BFA_DRIVER_VERSION | 55 | #ifdef BFA_DRIVER_VERSION |
40 | #define BFAD_DRIVER_VERSION BFA_DRIVER_VERSION | 56 | #define BFAD_DRIVER_VERSION BFA_DRIVER_VERSION |
41 | #else | 57 | #else |
42 | #define BFAD_DRIVER_VERSION "2.3.2.0" | 58 | #define BFAD_DRIVER_VERSION "2.3.2.3" |
43 | #endif | 59 | #endif |
44 | 60 | ||
45 | #define BFAD_PROTO_NAME FCPI_NAME | 61 | #define BFAD_PROTO_NAME FCPI_NAME |
@@ -263,28 +279,21 @@ struct bfad_hal_comp { | |||
263 | */ | 279 | */ |
264 | #define nextLowerInt(x) \ | 280 | #define nextLowerInt(x) \ |
265 | do { \ | 281 | do { \ |
266 | int i; \ | 282 | int __i; \ |
267 | (*x)--; \ | 283 | (*x)--; \ |
268 | for (i = 1; i < (sizeof(int)*8); i <<= 1) \ | 284 | for (__i = 1; __i < (sizeof(int)*8); __i <<= 1) \ |
269 | (*x) = (*x) | (*x) >> i; \ | 285 | (*x) = (*x) | (*x) >> __i; \ |
270 | (*x)++; \ | 286 | (*x)++; \ |
271 | (*x) = (*x) >> 1; \ | 287 | (*x) = (*x) >> 1; \ |
272 | } while (0) | 288 | } while (0) |
273 | 289 | ||
274 | 290 | ||
275 | #define list_remove_head(list, entry, type, member) \ | 291 | #define BFA_LOG(level, bfad, mask, fmt, arg...) \ |
276 | do { \ | 292 | do { \ |
277 | entry = NULL; \ | 293 | if (((mask) == 4) || (level[1] <= '4')) \ |
278 | if (!list_empty(list)) { \ | 294 | dev_printk(level, &((bfad)->pcidev)->dev, fmt, ##arg); \ |
279 | entry = list_entry((list)->next, type, member); \ | ||
280 | list_del_init(&entry->member); \ | ||
281 | } \ | ||
282 | } while (0) | 295 | } while (0) |
283 | 296 | ||
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, | 297 | bfa_status_t bfad_vport_create(struct bfad_s *bfad, u16 vf_id, |
289 | struct bfa_lport_cfg_s *port_cfg, | 298 | struct bfa_lport_cfg_s *port_cfg, |
290 | struct device *dev); | 299 | struct device *dev); |
@@ -316,8 +325,8 @@ void bfad_debugfs_exit(struct bfad_port_s *port); | |||
316 | 325 | ||
317 | void bfad_pci_remove(struct pci_dev *pdev); | 326 | void bfad_pci_remove(struct pci_dev *pdev); |
318 | int bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid); | 327 | int bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid); |
319 | void bfad_os_rport_online_wait(struct bfad_s *bfad); | 328 | void bfad_rport_online_wait(struct bfad_s *bfad); |
320 | int bfad_os_get_linkup_delay(struct bfad_s *bfad); | 329 | int bfad_get_linkup_delay(struct bfad_s *bfad); |
321 | int bfad_install_msix_handler(struct bfad_s *bfad); | 330 | int bfad_install_msix_handler(struct bfad_s *bfad); |
322 | 331 | ||
323 | extern struct idr bfad_im_port_index; | 332 | extern struct idr bfad_im_port_index; |
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index fbad5e9b240..c2b36179e8e 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c | |||
@@ -21,7 +21,6 @@ | |||
21 | 21 | ||
22 | #include "bfad_drv.h" | 22 | #include "bfad_drv.h" |
23 | #include "bfad_im.h" | 23 | #include "bfad_im.h" |
24 | #include "bfa_cb_ioim.h" | ||
25 | #include "bfa_fcs.h" | 24 | #include "bfa_fcs.h" |
26 | 25 | ||
27 | BFA_TRC_FILE(LDRV, IM); | 26 | BFA_TRC_FILE(LDRV, IM); |
@@ -93,10 +92,10 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio, | |||
93 | if (!cmnd->result && itnim && | 92 | if (!cmnd->result && itnim && |
94 | (bfa_lun_queue_depth > cmnd->device->queue_depth)) { | 93 | (bfa_lun_queue_depth > cmnd->device->queue_depth)) { |
95 | /* Queue depth adjustment for good status completion */ | 94 | /* Queue depth adjustment for good status completion */ |
96 | bfad_os_ramp_up_qdepth(itnim, cmnd->device); | 95 | bfad_ramp_up_qdepth(itnim, cmnd->device); |
97 | } else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) { | 96 | } else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) { |
98 | /* qfull handling */ | 97 | /* qfull handling */ |
99 | bfad_os_handle_qfull(itnim, cmnd->device); | 98 | bfad_handle_qfull(itnim, cmnd->device); |
100 | } | 99 | } |
101 | } | 100 | } |
102 | 101 | ||
@@ -124,7 +123,7 @@ bfa_cb_ioim_good_comp(void *drv, struct bfad_ioim_s *dio) | |||
124 | if (itnim_data) { | 123 | if (itnim_data) { |
125 | itnim = itnim_data->itnim; | 124 | itnim = itnim_data->itnim; |
126 | if (itnim) | 125 | if (itnim) |
127 | bfad_os_ramp_up_qdepth(itnim, cmnd->device); | 126 | bfad_ramp_up_qdepth(itnim, cmnd->device); |
128 | } | 127 | } |
129 | } | 128 | } |
130 | 129 | ||
@@ -183,7 +182,7 @@ bfad_im_info(struct Scsi_Host *shost) | |||
183 | bfa_get_adapter_model(bfa, model); | 182 | bfa_get_adapter_model(bfa, model); |
184 | 183 | ||
185 | memset(bfa_buf, 0, sizeof(bfa_buf)); | 184 | memset(bfa_buf, 0, sizeof(bfa_buf)); |
186 | if (ioc->ctdev) | 185 | if (ioc->ctdev && !ioc->fcmode) |
187 | snprintf(bfa_buf, sizeof(bfa_buf), | 186 | snprintf(bfa_buf, sizeof(bfa_buf), |
188 | "Brocade FCOE Adapter, " "model: %s hwpath: %s driver: %s", | 187 | "Brocade FCOE Adapter, " "model: %s hwpath: %s driver: %s", |
189 | model, bfad->pci_name, BFAD_DRIVER_VERSION); | 188 | model, bfad->pci_name, BFAD_DRIVER_VERSION); |
@@ -258,6 +257,7 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd, | |||
258 | struct bfa_tskim_s *tskim; | 257 | struct bfa_tskim_s *tskim; |
259 | struct bfa_itnim_s *bfa_itnim; | 258 | struct bfa_itnim_s *bfa_itnim; |
260 | bfa_status_t rc = BFA_STATUS_OK; | 259 | bfa_status_t rc = BFA_STATUS_OK; |
260 | struct scsi_lun scsilun; | ||
261 | 261 | ||
262 | tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); | 262 | tskim = bfa_tskim_alloc(&bfad->bfa, (struct bfad_tskim_s *) cmnd); |
263 | if (!tskim) { | 263 | if (!tskim) { |
@@ -274,7 +274,8 @@ bfad_im_target_reset_send(struct bfad_s *bfad, struct scsi_cmnd *cmnd, | |||
274 | cmnd->host_scribble = NULL; | 274 | cmnd->host_scribble = NULL; |
275 | cmnd->SCp.Status = 0; | 275 | cmnd->SCp.Status = 0; |
276 | bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); | 276 | bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); |
277 | bfa_tskim_start(tskim, bfa_itnim, (lun_t)0, | 277 | memset(&scsilun, 0, sizeof(scsilun)); |
278 | bfa_tskim_start(tskim, bfa_itnim, scsilun, | ||
278 | FCP_TM_TARGET_RESET, BFAD_TARGET_RESET_TMO); | 279 | FCP_TM_TARGET_RESET, BFAD_TARGET_RESET_TMO); |
279 | out: | 280 | out: |
280 | return rc; | 281 | return rc; |
@@ -301,6 +302,7 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
301 | int rc = SUCCESS; | 302 | int rc = SUCCESS; |
302 | unsigned long flags; | 303 | unsigned long flags; |
303 | enum bfi_tskim_status task_status; | 304 | enum bfi_tskim_status task_status; |
305 | struct scsi_lun scsilun; | ||
304 | 306 | ||
305 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 307 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
306 | itnim = itnim_data->itnim; | 308 | itnim = itnim_data->itnim; |
@@ -327,8 +329,8 @@ bfad_im_reset_lun_handler(struct scsi_cmnd *cmnd) | |||
327 | cmnd->SCp.ptr = (char *)&wq; | 329 | cmnd->SCp.ptr = (char *)&wq; |
328 | cmnd->SCp.Status = 0; | 330 | cmnd->SCp.Status = 0; |
329 | bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); | 331 | bfa_itnim = bfa_fcs_itnim_get_halitn(&itnim->fcs_itnim); |
330 | bfa_tskim_start(tskim, bfa_itnim, | 332 | int_to_scsilun(cmnd->device->lun, &scsilun); |
331 | bfad_int_to_lun(cmnd->device->lun), | 333 | bfa_tskim_start(tskim, bfa_itnim, scsilun, |
332 | FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO); | 334 | FCP_TM_LUN_RESET, BFAD_LUN_RESET_TMO); |
333 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 335 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
334 | 336 | ||
@@ -364,7 +366,7 @@ bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd) | |||
364 | 366 | ||
365 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 367 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
366 | for (i = 0; i < MAX_FCP_TARGET; i++) { | 368 | for (i = 0; i < MAX_FCP_TARGET; i++) { |
367 | itnim = bfad_os_get_itnim(im_port, i); | 369 | itnim = bfad_get_itnim(im_port, i); |
368 | if (itnim) { | 370 | if (itnim) { |
369 | cmnd->SCp.ptr = (char *)&wq; | 371 | cmnd->SCp.ptr = (char *)&wq; |
370 | rc = bfad_im_target_reset_send(bfad, cmnd, itnim); | 372 | rc = bfad_im_target_reset_send(bfad, cmnd, itnim); |
@@ -447,7 +449,7 @@ bfa_fcb_itnim_free(struct bfad_s *bfad, struct bfad_itnim_s *itnim_drv) | |||
447 | struct bfad_im_s *im = itnim_drv->im; | 449 | struct bfad_im_s *im = itnim_drv->im; |
448 | 450 | ||
449 | /* online to free state transtion should not happen */ | 451 | /* online to free state transtion should not happen */ |
450 | bfa_assert(itnim_drv->state != ITNIM_STATE_ONLINE); | 452 | WARN_ON(itnim_drv->state == ITNIM_STATE_ONLINE); |
451 | 453 | ||
452 | itnim_drv->queue_work = 1; | 454 | itnim_drv->queue_work = 1; |
453 | /* offline request is not yet done, use the same request to free */ | 455 | /* offline request is not yet done, use the same request to free */ |
@@ -545,7 +547,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port, | |||
545 | 547 | ||
546 | mutex_unlock(&bfad_mutex); | 548 | mutex_unlock(&bfad_mutex); |
547 | 549 | ||
548 | im_port->shost = bfad_os_scsi_host_alloc(im_port, bfad); | 550 | im_port->shost = bfad_scsi_host_alloc(im_port, bfad); |
549 | if (!im_port->shost) { | 551 | if (!im_port->shost) { |
550 | error = 1; | 552 | error = 1; |
551 | goto out_free_idr; | 553 | goto out_free_idr; |
@@ -571,7 +573,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port, | |||
571 | } | 573 | } |
572 | 574 | ||
573 | /* setup host fixed attribute if the lk supports */ | 575 | /* setup host fixed attribute if the lk supports */ |
574 | bfad_os_fc_host_init(im_port); | 576 | bfad_fc_host_init(im_port); |
575 | 577 | ||
576 | return 0; | 578 | return 0; |
577 | 579 | ||
@@ -662,7 +664,7 @@ bfad_im_port_clean(struct bfad_im_port_s *im_port) | |||
662 | } | 664 | } |
663 | 665 | ||
664 | /* the itnim_mapped_list must be empty at this time */ | 666 | /* the itnim_mapped_list must be empty at this time */ |
665 | bfa_assert(list_empty(&im_port->itnim_mapped_list)); | 667 | WARN_ON(!list_empty(&im_port->itnim_mapped_list)); |
666 | 668 | ||
667 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 669 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
668 | } | 670 | } |
@@ -682,7 +684,7 @@ bfad_im_probe(struct bfad_s *bfad) | |||
682 | bfad->im = im; | 684 | bfad->im = im; |
683 | im->bfad = bfad; | 685 | im->bfad = bfad; |
684 | 686 | ||
685 | if (bfad_os_thread_workq(bfad) != BFA_STATUS_OK) { | 687 | if (bfad_thread_workq(bfad) != BFA_STATUS_OK) { |
686 | kfree(im); | 688 | kfree(im); |
687 | rc = BFA_STATUS_FAILED; | 689 | rc = BFA_STATUS_FAILED; |
688 | } | 690 | } |
@@ -695,14 +697,14 @@ void | |||
695 | bfad_im_probe_undo(struct bfad_s *bfad) | 697 | bfad_im_probe_undo(struct bfad_s *bfad) |
696 | { | 698 | { |
697 | if (bfad->im) { | 699 | if (bfad->im) { |
698 | bfad_os_destroy_workq(bfad->im); | 700 | bfad_destroy_workq(bfad->im); |
699 | kfree(bfad->im); | 701 | kfree(bfad->im); |
700 | bfad->im = NULL; | 702 | bfad->im = NULL; |
701 | } | 703 | } |
702 | } | 704 | } |
703 | 705 | ||
704 | struct Scsi_Host * | 706 | struct Scsi_Host * |
705 | bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad) | 707 | bfad_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad) |
706 | { | 708 | { |
707 | struct scsi_host_template *sht; | 709 | struct scsi_host_template *sht; |
708 | 710 | ||
@@ -717,7 +719,7 @@ bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad) | |||
717 | } | 719 | } |
718 | 720 | ||
719 | void | 721 | void |
720 | bfad_os_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) | 722 | bfad_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) |
721 | { | 723 | { |
722 | if (!(im_port->flags & BFAD_PORT_DELETE)) | 724 | if (!(im_port->flags & BFAD_PORT_DELETE)) |
723 | flush_workqueue(bfad->im->drv_workq); | 725 | flush_workqueue(bfad->im->drv_workq); |
@@ -727,7 +729,7 @@ bfad_os_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) | |||
727 | } | 729 | } |
728 | 730 | ||
729 | void | 731 | void |
730 | bfad_os_destroy_workq(struct bfad_im_s *im) | 732 | bfad_destroy_workq(struct bfad_im_s *im) |
731 | { | 733 | { |
732 | if (im && im->drv_workq) { | 734 | if (im && im->drv_workq) { |
733 | flush_workqueue(im->drv_workq); | 735 | flush_workqueue(im->drv_workq); |
@@ -737,7 +739,7 @@ bfad_os_destroy_workq(struct bfad_im_s *im) | |||
737 | } | 739 | } |
738 | 740 | ||
739 | bfa_status_t | 741 | bfa_status_t |
740 | bfad_os_thread_workq(struct bfad_s *bfad) | 742 | bfad_thread_workq(struct bfad_s *bfad) |
741 | { | 743 | { |
742 | struct bfad_im_s *im = bfad->im; | 744 | struct bfad_im_s *im = bfad->im; |
743 | 745 | ||
@@ -841,7 +843,7 @@ bfad_im_module_exit(void) | |||
841 | } | 843 | } |
842 | 844 | ||
843 | void | 845 | void |
844 | bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev) | 846 | bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev) |
845 | { | 847 | { |
846 | struct scsi_device *tmp_sdev; | 848 | struct scsi_device *tmp_sdev; |
847 | 849 | ||
@@ -869,7 +871,7 @@ bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev) | |||
869 | } | 871 | } |
870 | 872 | ||
871 | void | 873 | void |
872 | bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev) | 874 | bfad_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev) |
873 | { | 875 | { |
874 | struct scsi_device *tmp_sdev; | 876 | struct scsi_device *tmp_sdev; |
875 | 877 | ||
@@ -883,7 +885,7 @@ bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev) | |||
883 | } | 885 | } |
884 | 886 | ||
885 | struct bfad_itnim_s * | 887 | struct bfad_itnim_s * |
886 | bfad_os_get_itnim(struct bfad_im_port_s *im_port, int id) | 888 | bfad_get_itnim(struct bfad_im_port_s *im_port, int id) |
887 | { | 889 | { |
888 | struct bfad_itnim_s *itnim = NULL; | 890 | struct bfad_itnim_s *itnim = NULL; |
889 | 891 | ||
@@ -922,7 +924,7 @@ bfad_im_supported_speeds(struct bfa_s *bfa) | |||
922 | if (!ioc_attr) | 924 | if (!ioc_attr) |
923 | return 0; | 925 | return 0; |
924 | 926 | ||
925 | bfa_get_attr(bfa, ioc_attr); | 927 | bfa_ioc_get_attr(&bfa->ioc, ioc_attr); |
926 | if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_8GBPS) { | 928 | if (ioc_attr->adapter_attr.max_speed == BFA_PORT_SPEED_8GBPS) { |
927 | if (ioc_attr->adapter_attr.is_mezz) { | 929 | if (ioc_attr->adapter_attr.is_mezz) { |
928 | supported_speed |= FC_PORTSPEED_8GBIT | | 930 | supported_speed |= FC_PORTSPEED_8GBIT | |
@@ -944,7 +946,7 @@ bfad_im_supported_speeds(struct bfa_s *bfa) | |||
944 | } | 946 | } |
945 | 947 | ||
946 | void | 948 | void |
947 | bfad_os_fc_host_init(struct bfad_im_port_s *im_port) | 949 | bfad_fc_host_init(struct bfad_im_port_s *im_port) |
948 | { | 950 | { |
949 | struct Scsi_Host *host = im_port->shost; | 951 | struct Scsi_Host *host = im_port->shost; |
950 | struct bfad_s *bfad = im_port->bfad; | 952 | struct bfad_s *bfad = im_port->bfad; |
@@ -988,7 +990,7 @@ bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, struct bfad_itnim_s *itnim) | |||
988 | rport_ids.port_name = | 990 | rport_ids.port_name = |
989 | cpu_to_be64(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim)); | 991 | cpu_to_be64(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim)); |
990 | rport_ids.port_id = | 992 | rport_ids.port_id = |
991 | bfa_os_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim)); | 993 | bfa_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim)); |
992 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; | 994 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; |
993 | 995 | ||
994 | itnim->fc_rport = fc_rport = | 996 | itnim->fc_rport = fc_rport = |
@@ -1109,7 +1111,7 @@ bfad_im_itnim_work_handler(struct work_struct *work) | |||
1109 | kfree(itnim); | 1111 | kfree(itnim); |
1110 | break; | 1112 | break; |
1111 | default: | 1113 | default: |
1112 | bfa_assert(0); | 1114 | WARN_ON(1); |
1113 | break; | 1115 | break; |
1114 | } | 1116 | } |
1115 | 1117 | ||
@@ -1172,7 +1174,6 @@ bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd | |||
1172 | } | 1174 | } |
1173 | 1175 | ||
1174 | cmnd->host_scribble = (char *)hal_io; | 1176 | cmnd->host_scribble = (char *)hal_io; |
1175 | bfa_trc_fp(bfad, hal_io->iotag); | ||
1176 | bfa_ioim_start(hal_io); | 1177 | bfa_ioim_start(hal_io); |
1177 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 1178 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
1178 | 1179 | ||
@@ -1190,7 +1191,7 @@ out_fail_cmd: | |||
1190 | static DEF_SCSI_QCMD(bfad_im_queuecommand) | 1191 | static DEF_SCSI_QCMD(bfad_im_queuecommand) |
1191 | 1192 | ||
1192 | void | 1193 | void |
1193 | bfad_os_rport_online_wait(struct bfad_s *bfad) | 1194 | bfad_rport_online_wait(struct bfad_s *bfad) |
1194 | { | 1195 | { |
1195 | int i; | 1196 | int i; |
1196 | int rport_delay = 10; | 1197 | int rport_delay = 10; |
@@ -1218,7 +1219,7 @@ bfad_os_rport_online_wait(struct bfad_s *bfad) | |||
1218 | } | 1219 | } |
1219 | 1220 | ||
1220 | int | 1221 | int |
1221 | bfad_os_get_linkup_delay(struct bfad_s *bfad) | 1222 | bfad_get_linkup_delay(struct bfad_s *bfad) |
1222 | { | 1223 | { |
1223 | u8 nwwns = 0; | 1224 | u8 nwwns = 0; |
1224 | wwn_t wwns[BFA_PREBOOT_BOOTLUN_MAX]; | 1225 | wwn_t wwns[BFA_PREBOOT_BOOTLUN_MAX]; |
diff --git a/drivers/scsi/bfa/bfad_im.h b/drivers/scsi/bfa/bfad_im.h index b038c0e0892..bfee63b16fa 100644 --- a/drivers/scsi/bfa/bfad_im.h +++ b/drivers/scsi/bfa/bfad_im.h | |||
@@ -117,17 +117,17 @@ struct bfad_im_s { | |||
117 | char drv_workq_name[KOBJ_NAME_LEN]; | 117 | char drv_workq_name[KOBJ_NAME_LEN]; |
118 | }; | 118 | }; |
119 | 119 | ||
120 | struct Scsi_Host *bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, | 120 | struct Scsi_Host *bfad_scsi_host_alloc(struct bfad_im_port_s *im_port, |
121 | struct bfad_s *); | 121 | struct bfad_s *); |
122 | bfa_status_t bfad_os_thread_workq(struct bfad_s *bfad); | 122 | bfa_status_t bfad_thread_workq(struct bfad_s *bfad); |
123 | void bfad_os_destroy_workq(struct bfad_im_s *im); | 123 | void bfad_destroy_workq(struct bfad_im_s *im); |
124 | void bfad_os_fc_host_init(struct bfad_im_port_s *im_port); | 124 | void bfad_fc_host_init(struct bfad_im_port_s *im_port); |
125 | void bfad_os_scsi_host_free(struct bfad_s *bfad, | 125 | void bfad_scsi_host_free(struct bfad_s *bfad, |
126 | struct bfad_im_port_s *im_port); | 126 | struct bfad_im_port_s *im_port); |
127 | void bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, | 127 | void bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim, |
128 | struct scsi_device *sdev); | 128 | struct scsi_device *sdev); |
129 | void bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev); | 129 | void bfad_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev); |
130 | struct bfad_itnim_s *bfad_os_get_itnim(struct bfad_im_port_s *im_port, int id); | 130 | struct bfad_itnim_s *bfad_get_itnim(struct bfad_im_port_s *im_port, int id); |
131 | 131 | ||
132 | extern struct scsi_host_template bfad_im_scsi_host_template; | 132 | extern struct scsi_host_template bfad_im_scsi_host_template; |
133 | extern struct scsi_host_template bfad_im_vport_template; | 133 | extern struct scsi_host_template bfad_im_vport_template; |
diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h index 58796d1284b..72b69a0c3b5 100644 --- a/drivers/scsi/bfa/bfi.h +++ b/drivers/scsi/bfa/bfi.h | |||
@@ -95,8 +95,8 @@ enum { | |||
95 | */ | 95 | */ |
96 | union bfi_addr_u { | 96 | union bfi_addr_u { |
97 | struct { | 97 | struct { |
98 | u32 addr_lo; | 98 | __be32 addr_lo; |
99 | u32 addr_hi; | 99 | __be32 addr_hi; |
100 | } a32; | 100 | } a32; |
101 | }; | 101 | }; |
102 | 102 | ||
@@ -104,7 +104,7 @@ union bfi_addr_u { | |||
104 | * Scatter Gather Element | 104 | * Scatter Gather Element |
105 | */ | 105 | */ |
106 | struct bfi_sge_s { | 106 | struct bfi_sge_s { |
107 | #ifdef __BIGENDIAN | 107 | #ifdef __BIG_ENDIAN |
108 | u32 flags:2, | 108 | u32 flags:2, |
109 | rsvd:2, | 109 | rsvd:2, |
110 | sg_len:28; | 110 | sg_len:28; |
@@ -399,7 +399,7 @@ union bfi_ioc_i2h_msg_u { | |||
399 | */ | 399 | */ |
400 | struct bfi_pbc_blun_s { | 400 | struct bfi_pbc_blun_s { |
401 | wwn_t tgt_pwwn; | 401 | wwn_t tgt_pwwn; |
402 | lun_t tgt_lun; | 402 | struct scsi_lun tgt_lun; |
403 | }; | 403 | }; |
404 | 404 | ||
405 | /* | 405 | /* |
diff --git a/drivers/scsi/bfa/bfi_cbreg.h b/drivers/scsi/bfa/bfi_cbreg.h index 6f03ed382c6..39ad42b66b5 100644 --- a/drivers/scsi/bfa/bfi_cbreg.h +++ b/drivers/scsi/bfa/bfi_cbreg.h | |||
@@ -208,6 +208,7 @@ | |||
208 | #define BFA_IOC1_HBEAT_REG HOST_SEM2_INFO_REG | 208 | #define BFA_IOC1_HBEAT_REG HOST_SEM2_INFO_REG |
209 | #define BFA_IOC1_STATE_REG HOST_SEM3_INFO_REG | 209 | #define BFA_IOC1_STATE_REG HOST_SEM3_INFO_REG |
210 | #define BFA_FW_USE_COUNT HOST_SEM4_INFO_REG | 210 | #define BFA_FW_USE_COUNT HOST_SEM4_INFO_REG |
211 | #define BFA_IOC_FAIL_SYNC HOST_SEM5_INFO_REG | ||
211 | 212 | ||
212 | #define CPE_Q_DEPTH(__n) \ | 213 | #define CPE_Q_DEPTH(__n) \ |
213 | (CPE_Q0_DEPTH + (__n) * (CPE_Q1_DEPTH - CPE_Q0_DEPTH)) | 214 | (CPE_Q0_DEPTH + (__n) * (CPE_Q1_DEPTH - CPE_Q0_DEPTH)) |
diff --git a/drivers/scsi/bfa/bfi_ctreg.h b/drivers/scsi/bfa/bfi_ctreg.h index 62b86a4b0e4..fc4ce4a5a18 100644 --- a/drivers/scsi/bfa/bfi_ctreg.h +++ b/drivers/scsi/bfa/bfi_ctreg.h | |||
@@ -522,6 +522,7 @@ enum { | |||
522 | #define BFA_IOC1_HBEAT_REG HOST_SEM2_INFO_REG | 522 | #define BFA_IOC1_HBEAT_REG HOST_SEM2_INFO_REG |
523 | #define BFA_IOC1_STATE_REG HOST_SEM3_INFO_REG | 523 | #define BFA_IOC1_STATE_REG HOST_SEM3_INFO_REG |
524 | #define BFA_FW_USE_COUNT HOST_SEM4_INFO_REG | 524 | #define BFA_FW_USE_COUNT HOST_SEM4_INFO_REG |
525 | #define BFA_IOC_FAIL_SYNC HOST_SEM5_INFO_REG | ||
525 | 526 | ||
526 | #define CPE_DEPTH_Q(__n) \ | 527 | #define CPE_DEPTH_Q(__n) \ |
527 | (CPE_DEPTH_Q0 + (__n) * (CPE_DEPTH_Q1 - CPE_DEPTH_Q0)) | 528 | (CPE_DEPTH_Q0 + (__n) * (CPE_DEPTH_Q1 - CPE_DEPTH_Q0)) |
@@ -539,22 +540,30 @@ enum { | |||
539 | (RME_PI_PTR_Q0 + (__n) * (RME_PI_PTR_Q1 - RME_PI_PTR_Q0)) | 540 | (RME_PI_PTR_Q0 + (__n) * (RME_PI_PTR_Q1 - RME_PI_PTR_Q0)) |
540 | #define RME_CI_PTR_Q(__n) \ | 541 | #define RME_CI_PTR_Q(__n) \ |
541 | (RME_CI_PTR_Q0 + (__n) * (RME_CI_PTR_Q1 - RME_CI_PTR_Q0)) | 542 | (RME_CI_PTR_Q0 + (__n) * (RME_CI_PTR_Q1 - RME_CI_PTR_Q0)) |
542 | #define HQM_QSET_RXQ_DRBL_P0(__n) (HQM_QSET0_RXQ_DRBL_P0 + (__n) \ | 543 | #define HQM_QSET_RXQ_DRBL_P0(__n) \ |
543 | * (HQM_QSET1_RXQ_DRBL_P0 - HQM_QSET0_RXQ_DRBL_P0)) | 544 | (HQM_QSET0_RXQ_DRBL_P0 + (__n) * \ |
544 | #define HQM_QSET_TXQ_DRBL_P0(__n) (HQM_QSET0_TXQ_DRBL_P0 + (__n) \ | 545 | (HQM_QSET1_RXQ_DRBL_P0 - HQM_QSET0_RXQ_DRBL_P0)) |
545 | * (HQM_QSET1_TXQ_DRBL_P0 - HQM_QSET0_TXQ_DRBL_P0)) | 546 | #define HQM_QSET_TXQ_DRBL_P0(__n) \ |
546 | #define HQM_QSET_IB_DRBL_1_P0(__n) (HQM_QSET0_IB_DRBL_1_P0 + (__n) \ | 547 | (HQM_QSET0_TXQ_DRBL_P0 + (__n) * \ |
547 | * (HQM_QSET1_IB_DRBL_1_P0 - HQM_QSET0_IB_DRBL_1_P0)) | 548 | (HQM_QSET1_TXQ_DRBL_P0 - HQM_QSET0_TXQ_DRBL_P0)) |
548 | #define HQM_QSET_IB_DRBL_2_P0(__n) (HQM_QSET0_IB_DRBL_2_P0 + (__n) \ | 549 | #define HQM_QSET_IB_DRBL_1_P0(__n) \ |
549 | * (HQM_QSET1_IB_DRBL_2_P0 - HQM_QSET0_IB_DRBL_2_P0)) | 550 | (HQM_QSET0_IB_DRBL_1_P0 + (__n) * \ |
550 | #define HQM_QSET_RXQ_DRBL_P1(__n) (HQM_QSET0_RXQ_DRBL_P1 + (__n) \ | 551 | (HQM_QSET1_IB_DRBL_1_P0 - HQM_QSET0_IB_DRBL_1_P0)) |
551 | * (HQM_QSET1_RXQ_DRBL_P1 - HQM_QSET0_RXQ_DRBL_P1)) | 552 | #define HQM_QSET_IB_DRBL_2_P0(__n) \ |
552 | #define HQM_QSET_TXQ_DRBL_P1(__n) (HQM_QSET0_TXQ_DRBL_P1 + (__n) \ | 553 | (HQM_QSET0_IB_DRBL_2_P0 + (__n) * \ |
553 | * (HQM_QSET1_TXQ_DRBL_P1 - HQM_QSET0_TXQ_DRBL_P1)) | 554 | (HQM_QSET1_IB_DRBL_2_P0 - HQM_QSET0_IB_DRBL_2_P0)) |
554 | #define HQM_QSET_IB_DRBL_1_P1(__n) (HQM_QSET0_IB_DRBL_1_P1 + (__n) \ | 555 | #define HQM_QSET_RXQ_DRBL_P1(__n) \ |
555 | * (HQM_QSET1_IB_DRBL_1_P1 - HQM_QSET0_IB_DRBL_1_P1)) | 556 | (HQM_QSET0_RXQ_DRBL_P1 + (__n) * \ |
556 | #define HQM_QSET_IB_DRBL_2_P1(__n) (HQM_QSET0_IB_DRBL_2_P1 + (__n) \ | 557 | (HQM_QSET1_RXQ_DRBL_P1 - HQM_QSET0_RXQ_DRBL_P1)) |
557 | * (HQM_QSET1_IB_DRBL_2_P1 - HQM_QSET0_IB_DRBL_2_P1)) | 558 | #define HQM_QSET_TXQ_DRBL_P1(__n) \ |
559 | (HQM_QSET0_TXQ_DRBL_P1 + (__n) * \ | ||
560 | (HQM_QSET1_TXQ_DRBL_P1 - HQM_QSET0_TXQ_DRBL_P1)) | ||
561 | #define HQM_QSET_IB_DRBL_1_P1(__n) \ | ||
562 | (HQM_QSET0_IB_DRBL_1_P1 + (__n) * \ | ||
563 | (HQM_QSET1_IB_DRBL_1_P1 - HQM_QSET0_IB_DRBL_1_P1)) | ||
564 | #define HQM_QSET_IB_DRBL_2_P1(__n) \ | ||
565 | (HQM_QSET0_IB_DRBL_2_P1 + (__n) * \ | ||
566 | (HQM_QSET1_IB_DRBL_2_P1 - HQM_QSET0_IB_DRBL_2_P1)) | ||
558 | 567 | ||
559 | #define CPE_Q_NUM(__fn, __q) (((__fn) << 2) + (__q)) | 568 | #define CPE_Q_NUM(__fn, __q) (((__fn) << 2) + (__q)) |
560 | #define RME_Q_NUM(__fn, __q) (((__fn) << 2) + (__q)) | 569 | #define RME_Q_NUM(__fn, __q) (((__fn) << 2) + (__q)) |
diff --git a/drivers/scsi/bfa/bfi_ms.h b/drivers/scsi/bfa/bfi_ms.h index fa9f6fb9d45..19e888a5755 100644 --- a/drivers/scsi/bfa/bfi_ms.h +++ b/drivers/scsi/bfa/bfi_ms.h | |||
@@ -47,10 +47,10 @@ struct bfi_iocfc_cfg_s { | |||
47 | */ | 47 | */ |
48 | union bfi_addr_u req_cq_ba[BFI_IOC_MAX_CQS]; | 48 | union bfi_addr_u req_cq_ba[BFI_IOC_MAX_CQS]; |
49 | union bfi_addr_u req_shadow_ci[BFI_IOC_MAX_CQS]; | 49 | union bfi_addr_u req_shadow_ci[BFI_IOC_MAX_CQS]; |
50 | u16 req_cq_elems[BFI_IOC_MAX_CQS]; | 50 | __be16 req_cq_elems[BFI_IOC_MAX_CQS]; |
51 | union bfi_addr_u rsp_cq_ba[BFI_IOC_MAX_CQS]; | 51 | union bfi_addr_u rsp_cq_ba[BFI_IOC_MAX_CQS]; |
52 | union bfi_addr_u rsp_shadow_pi[BFI_IOC_MAX_CQS]; | 52 | union bfi_addr_u rsp_shadow_pi[BFI_IOC_MAX_CQS]; |
53 | u16 rsp_cq_elems[BFI_IOC_MAX_CQS]; | 53 | __be16 rsp_cq_elems[BFI_IOC_MAX_CQS]; |
54 | 54 | ||
55 | union bfi_addr_u stats_addr; /* DMA-able address for stats */ | 55 | union bfi_addr_u stats_addr; /* DMA-able address for stats */ |
56 | union bfi_addr_u cfgrsp_addr; /* config response dma address */ | 56 | union bfi_addr_u cfgrsp_addr; /* config response dma address */ |
@@ -102,8 +102,8 @@ struct bfi_iocfc_set_intr_req_s { | |||
102 | struct bfi_mhdr_s mh; /* common msg header */ | 102 | struct bfi_mhdr_s mh; /* common msg header */ |
103 | u8 coalesce; /* enable intr coalescing */ | 103 | u8 coalesce; /* enable intr coalescing */ |
104 | u8 rsvd[3]; | 104 | u8 rsvd[3]; |
105 | u16 delay; /* delay timer 0..1125us */ | 105 | __be16 delay; /* delay timer 0..1125us */ |
106 | u16 latency; /* latency timer 0..225us */ | 106 | __be16 latency; /* latency timer 0..225us */ |
107 | }; | 107 | }; |
108 | 108 | ||
109 | 109 | ||
@@ -188,7 +188,8 @@ struct bfi_fcport_rsp_s { | |||
188 | struct bfi_mhdr_s mh; /* common msg header */ | 188 | struct bfi_mhdr_s mh; /* common msg header */ |
189 | u8 status; /* port enable status */ | 189 | u8 status; /* port enable status */ |
190 | u8 rsvd[3]; | 190 | u8 rsvd[3]; |
191 | u32 msgtag; /* msgtag for reply */ | 191 | struct bfa_port_cfg_s port_cfg;/* port configuration */ |
192 | u32 msgtag; /* msgtag for reply */ | ||
192 | }; | 193 | }; |
193 | 194 | ||
194 | /* | 195 | /* |
@@ -202,7 +203,8 @@ struct bfi_fcport_enable_req_s { | |||
202 | struct bfa_port_cfg_s port_cfg; /* port configuration */ | 203 | struct bfa_port_cfg_s port_cfg; /* port configuration */ |
203 | union bfi_addr_u stats_dma_addr; /* DMA address for stats */ | 204 | union bfi_addr_u stats_dma_addr; /* DMA address for stats */ |
204 | u32 msgtag; /* msgtag for reply */ | 205 | u32 msgtag; /* msgtag for reply */ |
205 | u32 rsvd2; | 206 | u8 use_flash_cfg; /* get prot cfg from flash */ |
207 | u8 rsvd2[3]; | ||
206 | }; | 208 | }; |
207 | 209 | ||
208 | /* | 210 | /* |
@@ -210,7 +212,7 @@ struct bfi_fcport_enable_req_s { | |||
210 | */ | 212 | */ |
211 | struct bfi_fcport_set_svc_params_req_s { | 213 | struct bfi_fcport_set_svc_params_req_s { |
212 | struct bfi_mhdr_s mh; /* msg header */ | 214 | struct bfi_mhdr_s mh; /* msg header */ |
213 | u16 tx_bbcredit; /* Tx credits */ | 215 | __be16 tx_bbcredit; /* Tx credits */ |
214 | u16 rsvd; | 216 | u16 rsvd; |
215 | }; | 217 | }; |
216 | 218 | ||
@@ -231,7 +233,7 @@ struct bfi_fcport_trunk_link_s { | |||
231 | u8 state; /* bfa_trunk_link_state_t */ | 233 | u8 state; /* bfa_trunk_link_state_t */ |
232 | u8 speed; /* bfa_port_speed_t */ | 234 | u8 speed; /* bfa_port_speed_t */ |
233 | u8 rsvd; | 235 | u8 rsvd; |
234 | u32 deskew; | 236 | __be32 deskew; |
235 | }; | 237 | }; |
236 | 238 | ||
237 | #define BFI_FCPORT_MAX_LINKS 2 | 239 | #define BFI_FCPORT_MAX_LINKS 2 |
@@ -284,17 +286,17 @@ enum bfi_fcxp_i2h { | |||
284 | */ | 286 | */ |
285 | struct bfi_fcxp_send_req_s { | 287 | struct bfi_fcxp_send_req_s { |
286 | struct bfi_mhdr_s mh; /* Common msg header */ | 288 | struct bfi_mhdr_s mh; /* Common msg header */ |
287 | u16 fcxp_tag; /* driver request tag */ | 289 | __be16 fcxp_tag; /* driver request tag */ |
288 | u16 max_frmsz; /* max send frame size */ | 290 | __be16 max_frmsz; /* max send frame size */ |
289 | u16 vf_id; /* vsan tag if applicable */ | 291 | __be16 vf_id; /* vsan tag if applicable */ |
290 | u16 rport_fw_hndl; /* FW Handle for the remote port */ | 292 | u16 rport_fw_hndl; /* FW Handle for the remote port */ |
291 | u8 class; /* FC class used for req/rsp */ | 293 | u8 class; /* FC class used for req/rsp */ |
292 | u8 rsp_timeout; /* timeout in secs, 0-no response */ | 294 | u8 rsp_timeout; /* timeout in secs, 0-no response */ |
293 | u8 cts; /* continue sequence */ | 295 | u8 cts; /* continue sequence */ |
294 | u8 lp_tag; /* lport tag */ | 296 | u8 lp_tag; /* lport tag */ |
295 | struct fchs_s fchs; /* request FC header structure */ | 297 | struct fchs_s fchs; /* request FC header structure */ |
296 | u32 req_len; /* request payload length */ | 298 | __be32 req_len; /* request payload length */ |
297 | u32 rsp_maxlen; /* max response length expected */ | 299 | __be32 rsp_maxlen; /* max response length expected */ |
298 | struct bfi_sge_s req_sge[BFA_FCXP_MAX_SGES]; /* request buf */ | 300 | struct bfi_sge_s req_sge[BFA_FCXP_MAX_SGES]; /* request buf */ |
299 | struct bfi_sge_s rsp_sge[BFA_FCXP_MAX_SGES]; /* response buf */ | 301 | struct bfi_sge_s rsp_sge[BFA_FCXP_MAX_SGES]; /* response buf */ |
300 | }; | 302 | }; |
@@ -304,11 +306,11 @@ struct bfi_fcxp_send_req_s { | |||
304 | */ | 306 | */ |
305 | struct bfi_fcxp_send_rsp_s { | 307 | struct bfi_fcxp_send_rsp_s { |
306 | struct bfi_mhdr_s mh; /* Common msg header */ | 308 | struct bfi_mhdr_s mh; /* Common msg header */ |
307 | u16 fcxp_tag; /* send request tag */ | 309 | __be16 fcxp_tag; /* send request tag */ |
308 | u8 req_status; /* request status */ | 310 | u8 req_status; /* request status */ |
309 | u8 rsvd; | 311 | u8 rsvd; |
310 | u32 rsp_len; /* actual response length */ | 312 | __be32 rsp_len; /* actual response length */ |
311 | u32 residue_len; /* residual response length */ | 313 | __be32 residue_len; /* residual response length */ |
312 | struct fchs_s fchs; /* response FC header structure */ | 314 | struct fchs_s fchs; /* response FC header structure */ |
313 | }; | 315 | }; |
314 | 316 | ||
@@ -325,7 +327,7 @@ enum bfi_uf_i2h { | |||
325 | struct bfi_uf_buf_post_s { | 327 | struct bfi_uf_buf_post_s { |
326 | struct bfi_mhdr_s mh; /* Common msg header */ | 328 | struct bfi_mhdr_s mh; /* Common msg header */ |
327 | u16 buf_tag; /* buffer tag */ | 329 | u16 buf_tag; /* buffer tag */ |
328 | u16 buf_len; /* total buffer length */ | 330 | __be16 buf_len; /* total buffer length */ |
329 | struct bfi_sge_s sge[BFA_UF_MAX_SGES]; /* buffer DMA SGEs */ | 331 | struct bfi_sge_s sge[BFA_UF_MAX_SGES]; /* buffer DMA SGEs */ |
330 | }; | 332 | }; |
331 | 333 | ||
@@ -340,6 +342,7 @@ struct bfi_uf_frm_rcvd_s { | |||
340 | enum bfi_lps_h2i_msgs { | 342 | enum bfi_lps_h2i_msgs { |
341 | BFI_LPS_H2I_LOGIN_REQ = 1, | 343 | BFI_LPS_H2I_LOGIN_REQ = 1, |
342 | BFI_LPS_H2I_LOGOUT_REQ = 2, | 344 | BFI_LPS_H2I_LOGOUT_REQ = 2, |
345 | BFI_LPS_H2I_N2N_PID_REQ = 3, | ||
343 | }; | 346 | }; |
344 | 347 | ||
345 | enum bfi_lps_i2h_msgs { | 348 | enum bfi_lps_i2h_msgs { |
@@ -352,7 +355,7 @@ struct bfi_lps_login_req_s { | |||
352 | struct bfi_mhdr_s mh; /* common msg header */ | 355 | struct bfi_mhdr_s mh; /* common msg header */ |
353 | u8 lp_tag; | 356 | u8 lp_tag; |
354 | u8 alpa; | 357 | u8 alpa; |
355 | u16 pdu_size; | 358 | __be16 pdu_size; |
356 | wwn_t pwwn; | 359 | wwn_t pwwn; |
357 | wwn_t nwwn; | 360 | wwn_t nwwn; |
358 | u8 fdisc; | 361 | u8 fdisc; |
@@ -368,7 +371,7 @@ struct bfi_lps_login_rsp_s { | |||
368 | u8 lsrjt_expl; | 371 | u8 lsrjt_expl; |
369 | wwn_t port_name; | 372 | wwn_t port_name; |
370 | wwn_t node_name; | 373 | wwn_t node_name; |
371 | u16 bb_credit; | 374 | __be16 bb_credit; |
372 | u8 f_port; | 375 | u8 f_port; |
373 | u8 npiv_en; | 376 | u8 npiv_en; |
374 | u32 lp_pid:24; | 377 | u32 lp_pid:24; |
@@ -399,10 +402,17 @@ struct bfi_lps_cvl_event_s { | |||
399 | u8 rsvd[3]; | 402 | u8 rsvd[3]; |
400 | }; | 403 | }; |
401 | 404 | ||
405 | struct bfi_lps_n2n_pid_req_s { | ||
406 | struct bfi_mhdr_s mh; /* common msg header */ | ||
407 | u8 lp_tag; | ||
408 | u32 lp_pid:24; | ||
409 | }; | ||
410 | |||
402 | union bfi_lps_h2i_msg_u { | 411 | union bfi_lps_h2i_msg_u { |
403 | struct bfi_mhdr_s *msg; | 412 | struct bfi_mhdr_s *msg; |
404 | struct bfi_lps_login_req_s *login_req; | 413 | struct bfi_lps_login_req_s *login_req; |
405 | struct bfi_lps_logout_req_s *logout_req; | 414 | struct bfi_lps_logout_req_s *logout_req; |
415 | struct bfi_lps_n2n_pid_req_s *n2n_pid_req; | ||
406 | }; | 416 | }; |
407 | 417 | ||
408 | union bfi_lps_i2h_msg_u { | 418 | union bfi_lps_i2h_msg_u { |
@@ -427,7 +437,7 @@ enum bfi_rport_i2h_msgs { | |||
427 | struct bfi_rport_create_req_s { | 437 | struct bfi_rport_create_req_s { |
428 | struct bfi_mhdr_s mh; /* common msg header */ | 438 | struct bfi_mhdr_s mh; /* common msg header */ |
429 | u16 bfa_handle; /* host rport handle */ | 439 | u16 bfa_handle; /* host rport handle */ |
430 | u16 max_frmsz; /* max rcv pdu size */ | 440 | __be16 max_frmsz; /* max rcv pdu size */ |
431 | u32 pid:24, /* remote port ID */ | 441 | u32 pid:24, /* remote port ID */ |
432 | lp_tag:8; /* local port tag */ | 442 | lp_tag:8; /* local port tag */ |
433 | u32 local_pid:24, /* local port ID */ | 443 | u32 local_pid:24, /* local port ID */ |
@@ -583,7 +593,7 @@ struct bfi_ioim_dif_s { | |||
583 | */ | 593 | */ |
584 | struct bfi_ioim_req_s { | 594 | struct bfi_ioim_req_s { |
585 | struct bfi_mhdr_s mh; /* Common msg header */ | 595 | struct bfi_mhdr_s mh; /* Common msg header */ |
586 | u16 io_tag; /* I/O tag */ | 596 | __be16 io_tag; /* I/O tag */ |
587 | u16 rport_hdl; /* itnim/rport firmware handle */ | 597 | u16 rport_hdl; /* itnim/rport firmware handle */ |
588 | struct fcp_cmnd_s cmnd; /* IO request info */ | 598 | struct fcp_cmnd_s cmnd; /* IO request info */ |
589 | 599 | ||
@@ -689,7 +699,7 @@ enum bfi_ioim_status { | |||
689 | */ | 699 | */ |
690 | struct bfi_ioim_rsp_s { | 700 | struct bfi_ioim_rsp_s { |
691 | struct bfi_mhdr_s mh; /* common msg header */ | 701 | struct bfi_mhdr_s mh; /* common msg header */ |
692 | u16 io_tag; /* completed IO tag */ | 702 | __be16 io_tag; /* completed IO tag */ |
693 | u16 bfa_rport_hndl; /* releated rport handle */ | 703 | u16 bfa_rport_hndl; /* releated rport handle */ |
694 | u8 io_status; /* IO completion status */ | 704 | u8 io_status; /* IO completion status */ |
695 | u8 reuse_io_tag; /* IO tag can be reused */ | 705 | u8 reuse_io_tag; /* IO tag can be reused */ |
@@ -698,13 +708,13 @@ struct bfi_ioim_rsp_s { | |||
698 | u8 sns_len; /* scsi sense length */ | 708 | u8 sns_len; /* scsi sense length */ |
699 | u8 resid_flags; /* IO residue flags */ | 709 | u8 resid_flags; /* IO residue flags */ |
700 | u8 rsvd_a; | 710 | u8 rsvd_a; |
701 | u32 residue; /* IO residual length in bytes */ | 711 | __be32 residue; /* IO residual length in bytes */ |
702 | u32 rsvd_b[3]; | 712 | u32 rsvd_b[3]; |
703 | }; | 713 | }; |
704 | 714 | ||
705 | struct bfi_ioim_abort_req_s { | 715 | struct bfi_ioim_abort_req_s { |
706 | struct bfi_mhdr_s mh; /* Common msg header */ | 716 | struct bfi_mhdr_s mh; /* Common msg header */ |
707 | u16 io_tag; /* I/O tag */ | 717 | __be16 io_tag; /* I/O tag */ |
708 | u16 abort_tag; /* unique request tag */ | 718 | u16 abort_tag; /* unique request tag */ |
709 | }; | 719 | }; |
710 | 720 | ||
@@ -723,9 +733,9 @@ enum bfi_tskim_i2h { | |||
723 | 733 | ||
724 | struct bfi_tskim_req_s { | 734 | struct bfi_tskim_req_s { |
725 | struct bfi_mhdr_s mh; /* Common msg header */ | 735 | struct bfi_mhdr_s mh; /* Common msg header */ |
726 | u16 tsk_tag; /* task management tag */ | 736 | __be16 tsk_tag; /* task management tag */ |
727 | u16 itn_fhdl; /* itn firmware handle */ | 737 | u16 itn_fhdl; /* itn firmware handle */ |
728 | lun_t lun; /* LU number */ | 738 | struct scsi_lun lun; /* LU number */ |
729 | u8 tm_flags; /* see enum fcp_tm_cmnd */ | 739 | u8 tm_flags; /* see enum fcp_tm_cmnd */ |
730 | u8 t_secs; /* Timeout value in seconds */ | 740 | u8 t_secs; /* Timeout value in seconds */ |
731 | u8 rsvd[2]; | 741 | u8 rsvd[2]; |
@@ -733,7 +743,7 @@ struct bfi_tskim_req_s { | |||
733 | 743 | ||
734 | struct bfi_tskim_abortreq_s { | 744 | struct bfi_tskim_abortreq_s { |
735 | struct bfi_mhdr_s mh; /* Common msg header */ | 745 | struct bfi_mhdr_s mh; /* Common msg header */ |
736 | u16 tsk_tag; /* task management tag */ | 746 | __be16 tsk_tag; /* task management tag */ |
737 | u16 rsvd; | 747 | u16 rsvd; |
738 | }; | 748 | }; |
739 | 749 | ||
@@ -755,7 +765,7 @@ enum bfi_tskim_status { | |||
755 | 765 | ||
756 | struct bfi_tskim_rsp_s { | 766 | struct bfi_tskim_rsp_s { |
757 | struct bfi_mhdr_s mh; /* Common msg header */ | 767 | struct bfi_mhdr_s mh; /* Common msg header */ |
758 | u16 tsk_tag; /* task mgmt cmnd tag */ | 768 | __be16 tsk_tag; /* task mgmt cmnd tag */ |
759 | u8 tsk_status; /* @ref bfi_tskim_status */ | 769 | u8 tsk_status; /* @ref bfi_tskim_status */ |
760 | u8 rsvd; | 770 | u8 rsvd; |
761 | }; | 771 | }; |