diff options
author | Jiri Kosina <jkosina@suse.cz> | 2010-04-22 20:08:44 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-04-22 20:08:44 -0400 |
commit | 6c9468e9eb1252eaefd94ce7f06e1be9b0b641b1 (patch) | |
tree | 797676a336b050bfa1ef879377c07e541b9075d6 /drivers/scsi/bfa | |
parent | 4cb3ca7cd7e2cae8d1daf5345ec99a1e8502cf3f (diff) | |
parent | c81eddb0e3728661d1585fbc564449c94165cc36 (diff) |
Merge branch 'master' into for-next
Diffstat (limited to 'drivers/scsi/bfa')
89 files changed, 3491 insertions, 2438 deletions
diff --git a/drivers/scsi/bfa/Makefile b/drivers/scsi/bfa/Makefile index 1d6009490d1c..17e06cae71b2 100644 --- a/drivers/scsi/bfa/Makefile +++ b/drivers/scsi/bfa/Makefile | |||
@@ -2,14 +2,14 @@ obj-$(CONFIG_SCSI_BFA_FC) := bfa.o | |||
2 | 2 | ||
3 | bfa-y := bfad.o bfad_intr.o bfad_os.o bfad_im.o bfad_attr.o bfad_fwimg.o | 3 | bfa-y := bfad.o bfad_intr.o bfad_os.o bfad_im.o bfad_attr.o bfad_fwimg.o |
4 | 4 | ||
5 | bfa-y += bfa_core.o bfa_ioc.o bfa_iocfc.o bfa_fcxp.o bfa_lps.o | 5 | bfa-y += bfa_core.o bfa_ioc.o bfa_ioc_ct.o bfa_ioc_cb.o bfa_iocfc.o bfa_fcxp.o |
6 | bfa-y += bfa_hw_cb.o bfa_hw_ct.o bfa_intr.o bfa_timer.o bfa_rport.o | 6 | bfa-y += bfa_lps.o bfa_hw_cb.o bfa_hw_ct.o bfa_intr.o bfa_timer.o bfa_rport.o |
7 | bfa-y += bfa_fcport.o bfa_port.o bfa_uf.o bfa_sgpg.o bfa_module.o bfa_ioim.o | 7 | bfa-y += bfa_fcport.o bfa_port.o bfa_uf.o bfa_sgpg.o bfa_module.o bfa_ioim.o |
8 | bfa-y += bfa_itnim.o bfa_fcpim.o bfa_tskim.o bfa_log.o bfa_log_module.o | 8 | bfa-y += bfa_itnim.o bfa_fcpim.o bfa_tskim.o bfa_log.o bfa_log_module.o |
9 | bfa-y += bfa_csdebug.o bfa_sm.o plog.o | 9 | bfa-y += bfa_csdebug.o bfa_sm.o plog.o |
10 | 10 | ||
11 | bfa-y += fcbuild.o fabric.o fcpim.o vfapi.o fcptm.o bfa_fcs.o bfa_fcs_port.o | 11 | bfa-y += fcbuild.o fabric.o fcpim.o vfapi.o fcptm.o bfa_fcs.o bfa_fcs_port.o |
12 | bfa-y += bfa_fcs_uf.o bfa_fcs_lport.o fab.o fdmi.o ms.o ns.o scn.o loop.o | 12 | bfa-y += bfa_fcs_uf.o bfa_fcs_lport.o fab.o fdmi.o ms.o ns.o scn.o loop.o |
13 | bfa-y += lport_api.o n2n.o rport.o rport_api.o rport_ftrs.o vport.o | 13 | bfa-y += lport_api.o n2n.o rport.o rport_api.o rport_ftrs.o vport.o |
14 | 14 | ||
15 | ccflags-y := -I$(obj) -I$(obj)/include -I$(obj)/include/cna | 15 | ccflags-y := -I$(obj) -I$(obj)/include -I$(obj)/include/cna -DBFA_PERF_BUILD |
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index 44e2d1155c51..0c08e185a766 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c | |||
@@ -385,6 +385,15 @@ bfa_debug_fwsave(struct bfa_s *bfa, void *trcdata, int *trclen) | |||
385 | } | 385 | } |
386 | 386 | ||
387 | /** | 387 | /** |
388 | * Clear the saved firmware trace information of an IOC. | ||
389 | */ | ||
390 | void | ||
391 | bfa_debug_fwsave_clear(struct bfa_s *bfa) | ||
392 | { | ||
393 | bfa_ioc_debug_fwsave_clear(&bfa->ioc); | ||
394 | } | ||
395 | |||
396 | /** | ||
388 | * Fetch firmware trace data. | 397 | * Fetch firmware trace data. |
389 | * | 398 | * |
390 | * @param[in] bfa BFA instance | 399 | * @param[in] bfa BFA instance |
@@ -399,4 +408,14 @@ bfa_debug_fwtrc(struct bfa_s *bfa, void *trcdata, int *trclen) | |||
399 | { | 408 | { |
400 | return bfa_ioc_debug_fwtrc(&bfa->ioc, trcdata, trclen); | 409 | return bfa_ioc_debug_fwtrc(&bfa->ioc, trcdata, trclen); |
401 | } | 410 | } |
411 | |||
412 | /** | ||
413 | * Reset hw semaphore & usage cnt regs and initialize. | ||
414 | */ | ||
415 | void | ||
416 | bfa_chip_reset(struct bfa_s *bfa) | ||
417 | { | ||
418 | bfa_ioc_ownership_reset(&bfa->ioc); | ||
419 | bfa_ioc_pll_init(&bfa->ioc); | ||
420 | } | ||
402 | #endif | 421 | #endif |
diff --git a/drivers/scsi/bfa/bfa_fcport.c b/drivers/scsi/bfa/bfa_fcport.c index aef648b55dfc..c589488db0c1 100644 --- a/drivers/scsi/bfa/bfa_fcport.c +++ b/drivers/scsi/bfa/bfa_fcport.c | |||
@@ -23,40 +23,33 @@ | |||
23 | #include <cs/bfa_plog.h> | 23 | #include <cs/bfa_plog.h> |
24 | #include <aen/bfa_aen_port.h> | 24 | #include <aen/bfa_aen_port.h> |
25 | 25 | ||
26 | BFA_TRC_FILE(HAL, PPORT); | 26 | BFA_TRC_FILE(HAL, FCPORT); |
27 | BFA_MODULE(pport); | 27 | BFA_MODULE(fcport); |
28 | |||
29 | #define bfa_pport_callback(__pport, __event) do { \ | ||
30 | if ((__pport)->bfa->fcs) { \ | ||
31 | (__pport)->event_cbfn((__pport)->event_cbarg, (__event)); \ | ||
32 | } else { \ | ||
33 | (__pport)->hcb_event = (__event); \ | ||
34 | bfa_cb_queue((__pport)->bfa, &(__pport)->hcb_qe, \ | ||
35 | __bfa_cb_port_event, (__pport)); \ | ||
36 | } \ | ||
37 | } while (0) | ||
38 | 28 | ||
39 | /* | 29 | /* |
40 | * The port is considered disabled if corresponding physical port or IOC are | 30 | * The port is considered disabled if corresponding physical port or IOC are |
41 | * disabled explicitly | 31 | * disabled explicitly |
42 | */ | 32 | */ |
43 | #define BFA_PORT_IS_DISABLED(bfa) \ | 33 | #define BFA_PORT_IS_DISABLED(bfa) \ |
44 | ((bfa_pport_is_disabled(bfa) == BFA_TRUE) || \ | 34 | ((bfa_fcport_is_disabled(bfa) == BFA_TRUE) || \ |
45 | (bfa_ioc_is_disabled(&bfa->ioc) == BFA_TRUE)) | 35 | (bfa_ioc_is_disabled(&bfa->ioc) == BFA_TRUE)) |
46 | 36 | ||
47 | /* | 37 | /* |
48 | * forward declarations | 38 | * forward declarations |
49 | */ | 39 | */ |
50 | static bfa_boolean_t bfa_pport_send_enable(struct bfa_pport_s *port); | 40 | static bfa_boolean_t bfa_fcport_send_enable(struct bfa_fcport_s *fcport); |
51 | static bfa_boolean_t bfa_pport_send_disable(struct bfa_pport_s *port); | 41 | static bfa_boolean_t bfa_fcport_send_disable(struct bfa_fcport_s *fcport); |
52 | static void bfa_pport_update_linkinfo(struct bfa_pport_s *pport); | 42 | static void bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport); |
53 | static void bfa_pport_reset_linkinfo(struct bfa_pport_s *pport); | 43 | static void bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport); |
54 | static void bfa_pport_set_wwns(struct bfa_pport_s *port); | 44 | static void bfa_fcport_set_wwns(struct bfa_fcport_s *fcport); |
55 | static void __bfa_cb_port_event(void *cbarg, bfa_boolean_t complete); | 45 | static void __bfa_cb_fcport_event(void *cbarg, bfa_boolean_t complete); |
56 | static void __bfa_cb_port_stats(void *cbarg, bfa_boolean_t complete); | 46 | static void bfa_fcport_callback(struct bfa_fcport_s *fcport, |
57 | static void __bfa_cb_port_stats_clr(void *cbarg, bfa_boolean_t complete); | 47 | enum bfa_pport_linkstate event); |
58 | static void bfa_port_stats_timeout(void *cbarg); | 48 | static void bfa_fcport_queue_cb(struct bfa_fcport_ln_s *ln, |
59 | static void bfa_port_stats_clr_timeout(void *cbarg); | 49 | enum bfa_pport_linkstate event); |
50 | static void __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete); | ||
51 | static void bfa_fcport_stats_get_timeout(void *cbarg); | ||
52 | static void bfa_fcport_stats_clr_timeout(void *cbarg); | ||
60 | 53 | ||
61 | /** | 54 | /** |
62 | * bfa_pport_private | 55 | * bfa_pport_private |
@@ -65,111 +58,114 @@ static void bfa_port_stats_clr_timeout(void *cbarg); | |||
65 | /** | 58 | /** |
66 | * BFA port state machine events | 59 | * BFA port state machine events |
67 | */ | 60 | */ |
68 | enum bfa_pport_sm_event { | 61 | enum bfa_fcport_sm_event { |
69 | BFA_PPORT_SM_START = 1, /* start port state machine */ | 62 | BFA_FCPORT_SM_START = 1, /* start port state machine */ |
70 | BFA_PPORT_SM_STOP = 2, /* stop port state machine */ | 63 | BFA_FCPORT_SM_STOP = 2, /* stop port state machine */ |
71 | BFA_PPORT_SM_ENABLE = 3, /* enable port */ | 64 | BFA_FCPORT_SM_ENABLE = 3, /* enable port */ |
72 | BFA_PPORT_SM_DISABLE = 4, /* disable port state machine */ | 65 | BFA_FCPORT_SM_DISABLE = 4, /* disable port state machine */ |
73 | BFA_PPORT_SM_FWRSP = 5, /* firmware enable/disable rsp */ | 66 | BFA_FCPORT_SM_FWRSP = 5, /* firmware enable/disable rsp */ |
74 | BFA_PPORT_SM_LINKUP = 6, /* firmware linkup event */ | 67 | BFA_FCPORT_SM_LINKUP = 6, /* firmware linkup event */ |
75 | BFA_PPORT_SM_LINKDOWN = 7, /* firmware linkup down */ | 68 | BFA_FCPORT_SM_LINKDOWN = 7, /* firmware linkup down */ |
76 | BFA_PPORT_SM_QRESUME = 8, /* CQ space available */ | 69 | BFA_FCPORT_SM_QRESUME = 8, /* CQ space available */ |
77 | BFA_PPORT_SM_HWFAIL = 9, /* IOC h/w failure */ | 70 | BFA_FCPORT_SM_HWFAIL = 9, /* IOC h/w failure */ |
78 | }; | 71 | }; |
79 | 72 | ||
80 | static void bfa_pport_sm_uninit(struct bfa_pport_s *pport, | 73 | /** |
81 | enum bfa_pport_sm_event event); | 74 | * BFA port link notification state machine events |
82 | static void bfa_pport_sm_enabling_qwait(struct bfa_pport_s *pport, | 75 | */ |
83 | enum bfa_pport_sm_event event); | 76 | |
84 | static void bfa_pport_sm_enabling(struct bfa_pport_s *pport, | 77 | enum bfa_fcport_ln_sm_event { |
85 | enum bfa_pport_sm_event event); | 78 | BFA_FCPORT_LN_SM_LINKUP = 1, /* linkup event */ |
86 | static void bfa_pport_sm_linkdown(struct bfa_pport_s *pport, | 79 | BFA_FCPORT_LN_SM_LINKDOWN = 2, /* linkdown event */ |
87 | enum bfa_pport_sm_event event); | 80 | BFA_FCPORT_LN_SM_NOTIFICATION = 3 /* done notification */ |
88 | static void bfa_pport_sm_linkup(struct bfa_pport_s *pport, | 81 | }; |
89 | enum bfa_pport_sm_event event); | 82 | |
90 | static void bfa_pport_sm_disabling(struct bfa_pport_s *pport, | 83 | static void bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport, |
91 | enum bfa_pport_sm_event event); | 84 | enum bfa_fcport_sm_event event); |
92 | static void bfa_pport_sm_disabling_qwait(struct bfa_pport_s *pport, | 85 | static void bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport, |
93 | enum bfa_pport_sm_event event); | 86 | enum bfa_fcport_sm_event event); |
94 | static void bfa_pport_sm_disabled(struct bfa_pport_s *pport, | 87 | static void bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport, |
95 | enum bfa_pport_sm_event event); | 88 | enum bfa_fcport_sm_event event); |
96 | static void bfa_pport_sm_stopped(struct bfa_pport_s *pport, | 89 | static void bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport, |
97 | enum bfa_pport_sm_event event); | 90 | enum bfa_fcport_sm_event event); |
98 | static void bfa_pport_sm_iocdown(struct bfa_pport_s *pport, | 91 | static void bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport, |
99 | enum bfa_pport_sm_event event); | 92 | enum bfa_fcport_sm_event event); |
100 | static void bfa_pport_sm_iocfail(struct bfa_pport_s *pport, | 93 | static void bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport, |
101 | enum bfa_pport_sm_event event); | 94 | enum bfa_fcport_sm_event event); |
95 | static void bfa_fcport_sm_disabling_qwait(struct bfa_fcport_s *fcport, | ||
96 | enum bfa_fcport_sm_event event); | ||
97 | static void bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport, | ||
98 | enum bfa_fcport_sm_event event); | ||
99 | static void bfa_fcport_sm_stopped(struct bfa_fcport_s *fcport, | ||
100 | enum bfa_fcport_sm_event event); | ||
101 | static void bfa_fcport_sm_iocdown(struct bfa_fcport_s *fcport, | ||
102 | enum bfa_fcport_sm_event event); | ||
103 | static void bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport, | ||
104 | enum bfa_fcport_sm_event event); | ||
105 | |||
106 | static void bfa_fcport_ln_sm_dn(struct bfa_fcport_ln_s *ln, | ||
107 | enum bfa_fcport_ln_sm_event event); | ||
108 | static void bfa_fcport_ln_sm_dn_nf(struct bfa_fcport_ln_s *ln, | ||
109 | enum bfa_fcport_ln_sm_event event); | ||
110 | static void bfa_fcport_ln_sm_dn_up_nf(struct bfa_fcport_ln_s *ln, | ||
111 | enum bfa_fcport_ln_sm_event event); | ||
112 | static void bfa_fcport_ln_sm_up(struct bfa_fcport_ln_s *ln, | ||
113 | enum bfa_fcport_ln_sm_event event); | ||
114 | static void bfa_fcport_ln_sm_up_nf(struct bfa_fcport_ln_s *ln, | ||
115 | enum bfa_fcport_ln_sm_event event); | ||
116 | static void bfa_fcport_ln_sm_up_dn_nf(struct bfa_fcport_ln_s *ln, | ||
117 | enum bfa_fcport_ln_sm_event event); | ||
118 | static void bfa_fcport_ln_sm_up_dn_up_nf(struct bfa_fcport_ln_s *ln, | ||
119 | enum bfa_fcport_ln_sm_event event); | ||
102 | 120 | ||
103 | static struct bfa_sm_table_s hal_pport_sm_table[] = { | 121 | static struct bfa_sm_table_s hal_pport_sm_table[] = { |
104 | {BFA_SM(bfa_pport_sm_uninit), BFA_PPORT_ST_UNINIT}, | 122 | {BFA_SM(bfa_fcport_sm_uninit), BFA_PPORT_ST_UNINIT}, |
105 | {BFA_SM(bfa_pport_sm_enabling_qwait), BFA_PPORT_ST_ENABLING_QWAIT}, | 123 | {BFA_SM(bfa_fcport_sm_enabling_qwait), BFA_PPORT_ST_ENABLING_QWAIT}, |
106 | {BFA_SM(bfa_pport_sm_enabling), BFA_PPORT_ST_ENABLING}, | 124 | {BFA_SM(bfa_fcport_sm_enabling), BFA_PPORT_ST_ENABLING}, |
107 | {BFA_SM(bfa_pport_sm_linkdown), BFA_PPORT_ST_LINKDOWN}, | 125 | {BFA_SM(bfa_fcport_sm_linkdown), BFA_PPORT_ST_LINKDOWN}, |
108 | {BFA_SM(bfa_pport_sm_linkup), BFA_PPORT_ST_LINKUP}, | 126 | {BFA_SM(bfa_fcport_sm_linkup), BFA_PPORT_ST_LINKUP}, |
109 | {BFA_SM(bfa_pport_sm_disabling_qwait), | 127 | {BFA_SM(bfa_fcport_sm_disabling_qwait), BFA_PPORT_ST_DISABLING_QWAIT}, |
110 | BFA_PPORT_ST_DISABLING_QWAIT}, | 128 | {BFA_SM(bfa_fcport_sm_disabling), BFA_PPORT_ST_DISABLING}, |
111 | {BFA_SM(bfa_pport_sm_disabling), BFA_PPORT_ST_DISABLING}, | 129 | {BFA_SM(bfa_fcport_sm_disabled), BFA_PPORT_ST_DISABLED}, |
112 | {BFA_SM(bfa_pport_sm_disabled), BFA_PPORT_ST_DISABLED}, | 130 | {BFA_SM(bfa_fcport_sm_stopped), BFA_PPORT_ST_STOPPED}, |
113 | {BFA_SM(bfa_pport_sm_stopped), BFA_PPORT_ST_STOPPED}, | 131 | {BFA_SM(bfa_fcport_sm_iocdown), BFA_PPORT_ST_IOCDOWN}, |
114 | {BFA_SM(bfa_pport_sm_iocdown), BFA_PPORT_ST_IOCDOWN}, | 132 | {BFA_SM(bfa_fcport_sm_iocfail), BFA_PPORT_ST_IOCDOWN}, |
115 | {BFA_SM(bfa_pport_sm_iocfail), BFA_PPORT_ST_IOCDOWN}, | ||
116 | }; | 133 | }; |
117 | 134 | ||
118 | static void | 135 | static void |
119 | bfa_pport_aen_post(struct bfa_pport_s *pport, enum bfa_port_aen_event event) | 136 | bfa_fcport_aen_post(struct bfa_fcport_s *fcport, enum bfa_port_aen_event event) |
120 | { | 137 | { |
121 | union bfa_aen_data_u aen_data; | 138 | union bfa_aen_data_u aen_data; |
122 | struct bfa_log_mod_s *logmod = pport->bfa->logm; | 139 | struct bfa_log_mod_s *logmod = fcport->bfa->logm; |
123 | wwn_t pwwn = pport->pwwn; | 140 | wwn_t pwwn = fcport->pwwn; |
124 | char pwwn_ptr[BFA_STRING_32]; | 141 | char pwwn_ptr[BFA_STRING_32]; |
125 | struct bfa_ioc_attr_s ioc_attr; | ||
126 | 142 | ||
143 | memset(&aen_data, 0, sizeof(aen_data)); | ||
127 | wwn2str(pwwn_ptr, pwwn); | 144 | wwn2str(pwwn_ptr, pwwn); |
128 | switch (event) { | 145 | bfa_log(logmod, BFA_LOG_CREATE_ID(BFA_AEN_CAT_PORT, event), pwwn_ptr); |
129 | case BFA_PORT_AEN_ONLINE: | ||
130 | bfa_log(logmod, BFA_AEN_PORT_ONLINE, pwwn_ptr); | ||
131 | break; | ||
132 | case BFA_PORT_AEN_OFFLINE: | ||
133 | bfa_log(logmod, BFA_AEN_PORT_OFFLINE, pwwn_ptr); | ||
134 | break; | ||
135 | case BFA_PORT_AEN_ENABLE: | ||
136 | bfa_log(logmod, BFA_AEN_PORT_ENABLE, pwwn_ptr); | ||
137 | break; | ||
138 | case BFA_PORT_AEN_DISABLE: | ||
139 | bfa_log(logmod, BFA_AEN_PORT_DISABLE, pwwn_ptr); | ||
140 | break; | ||
141 | case BFA_PORT_AEN_DISCONNECT: | ||
142 | bfa_log(logmod, BFA_AEN_PORT_DISCONNECT, pwwn_ptr); | ||
143 | break; | ||
144 | case BFA_PORT_AEN_QOS_NEG: | ||
145 | bfa_log(logmod, BFA_AEN_PORT_QOS_NEG, pwwn_ptr); | ||
146 | break; | ||
147 | default: | ||
148 | break; | ||
149 | } | ||
150 | 146 | ||
151 | bfa_ioc_get_attr(&pport->bfa->ioc, &ioc_attr); | 147 | aen_data.port.ioc_type = bfa_get_type(fcport->bfa); |
152 | aen_data.port.ioc_type = ioc_attr.ioc_type; | ||
153 | aen_data.port.pwwn = pwwn; | 148 | aen_data.port.pwwn = pwwn; |
154 | } | 149 | } |
155 | 150 | ||
156 | static void | 151 | static void |
157 | bfa_pport_sm_uninit(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | 152 | bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport, |
153 | enum bfa_fcport_sm_event event) | ||
158 | { | 154 | { |
159 | bfa_trc(pport->bfa, event); | 155 | bfa_trc(fcport->bfa, event); |
160 | 156 | ||
161 | switch (event) { | 157 | switch (event) { |
162 | case BFA_PPORT_SM_START: | 158 | case BFA_FCPORT_SM_START: |
163 | /** | 159 | /** |
164 | * Start event after IOC is configured and BFA is started. | 160 | * Start event after IOC is configured and BFA is started. |
165 | */ | 161 | */ |
166 | if (bfa_pport_send_enable(pport)) | 162 | if (bfa_fcport_send_enable(fcport)) |
167 | bfa_sm_set_state(pport, bfa_pport_sm_enabling); | 163 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling); |
168 | else | 164 | else |
169 | bfa_sm_set_state(pport, bfa_pport_sm_enabling_qwait); | 165 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling_qwait); |
170 | break; | 166 | break; |
171 | 167 | ||
172 | case BFA_PPORT_SM_ENABLE: | 168 | case BFA_FCPORT_SM_ENABLE: |
173 | /** | 169 | /** |
174 | * Port is persistently configured to be in enabled state. Do | 170 | * Port is persistently configured to be in enabled state. Do |
175 | * not change state. Port enabling is done when START event is | 171 | * not change state. Port enabling is done when START event is |
@@ -177,389 +173,412 @@ bfa_pport_sm_uninit(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | |||
177 | */ | 173 | */ |
178 | break; | 174 | break; |
179 | 175 | ||
180 | case BFA_PPORT_SM_DISABLE: | 176 | case BFA_FCPORT_SM_DISABLE: |
181 | /** | 177 | /** |
182 | * If a port is persistently configured to be disabled, the | 178 | * If a port is persistently configured to be disabled, the |
183 | * first event will a port disable request. | 179 | * first event will a port disable request. |
184 | */ | 180 | */ |
185 | bfa_sm_set_state(pport, bfa_pport_sm_disabled); | 181 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabled); |
186 | break; | 182 | break; |
187 | 183 | ||
188 | case BFA_PPORT_SM_HWFAIL: | 184 | case BFA_FCPORT_SM_HWFAIL: |
189 | bfa_sm_set_state(pport, bfa_pport_sm_iocdown); | 185 | bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown); |
190 | break; | 186 | break; |
191 | 187 | ||
192 | default: | 188 | default: |
193 | bfa_sm_fault(pport->bfa, event); | 189 | bfa_sm_fault(fcport->bfa, event); |
194 | } | 190 | } |
195 | } | 191 | } |
196 | 192 | ||
197 | static void | 193 | static void |
198 | bfa_pport_sm_enabling_qwait(struct bfa_pport_s *pport, | 194 | bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport, |
199 | enum bfa_pport_sm_event event) | 195 | enum bfa_fcport_sm_event event) |
200 | { | 196 | { |
201 | bfa_trc(pport->bfa, event); | 197 | bfa_trc(fcport->bfa, event); |
202 | 198 | ||
203 | switch (event) { | 199 | switch (event) { |
204 | case BFA_PPORT_SM_QRESUME: | 200 | case BFA_FCPORT_SM_QRESUME: |
205 | bfa_sm_set_state(pport, bfa_pport_sm_enabling); | 201 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling); |
206 | bfa_pport_send_enable(pport); | 202 | bfa_fcport_send_enable(fcport); |
207 | break; | 203 | break; |
208 | 204 | ||
209 | case BFA_PPORT_SM_STOP: | 205 | case BFA_FCPORT_SM_STOP: |
210 | bfa_reqq_wcancel(&pport->reqq_wait); | 206 | bfa_reqq_wcancel(&fcport->reqq_wait); |
211 | bfa_sm_set_state(pport, bfa_pport_sm_stopped); | 207 | bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); |
212 | break; | 208 | break; |
213 | 209 | ||
214 | case BFA_PPORT_SM_ENABLE: | 210 | case BFA_FCPORT_SM_ENABLE: |
215 | /** | 211 | /** |
216 | * Already enable is in progress. | 212 | * Already enable is in progress. |
217 | */ | 213 | */ |
218 | break; | 214 | break; |
219 | 215 | ||
220 | case BFA_PPORT_SM_DISABLE: | 216 | case BFA_FCPORT_SM_DISABLE: |
221 | /** | 217 | /** |
222 | * Just send disable request to firmware when room becomes | 218 | * Just send disable request to firmware when room becomes |
223 | * available in request queue. | 219 | * available in request queue. |
224 | */ | 220 | */ |
225 | bfa_sm_set_state(pport, bfa_pport_sm_disabled); | 221 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabled); |
226 | bfa_reqq_wcancel(&pport->reqq_wait); | 222 | bfa_reqq_wcancel(&fcport->reqq_wait); |
227 | bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, | 223 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
228 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); | 224 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); |
229 | bfa_pport_aen_post(pport, BFA_PORT_AEN_DISABLE); | 225 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE); |
230 | break; | 226 | break; |
231 | 227 | ||
232 | case BFA_PPORT_SM_LINKUP: | 228 | case BFA_FCPORT_SM_LINKUP: |
233 | case BFA_PPORT_SM_LINKDOWN: | 229 | case BFA_FCPORT_SM_LINKDOWN: |
234 | /** | 230 | /** |
235 | * Possible to get link events when doing back-to-back | 231 | * Possible to get link events when doing back-to-back |
236 | * enable/disables. | 232 | * enable/disables. |
237 | */ | 233 | */ |
238 | break; | 234 | break; |
239 | 235 | ||
240 | case BFA_PPORT_SM_HWFAIL: | 236 | case BFA_FCPORT_SM_HWFAIL: |
241 | bfa_reqq_wcancel(&pport->reqq_wait); | 237 | bfa_reqq_wcancel(&fcport->reqq_wait); |
242 | bfa_sm_set_state(pport, bfa_pport_sm_iocdown); | 238 | bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown); |
243 | break; | 239 | break; |
244 | 240 | ||
245 | default: | 241 | default: |
246 | bfa_sm_fault(pport->bfa, event); | 242 | bfa_sm_fault(fcport->bfa, event); |
247 | } | 243 | } |
248 | } | 244 | } |
249 | 245 | ||
250 | static void | 246 | static void |
251 | bfa_pport_sm_enabling(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | 247 | bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport, |
248 | enum bfa_fcport_sm_event event) | ||
252 | { | 249 | { |
253 | bfa_trc(pport->bfa, event); | 250 | bfa_trc(fcport->bfa, event); |
254 | 251 | ||
255 | switch (event) { | 252 | switch (event) { |
256 | case BFA_PPORT_SM_FWRSP: | 253 | case BFA_FCPORT_SM_FWRSP: |
257 | case BFA_PPORT_SM_LINKDOWN: | 254 | case BFA_FCPORT_SM_LINKDOWN: |
258 | bfa_sm_set_state(pport, bfa_pport_sm_linkdown); | 255 | bfa_sm_set_state(fcport, bfa_fcport_sm_linkdown); |
259 | break; | 256 | break; |
260 | 257 | ||
261 | case BFA_PPORT_SM_LINKUP: | 258 | case BFA_FCPORT_SM_LINKUP: |
262 | bfa_pport_update_linkinfo(pport); | 259 | bfa_fcport_update_linkinfo(fcport); |
263 | bfa_sm_set_state(pport, bfa_pport_sm_linkup); | 260 | bfa_sm_set_state(fcport, bfa_fcport_sm_linkup); |
264 | 261 | ||
265 | bfa_assert(pport->event_cbfn); | 262 | bfa_assert(fcport->event_cbfn); |
266 | bfa_pport_callback(pport, BFA_PPORT_LINKUP); | 263 | bfa_fcport_callback(fcport, BFA_PPORT_LINKUP); |
267 | break; | 264 | break; |
268 | 265 | ||
269 | case BFA_PPORT_SM_ENABLE: | 266 | case BFA_FCPORT_SM_ENABLE: |
270 | /** | 267 | /** |
271 | * Already being enabled. | 268 | * Already being enabled. |
272 | */ | 269 | */ |
273 | break; | 270 | break; |
274 | 271 | ||
275 | case BFA_PPORT_SM_DISABLE: | 272 | case BFA_FCPORT_SM_DISABLE: |
276 | if (bfa_pport_send_disable(pport)) | 273 | if (bfa_fcport_send_disable(fcport)) |
277 | bfa_sm_set_state(pport, bfa_pport_sm_disabling); | 274 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabling); |
278 | else | 275 | else |
279 | bfa_sm_set_state(pport, bfa_pport_sm_disabling_qwait); | 276 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait); |
280 | 277 | ||
281 | bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, | 278 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
282 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); | 279 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); |
283 | bfa_pport_aen_post(pport, BFA_PORT_AEN_DISABLE); | 280 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE); |
284 | break; | 281 | break; |
285 | 282 | ||
286 | case BFA_PPORT_SM_STOP: | 283 | case BFA_FCPORT_SM_STOP: |
287 | bfa_sm_set_state(pport, bfa_pport_sm_stopped); | 284 | bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); |
288 | break; | 285 | break; |
289 | 286 | ||
290 | case BFA_PPORT_SM_HWFAIL: | 287 | case BFA_FCPORT_SM_HWFAIL: |
291 | bfa_sm_set_state(pport, bfa_pport_sm_iocdown); | 288 | bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown); |
292 | break; | 289 | break; |
293 | 290 | ||
294 | default: | 291 | default: |
295 | bfa_sm_fault(pport->bfa, event); | 292 | bfa_sm_fault(fcport->bfa, event); |
296 | } | 293 | } |
297 | } | 294 | } |
298 | 295 | ||
299 | static void | 296 | static void |
300 | bfa_pport_sm_linkdown(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | 297 | bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport, |
298 | enum bfa_fcport_sm_event event) | ||
301 | { | 299 | { |
302 | bfa_trc(pport->bfa, event); | 300 | struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event; |
301 | bfa_trc(fcport->bfa, event); | ||
303 | 302 | ||
304 | switch (event) { | 303 | switch (event) { |
305 | case BFA_PPORT_SM_LINKUP: | 304 | case BFA_FCPORT_SM_LINKUP: |
306 | bfa_pport_update_linkinfo(pport); | 305 | bfa_fcport_update_linkinfo(fcport); |
307 | bfa_sm_set_state(pport, bfa_pport_sm_linkup); | 306 | bfa_sm_set_state(fcport, bfa_fcport_sm_linkup); |
308 | bfa_assert(pport->event_cbfn); | 307 | bfa_assert(fcport->event_cbfn); |
309 | bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, | 308 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
310 | BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkup"); | 309 | BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkup"); |
311 | bfa_pport_callback(pport, BFA_PPORT_LINKUP); | 310 | |
312 | bfa_pport_aen_post(pport, BFA_PORT_AEN_ONLINE); | 311 | if (!bfa_ioc_get_fcmode(&fcport->bfa->ioc)) { |
312 | |||
313 | bfa_trc(fcport->bfa, pevent->link_state.fcf.fipenabled); | ||
314 | bfa_trc(fcport->bfa, pevent->link_state.fcf.fipfailed); | ||
315 | |||
316 | if (pevent->link_state.fcf.fipfailed) | ||
317 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, | ||
318 | BFA_PL_EID_FIP_FCF_DISC, 0, | ||
319 | "FIP FCF Discovery Failed"); | ||
320 | else | ||
321 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, | ||
322 | BFA_PL_EID_FIP_FCF_DISC, 0, | ||
323 | "FIP FCF Discovered"); | ||
324 | } | ||
325 | |||
326 | bfa_fcport_callback(fcport, BFA_PPORT_LINKUP); | ||
327 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ONLINE); | ||
313 | /** | 328 | /** |
314 | * If QoS is enabled and it is not online, | 329 | * If QoS is enabled and it is not online, |
315 | * Send a separate event. | 330 | * Send a separate event. |
316 | */ | 331 | */ |
317 | if ((pport->cfg.qos_enabled) | 332 | if ((fcport->cfg.qos_enabled) |
318 | && (bfa_os_ntohl(pport->qos_attr.state) != BFA_QOS_ONLINE)) | 333 | && (bfa_os_ntohl(fcport->qos_attr.state) != BFA_QOS_ONLINE)) |
319 | bfa_pport_aen_post(pport, BFA_PORT_AEN_QOS_NEG); | 334 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_QOS_NEG); |
320 | 335 | ||
321 | break; | 336 | break; |
322 | 337 | ||
323 | case BFA_PPORT_SM_LINKDOWN: | 338 | case BFA_FCPORT_SM_LINKDOWN: |
324 | /** | 339 | /** |
325 | * Possible to get link down event. | 340 | * Possible to get link down event. |
326 | */ | 341 | */ |
327 | break; | 342 | break; |
328 | 343 | ||
329 | case BFA_PPORT_SM_ENABLE: | 344 | case BFA_FCPORT_SM_ENABLE: |
330 | /** | 345 | /** |
331 | * Already enabled. | 346 | * Already enabled. |
332 | */ | 347 | */ |
333 | break; | 348 | break; |
334 | 349 | ||
335 | case BFA_PPORT_SM_DISABLE: | 350 | case BFA_FCPORT_SM_DISABLE: |
336 | if (bfa_pport_send_disable(pport)) | 351 | if (bfa_fcport_send_disable(fcport)) |
337 | bfa_sm_set_state(pport, bfa_pport_sm_disabling); | 352 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabling); |
338 | else | 353 | else |
339 | bfa_sm_set_state(pport, bfa_pport_sm_disabling_qwait); | 354 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait); |
340 | 355 | ||
341 | bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, | 356 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
342 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); | 357 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); |
343 | bfa_pport_aen_post(pport, BFA_PORT_AEN_DISABLE); | 358 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE); |
344 | break; | 359 | break; |
345 | 360 | ||
346 | case BFA_PPORT_SM_STOP: | 361 | case BFA_FCPORT_SM_STOP: |
347 | bfa_sm_set_state(pport, bfa_pport_sm_stopped); | 362 | bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); |
348 | break; | 363 | break; |
349 | 364 | ||
350 | case BFA_PPORT_SM_HWFAIL: | 365 | case BFA_FCPORT_SM_HWFAIL: |
351 | bfa_sm_set_state(pport, bfa_pport_sm_iocdown); | 366 | bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown); |
352 | break; | 367 | break; |
353 | 368 | ||
354 | default: | 369 | default: |
355 | bfa_sm_fault(pport->bfa, event); | 370 | bfa_sm_fault(fcport->bfa, event); |
356 | } | 371 | } |
357 | } | 372 | } |
358 | 373 | ||
359 | static void | 374 | static void |
360 | bfa_pport_sm_linkup(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | 375 | bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport, |
376 | enum bfa_fcport_sm_event event) | ||
361 | { | 377 | { |
362 | bfa_trc(pport->bfa, event); | 378 | bfa_trc(fcport->bfa, event); |
363 | 379 | ||
364 | switch (event) { | 380 | switch (event) { |
365 | case BFA_PPORT_SM_ENABLE: | 381 | case BFA_FCPORT_SM_ENABLE: |
366 | /** | 382 | /** |
367 | * Already enabled. | 383 | * Already enabled. |
368 | */ | 384 | */ |
369 | break; | 385 | break; |
370 | 386 | ||
371 | case BFA_PPORT_SM_DISABLE: | 387 | case BFA_FCPORT_SM_DISABLE: |
372 | if (bfa_pport_send_disable(pport)) | 388 | if (bfa_fcport_send_disable(fcport)) |
373 | bfa_sm_set_state(pport, bfa_pport_sm_disabling); | 389 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabling); |
374 | else | 390 | else |
375 | bfa_sm_set_state(pport, bfa_pport_sm_disabling_qwait); | 391 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait); |
376 | 392 | ||
377 | bfa_pport_reset_linkinfo(pport); | 393 | bfa_fcport_reset_linkinfo(fcport); |
378 | bfa_pport_callback(pport, BFA_PPORT_LINKDOWN); | 394 | bfa_fcport_callback(fcport, BFA_PPORT_LINKDOWN); |
379 | bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, | 395 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
380 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); | 396 | BFA_PL_EID_PORT_DISABLE, 0, "Port Disable"); |
381 | bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE); | 397 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE); |
382 | bfa_pport_aen_post(pport, BFA_PORT_AEN_DISABLE); | 398 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE); |
383 | break; | 399 | break; |
384 | 400 | ||
385 | case BFA_PPORT_SM_LINKDOWN: | 401 | case BFA_FCPORT_SM_LINKDOWN: |
386 | bfa_sm_set_state(pport, bfa_pport_sm_linkdown); | 402 | bfa_sm_set_state(fcport, bfa_fcport_sm_linkdown); |
387 | bfa_pport_reset_linkinfo(pport); | 403 | bfa_fcport_reset_linkinfo(fcport); |
388 | bfa_pport_callback(pport, BFA_PPORT_LINKDOWN); | 404 | bfa_fcport_callback(fcport, BFA_PPORT_LINKDOWN); |
389 | bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, | 405 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
390 | BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown"); | 406 | BFA_PL_EID_PORT_ST_CHANGE, 0, "Port Linkdown"); |
391 | if (BFA_PORT_IS_DISABLED(pport->bfa)) | 407 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) |
392 | bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE); | 408 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE); |
393 | else | 409 | else |
394 | bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT); | 410 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT); |
395 | break; | 411 | break; |
396 | 412 | ||
397 | case BFA_PPORT_SM_STOP: | 413 | case BFA_FCPORT_SM_STOP: |
398 | bfa_sm_set_state(pport, bfa_pport_sm_stopped); | 414 | bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); |
399 | bfa_pport_reset_linkinfo(pport); | 415 | bfa_fcport_reset_linkinfo(fcport); |
400 | if (BFA_PORT_IS_DISABLED(pport->bfa)) | 416 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) |
401 | bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE); | 417 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE); |
402 | else | 418 | else |
403 | bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT); | 419 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT); |
404 | break; | 420 | break; |
405 | 421 | ||
406 | case BFA_PPORT_SM_HWFAIL: | 422 | case BFA_FCPORT_SM_HWFAIL: |
407 | bfa_sm_set_state(pport, bfa_pport_sm_iocdown); | 423 | bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown); |
408 | bfa_pport_reset_linkinfo(pport); | 424 | bfa_fcport_reset_linkinfo(fcport); |
409 | bfa_pport_callback(pport, BFA_PPORT_LINKDOWN); | 425 | bfa_fcport_callback(fcport, BFA_PPORT_LINKDOWN); |
410 | if (BFA_PORT_IS_DISABLED(pport->bfa)) | 426 | if (BFA_PORT_IS_DISABLED(fcport->bfa)) |
411 | bfa_pport_aen_post(pport, BFA_PORT_AEN_OFFLINE); | 427 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE); |
412 | else | 428 | else |
413 | bfa_pport_aen_post(pport, BFA_PORT_AEN_DISCONNECT); | 429 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT); |
414 | break; | 430 | break; |
415 | 431 | ||
416 | default: | 432 | default: |
417 | bfa_sm_fault(pport->bfa, event); | 433 | bfa_sm_fault(fcport->bfa, event); |
418 | } | 434 | } |
419 | } | 435 | } |
420 | 436 | ||
421 | static void | 437 | static void |
422 | bfa_pport_sm_disabling_qwait(struct bfa_pport_s *pport, | 438 | bfa_fcport_sm_disabling_qwait(struct bfa_fcport_s *fcport, |
423 | enum bfa_pport_sm_event event) | 439 | enum bfa_fcport_sm_event event) |
424 | { | 440 | { |
425 | bfa_trc(pport->bfa, event); | 441 | bfa_trc(fcport->bfa, event); |
426 | 442 | ||
427 | switch (event) { | 443 | switch (event) { |
428 | case BFA_PPORT_SM_QRESUME: | 444 | case BFA_FCPORT_SM_QRESUME: |
429 | bfa_sm_set_state(pport, bfa_pport_sm_disabling); | 445 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabling); |
430 | bfa_pport_send_disable(pport); | 446 | bfa_fcport_send_disable(fcport); |
431 | break; | 447 | break; |
432 | 448 | ||
433 | case BFA_PPORT_SM_STOP: | 449 | case BFA_FCPORT_SM_STOP: |
434 | bfa_sm_set_state(pport, bfa_pport_sm_stopped); | 450 | bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); |
435 | bfa_reqq_wcancel(&pport->reqq_wait); | 451 | bfa_reqq_wcancel(&fcport->reqq_wait); |
436 | break; | 452 | break; |
437 | 453 | ||
438 | case BFA_PPORT_SM_DISABLE: | 454 | case BFA_FCPORT_SM_DISABLE: |
439 | /** | 455 | /** |
440 | * Already being disabled. | 456 | * Already being disabled. |
441 | */ | 457 | */ |
442 | break; | 458 | break; |
443 | 459 | ||
444 | case BFA_PPORT_SM_LINKUP: | 460 | case BFA_FCPORT_SM_LINKUP: |
445 | case BFA_PPORT_SM_LINKDOWN: | 461 | case BFA_FCPORT_SM_LINKDOWN: |
446 | /** | 462 | /** |
447 | * Possible to get link events when doing back-to-back | 463 | * Possible to get link events when doing back-to-back |
448 | * enable/disables. | 464 | * enable/disables. |
449 | */ | 465 | */ |
450 | break; | 466 | break; |
451 | 467 | ||
452 | case BFA_PPORT_SM_HWFAIL: | 468 | case BFA_FCPORT_SM_HWFAIL: |
453 | bfa_sm_set_state(pport, bfa_pport_sm_iocfail); | 469 | bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail); |
454 | bfa_reqq_wcancel(&pport->reqq_wait); | 470 | bfa_reqq_wcancel(&fcport->reqq_wait); |
455 | break; | 471 | break; |
456 | 472 | ||
457 | default: | 473 | default: |
458 | bfa_sm_fault(pport->bfa, event); | 474 | bfa_sm_fault(fcport->bfa, event); |
459 | } | 475 | } |
460 | } | 476 | } |
461 | 477 | ||
462 | static void | 478 | static void |
463 | bfa_pport_sm_disabling(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | 479 | bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport, |
480 | enum bfa_fcport_sm_event event) | ||
464 | { | 481 | { |
465 | bfa_trc(pport->bfa, event); | 482 | bfa_trc(fcport->bfa, event); |
466 | 483 | ||
467 | switch (event) { | 484 | switch (event) { |
468 | case BFA_PPORT_SM_FWRSP: | 485 | case BFA_FCPORT_SM_FWRSP: |
469 | bfa_sm_set_state(pport, bfa_pport_sm_disabled); | 486 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabled); |
470 | break; | 487 | break; |
471 | 488 | ||
472 | case BFA_PPORT_SM_DISABLE: | 489 | case BFA_FCPORT_SM_DISABLE: |
473 | /** | 490 | /** |
474 | * Already being disabled. | 491 | * Already being disabled. |
475 | */ | 492 | */ |
476 | break; | 493 | break; |
477 | 494 | ||
478 | case BFA_PPORT_SM_ENABLE: | 495 | case BFA_FCPORT_SM_ENABLE: |
479 | if (bfa_pport_send_enable(pport)) | 496 | if (bfa_fcport_send_enable(fcport)) |
480 | bfa_sm_set_state(pport, bfa_pport_sm_enabling); | 497 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling); |
481 | else | 498 | else |
482 | bfa_sm_set_state(pport, bfa_pport_sm_enabling_qwait); | 499 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling_qwait); |
483 | 500 | ||
484 | bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, | 501 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
485 | BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); | 502 | BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); |
486 | bfa_pport_aen_post(pport, BFA_PORT_AEN_ENABLE); | 503 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE); |
487 | break; | 504 | break; |
488 | 505 | ||
489 | case BFA_PPORT_SM_STOP: | 506 | case BFA_FCPORT_SM_STOP: |
490 | bfa_sm_set_state(pport, bfa_pport_sm_stopped); | 507 | bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); |
491 | break; | 508 | break; |
492 | 509 | ||
493 | case BFA_PPORT_SM_LINKUP: | 510 | case BFA_FCPORT_SM_LINKUP: |
494 | case BFA_PPORT_SM_LINKDOWN: | 511 | case BFA_FCPORT_SM_LINKDOWN: |
495 | /** | 512 | /** |
496 | * Possible to get link events when doing back-to-back | 513 | * Possible to get link events when doing back-to-back |
497 | * enable/disables. | 514 | * enable/disables. |
498 | */ | 515 | */ |
499 | break; | 516 | break; |
500 | 517 | ||
501 | case BFA_PPORT_SM_HWFAIL: | 518 | case BFA_FCPORT_SM_HWFAIL: |
502 | bfa_sm_set_state(pport, bfa_pport_sm_iocfail); | 519 | bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail); |
503 | break; | 520 | break; |
504 | 521 | ||
505 | default: | 522 | default: |
506 | bfa_sm_fault(pport->bfa, event); | 523 | bfa_sm_fault(fcport->bfa, event); |
507 | } | 524 | } |
508 | } | 525 | } |
509 | 526 | ||
510 | static void | 527 | static void |
511 | bfa_pport_sm_disabled(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | 528 | bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport, |
529 | enum bfa_fcport_sm_event event) | ||
512 | { | 530 | { |
513 | bfa_trc(pport->bfa, event); | 531 | bfa_trc(fcport->bfa, event); |
514 | 532 | ||
515 | switch (event) { | 533 | switch (event) { |
516 | case BFA_PPORT_SM_START: | 534 | case BFA_FCPORT_SM_START: |
517 | /** | 535 | /** |
518 | * Ignore start event for a port that is disabled. | 536 | * Ignore start event for a port that is disabled. |
519 | */ | 537 | */ |
520 | break; | 538 | break; |
521 | 539 | ||
522 | case BFA_PPORT_SM_STOP: | 540 | case BFA_FCPORT_SM_STOP: |
523 | bfa_sm_set_state(pport, bfa_pport_sm_stopped); | 541 | bfa_sm_set_state(fcport, bfa_fcport_sm_stopped); |
524 | break; | 542 | break; |
525 | 543 | ||
526 | case BFA_PPORT_SM_ENABLE: | 544 | case BFA_FCPORT_SM_ENABLE: |
527 | if (bfa_pport_send_enable(pport)) | 545 | if (bfa_fcport_send_enable(fcport)) |
528 | bfa_sm_set_state(pport, bfa_pport_sm_enabling); | 546 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling); |
529 | else | 547 | else |
530 | bfa_sm_set_state(pport, bfa_pport_sm_enabling_qwait); | 548 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling_qwait); |
531 | 549 | ||
532 | bfa_plog_str(pport->bfa->plog, BFA_PL_MID_HAL, | 550 | bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, |
533 | BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); | 551 | BFA_PL_EID_PORT_ENABLE, 0, "Port Enable"); |
534 | bfa_pport_aen_post(pport, BFA_PORT_AEN_ENABLE); | 552 | bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE); |
535 | break; | 553 | break; |
536 | 554 | ||
537 | case BFA_PPORT_SM_DISABLE: | 555 | case BFA_FCPORT_SM_DISABLE: |
538 | /** | 556 | /** |
539 | * Already disabled. | 557 | * Already disabled. |
540 | */ | 558 | */ |
541 | break; | 559 | break; |
542 | 560 | ||
543 | case BFA_PPORT_SM_HWFAIL: | 561 | case BFA_FCPORT_SM_HWFAIL: |
544 | bfa_sm_set_state(pport, bfa_pport_sm_iocfail); | 562 | bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail); |
545 | break; | 563 | break; |
546 | 564 | ||
547 | default: | 565 | default: |
548 | bfa_sm_fault(pport->bfa, event); | 566 | bfa_sm_fault(fcport->bfa, event); |
549 | } | 567 | } |
550 | } | 568 | } |
551 | 569 | ||
552 | static void | 570 | static void |
553 | bfa_pport_sm_stopped(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | 571 | bfa_fcport_sm_stopped(struct bfa_fcport_s *fcport, |
572 | enum bfa_fcport_sm_event event) | ||
554 | { | 573 | { |
555 | bfa_trc(pport->bfa, event); | 574 | bfa_trc(fcport->bfa, event); |
556 | 575 | ||
557 | switch (event) { | 576 | switch (event) { |
558 | case BFA_PPORT_SM_START: | 577 | case BFA_FCPORT_SM_START: |
559 | if (bfa_pport_send_enable(pport)) | 578 | if (bfa_fcport_send_enable(fcport)) |
560 | bfa_sm_set_state(pport, bfa_pport_sm_enabling); | 579 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling); |
561 | else | 580 | else |
562 | bfa_sm_set_state(pport, bfa_pport_sm_enabling_qwait); | 581 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling_qwait); |
563 | break; | 582 | break; |
564 | 583 | ||
565 | default: | 584 | default: |
@@ -574,16 +593,17 @@ bfa_pport_sm_stopped(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | |||
574 | * Port is enabled. IOC is down/failed. | 593 | * Port is enabled. IOC is down/failed. |
575 | */ | 594 | */ |
576 | static void | 595 | static void |
577 | bfa_pport_sm_iocdown(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | 596 | bfa_fcport_sm_iocdown(struct bfa_fcport_s *fcport, |
597 | enum bfa_fcport_sm_event event) | ||
578 | { | 598 | { |
579 | bfa_trc(pport->bfa, event); | 599 | bfa_trc(fcport->bfa, event); |
580 | 600 | ||
581 | switch (event) { | 601 | switch (event) { |
582 | case BFA_PPORT_SM_START: | 602 | case BFA_FCPORT_SM_START: |
583 | if (bfa_pport_send_enable(pport)) | 603 | if (bfa_fcport_send_enable(fcport)) |
584 | bfa_sm_set_state(pport, bfa_pport_sm_enabling); | 604 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling); |
585 | else | 605 | else |
586 | bfa_sm_set_state(pport, bfa_pport_sm_enabling_qwait); | 606 | bfa_sm_set_state(fcport, bfa_fcport_sm_enabling_qwait); |
587 | break; | 607 | break; |
588 | 608 | ||
589 | default: | 609 | default: |
@@ -598,17 +618,18 @@ bfa_pport_sm_iocdown(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | |||
598 | * Port is disabled. IOC is down/failed. | 618 | * Port is disabled. IOC is down/failed. |
599 | */ | 619 | */ |
600 | static void | 620 | static void |
601 | bfa_pport_sm_iocfail(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | 621 | bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport, |
622 | enum bfa_fcport_sm_event event) | ||
602 | { | 623 | { |
603 | bfa_trc(pport->bfa, event); | 624 | bfa_trc(fcport->bfa, event); |
604 | 625 | ||
605 | switch (event) { | 626 | switch (event) { |
606 | case BFA_PPORT_SM_START: | 627 | case BFA_FCPORT_SM_START: |
607 | bfa_sm_set_state(pport, bfa_pport_sm_disabled); | 628 | bfa_sm_set_state(fcport, bfa_fcport_sm_disabled); |
608 | break; | 629 | break; |
609 | 630 | ||
610 | case BFA_PPORT_SM_ENABLE: | 631 | case BFA_FCPORT_SM_ENABLE: |
611 | bfa_sm_set_state(pport, bfa_pport_sm_iocdown); | 632 | bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown); |
612 | break; | 633 | break; |
613 | 634 | ||
614 | default: | 635 | default: |
@@ -619,41 +640,226 @@ bfa_pport_sm_iocfail(struct bfa_pport_s *pport, enum bfa_pport_sm_event event) | |||
619 | } | 640 | } |
620 | } | 641 | } |
621 | 642 | ||
643 | /** | ||
644 | * Link state is down | ||
645 | */ | ||
646 | static void | ||
647 | bfa_fcport_ln_sm_dn(struct bfa_fcport_ln_s *ln, | ||
648 | enum bfa_fcport_ln_sm_event event) | ||
649 | { | ||
650 | bfa_trc(ln->fcport->bfa, event); | ||
651 | |||
652 | switch (event) { | ||
653 | case BFA_FCPORT_LN_SM_LINKUP: | ||
654 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_up_nf); | ||
655 | bfa_fcport_queue_cb(ln, BFA_PPORT_LINKUP); | ||
656 | break; | ||
657 | |||
658 | default: | ||
659 | bfa_sm_fault(ln->fcport->bfa, event); | ||
660 | } | ||
661 | } | ||
662 | |||
663 | /** | ||
664 | * Link state is waiting for down notification | ||
665 | */ | ||
666 | static void | ||
667 | bfa_fcport_ln_sm_dn_nf(struct bfa_fcport_ln_s *ln, | ||
668 | enum bfa_fcport_ln_sm_event event) | ||
669 | { | ||
670 | bfa_trc(ln->fcport->bfa, event); | ||
671 | |||
672 | switch (event) { | ||
673 | case BFA_FCPORT_LN_SM_LINKUP: | ||
674 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn_up_nf); | ||
675 | break; | ||
676 | |||
677 | case BFA_FCPORT_LN_SM_NOTIFICATION: | ||
678 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn); | ||
679 | break; | ||
680 | |||
681 | default: | ||
682 | bfa_sm_fault(ln->fcport->bfa, event); | ||
683 | } | ||
684 | } | ||
685 | |||
686 | /** | ||
687 | * Link state is waiting for down notification and there is a pending up | ||
688 | */ | ||
689 | static void | ||
690 | bfa_fcport_ln_sm_dn_up_nf(struct bfa_fcport_ln_s *ln, | ||
691 | enum bfa_fcport_ln_sm_event event) | ||
692 | { | ||
693 | bfa_trc(ln->fcport->bfa, event); | ||
694 | |||
695 | switch (event) { | ||
696 | case BFA_FCPORT_LN_SM_LINKDOWN: | ||
697 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn_nf); | ||
698 | break; | ||
699 | |||
700 | case BFA_FCPORT_LN_SM_NOTIFICATION: | ||
701 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_up_nf); | ||
702 | bfa_fcport_queue_cb(ln, BFA_PPORT_LINKUP); | ||
703 | break; | ||
704 | |||
705 | default: | ||
706 | bfa_sm_fault(ln->fcport->bfa, event); | ||
707 | } | ||
708 | } | ||
709 | |||
710 | /** | ||
711 | * Link state is up | ||
712 | */ | ||
713 | static void | ||
714 | bfa_fcport_ln_sm_up(struct bfa_fcport_ln_s *ln, | ||
715 | enum bfa_fcport_ln_sm_event event) | ||
716 | { | ||
717 | bfa_trc(ln->fcport->bfa, event); | ||
718 | |||
719 | switch (event) { | ||
720 | case BFA_FCPORT_LN_SM_LINKDOWN: | ||
721 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn_nf); | ||
722 | bfa_fcport_queue_cb(ln, BFA_PPORT_LINKDOWN); | ||
723 | break; | ||
622 | 724 | ||
725 | default: | ||
726 | bfa_sm_fault(ln->fcport->bfa, event); | ||
727 | } | ||
728 | } | ||
729 | |||
730 | /** | ||
731 | * Link state is waiting for up notification | ||
732 | */ | ||
733 | static void | ||
734 | bfa_fcport_ln_sm_up_nf(struct bfa_fcport_ln_s *ln, | ||
735 | enum bfa_fcport_ln_sm_event event) | ||
736 | { | ||
737 | bfa_trc(ln->fcport->bfa, event); | ||
738 | |||
739 | switch (event) { | ||
740 | case BFA_FCPORT_LN_SM_LINKDOWN: | ||
741 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_up_dn_nf); | ||
742 | break; | ||
743 | |||
744 | case BFA_FCPORT_LN_SM_NOTIFICATION: | ||
745 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_up); | ||
746 | break; | ||
747 | |||
748 | default: | ||
749 | bfa_sm_fault(ln->fcport->bfa, event); | ||
750 | } | ||
751 | } | ||
752 | |||
753 | /** | ||
754 | * Link state is waiting for up notification and there is a pending down | ||
755 | */ | ||
756 | static void | ||
757 | bfa_fcport_ln_sm_up_dn_nf(struct bfa_fcport_ln_s *ln, | ||
758 | enum bfa_fcport_ln_sm_event event) | ||
759 | { | ||
760 | bfa_trc(ln->fcport->bfa, event); | ||
761 | |||
762 | switch (event) { | ||
763 | case BFA_FCPORT_LN_SM_LINKUP: | ||
764 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_up_dn_up_nf); | ||
765 | break; | ||
766 | |||
767 | case BFA_FCPORT_LN_SM_NOTIFICATION: | ||
768 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn_nf); | ||
769 | bfa_fcport_queue_cb(ln, BFA_PPORT_LINKDOWN); | ||
770 | break; | ||
771 | |||
772 | default: | ||
773 | bfa_sm_fault(ln->fcport->bfa, event); | ||
774 | } | ||
775 | } | ||
776 | |||
777 | /** | ||
778 | * Link state is waiting for up notification and there are pending down and up | ||
779 | */ | ||
780 | static void | ||
781 | bfa_fcport_ln_sm_up_dn_up_nf(struct bfa_fcport_ln_s *ln, | ||
782 | enum bfa_fcport_ln_sm_event event) | ||
783 | { | ||
784 | bfa_trc(ln->fcport->bfa, event); | ||
785 | |||
786 | switch (event) { | ||
787 | case BFA_FCPORT_LN_SM_LINKDOWN: | ||
788 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_up_dn_nf); | ||
789 | break; | ||
790 | |||
791 | case BFA_FCPORT_LN_SM_NOTIFICATION: | ||
792 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn_up_nf); | ||
793 | bfa_fcport_queue_cb(ln, BFA_PPORT_LINKDOWN); | ||
794 | break; | ||
795 | |||
796 | default: | ||
797 | bfa_sm_fault(ln->fcport->bfa, event); | ||
798 | } | ||
799 | } | ||
623 | 800 | ||
624 | /** | 801 | /** |
625 | * bfa_pport_private | 802 | * bfa_pport_private |
626 | */ | 803 | */ |
627 | 804 | ||
628 | static void | 805 | static void |
629 | __bfa_cb_port_event(void *cbarg, bfa_boolean_t complete) | 806 | __bfa_cb_fcport_event(void *cbarg, bfa_boolean_t complete) |
630 | { | 807 | { |
631 | struct bfa_pport_s *pport = cbarg; | 808 | struct bfa_fcport_ln_s *ln = cbarg; |
632 | 809 | ||
633 | if (complete) | 810 | if (complete) |
634 | pport->event_cbfn(pport->event_cbarg, pport->hcb_event); | 811 | ln->fcport->event_cbfn(ln->fcport->event_cbarg, ln->ln_event); |
812 | else | ||
813 | bfa_sm_send_event(ln, BFA_FCPORT_LN_SM_NOTIFICATION); | ||
635 | } | 814 | } |
636 | 815 | ||
637 | #define PPORT_STATS_DMA_SZ (BFA_ROUNDUP(sizeof(union bfa_pport_stats_u), \ | 816 | static void |
817 | bfa_fcport_callback(struct bfa_fcport_s *fcport, enum bfa_pport_linkstate event) | ||
818 | { | ||
819 | if (fcport->bfa->fcs) { | ||
820 | fcport->event_cbfn(fcport->event_cbarg, event); | ||
821 | return; | ||
822 | } | ||
823 | |||
824 | switch (event) { | ||
825 | case BFA_PPORT_LINKUP: | ||
826 | bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKUP); | ||
827 | break; | ||
828 | case BFA_PPORT_LINKDOWN: | ||
829 | bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKDOWN); | ||
830 | break; | ||
831 | default: | ||
832 | bfa_assert(0); | ||
833 | } | ||
834 | } | ||
835 | |||
836 | static void | ||
837 | bfa_fcport_queue_cb(struct bfa_fcport_ln_s *ln, enum bfa_pport_linkstate event) | ||
838 | { | ||
839 | ln->ln_event = event; | ||
840 | bfa_cb_queue(ln->fcport->bfa, &ln->ln_qe, __bfa_cb_fcport_event, ln); | ||
841 | } | ||
842 | |||
843 | #define FCPORT_STATS_DMA_SZ (BFA_ROUNDUP(sizeof(union bfa_fcport_stats_u), \ | ||
638 | BFA_CACHELINE_SZ)) | 844 | BFA_CACHELINE_SZ)) |
639 | 845 | ||
640 | static void | 846 | static void |
641 | bfa_pport_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len, | 847 | bfa_fcport_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len, |
642 | u32 *dm_len) | 848 | u32 *dm_len) |
643 | { | 849 | { |
644 | *dm_len += PPORT_STATS_DMA_SZ; | 850 | *dm_len += FCPORT_STATS_DMA_SZ; |
645 | } | 851 | } |
646 | 852 | ||
647 | static void | 853 | static void |
648 | bfa_pport_qresume(void *cbarg) | 854 | bfa_fcport_qresume(void *cbarg) |
649 | { | 855 | { |
650 | struct bfa_pport_s *port = cbarg; | 856 | struct bfa_fcport_s *fcport = cbarg; |
651 | 857 | ||
652 | bfa_sm_send_event(port, BFA_PPORT_SM_QRESUME); | 858 | bfa_sm_send_event(fcport, BFA_FCPORT_SM_QRESUME); |
653 | } | 859 | } |
654 | 860 | ||
655 | static void | 861 | static void |
656 | bfa_pport_mem_claim(struct bfa_pport_s *pport, struct bfa_meminfo_s *meminfo) | 862 | bfa_fcport_mem_claim(struct bfa_fcport_s *fcport, struct bfa_meminfo_s *meminfo) |
657 | { | 863 | { |
658 | u8 *dm_kva; | 864 | u8 *dm_kva; |
659 | u64 dm_pa; | 865 | u64 dm_pa; |
@@ -661,12 +867,12 @@ bfa_pport_mem_claim(struct bfa_pport_s *pport, struct bfa_meminfo_s *meminfo) | |||
661 | dm_kva = bfa_meminfo_dma_virt(meminfo); | 867 | dm_kva = bfa_meminfo_dma_virt(meminfo); |
662 | dm_pa = bfa_meminfo_dma_phys(meminfo); | 868 | dm_pa = bfa_meminfo_dma_phys(meminfo); |
663 | 869 | ||
664 | pport->stats_kva = dm_kva; | 870 | fcport->stats_kva = dm_kva; |
665 | pport->stats_pa = dm_pa; | 871 | fcport->stats_pa = dm_pa; |
666 | pport->stats = (union bfa_pport_stats_u *)dm_kva; | 872 | fcport->stats = (union bfa_fcport_stats_u *)dm_kva; |
667 | 873 | ||
668 | dm_kva += PPORT_STATS_DMA_SZ; | 874 | dm_kva += FCPORT_STATS_DMA_SZ; |
669 | dm_pa += PPORT_STATS_DMA_SZ; | 875 | dm_pa += FCPORT_STATS_DMA_SZ; |
670 | 876 | ||
671 | bfa_meminfo_dma_virt(meminfo) = dm_kva; | 877 | bfa_meminfo_dma_virt(meminfo) = dm_kva; |
672 | bfa_meminfo_dma_phys(meminfo) = dm_pa; | 878 | bfa_meminfo_dma_phys(meminfo) = dm_pa; |
@@ -676,18 +882,21 @@ bfa_pport_mem_claim(struct bfa_pport_s *pport, struct bfa_meminfo_s *meminfo) | |||
676 | * Memory initialization. | 882 | * Memory initialization. |
677 | */ | 883 | */ |
678 | static void | 884 | static void |
679 | bfa_pport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | 885 | bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, |
680 | struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev) | 886 | struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev) |
681 | { | 887 | { |
682 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 888 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
683 | struct bfa_pport_cfg_s *port_cfg = &pport->cfg; | 889 | struct bfa_pport_cfg_s *port_cfg = &fcport->cfg; |
890 | struct bfa_fcport_ln_s *ln = &fcport->ln; | ||
684 | 891 | ||
685 | bfa_os_memset(pport, 0, sizeof(struct bfa_pport_s)); | 892 | bfa_os_memset(fcport, 0, sizeof(struct bfa_fcport_s)); |
686 | pport->bfa = bfa; | 893 | fcport->bfa = bfa; |
894 | ln->fcport = fcport; | ||
687 | 895 | ||
688 | bfa_pport_mem_claim(pport, meminfo); | 896 | bfa_fcport_mem_claim(fcport, meminfo); |
689 | 897 | ||
690 | bfa_sm_set_state(pport, bfa_pport_sm_uninit); | 898 | bfa_sm_set_state(fcport, bfa_fcport_sm_uninit); |
899 | bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn); | ||
691 | 900 | ||
692 | /** | 901 | /** |
693 | * initialize and set default configuration | 902 | * initialize and set default configuration |
@@ -699,30 +908,30 @@ bfa_pport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
699 | 908 | ||
700 | port_cfg->trl_def_speed = BFA_PPORT_SPEED_1GBPS; | 909 | port_cfg->trl_def_speed = BFA_PPORT_SPEED_1GBPS; |
701 | 910 | ||
702 | bfa_reqq_winit(&pport->reqq_wait, bfa_pport_qresume, pport); | 911 | bfa_reqq_winit(&fcport->reqq_wait, bfa_fcport_qresume, fcport); |
703 | } | 912 | } |
704 | 913 | ||
705 | static void | 914 | static void |
706 | bfa_pport_initdone(struct bfa_s *bfa) | 915 | bfa_fcport_initdone(struct bfa_s *bfa) |
707 | { | 916 | { |
708 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 917 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
709 | 918 | ||
710 | /** | 919 | /** |
711 | * Initialize port attributes from IOC hardware data. | 920 | * Initialize port attributes from IOC hardware data. |
712 | */ | 921 | */ |
713 | bfa_pport_set_wwns(pport); | 922 | bfa_fcport_set_wwns(fcport); |
714 | if (pport->cfg.maxfrsize == 0) | 923 | if (fcport->cfg.maxfrsize == 0) |
715 | pport->cfg.maxfrsize = bfa_ioc_maxfrsize(&bfa->ioc); | 924 | fcport->cfg.maxfrsize = bfa_ioc_maxfrsize(&bfa->ioc); |
716 | pport->cfg.rx_bbcredit = bfa_ioc_rx_bbcredit(&bfa->ioc); | 925 | fcport->cfg.rx_bbcredit = bfa_ioc_rx_bbcredit(&bfa->ioc); |
717 | pport->speed_sup = bfa_ioc_speed_sup(&bfa->ioc); | 926 | fcport->speed_sup = bfa_ioc_speed_sup(&bfa->ioc); |
718 | 927 | ||
719 | bfa_assert(pport->cfg.maxfrsize); | 928 | bfa_assert(fcport->cfg.maxfrsize); |
720 | bfa_assert(pport->cfg.rx_bbcredit); | 929 | bfa_assert(fcport->cfg.rx_bbcredit); |
721 | bfa_assert(pport->speed_sup); | 930 | bfa_assert(fcport->speed_sup); |
722 | } | 931 | } |
723 | 932 | ||
724 | static void | 933 | static void |
725 | bfa_pport_detach(struct bfa_s *bfa) | 934 | bfa_fcport_detach(struct bfa_s *bfa) |
726 | { | 935 | { |
727 | } | 936 | } |
728 | 937 | ||
@@ -730,95 +939,97 @@ bfa_pport_detach(struct bfa_s *bfa) | |||
730 | * Called when IOC is ready. | 939 | * Called when IOC is ready. |
731 | */ | 940 | */ |
732 | static void | 941 | static void |
733 | bfa_pport_start(struct bfa_s *bfa) | 942 | bfa_fcport_start(struct bfa_s *bfa) |
734 | { | 943 | { |
735 | bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_START); | 944 | bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_START); |
736 | } | 945 | } |
737 | 946 | ||
738 | /** | 947 | /** |
739 | * Called before IOC is stopped. | 948 | * Called before IOC is stopped. |
740 | */ | 949 | */ |
741 | static void | 950 | static void |
742 | bfa_pport_stop(struct bfa_s *bfa) | 951 | bfa_fcport_stop(struct bfa_s *bfa) |
743 | { | 952 | { |
744 | bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_STOP); | 953 | bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_STOP); |
745 | } | 954 | } |
746 | 955 | ||
747 | /** | 956 | /** |
748 | * Called when IOC failure is detected. | 957 | * Called when IOC failure is detected. |
749 | */ | 958 | */ |
750 | static void | 959 | static void |
751 | bfa_pport_iocdisable(struct bfa_s *bfa) | 960 | bfa_fcport_iocdisable(struct bfa_s *bfa) |
752 | { | 961 | { |
753 | bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_HWFAIL); | 962 | bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_HWFAIL); |
754 | } | 963 | } |
755 | 964 | ||
756 | static void | 965 | static void |
757 | bfa_pport_update_linkinfo(struct bfa_pport_s *pport) | 966 | bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport) |
758 | { | 967 | { |
759 | struct bfi_pport_event_s *pevent = pport->event_arg.i2hmsg.event; | 968 | struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event; |
760 | 969 | ||
761 | pport->speed = pevent->link_state.speed; | 970 | fcport->speed = pevent->link_state.speed; |
762 | pport->topology = pevent->link_state.topology; | 971 | fcport->topology = pevent->link_state.topology; |
763 | 972 | ||
764 | if (pport->topology == BFA_PPORT_TOPOLOGY_LOOP) | 973 | if (fcport->topology == BFA_PPORT_TOPOLOGY_LOOP) |
765 | pport->myalpa = pevent->link_state.tl.loop_info.myalpa; | 974 | fcport->myalpa = |
975 | pevent->link_state.tl.loop_info.myalpa; | ||
766 | 976 | ||
767 | /* | 977 | /* |
768 | * QoS Details | 978 | * QoS Details |
769 | */ | 979 | */ |
770 | bfa_os_assign(pport->qos_attr, pevent->link_state.qos_attr); | 980 | bfa_os_assign(fcport->qos_attr, pevent->link_state.qos_attr); |
771 | bfa_os_assign(pport->qos_vc_attr, pevent->link_state.qos_vc_attr); | 981 | bfa_os_assign(fcport->qos_vc_attr, pevent->link_state.qos_vc_attr); |
772 | 982 | ||
773 | bfa_trc(pport->bfa, pport->speed); | 983 | bfa_trc(fcport->bfa, fcport->speed); |
774 | bfa_trc(pport->bfa, pport->topology); | 984 | bfa_trc(fcport->bfa, fcport->topology); |
775 | } | 985 | } |
776 | 986 | ||
777 | static void | 987 | static void |
778 | bfa_pport_reset_linkinfo(struct bfa_pport_s *pport) | 988 | bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport) |
779 | { | 989 | { |
780 | pport->speed = BFA_PPORT_SPEED_UNKNOWN; | 990 | fcport->speed = BFA_PPORT_SPEED_UNKNOWN; |
781 | pport->topology = BFA_PPORT_TOPOLOGY_NONE; | 991 | fcport->topology = BFA_PPORT_TOPOLOGY_NONE; |
782 | } | 992 | } |
783 | 993 | ||
784 | /** | 994 | /** |
785 | * Send port enable message to firmware. | 995 | * Send port enable message to firmware. |
786 | */ | 996 | */ |
787 | static bfa_boolean_t | 997 | static bfa_boolean_t |
788 | bfa_pport_send_enable(struct bfa_pport_s *port) | 998 | bfa_fcport_send_enable(struct bfa_fcport_s *fcport) |
789 | { | 999 | { |
790 | struct bfi_pport_enable_req_s *m; | 1000 | struct bfi_fcport_enable_req_s *m; |
791 | 1001 | ||
792 | /** | 1002 | /** |
793 | * Increment message tag before queue check, so that responses to old | 1003 | * Increment message tag before queue check, so that responses to old |
794 | * requests are discarded. | 1004 | * requests are discarded. |
795 | */ | 1005 | */ |
796 | port->msgtag++; | 1006 | fcport->msgtag++; |
797 | 1007 | ||
798 | /** | 1008 | /** |
799 | * check for room in queue to send request now | 1009 | * check for room in queue to send request now |
800 | */ | 1010 | */ |
801 | m = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); | 1011 | m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); |
802 | if (!m) { | 1012 | if (!m) { |
803 | bfa_reqq_wait(port->bfa, BFA_REQQ_PORT, &port->reqq_wait); | 1013 | bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT, |
1014 | &fcport->reqq_wait); | ||
804 | return BFA_FALSE; | 1015 | return BFA_FALSE; |
805 | } | 1016 | } |
806 | 1017 | ||
807 | bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_ENABLE_REQ, | 1018 | bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_ENABLE_REQ, |
808 | bfa_lpuid(port->bfa)); | 1019 | bfa_lpuid(fcport->bfa)); |
809 | m->nwwn = port->nwwn; | 1020 | m->nwwn = fcport->nwwn; |
810 | m->pwwn = port->pwwn; | 1021 | m->pwwn = fcport->pwwn; |
811 | m->port_cfg = port->cfg; | 1022 | m->port_cfg = fcport->cfg; |
812 | m->msgtag = port->msgtag; | 1023 | m->msgtag = fcport->msgtag; |
813 | m->port_cfg.maxfrsize = bfa_os_htons(port->cfg.maxfrsize); | 1024 | m->port_cfg.maxfrsize = bfa_os_htons(fcport->cfg.maxfrsize); |
814 | bfa_dma_be_addr_set(m->stats_dma_addr, port->stats_pa); | 1025 | bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa); |
815 | bfa_trc(port->bfa, m->stats_dma_addr.a32.addr_lo); | 1026 | bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo); |
816 | bfa_trc(port->bfa, m->stats_dma_addr.a32.addr_hi); | 1027 | bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi); |
817 | 1028 | ||
818 | /** | 1029 | /** |
819 | * queue I/O message to firmware | 1030 | * queue I/O message to firmware |
820 | */ | 1031 | */ |
821 | bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); | 1032 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); |
822 | return BFA_TRUE; | 1033 | return BFA_TRUE; |
823 | } | 1034 | } |
824 | 1035 | ||
@@ -826,74 +1037,226 @@ bfa_pport_send_enable(struct bfa_pport_s *port) | |||
826 | * Send port disable message to firmware. | 1037 | * Send port disable message to firmware. |
827 | */ | 1038 | */ |
828 | static bfa_boolean_t | 1039 | static bfa_boolean_t |
829 | bfa_pport_send_disable(struct bfa_pport_s *port) | 1040 | bfa_fcport_send_disable(struct bfa_fcport_s *fcport) |
830 | { | 1041 | { |
831 | bfi_pport_disable_req_t *m; | 1042 | struct bfi_fcport_req_s *m; |
832 | 1043 | ||
833 | /** | 1044 | /** |
834 | * Increment message tag before queue check, so that responses to old | 1045 | * Increment message tag before queue check, so that responses to old |
835 | * requests are discarded. | 1046 | * requests are discarded. |
836 | */ | 1047 | */ |
837 | port->msgtag++; | 1048 | fcport->msgtag++; |
838 | 1049 | ||
839 | /** | 1050 | /** |
840 | * check for room in queue to send request now | 1051 | * check for room in queue to send request now |
841 | */ | 1052 | */ |
842 | m = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); | 1053 | m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); |
843 | if (!m) { | 1054 | if (!m) { |
844 | bfa_reqq_wait(port->bfa, BFA_REQQ_PORT, &port->reqq_wait); | 1055 | bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT, |
1056 | &fcport->reqq_wait); | ||
845 | return BFA_FALSE; | 1057 | return BFA_FALSE; |
846 | } | 1058 | } |
847 | 1059 | ||
848 | bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_DISABLE_REQ, | 1060 | bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_DISABLE_REQ, |
849 | bfa_lpuid(port->bfa)); | 1061 | bfa_lpuid(fcport->bfa)); |
850 | m->msgtag = port->msgtag; | 1062 | m->msgtag = fcport->msgtag; |
851 | 1063 | ||
852 | /** | 1064 | /** |
853 | * queue I/O message to firmware | 1065 | * queue I/O message to firmware |
854 | */ | 1066 | */ |
855 | bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); | 1067 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); |
856 | 1068 | ||
857 | return BFA_TRUE; | 1069 | return BFA_TRUE; |
858 | } | 1070 | } |
859 | 1071 | ||
860 | static void | 1072 | static void |
861 | bfa_pport_set_wwns(struct bfa_pport_s *port) | 1073 | bfa_fcport_set_wwns(struct bfa_fcport_s *fcport) |
862 | { | 1074 | { |
863 | port->pwwn = bfa_ioc_get_pwwn(&port->bfa->ioc); | 1075 | fcport->pwwn = bfa_ioc_get_pwwn(&fcport->bfa->ioc); |
864 | port->nwwn = bfa_ioc_get_nwwn(&port->bfa->ioc); | 1076 | fcport->nwwn = bfa_ioc_get_nwwn(&fcport->bfa->ioc); |
865 | 1077 | ||
866 | bfa_trc(port->bfa, port->pwwn); | 1078 | bfa_trc(fcport->bfa, fcport->pwwn); |
867 | bfa_trc(port->bfa, port->nwwn); | 1079 | bfa_trc(fcport->bfa, fcport->nwwn); |
868 | } | 1080 | } |
869 | 1081 | ||
870 | static void | 1082 | static void |
871 | bfa_port_send_txcredit(void *port_cbarg) | 1083 | bfa_fcport_send_txcredit(void *port_cbarg) |
872 | { | 1084 | { |
873 | 1085 | ||
874 | struct bfa_pport_s *port = port_cbarg; | 1086 | struct bfa_fcport_s *fcport = port_cbarg; |
875 | struct bfi_pport_set_svc_params_req_s *m; | 1087 | struct bfi_fcport_set_svc_params_req_s *m; |
876 | 1088 | ||
877 | /** | 1089 | /** |
878 | * check for room in queue to send request now | 1090 | * check for room in queue to send request now |
879 | */ | 1091 | */ |
880 | m = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); | 1092 | m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); |
881 | if (!m) { | 1093 | if (!m) { |
882 | bfa_trc(port->bfa, port->cfg.tx_bbcredit); | 1094 | bfa_trc(fcport->bfa, fcport->cfg.tx_bbcredit); |
883 | return; | 1095 | return; |
884 | } | 1096 | } |
885 | 1097 | ||
886 | bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_SET_SVC_PARAMS_REQ, | 1098 | bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ, |
887 | bfa_lpuid(port->bfa)); | 1099 | bfa_lpuid(fcport->bfa)); |
888 | m->tx_bbcredit = bfa_os_htons((u16) port->cfg.tx_bbcredit); | 1100 | m->tx_bbcredit = bfa_os_htons((u16) fcport->cfg.tx_bbcredit); |
889 | 1101 | ||
890 | /** | 1102 | /** |
891 | * queue I/O message to firmware | 1103 | * queue I/O message to firmware |
892 | */ | 1104 | */ |
893 | bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); | 1105 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); |
894 | } | 1106 | } |
895 | 1107 | ||
1108 | static void | ||
1109 | bfa_fcport_qos_stats_swap(struct bfa_qos_stats_s *d, | ||
1110 | struct bfa_qos_stats_s *s) | ||
1111 | { | ||
1112 | u32 *dip = (u32 *) d; | ||
1113 | u32 *sip = (u32 *) s; | ||
1114 | int i; | ||
1115 | |||
1116 | /* Now swap the 32 bit fields */ | ||
1117 | for (i = 0; i < (sizeof(struct bfa_qos_stats_s)/sizeof(u32)); ++i) | ||
1118 | dip[i] = bfa_os_ntohl(sip[i]); | ||
1119 | } | ||
896 | 1120 | ||
1121 | static void | ||
1122 | bfa_fcport_fcoe_stats_swap(struct bfa_fcoe_stats_s *d, | ||
1123 | struct bfa_fcoe_stats_s *s) | ||
1124 | { | ||
1125 | u32 *dip = (u32 *) d; | ||
1126 | u32 *sip = (u32 *) s; | ||
1127 | int i; | ||
1128 | |||
1129 | for (i = 0; i < ((sizeof(struct bfa_fcoe_stats_s))/sizeof(u32)); | ||
1130 | i = i + 2) { | ||
1131 | #ifdef __BIGENDIAN | ||
1132 | dip[i] = bfa_os_ntohl(sip[i]); | ||
1133 | dip[i + 1] = bfa_os_ntohl(sip[i + 1]); | ||
1134 | #else | ||
1135 | dip[i] = bfa_os_ntohl(sip[i + 1]); | ||
1136 | dip[i + 1] = bfa_os_ntohl(sip[i]); | ||
1137 | #endif | ||
1138 | } | ||
1139 | } | ||
1140 | |||
1141 | static void | ||
1142 | __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete) | ||
1143 | { | ||
1144 | struct bfa_fcport_s *fcport = cbarg; | ||
1145 | |||
1146 | if (complete) { | ||
1147 | if (fcport->stats_status == BFA_STATUS_OK) { | ||
1148 | |||
1149 | /* Swap FC QoS or FCoE stats */ | ||
1150 | if (bfa_ioc_get_fcmode(&fcport->bfa->ioc)) | ||
1151 | bfa_fcport_qos_stats_swap( | ||
1152 | &fcport->stats_ret->fcqos, | ||
1153 | &fcport->stats->fcqos); | ||
1154 | else | ||
1155 | bfa_fcport_fcoe_stats_swap( | ||
1156 | &fcport->stats_ret->fcoe, | ||
1157 | &fcport->stats->fcoe); | ||
1158 | } | ||
1159 | fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status); | ||
1160 | } else { | ||
1161 | fcport->stats_busy = BFA_FALSE; | ||
1162 | fcport->stats_status = BFA_STATUS_OK; | ||
1163 | } | ||
1164 | } | ||
1165 | |||
1166 | static void | ||
1167 | bfa_fcport_stats_get_timeout(void *cbarg) | ||
1168 | { | ||
1169 | struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg; | ||
1170 | |||
1171 | bfa_trc(fcport->bfa, fcport->stats_qfull); | ||
1172 | |||
1173 | if (fcport->stats_qfull) { | ||
1174 | bfa_reqq_wcancel(&fcport->stats_reqq_wait); | ||
1175 | fcport->stats_qfull = BFA_FALSE; | ||
1176 | } | ||
1177 | |||
1178 | fcport->stats_status = BFA_STATUS_ETIMER; | ||
1179 | bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, __bfa_cb_fcport_stats_get, | ||
1180 | fcport); | ||
1181 | } | ||
1182 | |||
1183 | static void | ||
1184 | bfa_fcport_send_stats_get(void *cbarg) | ||
1185 | { | ||
1186 | struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg; | ||
1187 | struct bfi_fcport_req_s *msg; | ||
1188 | |||
1189 | msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); | ||
1190 | |||
1191 | if (!msg) { | ||
1192 | fcport->stats_qfull = BFA_TRUE; | ||
1193 | bfa_reqq_winit(&fcport->stats_reqq_wait, | ||
1194 | bfa_fcport_send_stats_get, fcport); | ||
1195 | bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT, | ||
1196 | &fcport->stats_reqq_wait); | ||
1197 | return; | ||
1198 | } | ||
1199 | fcport->stats_qfull = BFA_FALSE; | ||
1200 | |||
1201 | bfa_os_memset(msg, 0, sizeof(struct bfi_fcport_req_s)); | ||
1202 | bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_GET_REQ, | ||
1203 | bfa_lpuid(fcport->bfa)); | ||
1204 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); | ||
1205 | } | ||
1206 | |||
1207 | static void | ||
1208 | __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete) | ||
1209 | { | ||
1210 | struct bfa_fcport_s *fcport = cbarg; | ||
1211 | |||
1212 | if (complete) { | ||
1213 | fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status); | ||
1214 | } else { | ||
1215 | fcport->stats_busy = BFA_FALSE; | ||
1216 | fcport->stats_status = BFA_STATUS_OK; | ||
1217 | } | ||
1218 | } | ||
1219 | |||
1220 | static void | ||
1221 | bfa_fcport_stats_clr_timeout(void *cbarg) | ||
1222 | { | ||
1223 | struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg; | ||
1224 | |||
1225 | bfa_trc(fcport->bfa, fcport->stats_qfull); | ||
1226 | |||
1227 | if (fcport->stats_qfull) { | ||
1228 | bfa_reqq_wcancel(&fcport->stats_reqq_wait); | ||
1229 | fcport->stats_qfull = BFA_FALSE; | ||
1230 | } | ||
1231 | |||
1232 | fcport->stats_status = BFA_STATUS_ETIMER; | ||
1233 | bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, | ||
1234 | __bfa_cb_fcport_stats_clr, fcport); | ||
1235 | } | ||
1236 | |||
1237 | static void | ||
1238 | bfa_fcport_send_stats_clear(void *cbarg) | ||
1239 | { | ||
1240 | struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg; | ||
1241 | struct bfi_fcport_req_s *msg; | ||
1242 | |||
1243 | msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); | ||
1244 | |||
1245 | if (!msg) { | ||
1246 | fcport->stats_qfull = BFA_TRUE; | ||
1247 | bfa_reqq_winit(&fcport->stats_reqq_wait, | ||
1248 | bfa_fcport_send_stats_clear, fcport); | ||
1249 | bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT, | ||
1250 | &fcport->stats_reqq_wait); | ||
1251 | return; | ||
1252 | } | ||
1253 | fcport->stats_qfull = BFA_FALSE; | ||
1254 | |||
1255 | bfa_os_memset(msg, 0, sizeof(struct bfi_fcport_req_s)); | ||
1256 | bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_CLEAR_REQ, | ||
1257 | bfa_lpuid(fcport->bfa)); | ||
1258 | bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); | ||
1259 | } | ||
897 | 1260 | ||
898 | /** | 1261 | /** |
899 | * bfa_pport_public | 1262 | * bfa_pport_public |
@@ -903,32 +1266,32 @@ bfa_port_send_txcredit(void *port_cbarg) | |||
903 | * Firmware message handler. | 1266 | * Firmware message handler. |
904 | */ | 1267 | */ |
905 | void | 1268 | void |
906 | bfa_pport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) | 1269 | bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) |
907 | { | 1270 | { |
908 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1271 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
909 | union bfi_pport_i2h_msg_u i2hmsg; | 1272 | union bfi_fcport_i2h_msg_u i2hmsg; |
910 | 1273 | ||
911 | i2hmsg.msg = msg; | 1274 | i2hmsg.msg = msg; |
912 | pport->event_arg.i2hmsg = i2hmsg; | 1275 | fcport->event_arg.i2hmsg = i2hmsg; |
913 | 1276 | ||
914 | switch (msg->mhdr.msg_id) { | 1277 | switch (msg->mhdr.msg_id) { |
915 | case BFI_PPORT_I2H_ENABLE_RSP: | 1278 | case BFI_FCPORT_I2H_ENABLE_RSP: |
916 | if (pport->msgtag == i2hmsg.enable_rsp->msgtag) | 1279 | if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) |
917 | bfa_sm_send_event(pport, BFA_PPORT_SM_FWRSP); | 1280 | bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP); |
918 | break; | 1281 | break; |
919 | 1282 | ||
920 | case BFI_PPORT_I2H_DISABLE_RSP: | 1283 | case BFI_FCPORT_I2H_DISABLE_RSP: |
921 | if (pport->msgtag == i2hmsg.enable_rsp->msgtag) | 1284 | if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) |
922 | bfa_sm_send_event(pport, BFA_PPORT_SM_FWRSP); | 1285 | bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP); |
923 | break; | 1286 | break; |
924 | 1287 | ||
925 | case BFI_PPORT_I2H_EVENT: | 1288 | case BFI_FCPORT_I2H_EVENT: |
926 | switch (i2hmsg.event->link_state.linkstate) { | 1289 | switch (i2hmsg.event->link_state.linkstate) { |
927 | case BFA_PPORT_LINKUP: | 1290 | case BFA_PPORT_LINKUP: |
928 | bfa_sm_send_event(pport, BFA_PPORT_SM_LINKUP); | 1291 | bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKUP); |
929 | break; | 1292 | break; |
930 | case BFA_PPORT_LINKDOWN: | 1293 | case BFA_PPORT_LINKDOWN: |
931 | bfa_sm_send_event(pport, BFA_PPORT_SM_LINKDOWN); | 1294 | bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKDOWN); |
932 | break; | 1295 | break; |
933 | case BFA_PPORT_TRUNK_LINKDOWN: | 1296 | case BFA_PPORT_TRUNK_LINKDOWN: |
934 | /** todo: event notification */ | 1297 | /** todo: event notification */ |
@@ -936,42 +1299,40 @@ bfa_pport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) | |||
936 | } | 1299 | } |
937 | break; | 1300 | break; |
938 | 1301 | ||
939 | case BFI_PPORT_I2H_GET_STATS_RSP: | 1302 | case BFI_FCPORT_I2H_STATS_GET_RSP: |
940 | case BFI_PPORT_I2H_GET_QOS_STATS_RSP: | ||
941 | /* | 1303 | /* |
942 | * check for timer pop before processing the rsp | 1304 | * check for timer pop before processing the rsp |
943 | */ | 1305 | */ |
944 | if (pport->stats_busy == BFA_FALSE | 1306 | if (fcport->stats_busy == BFA_FALSE || |
945 | || pport->stats_status == BFA_STATUS_ETIMER) | 1307 | fcport->stats_status == BFA_STATUS_ETIMER) |
946 | break; | 1308 | break; |
947 | 1309 | ||
948 | bfa_timer_stop(&pport->timer); | 1310 | bfa_timer_stop(&fcport->timer); |
949 | pport->stats_status = i2hmsg.getstats_rsp->status; | 1311 | fcport->stats_status = i2hmsg.pstatsget_rsp->status; |
950 | bfa_cb_queue(pport->bfa, &pport->hcb_qe, __bfa_cb_port_stats, | 1312 | bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, |
951 | pport); | 1313 | __bfa_cb_fcport_stats_get, fcport); |
952 | break; | 1314 | break; |
953 | case BFI_PPORT_I2H_CLEAR_STATS_RSP: | 1315 | |
954 | case BFI_PPORT_I2H_CLEAR_QOS_STATS_RSP: | 1316 | case BFI_FCPORT_I2H_STATS_CLEAR_RSP: |
955 | /* | 1317 | /* |
956 | * check for timer pop before processing the rsp | 1318 | * check for timer pop before processing the rsp |
957 | */ | 1319 | */ |
958 | if (pport->stats_busy == BFA_FALSE | 1320 | if (fcport->stats_busy == BFA_FALSE || |
959 | || pport->stats_status == BFA_STATUS_ETIMER) | 1321 | fcport->stats_status == BFA_STATUS_ETIMER) |
960 | break; | 1322 | break; |
961 | 1323 | ||
962 | bfa_timer_stop(&pport->timer); | 1324 | bfa_timer_stop(&fcport->timer); |
963 | pport->stats_status = BFA_STATUS_OK; | 1325 | fcport->stats_status = BFA_STATUS_OK; |
964 | bfa_cb_queue(pport->bfa, &pport->hcb_qe, | 1326 | bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, |
965 | __bfa_cb_port_stats_clr, pport); | 1327 | __bfa_cb_fcport_stats_clr, fcport); |
966 | break; | 1328 | break; |
967 | 1329 | ||
968 | default: | 1330 | default: |
969 | bfa_assert(0); | 1331 | bfa_assert(0); |
1332 | break; | ||
970 | } | 1333 | } |
971 | } | 1334 | } |
972 | 1335 | ||
973 | |||
974 | |||
975 | /** | 1336 | /** |
976 | * bfa_pport_api | 1337 | * bfa_pport_api |
977 | */ | 1338 | */ |
@@ -980,35 +1341,35 @@ bfa_pport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) | |||
980 | * Registered callback for port events. | 1341 | * Registered callback for port events. |
981 | */ | 1342 | */ |
982 | void | 1343 | void |
983 | bfa_pport_event_register(struct bfa_s *bfa, | 1344 | bfa_fcport_event_register(struct bfa_s *bfa, |
984 | void (*cbfn) (void *cbarg, bfa_pport_event_t event), | 1345 | void (*cbfn) (void *cbarg, bfa_pport_event_t event), |
985 | void *cbarg) | 1346 | void *cbarg) |
986 | { | 1347 | { |
987 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1348 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
988 | 1349 | ||
989 | pport->event_cbfn = cbfn; | 1350 | fcport->event_cbfn = cbfn; |
990 | pport->event_cbarg = cbarg; | 1351 | fcport->event_cbarg = cbarg; |
991 | } | 1352 | } |
992 | 1353 | ||
993 | bfa_status_t | 1354 | bfa_status_t |
994 | bfa_pport_enable(struct bfa_s *bfa) | 1355 | bfa_fcport_enable(struct bfa_s *bfa) |
995 | { | 1356 | { |
996 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1357 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
997 | 1358 | ||
998 | if (pport->diag_busy) | 1359 | if (fcport->diag_busy) |
999 | return BFA_STATUS_DIAG_BUSY; | 1360 | return BFA_STATUS_DIAG_BUSY; |
1000 | else if (bfa_sm_cmp_state | 1361 | else if (bfa_sm_cmp_state |
1001 | (BFA_PORT_MOD(bfa), bfa_pport_sm_disabling_qwait)) | 1362 | (BFA_FCPORT_MOD(bfa), bfa_fcport_sm_disabling_qwait)) |
1002 | return BFA_STATUS_DEVBUSY; | 1363 | return BFA_STATUS_DEVBUSY; |
1003 | 1364 | ||
1004 | bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_ENABLE); | 1365 | bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_ENABLE); |
1005 | return BFA_STATUS_OK; | 1366 | return BFA_STATUS_OK; |
1006 | } | 1367 | } |
1007 | 1368 | ||
1008 | bfa_status_t | 1369 | bfa_status_t |
1009 | bfa_pport_disable(struct bfa_s *bfa) | 1370 | bfa_fcport_disable(struct bfa_s *bfa) |
1010 | { | 1371 | { |
1011 | bfa_sm_send_event(BFA_PORT_MOD(bfa), BFA_PPORT_SM_DISABLE); | 1372 | bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_DISABLE); |
1012 | return BFA_STATUS_OK; | 1373 | return BFA_STATUS_OK; |
1013 | } | 1374 | } |
1014 | 1375 | ||
@@ -1016,18 +1377,18 @@ bfa_pport_disable(struct bfa_s *bfa) | |||
1016 | * Configure port speed. | 1377 | * Configure port speed. |
1017 | */ | 1378 | */ |
1018 | bfa_status_t | 1379 | bfa_status_t |
1019 | bfa_pport_cfg_speed(struct bfa_s *bfa, enum bfa_pport_speed speed) | 1380 | bfa_fcport_cfg_speed(struct bfa_s *bfa, enum bfa_pport_speed speed) |
1020 | { | 1381 | { |
1021 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1382 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1022 | 1383 | ||
1023 | bfa_trc(bfa, speed); | 1384 | bfa_trc(bfa, speed); |
1024 | 1385 | ||
1025 | if ((speed != BFA_PPORT_SPEED_AUTO) && (speed > pport->speed_sup)) { | 1386 | if ((speed != BFA_PPORT_SPEED_AUTO) && (speed > fcport->speed_sup)) { |
1026 | bfa_trc(bfa, pport->speed_sup); | 1387 | bfa_trc(bfa, fcport->speed_sup); |
1027 | return BFA_STATUS_UNSUPP_SPEED; | 1388 | return BFA_STATUS_UNSUPP_SPEED; |
1028 | } | 1389 | } |
1029 | 1390 | ||
1030 | pport->cfg.speed = speed; | 1391 | fcport->cfg.speed = speed; |
1031 | 1392 | ||
1032 | return BFA_STATUS_OK; | 1393 | return BFA_STATUS_OK; |
1033 | } | 1394 | } |
@@ -1036,23 +1397,23 @@ bfa_pport_cfg_speed(struct bfa_s *bfa, enum bfa_pport_speed speed) | |||
1036 | * Get current speed. | 1397 | * Get current speed. |
1037 | */ | 1398 | */ |
1038 | enum bfa_pport_speed | 1399 | enum bfa_pport_speed |
1039 | bfa_pport_get_speed(struct bfa_s *bfa) | 1400 | bfa_fcport_get_speed(struct bfa_s *bfa) |
1040 | { | 1401 | { |
1041 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1402 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1042 | 1403 | ||
1043 | return port->speed; | 1404 | return fcport->speed; |
1044 | } | 1405 | } |
1045 | 1406 | ||
1046 | /** | 1407 | /** |
1047 | * Configure port topology. | 1408 | * Configure port topology. |
1048 | */ | 1409 | */ |
1049 | bfa_status_t | 1410 | bfa_status_t |
1050 | bfa_pport_cfg_topology(struct bfa_s *bfa, enum bfa_pport_topology topology) | 1411 | bfa_fcport_cfg_topology(struct bfa_s *bfa, enum bfa_pport_topology topology) |
1051 | { | 1412 | { |
1052 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1413 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1053 | 1414 | ||
1054 | bfa_trc(bfa, topology); | 1415 | bfa_trc(bfa, topology); |
1055 | bfa_trc(bfa, pport->cfg.topology); | 1416 | bfa_trc(bfa, fcport->cfg.topology); |
1056 | 1417 | ||
1057 | switch (topology) { | 1418 | switch (topology) { |
1058 | case BFA_PPORT_TOPOLOGY_P2P: | 1419 | case BFA_PPORT_TOPOLOGY_P2P: |
@@ -1064,7 +1425,7 @@ bfa_pport_cfg_topology(struct bfa_s *bfa, enum bfa_pport_topology topology) | |||
1064 | return BFA_STATUS_EINVAL; | 1425 | return BFA_STATUS_EINVAL; |
1065 | } | 1426 | } |
1066 | 1427 | ||
1067 | pport->cfg.topology = topology; | 1428 | fcport->cfg.topology = topology; |
1068 | return BFA_STATUS_OK; | 1429 | return BFA_STATUS_OK; |
1069 | } | 1430 | } |
1070 | 1431 | ||
@@ -1072,64 +1433,64 @@ bfa_pport_cfg_topology(struct bfa_s *bfa, enum bfa_pport_topology topology) | |||
1072 | * Get current topology. | 1433 | * Get current topology. |
1073 | */ | 1434 | */ |
1074 | enum bfa_pport_topology | 1435 | enum bfa_pport_topology |
1075 | bfa_pport_get_topology(struct bfa_s *bfa) | 1436 | bfa_fcport_get_topology(struct bfa_s *bfa) |
1076 | { | 1437 | { |
1077 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1438 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1078 | 1439 | ||
1079 | return port->topology; | 1440 | return fcport->topology; |
1080 | } | 1441 | } |
1081 | 1442 | ||
1082 | bfa_status_t | 1443 | bfa_status_t |
1083 | bfa_pport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa) | 1444 | bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa) |
1084 | { | 1445 | { |
1085 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1446 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1086 | 1447 | ||
1087 | bfa_trc(bfa, alpa); | 1448 | bfa_trc(bfa, alpa); |
1088 | bfa_trc(bfa, pport->cfg.cfg_hardalpa); | 1449 | bfa_trc(bfa, fcport->cfg.cfg_hardalpa); |
1089 | bfa_trc(bfa, pport->cfg.hardalpa); | 1450 | bfa_trc(bfa, fcport->cfg.hardalpa); |
1090 | 1451 | ||
1091 | pport->cfg.cfg_hardalpa = BFA_TRUE; | 1452 | fcport->cfg.cfg_hardalpa = BFA_TRUE; |
1092 | pport->cfg.hardalpa = alpa; | 1453 | fcport->cfg.hardalpa = alpa; |
1093 | 1454 | ||
1094 | return BFA_STATUS_OK; | 1455 | return BFA_STATUS_OK; |
1095 | } | 1456 | } |
1096 | 1457 | ||
1097 | bfa_status_t | 1458 | bfa_status_t |
1098 | bfa_pport_clr_hardalpa(struct bfa_s *bfa) | 1459 | bfa_fcport_clr_hardalpa(struct bfa_s *bfa) |
1099 | { | 1460 | { |
1100 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1461 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1101 | 1462 | ||
1102 | bfa_trc(bfa, pport->cfg.cfg_hardalpa); | 1463 | bfa_trc(bfa, fcport->cfg.cfg_hardalpa); |
1103 | bfa_trc(bfa, pport->cfg.hardalpa); | 1464 | bfa_trc(bfa, fcport->cfg.hardalpa); |
1104 | 1465 | ||
1105 | pport->cfg.cfg_hardalpa = BFA_FALSE; | 1466 | fcport->cfg.cfg_hardalpa = BFA_FALSE; |
1106 | return BFA_STATUS_OK; | 1467 | return BFA_STATUS_OK; |
1107 | } | 1468 | } |
1108 | 1469 | ||
1109 | bfa_boolean_t | 1470 | bfa_boolean_t |
1110 | bfa_pport_get_hardalpa(struct bfa_s *bfa, u8 *alpa) | 1471 | bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa) |
1111 | { | 1472 | { |
1112 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1473 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1113 | 1474 | ||
1114 | *alpa = port->cfg.hardalpa; | 1475 | *alpa = fcport->cfg.hardalpa; |
1115 | return port->cfg.cfg_hardalpa; | 1476 | return fcport->cfg.cfg_hardalpa; |
1116 | } | 1477 | } |
1117 | 1478 | ||
1118 | u8 | 1479 | u8 |
1119 | bfa_pport_get_myalpa(struct bfa_s *bfa) | 1480 | bfa_fcport_get_myalpa(struct bfa_s *bfa) |
1120 | { | 1481 | { |
1121 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1482 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1122 | 1483 | ||
1123 | return port->myalpa; | 1484 | return fcport->myalpa; |
1124 | } | 1485 | } |
1125 | 1486 | ||
1126 | bfa_status_t | 1487 | bfa_status_t |
1127 | bfa_pport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxfrsize) | 1488 | bfa_fcport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxfrsize) |
1128 | { | 1489 | { |
1129 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1490 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1130 | 1491 | ||
1131 | bfa_trc(bfa, maxfrsize); | 1492 | bfa_trc(bfa, maxfrsize); |
1132 | bfa_trc(bfa, pport->cfg.maxfrsize); | 1493 | bfa_trc(bfa, fcport->cfg.maxfrsize); |
1133 | 1494 | ||
1134 | /* | 1495 | /* |
1135 | * with in range | 1496 | * with in range |
@@ -1143,41 +1504,41 @@ bfa_pport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxfrsize) | |||
1143 | if ((maxfrsize != FC_MAX_PDUSZ) && (maxfrsize & (maxfrsize - 1))) | 1504 | if ((maxfrsize != FC_MAX_PDUSZ) && (maxfrsize & (maxfrsize - 1))) |
1144 | return BFA_STATUS_INVLD_DFSZ; | 1505 | return BFA_STATUS_INVLD_DFSZ; |
1145 | 1506 | ||
1146 | pport->cfg.maxfrsize = maxfrsize; | 1507 | fcport->cfg.maxfrsize = maxfrsize; |
1147 | return BFA_STATUS_OK; | 1508 | return BFA_STATUS_OK; |
1148 | } | 1509 | } |
1149 | 1510 | ||
1150 | u16 | 1511 | u16 |
1151 | bfa_pport_get_maxfrsize(struct bfa_s *bfa) | 1512 | bfa_fcport_get_maxfrsize(struct bfa_s *bfa) |
1152 | { | 1513 | { |
1153 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1514 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1154 | 1515 | ||
1155 | return port->cfg.maxfrsize; | 1516 | return fcport->cfg.maxfrsize; |
1156 | } | 1517 | } |
1157 | 1518 | ||
1158 | u32 | 1519 | u32 |
1159 | bfa_pport_mypid(struct bfa_s *bfa) | 1520 | bfa_fcport_mypid(struct bfa_s *bfa) |
1160 | { | 1521 | { |
1161 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1522 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1162 | 1523 | ||
1163 | return port->mypid; | 1524 | return fcport->mypid; |
1164 | } | 1525 | } |
1165 | 1526 | ||
1166 | u8 | 1527 | u8 |
1167 | bfa_pport_get_rx_bbcredit(struct bfa_s *bfa) | 1528 | bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa) |
1168 | { | 1529 | { |
1169 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1530 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1170 | 1531 | ||
1171 | return port->cfg.rx_bbcredit; | 1532 | return fcport->cfg.rx_bbcredit; |
1172 | } | 1533 | } |
1173 | 1534 | ||
1174 | void | 1535 | void |
1175 | bfa_pport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit) | 1536 | bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit) |
1176 | { | 1537 | { |
1177 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1538 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1178 | 1539 | ||
1179 | port->cfg.tx_bbcredit = (u8) tx_bbcredit; | 1540 | fcport->cfg.tx_bbcredit = (u8) tx_bbcredit; |
1180 | bfa_port_send_txcredit(port); | 1541 | bfa_fcport_send_txcredit(fcport); |
1181 | } | 1542 | } |
1182 | 1543 | ||
1183 | /** | 1544 | /** |
@@ -1185,302 +1546,192 @@ bfa_pport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit) | |||
1185 | */ | 1546 | */ |
1186 | 1547 | ||
1187 | wwn_t | 1548 | wwn_t |
1188 | bfa_pport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node) | 1549 | bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node) |
1189 | { | 1550 | { |
1190 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1551 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1191 | if (node) | 1552 | if (node) |
1192 | return pport->nwwn; | 1553 | return fcport->nwwn; |
1193 | else | 1554 | else |
1194 | return pport->pwwn; | 1555 | return fcport->pwwn; |
1195 | } | 1556 | } |
1196 | 1557 | ||
1197 | void | 1558 | void |
1198 | bfa_pport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr) | 1559 | bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr) |
1199 | { | 1560 | { |
1200 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1561 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1201 | 1562 | ||
1202 | bfa_os_memset(attr, 0, sizeof(struct bfa_pport_attr_s)); | 1563 | bfa_os_memset(attr, 0, sizeof(struct bfa_pport_attr_s)); |
1203 | 1564 | ||
1204 | attr->nwwn = pport->nwwn; | 1565 | attr->nwwn = fcport->nwwn; |
1205 | attr->pwwn = pport->pwwn; | 1566 | attr->pwwn = fcport->pwwn; |
1206 | 1567 | ||
1207 | bfa_os_memcpy(&attr->pport_cfg, &pport->cfg, | 1568 | bfa_os_memcpy(&attr->pport_cfg, &fcport->cfg, |
1208 | sizeof(struct bfa_pport_cfg_s)); | 1569 | sizeof(struct bfa_pport_cfg_s)); |
1209 | /* | 1570 | /* |
1210 | * speed attributes | 1571 | * speed attributes |
1211 | */ | 1572 | */ |
1212 | attr->pport_cfg.speed = pport->cfg.speed; | 1573 | attr->pport_cfg.speed = fcport->cfg.speed; |
1213 | attr->speed_supported = pport->speed_sup; | 1574 | attr->speed_supported = fcport->speed_sup; |
1214 | attr->speed = pport->speed; | 1575 | attr->speed = fcport->speed; |
1215 | attr->cos_supported = FC_CLASS_3; | 1576 | attr->cos_supported = FC_CLASS_3; |
1216 | 1577 | ||
1217 | /* | 1578 | /* |
1218 | * topology attributes | 1579 | * topology attributes |
1219 | */ | 1580 | */ |
1220 | attr->pport_cfg.topology = pport->cfg.topology; | 1581 | attr->pport_cfg.topology = fcport->cfg.topology; |
1221 | attr->topology = pport->topology; | 1582 | attr->topology = fcport->topology; |
1222 | 1583 | ||
1223 | /* | 1584 | /* |
1224 | * beacon attributes | 1585 | * beacon attributes |
1225 | */ | 1586 | */ |
1226 | attr->beacon = pport->beacon; | 1587 | attr->beacon = fcport->beacon; |
1227 | attr->link_e2e_beacon = pport->link_e2e_beacon; | 1588 | attr->link_e2e_beacon = fcport->link_e2e_beacon; |
1228 | attr->plog_enabled = bfa_plog_get_setting(pport->bfa->plog); | 1589 | attr->plog_enabled = bfa_plog_get_setting(fcport->bfa->plog); |
1229 | 1590 | ||
1230 | attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); | 1591 | attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); |
1231 | attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa); | 1592 | attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa); |
1232 | attr->port_state = bfa_sm_to_state(hal_pport_sm_table, pport->sm); | 1593 | attr->port_state = bfa_sm_to_state(hal_pport_sm_table, fcport->sm); |
1233 | if (bfa_ioc_is_disabled(&pport->bfa->ioc)) | 1594 | if (bfa_ioc_is_disabled(&fcport->bfa->ioc)) |
1234 | attr->port_state = BFA_PPORT_ST_IOCDIS; | 1595 | attr->port_state = BFA_PPORT_ST_IOCDIS; |
1235 | else if (bfa_ioc_fw_mismatch(&pport->bfa->ioc)) | 1596 | else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc)) |
1236 | attr->port_state = BFA_PPORT_ST_FWMISMATCH; | 1597 | attr->port_state = BFA_PPORT_ST_FWMISMATCH; |
1237 | } | 1598 | } |
1238 | 1599 | ||
1239 | static void | 1600 | #define BFA_FCPORT_STATS_TOV 1000 |
1240 | bfa_port_stats_query(void *cbarg) | ||
1241 | { | ||
1242 | struct bfa_pport_s *port = (struct bfa_pport_s *)cbarg; | ||
1243 | bfi_pport_get_stats_req_t *msg; | ||
1244 | |||
1245 | msg = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); | ||
1246 | |||
1247 | if (!msg) { | ||
1248 | port->stats_qfull = BFA_TRUE; | ||
1249 | bfa_reqq_winit(&port->stats_reqq_wait, bfa_port_stats_query, | ||
1250 | port); | ||
1251 | bfa_reqq_wait(port->bfa, BFA_REQQ_PORT, &port->stats_reqq_wait); | ||
1252 | return; | ||
1253 | } | ||
1254 | port->stats_qfull = BFA_FALSE; | ||
1255 | |||
1256 | bfa_os_memset(msg, 0, sizeof(bfi_pport_get_stats_req_t)); | ||
1257 | bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_GET_STATS_REQ, | ||
1258 | bfa_lpuid(port->bfa)); | ||
1259 | bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); | ||
1260 | |||
1261 | return; | ||
1262 | } | ||
1263 | |||
1264 | static void | ||
1265 | bfa_port_stats_clear(void *cbarg) | ||
1266 | { | ||
1267 | struct bfa_pport_s *port = (struct bfa_pport_s *)cbarg; | ||
1268 | bfi_pport_clear_stats_req_t *msg; | ||
1269 | |||
1270 | msg = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); | ||
1271 | 1601 | ||
1272 | if (!msg) { | 1602 | /** |
1273 | port->stats_qfull = BFA_TRUE; | 1603 | * Fetch port attributes (FCQoS or FCoE). |
1274 | bfa_reqq_winit(&port->stats_reqq_wait, bfa_port_stats_clear, | 1604 | */ |
1275 | port); | 1605 | bfa_status_t |
1276 | bfa_reqq_wait(port->bfa, BFA_REQQ_PORT, &port->stats_reqq_wait); | 1606 | bfa_fcport_get_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats, |
1277 | return; | 1607 | bfa_cb_pport_t cbfn, void *cbarg) |
1278 | } | ||
1279 | port->stats_qfull = BFA_FALSE; | ||
1280 | |||
1281 | bfa_os_memset(msg, 0, sizeof(bfi_pport_clear_stats_req_t)); | ||
1282 | bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_CLEAR_STATS_REQ, | ||
1283 | bfa_lpuid(port->bfa)); | ||
1284 | bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); | ||
1285 | return; | ||
1286 | } | ||
1287 | |||
1288 | static void | ||
1289 | bfa_port_qos_stats_clear(void *cbarg) | ||
1290 | { | 1608 | { |
1291 | struct bfa_pport_s *port = (struct bfa_pport_s *)cbarg; | 1609 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1292 | bfi_pport_clear_qos_stats_req_t *msg; | ||
1293 | |||
1294 | msg = bfa_reqq_next(port->bfa, BFA_REQQ_PORT); | ||
1295 | 1610 | ||
1296 | if (!msg) { | 1611 | if (fcport->stats_busy) { |
1297 | port->stats_qfull = BFA_TRUE; | 1612 | bfa_trc(bfa, fcport->stats_busy); |
1298 | bfa_reqq_winit(&port->stats_reqq_wait, bfa_port_qos_stats_clear, | 1613 | return BFA_STATUS_DEVBUSY; |
1299 | port); | ||
1300 | bfa_reqq_wait(port->bfa, BFA_REQQ_PORT, &port->stats_reqq_wait); | ||
1301 | return; | ||
1302 | } | 1614 | } |
1303 | port->stats_qfull = BFA_FALSE; | ||
1304 | 1615 | ||
1305 | bfa_os_memset(msg, 0, sizeof(bfi_pport_clear_qos_stats_req_t)); | 1616 | fcport->stats_busy = BFA_TRUE; |
1306 | bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_CLEAR_QOS_STATS_REQ, | 1617 | fcport->stats_ret = stats; |
1307 | bfa_lpuid(port->bfa)); | 1618 | fcport->stats_cbfn = cbfn; |
1308 | bfa_reqq_produce(port->bfa, BFA_REQQ_PORT); | 1619 | fcport->stats_cbarg = cbarg; |
1309 | return; | ||
1310 | } | ||
1311 | |||
1312 | static void | ||
1313 | bfa_pport_stats_swap(union bfa_pport_stats_u *d, union bfa_pport_stats_u *s) | ||
1314 | { | ||
1315 | u32 *dip = (u32 *) d; | ||
1316 | u32 *sip = (u32 *) s; | ||
1317 | int i; | ||
1318 | 1620 | ||
1319 | /* | 1621 | bfa_fcport_send_stats_get(fcport); |
1320 | * Do 64 bit fields swap first | ||
1321 | */ | ||
1322 | for (i = 0; | ||
1323 | i < | ||
1324 | ((sizeof(union bfa_pport_stats_u) - | ||
1325 | sizeof(struct bfa_qos_stats_s)) / sizeof(u32)); i = i + 2) { | ||
1326 | #ifdef __BIGENDIAN | ||
1327 | dip[i] = bfa_os_ntohl(sip[i]); | ||
1328 | dip[i + 1] = bfa_os_ntohl(sip[i + 1]); | ||
1329 | #else | ||
1330 | dip[i] = bfa_os_ntohl(sip[i + 1]); | ||
1331 | dip[i + 1] = bfa_os_ntohl(sip[i]); | ||
1332 | #endif | ||
1333 | } | ||
1334 | 1622 | ||
1335 | /* | 1623 | bfa_timer_start(bfa, &fcport->timer, bfa_fcport_stats_get_timeout, |
1336 | * Now swap the 32 bit fields | 1624 | fcport, BFA_FCPORT_STATS_TOV); |
1337 | */ | 1625 | return BFA_STATUS_OK; |
1338 | for (; i < (sizeof(union bfa_pport_stats_u) / sizeof(u32)); ++i) | ||
1339 | dip[i] = bfa_os_ntohl(sip[i]); | ||
1340 | } | 1626 | } |
1341 | 1627 | ||
1342 | static void | 1628 | /** |
1343 | __bfa_cb_port_stats_clr(void *cbarg, bfa_boolean_t complete) | 1629 | * Reset port statistics (FCQoS or FCoE). |
1630 | */ | ||
1631 | bfa_status_t | ||
1632 | bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg) | ||
1344 | { | 1633 | { |
1345 | struct bfa_pport_s *port = cbarg; | 1634 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1346 | 1635 | ||
1347 | if (complete) { | 1636 | if (fcport->stats_busy) { |
1348 | port->stats_cbfn(port->stats_cbarg, port->stats_status); | 1637 | bfa_trc(bfa, fcport->stats_busy); |
1349 | } else { | 1638 | return BFA_STATUS_DEVBUSY; |
1350 | port->stats_busy = BFA_FALSE; | ||
1351 | port->stats_status = BFA_STATUS_OK; | ||
1352 | } | 1639 | } |
1353 | } | ||
1354 | |||
1355 | static void | ||
1356 | bfa_port_stats_clr_timeout(void *cbarg) | ||
1357 | { | ||
1358 | struct bfa_pport_s *port = (struct bfa_pport_s *)cbarg; | ||
1359 | 1640 | ||
1360 | bfa_trc(port->bfa, port->stats_qfull); | 1641 | fcport->stats_busy = BFA_TRUE; |
1642 | fcport->stats_cbfn = cbfn; | ||
1643 | fcport->stats_cbarg = cbarg; | ||
1361 | 1644 | ||
1362 | if (port->stats_qfull) { | 1645 | bfa_fcport_send_stats_clear(fcport); |
1363 | bfa_reqq_wcancel(&port->stats_reqq_wait); | ||
1364 | port->stats_qfull = BFA_FALSE; | ||
1365 | } | ||
1366 | 1646 | ||
1367 | port->stats_status = BFA_STATUS_ETIMER; | 1647 | bfa_timer_start(bfa, &fcport->timer, bfa_fcport_stats_clr_timeout, |
1368 | bfa_cb_queue(port->bfa, &port->hcb_qe, __bfa_cb_port_stats_clr, port); | 1648 | fcport, BFA_FCPORT_STATS_TOV); |
1649 | return BFA_STATUS_OK; | ||
1369 | } | 1650 | } |
1370 | 1651 | ||
1371 | static void | 1652 | /** |
1372 | __bfa_cb_port_stats(void *cbarg, bfa_boolean_t complete) | 1653 | * Fetch FCQoS port statistics |
1654 | */ | ||
1655 | bfa_status_t | ||
1656 | bfa_fcport_get_qos_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats, | ||
1657 | bfa_cb_pport_t cbfn, void *cbarg) | ||
1373 | { | 1658 | { |
1374 | struct bfa_pport_s *port = cbarg; | 1659 | /* Meaningful only for FC mode */ |
1660 | bfa_assert(bfa_ioc_get_fcmode(&bfa->ioc)); | ||
1375 | 1661 | ||
1376 | if (complete) { | 1662 | return bfa_fcport_get_stats(bfa, stats, cbfn, cbarg); |
1377 | if (port->stats_status == BFA_STATUS_OK) | ||
1378 | bfa_pport_stats_swap(port->stats_ret, port->stats); | ||
1379 | port->stats_cbfn(port->stats_cbarg, port->stats_status); | ||
1380 | } else { | ||
1381 | port->stats_busy = BFA_FALSE; | ||
1382 | port->stats_status = BFA_STATUS_OK; | ||
1383 | } | ||
1384 | } | 1663 | } |
1385 | 1664 | ||
1386 | static void | 1665 | /** |
1387 | bfa_port_stats_timeout(void *cbarg) | 1666 | * Reset FCoE port statistics |
1667 | */ | ||
1668 | bfa_status_t | ||
1669 | bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg) | ||
1388 | { | 1670 | { |
1389 | struct bfa_pport_s *port = (struct bfa_pport_s *)cbarg; | 1671 | /* Meaningful only for FC mode */ |
1390 | 1672 | bfa_assert(bfa_ioc_get_fcmode(&bfa->ioc)); | |
1391 | bfa_trc(port->bfa, port->stats_qfull); | ||
1392 | 1673 | ||
1393 | if (port->stats_qfull) { | 1674 | return bfa_fcport_clear_stats(bfa, cbfn, cbarg); |
1394 | bfa_reqq_wcancel(&port->stats_reqq_wait); | ||
1395 | port->stats_qfull = BFA_FALSE; | ||
1396 | } | ||
1397 | |||
1398 | port->stats_status = BFA_STATUS_ETIMER; | ||
1399 | bfa_cb_queue(port->bfa, &port->hcb_qe, __bfa_cb_port_stats, port); | ||
1400 | } | 1675 | } |
1401 | 1676 | ||
1402 | #define BFA_PORT_STATS_TOV 1000 | ||
1403 | |||
1404 | /** | 1677 | /** |
1405 | * Fetch port attributes. | 1678 | * Fetch FCQoS port statistics |
1406 | */ | 1679 | */ |
1407 | bfa_status_t | 1680 | bfa_status_t |
1408 | bfa_pport_get_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats, | 1681 | bfa_fcport_get_fcoe_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats, |
1409 | bfa_cb_pport_t cbfn, void *cbarg) | 1682 | bfa_cb_pport_t cbfn, void *cbarg) |
1410 | { | 1683 | { |
1411 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1684 | /* Meaningful only for FCoE mode */ |
1412 | 1685 | bfa_assert(!bfa_ioc_get_fcmode(&bfa->ioc)); | |
1413 | if (port->stats_busy) { | ||
1414 | bfa_trc(bfa, port->stats_busy); | ||
1415 | return BFA_STATUS_DEVBUSY; | ||
1416 | } | ||
1417 | |||
1418 | port->stats_busy = BFA_TRUE; | ||
1419 | port->stats_ret = stats; | ||
1420 | port->stats_cbfn = cbfn; | ||
1421 | port->stats_cbarg = cbarg; | ||
1422 | |||
1423 | bfa_port_stats_query(port); | ||
1424 | 1686 | ||
1425 | bfa_timer_start(bfa, &port->timer, bfa_port_stats_timeout, port, | 1687 | return bfa_fcport_get_stats(bfa, stats, cbfn, cbarg); |
1426 | BFA_PORT_STATS_TOV); | ||
1427 | return BFA_STATUS_OK; | ||
1428 | } | 1688 | } |
1429 | 1689 | ||
1690 | /** | ||
1691 | * Reset FCoE port statistics | ||
1692 | */ | ||
1430 | bfa_status_t | 1693 | bfa_status_t |
1431 | bfa_pport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg) | 1694 | bfa_fcport_clear_fcoe_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg) |
1432 | { | 1695 | { |
1433 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1696 | /* Meaningful only for FCoE mode */ |
1434 | 1697 | bfa_assert(!bfa_ioc_get_fcmode(&bfa->ioc)); | |
1435 | if (port->stats_busy) { | ||
1436 | bfa_trc(bfa, port->stats_busy); | ||
1437 | return BFA_STATUS_DEVBUSY; | ||
1438 | } | ||
1439 | |||
1440 | port->stats_busy = BFA_TRUE; | ||
1441 | port->stats_cbfn = cbfn; | ||
1442 | port->stats_cbarg = cbarg; | ||
1443 | |||
1444 | bfa_port_stats_clear(port); | ||
1445 | 1698 | ||
1446 | bfa_timer_start(bfa, &port->timer, bfa_port_stats_clr_timeout, port, | 1699 | return bfa_fcport_clear_stats(bfa, cbfn, cbarg); |
1447 | BFA_PORT_STATS_TOV); | ||
1448 | return BFA_STATUS_OK; | ||
1449 | } | 1700 | } |
1450 | 1701 | ||
1451 | bfa_status_t | 1702 | bfa_status_t |
1452 | bfa_pport_trunk_enable(struct bfa_s *bfa, u8 bitmap) | 1703 | bfa_fcport_trunk_enable(struct bfa_s *bfa, u8 bitmap) |
1453 | { | 1704 | { |
1454 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1705 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1455 | 1706 | ||
1456 | bfa_trc(bfa, bitmap); | 1707 | bfa_trc(bfa, bitmap); |
1457 | bfa_trc(bfa, pport->cfg.trunked); | 1708 | bfa_trc(bfa, fcport->cfg.trunked); |
1458 | bfa_trc(bfa, pport->cfg.trunk_ports); | 1709 | bfa_trc(bfa, fcport->cfg.trunk_ports); |
1459 | 1710 | ||
1460 | if (!bitmap || (bitmap & (bitmap - 1))) | 1711 | if (!bitmap || (bitmap & (bitmap - 1))) |
1461 | return BFA_STATUS_EINVAL; | 1712 | return BFA_STATUS_EINVAL; |
1462 | 1713 | ||
1463 | pport->cfg.trunked = BFA_TRUE; | 1714 | fcport->cfg.trunked = BFA_TRUE; |
1464 | pport->cfg.trunk_ports = bitmap; | 1715 | fcport->cfg.trunk_ports = bitmap; |
1465 | 1716 | ||
1466 | return BFA_STATUS_OK; | 1717 | return BFA_STATUS_OK; |
1467 | } | 1718 | } |
1468 | 1719 | ||
1469 | void | 1720 | void |
1470 | bfa_pport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr) | 1721 | bfa_fcport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr) |
1471 | { | 1722 | { |
1472 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1723 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1473 | 1724 | ||
1474 | qos_attr->state = bfa_os_ntohl(pport->qos_attr.state); | 1725 | qos_attr->state = bfa_os_ntohl(fcport->qos_attr.state); |
1475 | qos_attr->total_bb_cr = bfa_os_ntohl(pport->qos_attr.total_bb_cr); | 1726 | qos_attr->total_bb_cr = bfa_os_ntohl(fcport->qos_attr.total_bb_cr); |
1476 | } | 1727 | } |
1477 | 1728 | ||
1478 | void | 1729 | void |
1479 | bfa_pport_qos_get_vc_attr(struct bfa_s *bfa, | 1730 | bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa, |
1480 | struct bfa_qos_vc_attr_s *qos_vc_attr) | 1731 | struct bfa_qos_vc_attr_s *qos_vc_attr) |
1481 | { | 1732 | { |
1482 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1733 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1483 | struct bfa_qos_vc_attr_s *bfa_vc_attr = &pport->qos_vc_attr; | 1734 | struct bfa_qos_vc_attr_s *bfa_vc_attr = &fcport->qos_vc_attr; |
1484 | u32 i = 0; | 1735 | u32 i = 0; |
1485 | 1736 | ||
1486 | qos_vc_attr->total_vc_count = bfa_os_ntohs(bfa_vc_attr->total_vc_count); | 1737 | qos_vc_attr->total_vc_count = bfa_os_ntohs(bfa_vc_attr->total_vc_count); |
@@ -1503,119 +1754,89 @@ bfa_pport_qos_get_vc_attr(struct bfa_s *bfa, | |||
1503 | } | 1754 | } |
1504 | 1755 | ||
1505 | /** | 1756 | /** |
1506 | * Fetch QoS Stats. | ||
1507 | */ | ||
1508 | bfa_status_t | ||
1509 | bfa_pport_get_qos_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats, | ||
1510 | bfa_cb_pport_t cbfn, void *cbarg) | ||
1511 | { | ||
1512 | /* | ||
1513 | * QoS stats is embedded in port stats | ||
1514 | */ | ||
1515 | return bfa_pport_get_stats(bfa, stats, cbfn, cbarg); | ||
1516 | } | ||
1517 | |||
1518 | bfa_status_t | ||
1519 | bfa_pport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg) | ||
1520 | { | ||
1521 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | ||
1522 | |||
1523 | if (port->stats_busy) { | ||
1524 | bfa_trc(bfa, port->stats_busy); | ||
1525 | return BFA_STATUS_DEVBUSY; | ||
1526 | } | ||
1527 | |||
1528 | port->stats_busy = BFA_TRUE; | ||
1529 | port->stats_cbfn = cbfn; | ||
1530 | port->stats_cbarg = cbarg; | ||
1531 | |||
1532 | bfa_port_qos_stats_clear(port); | ||
1533 | |||
1534 | bfa_timer_start(bfa, &port->timer, bfa_port_stats_clr_timeout, port, | ||
1535 | BFA_PORT_STATS_TOV); | ||
1536 | return BFA_STATUS_OK; | ||
1537 | } | ||
1538 | |||
1539 | /** | ||
1540 | * Fetch port attributes. | 1757 | * Fetch port attributes. |
1541 | */ | 1758 | */ |
1542 | bfa_status_t | 1759 | bfa_status_t |
1543 | bfa_pport_trunk_disable(struct bfa_s *bfa) | 1760 | bfa_fcport_trunk_disable(struct bfa_s *bfa) |
1544 | { | 1761 | { |
1545 | return BFA_STATUS_OK; | 1762 | return BFA_STATUS_OK; |
1546 | } | 1763 | } |
1547 | 1764 | ||
1548 | bfa_boolean_t | 1765 | bfa_boolean_t |
1549 | bfa_pport_trunk_query(struct bfa_s *bfa, u32 *bitmap) | 1766 | bfa_fcport_trunk_query(struct bfa_s *bfa, u32 *bitmap) |
1550 | { | 1767 | { |
1551 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1768 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1552 | 1769 | ||
1553 | *bitmap = port->cfg.trunk_ports; | 1770 | *bitmap = fcport->cfg.trunk_ports; |
1554 | return port->cfg.trunked; | 1771 | return fcport->cfg.trunked; |
1555 | } | 1772 | } |
1556 | 1773 | ||
1557 | bfa_boolean_t | 1774 | bfa_boolean_t |
1558 | bfa_pport_is_disabled(struct bfa_s *bfa) | 1775 | bfa_fcport_is_disabled(struct bfa_s *bfa) |
1559 | { | 1776 | { |
1560 | struct bfa_pport_s *port = BFA_PORT_MOD(bfa); | 1777 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1561 | 1778 | ||
1562 | return bfa_sm_to_state(hal_pport_sm_table, port->sm) == | 1779 | return bfa_sm_to_state(hal_pport_sm_table, fcport->sm) == |
1563 | BFA_PPORT_ST_DISABLED; | 1780 | BFA_PPORT_ST_DISABLED; |
1564 | 1781 | ||
1565 | } | 1782 | } |
1566 | 1783 | ||
1567 | bfa_boolean_t | 1784 | bfa_boolean_t |
1568 | bfa_pport_is_ratelim(struct bfa_s *bfa) | 1785 | bfa_fcport_is_ratelim(struct bfa_s *bfa) |
1569 | { | 1786 | { |
1570 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1787 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1571 | 1788 | ||
1572 | return pport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE; | 1789 | return fcport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE; |
1573 | 1790 | ||
1574 | } | 1791 | } |
1575 | 1792 | ||
1576 | void | 1793 | void |
1577 | bfa_pport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off) | 1794 | bfa_fcport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off) |
1578 | { | 1795 | { |
1579 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1796 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1797 | enum bfa_ioc_type_e ioc_type = bfa_get_type(bfa); | ||
1580 | 1798 | ||
1581 | bfa_trc(bfa, on_off); | 1799 | bfa_trc(bfa, on_off); |
1582 | bfa_trc(bfa, pport->cfg.qos_enabled); | 1800 | bfa_trc(bfa, fcport->cfg.qos_enabled); |
1801 | |||
1802 | bfa_trc(bfa, ioc_type); | ||
1583 | 1803 | ||
1584 | pport->cfg.qos_enabled = on_off; | 1804 | if (ioc_type == BFA_IOC_TYPE_FC) |
1805 | fcport->cfg.qos_enabled = on_off; | ||
1585 | } | 1806 | } |
1586 | 1807 | ||
1587 | void | 1808 | void |
1588 | bfa_pport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off) | 1809 | bfa_fcport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off) |
1589 | { | 1810 | { |
1590 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1811 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1591 | 1812 | ||
1592 | bfa_trc(bfa, on_off); | 1813 | bfa_trc(bfa, on_off); |
1593 | bfa_trc(bfa, pport->cfg.ratelimit); | 1814 | bfa_trc(bfa, fcport->cfg.ratelimit); |
1594 | 1815 | ||
1595 | pport->cfg.ratelimit = on_off; | 1816 | fcport->cfg.ratelimit = on_off; |
1596 | if (pport->cfg.trl_def_speed == BFA_PPORT_SPEED_UNKNOWN) | 1817 | if (fcport->cfg.trl_def_speed == BFA_PPORT_SPEED_UNKNOWN) |
1597 | pport->cfg.trl_def_speed = BFA_PPORT_SPEED_1GBPS; | 1818 | fcport->cfg.trl_def_speed = BFA_PPORT_SPEED_1GBPS; |
1598 | } | 1819 | } |
1599 | 1820 | ||
1600 | /** | 1821 | /** |
1601 | * Configure default minimum ratelim speed | 1822 | * Configure default minimum ratelim speed |
1602 | */ | 1823 | */ |
1603 | bfa_status_t | 1824 | bfa_status_t |
1604 | bfa_pport_cfg_ratelim_speed(struct bfa_s *bfa, enum bfa_pport_speed speed) | 1825 | bfa_fcport_cfg_ratelim_speed(struct bfa_s *bfa, enum bfa_pport_speed speed) |
1605 | { | 1826 | { |
1606 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1827 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1607 | 1828 | ||
1608 | bfa_trc(bfa, speed); | 1829 | bfa_trc(bfa, speed); |
1609 | 1830 | ||
1610 | /* | 1831 | /* |
1611 | * Auto and speeds greater than the supported speed, are invalid | 1832 | * Auto and speeds greater than the supported speed, are invalid |
1612 | */ | 1833 | */ |
1613 | if ((speed == BFA_PPORT_SPEED_AUTO) || (speed > pport->speed_sup)) { | 1834 | if ((speed == BFA_PPORT_SPEED_AUTO) || (speed > fcport->speed_sup)) { |
1614 | bfa_trc(bfa, pport->speed_sup); | 1835 | bfa_trc(bfa, fcport->speed_sup); |
1615 | return BFA_STATUS_UNSUPP_SPEED; | 1836 | return BFA_STATUS_UNSUPP_SPEED; |
1616 | } | 1837 | } |
1617 | 1838 | ||
1618 | pport->cfg.trl_def_speed = speed; | 1839 | fcport->cfg.trl_def_speed = speed; |
1619 | 1840 | ||
1620 | return BFA_STATUS_OK; | 1841 | return BFA_STATUS_OK; |
1621 | } | 1842 | } |
@@ -1624,45 +1845,45 @@ bfa_pport_cfg_ratelim_speed(struct bfa_s *bfa, enum bfa_pport_speed speed) | |||
1624 | * Get default minimum ratelim speed | 1845 | * Get default minimum ratelim speed |
1625 | */ | 1846 | */ |
1626 | enum bfa_pport_speed | 1847 | enum bfa_pport_speed |
1627 | bfa_pport_get_ratelim_speed(struct bfa_s *bfa) | 1848 | bfa_fcport_get_ratelim_speed(struct bfa_s *bfa) |
1628 | { | 1849 | { |
1629 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1850 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1630 | 1851 | ||
1631 | bfa_trc(bfa, pport->cfg.trl_def_speed); | 1852 | bfa_trc(bfa, fcport->cfg.trl_def_speed); |
1632 | return pport->cfg.trl_def_speed; | 1853 | return fcport->cfg.trl_def_speed; |
1633 | 1854 | ||
1634 | } | 1855 | } |
1635 | 1856 | ||
1636 | void | 1857 | void |
1637 | bfa_pport_busy(struct bfa_s *bfa, bfa_boolean_t status) | 1858 | bfa_fcport_busy(struct bfa_s *bfa, bfa_boolean_t status) |
1638 | { | 1859 | { |
1639 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1860 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1640 | 1861 | ||
1641 | bfa_trc(bfa, status); | 1862 | bfa_trc(bfa, status); |
1642 | bfa_trc(bfa, pport->diag_busy); | 1863 | bfa_trc(bfa, fcport->diag_busy); |
1643 | 1864 | ||
1644 | pport->diag_busy = status; | 1865 | fcport->diag_busy = status; |
1645 | } | 1866 | } |
1646 | 1867 | ||
1647 | void | 1868 | void |
1648 | bfa_pport_beacon(struct bfa_s *bfa, bfa_boolean_t beacon, | 1869 | bfa_fcport_beacon(struct bfa_s *bfa, bfa_boolean_t beacon, |
1649 | bfa_boolean_t link_e2e_beacon) | 1870 | bfa_boolean_t link_e2e_beacon) |
1650 | { | 1871 | { |
1651 | struct bfa_pport_s *pport = BFA_PORT_MOD(bfa); | 1872 | struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); |
1652 | 1873 | ||
1653 | bfa_trc(bfa, beacon); | 1874 | bfa_trc(bfa, beacon); |
1654 | bfa_trc(bfa, link_e2e_beacon); | 1875 | bfa_trc(bfa, link_e2e_beacon); |
1655 | bfa_trc(bfa, pport->beacon); | 1876 | bfa_trc(bfa, fcport->beacon); |
1656 | bfa_trc(bfa, pport->link_e2e_beacon); | 1877 | bfa_trc(bfa, fcport->link_e2e_beacon); |
1657 | 1878 | ||
1658 | pport->beacon = beacon; | 1879 | fcport->beacon = beacon; |
1659 | pport->link_e2e_beacon = link_e2e_beacon; | 1880 | fcport->link_e2e_beacon = link_e2e_beacon; |
1660 | } | 1881 | } |
1661 | 1882 | ||
1662 | bfa_boolean_t | 1883 | bfa_boolean_t |
1663 | bfa_pport_is_linkup(struct bfa_s *bfa) | 1884 | bfa_fcport_is_linkup(struct bfa_s *bfa) |
1664 | { | 1885 | { |
1665 | return bfa_sm_cmp_state(BFA_PORT_MOD(bfa), bfa_pport_sm_linkup); | 1886 | return bfa_sm_cmp_state(BFA_FCPORT_MOD(bfa), bfa_fcport_sm_linkup); |
1666 | } | 1887 | } |
1667 | 1888 | ||
1668 | 1889 | ||
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index 7cb39a306ea9..3516172c597c 100644 --- a/drivers/scsi/bfa/bfa_fcs.c +++ b/drivers/scsi/bfa/bfa_fcs.c | |||
@@ -36,6 +36,7 @@ | |||
36 | * FCS sub-modules | 36 | * FCS sub-modules |
37 | */ | 37 | */ |
38 | struct bfa_fcs_mod_s { | 38 | struct bfa_fcs_mod_s { |
39 | void (*attach) (struct bfa_fcs_s *fcs); | ||
39 | void (*modinit) (struct bfa_fcs_s *fcs); | 40 | void (*modinit) (struct bfa_fcs_s *fcs); |
40 | void (*modexit) (struct bfa_fcs_s *fcs); | 41 | void (*modexit) (struct bfa_fcs_s *fcs); |
41 | }; | 42 | }; |
@@ -43,12 +44,10 @@ struct bfa_fcs_mod_s { | |||
43 | #define BFA_FCS_MODULE(_mod) { _mod ## _modinit, _mod ## _modexit } | 44 | #define BFA_FCS_MODULE(_mod) { _mod ## _modinit, _mod ## _modexit } |
44 | 45 | ||
45 | static struct bfa_fcs_mod_s fcs_modules[] = { | 46 | static struct bfa_fcs_mod_s fcs_modules[] = { |
46 | BFA_FCS_MODULE(bfa_fcs_pport), | 47 | { bfa_fcs_pport_attach, NULL, NULL }, |
47 | BFA_FCS_MODULE(bfa_fcs_uf), | 48 | { bfa_fcs_uf_attach, NULL, NULL }, |
48 | BFA_FCS_MODULE(bfa_fcs_fabric), | 49 | { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit, |
49 | BFA_FCS_MODULE(bfa_fcs_vport), | 50 | bfa_fcs_fabric_modexit }, |
50 | BFA_FCS_MODULE(bfa_fcs_rport), | ||
51 | BFA_FCS_MODULE(bfa_fcs_fcpim), | ||
52 | }; | 51 | }; |
53 | 52 | ||
54 | /** | 53 | /** |
@@ -71,16 +70,10 @@ bfa_fcs_exit_comp(void *fcs_cbarg) | |||
71 | */ | 70 | */ |
72 | 71 | ||
73 | /** | 72 | /** |
74 | * FCS instance initialization. | 73 | * fcs attach -- called once to initialize data structures at driver attach time |
75 | * | ||
76 | * param[in] fcs FCS instance | ||
77 | * param[in] bfa BFA instance | ||
78 | * param[in] bfad BFA driver instance | ||
79 | * | ||
80 | * return None | ||
81 | */ | 74 | */ |
82 | void | 75 | void |
83 | bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, | 76 | bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, |
84 | bfa_boolean_t min_cfg) | 77 | bfa_boolean_t min_cfg) |
85 | { | 78 | { |
86 | int i; | 79 | int i; |
@@ -95,7 +88,24 @@ bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, | |||
95 | 88 | ||
96 | for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { | 89 | for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { |
97 | mod = &fcs_modules[i]; | 90 | mod = &fcs_modules[i]; |
98 | mod->modinit(fcs); | 91 | if (mod->attach) |
92 | mod->attach(fcs); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * fcs initialization, called once after bfa initialization is complete | ||
98 | */ | ||
99 | void | ||
100 | bfa_fcs_init(struct bfa_fcs_s *fcs) | ||
101 | { | ||
102 | int i; | ||
103 | struct bfa_fcs_mod_s *mod; | ||
104 | |||
105 | for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { | ||
106 | mod = &fcs_modules[i]; | ||
107 | if (mod->modinit) | ||
108 | mod->modinit(fcs); | ||
99 | } | 109 | } |
100 | } | 110 | } |
101 | 111 | ||
@@ -127,6 +137,23 @@ bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, | |||
127 | } | 137 | } |
128 | 138 | ||
129 | /** | 139 | /** |
140 | * @brief | ||
141 | * FCS FDMI Driver Parameter Initialization | ||
142 | * | ||
143 | * @param[in] fcs FCS instance | ||
144 | * @param[in] fdmi_enable TRUE/FALSE | ||
145 | * | ||
146 | * @return None | ||
147 | */ | ||
148 | void | ||
149 | bfa_fcs_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable) | ||
150 | { | ||
151 | |||
152 | fcs->fdmi_enabled = fdmi_enable; | ||
153 | |||
154 | } | ||
155 | |||
156 | /** | ||
130 | * FCS instance cleanup and exit. | 157 | * FCS instance cleanup and exit. |
131 | * | 158 | * |
132 | * param[in] fcs FCS instance | 159 | * param[in] fcs FCS instance |
@@ -143,10 +170,12 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs) | |||
143 | nmods = sizeof(fcs_modules) / sizeof(fcs_modules[0]); | 170 | nmods = sizeof(fcs_modules) / sizeof(fcs_modules[0]); |
144 | 171 | ||
145 | for (i = 0; i < nmods; i++) { | 172 | for (i = 0; i < nmods; i++) { |
146 | bfa_wc_up(&fcs->wc); | ||
147 | 173 | ||
148 | mod = &fcs_modules[i]; | 174 | mod = &fcs_modules[i]; |
149 | mod->modexit(fcs); | 175 | if (mod->modexit) { |
176 | bfa_wc_up(&fcs->wc); | ||
177 | mod->modexit(fcs); | ||
178 | } | ||
150 | } | 179 | } |
151 | 180 | ||
152 | bfa_wc_wait(&fcs->wc); | 181 | bfa_wc_wait(&fcs->wc); |
diff --git a/drivers/scsi/bfa/bfa_fcs_lport.c b/drivers/scsi/bfa/bfa_fcs_lport.c index c7ab257f10a7..7c1251c682d8 100644 --- a/drivers/scsi/bfa/bfa_fcs_lport.c +++ b/drivers/scsi/bfa/bfa_fcs_lport.c | |||
@@ -114,7 +114,7 @@ bfa_fcs_port_sm_uninit(struct bfa_fcs_port_s *port, | |||
114 | break; | 114 | break; |
115 | 115 | ||
116 | default: | 116 | default: |
117 | bfa_assert(0); | 117 | bfa_sm_fault(port->fcs, event); |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
@@ -136,7 +136,7 @@ bfa_fcs_port_sm_init(struct bfa_fcs_port_s *port, enum bfa_fcs_port_event event) | |||
136 | break; | 136 | break; |
137 | 137 | ||
138 | default: | 138 | default: |
139 | bfa_assert(0); | 139 | bfa_sm_fault(port->fcs, event); |
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
@@ -176,7 +176,7 @@ bfa_fcs_port_sm_online(struct bfa_fcs_port_s *port, | |||
176 | break; | 176 | break; |
177 | 177 | ||
178 | default: | 178 | default: |
179 | bfa_assert(0); | 179 | bfa_sm_fault(port->fcs, event); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
@@ -214,7 +214,7 @@ bfa_fcs_port_sm_offline(struct bfa_fcs_port_s *port, | |||
214 | break; | 214 | break; |
215 | 215 | ||
216 | default: | 216 | default: |
217 | bfa_assert(0); | 217 | bfa_sm_fault(port->fcs, event); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
@@ -234,7 +234,7 @@ bfa_fcs_port_sm_deleting(struct bfa_fcs_port_s *port, | |||
234 | break; | 234 | break; |
235 | 235 | ||
236 | default: | 236 | default: |
237 | bfa_assert(0); | 237 | bfa_sm_fault(port->fcs, event); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | 240 | ||
@@ -263,30 +263,8 @@ bfa_fcs_port_aen_post(struct bfa_fcs_port_s *port, | |||
263 | 263 | ||
264 | bfa_assert(role <= BFA_PORT_ROLE_FCP_MAX); | 264 | bfa_assert(role <= BFA_PORT_ROLE_FCP_MAX); |
265 | 265 | ||
266 | switch (event) { | 266 | bfa_log(logmod, BFA_LOG_CREATE_ID(BFA_AEN_CAT_LPORT, event), lpwwn_ptr, |
267 | case BFA_LPORT_AEN_ONLINE: | 267 | role_str[role/2]); |
268 | bfa_log(logmod, BFA_AEN_LPORT_ONLINE, lpwwn_ptr, | ||
269 | role_str[role / 2]); | ||
270 | break; | ||
271 | case BFA_LPORT_AEN_OFFLINE: | ||
272 | bfa_log(logmod, BFA_AEN_LPORT_OFFLINE, lpwwn_ptr, | ||
273 | role_str[role / 2]); | ||
274 | break; | ||
275 | case BFA_LPORT_AEN_NEW: | ||
276 | bfa_log(logmod, BFA_AEN_LPORT_NEW, lpwwn_ptr, | ||
277 | role_str[role / 2]); | ||
278 | break; | ||
279 | case BFA_LPORT_AEN_DELETE: | ||
280 | bfa_log(logmod, BFA_AEN_LPORT_DELETE, lpwwn_ptr, | ||
281 | role_str[role / 2]); | ||
282 | break; | ||
283 | case BFA_LPORT_AEN_DISCONNECT: | ||
284 | bfa_log(logmod, BFA_AEN_LPORT_DISCONNECT, lpwwn_ptr, | ||
285 | role_str[role / 2]); | ||
286 | break; | ||
287 | default: | ||
288 | break; | ||
289 | } | ||
290 | 268 | ||
291 | aen_data.lport.vf_id = port->fabric->vf_id; | 269 | aen_data.lport.vf_id = port->fabric->vf_id; |
292 | aen_data.lport.roles = role; | 270 | aen_data.lport.roles = role; |
@@ -873,36 +851,46 @@ bfa_fcs_port_is_online(struct bfa_fcs_port_s *port) | |||
873 | } | 851 | } |
874 | 852 | ||
875 | /** | 853 | /** |
876 | * Logical port initialization of base or virtual port. | 854 | * Attach time initialization of logical ports. |
877 | * Called by fabric for base port or by vport for virtual ports. | ||
878 | */ | 855 | */ |
879 | void | 856 | void |
880 | bfa_fcs_lport_init(struct bfa_fcs_port_s *lport, struct bfa_fcs_s *fcs, | 857 | bfa_fcs_lport_attach(struct bfa_fcs_port_s *lport, struct bfa_fcs_s *fcs, |
881 | u16 vf_id, struct bfa_port_cfg_s *port_cfg, | 858 | uint16_t vf_id, struct bfa_fcs_vport_s *vport) |
882 | struct bfa_fcs_vport_s *vport) | ||
883 | { | 859 | { |
884 | lport->fcs = fcs; | 860 | lport->fcs = fcs; |
885 | lport->fabric = bfa_fcs_vf_lookup(fcs, vf_id); | 861 | lport->fabric = bfa_fcs_vf_lookup(fcs, vf_id); |
886 | bfa_os_assign(lport->port_cfg, *port_cfg); | ||
887 | lport->vport = vport; | 862 | lport->vport = vport; |
888 | lport->lp_tag = (vport) ? bfa_lps_get_tag(vport->lps) : | 863 | lport->lp_tag = (vport) ? bfa_lps_get_tag(vport->lps) : |
889 | bfa_lps_get_tag(lport->fabric->lps); | 864 | bfa_lps_get_tag(lport->fabric->lps); |
890 | 865 | ||
891 | INIT_LIST_HEAD(&lport->rport_q); | 866 | INIT_LIST_HEAD(&lport->rport_q); |
892 | lport->num_rports = 0; | 867 | lport->num_rports = 0; |
868 | } | ||
869 | |||
870 | /** | ||
871 | * Logical port initialization of base or virtual port. | ||
872 | * Called by fabric for base port or by vport for virtual ports. | ||
873 | */ | ||
893 | 874 | ||
894 | lport->bfad_port = | 875 | void |
895 | bfa_fcb_port_new(fcs->bfad, lport, lport->port_cfg.roles, | 876 | bfa_fcs_lport_init(struct bfa_fcs_port_s *lport, |
877 | struct bfa_port_cfg_s *port_cfg) | ||
878 | { | ||
879 | struct bfa_fcs_vport_s *vport = lport->vport; | ||
880 | |||
881 | bfa_os_assign(lport->port_cfg, *port_cfg); | ||
882 | |||
883 | lport->bfad_port = bfa_fcb_port_new(lport->fcs->bfad, lport, | ||
884 | lport->port_cfg.roles, | ||
896 | lport->fabric->vf_drv, | 885 | lport->fabric->vf_drv, |
897 | vport ? vport->vport_drv : NULL); | 886 | vport ? vport->vport_drv : NULL); |
887 | |||
898 | bfa_fcs_port_aen_post(lport, BFA_LPORT_AEN_NEW); | 888 | bfa_fcs_port_aen_post(lport, BFA_LPORT_AEN_NEW); |
899 | 889 | ||
900 | bfa_sm_set_state(lport, bfa_fcs_port_sm_uninit); | 890 | bfa_sm_set_state(lport, bfa_fcs_port_sm_uninit); |
901 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); | 891 | bfa_sm_send_event(lport, BFA_FCS_PORT_SM_CREATE); |
902 | } | 892 | } |
903 | 893 | ||
904 | |||
905 | |||
906 | /** | 894 | /** |
907 | * fcs_lport_api | 895 | * fcs_lport_api |
908 | */ | 896 | */ |
@@ -921,13 +909,20 @@ bfa_fcs_port_get_attr(struct bfa_fcs_port_s *port, | |||
921 | if (port->fabric) { | 909 | if (port->fabric) { |
922 | port_attr->port_type = bfa_fcs_fabric_port_type(port->fabric); | 910 | port_attr->port_type = bfa_fcs_fabric_port_type(port->fabric); |
923 | port_attr->loopback = bfa_fcs_fabric_is_loopback(port->fabric); | 911 | port_attr->loopback = bfa_fcs_fabric_is_loopback(port->fabric); |
912 | port_attr->authfail = | ||
913 | bfa_fcs_fabric_is_auth_failed(port->fabric); | ||
924 | port_attr->fabric_name = bfa_fcs_port_get_fabric_name(port); | 914 | port_attr->fabric_name = bfa_fcs_port_get_fabric_name(port); |
925 | memcpy(port_attr->fabric_ip_addr, | 915 | memcpy(port_attr->fabric_ip_addr, |
926 | bfa_fcs_port_get_fabric_ipaddr(port), | 916 | bfa_fcs_port_get_fabric_ipaddr(port), |
927 | BFA_FCS_FABRIC_IPADDR_SZ); | 917 | BFA_FCS_FABRIC_IPADDR_SZ); |
928 | 918 | ||
929 | if (port->vport != NULL) | 919 | if (port->vport != NULL) { |
930 | port_attr->port_type = BFA_PPORT_TYPE_VPORT; | 920 | port_attr->port_type = BFA_PPORT_TYPE_VPORT; |
921 | port_attr->fpma_mac = | ||
922 | bfa_lps_get_lp_mac(port->vport->lps); | ||
923 | } else | ||
924 | port_attr->fpma_mac = | ||
925 | bfa_lps_get_lp_mac(port->fabric->lps); | ||
931 | 926 | ||
932 | } else { | 927 | } else { |
933 | port_attr->port_type = BFA_PPORT_TYPE_UNKNOWN; | 928 | port_attr->port_type = BFA_PPORT_TYPE_UNKNOWN; |
diff --git a/drivers/scsi/bfa/bfa_fcs_port.c b/drivers/scsi/bfa/bfa_fcs_port.c index 9c4b24e62de1..3c27788cd527 100644 --- a/drivers/scsi/bfa/bfa_fcs_port.c +++ b/drivers/scsi/bfa/bfa_fcs_port.c | |||
@@ -55,14 +55,7 @@ bfa_fcs_pport_event_handler(void *cbarg, bfa_pport_event_t event) | |||
55 | } | 55 | } |
56 | 56 | ||
57 | void | 57 | void |
58 | bfa_fcs_pport_modinit(struct bfa_fcs_s *fcs) | 58 | bfa_fcs_pport_attach(struct bfa_fcs_s *fcs) |
59 | { | 59 | { |
60 | bfa_pport_event_register(fcs->bfa, bfa_fcs_pport_event_handler, | 60 | bfa_fcport_event_register(fcs->bfa, bfa_fcs_pport_event_handler, fcs); |
61 | fcs); | ||
62 | } | ||
63 | |||
64 | void | ||
65 | bfa_fcs_pport_modexit(struct bfa_fcs_s *fcs) | ||
66 | { | ||
67 | bfa_fcs_modexit_comp(fcs); | ||
68 | } | 61 | } |
diff --git a/drivers/scsi/bfa/bfa_fcs_uf.c b/drivers/scsi/bfa/bfa_fcs_uf.c index ad01db6444b2..3d57d48bbae4 100644 --- a/drivers/scsi/bfa/bfa_fcs_uf.c +++ b/drivers/scsi/bfa/bfa_fcs_uf.c | |||
@@ -93,13 +93,7 @@ bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | void | 95 | void |
96 | bfa_fcs_uf_modinit(struct bfa_fcs_s *fcs) | 96 | bfa_fcs_uf_attach(struct bfa_fcs_s *fcs) |
97 | { | 97 | { |
98 | bfa_uf_recv_register(fcs->bfa, bfa_fcs_uf_recv, fcs); | 98 | bfa_uf_recv_register(fcs->bfa, bfa_fcs_uf_recv, fcs); |
99 | } | 99 | } |
100 | |||
101 | void | ||
102 | bfa_fcs_uf_modexit(struct bfa_fcs_s *fcs) | ||
103 | { | ||
104 | bfa_fcs_modexit_comp(fcs); | ||
105 | } | ||
diff --git a/drivers/scsi/bfa/bfa_hw_cb.c b/drivers/scsi/bfa/bfa_hw_cb.c index ede1438619e2..871a4e28575c 100644 --- a/drivers/scsi/bfa/bfa_hw_cb.c +++ b/drivers/scsi/bfa/bfa_hw_cb.c | |||
@@ -53,6 +53,18 @@ bfa_hwcb_reginit(struct bfa_s *bfa) | |||
53 | } | 53 | } |
54 | 54 | ||
55 | void | 55 | void |
56 | bfa_hwcb_reqq_ack(struct bfa_s *bfa, int reqq) | ||
57 | { | ||
58 | } | ||
59 | |||
60 | static void | ||
61 | bfa_hwcb_reqq_ack_msix(struct bfa_s *bfa, int reqq) | ||
62 | { | ||
63 | bfa_reg_write(bfa->iocfc.bfa_regs.intr_status, | ||
64 | __HFN_INT_CPE_Q0 << CPE_Q_NUM(bfa_ioc_pcifn(&bfa->ioc), reqq)); | ||
65 | } | ||
66 | |||
67 | void | ||
56 | bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq) | 68 | bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq) |
57 | { | 69 | { |
58 | } | 70 | } |
@@ -136,6 +148,7 @@ bfa_hwcb_msix_uninstall(struct bfa_s *bfa) | |||
136 | void | 148 | void |
137 | bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix) | 149 | bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix) |
138 | { | 150 | { |
151 | bfa->iocfc.hwif.hw_reqq_ack = bfa_hwcb_reqq_ack_msix; | ||
139 | bfa->iocfc.hwif.hw_rspq_ack = bfa_hwcb_rspq_ack_msix; | 152 | bfa->iocfc.hwif.hw_rspq_ack = bfa_hwcb_rspq_ack_msix; |
140 | } | 153 | } |
141 | 154 | ||
diff --git a/drivers/scsi/bfa/bfa_hw_ct.c b/drivers/scsi/bfa/bfa_hw_ct.c index 51ae5740e6e9..76ceb9a4bf2f 100644 --- a/drivers/scsi/bfa/bfa_hw_ct.c +++ b/drivers/scsi/bfa/bfa_hw_ct.c | |||
@@ -85,6 +85,15 @@ bfa_hwct_reginit(struct bfa_s *bfa) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | void | 87 | void |
88 | bfa_hwct_reqq_ack(struct bfa_s *bfa, int reqq) | ||
89 | { | ||
90 | u32 r32; | ||
91 | |||
92 | r32 = bfa_reg_read(bfa->iocfc.bfa_regs.cpe_q_ctrl[reqq]); | ||
93 | bfa_reg_write(bfa->iocfc.bfa_regs.cpe_q_ctrl[reqq], r32); | ||
94 | } | ||
95 | |||
96 | void | ||
88 | bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq) | 97 | bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq) |
89 | { | 98 | { |
90 | u32 r32; | 99 | u32 r32; |
diff --git a/drivers/scsi/bfa/bfa_intr.c b/drivers/scsi/bfa/bfa_intr.c index b36540e4ed76..0eba3f930d5b 100644 --- a/drivers/scsi/bfa/bfa_intr.c +++ b/drivers/scsi/bfa/bfa_intr.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | #include <bfa.h> | 17 | #include <bfa.h> |
18 | #include <bfi/bfi_cbreg.h> | 18 | #include <bfi/bfi_ctreg.h> |
19 | #include <bfa_port_priv.h> | 19 | #include <bfa_port_priv.h> |
20 | #include <bfa_intr_priv.h> | 20 | #include <bfa_intr_priv.h> |
21 | #include <cs/bfa_debug.h> | 21 | #include <cs/bfa_debug.h> |
@@ -34,6 +34,26 @@ bfa_msix_lpu(struct bfa_s *bfa) | |||
34 | bfa_ioc_mbox_isr(&bfa->ioc); | 34 | bfa_ioc_mbox_isr(&bfa->ioc); |
35 | } | 35 | } |
36 | 36 | ||
37 | static void | ||
38 | bfa_reqq_resume(struct bfa_s *bfa, int qid) | ||
39 | { | ||
40 | struct list_head *waitq, *qe, *qen; | ||
41 | struct bfa_reqq_wait_s *wqe; | ||
42 | |||
43 | waitq = bfa_reqq(bfa, qid); | ||
44 | list_for_each_safe(qe, qen, waitq) { | ||
45 | /** | ||
46 | * Callback only as long as there is room in request queue | ||
47 | */ | ||
48 | if (bfa_reqq_full(bfa, qid)) | ||
49 | break; | ||
50 | |||
51 | list_del(qe); | ||
52 | wqe = (struct bfa_reqq_wait_s *) qe; | ||
53 | wqe->qresume(wqe->cbarg); | ||
54 | } | ||
55 | } | ||
56 | |||
37 | void | 57 | void |
38 | bfa_msix_all(struct bfa_s *bfa, int vec) | 58 | bfa_msix_all(struct bfa_s *bfa, int vec) |
39 | { | 59 | { |
@@ -96,7 +116,8 @@ bfa_isr_enable(struct bfa_s *bfa) | |||
96 | 116 | ||
97 | bfa_msix_install(bfa); | 117 | bfa_msix_install(bfa); |
98 | intr_unmask = (__HFN_INT_ERR_EMC | __HFN_INT_ERR_LPU0 | | 118 | intr_unmask = (__HFN_INT_ERR_EMC | __HFN_INT_ERR_LPU0 | |
99 | __HFN_INT_ERR_LPU1 | __HFN_INT_ERR_PSS); | 119 | __HFN_INT_ERR_LPU1 | __HFN_INT_ERR_PSS | |
120 | __HFN_INT_LL_HALT); | ||
100 | 121 | ||
101 | if (pci_func == 0) | 122 | if (pci_func == 0) |
102 | intr_unmask |= (__HFN_INT_CPE_Q0 | __HFN_INT_CPE_Q1 | | 123 | intr_unmask |= (__HFN_INT_CPE_Q0 | __HFN_INT_CPE_Q1 | |
@@ -127,23 +148,18 @@ bfa_isr_disable(struct bfa_s *bfa) | |||
127 | void | 148 | void |
128 | bfa_msix_reqq(struct bfa_s *bfa, int qid) | 149 | bfa_msix_reqq(struct bfa_s *bfa, int qid) |
129 | { | 150 | { |
130 | struct list_head *waitq, *qe, *qen; | 151 | struct list_head *waitq; |
131 | struct bfa_reqq_wait_s *wqe; | ||
132 | 152 | ||
133 | qid &= (BFI_IOC_MAX_CQS - 1); | 153 | qid &= (BFI_IOC_MAX_CQS - 1); |
134 | 154 | ||
135 | waitq = bfa_reqq(bfa, qid); | 155 | bfa->iocfc.hwif.hw_reqq_ack(bfa, qid); |
136 | list_for_each_safe(qe, qen, waitq) { | ||
137 | /** | ||
138 | * Callback only as long as there is room in request queue | ||
139 | */ | ||
140 | if (bfa_reqq_full(bfa, qid)) | ||
141 | break; | ||
142 | 156 | ||
143 | list_del(qe); | 157 | /** |
144 | wqe = (struct bfa_reqq_wait_s *) qe; | 158 | * Resume any pending requests in the corresponding reqq. |
145 | wqe->qresume(wqe->cbarg); | 159 | */ |
146 | } | 160 | waitq = bfa_reqq(bfa, qid); |
161 | if (!list_empty(waitq)) | ||
162 | bfa_reqq_resume(bfa, qid); | ||
147 | } | 163 | } |
148 | 164 | ||
149 | void | 165 | void |
@@ -157,26 +173,27 @@ bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
157 | } | 173 | } |
158 | 174 | ||
159 | void | 175 | void |
160 | bfa_msix_rspq(struct bfa_s *bfa, int rsp_qid) | 176 | bfa_msix_rspq(struct bfa_s *bfa, int qid) |
161 | { | 177 | { |
162 | struct bfi_msg_s *m; | 178 | struct bfi_msg_s *m; |
163 | u32 pi, ci; | 179 | u32 pi, ci; |
180 | struct list_head *waitq; | ||
164 | 181 | ||
165 | bfa_trc_fp(bfa, rsp_qid); | 182 | bfa_trc_fp(bfa, qid); |
166 | 183 | ||
167 | rsp_qid &= (BFI_IOC_MAX_CQS - 1); | 184 | qid &= (BFI_IOC_MAX_CQS - 1); |
168 | 185 | ||
169 | bfa->iocfc.hwif.hw_rspq_ack(bfa, rsp_qid); | 186 | bfa->iocfc.hwif.hw_rspq_ack(bfa, qid); |
170 | 187 | ||
171 | ci = bfa_rspq_ci(bfa, rsp_qid); | 188 | ci = bfa_rspq_ci(bfa, qid); |
172 | pi = bfa_rspq_pi(bfa, rsp_qid); | 189 | pi = bfa_rspq_pi(bfa, qid); |
173 | 190 | ||
174 | bfa_trc_fp(bfa, ci); | 191 | bfa_trc_fp(bfa, ci); |
175 | bfa_trc_fp(bfa, pi); | 192 | bfa_trc_fp(bfa, pi); |
176 | 193 | ||
177 | if (bfa->rme_process) { | 194 | if (bfa->rme_process) { |
178 | while (ci != pi) { | 195 | while (ci != pi) { |
179 | m = bfa_rspq_elem(bfa, rsp_qid, ci); | 196 | m = bfa_rspq_elem(bfa, qid, ci); |
180 | bfa_assert_fp(m->mhdr.msg_class < BFI_MC_MAX); | 197 | bfa_assert_fp(m->mhdr.msg_class < BFI_MC_MAX); |
181 | 198 | ||
182 | bfa_isrs[m->mhdr.msg_class] (bfa, m); | 199 | bfa_isrs[m->mhdr.msg_class] (bfa, m); |
@@ -188,25 +205,59 @@ bfa_msix_rspq(struct bfa_s *bfa, int rsp_qid) | |||
188 | /** | 205 | /** |
189 | * update CI | 206 | * update CI |
190 | */ | 207 | */ |
191 | bfa_rspq_ci(bfa, rsp_qid) = pi; | 208 | bfa_rspq_ci(bfa, qid) = pi; |
192 | bfa_reg_write(bfa->iocfc.bfa_regs.rme_q_ci[rsp_qid], pi); | 209 | bfa_reg_write(bfa->iocfc.bfa_regs.rme_q_ci[qid], pi); |
193 | bfa_os_mmiowb(); | 210 | bfa_os_mmiowb(); |
211 | |||
212 | /** | ||
213 | * Resume any pending requests in the corresponding reqq. | ||
214 | */ | ||
215 | waitq = bfa_reqq(bfa, qid); | ||
216 | if (!list_empty(waitq)) | ||
217 | bfa_reqq_resume(bfa, qid); | ||
194 | } | 218 | } |
195 | 219 | ||
196 | void | 220 | void |
197 | bfa_msix_lpu_err(struct bfa_s *bfa, int vec) | 221 | bfa_msix_lpu_err(struct bfa_s *bfa, int vec) |
198 | { | 222 | { |
199 | u32 intr; | 223 | u32 intr, curr_value; |
200 | 224 | ||
201 | intr = bfa_reg_read(bfa->iocfc.bfa_regs.intr_status); | 225 | intr = bfa_reg_read(bfa->iocfc.bfa_regs.intr_status); |
202 | 226 | ||
203 | if (intr & (__HFN_INT_MBOX_LPU0 | __HFN_INT_MBOX_LPU1)) | 227 | if (intr & (__HFN_INT_MBOX_LPU0 | __HFN_INT_MBOX_LPU1)) |
204 | bfa_msix_lpu(bfa); | 228 | bfa_msix_lpu(bfa); |
205 | 229 | ||
206 | if (intr & (__HFN_INT_ERR_EMC | | 230 | intr &= (__HFN_INT_ERR_EMC | __HFN_INT_ERR_LPU0 | |
207 | __HFN_INT_ERR_LPU0 | __HFN_INT_ERR_LPU1 | | 231 | __HFN_INT_ERR_LPU1 | __HFN_INT_ERR_PSS | __HFN_INT_LL_HALT); |
208 | __HFN_INT_ERR_PSS)) | 232 | |
233 | if (intr) { | ||
234 | if (intr & __HFN_INT_LL_HALT) { | ||
235 | /** | ||
236 | * If LL_HALT bit is set then FW Init Halt LL Port | ||
237 | * Register needs to be cleared as well so Interrupt | ||
238 | * Status Register will be cleared. | ||
239 | */ | ||
240 | curr_value = bfa_reg_read(bfa->ioc.ioc_regs.ll_halt); | ||
241 | curr_value &= ~__FW_INIT_HALT_P; | ||
242 | bfa_reg_write(bfa->ioc.ioc_regs.ll_halt, curr_value); | ||
243 | } | ||
244 | |||
245 | if (intr & __HFN_INT_ERR_PSS) { | ||
246 | /** | ||
247 | * ERR_PSS bit needs to be cleared as well in case | ||
248 | * interrups are shared so driver's interrupt handler is | ||
249 | * still called eventhough it is already masked out. | ||
250 | */ | ||
251 | curr_value = bfa_reg_read( | ||
252 | bfa->ioc.ioc_regs.pss_err_status_reg); | ||
253 | curr_value &= __PSS_ERR_STATUS_SET; | ||
254 | bfa_reg_write(bfa->ioc.ioc_regs.pss_err_status_reg, | ||
255 | curr_value); | ||
256 | } | ||
257 | |||
258 | bfa_reg_write(bfa->iocfc.bfa_regs.intr_status, intr); | ||
209 | bfa_msix_errint(bfa, intr); | 259 | bfa_msix_errint(bfa, intr); |
260 | } | ||
210 | } | 261 | } |
211 | 262 | ||
212 | void | 263 | void |
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index 397d7e9eade5..e038bc9769f6 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c | |||
@@ -18,7 +18,7 @@ | |||
18 | #include <bfa.h> | 18 | #include <bfa.h> |
19 | #include <bfa_ioc.h> | 19 | #include <bfa_ioc.h> |
20 | #include <bfa_fwimg_priv.h> | 20 | #include <bfa_fwimg_priv.h> |
21 | #include <bfa_trcmod_priv.h> | 21 | #include <cna/bfa_cna_trcmod.h> |
22 | #include <cs/bfa_debug.h> | 22 | #include <cs/bfa_debug.h> |
23 | #include <bfi/bfi_ioc.h> | 23 | #include <bfi/bfi_ioc.h> |
24 | #include <bfi/bfi_ctreg.h> | 24 | #include <bfi/bfi_ctreg.h> |
@@ -27,18 +27,17 @@ | |||
27 | #include <log/bfa_log_hal.h> | 27 | #include <log/bfa_log_hal.h> |
28 | #include <defs/bfa_defs_pci.h> | 28 | #include <defs/bfa_defs_pci.h> |
29 | 29 | ||
30 | BFA_TRC_FILE(HAL, IOC); | 30 | BFA_TRC_FILE(CNA, IOC); |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * IOC local definitions | 33 | * IOC local definitions |
34 | */ | 34 | */ |
35 | #define BFA_IOC_TOV 2000 /* msecs */ | 35 | #define BFA_IOC_TOV 2000 /* msecs */ |
36 | #define BFA_IOC_HB_TOV 1000 /* msecs */ | 36 | #define BFA_IOC_HWSEM_TOV 500 /* msecs */ |
37 | #define BFA_IOC_HB_FAIL_MAX 4 | 37 | #define BFA_IOC_HB_TOV 500 /* msecs */ |
38 | #define BFA_IOC_HWINIT_MAX 2 | 38 | #define BFA_IOC_HWINIT_MAX 2 |
39 | #define BFA_IOC_FWIMG_MINSZ (16 * 1024) | 39 | #define BFA_IOC_FWIMG_MINSZ (16 * 1024) |
40 | #define BFA_IOC_TOV_RECOVER (BFA_IOC_HB_FAIL_MAX * BFA_IOC_HB_TOV \ | 40 | #define BFA_IOC_TOV_RECOVER BFA_IOC_HB_TOV |
41 | + BFA_IOC_TOV) | ||
42 | 41 | ||
43 | #define bfa_ioc_timer_start(__ioc) \ | 42 | #define bfa_ioc_timer_start(__ioc) \ |
44 | bfa_timer_begin((__ioc)->timer_mod, &(__ioc)->ioc_timer, \ | 43 | bfa_timer_begin((__ioc)->timer_mod, &(__ioc)->ioc_timer, \ |
@@ -51,12 +50,25 @@ BFA_TRC_FILE(HAL, IOC); | |||
51 | (sizeof(struct bfa_trc_mod_s) - \ | 50 | (sizeof(struct bfa_trc_mod_s) - \ |
52 | BFA_TRC_MAX * sizeof(struct bfa_trc_s))) | 51 | BFA_TRC_MAX * sizeof(struct bfa_trc_s))) |
53 | #define BFA_DBG_FWTRC_OFF(_fn) (BFI_IOC_TRC_OFF + BFA_DBG_FWTRC_LEN * (_fn)) | 52 | #define BFA_DBG_FWTRC_OFF(_fn) (BFI_IOC_TRC_OFF + BFA_DBG_FWTRC_LEN * (_fn)) |
54 | #define bfa_ioc_stats(_ioc, _stats) ((_ioc)->stats._stats++) | ||
55 | 53 | ||
56 | #define BFA_FLASH_CHUNK_NO(off) (off / BFI_FLASH_CHUNK_SZ_WORDS) | 54 | /** |
57 | #define BFA_FLASH_OFFSET_IN_CHUNK(off) (off % BFI_FLASH_CHUNK_SZ_WORDS) | 55 | * Asic specific macros : see bfa_hw_cb.c and bfa_hw_ct.c for details. |
58 | #define BFA_FLASH_CHUNK_ADDR(chunkno) (chunkno * BFI_FLASH_CHUNK_SZ_WORDS) | 56 | */ |
59 | bfa_boolean_t bfa_auto_recover = BFA_FALSE; | 57 | |
58 | #define bfa_ioc_firmware_lock(__ioc) \ | ||
59 | ((__ioc)->ioc_hwif->ioc_firmware_lock(__ioc)) | ||
60 | #define bfa_ioc_firmware_unlock(__ioc) \ | ||
61 | ((__ioc)->ioc_hwif->ioc_firmware_unlock(__ioc)) | ||
62 | #define bfa_ioc_fwimg_get_chunk(__ioc, __off) \ | ||
63 | ((__ioc)->ioc_hwif->ioc_fwimg_get_chunk(__ioc, __off)) | ||
64 | #define bfa_ioc_fwimg_get_size(__ioc) \ | ||
65 | ((__ioc)->ioc_hwif->ioc_fwimg_get_size(__ioc)) | ||
66 | #define bfa_ioc_reg_init(__ioc) ((__ioc)->ioc_hwif->ioc_reg_init(__ioc)) | ||
67 | #define bfa_ioc_map_port(__ioc) ((__ioc)->ioc_hwif->ioc_map_port(__ioc)) | ||
68 | #define bfa_ioc_notify_hbfail(__ioc) \ | ||
69 | ((__ioc)->ioc_hwif->ioc_notify_hbfail(__ioc)) | ||
70 | |||
71 | bfa_boolean_t bfa_auto_recover = BFA_TRUE; | ||
60 | 72 | ||
61 | /* | 73 | /* |
62 | * forward declarations | 74 | * forward declarations |
@@ -64,7 +76,6 @@ bfa_boolean_t bfa_auto_recover = BFA_FALSE; | |||
64 | static void bfa_ioc_aen_post(struct bfa_ioc_s *bfa, | 76 | static void bfa_ioc_aen_post(struct bfa_ioc_s *bfa, |
65 | enum bfa_ioc_aen_event event); | 77 | enum bfa_ioc_aen_event event); |
66 | static void bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc); | 78 | static void bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc); |
67 | static void bfa_ioc_hw_sem_release(struct bfa_ioc_s *ioc); | ||
68 | static void bfa_ioc_hw_sem_get_cancel(struct bfa_ioc_s *ioc); | 79 | static void bfa_ioc_hw_sem_get_cancel(struct bfa_ioc_s *ioc); |
69 | static void bfa_ioc_hwinit(struct bfa_ioc_s *ioc, bfa_boolean_t force); | 80 | static void bfa_ioc_hwinit(struct bfa_ioc_s *ioc, bfa_boolean_t force); |
70 | static void bfa_ioc_timeout(void *ioc); | 81 | static void bfa_ioc_timeout(void *ioc); |
@@ -77,8 +88,6 @@ static void bfa_ioc_reset(struct bfa_ioc_s *ioc, bfa_boolean_t force); | |||
77 | static void bfa_ioc_mbox_poll(struct bfa_ioc_s *ioc); | 88 | static void bfa_ioc_mbox_poll(struct bfa_ioc_s *ioc); |
78 | static void bfa_ioc_mbox_hbfail(struct bfa_ioc_s *ioc); | 89 | static void bfa_ioc_mbox_hbfail(struct bfa_ioc_s *ioc); |
79 | static void bfa_ioc_recover(struct bfa_ioc_s *ioc); | 90 | static void bfa_ioc_recover(struct bfa_ioc_s *ioc); |
80 | static bfa_boolean_t bfa_ioc_firmware_lock(struct bfa_ioc_s *ioc); | ||
81 | static void bfa_ioc_firmware_unlock(struct bfa_ioc_s *ioc); | ||
82 | static void bfa_ioc_disable_comp(struct bfa_ioc_s *ioc); | 91 | static void bfa_ioc_disable_comp(struct bfa_ioc_s *ioc); |
83 | static void bfa_ioc_lpu_stop(struct bfa_ioc_s *ioc); | 92 | static void bfa_ioc_lpu_stop(struct bfa_ioc_s *ioc); |
84 | 93 | ||
@@ -508,14 +517,19 @@ bfa_ioc_sm_disabling(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
508 | bfa_trc(ioc, event); | 517 | bfa_trc(ioc, event); |
509 | 518 | ||
510 | switch (event) { | 519 | switch (event) { |
511 | case IOC_E_HWERROR: | ||
512 | case IOC_E_FWRSP_DISABLE: | 520 | case IOC_E_FWRSP_DISABLE: |
513 | bfa_ioc_timer_stop(ioc); | 521 | bfa_ioc_timer_stop(ioc); |
522 | bfa_fsm_set_state(ioc, bfa_ioc_sm_disabled); | ||
523 | break; | ||
524 | |||
525 | case IOC_E_HWERROR: | ||
526 | bfa_ioc_timer_stop(ioc); | ||
514 | /* | 527 | /* |
515 | * !!! fall through !!! | 528 | * !!! fall through !!! |
516 | */ | 529 | */ |
517 | 530 | ||
518 | case IOC_E_TIMEOUT: | 531 | case IOC_E_TIMEOUT: |
532 | bfa_reg_write(ioc->ioc_regs.ioc_fwstate, BFI_IOC_FAIL); | ||
519 | bfa_fsm_set_state(ioc, bfa_ioc_sm_disabled); | 533 | bfa_fsm_set_state(ioc, bfa_ioc_sm_disabled); |
520 | break; | 534 | break; |
521 | 535 | ||
@@ -608,15 +622,12 @@ bfa_ioc_sm_hbfail_entry(struct bfa_ioc_s *ioc) | |||
608 | * Mark IOC as failed in hardware and stop firmware. | 622 | * Mark IOC as failed in hardware and stop firmware. |
609 | */ | 623 | */ |
610 | bfa_ioc_lpu_stop(ioc); | 624 | bfa_ioc_lpu_stop(ioc); |
611 | bfa_reg_write(ioc->ioc_regs.ioc_fwstate, BFI_IOC_HBFAIL); | 625 | bfa_reg_write(ioc->ioc_regs.ioc_fwstate, BFI_IOC_FAIL); |
612 | 626 | ||
613 | if (ioc->pcidev.device_id == BFA_PCI_DEVICE_ID_CT) { | 627 | /** |
614 | bfa_reg_write(ioc->ioc_regs.ll_halt, __FW_INIT_HALT_P); | 628 | * Notify other functions on HB failure. |
615 | /* | 629 | */ |
616 | * Wait for halt to take effect | 630 | bfa_ioc_notify_hbfail(ioc); |
617 | */ | ||
618 | bfa_reg_read(ioc->ioc_regs.ll_halt); | ||
619 | } | ||
620 | 631 | ||
621 | /** | 632 | /** |
622 | * Notify driver and common modules registered for notification. | 633 | * Notify driver and common modules registered for notification. |
@@ -672,6 +683,12 @@ bfa_ioc_sm_hbfail(struct bfa_ioc_s *ioc, enum ioc_event event) | |||
672 | */ | 683 | */ |
673 | break; | 684 | break; |
674 | 685 | ||
686 | case IOC_E_HWERROR: | ||
687 | /* | ||
688 | * HB failure notification, ignore. | ||
689 | */ | ||
690 | break; | ||
691 | |||
675 | default: | 692 | default: |
676 | bfa_sm_fault(ioc, event); | 693 | bfa_sm_fault(ioc, event); |
677 | } | 694 | } |
@@ -700,7 +717,7 @@ bfa_ioc_disable_comp(struct bfa_ioc_s *ioc) | |||
700 | } | 717 | } |
701 | } | 718 | } |
702 | 719 | ||
703 | static void | 720 | void |
704 | bfa_ioc_sem_timeout(void *ioc_arg) | 721 | bfa_ioc_sem_timeout(void *ioc_arg) |
705 | { | 722 | { |
706 | struct bfa_ioc_s *ioc = (struct bfa_ioc_s *)ioc_arg; | 723 | struct bfa_ioc_s *ioc = (struct bfa_ioc_s *)ioc_arg; |
@@ -708,26 +725,32 @@ bfa_ioc_sem_timeout(void *ioc_arg) | |||
708 | bfa_ioc_hw_sem_get(ioc); | 725 | bfa_ioc_hw_sem_get(ioc); |
709 | } | 726 | } |
710 | 727 | ||
711 | static void | 728 | bfa_boolean_t |
712 | bfa_ioc_usage_sem_get(struct bfa_ioc_s *ioc) | 729 | bfa_ioc_sem_get(bfa_os_addr_t sem_reg) |
713 | { | 730 | { |
714 | u32 r32; | 731 | u32 r32; |
715 | int cnt = 0; | 732 | int cnt = 0; |
716 | #define BFA_SEM_SPINCNT 1000 | 733 | #define BFA_SEM_SPINCNT 3000 |
717 | 734 | ||
718 | do { | 735 | r32 = bfa_reg_read(sem_reg); |
719 | r32 = bfa_reg_read(ioc->ioc_regs.ioc_usage_sem_reg); | 736 | |
737 | while (r32 && (cnt < BFA_SEM_SPINCNT)) { | ||
720 | cnt++; | 738 | cnt++; |
721 | if (cnt > BFA_SEM_SPINCNT) | 739 | bfa_os_udelay(2); |
722 | break; | 740 | r32 = bfa_reg_read(sem_reg); |
723 | } while (r32 != 0); | 741 | } |
742 | |||
743 | if (r32 == 0) | ||
744 | return BFA_TRUE; | ||
745 | |||
724 | bfa_assert(cnt < BFA_SEM_SPINCNT); | 746 | bfa_assert(cnt < BFA_SEM_SPINCNT); |
747 | return BFA_FALSE; | ||
725 | } | 748 | } |
726 | 749 | ||
727 | static void | 750 | void |
728 | bfa_ioc_usage_sem_release(struct bfa_ioc_s *ioc) | 751 | bfa_ioc_sem_release(bfa_os_addr_t sem_reg) |
729 | { | 752 | { |
730 | bfa_reg_write(ioc->ioc_regs.ioc_usage_sem_reg, 1); | 753 | bfa_reg_write(sem_reg, 1); |
731 | } | 754 | } |
732 | 755 | ||
733 | static void | 756 | static void |
@@ -737,7 +760,7 @@ bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc) | |||
737 | 760 | ||
738 | /** | 761 | /** |
739 | * First read to the semaphore register will return 0, subsequent reads | 762 | * First read to the semaphore register will return 0, subsequent reads |
740 | * will return 1. Semaphore is released by writing 0 to the register | 763 | * will return 1. Semaphore is released by writing 1 to the register |
741 | */ | 764 | */ |
742 | r32 = bfa_reg_read(ioc->ioc_regs.ioc_sem_reg); | 765 | r32 = bfa_reg_read(ioc->ioc_regs.ioc_sem_reg); |
743 | if (r32 == 0) { | 766 | if (r32 == 0) { |
@@ -746,10 +769,10 @@ bfa_ioc_hw_sem_get(struct bfa_ioc_s *ioc) | |||
746 | } | 769 | } |
747 | 770 | ||
748 | bfa_timer_begin(ioc->timer_mod, &ioc->sem_timer, bfa_ioc_sem_timeout, | 771 | bfa_timer_begin(ioc->timer_mod, &ioc->sem_timer, bfa_ioc_sem_timeout, |
749 | ioc, BFA_IOC_TOV); | 772 | ioc, BFA_IOC_HWSEM_TOV); |
750 | } | 773 | } |
751 | 774 | ||
752 | static void | 775 | void |
753 | bfa_ioc_hw_sem_release(struct bfa_ioc_s *ioc) | 776 | bfa_ioc_hw_sem_release(struct bfa_ioc_s *ioc) |
754 | { | 777 | { |
755 | bfa_reg_write(ioc->ioc_regs.ioc_sem_reg, 1); | 778 | bfa_reg_write(ioc->ioc_regs.ioc_sem_reg, 1); |
@@ -828,7 +851,7 @@ bfa_ioc_lpu_stop(struct bfa_ioc_s *ioc) | |||
828 | /** | 851 | /** |
829 | * Get driver and firmware versions. | 852 | * Get driver and firmware versions. |
830 | */ | 853 | */ |
831 | static void | 854 | void |
832 | bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr) | 855 | bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr) |
833 | { | 856 | { |
834 | u32 pgnum, pgoff; | 857 | u32 pgnum, pgoff; |
@@ -847,24 +870,10 @@ bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr) | |||
847 | } | 870 | } |
848 | } | 871 | } |
849 | 872 | ||
850 | static u32 * | ||
851 | bfa_ioc_fwimg_get_chunk(struct bfa_ioc_s *ioc, u32 off) | ||
852 | { | ||
853 | if (ioc->ctdev) | ||
854 | return bfi_image_ct_get_chunk(off); | ||
855 | return bfi_image_cb_get_chunk(off); | ||
856 | } | ||
857 | |||
858 | static u32 | ||
859 | bfa_ioc_fwimg_get_size(struct bfa_ioc_s *ioc) | ||
860 | { | ||
861 | return (ioc->ctdev) ? bfi_image_ct_size : bfi_image_cb_size; | ||
862 | } | ||
863 | |||
864 | /** | 873 | /** |
865 | * Returns TRUE if same. | 874 | * Returns TRUE if same. |
866 | */ | 875 | */ |
867 | static bfa_boolean_t | 876 | bfa_boolean_t |
868 | bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr) | 877 | bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr) |
869 | { | 878 | { |
870 | struct bfi_ioc_image_hdr_s *drv_fwhdr; | 879 | struct bfi_ioc_image_hdr_s *drv_fwhdr; |
@@ -921,95 +930,6 @@ bfa_ioc_fwver_valid(struct bfa_ioc_s *ioc) | |||
921 | } | 930 | } |
922 | 931 | ||
923 | /** | 932 | /** |
924 | * Return true if firmware of current driver matches the running firmware. | ||
925 | */ | ||
926 | static bfa_boolean_t | ||
927 | bfa_ioc_firmware_lock(struct bfa_ioc_s *ioc) | ||
928 | { | ||
929 | enum bfi_ioc_state ioc_fwstate; | ||
930 | u32 usecnt; | ||
931 | struct bfi_ioc_image_hdr_s fwhdr; | ||
932 | |||
933 | /** | ||
934 | * Firmware match check is relevant only for CNA. | ||
935 | */ | ||
936 | if (!ioc->cna) | ||
937 | return BFA_TRUE; | ||
938 | |||
939 | /** | ||
940 | * If bios boot (flash based) -- do not increment usage count | ||
941 | */ | ||
942 | if (bfa_ioc_fwimg_get_size(ioc) < BFA_IOC_FWIMG_MINSZ) | ||
943 | return BFA_TRUE; | ||
944 | |||
945 | bfa_ioc_usage_sem_get(ioc); | ||
946 | usecnt = bfa_reg_read(ioc->ioc_regs.ioc_usage_reg); | ||
947 | |||
948 | /** | ||
949 | * If usage count is 0, always return TRUE. | ||
950 | */ | ||
951 | if (usecnt == 0) { | ||
952 | bfa_reg_write(ioc->ioc_regs.ioc_usage_reg, 1); | ||
953 | bfa_ioc_usage_sem_release(ioc); | ||
954 | bfa_trc(ioc, usecnt); | ||
955 | return BFA_TRUE; | ||
956 | } | ||
957 | |||
958 | ioc_fwstate = bfa_reg_read(ioc->ioc_regs.ioc_fwstate); | ||
959 | bfa_trc(ioc, ioc_fwstate); | ||
960 | |||
961 | /** | ||
962 | * Use count cannot be non-zero and chip in uninitialized state. | ||
963 | */ | ||
964 | bfa_assert(ioc_fwstate != BFI_IOC_UNINIT); | ||
965 | |||
966 | /** | ||
967 | * Check if another driver with a different firmware is active | ||
968 | */ | ||
969 | bfa_ioc_fwver_get(ioc, &fwhdr); | ||
970 | if (!bfa_ioc_fwver_cmp(ioc, &fwhdr)) { | ||
971 | bfa_ioc_usage_sem_release(ioc); | ||
972 | bfa_trc(ioc, usecnt); | ||
973 | return BFA_FALSE; | ||
974 | } | ||
975 | |||
976 | /** | ||
977 | * Same firmware version. Increment the reference count. | ||
978 | */ | ||
979 | usecnt++; | ||
980 | bfa_reg_write(ioc->ioc_regs.ioc_usage_reg, usecnt); | ||
981 | bfa_ioc_usage_sem_release(ioc); | ||
982 | bfa_trc(ioc, usecnt); | ||
983 | return BFA_TRUE; | ||
984 | } | ||
985 | |||
986 | static void | ||
987 | bfa_ioc_firmware_unlock(struct bfa_ioc_s *ioc) | ||
988 | { | ||
989 | u32 usecnt; | ||
990 | |||
991 | /** | ||
992 | * Firmware lock is relevant only for CNA. | ||
993 | * If bios boot (flash based) -- do not decrement usage count | ||
994 | */ | ||
995 | if (!ioc->cna || (bfa_ioc_fwimg_get_size(ioc) < BFA_IOC_FWIMG_MINSZ)) | ||
996 | return; | ||
997 | |||
998 | /** | ||
999 | * decrement usage count | ||
1000 | */ | ||
1001 | bfa_ioc_usage_sem_get(ioc); | ||
1002 | usecnt = bfa_reg_read(ioc->ioc_regs.ioc_usage_reg); | ||
1003 | bfa_assert(usecnt > 0); | ||
1004 | |||
1005 | usecnt--; | ||
1006 | bfa_reg_write(ioc->ioc_regs.ioc_usage_reg, usecnt); | ||
1007 | bfa_trc(ioc, usecnt); | ||
1008 | |||
1009 | bfa_ioc_usage_sem_release(ioc); | ||
1010 | } | ||
1011 | |||
1012 | /** | ||
1013 | * Conditionally flush any pending message from firmware at start. | 933 | * Conditionally flush any pending message from firmware at start. |
1014 | */ | 934 | */ |
1015 | static void | 935 | static void |
@@ -1152,33 +1072,27 @@ bfa_ioc_send_getattr(struct bfa_ioc_s *ioc) | |||
1152 | static void | 1072 | static void |
1153 | bfa_ioc_hb_check(void *cbarg) | 1073 | bfa_ioc_hb_check(void *cbarg) |
1154 | { | 1074 | { |
1155 | struct bfa_ioc_s *ioc = cbarg; | 1075 | struct bfa_ioc_s *ioc = cbarg; |
1156 | u32 hb_count; | 1076 | u32 hb_count; |
1157 | 1077 | ||
1158 | hb_count = bfa_reg_read(ioc->ioc_regs.heartbeat); | 1078 | hb_count = bfa_reg_read(ioc->ioc_regs.heartbeat); |
1159 | if (ioc->hb_count == hb_count) { | 1079 | if (ioc->hb_count == hb_count) { |
1160 | ioc->hb_fail++; | 1080 | bfa_log(ioc->logm, BFA_LOG_HAL_HEARTBEAT_FAILURE, |
1161 | } else { | 1081 | hb_count); |
1162 | ioc->hb_count = hb_count; | ||
1163 | ioc->hb_fail = 0; | ||
1164 | } | ||
1165 | |||
1166 | if (ioc->hb_fail >= BFA_IOC_HB_FAIL_MAX) { | ||
1167 | bfa_log(ioc->logm, BFA_LOG_HAL_HEARTBEAT_FAILURE, hb_count); | ||
1168 | ioc->hb_fail = 0; | ||
1169 | bfa_ioc_recover(ioc); | 1082 | bfa_ioc_recover(ioc); |
1170 | return; | 1083 | return; |
1084 | } else { | ||
1085 | ioc->hb_count = hb_count; | ||
1171 | } | 1086 | } |
1172 | 1087 | ||
1173 | bfa_ioc_mbox_poll(ioc); | 1088 | bfa_ioc_mbox_poll(ioc); |
1174 | bfa_timer_begin(ioc->timer_mod, &ioc->ioc_timer, bfa_ioc_hb_check, ioc, | 1089 | bfa_timer_begin(ioc->timer_mod, &ioc->ioc_timer, bfa_ioc_hb_check, |
1175 | BFA_IOC_HB_TOV); | 1090 | ioc, BFA_IOC_HB_TOV); |
1176 | } | 1091 | } |
1177 | 1092 | ||
1178 | static void | 1093 | static void |
1179 | bfa_ioc_hb_monitor(struct bfa_ioc_s *ioc) | 1094 | bfa_ioc_hb_monitor(struct bfa_ioc_s *ioc) |
1180 | { | 1095 | { |
1181 | ioc->hb_fail = 0; | ||
1182 | ioc->hb_count = bfa_reg_read(ioc->ioc_regs.heartbeat); | 1096 | ioc->hb_count = bfa_reg_read(ioc->ioc_regs.heartbeat); |
1183 | bfa_timer_begin(ioc->timer_mod, &ioc->ioc_timer, bfa_ioc_hb_check, ioc, | 1097 | bfa_timer_begin(ioc->timer_mod, &ioc->ioc_timer, bfa_ioc_hb_check, ioc, |
1184 | BFA_IOC_HB_TOV); | 1098 | BFA_IOC_HB_TOV); |
@@ -1191,112 +1105,6 @@ bfa_ioc_hb_stop(struct bfa_ioc_s *ioc) | |||
1191 | } | 1105 | } |
1192 | 1106 | ||
1193 | /** | 1107 | /** |
1194 | * Host to LPU mailbox message addresses | ||
1195 | */ | ||
1196 | static struct { | ||
1197 | u32 hfn_mbox, lpu_mbox, hfn_pgn; | ||
1198 | } iocreg_fnreg[] = { | ||
1199 | { | ||
1200 | HOSTFN0_LPU_MBOX0_0, LPU_HOSTFN0_MBOX0_0, HOST_PAGE_NUM_FN0}, { | ||
1201 | HOSTFN1_LPU_MBOX0_8, LPU_HOSTFN1_MBOX0_8, HOST_PAGE_NUM_FN1}, { | ||
1202 | HOSTFN2_LPU_MBOX0_0, LPU_HOSTFN2_MBOX0_0, HOST_PAGE_NUM_FN2}, { | ||
1203 | HOSTFN3_LPU_MBOX0_8, LPU_HOSTFN3_MBOX0_8, HOST_PAGE_NUM_FN3} | ||
1204 | }; | ||
1205 | |||
1206 | /** | ||
1207 | * Host <-> LPU mailbox command/status registers - port 0 | ||
1208 | */ | ||
1209 | static struct { | ||
1210 | u32 hfn, lpu; | ||
1211 | } iocreg_mbcmd_p0[] = { | ||
1212 | { | ||
1213 | HOSTFN0_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN0_MBOX0_CMD_STAT}, { | ||
1214 | HOSTFN1_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN1_MBOX0_CMD_STAT}, { | ||
1215 | HOSTFN2_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN2_MBOX0_CMD_STAT}, { | ||
1216 | HOSTFN3_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN3_MBOX0_CMD_STAT} | ||
1217 | }; | ||
1218 | |||
1219 | /** | ||
1220 | * Host <-> LPU mailbox command/status registers - port 1 | ||
1221 | */ | ||
1222 | static struct { | ||
1223 | u32 hfn, lpu; | ||
1224 | } iocreg_mbcmd_p1[] = { | ||
1225 | { | ||
1226 | HOSTFN0_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN0_MBOX0_CMD_STAT}, { | ||
1227 | HOSTFN1_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN1_MBOX0_CMD_STAT}, { | ||
1228 | HOSTFN2_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN2_MBOX0_CMD_STAT}, { | ||
1229 | HOSTFN3_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN3_MBOX0_CMD_STAT} | ||
1230 | }; | ||
1231 | |||
1232 | /** | ||
1233 | * Shared IRQ handling in INTX mode | ||
1234 | */ | ||
1235 | static struct { | ||
1236 | u32 isr, msk; | ||
1237 | } iocreg_shirq_next[] = { | ||
1238 | { | ||
1239 | HOSTFN1_INT_STATUS, HOSTFN1_INT_MSK}, { | ||
1240 | HOSTFN2_INT_STATUS, HOSTFN2_INT_MSK}, { | ||
1241 | HOSTFN3_INT_STATUS, HOSTFN3_INT_MSK}, { | ||
1242 | HOSTFN0_INT_STATUS, HOSTFN0_INT_MSK},}; | ||
1243 | |||
1244 | static void | ||
1245 | bfa_ioc_reg_init(struct bfa_ioc_s *ioc) | ||
1246 | { | ||
1247 | bfa_os_addr_t rb; | ||
1248 | int pcifn = bfa_ioc_pcifn(ioc); | ||
1249 | |||
1250 | rb = bfa_ioc_bar0(ioc); | ||
1251 | |||
1252 | ioc->ioc_regs.hfn_mbox = rb + iocreg_fnreg[pcifn].hfn_mbox; | ||
1253 | ioc->ioc_regs.lpu_mbox = rb + iocreg_fnreg[pcifn].lpu_mbox; | ||
1254 | ioc->ioc_regs.host_page_num_fn = rb + iocreg_fnreg[pcifn].hfn_pgn; | ||
1255 | |||
1256 | if (ioc->port_id == 0) { | ||
1257 | ioc->ioc_regs.heartbeat = rb + BFA_IOC0_HBEAT_REG; | ||
1258 | ioc->ioc_regs.ioc_fwstate = rb + BFA_IOC0_STATE_REG; | ||
1259 | ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd_p0[pcifn].hfn; | ||
1260 | ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd_p0[pcifn].lpu; | ||
1261 | ioc->ioc_regs.ll_halt = rb + FW_INIT_HALT_P0; | ||
1262 | } else { | ||
1263 | ioc->ioc_regs.heartbeat = (rb + BFA_IOC1_HBEAT_REG); | ||
1264 | ioc->ioc_regs.ioc_fwstate = (rb + BFA_IOC1_STATE_REG); | ||
1265 | ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd_p1[pcifn].hfn; | ||
1266 | ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd_p1[pcifn].lpu; | ||
1267 | ioc->ioc_regs.ll_halt = rb + FW_INIT_HALT_P1; | ||
1268 | } | ||
1269 | |||
1270 | /** | ||
1271 | * Shared IRQ handling in INTX mode | ||
1272 | */ | ||
1273 | ioc->ioc_regs.shirq_isr_next = rb + iocreg_shirq_next[pcifn].isr; | ||
1274 | ioc->ioc_regs.shirq_msk_next = rb + iocreg_shirq_next[pcifn].msk; | ||
1275 | |||
1276 | /* | ||
1277 | * PSS control registers | ||
1278 | */ | ||
1279 | ioc->ioc_regs.pss_ctl_reg = (rb + PSS_CTL_REG); | ||
1280 | ioc->ioc_regs.app_pll_fast_ctl_reg = (rb + APP_PLL_425_CTL_REG); | ||
1281 | ioc->ioc_regs.app_pll_slow_ctl_reg = (rb + APP_PLL_312_CTL_REG); | ||
1282 | |||
1283 | /* | ||
1284 | * IOC semaphore registers and serialization | ||
1285 | */ | ||
1286 | ioc->ioc_regs.ioc_sem_reg = (rb + HOST_SEM0_REG); | ||
1287 | ioc->ioc_regs.ioc_usage_sem_reg = (rb + HOST_SEM1_REG); | ||
1288 | ioc->ioc_regs.ioc_usage_reg = (rb + BFA_FW_USE_COUNT); | ||
1289 | |||
1290 | /** | ||
1291 | * sram memory access | ||
1292 | */ | ||
1293 | ioc->ioc_regs.smem_page_start = (rb + PSS_SMEM_PAGE_START); | ||
1294 | ioc->ioc_regs.smem_pg0 = BFI_IOC_SMEM_PG0_CB; | ||
1295 | if (ioc->pcidev.device_id == BFA_PCI_DEVICE_ID_CT) | ||
1296 | ioc->ioc_regs.smem_pg0 = BFI_IOC_SMEM_PG0_CT; | ||
1297 | } | ||
1298 | |||
1299 | /** | ||
1300 | * Initiate a full firmware download. | 1108 | * Initiate a full firmware download. |
1301 | */ | 1109 | */ |
1302 | static void | 1110 | static void |
@@ -1321,9 +1129,6 @@ bfa_ioc_download_fw(struct bfa_ioc_s *ioc, u32 boot_type, | |||
1321 | if (bfa_ioc_fwimg_get_size(ioc) < BFA_IOC_FWIMG_MINSZ) | 1129 | if (bfa_ioc_fwimg_get_size(ioc) < BFA_IOC_FWIMG_MINSZ) |
1322 | boot_type = BFI_BOOT_TYPE_FLASH; | 1130 | boot_type = BFI_BOOT_TYPE_FLASH; |
1323 | fwimg = bfa_ioc_fwimg_get_chunk(ioc, chunkno); | 1131 | fwimg = bfa_ioc_fwimg_get_chunk(ioc, chunkno); |
1324 | fwimg[BFI_BOOT_TYPE_OFF / sizeof(u32)] = bfa_os_swap32(boot_type); | ||
1325 | fwimg[BFI_BOOT_PARAM_OFF / sizeof(u32)] = | ||
1326 | bfa_os_swap32(boot_param); | ||
1327 | 1132 | ||
1328 | pgnum = bfa_ioc_smem_pgnum(ioc, loff); | 1133 | pgnum = bfa_ioc_smem_pgnum(ioc, loff); |
1329 | pgoff = bfa_ioc_smem_pgoff(ioc, loff); | 1134 | pgoff = bfa_ioc_smem_pgoff(ioc, loff); |
@@ -1332,17 +1137,17 @@ bfa_ioc_download_fw(struct bfa_ioc_s *ioc, u32 boot_type, | |||
1332 | 1137 | ||
1333 | for (i = 0; i < bfa_ioc_fwimg_get_size(ioc); i++) { | 1138 | for (i = 0; i < bfa_ioc_fwimg_get_size(ioc); i++) { |
1334 | 1139 | ||
1335 | if (BFA_FLASH_CHUNK_NO(i) != chunkno) { | 1140 | if (BFA_IOC_FLASH_CHUNK_NO(i) != chunkno) { |
1336 | chunkno = BFA_FLASH_CHUNK_NO(i); | 1141 | chunkno = BFA_IOC_FLASH_CHUNK_NO(i); |
1337 | fwimg = bfa_ioc_fwimg_get_chunk(ioc, | 1142 | fwimg = bfa_ioc_fwimg_get_chunk(ioc, |
1338 | BFA_FLASH_CHUNK_ADDR(chunkno)); | 1143 | BFA_IOC_FLASH_CHUNK_ADDR(chunkno)); |
1339 | } | 1144 | } |
1340 | 1145 | ||
1341 | /** | 1146 | /** |
1342 | * write smem | 1147 | * write smem |
1343 | */ | 1148 | */ |
1344 | bfa_mem_write(ioc->ioc_regs.smem_page_start, loff, | 1149 | bfa_mem_write(ioc->ioc_regs.smem_page_start, loff, |
1345 | fwimg[BFA_FLASH_OFFSET_IN_CHUNK(i)]); | 1150 | fwimg[BFA_IOC_FLASH_OFFSET_IN_CHUNK(i)]); |
1346 | 1151 | ||
1347 | loff += sizeof(u32); | 1152 | loff += sizeof(u32); |
1348 | 1153 | ||
@@ -1358,6 +1163,14 @@ bfa_ioc_download_fw(struct bfa_ioc_s *ioc, u32 boot_type, | |||
1358 | 1163 | ||
1359 | bfa_reg_write(ioc->ioc_regs.host_page_num_fn, | 1164 | bfa_reg_write(ioc->ioc_regs.host_page_num_fn, |
1360 | bfa_ioc_smem_pgnum(ioc, 0)); | 1165 | bfa_ioc_smem_pgnum(ioc, 0)); |
1166 | |||
1167 | /* | ||
1168 | * Set boot type and boot param at the end. | ||
1169 | */ | ||
1170 | bfa_mem_write(ioc->ioc_regs.smem_page_start, BFI_BOOT_TYPE_OFF, | ||
1171 | bfa_os_swap32(boot_type)); | ||
1172 | bfa_mem_write(ioc->ioc_regs.smem_page_start, BFI_BOOT_PARAM_OFF, | ||
1173 | bfa_os_swap32(boot_param)); | ||
1361 | } | 1174 | } |
1362 | 1175 | ||
1363 | static void | 1176 | static void |
@@ -1440,168 +1253,10 @@ bfa_ioc_mbox_hbfail(struct bfa_ioc_s *ioc) | |||
1440 | } | 1253 | } |
1441 | 1254 | ||
1442 | /** | 1255 | /** |
1443 | * Initialize IOC to port mapping. | ||
1444 | */ | ||
1445 | |||
1446 | #define FNC_PERS_FN_SHIFT(__fn) ((__fn) * 8) | ||
1447 | static void | ||
1448 | bfa_ioc_map_port(struct bfa_ioc_s *ioc) | ||
1449 | { | ||
1450 | bfa_os_addr_t rb = ioc->pcidev.pci_bar_kva; | ||
1451 | u32 r32; | ||
1452 | |||
1453 | /** | ||
1454 | * For crossbow, port id is same as pci function. | ||
1455 | */ | ||
1456 | if (ioc->pcidev.device_id != BFA_PCI_DEVICE_ID_CT) { | ||
1457 | ioc->port_id = bfa_ioc_pcifn(ioc); | ||
1458 | return; | ||
1459 | } | ||
1460 | |||
1461 | /** | ||
1462 | * For catapult, base port id on personality register and IOC type | ||
1463 | */ | ||
1464 | r32 = bfa_reg_read(rb + FNC_PERS_REG); | ||
1465 | r32 >>= FNC_PERS_FN_SHIFT(bfa_ioc_pcifn(ioc)); | ||
1466 | ioc->port_id = (r32 & __F0_PORT_MAP_MK) >> __F0_PORT_MAP_SH; | ||
1467 | |||
1468 | bfa_trc(ioc, bfa_ioc_pcifn(ioc)); | ||
1469 | bfa_trc(ioc, ioc->port_id); | ||
1470 | } | ||
1471 | |||
1472 | |||
1473 | |||
1474 | /** | ||
1475 | * bfa_ioc_public | 1256 | * bfa_ioc_public |
1476 | */ | 1257 | */ |
1477 | 1258 | ||
1478 | /** | 1259 | /** |
1479 | * Set interrupt mode for a function: INTX or MSIX | ||
1480 | */ | ||
1481 | void | ||
1482 | bfa_ioc_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix) | ||
1483 | { | ||
1484 | bfa_os_addr_t rb = ioc->pcidev.pci_bar_kva; | ||
1485 | u32 r32, mode; | ||
1486 | |||
1487 | r32 = bfa_reg_read(rb + FNC_PERS_REG); | ||
1488 | bfa_trc(ioc, r32); | ||
1489 | |||
1490 | mode = (r32 >> FNC_PERS_FN_SHIFT(bfa_ioc_pcifn(ioc))) & | ||
1491 | __F0_INTX_STATUS; | ||
1492 | |||
1493 | /** | ||
1494 | * If already in desired mode, do not change anything | ||
1495 | */ | ||
1496 | if (!msix && mode) | ||
1497 | return; | ||
1498 | |||
1499 | if (msix) | ||
1500 | mode = __F0_INTX_STATUS_MSIX; | ||
1501 | else | ||
1502 | mode = __F0_INTX_STATUS_INTA; | ||
1503 | |||
1504 | r32 &= ~(__F0_INTX_STATUS << FNC_PERS_FN_SHIFT(bfa_ioc_pcifn(ioc))); | ||
1505 | r32 |= (mode << FNC_PERS_FN_SHIFT(bfa_ioc_pcifn(ioc))); | ||
1506 | bfa_trc(ioc, r32); | ||
1507 | |||
1508 | bfa_reg_write(rb + FNC_PERS_REG, r32); | ||
1509 | } | ||
1510 | |||
1511 | bfa_status_t | ||
1512 | bfa_ioc_pll_init(struct bfa_ioc_s *ioc) | ||
1513 | { | ||
1514 | bfa_os_addr_t rb = ioc->pcidev.pci_bar_kva; | ||
1515 | u32 pll_sclk, pll_fclk, r32; | ||
1516 | |||
1517 | if (ioc->pcidev.device_id == BFA_PCI_DEVICE_ID_CT) { | ||
1518 | pll_sclk = | ||
1519 | __APP_PLL_312_ENABLE | __APP_PLL_312_LRESETN | | ||
1520 | __APP_PLL_312_RSEL200500 | __APP_PLL_312_P0_1(0U) | | ||
1521 | __APP_PLL_312_JITLMT0_1(3U) | | ||
1522 | __APP_PLL_312_CNTLMT0_1(1U); | ||
1523 | pll_fclk = | ||
1524 | __APP_PLL_425_ENABLE | __APP_PLL_425_LRESETN | | ||
1525 | __APP_PLL_425_RSEL200500 | __APP_PLL_425_P0_1(0U) | | ||
1526 | __APP_PLL_425_JITLMT0_1(3U) | | ||
1527 | __APP_PLL_425_CNTLMT0_1(1U); | ||
1528 | |||
1529 | /** | ||
1530 | * For catapult, choose operational mode FC/FCoE | ||
1531 | */ | ||
1532 | if (ioc->fcmode) { | ||
1533 | bfa_reg_write((rb + OP_MODE), 0); | ||
1534 | bfa_reg_write((rb + ETH_MAC_SER_REG), | ||
1535 | __APP_EMS_CMLCKSEL | __APP_EMS_REFCKBUFEN2 | ||
1536 | | __APP_EMS_CHANNEL_SEL); | ||
1537 | } else { | ||
1538 | ioc->pllinit = BFA_TRUE; | ||
1539 | bfa_reg_write((rb + OP_MODE), __GLOBAL_FCOE_MODE); | ||
1540 | bfa_reg_write((rb + ETH_MAC_SER_REG), | ||
1541 | __APP_EMS_REFCKBUFEN1); | ||
1542 | } | ||
1543 | } else { | ||
1544 | pll_sclk = | ||
1545 | __APP_PLL_312_ENABLE | __APP_PLL_312_LRESETN | | ||
1546 | __APP_PLL_312_P0_1(3U) | __APP_PLL_312_JITLMT0_1(3U) | | ||
1547 | __APP_PLL_312_CNTLMT0_1(3U); | ||
1548 | pll_fclk = | ||
1549 | __APP_PLL_425_ENABLE | __APP_PLL_425_LRESETN | | ||
1550 | __APP_PLL_425_RSEL200500 | __APP_PLL_425_P0_1(3U) | | ||
1551 | __APP_PLL_425_JITLMT0_1(3U) | | ||
1552 | __APP_PLL_425_CNTLMT0_1(3U); | ||
1553 | } | ||
1554 | |||
1555 | bfa_reg_write((rb + BFA_IOC0_STATE_REG), BFI_IOC_UNINIT); | ||
1556 | bfa_reg_write((rb + BFA_IOC1_STATE_REG), BFI_IOC_UNINIT); | ||
1557 | |||
1558 | bfa_reg_write((rb + HOSTFN0_INT_MSK), 0xffffffffU); | ||
1559 | bfa_reg_write((rb + HOSTFN1_INT_MSK), 0xffffffffU); | ||
1560 | bfa_reg_write((rb + HOSTFN0_INT_STATUS), 0xffffffffU); | ||
1561 | bfa_reg_write((rb + HOSTFN1_INT_STATUS), 0xffffffffU); | ||
1562 | bfa_reg_write((rb + HOSTFN0_INT_MSK), 0xffffffffU); | ||
1563 | bfa_reg_write((rb + HOSTFN1_INT_MSK), 0xffffffffU); | ||
1564 | |||
1565 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, | ||
1566 | __APP_PLL_312_LOGIC_SOFT_RESET); | ||
1567 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, | ||
1568 | __APP_PLL_312_BYPASS | __APP_PLL_312_LOGIC_SOFT_RESET); | ||
1569 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, | ||
1570 | __APP_PLL_425_LOGIC_SOFT_RESET); | ||
1571 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, | ||
1572 | __APP_PLL_425_BYPASS | __APP_PLL_425_LOGIC_SOFT_RESET); | ||
1573 | bfa_os_udelay(2); | ||
1574 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, | ||
1575 | __APP_PLL_312_LOGIC_SOFT_RESET); | ||
1576 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, | ||
1577 | __APP_PLL_425_LOGIC_SOFT_RESET); | ||
1578 | |||
1579 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, | ||
1580 | pll_sclk | __APP_PLL_312_LOGIC_SOFT_RESET); | ||
1581 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, | ||
1582 | pll_fclk | __APP_PLL_425_LOGIC_SOFT_RESET); | ||
1583 | |||
1584 | /** | ||
1585 | * Wait for PLLs to lock. | ||
1586 | */ | ||
1587 | bfa_os_udelay(2000); | ||
1588 | bfa_reg_write((rb + HOSTFN0_INT_STATUS), 0xffffffffU); | ||
1589 | bfa_reg_write((rb + HOSTFN1_INT_STATUS), 0xffffffffU); | ||
1590 | |||
1591 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, pll_sclk); | ||
1592 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, pll_fclk); | ||
1593 | |||
1594 | if (ioc->pcidev.device_id == BFA_PCI_DEVICE_ID_CT) { | ||
1595 | bfa_reg_write((rb + MBIST_CTL_REG), __EDRAM_BISTR_START); | ||
1596 | bfa_os_udelay(1000); | ||
1597 | r32 = bfa_reg_read((rb + MBIST_STAT_REG)); | ||
1598 | bfa_trc(ioc, r32); | ||
1599 | } | ||
1600 | |||
1601 | return BFA_STATUS_OK; | ||
1602 | } | ||
1603 | |||
1604 | /** | ||
1605 | * Interface used by diag module to do firmware boot with memory test | 1260 | * Interface used by diag module to do firmware boot with memory test |
1606 | * as the entry vector. | 1261 | * as the entry vector. |
1607 | */ | 1262 | */ |
@@ -1642,7 +1297,7 @@ bfa_ioc_boot(struct bfa_ioc_s *ioc, u32 boot_type, u32 boot_param) | |||
1642 | void | 1297 | void |
1643 | bfa_ioc_auto_recover(bfa_boolean_t auto_recover) | 1298 | bfa_ioc_auto_recover(bfa_boolean_t auto_recover) |
1644 | { | 1299 | { |
1645 | bfa_auto_recover = BFA_FALSE; | 1300 | bfa_auto_recover = auto_recover; |
1646 | } | 1301 | } |
1647 | 1302 | ||
1648 | 1303 | ||
@@ -1764,6 +1419,14 @@ bfa_ioc_pci_init(struct bfa_ioc_s *ioc, struct bfa_pcidev_s *pcidev, | |||
1764 | ioc->ctdev = (ioc->pcidev.device_id == BFA_PCI_DEVICE_ID_CT); | 1419 | ioc->ctdev = (ioc->pcidev.device_id == BFA_PCI_DEVICE_ID_CT); |
1765 | ioc->cna = ioc->ctdev && !ioc->fcmode; | 1420 | ioc->cna = ioc->ctdev && !ioc->fcmode; |
1766 | 1421 | ||
1422 | /** | ||
1423 | * Set asic specific interfaces. See bfa_ioc_cb.c and bfa_ioc_ct.c | ||
1424 | */ | ||
1425 | if (ioc->ctdev) | ||
1426 | bfa_ioc_set_ct_hwif(ioc); | ||
1427 | else | ||
1428 | bfa_ioc_set_cb_hwif(ioc); | ||
1429 | |||
1767 | bfa_ioc_map_port(ioc); | 1430 | bfa_ioc_map_port(ioc); |
1768 | bfa_ioc_reg_init(ioc); | 1431 | bfa_ioc_reg_init(ioc); |
1769 | } | 1432 | } |
@@ -1830,7 +1493,6 @@ return (auto_recover) ? BFA_DBG_FWTRC_LEN : 0; | |||
1830 | void | 1493 | void |
1831 | bfa_ioc_debug_memclaim(struct bfa_ioc_s *ioc, void *dbg_fwsave) | 1494 | bfa_ioc_debug_memclaim(struct bfa_ioc_s *ioc, void *dbg_fwsave) |
1832 | { | 1495 | { |
1833 | bfa_assert(ioc->auto_recover); | ||
1834 | ioc->dbg_fwsave = dbg_fwsave; | 1496 | ioc->dbg_fwsave = dbg_fwsave; |
1835 | ioc->dbg_fwsave_len = bfa_ioc_debug_trcsz(ioc->auto_recover); | 1497 | ioc->dbg_fwsave_len = bfa_ioc_debug_trcsz(ioc->auto_recover); |
1836 | } | 1498 | } |
@@ -1973,7 +1635,7 @@ bfa_ioc_fw_mismatch(struct bfa_ioc_s *ioc) | |||
1973 | ((__sm) == BFI_IOC_INITING) || \ | 1635 | ((__sm) == BFI_IOC_INITING) || \ |
1974 | ((__sm) == BFI_IOC_HWINIT) || \ | 1636 | ((__sm) == BFI_IOC_HWINIT) || \ |
1975 | ((__sm) == BFI_IOC_DISABLED) || \ | 1637 | ((__sm) == BFI_IOC_DISABLED) || \ |
1976 | ((__sm) == BFI_IOC_HBFAIL) || \ | 1638 | ((__sm) == BFI_IOC_FAIL) || \ |
1977 | ((__sm) == BFI_IOC_CFG_DISABLED)) | 1639 | ((__sm) == BFI_IOC_CFG_DISABLED)) |
1978 | 1640 | ||
1979 | /** | 1641 | /** |
@@ -2017,46 +1679,28 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, | |||
2017 | struct bfa_adapter_attr_s *ad_attr) | 1679 | struct bfa_adapter_attr_s *ad_attr) |
2018 | { | 1680 | { |
2019 | struct bfi_ioc_attr_s *ioc_attr; | 1681 | struct bfi_ioc_attr_s *ioc_attr; |
2020 | char model[BFA_ADAPTER_MODEL_NAME_LEN]; | ||
2021 | 1682 | ||
2022 | ioc_attr = ioc->attr; | 1683 | ioc_attr = ioc->attr; |
2023 | bfa_os_memcpy((void *)&ad_attr->serial_num, | 1684 | |
2024 | (void *)ioc_attr->brcd_serialnum, | 1685 | bfa_ioc_get_adapter_serial_num(ioc, ad_attr->serial_num); |
2025 | BFA_ADAPTER_SERIAL_NUM_LEN); | 1686 | bfa_ioc_get_adapter_fw_ver(ioc, ad_attr->fw_ver); |
2026 | 1687 | bfa_ioc_get_adapter_optrom_ver(ioc, ad_attr->optrom_ver); | |
2027 | bfa_os_memcpy(&ad_attr->fw_ver, ioc_attr->fw_version, BFA_VERSION_LEN); | 1688 | bfa_ioc_get_adapter_manufacturer(ioc, ad_attr->manufacturer); |
2028 | bfa_os_memcpy(&ad_attr->optrom_ver, ioc_attr->optrom_version, | ||
2029 | BFA_VERSION_LEN); | ||
2030 | bfa_os_memcpy(&ad_attr->manufacturer, BFA_MFG_NAME, | ||
2031 | BFA_ADAPTER_MFG_NAME_LEN); | ||
2032 | bfa_os_memcpy(&ad_attr->vpd, &ioc_attr->vpd, | 1689 | bfa_os_memcpy(&ad_attr->vpd, &ioc_attr->vpd, |
2033 | sizeof(struct bfa_mfg_vpd_s)); | 1690 | sizeof(struct bfa_mfg_vpd_s)); |
2034 | 1691 | ||
2035 | ad_attr->nports = BFI_ADAPTER_GETP(NPORTS, ioc_attr->adapter_prop); | 1692 | ad_attr->nports = bfa_ioc_get_nports(ioc); |
2036 | ad_attr->max_speed = BFI_ADAPTER_GETP(SPEED, ioc_attr->adapter_prop); | 1693 | ad_attr->max_speed = bfa_ioc_speed_sup(ioc); |
2037 | 1694 | ||
2038 | /** | 1695 | bfa_ioc_get_adapter_model(ioc, ad_attr->model); |
2039 | * model name | 1696 | /* For now, model descr uses same model string */ |
2040 | */ | 1697 | bfa_ioc_get_adapter_model(ioc, ad_attr->model_descr); |
2041 | if (BFI_ADAPTER_GETP(SPEED, ioc_attr->adapter_prop) == 10) { | ||
2042 | strcpy(model, "BR-10?0"); | ||
2043 | model[5] = '0' + ad_attr->nports; | ||
2044 | } else { | ||
2045 | strcpy(model, "Brocade-??5"); | ||
2046 | model[8] = | ||
2047 | '0' + BFI_ADAPTER_GETP(SPEED, ioc_attr->adapter_prop); | ||
2048 | model[9] = '0' + ad_attr->nports; | ||
2049 | } | ||
2050 | 1698 | ||
2051 | if (BFI_ADAPTER_IS_SPECIAL(ioc_attr->adapter_prop)) | 1699 | if (BFI_ADAPTER_IS_SPECIAL(ioc_attr->adapter_prop)) |
2052 | ad_attr->prototype = 1; | 1700 | ad_attr->prototype = 1; |
2053 | else | 1701 | else |
2054 | ad_attr->prototype = 0; | 1702 | ad_attr->prototype = 0; |
2055 | 1703 | ||
2056 | bfa_os_memcpy(&ad_attr->model, model, BFA_ADAPTER_MODEL_NAME_LEN); | ||
2057 | bfa_os_memcpy(&ad_attr->model_descr, &ad_attr->model, | ||
2058 | BFA_ADAPTER_MODEL_NAME_LEN); | ||
2059 | |||
2060 | ad_attr->pwwn = bfa_ioc_get_pwwn(ioc); | 1704 | ad_attr->pwwn = bfa_ioc_get_pwwn(ioc); |
2061 | ad_attr->mac = bfa_ioc_get_mac(ioc); | 1705 | ad_attr->mac = bfa_ioc_get_mac(ioc); |
2062 | 1706 | ||
@@ -2064,41 +1708,122 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, | |||
2064 | ad_attr->pcie_lanes = ioc_attr->pcie_lanes; | 1708 | ad_attr->pcie_lanes = ioc_attr->pcie_lanes; |
2065 | ad_attr->pcie_lanes_orig = ioc_attr->pcie_lanes_orig; | 1709 | ad_attr->pcie_lanes_orig = ioc_attr->pcie_lanes_orig; |
2066 | ad_attr->asic_rev = ioc_attr->asic_rev; | 1710 | ad_attr->asic_rev = ioc_attr->asic_rev; |
2067 | ad_attr->hw_ver[0] = 'R'; | 1711 | |
2068 | ad_attr->hw_ver[1] = 'e'; | 1712 | bfa_ioc_get_pci_chip_rev(ioc, ad_attr->hw_ver); |
2069 | ad_attr->hw_ver[2] = 'v'; | ||
2070 | ad_attr->hw_ver[3] = '-'; | ||
2071 | ad_attr->hw_ver[4] = ioc_attr->asic_rev; | ||
2072 | ad_attr->hw_ver[5] = '\0'; | ||
2073 | 1713 | ||
2074 | ad_attr->cna_capable = ioc->cna; | 1714 | ad_attr->cna_capable = ioc->cna; |
2075 | } | 1715 | } |
2076 | 1716 | ||
1717 | enum bfa_ioc_type_e | ||
1718 | bfa_ioc_get_type(struct bfa_ioc_s *ioc) | ||
1719 | { | ||
1720 | if (!ioc->ctdev || ioc->fcmode) | ||
1721 | return BFA_IOC_TYPE_FC; | ||
1722 | else if (ioc->ioc_mc == BFI_MC_IOCFC) | ||
1723 | return BFA_IOC_TYPE_FCoE; | ||
1724 | else if (ioc->ioc_mc == BFI_MC_LL) | ||
1725 | return BFA_IOC_TYPE_LL; | ||
1726 | else { | ||
1727 | bfa_assert(ioc->ioc_mc == BFI_MC_LL); | ||
1728 | return BFA_IOC_TYPE_LL; | ||
1729 | } | ||
1730 | } | ||
1731 | |||
1732 | void | ||
1733 | bfa_ioc_get_adapter_serial_num(struct bfa_ioc_s *ioc, char *serial_num) | ||
1734 | { | ||
1735 | bfa_os_memset((void *)serial_num, 0, BFA_ADAPTER_SERIAL_NUM_LEN); | ||
1736 | bfa_os_memcpy((void *)serial_num, | ||
1737 | (void *)ioc->attr->brcd_serialnum, | ||
1738 | BFA_ADAPTER_SERIAL_NUM_LEN); | ||
1739 | } | ||
1740 | |||
1741 | void | ||
1742 | bfa_ioc_get_adapter_fw_ver(struct bfa_ioc_s *ioc, char *fw_ver) | ||
1743 | { | ||
1744 | bfa_os_memset((void *)fw_ver, 0, BFA_VERSION_LEN); | ||
1745 | bfa_os_memcpy(fw_ver, ioc->attr->fw_version, BFA_VERSION_LEN); | ||
1746 | } | ||
1747 | |||
1748 | void | ||
1749 | bfa_ioc_get_pci_chip_rev(struct bfa_ioc_s *ioc, char *chip_rev) | ||
1750 | { | ||
1751 | bfa_assert(chip_rev); | ||
1752 | |||
1753 | bfa_os_memset((void *)chip_rev, 0, BFA_IOC_CHIP_REV_LEN); | ||
1754 | |||
1755 | chip_rev[0] = 'R'; | ||
1756 | chip_rev[1] = 'e'; | ||
1757 | chip_rev[2] = 'v'; | ||
1758 | chip_rev[3] = '-'; | ||
1759 | chip_rev[4] = ioc->attr->asic_rev; | ||
1760 | chip_rev[5] = '\0'; | ||
1761 | } | ||
1762 | |||
1763 | void | ||
1764 | bfa_ioc_get_adapter_optrom_ver(struct bfa_ioc_s *ioc, char *optrom_ver) | ||
1765 | { | ||
1766 | bfa_os_memset((void *)optrom_ver, 0, BFA_VERSION_LEN); | ||
1767 | bfa_os_memcpy(optrom_ver, ioc->attr->optrom_version, | ||
1768 | BFA_VERSION_LEN); | ||
1769 | } | ||
1770 | |||
1771 | void | ||
1772 | bfa_ioc_get_adapter_manufacturer(struct bfa_ioc_s *ioc, char *manufacturer) | ||
1773 | { | ||
1774 | bfa_os_memset((void *)manufacturer, 0, BFA_ADAPTER_MFG_NAME_LEN); | ||
1775 | bfa_os_memcpy(manufacturer, BFA_MFG_NAME, BFA_ADAPTER_MFG_NAME_LEN); | ||
1776 | } | ||
1777 | |||
1778 | void | ||
1779 | bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model) | ||
1780 | { | ||
1781 | struct bfi_ioc_attr_s *ioc_attr; | ||
1782 | u8 nports; | ||
1783 | u8 max_speed; | ||
1784 | |||
1785 | bfa_assert(model); | ||
1786 | bfa_os_memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN); | ||
1787 | |||
1788 | ioc_attr = ioc->attr; | ||
1789 | |||
1790 | nports = bfa_ioc_get_nports(ioc); | ||
1791 | max_speed = bfa_ioc_speed_sup(ioc); | ||
1792 | |||
1793 | /** | ||
1794 | * model name | ||
1795 | */ | ||
1796 | if (max_speed == 10) { | ||
1797 | strcpy(model, "BR-10?0"); | ||
1798 | model[5] = '0' + nports; | ||
1799 | } else { | ||
1800 | strcpy(model, "Brocade-??5"); | ||
1801 | model[8] = '0' + max_speed; | ||
1802 | model[9] = '0' + nports; | ||
1803 | } | ||
1804 | } | ||
1805 | |||
1806 | enum bfa_ioc_state | ||
1807 | bfa_ioc_get_state(struct bfa_ioc_s *ioc) | ||
1808 | { | ||
1809 | return bfa_sm_to_state(ioc_sm_table, ioc->fsm); | ||
1810 | } | ||
1811 | |||
2077 | void | 1812 | void |
2078 | bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr) | 1813 | bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr) |
2079 | { | 1814 | { |
2080 | bfa_os_memset((void *)ioc_attr, 0, sizeof(struct bfa_ioc_attr_s)); | 1815 | bfa_os_memset((void *)ioc_attr, 0, sizeof(struct bfa_ioc_attr_s)); |
2081 | 1816 | ||
2082 | ioc_attr->state = bfa_sm_to_state(ioc_sm_table, ioc->fsm); | 1817 | ioc_attr->state = bfa_ioc_get_state(ioc); |
2083 | ioc_attr->port_id = ioc->port_id; | 1818 | ioc_attr->port_id = ioc->port_id; |
2084 | 1819 | ||
2085 | if (!ioc->ctdev) | 1820 | ioc_attr->ioc_type = bfa_ioc_get_type(ioc); |
2086 | ioc_attr->ioc_type = BFA_IOC_TYPE_FC; | ||
2087 | else if (ioc->ioc_mc == BFI_MC_IOCFC) | ||
2088 | ioc_attr->ioc_type = BFA_IOC_TYPE_FCoE; | ||
2089 | else if (ioc->ioc_mc == BFI_MC_LL) | ||
2090 | ioc_attr->ioc_type = BFA_IOC_TYPE_LL; | ||
2091 | 1821 | ||
2092 | bfa_ioc_get_adapter_attr(ioc, &ioc_attr->adapter_attr); | 1822 | bfa_ioc_get_adapter_attr(ioc, &ioc_attr->adapter_attr); |
2093 | 1823 | ||
2094 | ioc_attr->pci_attr.device_id = ioc->pcidev.device_id; | 1824 | ioc_attr->pci_attr.device_id = ioc->pcidev.device_id; |
2095 | ioc_attr->pci_attr.pcifn = ioc->pcidev.pci_func; | 1825 | ioc_attr->pci_attr.pcifn = ioc->pcidev.pci_func; |
2096 | ioc_attr->pci_attr.chip_rev[0] = 'R'; | 1826 | bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev); |
2097 | ioc_attr->pci_attr.chip_rev[1] = 'e'; | ||
2098 | ioc_attr->pci_attr.chip_rev[2] = 'v'; | ||
2099 | ioc_attr->pci_attr.chip_rev[3] = '-'; | ||
2100 | ioc_attr->pci_attr.chip_rev[4] = ioc_attr->adapter_attr.asic_rev; | ||
2101 | ioc_attr->pci_attr.chip_rev[5] = '\0'; | ||
2102 | } | 1827 | } |
2103 | 1828 | ||
2104 | /** | 1829 | /** |
@@ -2195,29 +1920,6 @@ bfa_ioc_get_fcmode(struct bfa_ioc_s *ioc) | |||
2195 | } | 1920 | } |
2196 | 1921 | ||
2197 | /** | 1922 | /** |
2198 | * Return true if interrupt should be claimed. | ||
2199 | */ | ||
2200 | bfa_boolean_t | ||
2201 | bfa_ioc_intx_claim(struct bfa_ioc_s *ioc) | ||
2202 | { | ||
2203 | u32 isr, msk; | ||
2204 | |||
2205 | /** | ||
2206 | * Always claim if not catapult. | ||
2207 | */ | ||
2208 | if (!ioc->ctdev) | ||
2209 | return BFA_TRUE; | ||
2210 | |||
2211 | /** | ||
2212 | * FALSE if next device is claiming interrupt. | ||
2213 | * TRUE if next device is not interrupting or not present. | ||
2214 | */ | ||
2215 | msk = bfa_reg_read(ioc->ioc_regs.shirq_msk_next); | ||
2216 | isr = bfa_reg_read(ioc->ioc_regs.shirq_isr_next); | ||
2217 | return !(isr & ~msk); | ||
2218 | } | ||
2219 | |||
2220 | /** | ||
2221 | * Send AEN notification | 1923 | * Send AEN notification |
2222 | */ | 1924 | */ |
2223 | static void | 1925 | static void |
@@ -2226,32 +1928,14 @@ bfa_ioc_aen_post(struct bfa_ioc_s *ioc, enum bfa_ioc_aen_event event) | |||
2226 | union bfa_aen_data_u aen_data; | 1928 | union bfa_aen_data_u aen_data; |
2227 | struct bfa_log_mod_s *logmod = ioc->logm; | 1929 | struct bfa_log_mod_s *logmod = ioc->logm; |
2228 | s32 inst_num = 0; | 1930 | s32 inst_num = 0; |
2229 | struct bfa_ioc_attr_s ioc_attr; | 1931 | enum bfa_ioc_type_e ioc_type; |
2230 | 1932 | ||
2231 | switch (event) { | 1933 | bfa_log(logmod, BFA_LOG_CREATE_ID(BFA_AEN_CAT_IOC, event), inst_num); |
2232 | case BFA_IOC_AEN_HBGOOD: | ||
2233 | bfa_log(logmod, BFA_AEN_IOC_HBGOOD, inst_num); | ||
2234 | break; | ||
2235 | case BFA_IOC_AEN_HBFAIL: | ||
2236 | bfa_log(logmod, BFA_AEN_IOC_HBFAIL, inst_num); | ||
2237 | break; | ||
2238 | case BFA_IOC_AEN_ENABLE: | ||
2239 | bfa_log(logmod, BFA_AEN_IOC_ENABLE, inst_num); | ||
2240 | break; | ||
2241 | case BFA_IOC_AEN_DISABLE: | ||
2242 | bfa_log(logmod, BFA_AEN_IOC_DISABLE, inst_num); | ||
2243 | break; | ||
2244 | case BFA_IOC_AEN_FWMISMATCH: | ||
2245 | bfa_log(logmod, BFA_AEN_IOC_FWMISMATCH, inst_num); | ||
2246 | break; | ||
2247 | default: | ||
2248 | break; | ||
2249 | } | ||
2250 | 1934 | ||
2251 | memset(&aen_data.ioc.pwwn, 0, sizeof(aen_data.ioc.pwwn)); | 1935 | memset(&aen_data.ioc.pwwn, 0, sizeof(aen_data.ioc.pwwn)); |
2252 | memset(&aen_data.ioc.mac, 0, sizeof(aen_data.ioc.mac)); | 1936 | memset(&aen_data.ioc.mac, 0, sizeof(aen_data.ioc.mac)); |
2253 | bfa_ioc_get_attr(ioc, &ioc_attr); | 1937 | ioc_type = bfa_ioc_get_type(ioc); |
2254 | switch (ioc_attr.ioc_type) { | 1938 | switch (ioc_type) { |
2255 | case BFA_IOC_TYPE_FC: | 1939 | case BFA_IOC_TYPE_FC: |
2256 | aen_data.ioc.pwwn = bfa_ioc_get_pwwn(ioc); | 1940 | aen_data.ioc.pwwn = bfa_ioc_get_pwwn(ioc); |
2257 | break; | 1941 | break; |
@@ -2263,10 +1947,10 @@ bfa_ioc_aen_post(struct bfa_ioc_s *ioc, enum bfa_ioc_aen_event event) | |||
2263 | aen_data.ioc.mac = bfa_ioc_get_mac(ioc); | 1947 | aen_data.ioc.mac = bfa_ioc_get_mac(ioc); |
2264 | break; | 1948 | break; |
2265 | default: | 1949 | default: |
2266 | bfa_assert(ioc_attr.ioc_type == BFA_IOC_TYPE_FC); | 1950 | bfa_assert(ioc_type == BFA_IOC_TYPE_FC); |
2267 | break; | 1951 | break; |
2268 | } | 1952 | } |
2269 | aen_data.ioc.ioc_type = ioc_attr.ioc_type; | 1953 | aen_data.ioc.ioc_type = ioc_type; |
2270 | } | 1954 | } |
2271 | 1955 | ||
2272 | /** | 1956 | /** |
@@ -2290,6 +1974,15 @@ bfa_ioc_debug_fwsave(struct bfa_ioc_s *ioc, void *trcdata, int *trclen) | |||
2290 | } | 1974 | } |
2291 | 1975 | ||
2292 | /** | 1976 | /** |
1977 | * Clear saved firmware trace | ||
1978 | */ | ||
1979 | void | ||
1980 | bfa_ioc_debug_fwsave_clear(struct bfa_ioc_s *ioc) | ||
1981 | { | ||
1982 | ioc->dbg_fwsave_once = BFA_TRUE; | ||
1983 | } | ||
1984 | |||
1985 | /** | ||
2293 | * Retrieve saved firmware trace from a prior IOC failure. | 1986 | * Retrieve saved firmware trace from a prior IOC failure. |
2294 | */ | 1987 | */ |
2295 | bfa_status_t | 1988 | bfa_status_t |
@@ -2304,6 +1997,13 @@ bfa_ioc_debug_fwtrc(struct bfa_ioc_s *ioc, void *trcdata, int *trclen) | |||
2304 | 1997 | ||
2305 | pgnum = bfa_ioc_smem_pgnum(ioc, loff); | 1998 | pgnum = bfa_ioc_smem_pgnum(ioc, loff); |
2306 | loff = bfa_ioc_smem_pgoff(ioc, loff); | 1999 | loff = bfa_ioc_smem_pgoff(ioc, loff); |
2000 | |||
2001 | /* | ||
2002 | * Hold semaphore to serialize pll init and fwtrc. | ||
2003 | */ | ||
2004 | if (BFA_FALSE == bfa_ioc_sem_get(ioc->ioc_regs.ioc_init_sem_reg)) | ||
2005 | return BFA_STATUS_FAILED; | ||
2006 | |||
2307 | bfa_reg_write(ioc->ioc_regs.host_page_num_fn, pgnum); | 2007 | bfa_reg_write(ioc->ioc_regs.host_page_num_fn, pgnum); |
2308 | 2008 | ||
2309 | tlen = *trclen; | 2009 | tlen = *trclen; |
@@ -2329,6 +2029,12 @@ bfa_ioc_debug_fwtrc(struct bfa_ioc_s *ioc, void *trcdata, int *trclen) | |||
2329 | } | 2029 | } |
2330 | bfa_reg_write(ioc->ioc_regs.host_page_num_fn, | 2030 | bfa_reg_write(ioc->ioc_regs.host_page_num_fn, |
2331 | bfa_ioc_smem_pgnum(ioc, 0)); | 2031 | bfa_ioc_smem_pgnum(ioc, 0)); |
2032 | |||
2033 | /* | ||
2034 | * release semaphore. | ||
2035 | */ | ||
2036 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_init_sem_reg); | ||
2037 | |||
2332 | bfa_trc(ioc, pgnum); | 2038 | bfa_trc(ioc, pgnum); |
2333 | 2039 | ||
2334 | *trclen = tlen * sizeof(u32); | 2040 | *trclen = tlen * sizeof(u32); |
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index 7c30f05ab137..d0804406ea1a 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h | |||
@@ -74,15 +74,18 @@ struct bfa_ioc_regs_s { | |||
74 | bfa_os_addr_t lpu_mbox_cmd; | 74 | bfa_os_addr_t lpu_mbox_cmd; |
75 | bfa_os_addr_t lpu_mbox; | 75 | bfa_os_addr_t lpu_mbox; |
76 | bfa_os_addr_t pss_ctl_reg; | 76 | bfa_os_addr_t pss_ctl_reg; |
77 | bfa_os_addr_t pss_err_status_reg; | ||
77 | bfa_os_addr_t app_pll_fast_ctl_reg; | 78 | bfa_os_addr_t app_pll_fast_ctl_reg; |
78 | bfa_os_addr_t app_pll_slow_ctl_reg; | 79 | bfa_os_addr_t app_pll_slow_ctl_reg; |
79 | bfa_os_addr_t ioc_sem_reg; | 80 | bfa_os_addr_t ioc_sem_reg; |
80 | bfa_os_addr_t ioc_usage_sem_reg; | 81 | bfa_os_addr_t ioc_usage_sem_reg; |
82 | bfa_os_addr_t ioc_init_sem_reg; | ||
81 | bfa_os_addr_t ioc_usage_reg; | 83 | bfa_os_addr_t ioc_usage_reg; |
82 | bfa_os_addr_t host_page_num_fn; | 84 | bfa_os_addr_t host_page_num_fn; |
83 | bfa_os_addr_t heartbeat; | 85 | bfa_os_addr_t heartbeat; |
84 | bfa_os_addr_t ioc_fwstate; | 86 | bfa_os_addr_t ioc_fwstate; |
85 | bfa_os_addr_t ll_halt; | 87 | bfa_os_addr_t ll_halt; |
88 | bfa_os_addr_t err_set; | ||
86 | bfa_os_addr_t shirq_isr_next; | 89 | bfa_os_addr_t shirq_isr_next; |
87 | bfa_os_addr_t shirq_msk_next; | 90 | bfa_os_addr_t shirq_msk_next; |
88 | bfa_os_addr_t smem_page_start; | 91 | bfa_os_addr_t smem_page_start; |
@@ -154,7 +157,6 @@ struct bfa_ioc_s { | |||
154 | struct bfa_timer_s ioc_timer; | 157 | struct bfa_timer_s ioc_timer; |
155 | struct bfa_timer_s sem_timer; | 158 | struct bfa_timer_s sem_timer; |
156 | u32 hb_count; | 159 | u32 hb_count; |
157 | u32 hb_fail; | ||
158 | u32 retry_count; | 160 | u32 retry_count; |
159 | struct list_head hb_notify_q; | 161 | struct list_head hb_notify_q; |
160 | void *dbg_fwsave; | 162 | void *dbg_fwsave; |
@@ -177,6 +179,22 @@ struct bfa_ioc_s { | |||
177 | struct bfi_ioc_attr_s *attr; | 179 | struct bfi_ioc_attr_s *attr; |
178 | struct bfa_ioc_cbfn_s *cbfn; | 180 | struct bfa_ioc_cbfn_s *cbfn; |
179 | struct bfa_ioc_mbox_mod_s mbox_mod; | 181 | struct bfa_ioc_mbox_mod_s mbox_mod; |
182 | struct bfa_ioc_hwif_s *ioc_hwif; | ||
183 | }; | ||
184 | |||
185 | struct bfa_ioc_hwif_s { | ||
186 | bfa_status_t (*ioc_pll_init) (struct bfa_ioc_s *ioc); | ||
187 | bfa_boolean_t (*ioc_firmware_lock) (struct bfa_ioc_s *ioc); | ||
188 | void (*ioc_firmware_unlock) (struct bfa_ioc_s *ioc); | ||
189 | u32 * (*ioc_fwimg_get_chunk) (struct bfa_ioc_s *ioc, | ||
190 | u32 off); | ||
191 | u32 (*ioc_fwimg_get_size) (struct bfa_ioc_s *ioc); | ||
192 | void (*ioc_reg_init) (struct bfa_ioc_s *ioc); | ||
193 | void (*ioc_map_port) (struct bfa_ioc_s *ioc); | ||
194 | void (*ioc_isr_mode_set) (struct bfa_ioc_s *ioc, | ||
195 | bfa_boolean_t msix); | ||
196 | void (*ioc_notify_hbfail) (struct bfa_ioc_s *ioc); | ||
197 | void (*ioc_ownership_reset) (struct bfa_ioc_s *ioc); | ||
180 | }; | 198 | }; |
181 | 199 | ||
182 | #define bfa_ioc_pcifn(__ioc) ((__ioc)->pcidev.pci_func) | 200 | #define bfa_ioc_pcifn(__ioc) ((__ioc)->pcidev.pci_func) |
@@ -191,6 +209,15 @@ struct bfa_ioc_s { | |||
191 | #define bfa_ioc_rx_bbcredit(__ioc) ((__ioc)->attr->rx_bbcredit) | 209 | #define bfa_ioc_rx_bbcredit(__ioc) ((__ioc)->attr->rx_bbcredit) |
192 | #define bfa_ioc_speed_sup(__ioc) \ | 210 | #define bfa_ioc_speed_sup(__ioc) \ |
193 | BFI_ADAPTER_GETP(SPEED, (__ioc)->attr->adapter_prop) | 211 | BFI_ADAPTER_GETP(SPEED, (__ioc)->attr->adapter_prop) |
212 | #define bfa_ioc_get_nports(__ioc) \ | ||
213 | BFI_ADAPTER_GETP(NPORTS, (__ioc)->attr->adapter_prop) | ||
214 | |||
215 | #define bfa_ioc_stats(_ioc, _stats) ((_ioc)->stats._stats++) | ||
216 | #define BFA_IOC_FWIMG_MINSZ (16 * 1024) | ||
217 | |||
218 | #define BFA_IOC_FLASH_CHUNK_NO(off) (off / BFI_FLASH_CHUNK_SZ_WORDS) | ||
219 | #define BFA_IOC_FLASH_OFFSET_IN_CHUNK(off) (off % BFI_FLASH_CHUNK_SZ_WORDS) | ||
220 | #define BFA_IOC_FLASH_CHUNK_ADDR(chunkno) (chunkno * BFI_FLASH_CHUNK_SZ_WORDS) | ||
194 | 221 | ||
195 | /** | 222 | /** |
196 | * IOC mailbox interface | 223 | * IOC mailbox interface |
@@ -207,6 +234,14 @@ void bfa_ioc_mbox_regisr(struct bfa_ioc_s *ioc, enum bfi_mclass mc, | |||
207 | /** | 234 | /** |
208 | * IOC interfaces | 235 | * IOC interfaces |
209 | */ | 236 | */ |
237 | #define bfa_ioc_pll_init(__ioc) ((__ioc)->ioc_hwif->ioc_pll_init(__ioc)) | ||
238 | #define bfa_ioc_isr_mode_set(__ioc, __msix) \ | ||
239 | ((__ioc)->ioc_hwif->ioc_isr_mode_set(__ioc, __msix)) | ||
240 | #define bfa_ioc_ownership_reset(__ioc) \ | ||
241 | ((__ioc)->ioc_hwif->ioc_ownership_reset(__ioc)) | ||
242 | |||
243 | void bfa_ioc_set_ct_hwif(struct bfa_ioc_s *ioc); | ||
244 | void bfa_ioc_set_cb_hwif(struct bfa_ioc_s *ioc); | ||
210 | void bfa_ioc_attach(struct bfa_ioc_s *ioc, void *bfa, | 245 | void bfa_ioc_attach(struct bfa_ioc_s *ioc, void *bfa, |
211 | struct bfa_ioc_cbfn_s *cbfn, struct bfa_timer_mod_s *timer_mod, | 246 | struct bfa_ioc_cbfn_s *cbfn, struct bfa_timer_mod_s *timer_mod, |
212 | struct bfa_trc_mod_s *trcmod, | 247 | struct bfa_trc_mod_s *trcmod, |
@@ -223,13 +258,21 @@ bfa_boolean_t bfa_ioc_intx_claim(struct bfa_ioc_s *ioc); | |||
223 | void bfa_ioc_boot(struct bfa_ioc_s *ioc, u32 boot_type, u32 boot_param); | 258 | void bfa_ioc_boot(struct bfa_ioc_s *ioc, u32 boot_type, u32 boot_param); |
224 | void bfa_ioc_isr(struct bfa_ioc_s *ioc, struct bfi_mbmsg_s *msg); | 259 | void bfa_ioc_isr(struct bfa_ioc_s *ioc, struct bfi_mbmsg_s *msg); |
225 | void bfa_ioc_error_isr(struct bfa_ioc_s *ioc); | 260 | void bfa_ioc_error_isr(struct bfa_ioc_s *ioc); |
226 | void bfa_ioc_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t intx); | ||
227 | bfa_status_t bfa_ioc_pll_init(struct bfa_ioc_s *ioc); | ||
228 | bfa_boolean_t bfa_ioc_is_operational(struct bfa_ioc_s *ioc); | 261 | bfa_boolean_t bfa_ioc_is_operational(struct bfa_ioc_s *ioc); |
229 | bfa_boolean_t bfa_ioc_is_disabled(struct bfa_ioc_s *ioc); | 262 | bfa_boolean_t bfa_ioc_is_disabled(struct bfa_ioc_s *ioc); |
230 | bfa_boolean_t bfa_ioc_fw_mismatch(struct bfa_ioc_s *ioc); | 263 | bfa_boolean_t bfa_ioc_fw_mismatch(struct bfa_ioc_s *ioc); |
231 | bfa_boolean_t bfa_ioc_adapter_is_disabled(struct bfa_ioc_s *ioc); | 264 | bfa_boolean_t bfa_ioc_adapter_is_disabled(struct bfa_ioc_s *ioc); |
232 | void bfa_ioc_cfg_complete(struct bfa_ioc_s *ioc); | 265 | void bfa_ioc_cfg_complete(struct bfa_ioc_s *ioc); |
266 | enum bfa_ioc_type_e bfa_ioc_get_type(struct bfa_ioc_s *ioc); | ||
267 | void bfa_ioc_get_adapter_serial_num(struct bfa_ioc_s *ioc, char *serial_num); | ||
268 | void bfa_ioc_get_adapter_fw_ver(struct bfa_ioc_s *ioc, char *fw_ver); | ||
269 | void bfa_ioc_get_adapter_optrom_ver(struct bfa_ioc_s *ioc, char *optrom_ver); | ||
270 | void bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model); | ||
271 | void bfa_ioc_get_adapter_manufacturer(struct bfa_ioc_s *ioc, | ||
272 | char *manufacturer); | ||
273 | void bfa_ioc_get_pci_chip_rev(struct bfa_ioc_s *ioc, char *chip_rev); | ||
274 | enum bfa_ioc_state bfa_ioc_get_state(struct bfa_ioc_s *ioc); | ||
275 | |||
233 | void bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr); | 276 | void bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr); |
234 | void bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, | 277 | void bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, |
235 | struct bfa_adapter_attr_s *ad_attr); | 278 | struct bfa_adapter_attr_s *ad_attr); |
@@ -237,6 +280,7 @@ int bfa_ioc_debug_trcsz(bfa_boolean_t auto_recover); | |||
237 | void bfa_ioc_debug_memclaim(struct bfa_ioc_s *ioc, void *dbg_fwsave); | 280 | void bfa_ioc_debug_memclaim(struct bfa_ioc_s *ioc, void *dbg_fwsave); |
238 | bfa_status_t bfa_ioc_debug_fwsave(struct bfa_ioc_s *ioc, void *trcdata, | 281 | bfa_status_t bfa_ioc_debug_fwsave(struct bfa_ioc_s *ioc, void *trcdata, |
239 | int *trclen); | 282 | int *trclen); |
283 | void bfa_ioc_debug_fwsave_clear(struct bfa_ioc_s *ioc); | ||
240 | bfa_status_t bfa_ioc_debug_fwtrc(struct bfa_ioc_s *ioc, void *trcdata, | 284 | bfa_status_t bfa_ioc_debug_fwtrc(struct bfa_ioc_s *ioc, void *trcdata, |
241 | int *trclen); | 285 | int *trclen); |
242 | u32 bfa_ioc_smem_pgnum(struct bfa_ioc_s *ioc, u32 fmaddr); | 286 | u32 bfa_ioc_smem_pgnum(struct bfa_ioc_s *ioc, u32 fmaddr); |
@@ -245,6 +289,13 @@ void bfa_ioc_set_fcmode(struct bfa_ioc_s *ioc); | |||
245 | bfa_boolean_t bfa_ioc_get_fcmode(struct bfa_ioc_s *ioc); | 289 | bfa_boolean_t bfa_ioc_get_fcmode(struct bfa_ioc_s *ioc); |
246 | void bfa_ioc_hbfail_register(struct bfa_ioc_s *ioc, | 290 | void bfa_ioc_hbfail_register(struct bfa_ioc_s *ioc, |
247 | struct bfa_ioc_hbfail_notify_s *notify); | 291 | struct bfa_ioc_hbfail_notify_s *notify); |
292 | bfa_boolean_t bfa_ioc_sem_get(bfa_os_addr_t sem_reg); | ||
293 | void bfa_ioc_sem_release(bfa_os_addr_t sem_reg); | ||
294 | void bfa_ioc_hw_sem_release(struct bfa_ioc_s *ioc); | ||
295 | void bfa_ioc_fwver_get(struct bfa_ioc_s *ioc, | ||
296 | struct bfi_ioc_image_hdr_s *fwhdr); | ||
297 | bfa_boolean_t bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc, | ||
298 | struct bfi_ioc_image_hdr_s *fwhdr); | ||
248 | 299 | ||
249 | /* | 300 | /* |
250 | * bfa mfg wwn API functions | 301 | * bfa mfg wwn API functions |
diff --git a/drivers/scsi/bfa/bfa_ioc_cb.c b/drivers/scsi/bfa/bfa_ioc_cb.c new file mode 100644 index 000000000000..3ce85319f739 --- /dev/null +++ b/drivers/scsi/bfa/bfa_ioc_cb.c | |||
@@ -0,0 +1,274 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2009 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.h> | ||
19 | #include <bfa_ioc.h> | ||
20 | #include <bfa_fwimg_priv.h> | ||
21 | #include <cna/bfa_cna_trcmod.h> | ||
22 | #include <cs/bfa_debug.h> | ||
23 | #include <bfi/bfi_ioc.h> | ||
24 | #include <bfi/bfi_cbreg.h> | ||
25 | #include <log/bfa_log_hal.h> | ||
26 | #include <defs/bfa_defs_pci.h> | ||
27 | |||
28 | BFA_TRC_FILE(CNA, IOC_CB); | ||
29 | |||
30 | /* | ||
31 | * forward declarations | ||
32 | */ | ||
33 | static bfa_status_t bfa_ioc_cb_pll_init(struct bfa_ioc_s *ioc); | ||
34 | static bfa_boolean_t bfa_ioc_cb_firmware_lock(struct bfa_ioc_s *ioc); | ||
35 | static void bfa_ioc_cb_firmware_unlock(struct bfa_ioc_s *ioc); | ||
36 | static u32 *bfa_ioc_cb_fwimg_get_chunk(struct bfa_ioc_s *ioc, u32 off); | ||
37 | static u32 bfa_ioc_cb_fwimg_get_size(struct bfa_ioc_s *ioc); | ||
38 | static void bfa_ioc_cb_reg_init(struct bfa_ioc_s *ioc); | ||
39 | static void bfa_ioc_cb_map_port(struct bfa_ioc_s *ioc); | ||
40 | static void bfa_ioc_cb_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); | ||
41 | static void bfa_ioc_cb_notify_hbfail(struct bfa_ioc_s *ioc); | ||
42 | static void bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc); | ||
43 | |||
44 | struct bfa_ioc_hwif_s hwif_cb = { | ||
45 | bfa_ioc_cb_pll_init, | ||
46 | bfa_ioc_cb_firmware_lock, | ||
47 | bfa_ioc_cb_firmware_unlock, | ||
48 | bfa_ioc_cb_fwimg_get_chunk, | ||
49 | bfa_ioc_cb_fwimg_get_size, | ||
50 | bfa_ioc_cb_reg_init, | ||
51 | bfa_ioc_cb_map_port, | ||
52 | bfa_ioc_cb_isr_mode_set, | ||
53 | bfa_ioc_cb_notify_hbfail, | ||
54 | bfa_ioc_cb_ownership_reset, | ||
55 | }; | ||
56 | |||
57 | /** | ||
58 | * Called from bfa_ioc_attach() to map asic specific calls. | ||
59 | */ | ||
60 | void | ||
61 | bfa_ioc_set_cb_hwif(struct bfa_ioc_s *ioc) | ||
62 | { | ||
63 | ioc->ioc_hwif = &hwif_cb; | ||
64 | } | ||
65 | |||
66 | static u32 * | ||
67 | bfa_ioc_cb_fwimg_get_chunk(struct bfa_ioc_s *ioc, u32 off) | ||
68 | { | ||
69 | return bfi_image_cb_get_chunk(off); | ||
70 | } | ||
71 | |||
72 | static u32 | ||
73 | bfa_ioc_cb_fwimg_get_size(struct bfa_ioc_s *ioc) | ||
74 | { | ||
75 | return bfi_image_cb_size; | ||
76 | } | ||
77 | |||
78 | /** | ||
79 | * Return true if firmware of current driver matches the running firmware. | ||
80 | */ | ||
81 | static bfa_boolean_t | ||
82 | bfa_ioc_cb_firmware_lock(struct bfa_ioc_s *ioc) | ||
83 | { | ||
84 | return BFA_TRUE; | ||
85 | } | ||
86 | |||
87 | static void | ||
88 | bfa_ioc_cb_firmware_unlock(struct bfa_ioc_s *ioc) | ||
89 | { | ||
90 | } | ||
91 | |||
92 | /** | ||
93 | * Notify other functions on HB failure. | ||
94 | */ | ||
95 | static void | ||
96 | bfa_ioc_cb_notify_hbfail(struct bfa_ioc_s *ioc) | ||
97 | { | ||
98 | bfa_reg_write(ioc->ioc_regs.err_set, __PSS_ERR_STATUS_SET); | ||
99 | bfa_reg_read(ioc->ioc_regs.err_set); | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * Host to LPU mailbox message addresses | ||
104 | */ | ||
105 | static struct { u32 hfn_mbox, lpu_mbox, hfn_pgn; } iocreg_fnreg[] = { | ||
106 | { HOSTFN0_LPU_MBOX0_0, LPU_HOSTFN0_MBOX0_0, HOST_PAGE_NUM_FN0 }, | ||
107 | { HOSTFN1_LPU_MBOX0_8, LPU_HOSTFN1_MBOX0_8, HOST_PAGE_NUM_FN1 } | ||
108 | }; | ||
109 | |||
110 | /** | ||
111 | * Host <-> LPU mailbox command/status registers | ||
112 | */ | ||
113 | static struct { u32 hfn, lpu; } iocreg_mbcmd[] = { | ||
114 | { HOSTFN0_LPU0_CMD_STAT, LPU0_HOSTFN0_CMD_STAT }, | ||
115 | { HOSTFN1_LPU1_CMD_STAT, LPU1_HOSTFN1_CMD_STAT } | ||
116 | }; | ||
117 | |||
118 | static void | ||
119 | bfa_ioc_cb_reg_init(struct bfa_ioc_s *ioc) | ||
120 | { | ||
121 | bfa_os_addr_t rb; | ||
122 | int pcifn = bfa_ioc_pcifn(ioc); | ||
123 | |||
124 | rb = bfa_ioc_bar0(ioc); | ||
125 | |||
126 | ioc->ioc_regs.hfn_mbox = rb + iocreg_fnreg[pcifn].hfn_mbox; | ||
127 | ioc->ioc_regs.lpu_mbox = rb + iocreg_fnreg[pcifn].lpu_mbox; | ||
128 | ioc->ioc_regs.host_page_num_fn = rb + iocreg_fnreg[pcifn].hfn_pgn; | ||
129 | |||
130 | if (ioc->port_id == 0) { | ||
131 | ioc->ioc_regs.heartbeat = rb + BFA_IOC0_HBEAT_REG; | ||
132 | ioc->ioc_regs.ioc_fwstate = rb + BFA_IOC0_STATE_REG; | ||
133 | } else { | ||
134 | ioc->ioc_regs.heartbeat = (rb + BFA_IOC1_HBEAT_REG); | ||
135 | ioc->ioc_regs.ioc_fwstate = (rb + BFA_IOC1_STATE_REG); | ||
136 | } | ||
137 | |||
138 | /** | ||
139 | * Host <-> LPU mailbox command/status registers | ||
140 | */ | ||
141 | ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd[pcifn].hfn; | ||
142 | ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd[pcifn].lpu; | ||
143 | |||
144 | /* | ||
145 | * PSS control registers | ||
146 | */ | ||
147 | ioc->ioc_regs.pss_ctl_reg = (rb + PSS_CTL_REG); | ||
148 | ioc->ioc_regs.pss_err_status_reg = (rb + PSS_ERR_STATUS_REG); | ||
149 | ioc->ioc_regs.app_pll_fast_ctl_reg = (rb + APP_PLL_400_CTL_REG); | ||
150 | ioc->ioc_regs.app_pll_slow_ctl_reg = (rb + APP_PLL_212_CTL_REG); | ||
151 | |||
152 | /* | ||
153 | * IOC semaphore registers and serialization | ||
154 | */ | ||
155 | ioc->ioc_regs.ioc_sem_reg = (rb + HOST_SEM0_REG); | ||
156 | ioc->ioc_regs.ioc_init_sem_reg = (rb + HOST_SEM2_REG); | ||
157 | |||
158 | /** | ||
159 | * sram memory access | ||
160 | */ | ||
161 | ioc->ioc_regs.smem_page_start = (rb + PSS_SMEM_PAGE_START); | ||
162 | ioc->ioc_regs.smem_pg0 = BFI_IOC_SMEM_PG0_CB; | ||
163 | |||
164 | /* | ||
165 | * err set reg : for notification of hb failure | ||
166 | */ | ||
167 | ioc->ioc_regs.err_set = (rb + ERR_SET_REG); | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * Initialize IOC to port mapping. | ||
172 | */ | ||
173 | static void | ||
174 | bfa_ioc_cb_map_port(struct bfa_ioc_s *ioc) | ||
175 | { | ||
176 | /** | ||
177 | * For crossbow, port id is same as pci function. | ||
178 | */ | ||
179 | ioc->port_id = bfa_ioc_pcifn(ioc); | ||
180 | bfa_trc(ioc, ioc->port_id); | ||
181 | } | ||
182 | |||
183 | /** | ||
184 | * Set interrupt mode for a function: INTX or MSIX | ||
185 | */ | ||
186 | static void | ||
187 | bfa_ioc_cb_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix) | ||
188 | { | ||
189 | } | ||
190 | |||
191 | static bfa_status_t | ||
192 | bfa_ioc_cb_pll_init(struct bfa_ioc_s *ioc) | ||
193 | { | ||
194 | bfa_os_addr_t rb = ioc->pcidev.pci_bar_kva; | ||
195 | u32 pll_sclk, pll_fclk; | ||
196 | |||
197 | /* | ||
198 | * Hold semaphore so that nobody can access the chip during init. | ||
199 | */ | ||
200 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_init_sem_reg); | ||
201 | |||
202 | pll_sclk = __APP_PLL_212_ENABLE | __APP_PLL_212_LRESETN | | ||
203 | __APP_PLL_212_P0_1(3U) | | ||
204 | __APP_PLL_212_JITLMT0_1(3U) | | ||
205 | __APP_PLL_212_CNTLMT0_1(3U); | ||
206 | pll_fclk = __APP_PLL_400_ENABLE | __APP_PLL_400_LRESETN | | ||
207 | __APP_PLL_400_RSEL200500 | __APP_PLL_400_P0_1(3U) | | ||
208 | __APP_PLL_400_JITLMT0_1(3U) | | ||
209 | __APP_PLL_400_CNTLMT0_1(3U); | ||
210 | |||
211 | bfa_reg_write((rb + BFA_IOC0_STATE_REG), BFI_IOC_UNINIT); | ||
212 | bfa_reg_write((rb + BFA_IOC1_STATE_REG), BFI_IOC_UNINIT); | ||
213 | |||
214 | bfa_reg_write((rb + HOSTFN0_INT_MSK), 0xffffffffU); | ||
215 | bfa_reg_write((rb + HOSTFN1_INT_MSK), 0xffffffffU); | ||
216 | bfa_reg_write((rb + HOSTFN0_INT_STATUS), 0xffffffffU); | ||
217 | bfa_reg_write((rb + HOSTFN1_INT_STATUS), 0xffffffffU); | ||
218 | bfa_reg_write((rb + HOSTFN0_INT_MSK), 0xffffffffU); | ||
219 | bfa_reg_write((rb + HOSTFN1_INT_MSK), 0xffffffffU); | ||
220 | |||
221 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, | ||
222 | __APP_PLL_212_LOGIC_SOFT_RESET); | ||
223 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, | ||
224 | __APP_PLL_212_BYPASS | | ||
225 | __APP_PLL_212_LOGIC_SOFT_RESET); | ||
226 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, | ||
227 | __APP_PLL_400_LOGIC_SOFT_RESET); | ||
228 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, | ||
229 | __APP_PLL_400_BYPASS | | ||
230 | __APP_PLL_400_LOGIC_SOFT_RESET); | ||
231 | bfa_os_udelay(2); | ||
232 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, | ||
233 | __APP_PLL_212_LOGIC_SOFT_RESET); | ||
234 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, | ||
235 | __APP_PLL_400_LOGIC_SOFT_RESET); | ||
236 | |||
237 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, | ||
238 | pll_sclk | __APP_PLL_212_LOGIC_SOFT_RESET); | ||
239 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, | ||
240 | pll_fclk | __APP_PLL_400_LOGIC_SOFT_RESET); | ||
241 | |||
242 | /** | ||
243 | * Wait for PLLs to lock. | ||
244 | */ | ||
245 | bfa_os_udelay(2000); | ||
246 | bfa_reg_write((rb + HOSTFN0_INT_STATUS), 0xffffffffU); | ||
247 | bfa_reg_write((rb + HOSTFN1_INT_STATUS), 0xffffffffU); | ||
248 | |||
249 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, pll_sclk); | ||
250 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, pll_fclk); | ||
251 | |||
252 | /* | ||
253 | * release semaphore. | ||
254 | */ | ||
255 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_init_sem_reg); | ||
256 | |||
257 | return BFA_STATUS_OK; | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * Cleanup hw semaphore and usecnt registers | ||
262 | */ | ||
263 | static void | ||
264 | bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc) | ||
265 | { | ||
266 | |||
267 | /* | ||
268 | * Read the hw sem reg to make sure that it is locked | ||
269 | * before we clear it. If it is not locked, writing 1 | ||
270 | * will lock it instead of clearing it. | ||
271 | */ | ||
272 | bfa_reg_read(ioc->ioc_regs.ioc_sem_reg); | ||
273 | bfa_ioc_hw_sem_release(ioc); | ||
274 | } | ||
diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c new file mode 100644 index 000000000000..20b58ad5f95c --- /dev/null +++ b/drivers/scsi/bfa/bfa_ioc_ct.c | |||
@@ -0,0 +1,423 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2009 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.h> | ||
19 | #include <bfa_ioc.h> | ||
20 | #include <bfa_fwimg_priv.h> | ||
21 | #include <cna/bfa_cna_trcmod.h> | ||
22 | #include <cs/bfa_debug.h> | ||
23 | #include <bfi/bfi_ioc.h> | ||
24 | #include <bfi/bfi_ctreg.h> | ||
25 | #include <log/bfa_log_hal.h> | ||
26 | #include <defs/bfa_defs_pci.h> | ||
27 | |||
28 | BFA_TRC_FILE(CNA, IOC_CT); | ||
29 | |||
30 | /* | ||
31 | * forward declarations | ||
32 | */ | ||
33 | static bfa_status_t bfa_ioc_ct_pll_init(struct bfa_ioc_s *ioc); | ||
34 | static bfa_boolean_t bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc); | ||
35 | static void bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc); | ||
36 | static u32* bfa_ioc_ct_fwimg_get_chunk(struct bfa_ioc_s *ioc, | ||
37 | u32 off); | ||
38 | static u32 bfa_ioc_ct_fwimg_get_size(struct bfa_ioc_s *ioc); | ||
39 | static void bfa_ioc_ct_reg_init(struct bfa_ioc_s *ioc); | ||
40 | static void bfa_ioc_ct_map_port(struct bfa_ioc_s *ioc); | ||
41 | static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); | ||
42 | static void bfa_ioc_ct_notify_hbfail(struct bfa_ioc_s *ioc); | ||
43 | static void bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc); | ||
44 | |||
45 | struct bfa_ioc_hwif_s hwif_ct = { | ||
46 | bfa_ioc_ct_pll_init, | ||
47 | bfa_ioc_ct_firmware_lock, | ||
48 | bfa_ioc_ct_firmware_unlock, | ||
49 | bfa_ioc_ct_fwimg_get_chunk, | ||
50 | bfa_ioc_ct_fwimg_get_size, | ||
51 | bfa_ioc_ct_reg_init, | ||
52 | bfa_ioc_ct_map_port, | ||
53 | bfa_ioc_ct_isr_mode_set, | ||
54 | bfa_ioc_ct_notify_hbfail, | ||
55 | bfa_ioc_ct_ownership_reset, | ||
56 | }; | ||
57 | |||
58 | /** | ||
59 | * Called from bfa_ioc_attach() to map asic specific calls. | ||
60 | */ | ||
61 | void | ||
62 | bfa_ioc_set_ct_hwif(struct bfa_ioc_s *ioc) | ||
63 | { | ||
64 | ioc->ioc_hwif = &hwif_ct; | ||
65 | } | ||
66 | |||
67 | static u32* | ||
68 | bfa_ioc_ct_fwimg_get_chunk(struct bfa_ioc_s *ioc, u32 off) | ||
69 | { | ||
70 | return bfi_image_ct_get_chunk(off); | ||
71 | } | ||
72 | |||
73 | static u32 | ||
74 | bfa_ioc_ct_fwimg_get_size(struct bfa_ioc_s *ioc) | ||
75 | { | ||
76 | return bfi_image_ct_size; | ||
77 | } | ||
78 | |||
79 | /** | ||
80 | * Return true if firmware of current driver matches the running firmware. | ||
81 | */ | ||
82 | static bfa_boolean_t | ||
83 | bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) | ||
84 | { | ||
85 | enum bfi_ioc_state ioc_fwstate; | ||
86 | u32 usecnt; | ||
87 | struct bfi_ioc_image_hdr_s fwhdr; | ||
88 | |||
89 | /** | ||
90 | * Firmware match check is relevant only for CNA. | ||
91 | */ | ||
92 | if (!ioc->cna) | ||
93 | return BFA_TRUE; | ||
94 | |||
95 | /** | ||
96 | * If bios boot (flash based) -- do not increment usage count | ||
97 | */ | ||
98 | if (bfa_ioc_ct_fwimg_get_size(ioc) < BFA_IOC_FWIMG_MINSZ) | ||
99 | return BFA_TRUE; | ||
100 | |||
101 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); | ||
102 | usecnt = bfa_reg_read(ioc->ioc_regs.ioc_usage_reg); | ||
103 | |||
104 | /** | ||
105 | * If usage count is 0, always return TRUE. | ||
106 | */ | ||
107 | if (usecnt == 0) { | ||
108 | bfa_reg_write(ioc->ioc_regs.ioc_usage_reg, 1); | ||
109 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); | ||
110 | bfa_trc(ioc, usecnt); | ||
111 | return BFA_TRUE; | ||
112 | } | ||
113 | |||
114 | ioc_fwstate = bfa_reg_read(ioc->ioc_regs.ioc_fwstate); | ||
115 | bfa_trc(ioc, ioc_fwstate); | ||
116 | |||
117 | /** | ||
118 | * Use count cannot be non-zero and chip in uninitialized state. | ||
119 | */ | ||
120 | bfa_assert(ioc_fwstate != BFI_IOC_UNINIT); | ||
121 | |||
122 | /** | ||
123 | * Check if another driver with a different firmware is active | ||
124 | */ | ||
125 | bfa_ioc_fwver_get(ioc, &fwhdr); | ||
126 | if (!bfa_ioc_fwver_cmp(ioc, &fwhdr)) { | ||
127 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); | ||
128 | bfa_trc(ioc, usecnt); | ||
129 | return BFA_FALSE; | ||
130 | } | ||
131 | |||
132 | /** | ||
133 | * Same firmware version. Increment the reference count. | ||
134 | */ | ||
135 | usecnt++; | ||
136 | bfa_reg_write(ioc->ioc_regs.ioc_usage_reg, usecnt); | ||
137 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); | ||
138 | bfa_trc(ioc, usecnt); | ||
139 | return BFA_TRUE; | ||
140 | } | ||
141 | |||
142 | static void | ||
143 | bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc) | ||
144 | { | ||
145 | u32 usecnt; | ||
146 | |||
147 | /** | ||
148 | * Firmware lock is relevant only for CNA. | ||
149 | * If bios boot (flash based) -- do not decrement usage count | ||
150 | */ | ||
151 | if (!ioc->cna || bfa_ioc_ct_fwimg_get_size(ioc) < BFA_IOC_FWIMG_MINSZ) | ||
152 | return; | ||
153 | |||
154 | /** | ||
155 | * decrement usage count | ||
156 | */ | ||
157 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); | ||
158 | usecnt = bfa_reg_read(ioc->ioc_regs.ioc_usage_reg); | ||
159 | bfa_assert(usecnt > 0); | ||
160 | |||
161 | usecnt--; | ||
162 | bfa_reg_write(ioc->ioc_regs.ioc_usage_reg, usecnt); | ||
163 | bfa_trc(ioc, usecnt); | ||
164 | |||
165 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); | ||
166 | } | ||
167 | |||
168 | /** | ||
169 | * Notify other functions on HB failure. | ||
170 | */ | ||
171 | static void | ||
172 | bfa_ioc_ct_notify_hbfail(struct bfa_ioc_s *ioc) | ||
173 | { | ||
174 | if (ioc->cna) { | ||
175 | bfa_reg_write(ioc->ioc_regs.ll_halt, __FW_INIT_HALT_P); | ||
176 | /* Wait for halt to take effect */ | ||
177 | bfa_reg_read(ioc->ioc_regs.ll_halt); | ||
178 | } else { | ||
179 | bfa_reg_write(ioc->ioc_regs.err_set, __PSS_ERR_STATUS_SET); | ||
180 | bfa_reg_read(ioc->ioc_regs.err_set); | ||
181 | } | ||
182 | } | ||
183 | |||
184 | /** | ||
185 | * Host to LPU mailbox message addresses | ||
186 | */ | ||
187 | static struct { u32 hfn_mbox, lpu_mbox, hfn_pgn; } iocreg_fnreg[] = { | ||
188 | { HOSTFN0_LPU_MBOX0_0, LPU_HOSTFN0_MBOX0_0, HOST_PAGE_NUM_FN0 }, | ||
189 | { HOSTFN1_LPU_MBOX0_8, LPU_HOSTFN1_MBOX0_8, HOST_PAGE_NUM_FN1 }, | ||
190 | { HOSTFN2_LPU_MBOX0_0, LPU_HOSTFN2_MBOX0_0, HOST_PAGE_NUM_FN2 }, | ||
191 | { HOSTFN3_LPU_MBOX0_8, LPU_HOSTFN3_MBOX0_8, HOST_PAGE_NUM_FN3 } | ||
192 | }; | ||
193 | |||
194 | /** | ||
195 | * Host <-> LPU mailbox command/status registers - port 0 | ||
196 | */ | ||
197 | static struct { u32 hfn, lpu; } iocreg_mbcmd_p0[] = { | ||
198 | { HOSTFN0_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN0_MBOX0_CMD_STAT }, | ||
199 | { HOSTFN1_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN1_MBOX0_CMD_STAT }, | ||
200 | { HOSTFN2_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN2_MBOX0_CMD_STAT }, | ||
201 | { HOSTFN3_LPU0_MBOX0_CMD_STAT, LPU0_HOSTFN3_MBOX0_CMD_STAT } | ||
202 | }; | ||
203 | |||
204 | /** | ||
205 | * Host <-> LPU mailbox command/status registers - port 1 | ||
206 | */ | ||
207 | static struct { u32 hfn, lpu; } iocreg_mbcmd_p1[] = { | ||
208 | { HOSTFN0_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN0_MBOX0_CMD_STAT }, | ||
209 | { HOSTFN1_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN1_MBOX0_CMD_STAT }, | ||
210 | { HOSTFN2_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN2_MBOX0_CMD_STAT }, | ||
211 | { HOSTFN3_LPU1_MBOX0_CMD_STAT, LPU1_HOSTFN3_MBOX0_CMD_STAT } | ||
212 | }; | ||
213 | |||
214 | static void | ||
215 | bfa_ioc_ct_reg_init(struct bfa_ioc_s *ioc) | ||
216 | { | ||
217 | bfa_os_addr_t rb; | ||
218 | int pcifn = bfa_ioc_pcifn(ioc); | ||
219 | |||
220 | rb = bfa_ioc_bar0(ioc); | ||
221 | |||
222 | ioc->ioc_regs.hfn_mbox = rb + iocreg_fnreg[pcifn].hfn_mbox; | ||
223 | ioc->ioc_regs.lpu_mbox = rb + iocreg_fnreg[pcifn].lpu_mbox; | ||
224 | ioc->ioc_regs.host_page_num_fn = rb + iocreg_fnreg[pcifn].hfn_pgn; | ||
225 | |||
226 | if (ioc->port_id == 0) { | ||
227 | ioc->ioc_regs.heartbeat = rb + BFA_IOC0_HBEAT_REG; | ||
228 | ioc->ioc_regs.ioc_fwstate = rb + BFA_IOC0_STATE_REG; | ||
229 | ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd_p0[pcifn].hfn; | ||
230 | ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd_p0[pcifn].lpu; | ||
231 | ioc->ioc_regs.ll_halt = rb + FW_INIT_HALT_P0; | ||
232 | } else { | ||
233 | ioc->ioc_regs.heartbeat = (rb + BFA_IOC1_HBEAT_REG); | ||
234 | ioc->ioc_regs.ioc_fwstate = (rb + BFA_IOC1_STATE_REG); | ||
235 | ioc->ioc_regs.hfn_mbox_cmd = rb + iocreg_mbcmd_p1[pcifn].hfn; | ||
236 | ioc->ioc_regs.lpu_mbox_cmd = rb + iocreg_mbcmd_p1[pcifn].lpu; | ||
237 | ioc->ioc_regs.ll_halt = rb + FW_INIT_HALT_P1; | ||
238 | } | ||
239 | |||
240 | /* | ||
241 | * PSS control registers | ||
242 | */ | ||
243 | ioc->ioc_regs.pss_ctl_reg = (rb + PSS_CTL_REG); | ||
244 | ioc->ioc_regs.pss_err_status_reg = (rb + PSS_ERR_STATUS_REG); | ||
245 | ioc->ioc_regs.app_pll_fast_ctl_reg = (rb + APP_PLL_425_CTL_REG); | ||
246 | ioc->ioc_regs.app_pll_slow_ctl_reg = (rb + APP_PLL_312_CTL_REG); | ||
247 | |||
248 | /* | ||
249 | * IOC semaphore registers and serialization | ||
250 | */ | ||
251 | ioc->ioc_regs.ioc_sem_reg = (rb + HOST_SEM0_REG); | ||
252 | ioc->ioc_regs.ioc_usage_sem_reg = (rb + HOST_SEM1_REG); | ||
253 | ioc->ioc_regs.ioc_init_sem_reg = (rb + HOST_SEM2_REG); | ||
254 | ioc->ioc_regs.ioc_usage_reg = (rb + BFA_FW_USE_COUNT); | ||
255 | |||
256 | /** | ||
257 | * sram memory access | ||
258 | */ | ||
259 | ioc->ioc_regs.smem_page_start = (rb + PSS_SMEM_PAGE_START); | ||
260 | ioc->ioc_regs.smem_pg0 = BFI_IOC_SMEM_PG0_CT; | ||
261 | |||
262 | /* | ||
263 | * err set reg : for notification of hb failure in fcmode | ||
264 | */ | ||
265 | ioc->ioc_regs.err_set = (rb + ERR_SET_REG); | ||
266 | } | ||
267 | |||
268 | /** | ||
269 | * Initialize IOC to port mapping. | ||
270 | */ | ||
271 | |||
272 | #define FNC_PERS_FN_SHIFT(__fn) ((__fn) * 8) | ||
273 | static void | ||
274 | bfa_ioc_ct_map_port(struct bfa_ioc_s *ioc) | ||
275 | { | ||
276 | bfa_os_addr_t rb = ioc->pcidev.pci_bar_kva; | ||
277 | u32 r32; | ||
278 | |||
279 | /** | ||
280 | * For catapult, base port id on personality register and IOC type | ||
281 | */ | ||
282 | r32 = bfa_reg_read(rb + FNC_PERS_REG); | ||
283 | r32 >>= FNC_PERS_FN_SHIFT(bfa_ioc_pcifn(ioc)); | ||
284 | ioc->port_id = (r32 & __F0_PORT_MAP_MK) >> __F0_PORT_MAP_SH; | ||
285 | |||
286 | bfa_trc(ioc, bfa_ioc_pcifn(ioc)); | ||
287 | bfa_trc(ioc, ioc->port_id); | ||
288 | } | ||
289 | |||
290 | /** | ||
291 | * Set interrupt mode for a function: INTX or MSIX | ||
292 | */ | ||
293 | static void | ||
294 | bfa_ioc_ct_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix) | ||
295 | { | ||
296 | bfa_os_addr_t rb = ioc->pcidev.pci_bar_kva; | ||
297 | u32 r32, mode; | ||
298 | |||
299 | r32 = bfa_reg_read(rb + FNC_PERS_REG); | ||
300 | bfa_trc(ioc, r32); | ||
301 | |||
302 | mode = (r32 >> FNC_PERS_FN_SHIFT(bfa_ioc_pcifn(ioc))) & | ||
303 | __F0_INTX_STATUS; | ||
304 | |||
305 | /** | ||
306 | * If already in desired mode, do not change anything | ||
307 | */ | ||
308 | if (!msix && mode) | ||
309 | return; | ||
310 | |||
311 | if (msix) | ||
312 | mode = __F0_INTX_STATUS_MSIX; | ||
313 | else | ||
314 | mode = __F0_INTX_STATUS_INTA; | ||
315 | |||
316 | r32 &= ~(__F0_INTX_STATUS << FNC_PERS_FN_SHIFT(bfa_ioc_pcifn(ioc))); | ||
317 | r32 |= (mode << FNC_PERS_FN_SHIFT(bfa_ioc_pcifn(ioc))); | ||
318 | bfa_trc(ioc, r32); | ||
319 | |||
320 | bfa_reg_write(rb + FNC_PERS_REG, r32); | ||
321 | } | ||
322 | |||
323 | static bfa_status_t | ||
324 | bfa_ioc_ct_pll_init(struct bfa_ioc_s *ioc) | ||
325 | { | ||
326 | bfa_os_addr_t rb = ioc->pcidev.pci_bar_kva; | ||
327 | u32 pll_sclk, pll_fclk, r32; | ||
328 | |||
329 | /* | ||
330 | * Hold semaphore so that nobody can access the chip during init. | ||
331 | */ | ||
332 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_init_sem_reg); | ||
333 | |||
334 | pll_sclk = __APP_PLL_312_LRESETN | __APP_PLL_312_ENARST | | ||
335 | __APP_PLL_312_RSEL200500 | __APP_PLL_312_P0_1(3U) | | ||
336 | __APP_PLL_312_JITLMT0_1(3U) | | ||
337 | __APP_PLL_312_CNTLMT0_1(1U); | ||
338 | pll_fclk = __APP_PLL_425_LRESETN | __APP_PLL_425_ENARST | | ||
339 | __APP_PLL_425_RSEL200500 | __APP_PLL_425_P0_1(3U) | | ||
340 | __APP_PLL_425_JITLMT0_1(3U) | | ||
341 | __APP_PLL_425_CNTLMT0_1(1U); | ||
342 | |||
343 | /** | ||
344 | * For catapult, choose operational mode FC/FCoE | ||
345 | */ | ||
346 | if (ioc->fcmode) { | ||
347 | bfa_reg_write((rb + OP_MODE), 0); | ||
348 | bfa_reg_write((rb + ETH_MAC_SER_REG), | ||
349 | __APP_EMS_CMLCKSEL | | ||
350 | __APP_EMS_REFCKBUFEN2 | | ||
351 | __APP_EMS_CHANNEL_SEL); | ||
352 | } else { | ||
353 | ioc->pllinit = BFA_TRUE; | ||
354 | bfa_reg_write((rb + OP_MODE), __GLOBAL_FCOE_MODE); | ||
355 | bfa_reg_write((rb + ETH_MAC_SER_REG), | ||
356 | __APP_EMS_REFCKBUFEN1); | ||
357 | } | ||
358 | |||
359 | bfa_reg_write((rb + BFA_IOC0_STATE_REG), BFI_IOC_UNINIT); | ||
360 | bfa_reg_write((rb + BFA_IOC1_STATE_REG), BFI_IOC_UNINIT); | ||
361 | |||
362 | bfa_reg_write((rb + HOSTFN0_INT_MSK), 0xffffffffU); | ||
363 | bfa_reg_write((rb + HOSTFN1_INT_MSK), 0xffffffffU); | ||
364 | bfa_reg_write((rb + HOSTFN0_INT_STATUS), 0xffffffffU); | ||
365 | bfa_reg_write((rb + HOSTFN1_INT_STATUS), 0xffffffffU); | ||
366 | bfa_reg_write((rb + HOSTFN0_INT_MSK), 0xffffffffU); | ||
367 | bfa_reg_write((rb + HOSTFN1_INT_MSK), 0xffffffffU); | ||
368 | |||
369 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, pll_sclk | | ||
370 | __APP_PLL_312_LOGIC_SOFT_RESET); | ||
371 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, pll_fclk | | ||
372 | __APP_PLL_425_LOGIC_SOFT_RESET); | ||
373 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, pll_sclk | | ||
374 | __APP_PLL_312_LOGIC_SOFT_RESET | __APP_PLL_312_ENABLE); | ||
375 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, pll_fclk | | ||
376 | __APP_PLL_425_LOGIC_SOFT_RESET | __APP_PLL_425_ENABLE); | ||
377 | |||
378 | /** | ||
379 | * Wait for PLLs to lock. | ||
380 | */ | ||
381 | bfa_reg_read(rb + HOSTFN0_INT_MSK); | ||
382 | bfa_os_udelay(2000); | ||
383 | bfa_reg_write((rb + HOSTFN0_INT_STATUS), 0xffffffffU); | ||
384 | bfa_reg_write((rb + HOSTFN1_INT_STATUS), 0xffffffffU); | ||
385 | |||
386 | bfa_reg_write(ioc->ioc_regs.app_pll_slow_ctl_reg, pll_sclk | | ||
387 | __APP_PLL_312_ENABLE); | ||
388 | bfa_reg_write(ioc->ioc_regs.app_pll_fast_ctl_reg, pll_fclk | | ||
389 | __APP_PLL_425_ENABLE); | ||
390 | |||
391 | bfa_reg_write((rb + MBIST_CTL_REG), __EDRAM_BISTR_START); | ||
392 | bfa_os_udelay(1000); | ||
393 | r32 = bfa_reg_read((rb + MBIST_STAT_REG)); | ||
394 | bfa_trc(ioc, r32); | ||
395 | /* | ||
396 | * release semaphore. | ||
397 | */ | ||
398 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_init_sem_reg); | ||
399 | |||
400 | return BFA_STATUS_OK; | ||
401 | } | ||
402 | |||
403 | /** | ||
404 | * Cleanup hw semaphore and usecnt registers | ||
405 | */ | ||
406 | static void | ||
407 | bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc) | ||
408 | { | ||
409 | |||
410 | if (ioc->cna) { | ||
411 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); | ||
412 | bfa_reg_write(ioc->ioc_regs.ioc_usage_reg, 0); | ||
413 | bfa_ioc_sem_release(ioc->ioc_regs.ioc_usage_sem_reg); | ||
414 | } | ||
415 | |||
416 | /* | ||
417 | * Read the hw sem reg to make sure that it is locked | ||
418 | * before we clear it. If it is not locked, writing 1 | ||
419 | * will lock it instead of clearing it. | ||
420 | */ | ||
421 | bfa_reg_read(ioc->ioc_regs.ioc_sem_reg); | ||
422 | bfa_ioc_hw_sem_release(ioc); | ||
423 | } | ||
diff --git a/drivers/scsi/bfa/bfa_iocfc.c b/drivers/scsi/bfa/bfa_iocfc.c index d7ab792a9e54..a76de2669bfc 100644 --- a/drivers/scsi/bfa/bfa_iocfc.c +++ b/drivers/scsi/bfa/bfa_iocfc.c | |||
@@ -172,6 +172,7 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
172 | */ | 172 | */ |
173 | if (bfa_ioc_devid(&bfa->ioc) == BFA_PCI_DEVICE_ID_CT) { | 173 | if (bfa_ioc_devid(&bfa->ioc) == BFA_PCI_DEVICE_ID_CT) { |
174 | iocfc->hwif.hw_reginit = bfa_hwct_reginit; | 174 | iocfc->hwif.hw_reginit = bfa_hwct_reginit; |
175 | iocfc->hwif.hw_reqq_ack = bfa_hwct_reqq_ack; | ||
175 | iocfc->hwif.hw_rspq_ack = bfa_hwct_rspq_ack; | 176 | iocfc->hwif.hw_rspq_ack = bfa_hwct_rspq_ack; |
176 | iocfc->hwif.hw_msix_init = bfa_hwct_msix_init; | 177 | iocfc->hwif.hw_msix_init = bfa_hwct_msix_init; |
177 | iocfc->hwif.hw_msix_install = bfa_hwct_msix_install; | 178 | iocfc->hwif.hw_msix_install = bfa_hwct_msix_install; |
@@ -180,6 +181,7 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
180 | iocfc->hwif.hw_msix_getvecs = bfa_hwct_msix_getvecs; | 181 | iocfc->hwif.hw_msix_getvecs = bfa_hwct_msix_getvecs; |
181 | } else { | 182 | } else { |
182 | iocfc->hwif.hw_reginit = bfa_hwcb_reginit; | 183 | iocfc->hwif.hw_reginit = bfa_hwcb_reginit; |
184 | iocfc->hwif.hw_reqq_ack = bfa_hwcb_reqq_ack; | ||
183 | iocfc->hwif.hw_rspq_ack = bfa_hwcb_rspq_ack; | 185 | iocfc->hwif.hw_rspq_ack = bfa_hwcb_rspq_ack; |
184 | iocfc->hwif.hw_msix_init = bfa_hwcb_msix_init; | 186 | iocfc->hwif.hw_msix_init = bfa_hwcb_msix_init; |
185 | iocfc->hwif.hw_msix_install = bfa_hwcb_msix_install; | 187 | iocfc->hwif.hw_msix_install = bfa_hwcb_msix_install; |
@@ -336,8 +338,10 @@ bfa_iocfc_init_cb(void *bfa_arg, bfa_boolean_t complete) | |||
336 | bfa_cb_init(bfa->bfad, BFA_STATUS_OK); | 338 | bfa_cb_init(bfa->bfad, BFA_STATUS_OK); |
337 | else | 339 | else |
338 | bfa_cb_init(bfa->bfad, BFA_STATUS_FAILED); | 340 | bfa_cb_init(bfa->bfad, BFA_STATUS_FAILED); |
339 | } else | 341 | } else { |
340 | bfa->iocfc.action = BFA_IOCFC_ACT_NONE; | 342 | if (bfa->iocfc.cfgdone) |
343 | bfa->iocfc.action = BFA_IOCFC_ACT_NONE; | ||
344 | } | ||
341 | } | 345 | } |
342 | 346 | ||
343 | static void | 347 | static void |
@@ -619,8 +623,6 @@ bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
619 | 623 | ||
620 | bfa_ioc_attach(&bfa->ioc, bfa, &bfa_iocfc_cbfn, &bfa->timer_mod, | 624 | bfa_ioc_attach(&bfa->ioc, bfa, &bfa_iocfc_cbfn, &bfa->timer_mod, |
621 | bfa->trcmod, bfa->aen, bfa->logm); | 625 | bfa->trcmod, bfa->aen, bfa->logm); |
622 | bfa_ioc_pci_init(&bfa->ioc, pcidev, BFI_MC_IOCFC); | ||
623 | bfa_ioc_mbox_register(&bfa->ioc, bfa_mbox_isrs); | ||
624 | 626 | ||
625 | /** | 627 | /** |
626 | * Choose FC (ssid: 0x1C) v/s FCoE (ssid: 0x14) mode. | 628 | * Choose FC (ssid: 0x1C) v/s FCoE (ssid: 0x14) mode. |
@@ -628,6 +630,9 @@ bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
628 | if (0) | 630 | if (0) |
629 | bfa_ioc_set_fcmode(&bfa->ioc); | 631 | bfa_ioc_set_fcmode(&bfa->ioc); |
630 | 632 | ||
633 | bfa_ioc_pci_init(&bfa->ioc, pcidev, BFI_MC_IOCFC); | ||
634 | bfa_ioc_mbox_register(&bfa->ioc, bfa_mbox_isrs); | ||
635 | |||
631 | bfa_iocfc_init_mem(bfa, bfad, cfg, pcidev); | 636 | bfa_iocfc_init_mem(bfa, bfad, cfg, pcidev); |
632 | bfa_iocfc_mem_claim(bfa, cfg, meminfo); | 637 | bfa_iocfc_mem_claim(bfa, cfg, meminfo); |
633 | bfa_timer_init(&bfa->timer_mod); | 638 | bfa_timer_init(&bfa->timer_mod); |
@@ -654,7 +659,6 @@ bfa_iocfc_init(struct bfa_s *bfa) | |||
654 | { | 659 | { |
655 | bfa->iocfc.action = BFA_IOCFC_ACT_INIT; | 660 | bfa->iocfc.action = BFA_IOCFC_ACT_INIT; |
656 | bfa_ioc_enable(&bfa->ioc); | 661 | bfa_ioc_enable(&bfa->ioc); |
657 | bfa_msix_install(bfa); | ||
658 | } | 662 | } |
659 | 663 | ||
660 | /** | 664 | /** |
@@ -797,6 +801,11 @@ bfa_iocfc_get_stats(struct bfa_s *bfa, struct bfa_iocfc_stats_s *stats, | |||
797 | return BFA_STATUS_DEVBUSY; | 801 | return BFA_STATUS_DEVBUSY; |
798 | } | 802 | } |
799 | 803 | ||
804 | if (!bfa_iocfc_is_operational(bfa)) { | ||
805 | bfa_trc(bfa, 0); | ||
806 | return BFA_STATUS_IOC_NON_OP; | ||
807 | } | ||
808 | |||
800 | iocfc->stats_busy = BFA_TRUE; | 809 | iocfc->stats_busy = BFA_TRUE; |
801 | iocfc->stats_ret = stats; | 810 | iocfc->stats_ret = stats; |
802 | iocfc->stats_cbfn = cbfn; | 811 | iocfc->stats_cbfn = cbfn; |
@@ -817,6 +826,11 @@ bfa_iocfc_clear_stats(struct bfa_s *bfa, bfa_cb_ioc_t cbfn, void *cbarg) | |||
817 | return BFA_STATUS_DEVBUSY; | 826 | return BFA_STATUS_DEVBUSY; |
818 | } | 827 | } |
819 | 828 | ||
829 | if (!bfa_iocfc_is_operational(bfa)) { | ||
830 | bfa_trc(bfa, 0); | ||
831 | return BFA_STATUS_IOC_NON_OP; | ||
832 | } | ||
833 | |||
820 | iocfc->stats_busy = BFA_TRUE; | 834 | iocfc->stats_busy = BFA_TRUE; |
821 | iocfc->stats_cbfn = cbfn; | 835 | iocfc->stats_cbfn = cbfn; |
822 | iocfc->stats_cbarg = cbarg; | 836 | iocfc->stats_cbarg = cbarg; |
diff --git a/drivers/scsi/bfa/bfa_iocfc.h b/drivers/scsi/bfa/bfa_iocfc.h index ce9a830a4207..fbb4bdc9d600 100644 --- a/drivers/scsi/bfa/bfa_iocfc.h +++ b/drivers/scsi/bfa/bfa_iocfc.h | |||
@@ -54,6 +54,7 @@ struct bfa_msix_s { | |||
54 | */ | 54 | */ |
55 | struct bfa_hwif_s { | 55 | struct bfa_hwif_s { |
56 | void (*hw_reginit)(struct bfa_s *bfa); | 56 | void (*hw_reginit)(struct bfa_s *bfa); |
57 | void (*hw_reqq_ack)(struct bfa_s *bfa, int reqq); | ||
57 | void (*hw_rspq_ack)(struct bfa_s *bfa, int rspq); | 58 | void (*hw_rspq_ack)(struct bfa_s *bfa, int rspq); |
58 | void (*hw_msix_init)(struct bfa_s *bfa, int nvecs); | 59 | void (*hw_msix_init)(struct bfa_s *bfa, int nvecs); |
59 | void (*hw_msix_install)(struct bfa_s *bfa); | 60 | void (*hw_msix_install)(struct bfa_s *bfa); |
@@ -143,6 +144,7 @@ void bfa_msix_rspq(struct bfa_s *bfa, int vec); | |||
143 | void bfa_msix_lpu_err(struct bfa_s *bfa, int vec); | 144 | void bfa_msix_lpu_err(struct bfa_s *bfa, int vec); |
144 | 145 | ||
145 | void bfa_hwcb_reginit(struct bfa_s *bfa); | 146 | void bfa_hwcb_reginit(struct bfa_s *bfa); |
147 | void bfa_hwcb_reqq_ack(struct bfa_s *bfa, int rspq); | ||
146 | void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq); | 148 | void bfa_hwcb_rspq_ack(struct bfa_s *bfa, int rspq); |
147 | void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs); | 149 | void bfa_hwcb_msix_init(struct bfa_s *bfa, int nvecs); |
148 | void bfa_hwcb_msix_install(struct bfa_s *bfa); | 150 | void bfa_hwcb_msix_install(struct bfa_s *bfa); |
@@ -151,6 +153,7 @@ void bfa_hwcb_isr_mode_set(struct bfa_s *bfa, bfa_boolean_t msix); | |||
151 | void bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, | 153 | void bfa_hwcb_msix_getvecs(struct bfa_s *bfa, u32 *vecmap, |
152 | u32 *nvecs, u32 *maxvec); | 154 | u32 *nvecs, u32 *maxvec); |
153 | void bfa_hwct_reginit(struct bfa_s *bfa); | 155 | void bfa_hwct_reginit(struct bfa_s *bfa); |
156 | void bfa_hwct_reqq_ack(struct bfa_s *bfa, int rspq); | ||
154 | void bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq); | 157 | void bfa_hwct_rspq_ack(struct bfa_s *bfa, int rspq); |
155 | void bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs); | 158 | void bfa_hwct_msix_init(struct bfa_s *bfa, int nvecs); |
156 | void bfa_hwct_msix_install(struct bfa_s *bfa); | 159 | void bfa_hwct_msix_install(struct bfa_s *bfa); |
diff --git a/drivers/scsi/bfa/bfa_ioim.c b/drivers/scsi/bfa/bfa_ioim.c index f81d359b7089..5b107abe46e5 100644 --- a/drivers/scsi/bfa/bfa_ioim.c +++ b/drivers/scsi/bfa/bfa_ioim.c | |||
@@ -149,7 +149,7 @@ bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
149 | break; | 149 | break; |
150 | 150 | ||
151 | default: | 151 | default: |
152 | bfa_assert(0); | 152 | bfa_sm_fault(ioim->bfa, event); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
@@ -194,7 +194,7 @@ bfa_ioim_sm_sgalloc(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
194 | break; | 194 | break; |
195 | 195 | ||
196 | default: | 196 | default: |
197 | bfa_assert(0); | 197 | bfa_sm_fault(ioim->bfa, event); |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
@@ -259,7 +259,7 @@ bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
259 | break; | 259 | break; |
260 | 260 | ||
261 | default: | 261 | default: |
262 | bfa_assert(0); | 262 | bfa_sm_fault(ioim->bfa, event); |
263 | } | 263 | } |
264 | } | 264 | } |
265 | 265 | ||
@@ -317,7 +317,7 @@ bfa_ioim_sm_abort(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
317 | break; | 317 | break; |
318 | 318 | ||
319 | default: | 319 | default: |
320 | bfa_assert(0); | 320 | bfa_sm_fault(ioim->bfa, event); |
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
@@ -377,7 +377,7 @@ bfa_ioim_sm_cleanup(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
377 | break; | 377 | break; |
378 | 378 | ||
379 | default: | 379 | default: |
380 | bfa_assert(0); | 380 | bfa_sm_fault(ioim->bfa, event); |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
@@ -419,7 +419,7 @@ bfa_ioim_sm_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
419 | break; | 419 | break; |
420 | 420 | ||
421 | default: | 421 | default: |
422 | bfa_assert(0); | 422 | bfa_sm_fault(ioim->bfa, event); |
423 | } | 423 | } |
424 | } | 424 | } |
425 | 425 | ||
@@ -467,7 +467,7 @@ bfa_ioim_sm_abort_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
467 | break; | 467 | break; |
468 | 468 | ||
469 | default: | 469 | default: |
470 | bfa_assert(0); | 470 | bfa_sm_fault(ioim->bfa, event); |
471 | } | 471 | } |
472 | } | 472 | } |
473 | 473 | ||
@@ -516,7 +516,7 @@ bfa_ioim_sm_cleanup_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
516 | break; | 516 | break; |
517 | 517 | ||
518 | default: | 518 | default: |
519 | bfa_assert(0); | 519 | bfa_sm_fault(ioim->bfa, event); |
520 | } | 520 | } |
521 | } | 521 | } |
522 | 522 | ||
@@ -544,7 +544,7 @@ bfa_ioim_sm_hcb(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
544 | break; | 544 | break; |
545 | 545 | ||
546 | default: | 546 | default: |
547 | bfa_assert(0); | 547 | bfa_sm_fault(ioim->bfa, event); |
548 | } | 548 | } |
549 | } | 549 | } |
550 | 550 | ||
@@ -577,7 +577,7 @@ bfa_ioim_sm_hcb_free(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
577 | break; | 577 | break; |
578 | 578 | ||
579 | default: | 579 | default: |
580 | bfa_assert(0); | 580 | bfa_sm_fault(ioim->bfa, event); |
581 | } | 581 | } |
582 | } | 582 | } |
583 | 583 | ||
@@ -605,7 +605,7 @@ bfa_ioim_sm_resfree(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) | |||
605 | break; | 605 | break; |
606 | 606 | ||
607 | default: | 607 | default: |
608 | bfa_assert(0); | 608 | bfa_sm_fault(ioim->bfa, event); |
609 | } | 609 | } |
610 | } | 610 | } |
611 | 611 | ||
diff --git a/drivers/scsi/bfa/bfa_itnim.c b/drivers/scsi/bfa/bfa_itnim.c index eabf7d38bd09..a914ff255135 100644 --- a/drivers/scsi/bfa/bfa_itnim.c +++ b/drivers/scsi/bfa/bfa_itnim.c | |||
@@ -144,7 +144,7 @@ bfa_itnim_sm_uninit(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
144 | break; | 144 | break; |
145 | 145 | ||
146 | default: | 146 | default: |
147 | bfa_assert(0); | 147 | bfa_sm_fault(itnim->bfa, event); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
@@ -175,7 +175,7 @@ bfa_itnim_sm_created(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
175 | break; | 175 | break; |
176 | 176 | ||
177 | default: | 177 | default: |
178 | bfa_assert(0); | 178 | bfa_sm_fault(itnim->bfa, event); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
@@ -212,7 +212,7 @@ bfa_itnim_sm_fwcreate(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
212 | break; | 212 | break; |
213 | 213 | ||
214 | default: | 214 | default: |
215 | bfa_assert(0); | 215 | bfa_sm_fault(itnim->bfa, event); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
@@ -247,7 +247,7 @@ bfa_itnim_sm_fwcreate_qfull(struct bfa_itnim_s *itnim, | |||
247 | break; | 247 | break; |
248 | 248 | ||
249 | default: | 249 | default: |
250 | bfa_assert(0); | 250 | bfa_sm_fault(itnim->bfa, event); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
@@ -275,7 +275,7 @@ bfa_itnim_sm_delete_pending(struct bfa_itnim_s *itnim, | |||
275 | break; | 275 | break; |
276 | 276 | ||
277 | default: | 277 | default: |
278 | bfa_assert(0); | 278 | bfa_sm_fault(itnim->bfa, event); |
279 | } | 279 | } |
280 | } | 280 | } |
281 | 281 | ||
@@ -317,7 +317,7 @@ bfa_itnim_sm_online(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
317 | break; | 317 | break; |
318 | 318 | ||
319 | default: | 319 | default: |
320 | bfa_assert(0); | 320 | bfa_sm_fault(itnim->bfa, event); |
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
@@ -348,7 +348,7 @@ bfa_itnim_sm_sler(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
348 | break; | 348 | break; |
349 | 349 | ||
350 | default: | 350 | default: |
351 | bfa_assert(0); | 351 | bfa_sm_fault(itnim->bfa, event); |
352 | } | 352 | } |
353 | } | 353 | } |
354 | 354 | ||
@@ -385,7 +385,7 @@ bfa_itnim_sm_cleanup_offline(struct bfa_itnim_s *itnim, | |||
385 | break; | 385 | break; |
386 | 386 | ||
387 | default: | 387 | default: |
388 | bfa_assert(0); | 388 | bfa_sm_fault(itnim->bfa, event); |
389 | } | 389 | } |
390 | } | 390 | } |
391 | 391 | ||
@@ -413,7 +413,7 @@ bfa_itnim_sm_cleanup_delete(struct bfa_itnim_s *itnim, | |||
413 | break; | 413 | break; |
414 | 414 | ||
415 | default: | 415 | default: |
416 | bfa_assert(0); | 416 | bfa_sm_fault(itnim->bfa, event); |
417 | } | 417 | } |
418 | } | 418 | } |
419 | 419 | ||
@@ -442,7 +442,7 @@ bfa_itnim_sm_fwdelete(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
442 | break; | 442 | break; |
443 | 443 | ||
444 | default: | 444 | default: |
445 | bfa_assert(0); | 445 | bfa_sm_fault(itnim->bfa, event); |
446 | } | 446 | } |
447 | } | 447 | } |
448 | 448 | ||
@@ -470,7 +470,7 @@ bfa_itnim_sm_fwdelete_qfull(struct bfa_itnim_s *itnim, | |||
470 | break; | 470 | break; |
471 | 471 | ||
472 | default: | 472 | default: |
473 | bfa_assert(0); | 473 | bfa_sm_fault(itnim->bfa, event); |
474 | } | 474 | } |
475 | } | 475 | } |
476 | 476 | ||
@@ -502,7 +502,7 @@ bfa_itnim_sm_offline(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
502 | break; | 502 | break; |
503 | 503 | ||
504 | default: | 504 | default: |
505 | bfa_assert(0); | 505 | bfa_sm_fault(itnim->bfa, event); |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
@@ -538,7 +538,7 @@ bfa_itnim_sm_iocdisable(struct bfa_itnim_s *itnim, | |||
538 | break; | 538 | break; |
539 | 539 | ||
540 | default: | 540 | default: |
541 | bfa_assert(0); | 541 | bfa_sm_fault(itnim->bfa, event); |
542 | } | 542 | } |
543 | } | 543 | } |
544 | 544 | ||
@@ -559,7 +559,7 @@ bfa_itnim_sm_deleting(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) | |||
559 | break; | 559 | break; |
560 | 560 | ||
561 | default: | 561 | default: |
562 | bfa_assert(0); | 562 | bfa_sm_fault(itnim->bfa, event); |
563 | } | 563 | } |
564 | } | 564 | } |
565 | 565 | ||
@@ -583,7 +583,7 @@ bfa_itnim_sm_deleting_qfull(struct bfa_itnim_s *itnim, | |||
583 | break; | 583 | break; |
584 | 584 | ||
585 | default: | 585 | default: |
586 | bfa_assert(0); | 586 | bfa_sm_fault(itnim->bfa, event); |
587 | } | 587 | } |
588 | } | 588 | } |
589 | 589 | ||
diff --git a/drivers/scsi/bfa/bfa_lps.c b/drivers/scsi/bfa/bfa_lps.c index 9844b45412b6..ad06f6189092 100644 --- a/drivers/scsi/bfa/bfa_lps.c +++ b/drivers/scsi/bfa/bfa_lps.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <bfa.h> | 18 | #include <bfa.h> |
19 | #include <bfi/bfi_lps.h> | 19 | #include <bfi/bfi_lps.h> |
20 | #include <cs/bfa_debug.h> | 20 | #include <cs/bfa_debug.h> |
21 | #include <defs/bfa_defs_pci.h> | ||
21 | 22 | ||
22 | BFA_TRC_FILE(HAL, LPS); | 23 | BFA_TRC_FILE(HAL, LPS); |
23 | BFA_MODULE(lps); | 24 | BFA_MODULE(lps); |
@@ -25,6 +26,12 @@ BFA_MODULE(lps); | |||
25 | #define BFA_LPS_MIN_LPORTS (1) | 26 | #define BFA_LPS_MIN_LPORTS (1) |
26 | #define BFA_LPS_MAX_LPORTS (256) | 27 | #define BFA_LPS_MAX_LPORTS (256) |
27 | 28 | ||
29 | /* | ||
30 | * Maximum Vports supported per physical port or vf. | ||
31 | */ | ||
32 | #define BFA_LPS_MAX_VPORTS_SUPP_CB 255 | ||
33 | #define BFA_LPS_MAX_VPORTS_SUPP_CT 190 | ||
34 | |||
28 | /** | 35 | /** |
29 | * forward declarations | 36 | * forward declarations |
30 | */ | 37 | */ |
@@ -49,7 +56,7 @@ static void bfa_lps_send_login(struct bfa_lps_s *lps); | |||
49 | static void bfa_lps_send_logout(struct bfa_lps_s *lps); | 56 | static void bfa_lps_send_logout(struct bfa_lps_s *lps); |
50 | static void bfa_lps_login_comp(struct bfa_lps_s *lps); | 57 | static void bfa_lps_login_comp(struct bfa_lps_s *lps); |
51 | static void bfa_lps_logout_comp(struct bfa_lps_s *lps); | 58 | static void bfa_lps_logout_comp(struct bfa_lps_s *lps); |
52 | 59 | static void bfa_lps_cvl_event(struct bfa_lps_s *lps); | |
53 | 60 | ||
54 | /** | 61 | /** |
55 | * lps_pvt BFA LPS private functions | 62 | * lps_pvt BFA LPS private functions |
@@ -62,6 +69,7 @@ enum bfa_lps_event { | |||
62 | BFA_LPS_SM_RESUME = 4, /* space present in reqq queue */ | 69 | BFA_LPS_SM_RESUME = 4, /* space present in reqq queue */ |
63 | BFA_LPS_SM_DELETE = 5, /* lps delete from user */ | 70 | BFA_LPS_SM_DELETE = 5, /* lps delete from user */ |
64 | BFA_LPS_SM_OFFLINE = 6, /* Link is offline */ | 71 | BFA_LPS_SM_OFFLINE = 6, /* Link is offline */ |
72 | BFA_LPS_SM_RX_CVL = 7, /* Rx clear virtual link */ | ||
65 | }; | 73 | }; |
66 | 74 | ||
67 | static void bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event); | 75 | static void bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event); |
@@ -91,6 +99,12 @@ bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
91 | bfa_sm_set_state(lps, bfa_lps_sm_login); | 99 | bfa_sm_set_state(lps, bfa_lps_sm_login); |
92 | bfa_lps_send_login(lps); | 100 | bfa_lps_send_login(lps); |
93 | } | 101 | } |
102 | if (lps->fdisc) | ||
103 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
104 | BFA_PL_EID_LOGIN, 0, "FDISC Request"); | ||
105 | else | ||
106 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
107 | BFA_PL_EID_LOGIN, 0, "FLOGI Request"); | ||
94 | break; | 108 | break; |
95 | 109 | ||
96 | case BFA_LPS_SM_LOGOUT: | 110 | case BFA_LPS_SM_LOGOUT: |
@@ -101,6 +115,7 @@ bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
101 | bfa_lps_free(lps); | 115 | bfa_lps_free(lps); |
102 | break; | 116 | break; |
103 | 117 | ||
118 | case BFA_LPS_SM_RX_CVL: | ||
104 | case BFA_LPS_SM_OFFLINE: | 119 | case BFA_LPS_SM_OFFLINE: |
105 | break; | 120 | break; |
106 | 121 | ||
@@ -112,7 +127,7 @@ bfa_lps_sm_init(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
112 | break; | 127 | break; |
113 | 128 | ||
114 | default: | 129 | default: |
115 | bfa_assert(0); | 130 | bfa_sm_fault(lps->bfa, event); |
116 | } | 131 | } |
117 | } | 132 | } |
118 | 133 | ||
@@ -127,10 +142,25 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
127 | 142 | ||
128 | switch (event) { | 143 | switch (event) { |
129 | case BFA_LPS_SM_FWRSP: | 144 | case BFA_LPS_SM_FWRSP: |
130 | if (lps->status == BFA_STATUS_OK) | 145 | if (lps->status == BFA_STATUS_OK) { |
131 | bfa_sm_set_state(lps, bfa_lps_sm_online); | 146 | bfa_sm_set_state(lps, bfa_lps_sm_online); |
132 | else | 147 | if (lps->fdisc) |
148 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
149 | BFA_PL_EID_LOGIN, 0, "FDISC Accept"); | ||
150 | else | ||
151 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
152 | BFA_PL_EID_LOGIN, 0, "FLOGI Accept"); | ||
153 | } else { | ||
133 | bfa_sm_set_state(lps, bfa_lps_sm_init); | 154 | bfa_sm_set_state(lps, bfa_lps_sm_init); |
155 | if (lps->fdisc) | ||
156 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
157 | BFA_PL_EID_LOGIN, 0, | ||
158 | "FDISC Fail (RJT or timeout)"); | ||
159 | else | ||
160 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
161 | BFA_PL_EID_LOGIN, 0, | ||
162 | "FLOGI Fail (RJT or timeout)"); | ||
163 | } | ||
134 | bfa_lps_login_comp(lps); | 164 | bfa_lps_login_comp(lps); |
135 | break; | 165 | break; |
136 | 166 | ||
@@ -139,7 +169,7 @@ bfa_lps_sm_login(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
139 | break; | 169 | break; |
140 | 170 | ||
141 | default: | 171 | default: |
142 | bfa_assert(0); | 172 | bfa_sm_fault(lps->bfa, event); |
143 | } | 173 | } |
144 | } | 174 | } |
145 | 175 | ||
@@ -162,8 +192,16 @@ bfa_lps_sm_loginwait(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
162 | bfa_reqq_wcancel(&lps->wqe); | 192 | bfa_reqq_wcancel(&lps->wqe); |
163 | break; | 193 | break; |
164 | 194 | ||
195 | case BFA_LPS_SM_RX_CVL: | ||
196 | /* | ||
197 | * Login was not even sent out; so when getting out | ||
198 | * of this state, it will appear like a login retry | ||
199 | * after Clear virtual link | ||
200 | */ | ||
201 | break; | ||
202 | |||
165 | default: | 203 | default: |
166 | bfa_assert(0); | 204 | bfa_sm_fault(lps->bfa, event); |
167 | } | 205 | } |
168 | } | 206 | } |
169 | 207 | ||
@@ -185,6 +223,17 @@ bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
185 | bfa_sm_set_state(lps, bfa_lps_sm_logout); | 223 | bfa_sm_set_state(lps, bfa_lps_sm_logout); |
186 | bfa_lps_send_logout(lps); | 224 | bfa_lps_send_logout(lps); |
187 | } | 225 | } |
226 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
227 | BFA_PL_EID_LOGO, 0, "Logout"); | ||
228 | break; | ||
229 | |||
230 | case BFA_LPS_SM_RX_CVL: | ||
231 | bfa_sm_set_state(lps, bfa_lps_sm_init); | ||
232 | |||
233 | /* Let the vport module know about this event */ | ||
234 | bfa_lps_cvl_event(lps); | ||
235 | bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, | ||
236 | BFA_PL_EID_FIP_FCF_CVL, 0, "FCF Clear Virt. Link Rx"); | ||
188 | break; | 237 | break; |
189 | 238 | ||
190 | case BFA_LPS_SM_OFFLINE: | 239 | case BFA_LPS_SM_OFFLINE: |
@@ -193,7 +242,7 @@ bfa_lps_sm_online(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
193 | break; | 242 | break; |
194 | 243 | ||
195 | default: | 244 | default: |
196 | bfa_assert(0); | 245 | bfa_sm_fault(lps->bfa, event); |
197 | } | 246 | } |
198 | } | 247 | } |
199 | 248 | ||
@@ -217,7 +266,7 @@ bfa_lps_sm_logout(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
217 | break; | 266 | break; |
218 | 267 | ||
219 | default: | 268 | default: |
220 | bfa_assert(0); | 269 | bfa_sm_fault(lps->bfa, event); |
221 | } | 270 | } |
222 | } | 271 | } |
223 | 272 | ||
@@ -242,7 +291,7 @@ bfa_lps_sm_logowait(struct bfa_lps_s *lps, enum bfa_lps_event event) | |||
242 | break; | 291 | break; |
243 | 292 | ||
244 | default: | 293 | default: |
245 | bfa_assert(0); | 294 | bfa_sm_fault(lps->bfa, event); |
246 | } | 295 | } |
247 | } | 296 | } |
248 | 297 | ||
@@ -396,6 +445,20 @@ bfa_lps_logout_rsp(struct bfa_s *bfa, struct bfi_lps_logout_rsp_s *rsp) | |||
396 | } | 445 | } |
397 | 446 | ||
398 | /** | 447 | /** |
448 | * Firmware received a Clear virtual link request (for FCoE) | ||
449 | */ | ||
450 | static void | ||
451 | bfa_lps_rx_cvl_event(struct bfa_s *bfa, struct bfi_lps_cvl_event_s *cvl) | ||
452 | { | ||
453 | struct bfa_lps_mod_s *mod = BFA_LPS_MOD(bfa); | ||
454 | struct bfa_lps_s *lps; | ||
455 | |||
456 | lps = BFA_LPS_FROM_TAG(mod, cvl->lp_tag); | ||
457 | |||
458 | bfa_sm_send_event(lps, BFA_LPS_SM_RX_CVL); | ||
459 | } | ||
460 | |||
461 | /** | ||
399 | * Space is available in request queue, resume queueing request to firmware. | 462 | * Space is available in request queue, resume queueing request to firmware. |
400 | */ | 463 | */ |
401 | static void | 464 | static void |
@@ -531,7 +594,48 @@ bfa_lps_logout_comp(struct bfa_lps_s *lps) | |||
531 | bfa_cb_lps_flogo_comp(lps->bfa->bfad, lps->uarg); | 594 | bfa_cb_lps_flogo_comp(lps->bfa->bfad, lps->uarg); |
532 | } | 595 | } |
533 | 596 | ||
597 | /** | ||
598 | * Clear virtual link completion handler for non-fcs | ||
599 | */ | ||
600 | static void | ||
601 | bfa_lps_cvl_event_cb(void *arg, bfa_boolean_t complete) | ||
602 | { | ||
603 | struct bfa_lps_s *lps = arg; | ||
604 | |||
605 | if (!complete) | ||
606 | return; | ||
607 | |||
608 | /* Clear virtual link to base port will result in link down */ | ||
609 | if (lps->fdisc) | ||
610 | bfa_cb_lps_cvl_event(lps->bfa->bfad, lps->uarg); | ||
611 | } | ||
612 | |||
613 | /** | ||
614 | * Received Clear virtual link event --direct call for fcs, | ||
615 | * queue for others | ||
616 | */ | ||
617 | static void | ||
618 | bfa_lps_cvl_event(struct bfa_lps_s *lps) | ||
619 | { | ||
620 | if (!lps->bfa->fcs) { | ||
621 | bfa_cb_queue(lps->bfa, &lps->hcb_qe, bfa_lps_cvl_event_cb, | ||
622 | lps); | ||
623 | return; | ||
624 | } | ||
625 | |||
626 | /* Clear virtual link to base port will result in link down */ | ||
627 | if (lps->fdisc) | ||
628 | bfa_cb_lps_cvl_event(lps->bfa->bfad, lps->uarg); | ||
629 | } | ||
534 | 630 | ||
631 | u32 | ||
632 | bfa_lps_get_max_vport(struct bfa_s *bfa) | ||
633 | { | ||
634 | if (bfa_ioc_devid(&bfa->ioc) == BFA_PCI_DEVICE_ID_CT) | ||
635 | return BFA_LPS_MAX_VPORTS_SUPP_CT; | ||
636 | else | ||
637 | return BFA_LPS_MAX_VPORTS_SUPP_CB; | ||
638 | } | ||
535 | 639 | ||
536 | /** | 640 | /** |
537 | * lps_public BFA LPS public functions | 641 | * lps_public BFA LPS public functions |
@@ -752,6 +856,14 @@ bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps) | |||
752 | return lps->lsrjt_expl; | 856 | return lps->lsrjt_expl; |
753 | } | 857 | } |
754 | 858 | ||
859 | /** | ||
860 | * Return fpma/spma MAC for lport | ||
861 | */ | ||
862 | struct mac_s | ||
863 | bfa_lps_get_lp_mac(struct bfa_lps_s *lps) | ||
864 | { | ||
865 | return lps->lp_mac; | ||
866 | } | ||
755 | 867 | ||
756 | /** | 868 | /** |
757 | * LPS firmware message class handler. | 869 | * LPS firmware message class handler. |
@@ -773,6 +885,10 @@ bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *m) | |||
773 | bfa_lps_logout_rsp(bfa, msg.logout_rsp); | 885 | bfa_lps_logout_rsp(bfa, msg.logout_rsp); |
774 | break; | 886 | break; |
775 | 887 | ||
888 | case BFI_LPS_H2I_CVL_EVENT: | ||
889 | bfa_lps_rx_cvl_event(bfa, msg.cvl_event); | ||
890 | break; | ||
891 | |||
776 | default: | 892 | default: |
777 | bfa_trc(bfa, m->mhdr.msg_id); | 893 | bfa_trc(bfa, m->mhdr.msg_id); |
778 | bfa_assert(0); | 894 | bfa_assert(0); |
diff --git a/drivers/scsi/bfa/bfa_module.c b/drivers/scsi/bfa/bfa_module.c index 32eda8e1ec65..a7fcc80c177e 100644 --- a/drivers/scsi/bfa/bfa_module.c +++ b/drivers/scsi/bfa/bfa_module.c | |||
@@ -24,7 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | struct bfa_module_s *hal_mods[] = { | 25 | struct bfa_module_s *hal_mods[] = { |
26 | &hal_mod_sgpg, | 26 | &hal_mod_sgpg, |
27 | &hal_mod_pport, | 27 | &hal_mod_fcport, |
28 | &hal_mod_fcxp, | 28 | &hal_mod_fcxp, |
29 | &hal_mod_lps, | 29 | &hal_mod_lps, |
30 | &hal_mod_uf, | 30 | &hal_mod_uf, |
@@ -45,7 +45,7 @@ bfa_isr_func_t bfa_isrs[BFI_MC_MAX] = { | |||
45 | bfa_isr_unhandled, /* BFI_MC_DIAG */ | 45 | bfa_isr_unhandled, /* BFI_MC_DIAG */ |
46 | bfa_isr_unhandled, /* BFI_MC_FLASH */ | 46 | bfa_isr_unhandled, /* BFI_MC_FLASH */ |
47 | bfa_isr_unhandled, /* BFI_MC_CEE */ | 47 | bfa_isr_unhandled, /* BFI_MC_CEE */ |
48 | bfa_pport_isr, /* BFI_MC_PORT */ | 48 | bfa_fcport_isr, /* BFI_MC_FCPORT */ |
49 | bfa_isr_unhandled, /* BFI_MC_IOCFC */ | 49 | bfa_isr_unhandled, /* BFI_MC_IOCFC */ |
50 | bfa_isr_unhandled, /* BFI_MC_LL */ | 50 | bfa_isr_unhandled, /* BFI_MC_LL */ |
51 | bfa_uf_isr, /* BFI_MC_UF */ | 51 | bfa_uf_isr, /* BFI_MC_UF */ |
diff --git a/drivers/scsi/bfa/bfa_modules_priv.h b/drivers/scsi/bfa/bfa_modules_priv.h index 96f70534593c..f554c2fad6a9 100644 --- a/drivers/scsi/bfa/bfa_modules_priv.h +++ b/drivers/scsi/bfa/bfa_modules_priv.h | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | struct bfa_modules_s { | 31 | struct bfa_modules_s { |
32 | struct bfa_pport_s pport; /* physical port module */ | 32 | struct bfa_fcport_s fcport; /* fc port module */ |
33 | struct bfa_fcxp_mod_s fcxp_mod; /* fcxp module */ | 33 | struct bfa_fcxp_mod_s fcxp_mod; /* fcxp module */ |
34 | struct bfa_lps_mod_s lps_mod; /* fcxp module */ | 34 | struct bfa_lps_mod_s lps_mod; /* fcxp module */ |
35 | struct bfa_uf_mod_s uf_mod; /* unsolicited frame module */ | 35 | struct bfa_uf_mod_s uf_mod; /* unsolicited frame module */ |
diff --git a/drivers/scsi/bfa/bfa_port_priv.h b/drivers/scsi/bfa/bfa_port_priv.h index 51f698a06b6d..40e256ec67ff 100644 --- a/drivers/scsi/bfa/bfa_port_priv.h +++ b/drivers/scsi/bfa/bfa_port_priv.h | |||
@@ -23,9 +23,19 @@ | |||
23 | #include "bfa_intr_priv.h" | 23 | #include "bfa_intr_priv.h" |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * BFA physical port data structure | 26 | * Link notification data structure |
27 | */ | 27 | */ |
28 | struct bfa_pport_s { | 28 | struct bfa_fcport_ln_s { |
29 | struct bfa_fcport_s *fcport; | ||
30 | bfa_sm_t sm; | ||
31 | struct bfa_cb_qe_s ln_qe; /* BFA callback queue elem for ln */ | ||
32 | enum bfa_pport_linkstate ln_event; /* ln event for callback */ | ||
33 | }; | ||
34 | |||
35 | /** | ||
36 | * BFA FC port data structure | ||
37 | */ | ||
38 | struct bfa_fcport_s { | ||
29 | struct bfa_s *bfa; /* parent BFA instance */ | 39 | struct bfa_s *bfa; /* parent BFA instance */ |
30 | bfa_sm_t sm; /* port state machine */ | 40 | bfa_sm_t sm; /* port state machine */ |
31 | wwn_t nwwn; /* node wwn of physical port */ | 41 | wwn_t nwwn; /* node wwn of physical port */ |
@@ -36,6 +46,8 @@ struct bfa_pport_s { | |||
36 | enum bfa_pport_topology topology; /* current topology */ | 46 | enum bfa_pport_topology topology; /* current topology */ |
37 | u8 myalpa; /* my ALPA in LOOP topology */ | 47 | u8 myalpa; /* my ALPA in LOOP topology */ |
38 | u8 rsvd[3]; | 48 | u8 rsvd[3]; |
49 | u32 mypid:24; | ||
50 | u32 rsvd_b:8; | ||
39 | struct bfa_pport_cfg_s cfg; /* current port configuration */ | 51 | struct bfa_pport_cfg_s cfg; /* current port configuration */ |
40 | struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ | 52 | struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ |
41 | struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */ | 53 | struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */ |
@@ -49,42 +61,31 @@ struct bfa_pport_s { | |||
49 | void (*event_cbfn) (void *cbarg, | 61 | void (*event_cbfn) (void *cbarg, |
50 | bfa_pport_event_t event); | 62 | bfa_pport_event_t event); |
51 | union { | 63 | union { |
52 | union bfi_pport_i2h_msg_u i2hmsg; | 64 | union bfi_fcport_i2h_msg_u i2hmsg; |
53 | } event_arg; | 65 | } event_arg; |
54 | void *bfad; /* BFA driver handle */ | 66 | void *bfad; /* BFA driver handle */ |
67 | struct bfa_fcport_ln_s ln; /* Link Notification */ | ||
55 | struct bfa_cb_qe_s hcb_qe; /* BFA callback queue elem */ | 68 | struct bfa_cb_qe_s hcb_qe; /* BFA callback queue elem */ |
56 | enum bfa_pport_linkstate hcb_event; | 69 | struct bfa_timer_s timer; /* timer */ |
57 | /* link event for callback */ | ||
58 | u32 msgtag; /* fimrware msg tag for reply */ | 70 | u32 msgtag; /* fimrware msg tag for reply */ |
59 | u8 *stats_kva; | 71 | u8 *stats_kva; |
60 | u64 stats_pa; | 72 | u64 stats_pa; |
61 | union bfa_pport_stats_u *stats; /* pport stats */ | 73 | union bfa_fcport_stats_u *stats; |
62 | u32 mypid:24; | 74 | union bfa_fcport_stats_u *stats_ret; /* driver stats location */ |
63 | u32 rsvd_b:8; | 75 | bfa_status_t stats_status; /* stats/statsclr status */ |
64 | struct bfa_timer_s timer; /* timer */ | 76 | bfa_boolean_t stats_busy; /* outstanding stats/statsclr */ |
65 | union bfa_pport_stats_u *stats_ret; | 77 | bfa_boolean_t stats_qfull; |
66 | /* driver stats location */ | 78 | bfa_cb_pport_t stats_cbfn; /* driver callback function */ |
67 | bfa_status_t stats_status; | 79 | void *stats_cbarg; /* *!< user callback arg */ |
68 | /* stats/statsclr status */ | 80 | bfa_boolean_t diag_busy; /* diag busy status */ |
69 | bfa_boolean_t stats_busy; | 81 | bfa_boolean_t beacon; /* port beacon status */ |
70 | /* outstanding stats/statsclr */ | 82 | bfa_boolean_t link_e2e_beacon; /* link beacon status */ |
71 | bfa_boolean_t stats_qfull; | ||
72 | bfa_boolean_t diag_busy; | ||
73 | /* diag busy status */ | ||
74 | bfa_boolean_t beacon; | ||
75 | /* port beacon status */ | ||
76 | bfa_boolean_t link_e2e_beacon; | ||
77 | /* link beacon status */ | ||
78 | bfa_cb_pport_t stats_cbfn; | ||
79 | /* driver callback function */ | ||
80 | void *stats_cbarg; | ||
81 | /* *!< user callback arg */ | ||
82 | }; | 83 | }; |
83 | 84 | ||
84 | #define BFA_PORT_MOD(__bfa) (&(__bfa)->modules.pport) | 85 | #define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport) |
85 | 86 | ||
86 | /* | 87 | /* |
87 | * public functions | 88 | * public functions |
88 | */ | 89 | */ |
89 | void bfa_pport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | 90 | void bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); |
90 | #endif /* __BFA_PORT_PRIV_H__ */ | 91 | #endif /* __BFA_PORT_PRIV_H__ */ |
diff --git a/drivers/scsi/bfa/bfa_priv.h b/drivers/scsi/bfa/bfa_priv.h index 0747a6b26f7b..be80fc7e1b0e 100644 --- a/drivers/scsi/bfa/bfa_priv.h +++ b/drivers/scsi/bfa/bfa_priv.h | |||
@@ -101,7 +101,7 @@ extern bfa_boolean_t bfa_auto_recover; | |||
101 | extern struct bfa_module_s hal_mod_flash; | 101 | extern struct bfa_module_s hal_mod_flash; |
102 | extern struct bfa_module_s hal_mod_fcdiag; | 102 | extern struct bfa_module_s hal_mod_fcdiag; |
103 | extern struct bfa_module_s hal_mod_sgpg; | 103 | extern struct bfa_module_s hal_mod_sgpg; |
104 | extern struct bfa_module_s hal_mod_pport; | 104 | extern struct bfa_module_s hal_mod_fcport; |
105 | extern struct bfa_module_s hal_mod_fcxp; | 105 | extern struct bfa_module_s hal_mod_fcxp; |
106 | extern struct bfa_module_s hal_mod_lps; | 106 | extern struct bfa_module_s hal_mod_lps; |
107 | extern struct bfa_module_s hal_mod_uf; | 107 | extern struct bfa_module_s hal_mod_uf; |
diff --git a/drivers/scsi/bfa/bfa_rport.c b/drivers/scsi/bfa/bfa_rport.c index 3e1990a74258..7c509fa244e4 100644 --- a/drivers/scsi/bfa/bfa_rport.c +++ b/drivers/scsi/bfa/bfa_rport.c | |||
@@ -114,7 +114,7 @@ bfa_rport_sm_uninit(struct bfa_rport_s *rp, enum bfa_rport_event event) | |||
114 | 114 | ||
115 | default: | 115 | default: |
116 | bfa_stats(rp, sm_un_unexp); | 116 | bfa_stats(rp, sm_un_unexp); |
117 | bfa_assert(0); | 117 | bfa_sm_fault(rp->bfa, event); |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
@@ -146,7 +146,7 @@ bfa_rport_sm_created(struct bfa_rport_s *rp, enum bfa_rport_event event) | |||
146 | 146 | ||
147 | default: | 147 | default: |
148 | bfa_stats(rp, sm_cr_unexp); | 148 | bfa_stats(rp, sm_cr_unexp); |
149 | bfa_assert(0); | 149 | bfa_sm_fault(rp->bfa, event); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
@@ -183,7 +183,7 @@ bfa_rport_sm_fwcreate(struct bfa_rport_s *rp, enum bfa_rport_event event) | |||
183 | 183 | ||
184 | default: | 184 | default: |
185 | bfa_stats(rp, sm_fwc_unexp); | 185 | bfa_stats(rp, sm_fwc_unexp); |
186 | bfa_assert(0); | 186 | bfa_sm_fault(rp->bfa, event); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | 189 | ||
@@ -224,7 +224,7 @@ bfa_rport_sm_fwcreate_qfull(struct bfa_rport_s *rp, enum bfa_rport_event event) | |||
224 | 224 | ||
225 | default: | 225 | default: |
226 | bfa_stats(rp, sm_fwc_unexp); | 226 | bfa_stats(rp, sm_fwc_unexp); |
227 | bfa_assert(0); | 227 | bfa_sm_fault(rp->bfa, event); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | 230 | ||
@@ -296,7 +296,7 @@ bfa_rport_sm_online(struct bfa_rport_s *rp, enum bfa_rport_event event) | |||
296 | 296 | ||
297 | default: | 297 | default: |
298 | bfa_stats(rp, sm_on_unexp); | 298 | bfa_stats(rp, sm_on_unexp); |
299 | bfa_assert(0); | 299 | bfa_sm_fault(rp->bfa, event); |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
@@ -329,7 +329,7 @@ bfa_rport_sm_fwdelete(struct bfa_rport_s *rp, enum bfa_rport_event event) | |||
329 | 329 | ||
330 | default: | 330 | default: |
331 | bfa_stats(rp, sm_fwd_unexp); | 331 | bfa_stats(rp, sm_fwd_unexp); |
332 | bfa_assert(0); | 332 | bfa_sm_fault(rp->bfa, event); |
333 | } | 333 | } |
334 | } | 334 | } |
335 | 335 | ||
@@ -359,7 +359,7 @@ bfa_rport_sm_fwdelete_qfull(struct bfa_rport_s *rp, enum bfa_rport_event event) | |||
359 | 359 | ||
360 | default: | 360 | default: |
361 | bfa_stats(rp, sm_fwd_unexp); | 361 | bfa_stats(rp, sm_fwd_unexp); |
362 | bfa_assert(0); | 362 | bfa_sm_fault(rp->bfa, event); |
363 | } | 363 | } |
364 | } | 364 | } |
365 | 365 | ||
@@ -394,7 +394,7 @@ bfa_rport_sm_offline(struct bfa_rport_s *rp, enum bfa_rport_event event) | |||
394 | 394 | ||
395 | default: | 395 | default: |
396 | bfa_stats(rp, sm_off_unexp); | 396 | bfa_stats(rp, sm_off_unexp); |
397 | bfa_assert(0); | 397 | bfa_sm_fault(rp->bfa, event); |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
@@ -421,7 +421,7 @@ bfa_rport_sm_deleting(struct bfa_rport_s *rp, enum bfa_rport_event event) | |||
421 | break; | 421 | break; |
422 | 422 | ||
423 | default: | 423 | default: |
424 | bfa_assert(0); | 424 | bfa_sm_fault(rp->bfa, event); |
425 | } | 425 | } |
426 | } | 426 | } |
427 | 427 | ||
@@ -446,7 +446,7 @@ bfa_rport_sm_deleting_qfull(struct bfa_rport_s *rp, enum bfa_rport_event event) | |||
446 | break; | 446 | break; |
447 | 447 | ||
448 | default: | 448 | default: |
449 | bfa_assert(0); | 449 | bfa_sm_fault(rp->bfa, event); |
450 | } | 450 | } |
451 | } | 451 | } |
452 | 452 | ||
@@ -477,7 +477,7 @@ bfa_rport_sm_delete_pending(struct bfa_rport_s *rp, | |||
477 | 477 | ||
478 | default: | 478 | default: |
479 | bfa_stats(rp, sm_delp_unexp); | 479 | bfa_stats(rp, sm_delp_unexp); |
480 | bfa_assert(0); | 480 | bfa_sm_fault(rp->bfa, event); |
481 | } | 481 | } |
482 | } | 482 | } |
483 | 483 | ||
@@ -512,7 +512,7 @@ bfa_rport_sm_offline_pending(struct bfa_rport_s *rp, | |||
512 | 512 | ||
513 | default: | 513 | default: |
514 | bfa_stats(rp, sm_offp_unexp); | 514 | bfa_stats(rp, sm_offp_unexp); |
515 | bfa_assert(0); | 515 | bfa_sm_fault(rp->bfa, event); |
516 | } | 516 | } |
517 | } | 517 | } |
518 | 518 | ||
@@ -550,7 +550,7 @@ bfa_rport_sm_iocdisable(struct bfa_rport_s *rp, enum bfa_rport_event event) | |||
550 | 550 | ||
551 | default: | 551 | default: |
552 | bfa_stats(rp, sm_iocd_unexp); | 552 | bfa_stats(rp, sm_iocd_unexp); |
553 | bfa_assert(0); | 553 | bfa_sm_fault(rp->bfa, event); |
554 | } | 554 | } |
555 | } | 555 | } |
556 | 556 | ||
diff --git a/drivers/scsi/bfa/bfa_trcmod_priv.h b/drivers/scsi/bfa/bfa_trcmod_priv.h index b3562dce7e9f..a7a82610db85 100644 --- a/drivers/scsi/bfa/bfa_trcmod_priv.h +++ b/drivers/scsi/bfa/bfa_trcmod_priv.h | |||
@@ -29,38 +29,36 @@ | |||
29 | * !!! needed between trace utility and driver version | 29 | * !!! needed between trace utility and driver version |
30 | */ | 30 | */ |
31 | enum { | 31 | enum { |
32 | BFA_TRC_HAL_IOC = 1, | 32 | BFA_TRC_HAL_INTR = 1, |
33 | BFA_TRC_HAL_INTR = 2, | 33 | BFA_TRC_HAL_FCXP = 2, |
34 | BFA_TRC_HAL_FCXP = 3, | 34 | BFA_TRC_HAL_UF = 3, |
35 | BFA_TRC_HAL_UF = 4, | 35 | BFA_TRC_HAL_RPORT = 4, |
36 | BFA_TRC_HAL_DIAG = 5, | 36 | BFA_TRC_HAL_FCPIM = 5, |
37 | BFA_TRC_HAL_RPORT = 6, | 37 | BFA_TRC_HAL_IOIM = 6, |
38 | BFA_TRC_HAL_FCPIM = 7, | 38 | BFA_TRC_HAL_TSKIM = 7, |
39 | BFA_TRC_HAL_IOIM = 8, | 39 | BFA_TRC_HAL_ITNIM = 8, |
40 | BFA_TRC_HAL_TSKIM = 9, | 40 | BFA_TRC_HAL_FCPORT = 9, |
41 | BFA_TRC_HAL_ITNIM = 10, | 41 | BFA_TRC_HAL_SGPG = 10, |
42 | BFA_TRC_HAL_PPORT = 11, | 42 | BFA_TRC_HAL_FLASH = 11, |
43 | BFA_TRC_HAL_SGPG = 12, | 43 | BFA_TRC_HAL_DEBUG = 12, |
44 | BFA_TRC_HAL_FLASH = 13, | 44 | BFA_TRC_HAL_WWN = 13, |
45 | BFA_TRC_HAL_DEBUG = 14, | 45 | BFA_TRC_HAL_FLASH_RAW = 14, |
46 | BFA_TRC_HAL_WWN = 15, | 46 | BFA_TRC_HAL_SBOOT = 15, |
47 | BFA_TRC_HAL_FLASH_RAW = 16, | 47 | BFA_TRC_HAL_SBOOT_IO = 16, |
48 | BFA_TRC_HAL_SBOOT = 17, | 48 | BFA_TRC_HAL_SBOOT_INTR = 17, |
49 | BFA_TRC_HAL_SBOOT_IO = 18, | 49 | BFA_TRC_HAL_SBTEST = 18, |
50 | BFA_TRC_HAL_SBOOT_INTR = 19, | 50 | BFA_TRC_HAL_IPFC = 19, |
51 | BFA_TRC_HAL_SBTEST = 20, | 51 | BFA_TRC_HAL_IOCFC = 20, |
52 | BFA_TRC_HAL_IPFC = 21, | 52 | BFA_TRC_HAL_FCPTM = 21, |
53 | BFA_TRC_HAL_IOCFC = 22, | 53 | BFA_TRC_HAL_IOTM = 22, |
54 | BFA_TRC_HAL_FCPTM = 23, | 54 | BFA_TRC_HAL_TSKTM = 23, |
55 | BFA_TRC_HAL_IOTM = 24, | 55 | BFA_TRC_HAL_TIN = 24, |
56 | BFA_TRC_HAL_TSKTM = 25, | 56 | BFA_TRC_HAL_LPS = 25, |
57 | BFA_TRC_HAL_TIN = 26, | 57 | BFA_TRC_HAL_FCDIAG = 26, |
58 | BFA_TRC_HAL_LPS = 27, | 58 | BFA_TRC_HAL_PBIND = 27, |
59 | BFA_TRC_HAL_FCDIAG = 28, | 59 | BFA_TRC_HAL_IOCFC_CT = 28, |
60 | BFA_TRC_HAL_PBIND = 29, | 60 | BFA_TRC_HAL_IOCFC_CB = 29, |
61 | BFA_TRC_HAL_IOCFC_CT = 30, | 61 | BFA_TRC_HAL_IOCFC_Q = 30, |
62 | BFA_TRC_HAL_IOCFC_CB = 31, | ||
63 | BFA_TRC_HAL_IOCFC_Q = 32, | ||
64 | }; | 62 | }; |
65 | 63 | ||
66 | #endif /* __BFA_TRCMOD_PRIV_H__ */ | 64 | #endif /* __BFA_TRCMOD_PRIV_H__ */ |
diff --git a/drivers/scsi/bfa/bfa_tskim.c b/drivers/scsi/bfa/bfa_tskim.c index ff7a4dc0bf3c..ad9aaaedd3f1 100644 --- a/drivers/scsi/bfa/bfa_tskim.c +++ b/drivers/scsi/bfa/bfa_tskim.c | |||
@@ -110,7 +110,7 @@ bfa_tskim_sm_uninit(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | |||
110 | break; | 110 | break; |
111 | 111 | ||
112 | default: | 112 | default: |
113 | bfa_assert(0); | 113 | bfa_sm_fault(tskim->bfa, event); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
@@ -146,7 +146,7 @@ bfa_tskim_sm_active(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | |||
146 | break; | 146 | break; |
147 | 147 | ||
148 | default: | 148 | default: |
149 | bfa_assert(0); | 149 | bfa_sm_fault(tskim->bfa, event); |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
@@ -178,7 +178,7 @@ bfa_tskim_sm_cleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | |||
178 | break; | 178 | break; |
179 | 179 | ||
180 | default: | 180 | default: |
181 | bfa_assert(0); | 181 | bfa_sm_fault(tskim->bfa, event); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
@@ -207,7 +207,7 @@ bfa_tskim_sm_iocleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | |||
207 | break; | 207 | break; |
208 | 208 | ||
209 | default: | 209 | default: |
210 | bfa_assert(0); | 210 | bfa_sm_fault(tskim->bfa, event); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
@@ -242,7 +242,7 @@ bfa_tskim_sm_qfull(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | |||
242 | break; | 242 | break; |
243 | 243 | ||
244 | default: | 244 | default: |
245 | bfa_assert(0); | 245 | bfa_sm_fault(tskim->bfa, event); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
@@ -277,7 +277,7 @@ bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim, | |||
277 | break; | 277 | break; |
278 | 278 | ||
279 | default: | 279 | default: |
280 | bfa_assert(0); | 280 | bfa_sm_fault(tskim->bfa, event); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
@@ -303,7 +303,7 @@ bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) | |||
303 | break; | 303 | break; |
304 | 304 | ||
305 | default: | 305 | default: |
306 | bfa_assert(0); | 306 | bfa_sm_fault(tskim->bfa, event); |
307 | } | 307 | } |
308 | } | 308 | } |
309 | 309 | ||
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index b52b773d49d9..13f5feb308c2 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -19,7 +19,9 @@ | |||
19 | * bfad.c Linux driver PCI interface module. | 19 | * bfad.c Linux driver PCI interface module. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/slab.h> | ||
22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/kthread.h> | ||
23 | #include "bfad_drv.h" | 25 | #include "bfad_drv.h" |
24 | #include "bfad_im.h" | 26 | #include "bfad_im.h" |
25 | #include "bfad_tm.h" | 27 | #include "bfad_tm.h" |
@@ -53,6 +55,7 @@ static int log_level = BFA_LOG_WARNING; | |||
53 | static int ioc_auto_recover = BFA_TRUE; | 55 | static int ioc_auto_recover = BFA_TRUE; |
54 | static int ipfc_enable = BFA_FALSE; | 56 | static int ipfc_enable = BFA_FALSE; |
55 | static int ipfc_mtu = -1; | 57 | static int ipfc_mtu = -1; |
58 | static int fdmi_enable = BFA_TRUE; | ||
56 | int bfa_lun_queue_depth = BFAD_LUN_QUEUE_DEPTH; | 59 | int bfa_lun_queue_depth = BFAD_LUN_QUEUE_DEPTH; |
57 | int bfa_linkup_delay = -1; | 60 | int bfa_linkup_delay = -1; |
58 | 61 | ||
@@ -74,6 +77,7 @@ module_param(log_level, int, S_IRUGO | S_IWUSR); | |||
74 | module_param(ioc_auto_recover, int, S_IRUGO | S_IWUSR); | 77 | module_param(ioc_auto_recover, int, S_IRUGO | S_IWUSR); |
75 | module_param(ipfc_enable, int, S_IRUGO | S_IWUSR); | 78 | module_param(ipfc_enable, int, S_IRUGO | S_IWUSR); |
76 | module_param(ipfc_mtu, int, S_IRUGO | S_IWUSR); | 79 | module_param(ipfc_mtu, int, S_IRUGO | S_IWUSR); |
80 | module_param(fdmi_enable, int, S_IRUGO | S_IWUSR); | ||
77 | module_param(bfa_linkup_delay, int, S_IRUGO | S_IWUSR); | 81 | module_param(bfa_linkup_delay, int, S_IRUGO | S_IWUSR); |
78 | 82 | ||
79 | /* | 83 | /* |
@@ -95,6 +99,8 @@ bfad_fc4_probe(struct bfad_s *bfad) | |||
95 | 99 | ||
96 | if (ipfc_enable) | 100 | if (ipfc_enable) |
97 | bfad_ipfc_probe(bfad); | 101 | bfad_ipfc_probe(bfad); |
102 | |||
103 | bfad->bfad_flags |= BFAD_FC4_PROBE_DONE; | ||
98 | ext: | 104 | ext: |
99 | return rc; | 105 | return rc; |
100 | } | 106 | } |
@@ -106,6 +112,7 @@ bfad_fc4_probe_undo(struct bfad_s *bfad) | |||
106 | bfad_tm_probe_undo(bfad); | 112 | bfad_tm_probe_undo(bfad); |
107 | if (ipfc_enable) | 113 | if (ipfc_enable) |
108 | bfad_ipfc_probe_undo(bfad); | 114 | bfad_ipfc_probe_undo(bfad); |
115 | bfad->bfad_flags &= ~BFAD_FC4_PROBE_DONE; | ||
109 | } | 116 | } |
110 | 117 | ||
111 | static void | 118 | static void |
@@ -173,9 +180,19 @@ bfa_cb_init(void *drv, bfa_status_t init_status) | |||
173 | { | 180 | { |
174 | struct bfad_s *bfad = drv; | 181 | struct bfad_s *bfad = drv; |
175 | 182 | ||
176 | if (init_status == BFA_STATUS_OK) | 183 | if (init_status == BFA_STATUS_OK) { |
177 | bfad->bfad_flags |= BFAD_HAL_INIT_DONE; | 184 | bfad->bfad_flags |= BFAD_HAL_INIT_DONE; |
178 | 185 | ||
186 | /* If BFAD_HAL_INIT_FAIL flag is set: | ||
187 | * Wake up the kernel thread to start | ||
188 | * the bfad operations after HAL init done | ||
189 | */ | ||
190 | if ((bfad->bfad_flags & BFAD_HAL_INIT_FAIL)) { | ||
191 | bfad->bfad_flags &= ~BFAD_HAL_INIT_FAIL; | ||
192 | wake_up_process(bfad->bfad_tsk); | ||
193 | } | ||
194 | } | ||
195 | |||
179 | complete(&bfad->comp); | 196 | complete(&bfad->comp); |
180 | } | 197 | } |
181 | 198 | ||
@@ -648,7 +665,7 @@ bfad_fcs_port_cfg(struct bfad_s *bfad) | |||
648 | 665 | ||
649 | sprintf(symname, "%s-%d", BFAD_DRIVER_NAME, bfad->inst_no); | 666 | sprintf(symname, "%s-%d", BFAD_DRIVER_NAME, bfad->inst_no); |
650 | memcpy(port_cfg.sym_name.symname, symname, strlen(symname)); | 667 | memcpy(port_cfg.sym_name.symname, symname, strlen(symname)); |
651 | bfa_pport_get_attr(&bfad->bfa, &attr); | 668 | bfa_fcport_get_attr(&bfad->bfa, &attr); |
652 | port_cfg.nwwn = attr.nwwn; | 669 | port_cfg.nwwn = attr.nwwn; |
653 | port_cfg.pwwn = attr.pwwn; | 670 | port_cfg.pwwn = attr.pwwn; |
654 | 671 | ||
@@ -661,7 +678,6 @@ bfad_drv_init(struct bfad_s *bfad) | |||
661 | bfa_status_t rc; | 678 | bfa_status_t rc; |
662 | unsigned long flags; | 679 | unsigned long flags; |
663 | struct bfa_fcs_driver_info_s driver_info; | 680 | struct bfa_fcs_driver_info_s driver_info; |
664 | int i; | ||
665 | 681 | ||
666 | bfad->cfg_data.rport_del_timeout = rport_del_timeout; | 682 | bfad->cfg_data.rport_del_timeout = rport_del_timeout; |
667 | bfad->cfg_data.lun_queue_depth = bfa_lun_queue_depth; | 683 | bfad->cfg_data.lun_queue_depth = bfa_lun_queue_depth; |
@@ -681,12 +697,7 @@ bfad_drv_init(struct bfad_s *bfad) | |||
681 | bfa_init_log(&bfad->bfa, bfad->logmod); | 697 | bfa_init_log(&bfad->bfa, bfad->logmod); |
682 | bfa_init_trc(&bfad->bfa, bfad->trcmod); | 698 | bfa_init_trc(&bfad->bfa, bfad->trcmod); |
683 | bfa_init_aen(&bfad->bfa, bfad->aen); | 699 | bfa_init_aen(&bfad->bfa, bfad->aen); |
684 | INIT_LIST_HEAD(&bfad->file_q); | 700 | memset(bfad->file_map, 0, sizeof(bfad->file_map)); |
685 | INIT_LIST_HEAD(&bfad->file_free_q); | ||
686 | for (i = 0; i < BFAD_AEN_MAX_APPS; i++) { | ||
687 | bfa_q_qe_init(&bfad->file_buf[i].qe); | ||
688 | list_add_tail(&bfad->file_buf[i].qe, &bfad->file_free_q); | ||
689 | } | ||
690 | bfa_init_plog(&bfad->bfa, &bfad->plog_buf); | 701 | bfa_init_plog(&bfad->bfa, &bfad->plog_buf); |
691 | bfa_plog_init(&bfad->plog_buf); | 702 | bfa_plog_init(&bfad->plog_buf); |
692 | bfa_plog_str(&bfad->plog_buf, BFA_PL_MID_DRVR, BFA_PL_EID_DRIVER_START, | 703 | bfa_plog_str(&bfad->plog_buf, BFA_PL_MID_DRVR, BFA_PL_EID_DRIVER_START, |
@@ -746,8 +757,16 @@ bfad_drv_init(struct bfad_s *bfad) | |||
746 | bfa_fcs_log_init(&bfad->bfa_fcs, bfad->logmod); | 757 | bfa_fcs_log_init(&bfad->bfa_fcs, bfad->logmod); |
747 | bfa_fcs_trc_init(&bfad->bfa_fcs, bfad->trcmod); | 758 | bfa_fcs_trc_init(&bfad->bfa_fcs, bfad->trcmod); |
748 | bfa_fcs_aen_init(&bfad->bfa_fcs, bfad->aen); | 759 | bfa_fcs_aen_init(&bfad->bfa_fcs, bfad->aen); |
749 | bfa_fcs_init(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE); | 760 | bfa_fcs_attach(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE); |
761 | |||
762 | /* Do FCS init only when HAL init is done */ | ||
763 | if ((bfad->bfad_flags & BFAD_HAL_INIT_DONE)) { | ||
764 | bfa_fcs_init(&bfad->bfa_fcs); | ||
765 | bfad->bfad_flags |= BFAD_FCS_INIT_DONE; | ||
766 | } | ||
767 | |||
750 | bfa_fcs_driver_info_init(&bfad->bfa_fcs, &driver_info); | 768 | bfa_fcs_driver_info_init(&bfad->bfa_fcs, &driver_info); |
769 | bfa_fcs_set_fdmi_param(&bfad->bfa_fcs, fdmi_enable); | ||
751 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 770 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
752 | 771 | ||
753 | bfad->bfad_flags |= BFAD_DRV_INIT_DONE; | 772 | bfad->bfad_flags |= BFAD_DRV_INIT_DONE; |
@@ -763,12 +782,21 @@ out_hal_mem_alloc_failure: | |||
763 | void | 782 | void |
764 | bfad_drv_uninit(struct bfad_s *bfad) | 783 | bfad_drv_uninit(struct bfad_s *bfad) |
765 | { | 784 | { |
785 | unsigned long flags; | ||
786 | |||
787 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
788 | init_completion(&bfad->comp); | ||
789 | bfa_stop(&bfad->bfa); | ||
790 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
791 | wait_for_completion(&bfad->comp); | ||
792 | |||
766 | del_timer_sync(&bfad->hal_tmo); | 793 | del_timer_sync(&bfad->hal_tmo); |
767 | bfa_isr_disable(&bfad->bfa); | 794 | bfa_isr_disable(&bfad->bfa); |
768 | bfa_detach(&bfad->bfa); | 795 | bfa_detach(&bfad->bfa); |
769 | bfad_remove_intr(bfad); | 796 | bfad_remove_intr(bfad); |
770 | bfa_assert(list_empty(&bfad->file_q)); | ||
771 | bfad_hal_mem_release(bfad); | 797 | bfad_hal_mem_release(bfad); |
798 | |||
799 | bfad->bfad_flags &= ~BFAD_DRV_INIT_DONE; | ||
772 | } | 800 | } |
773 | 801 | ||
774 | void | 802 | void |
@@ -859,6 +887,86 @@ bfad_drv_log_level_set(struct bfad_s *bfad) | |||
859 | bfa_log_set_level_all(&bfad->log_data, log_level); | 887 | bfa_log_set_level_all(&bfad->log_data, log_level); |
860 | } | 888 | } |
861 | 889 | ||
890 | bfa_status_t | ||
891 | bfad_start_ops(struct bfad_s *bfad) | ||
892 | { | ||
893 | int retval; | ||
894 | |||
895 | /* PPORT FCS config */ | ||
896 | bfad_fcs_port_cfg(bfad); | ||
897 | |||
898 | retval = bfad_cfg_pport(bfad, BFA_PORT_ROLE_FCP_IM); | ||
899 | if (retval != BFA_STATUS_OK) | ||
900 | goto out_cfg_pport_failure; | ||
901 | |||
902 | /* BFAD level FC4 (IM/TM/IPFC) specific resource allocation */ | ||
903 | retval = bfad_fc4_probe(bfad); | ||
904 | if (retval != BFA_STATUS_OK) { | ||
905 | printk(KERN_WARNING "bfad_fc4_probe failed\n"); | ||
906 | goto out_fc4_probe_failure; | ||
907 | } | ||
908 | |||
909 | bfad_drv_start(bfad); | ||
910 | |||
911 | /* | ||
912 | * If bfa_linkup_delay is set to -1 default; try to retrive the | ||
913 | * value using the bfad_os_get_linkup_delay(); else use the | ||
914 | * passed in module param value as the bfa_linkup_delay. | ||
915 | */ | ||
916 | if (bfa_linkup_delay < 0) { | ||
917 | |||
918 | bfa_linkup_delay = bfad_os_get_linkup_delay(bfad); | ||
919 | bfad_os_rport_online_wait(bfad); | ||
920 | bfa_linkup_delay = -1; | ||
921 | |||
922 | } else { | ||
923 | bfad_os_rport_online_wait(bfad); | ||
924 | } | ||
925 | |||
926 | bfa_log(bfad->logmod, BFA_LOG_LINUX_DEVICE_CLAIMED, bfad->pci_name); | ||
927 | |||
928 | return BFA_STATUS_OK; | ||
929 | |||
930 | out_fc4_probe_failure: | ||
931 | bfad_fc4_probe_undo(bfad); | ||
932 | bfad_uncfg_pport(bfad); | ||
933 | out_cfg_pport_failure: | ||
934 | return BFA_STATUS_FAILED; | ||
935 | } | ||
936 | |||
937 | int | ||
938 | bfad_worker (void *ptr) | ||
939 | { | ||
940 | struct bfad_s *bfad; | ||
941 | unsigned long flags; | ||
942 | |||
943 | bfad = (struct bfad_s *)ptr; | ||
944 | |||
945 | while (!kthread_should_stop()) { | ||
946 | |||
947 | /* Check if the FCS init is done from bfad_drv_init; | ||
948 | * if not done do FCS init and set the flag. | ||
949 | */ | ||
950 | if (!(bfad->bfad_flags & BFAD_FCS_INIT_DONE)) { | ||
951 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
952 | bfa_fcs_init(&bfad->bfa_fcs); | ||
953 | bfad->bfad_flags |= BFAD_FCS_INIT_DONE; | ||
954 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
955 | } | ||
956 | |||
957 | /* Start the bfad operations after HAL init done */ | ||
958 | bfad_start_ops(bfad); | ||
959 | |||
960 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
961 | bfad->bfad_tsk = NULL; | ||
962 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
963 | |||
964 | break; | ||
965 | } | ||
966 | |||
967 | return 0; | ||
968 | } | ||
969 | |||
862 | /* | 970 | /* |
863 | * PCI_entry PCI driver entries * { | 971 | * PCI_entry PCI driver entries * { |
864 | */ | 972 | */ |
@@ -871,7 +979,6 @@ bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
871 | { | 979 | { |
872 | struct bfad_s *bfad; | 980 | struct bfad_s *bfad; |
873 | int error = -ENODEV, retval; | 981 | int error = -ENODEV, retval; |
874 | char buf[16]; | ||
875 | 982 | ||
876 | /* | 983 | /* |
877 | * For single port cards - only claim function 0 | 984 | * For single port cards - only claim function 0 |
@@ -902,8 +1009,7 @@ bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
902 | bfa_trc(bfad, bfad_inst); | 1009 | bfa_trc(bfad, bfad_inst); |
903 | 1010 | ||
904 | bfad->logmod = &bfad->log_data; | 1011 | bfad->logmod = &bfad->log_data; |
905 | sprintf(buf, "%d", bfad_inst); | 1012 | bfa_log_init(bfad->logmod, (char *)pci_name(pdev), bfa_os_printf); |
906 | bfa_log_init(bfad->logmod, buf, bfa_os_printf); | ||
907 | 1013 | ||
908 | bfad_drv_log_level_set(bfad); | 1014 | bfad_drv_log_level_set(bfad); |
909 | 1015 | ||
@@ -933,57 +1039,39 @@ bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
933 | bfad->ref_count = 0; | 1039 | bfad->ref_count = 0; |
934 | bfad->pport.bfad = bfad; | 1040 | bfad->pport.bfad = bfad; |
935 | 1041 | ||
1042 | bfad->bfad_tsk = kthread_create(bfad_worker, (void *) bfad, "%s", | ||
1043 | "bfad_worker"); | ||
1044 | if (IS_ERR(bfad->bfad_tsk)) { | ||
1045 | printk(KERN_INFO "bfad[%d]: Kernel thread" | ||
1046 | " creation failed!\n", | ||
1047 | bfad->inst_no); | ||
1048 | goto out_kthread_create_failure; | ||
1049 | } | ||
1050 | |||
936 | retval = bfad_drv_init(bfad); | 1051 | retval = bfad_drv_init(bfad); |
937 | if (retval != BFA_STATUS_OK) | 1052 | if (retval != BFA_STATUS_OK) |
938 | goto out_drv_init_failure; | 1053 | goto out_drv_init_failure; |
939 | if (!(bfad->bfad_flags & BFAD_HAL_INIT_DONE)) { | 1054 | if (!(bfad->bfad_flags & BFAD_HAL_INIT_DONE)) { |
1055 | bfad->bfad_flags |= BFAD_HAL_INIT_FAIL; | ||
940 | printk(KERN_WARNING "bfad%d: hal init failed\n", bfad->inst_no); | 1056 | printk(KERN_WARNING "bfad%d: hal init failed\n", bfad->inst_no); |
941 | goto ok; | 1057 | goto ok; |
942 | } | 1058 | } |
943 | 1059 | ||
944 | /* | 1060 | retval = bfad_start_ops(bfad); |
945 | * PPORT FCS config | ||
946 | */ | ||
947 | bfad_fcs_port_cfg(bfad); | ||
948 | |||
949 | retval = bfad_cfg_pport(bfad, BFA_PORT_ROLE_FCP_IM); | ||
950 | if (retval != BFA_STATUS_OK) | 1061 | if (retval != BFA_STATUS_OK) |
951 | goto out_cfg_pport_failure; | 1062 | goto out_start_ops_failure; |
952 | |||
953 | /* | ||
954 | * BFAD level FC4 (IM/TM/IPFC) specific resource allocation | ||
955 | */ | ||
956 | retval = bfad_fc4_probe(bfad); | ||
957 | if (retval != BFA_STATUS_OK) { | ||
958 | printk(KERN_WARNING "bfad_fc4_probe failed\n"); | ||
959 | goto out_fc4_probe_failure; | ||
960 | } | ||
961 | 1063 | ||
962 | bfad_drv_start(bfad); | 1064 | kthread_stop(bfad->bfad_tsk); |
963 | 1065 | bfad->bfad_tsk = NULL; | |
964 | /* | ||
965 | * If bfa_linkup_delay is set to -1 default; try to retrive the | ||
966 | * value using the bfad_os_get_linkup_delay(); else use the | ||
967 | * passed in module param value as the bfa_linkup_delay. | ||
968 | */ | ||
969 | if (bfa_linkup_delay < 0) { | ||
970 | bfa_linkup_delay = bfad_os_get_linkup_delay(bfad); | ||
971 | bfad_os_rport_online_wait(bfad); | ||
972 | bfa_linkup_delay = -1; | ||
973 | } else { | ||
974 | bfad_os_rport_online_wait(bfad); | ||
975 | } | ||
976 | 1066 | ||
977 | bfa_log(bfad->logmod, BFA_LOG_LINUX_DEVICE_CLAIMED, bfad->pci_name); | ||
978 | ok: | 1067 | ok: |
979 | return 0; | 1068 | return 0; |
980 | 1069 | ||
981 | out_fc4_probe_failure: | 1070 | out_start_ops_failure: |
982 | bfad_fc4_probe_undo(bfad); | ||
983 | bfad_uncfg_pport(bfad); | ||
984 | out_cfg_pport_failure: | ||
985 | bfad_drv_uninit(bfad); | 1071 | bfad_drv_uninit(bfad); |
986 | out_drv_init_failure: | 1072 | out_drv_init_failure: |
1073 | kthread_stop(bfad->bfad_tsk); | ||
1074 | out_kthread_create_failure: | ||
987 | mutex_lock(&bfad_mutex); | 1075 | mutex_lock(&bfad_mutex); |
988 | bfad_inst--; | 1076 | bfad_inst--; |
989 | list_del(&bfad->list_entry); | 1077 | list_del(&bfad->list_entry); |
@@ -1008,6 +1096,11 @@ bfad_pci_remove(struct pci_dev *pdev) | |||
1008 | 1096 | ||
1009 | bfa_trc(bfad, bfad->inst_no); | 1097 | bfa_trc(bfad, bfad->inst_no); |
1010 | 1098 | ||
1099 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
1100 | if (bfad->bfad_tsk != NULL) | ||
1101 | kthread_stop(bfad->bfad_tsk); | ||
1102 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
1103 | |||
1011 | if ((bfad->bfad_flags & BFAD_DRV_INIT_DONE) | 1104 | if ((bfad->bfad_flags & BFAD_DRV_INIT_DONE) |
1012 | && !(bfad->bfad_flags & BFAD_HAL_INIT_DONE)) { | 1105 | && !(bfad->bfad_flags & BFAD_HAL_INIT_DONE)) { |
1013 | 1106 | ||
@@ -1024,13 +1117,25 @@ bfad_pci_remove(struct pci_dev *pdev) | |||
1024 | goto remove_sysfs; | 1117 | goto remove_sysfs; |
1025 | } | 1118 | } |
1026 | 1119 | ||
1027 | if (bfad->bfad_flags & BFAD_HAL_START_DONE) | 1120 | if (bfad->bfad_flags & BFAD_HAL_START_DONE) { |
1028 | bfad_drv_stop(bfad); | 1121 | bfad_drv_stop(bfad); |
1122 | } else if (bfad->bfad_flags & BFAD_DRV_INIT_DONE) { | ||
1123 | /* Invoking bfa_stop() before bfa_detach | ||
1124 | * when HAL and DRV init are success | ||
1125 | * but HAL start did not occur. | ||
1126 | */ | ||
1127 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
1128 | init_completion(&bfad->comp); | ||
1129 | bfa_stop(&bfad->bfa); | ||
1130 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
1131 | wait_for_completion(&bfad->comp); | ||
1132 | } | ||
1029 | 1133 | ||
1030 | bfad_remove_intr(bfad); | 1134 | bfad_remove_intr(bfad); |
1031 | |||
1032 | del_timer_sync(&bfad->hal_tmo); | 1135 | del_timer_sync(&bfad->hal_tmo); |
1033 | bfad_fc4_probe_undo(bfad); | 1136 | |
1137 | if (bfad->bfad_flags & BFAD_FC4_PROBE_DONE) | ||
1138 | bfad_fc4_probe_undo(bfad); | ||
1034 | 1139 | ||
1035 | if (bfad->bfad_flags & BFAD_CFG_PPORT_DONE) | 1140 | if (bfad->bfad_flags & BFAD_CFG_PPORT_DONE) |
1036 | bfad_uncfg_pport(bfad); | 1141 | bfad_uncfg_pport(bfad); |
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c index 9129ae3040ff..6a2efdd5ef24 100644 --- a/drivers/scsi/bfa/bfad_attr.c +++ b/drivers/scsi/bfa/bfad_attr.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * bfa_attr.c Linux driver configuration interface module. | 19 | * bfa_attr.c Linux driver configuration interface module. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/slab.h> | ||
22 | #include "bfad_drv.h" | 23 | #include "bfad_drv.h" |
23 | #include "bfad_im.h" | 24 | #include "bfad_im.h" |
24 | #include "bfad_trcmod.h" | 25 | #include "bfad_trcmod.h" |
@@ -141,7 +142,7 @@ bfad_im_get_host_port_type(struct Scsi_Host *shost) | |||
141 | struct bfad_s *bfad = im_port->bfad; | 142 | struct bfad_s *bfad = im_port->bfad; |
142 | struct bfa_pport_attr_s attr; | 143 | struct bfa_pport_attr_s attr; |
143 | 144 | ||
144 | bfa_pport_get_attr(&bfad->bfa, &attr); | 145 | bfa_fcport_get_attr(&bfad->bfa, &attr); |
145 | 146 | ||
146 | switch (attr.port_type) { | 147 | switch (attr.port_type) { |
147 | case BFA_PPORT_TYPE_NPORT: | 148 | case BFA_PPORT_TYPE_NPORT: |
@@ -173,7 +174,7 @@ bfad_im_get_host_port_state(struct Scsi_Host *shost) | |||
173 | struct bfad_s *bfad = im_port->bfad; | 174 | struct bfad_s *bfad = im_port->bfad; |
174 | struct bfa_pport_attr_s attr; | 175 | struct bfa_pport_attr_s attr; |
175 | 176 | ||
176 | bfa_pport_get_attr(&bfad->bfa, &attr); | 177 | bfa_fcport_get_attr(&bfad->bfa, &attr); |
177 | 178 | ||
178 | switch (attr.port_state) { | 179 | switch (attr.port_state) { |
179 | case BFA_PPORT_ST_LINKDOWN: | 180 | case BFA_PPORT_ST_LINKDOWN: |
@@ -229,8 +230,10 @@ bfad_im_get_host_speed(struct Scsi_Host *shost) | |||
229 | (struct bfad_im_port_s *) shost->hostdata[0]; | 230 | (struct bfad_im_port_s *) shost->hostdata[0]; |
230 | struct bfad_s *bfad = im_port->bfad; | 231 | struct bfad_s *bfad = im_port->bfad; |
231 | struct bfa_pport_attr_s attr; | 232 | struct bfa_pport_attr_s attr; |
233 | unsigned long flags; | ||
232 | 234 | ||
233 | bfa_pport_get_attr(&bfad->bfa, &attr); | 235 | spin_lock_irqsave(shost->host_lock, flags); |
236 | bfa_fcport_get_attr(&bfad->bfa, &attr); | ||
234 | switch (attr.speed) { | 237 | switch (attr.speed) { |
235 | case BFA_PPORT_SPEED_8GBPS: | 238 | case BFA_PPORT_SPEED_8GBPS: |
236 | fc_host_speed(shost) = FC_PORTSPEED_8GBIT; | 239 | fc_host_speed(shost) = FC_PORTSPEED_8GBIT; |
@@ -248,6 +251,7 @@ bfad_im_get_host_speed(struct Scsi_Host *shost) | |||
248 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; | 251 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; |
249 | break; | 252 | break; |
250 | } | 253 | } |
254 | spin_unlock_irqrestore(shost->host_lock, flags); | ||
251 | } | 255 | } |
252 | 256 | ||
253 | /** | 257 | /** |
@@ -285,7 +289,7 @@ bfad_im_get_stats(struct Scsi_Host *shost) | |||
285 | init_completion(&fcomp.comp); | 289 | init_completion(&fcomp.comp); |
286 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 290 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
287 | memset(hstats, 0, sizeof(struct fc_host_statistics)); | 291 | memset(hstats, 0, sizeof(struct fc_host_statistics)); |
288 | rc = bfa_pport_get_stats(&bfad->bfa, | 292 | rc = bfa_port_get_stats(BFA_FCPORT(&bfad->bfa), |
289 | (union bfa_pport_stats_u *) hstats, | 293 | (union bfa_pport_stats_u *) hstats, |
290 | bfad_hcb_comp, &fcomp); | 294 | bfad_hcb_comp, &fcomp); |
291 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 295 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
@@ -312,7 +316,8 @@ bfad_im_reset_stats(struct Scsi_Host *shost) | |||
312 | 316 | ||
313 | init_completion(&fcomp.comp); | 317 | init_completion(&fcomp.comp); |
314 | spin_lock_irqsave(&bfad->bfad_lock, flags); | 318 | spin_lock_irqsave(&bfad->bfad_lock, flags); |
315 | rc = bfa_pport_clear_stats(&bfad->bfa, bfad_hcb_comp, &fcomp); | 319 | rc = bfa_port_clear_stats(BFA_FCPORT(&bfad->bfa), bfad_hcb_comp, |
320 | &fcomp); | ||
316 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | 321 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
317 | 322 | ||
318 | if (rc != BFA_STATUS_OK) | 323 | if (rc != BFA_STATUS_OK) |
@@ -421,12 +426,10 @@ bfad_im_serial_num_show(struct device *dev, struct device_attribute *attr, | |||
421 | struct bfad_im_port_s *im_port = | 426 | struct bfad_im_port_s *im_port = |
422 | (struct bfad_im_port_s *) shost->hostdata[0]; | 427 | (struct bfad_im_port_s *) shost->hostdata[0]; |
423 | struct bfad_s *bfad = im_port->bfad; | 428 | struct bfad_s *bfad = im_port->bfad; |
424 | struct bfa_ioc_attr_s ioc_attr; | 429 | char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN]; |
425 | 430 | ||
426 | memset(&ioc_attr, 0, sizeof(ioc_attr)); | 431 | bfa_get_adapter_serial_num(&bfad->bfa, serial_num); |
427 | bfa_get_attr(&bfad->bfa, &ioc_attr); | 432 | return snprintf(buf, PAGE_SIZE, "%s\n", serial_num); |
428 | return snprintf(buf, PAGE_SIZE, "%s\n", | ||
429 | ioc_attr.adapter_attr.serial_num); | ||
430 | } | 433 | } |
431 | 434 | ||
432 | static ssize_t | 435 | static ssize_t |
@@ -437,11 +440,10 @@ bfad_im_model_show(struct device *dev, struct device_attribute *attr, | |||
437 | struct bfad_im_port_s *im_port = | 440 | struct bfad_im_port_s *im_port = |
438 | (struct bfad_im_port_s *) shost->hostdata[0]; | 441 | (struct bfad_im_port_s *) shost->hostdata[0]; |
439 | struct bfad_s *bfad = im_port->bfad; | 442 | struct bfad_s *bfad = im_port->bfad; |
440 | struct bfa_ioc_attr_s ioc_attr; | 443 | char model[BFA_ADAPTER_MODEL_NAME_LEN]; |
441 | 444 | ||
442 | memset(&ioc_attr, 0, sizeof(ioc_attr)); | 445 | bfa_get_adapter_model(&bfad->bfa, model); |
443 | bfa_get_attr(&bfad->bfa, &ioc_attr); | 446 | return snprintf(buf, PAGE_SIZE, "%s\n", model); |
444 | return snprintf(buf, PAGE_SIZE, "%s\n", ioc_attr.adapter_attr.model); | ||
445 | } | 447 | } |
446 | 448 | ||
447 | static ssize_t | 449 | static ssize_t |
@@ -452,12 +454,10 @@ bfad_im_model_desc_show(struct device *dev, struct device_attribute *attr, | |||
452 | struct bfad_im_port_s *im_port = | 454 | struct bfad_im_port_s *im_port = |
453 | (struct bfad_im_port_s *) shost->hostdata[0]; | 455 | (struct bfad_im_port_s *) shost->hostdata[0]; |
454 | struct bfad_s *bfad = im_port->bfad; | 456 | struct bfad_s *bfad = im_port->bfad; |
455 | struct bfa_ioc_attr_s ioc_attr; | 457 | char model_descr[BFA_ADAPTER_MODEL_DESCR_LEN]; |
456 | 458 | ||
457 | memset(&ioc_attr, 0, sizeof(ioc_attr)); | 459 | bfa_get_adapter_model(&bfad->bfa, model_descr); |
458 | bfa_get_attr(&bfad->bfa, &ioc_attr); | 460 | return snprintf(buf, PAGE_SIZE, "%s\n", model_descr); |
459 | return snprintf(buf, PAGE_SIZE, "%s\n", | ||
460 | ioc_attr.adapter_attr.model_descr); | ||
461 | } | 461 | } |
462 | 462 | ||
463 | static ssize_t | 463 | static ssize_t |
@@ -482,14 +482,13 @@ bfad_im_symbolic_name_show(struct device *dev, struct device_attribute *attr, | |||
482 | struct bfad_im_port_s *im_port = | 482 | struct bfad_im_port_s *im_port = |
483 | (struct bfad_im_port_s *) shost->hostdata[0]; | 483 | (struct bfad_im_port_s *) shost->hostdata[0]; |
484 | struct bfad_s *bfad = im_port->bfad; | 484 | struct bfad_s *bfad = im_port->bfad; |
485 | struct bfa_ioc_attr_s ioc_attr; | 485 | char model[BFA_ADAPTER_MODEL_NAME_LEN]; |
486 | 486 | char fw_ver[BFA_VERSION_LEN]; | |
487 | memset(&ioc_attr, 0, sizeof(ioc_attr)); | ||
488 | bfa_get_attr(&bfad->bfa, &ioc_attr); | ||
489 | 487 | ||
488 | bfa_get_adapter_model(&bfad->bfa, model); | ||
489 | bfa_get_adapter_fw_ver(&bfad->bfa, fw_ver); | ||
490 | return snprintf(buf, PAGE_SIZE, "Brocade %s FV%s DV%s\n", | 490 | return snprintf(buf, PAGE_SIZE, "Brocade %s FV%s DV%s\n", |
491 | ioc_attr.adapter_attr.model, | 491 | model, fw_ver, BFAD_DRIVER_VERSION); |
492 | ioc_attr.adapter_attr.fw_ver, BFAD_DRIVER_VERSION); | ||
493 | } | 492 | } |
494 | 493 | ||
495 | static ssize_t | 494 | static ssize_t |
@@ -500,11 +499,10 @@ bfad_im_hw_version_show(struct device *dev, struct device_attribute *attr, | |||
500 | struct bfad_im_port_s *im_port = | 499 | struct bfad_im_port_s *im_port = |
501 | (struct bfad_im_port_s *) shost->hostdata[0]; | 500 | (struct bfad_im_port_s *) shost->hostdata[0]; |
502 | struct bfad_s *bfad = im_port->bfad; | 501 | struct bfad_s *bfad = im_port->bfad; |
503 | struct bfa_ioc_attr_s ioc_attr; | 502 | char hw_ver[BFA_VERSION_LEN]; |
504 | 503 | ||
505 | memset(&ioc_attr, 0, sizeof(ioc_attr)); | 504 | bfa_get_pci_chip_rev(&bfad->bfa, hw_ver); |
506 | bfa_get_attr(&bfad->bfa, &ioc_attr); | 505 | return snprintf(buf, PAGE_SIZE, "%s\n", hw_ver); |
507 | return snprintf(buf, PAGE_SIZE, "%s\n", ioc_attr.adapter_attr.hw_ver); | ||
508 | } | 506 | } |
509 | 507 | ||
510 | static ssize_t | 508 | static ssize_t |
@@ -522,12 +520,10 @@ bfad_im_optionrom_version_show(struct device *dev, | |||
522 | struct bfad_im_port_s *im_port = | 520 | struct bfad_im_port_s *im_port = |
523 | (struct bfad_im_port_s *) shost->hostdata[0]; | 521 | (struct bfad_im_port_s *) shost->hostdata[0]; |
524 | struct bfad_s *bfad = im_port->bfad; | 522 | struct bfad_s *bfad = im_port->bfad; |
525 | struct bfa_ioc_attr_s ioc_attr; | 523 | char optrom_ver[BFA_VERSION_LEN]; |
526 | 524 | ||
527 | memset(&ioc_attr, 0, sizeof(ioc_attr)); | 525 | bfa_get_adapter_optrom_ver(&bfad->bfa, optrom_ver); |
528 | bfa_get_attr(&bfad->bfa, &ioc_attr); | 526 | return snprintf(buf, PAGE_SIZE, "%s\n", optrom_ver); |
529 | return snprintf(buf, PAGE_SIZE, "%s\n", | ||
530 | ioc_attr.adapter_attr.optrom_ver); | ||
531 | } | 527 | } |
532 | 528 | ||
533 | static ssize_t | 529 | static ssize_t |
@@ -538,11 +534,10 @@ bfad_im_fw_version_show(struct device *dev, struct device_attribute *attr, | |||
538 | struct bfad_im_port_s *im_port = | 534 | struct bfad_im_port_s *im_port = |
539 | (struct bfad_im_port_s *) shost->hostdata[0]; | 535 | (struct bfad_im_port_s *) shost->hostdata[0]; |
540 | struct bfad_s *bfad = im_port->bfad; | 536 | struct bfad_s *bfad = im_port->bfad; |
541 | struct bfa_ioc_attr_s ioc_attr; | 537 | char fw_ver[BFA_VERSION_LEN]; |
542 | 538 | ||
543 | memset(&ioc_attr, 0, sizeof(ioc_attr)); | 539 | bfa_get_adapter_fw_ver(&bfad->bfa, fw_ver); |
544 | bfa_get_attr(&bfad->bfa, &ioc_attr); | 540 | return snprintf(buf, PAGE_SIZE, "%s\n", fw_ver); |
545 | return snprintf(buf, PAGE_SIZE, "%s\n", ioc_attr.adapter_attr.fw_ver); | ||
546 | } | 541 | } |
547 | 542 | ||
548 | static ssize_t | 543 | static ssize_t |
@@ -553,11 +548,9 @@ bfad_im_num_of_ports_show(struct device *dev, struct device_attribute *attr, | |||
553 | struct bfad_im_port_s *im_port = | 548 | struct bfad_im_port_s *im_port = |
554 | (struct bfad_im_port_s *) shost->hostdata[0]; | 549 | (struct bfad_im_port_s *) shost->hostdata[0]; |
555 | struct bfad_s *bfad = im_port->bfad; | 550 | struct bfad_s *bfad = im_port->bfad; |
556 | struct bfa_ioc_attr_s ioc_attr; | ||
557 | 551 | ||
558 | memset(&ioc_attr, 0, sizeof(ioc_attr)); | 552 | return snprintf(buf, PAGE_SIZE, "%d\n", |
559 | bfa_get_attr(&bfad->bfa, &ioc_attr); | 553 | bfa_get_nports(&bfad->bfa)); |
560 | return snprintf(buf, PAGE_SIZE, "%d\n", ioc_attr.adapter_attr.nports); | ||
561 | } | 554 | } |
562 | 555 | ||
563 | static ssize_t | 556 | static ssize_t |
diff --git a/drivers/scsi/bfa/bfad_attr.h b/drivers/scsi/bfa/bfad_attr.h index 4d3312da6a81..bf0102076508 100644 --- a/drivers/scsi/bfa/bfad_attr.h +++ b/drivers/scsi/bfa/bfad_attr.h | |||
@@ -17,9 +17,6 @@ | |||
17 | 17 | ||
18 | #ifndef __BFAD_ATTR_H__ | 18 | #ifndef __BFAD_ATTR_H__ |
19 | #define __BFAD_ATTR_H__ | 19 | #define __BFAD_ATTR_H__ |
20 | /** | ||
21 | * bfad_attr.h VMware driver configuration interface module. | ||
22 | */ | ||
23 | 20 | ||
24 | /** | 21 | /** |
25 | * FC_transport_template FC transport template | 22 | * FC_transport_template FC transport template |
@@ -52,12 +49,6 @@ bfad_im_get_starget_port_name(struct scsi_target *starget); | |||
52 | void | 49 | void |
53 | bfad_im_get_host_port_id(struct Scsi_Host *shost); | 50 | bfad_im_get_host_port_id(struct Scsi_Host *shost); |
54 | 51 | ||
55 | /** | ||
56 | * FC transport template entry, issue a LIP. | ||
57 | */ | ||
58 | int | ||
59 | bfad_im_issue_fc_host_lip(struct Scsi_Host *shost); | ||
60 | |||
61 | struct Scsi_Host* | 52 | struct Scsi_Host* |
62 | bfad_os_starget_to_shost(struct scsi_target *starget); | 53 | bfad_os_starget_to_shost(struct scsi_target *starget); |
63 | 54 | ||
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h index 172c81e25c1c..107848cd3b6d 100644 --- a/drivers/scsi/bfa/bfad_drv.h +++ b/drivers/scsi/bfa/bfad_drv.h | |||
@@ -46,7 +46,7 @@ | |||
46 | #ifdef BFA_DRIVER_VERSION | 46 | #ifdef BFA_DRIVER_VERSION |
47 | #define BFAD_DRIVER_VERSION BFA_DRIVER_VERSION | 47 | #define BFAD_DRIVER_VERSION BFA_DRIVER_VERSION |
48 | #else | 48 | #else |
49 | #define BFAD_DRIVER_VERSION "2.0.0.0" | 49 | #define BFAD_DRIVER_VERSION "2.1.2.1" |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | 52 | ||
@@ -62,7 +62,9 @@ | |||
62 | #define BFAD_HAL_START_DONE 0x00000010 | 62 | #define BFAD_HAL_START_DONE 0x00000010 |
63 | #define BFAD_PORT_ONLINE 0x00000020 | 63 | #define BFAD_PORT_ONLINE 0x00000020 |
64 | #define BFAD_RPORT_ONLINE 0x00000040 | 64 | #define BFAD_RPORT_ONLINE 0x00000040 |
65 | 65 | #define BFAD_FCS_INIT_DONE 0x00000080 | |
66 | #define BFAD_HAL_INIT_FAIL 0x00000100 | ||
67 | #define BFAD_FC4_PROBE_DONE 0x00000200 | ||
66 | #define BFAD_PORT_DELETE 0x00000001 | 68 | #define BFAD_PORT_DELETE 0x00000001 |
67 | 69 | ||
68 | /* | 70 | /* |
@@ -137,12 +139,16 @@ struct bfad_cfg_param_s { | |||
137 | u32 binding_method; | 139 | u32 binding_method; |
138 | }; | 140 | }; |
139 | 141 | ||
140 | #define BFAD_AEN_MAX_APPS 8 | 142 | union bfad_tmp_buf { |
141 | struct bfad_aen_file_s { | 143 | /* From struct bfa_adapter_attr_s */ |
142 | struct list_head qe; | 144 | char manufacturer[BFA_ADAPTER_MFG_NAME_LEN]; |
143 | struct bfad_s *bfad; | 145 | char serial_num[BFA_ADAPTER_SERIAL_NUM_LEN]; |
144 | s32 ri; | 146 | char model[BFA_ADAPTER_MODEL_NAME_LEN]; |
145 | s32 app_id; | 147 | char fw_ver[BFA_VERSION_LEN]; |
148 | char optrom_ver[BFA_VERSION_LEN]; | ||
149 | |||
150 | /* From struct bfa_ioc_pci_attr_s */ | ||
151 | u8 chip_rev[BFA_IOC_CHIP_REV_LEN]; /* chip revision */ | ||
146 | }; | 152 | }; |
147 | 153 | ||
148 | /* | 154 | /* |
@@ -168,6 +174,7 @@ struct bfad_s { | |||
168 | u32 inst_no; /* BFAD instance number */ | 174 | u32 inst_no; /* BFAD instance number */ |
169 | u32 bfad_flags; | 175 | u32 bfad_flags; |
170 | spinlock_t bfad_lock; | 176 | spinlock_t bfad_lock; |
177 | struct task_struct *bfad_tsk; | ||
171 | struct bfad_cfg_param_s cfg_data; | 178 | struct bfad_cfg_param_s cfg_data; |
172 | struct bfad_msix_s msix_tab[MAX_MSIX_ENTRY]; | 179 | struct bfad_msix_s msix_tab[MAX_MSIX_ENTRY]; |
173 | int nvec; | 180 | int nvec; |
@@ -183,18 +190,12 @@ struct bfad_s { | |||
183 | struct bfa_log_mod_s *logmod; | 190 | struct bfa_log_mod_s *logmod; |
184 | struct bfa_aen_s *aen; | 191 | struct bfa_aen_s *aen; |
185 | struct bfa_aen_s aen_buf; | 192 | struct bfa_aen_s aen_buf; |
186 | struct bfad_aen_file_s file_buf[BFAD_AEN_MAX_APPS]; | 193 | void *file_map[BFA_AEN_MAX_APP]; |
187 | struct list_head file_q; | ||
188 | struct list_head file_free_q; | ||
189 | struct bfa_plog_s plog_buf; | 194 | struct bfa_plog_s plog_buf; |
190 | int ref_count; | 195 | int ref_count; |
191 | bfa_boolean_t ipfc_enabled; | 196 | bfa_boolean_t ipfc_enabled; |
197 | union bfad_tmp_buf tmp_buf; | ||
192 | struct fc_host_statistics link_stats; | 198 | struct fc_host_statistics link_stats; |
193 | |||
194 | struct kobject *bfa_kobj; | ||
195 | struct kobject *ioc_kobj; | ||
196 | struct kobject *pport_kobj; | ||
197 | struct kobject *lport_kobj; | ||
198 | }; | 199 | }; |
199 | 200 | ||
200 | /* | 201 | /* |
@@ -258,6 +259,7 @@ bfa_status_t bfad_vf_create(struct bfad_s *bfad, u16 vf_id, | |||
258 | struct bfa_port_cfg_s *port_cfg); | 259 | struct bfa_port_cfg_s *port_cfg); |
259 | bfa_status_t bfad_cfg_pport(struct bfad_s *bfad, enum bfa_port_role role); | 260 | bfa_status_t bfad_cfg_pport(struct bfad_s *bfad, enum bfa_port_role role); |
260 | bfa_status_t bfad_drv_init(struct bfad_s *bfad); | 261 | bfa_status_t bfad_drv_init(struct bfad_s *bfad); |
262 | bfa_status_t bfad_start_ops(struct bfad_s *bfad); | ||
261 | void bfad_drv_start(struct bfad_s *bfad); | 263 | void bfad_drv_start(struct bfad_s *bfad); |
262 | void bfad_uncfg_pport(struct bfad_s *bfad); | 264 | void bfad_uncfg_pport(struct bfad_s *bfad); |
263 | void bfad_drv_stop(struct bfad_s *bfad); | 265 | void bfad_drv_stop(struct bfad_s *bfad); |
@@ -279,6 +281,7 @@ void bfad_drv_uninit(struct bfad_s *bfad); | |||
279 | void bfad_drv_log_level_set(struct bfad_s *bfad); | 281 | void bfad_drv_log_level_set(struct bfad_s *bfad); |
280 | bfa_status_t bfad_fc4_module_init(void); | 282 | bfa_status_t bfad_fc4_module_init(void); |
281 | void bfad_fc4_module_exit(void); | 283 | void bfad_fc4_module_exit(void); |
284 | int bfad_worker (void *ptr); | ||
282 | 285 | ||
283 | void bfad_pci_remove(struct pci_dev *pdev); | 286 | void bfad_pci_remove(struct pci_dev *pdev); |
284 | int bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid); | 287 | int bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid); |
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index f788c2a0ab07..78f42aa57369 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * bfad_im.c Linux driver IM module. | 19 | * bfad_im.c Linux driver IM module. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/slab.h> | ||
22 | #include "bfad_drv.h" | 23 | #include "bfad_drv.h" |
23 | #include "bfad_im.h" | 24 | #include "bfad_im.h" |
24 | #include "bfad_trcmod.h" | 25 | #include "bfad_trcmod.h" |
@@ -43,11 +44,11 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio, | |||
43 | struct bfad_s *bfad = drv; | 44 | struct bfad_s *bfad = drv; |
44 | struct bfad_itnim_data_s *itnim_data; | 45 | struct bfad_itnim_data_s *itnim_data; |
45 | struct bfad_itnim_s *itnim; | 46 | struct bfad_itnim_s *itnim; |
47 | u8 host_status = DID_OK; | ||
46 | 48 | ||
47 | switch (io_status) { | 49 | switch (io_status) { |
48 | case BFI_IOIM_STS_OK: | 50 | case BFI_IOIM_STS_OK: |
49 | bfa_trc(bfad, scsi_status); | 51 | bfa_trc(bfad, scsi_status); |
50 | cmnd->result = ScsiResult(DID_OK, scsi_status); | ||
51 | scsi_set_resid(cmnd, 0); | 52 | scsi_set_resid(cmnd, 0); |
52 | 53 | ||
53 | if (sns_len > 0) { | 54 | if (sns_len > 0) { |
@@ -56,8 +57,18 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio, | |||
56 | sns_len = SCSI_SENSE_BUFFERSIZE; | 57 | sns_len = SCSI_SENSE_BUFFERSIZE; |
57 | memcpy(cmnd->sense_buffer, sns_info, sns_len); | 58 | memcpy(cmnd->sense_buffer, sns_info, sns_len); |
58 | } | 59 | } |
59 | if (residue > 0) | 60 | if (residue > 0) { |
61 | bfa_trc(bfad, residue); | ||
60 | scsi_set_resid(cmnd, residue); | 62 | scsi_set_resid(cmnd, residue); |
63 | if (!sns_len && (scsi_status == SAM_STAT_GOOD) && | ||
64 | (scsi_bufflen(cmnd) - residue) < | ||
65 | cmnd->underflow) { | ||
66 | bfa_trc(bfad, 0); | ||
67 | host_status = DID_ERROR; | ||
68 | } | ||
69 | } | ||
70 | cmnd->result = ScsiResult(host_status, scsi_status); | ||
71 | |||
61 | break; | 72 | break; |
62 | 73 | ||
63 | case BFI_IOIM_STS_ABORTED: | 74 | case BFI_IOIM_STS_ABORTED: |
@@ -167,17 +178,15 @@ bfad_im_info(struct Scsi_Host *shost) | |||
167 | static char bfa_buf[256]; | 178 | static char bfa_buf[256]; |
168 | struct bfad_im_port_s *im_port = | 179 | struct bfad_im_port_s *im_port = |
169 | (struct bfad_im_port_s *) shost->hostdata[0]; | 180 | (struct bfad_im_port_s *) shost->hostdata[0]; |
170 | struct bfa_ioc_attr_s ioc_attr; | ||
171 | struct bfad_s *bfad = im_port->bfad; | 181 | struct bfad_s *bfad = im_port->bfad; |
182 | char model[BFA_ADAPTER_MODEL_NAME_LEN]; | ||
172 | 183 | ||
173 | memset(&ioc_attr, 0, sizeof(ioc_attr)); | 184 | bfa_get_adapter_model(&bfad->bfa, model); |
174 | bfa_get_attr(&bfad->bfa, &ioc_attr); | ||
175 | 185 | ||
176 | memset(bfa_buf, 0, sizeof(bfa_buf)); | 186 | memset(bfa_buf, 0, sizeof(bfa_buf)); |
177 | snprintf(bfa_buf, sizeof(bfa_buf), | 187 | snprintf(bfa_buf, sizeof(bfa_buf), |
178 | "Brocade FC/FCOE Adapter, " "model: %s hwpath: %s driver: %s", | 188 | "Brocade FC/FCOE Adapter, " "model: %s hwpath: %s driver: %s", |
179 | ioc_attr.adapter_attr.model, bfad->pci_name, | 189 | model, bfad->pci_name, BFAD_DRIVER_VERSION); |
180 | BFAD_DRIVER_VERSION); | ||
181 | return bfa_buf; | 190 | return bfa_buf; |
182 | } | 191 | } |
183 | 192 | ||
@@ -501,16 +510,6 @@ void bfa_fcb_itnim_tov(struct bfad_itnim_s *itnim) | |||
501 | } | 510 | } |
502 | 511 | ||
503 | /** | 512 | /** |
504 | * Path TOV processing begin notification -- dummy for linux | ||
505 | */ | ||
506 | void | ||
507 | bfa_fcb_itnim_tov_begin(struct bfad_itnim_s *itnim) | ||
508 | { | ||
509 | } | ||
510 | |||
511 | |||
512 | |||
513 | /** | ||
514 | * Allocate a Scsi_Host for a port. | 513 | * Allocate a Scsi_Host for a port. |
515 | */ | 514 | */ |
516 | int | 515 | int |
@@ -931,10 +930,9 @@ bfad_os_fc_host_init(struct bfad_im_port_s *im_port) | |||
931 | struct Scsi_Host *host = im_port->shost; | 930 | struct Scsi_Host *host = im_port->shost; |
932 | struct bfad_s *bfad = im_port->bfad; | 931 | struct bfad_s *bfad = im_port->bfad; |
933 | struct bfad_port_s *port = im_port->port; | 932 | struct bfad_port_s *port = im_port->port; |
934 | union attr { | 933 | struct bfa_pport_attr_s pattr; |
935 | struct bfa_pport_attr_s pattr; | 934 | char model[BFA_ADAPTER_MODEL_NAME_LEN]; |
936 | struct bfa_ioc_attr_s ioc_attr; | 935 | char fw_ver[BFA_VERSION_LEN]; |
937 | } attr; | ||
938 | 936 | ||
939 | fc_host_node_name(host) = | 937 | fc_host_node_name(host) = |
940 | bfa_os_htonll((bfa_fcs_port_get_nwwn(port->fcs_port))); | 938 | bfa_os_htonll((bfa_fcs_port_get_nwwn(port->fcs_port))); |
@@ -954,20 +952,18 @@ bfad_os_fc_host_init(struct bfad_im_port_s *im_port) | |||
954 | /* For fibre channel services type 0x20 */ | 952 | /* For fibre channel services type 0x20 */ |
955 | fc_host_supported_fc4s(host)[7] = 1; | 953 | fc_host_supported_fc4s(host)[7] = 1; |
956 | 954 | ||
957 | memset(&attr.ioc_attr, 0, sizeof(attr.ioc_attr)); | 955 | bfa_get_adapter_model(&bfad->bfa, model); |
958 | bfa_get_attr(&bfad->bfa, &attr.ioc_attr); | 956 | bfa_get_adapter_fw_ver(&bfad->bfa, fw_ver); |
959 | sprintf(fc_host_symbolic_name(host), "Brocade %s FV%s DV%s", | 957 | sprintf(fc_host_symbolic_name(host), "Brocade %s FV%s DV%s", |
960 | attr.ioc_attr.adapter_attr.model, | 958 | model, fw_ver, BFAD_DRIVER_VERSION); |
961 | attr.ioc_attr.adapter_attr.fw_ver, BFAD_DRIVER_VERSION); | ||
962 | 959 | ||
963 | fc_host_supported_speeds(host) = 0; | 960 | fc_host_supported_speeds(host) = 0; |
964 | fc_host_supported_speeds(host) |= | 961 | fc_host_supported_speeds(host) |= |
965 | FC_PORTSPEED_8GBIT | FC_PORTSPEED_4GBIT | FC_PORTSPEED_2GBIT | | 962 | FC_PORTSPEED_8GBIT | FC_PORTSPEED_4GBIT | FC_PORTSPEED_2GBIT | |
966 | FC_PORTSPEED_1GBIT; | 963 | FC_PORTSPEED_1GBIT; |
967 | 964 | ||
968 | memset(&attr.pattr, 0, sizeof(attr.pattr)); | 965 | bfa_fcport_get_attr(&bfad->bfa, &pattr); |
969 | bfa_pport_get_attr(&bfad->bfa, &attr.pattr); | 966 | fc_host_maxframe_size(host) = pattr.pport_cfg.maxfrsize; |
970 | fc_host_maxframe_size(host) = attr.pattr.pport_cfg.maxfrsize; | ||
971 | } | 967 | } |
972 | 968 | ||
973 | static void | 969 | static void |
diff --git a/drivers/scsi/bfa/bfad_im.h b/drivers/scsi/bfa/bfad_im.h index 189a5b29e21a..85ab2da21321 100644 --- a/drivers/scsi/bfa/bfad_im.h +++ b/drivers/scsi/bfa/bfad_im.h | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #define FCPI_NAME " fcpim" | 24 | #define FCPI_NAME " fcpim" |
25 | 25 | ||
26 | void bfad_flags_set(struct bfad_s *bfad, u32 flags); | ||
27 | bfa_status_t bfad_im_module_init(void); | 26 | bfa_status_t bfad_im_module_init(void); |
28 | void bfad_im_module_exit(void); | 27 | void bfad_im_module_exit(void); |
29 | bfa_status_t bfad_im_probe(struct bfad_s *bfad); | 28 | bfa_status_t bfad_im_probe(struct bfad_s *bfad); |
@@ -126,7 +125,6 @@ bfa_status_t bfad_os_thread_workq(struct bfad_s *bfad); | |||
126 | void bfad_os_destroy_workq(struct bfad_im_s *im); | 125 | void bfad_os_destroy_workq(struct bfad_im_s *im); |
127 | void bfad_os_itnim_process(struct bfad_itnim_s *itnim_drv); | 126 | void bfad_os_itnim_process(struct bfad_itnim_s *itnim_drv); |
128 | void bfad_os_fc_host_init(struct bfad_im_port_s *im_port); | 127 | void bfad_os_fc_host_init(struct bfad_im_port_s *im_port); |
129 | void bfad_os_init_work(struct bfad_im_port_s *im_port); | ||
130 | void bfad_os_scsi_host_free(struct bfad_s *bfad, | 128 | void bfad_os_scsi_host_free(struct bfad_s *bfad, |
131 | struct bfad_im_port_s *im_port); | 129 | struct bfad_im_port_s *im_port); |
132 | void bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, | 130 | void bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, |
@@ -136,9 +134,6 @@ struct bfad_itnim_s *bfad_os_get_itnim(struct bfad_im_port_s *im_port, int id); | |||
136 | int bfad_os_scsi_add_host(struct Scsi_Host *shost, | 134 | int bfad_os_scsi_add_host(struct Scsi_Host *shost, |
137 | struct bfad_im_port_s *im_port, struct bfad_s *bfad); | 135 | struct bfad_im_port_s *im_port, struct bfad_s *bfad); |
138 | 136 | ||
139 | /* | ||
140 | * scsi_host_template entries | ||
141 | */ | ||
142 | void bfad_im_itnim_unmap(struct bfad_im_port_s *im_port, | 137 | void bfad_im_itnim_unmap(struct bfad_im_port_s *im_port, |
143 | struct bfad_itnim_s *itnim); | 138 | struct bfad_itnim_s *itnim); |
144 | 139 | ||
diff --git a/drivers/scsi/bfa/bfad_intr.c b/drivers/scsi/bfa/bfad_intr.c index 7de8832f6fee..2b7dbecbebca 100644 --- a/drivers/scsi/bfa/bfad_intr.c +++ b/drivers/scsi/bfa/bfad_intr.c | |||
@@ -23,8 +23,10 @@ BFA_TRC_FILE(LDRV, INTR); | |||
23 | /** | 23 | /** |
24 | * bfa_isr BFA driver interrupt functions | 24 | * bfa_isr BFA driver interrupt functions |
25 | */ | 25 | */ |
26 | static int msix_disable; | 26 | static int msix_disable_cb; |
27 | module_param(msix_disable, int, S_IRUGO | S_IWUSR); | 27 | static int msix_disable_ct; |
28 | module_param(msix_disable_cb, int, S_IRUGO | S_IWUSR); | ||
29 | module_param(msix_disable_ct, int, S_IRUGO | S_IWUSR); | ||
28 | /** | 30 | /** |
29 | * Line based interrupt handler. | 31 | * Line based interrupt handler. |
30 | */ | 32 | */ |
@@ -141,6 +143,7 @@ bfad_setup_intr(struct bfad_s *bfad) | |||
141 | int error = 0; | 143 | int error = 0; |
142 | u32 mask = 0, i, num_bit = 0, max_bit = 0; | 144 | u32 mask = 0, i, num_bit = 0, max_bit = 0; |
143 | struct msix_entry msix_entries[MAX_MSIX_ENTRY]; | 145 | struct msix_entry msix_entries[MAX_MSIX_ENTRY]; |
146 | struct pci_dev *pdev = bfad->pcidev; | ||
144 | 147 | ||
145 | /* Call BFA to get the msix map for this PCI function. */ | 148 | /* Call BFA to get the msix map for this PCI function. */ |
146 | bfa_msix_getvecs(&bfad->bfa, &mask, &num_bit, &max_bit); | 149 | bfa_msix_getvecs(&bfad->bfa, &mask, &num_bit, &max_bit); |
@@ -148,7 +151,9 @@ bfad_setup_intr(struct bfad_s *bfad) | |||
148 | /* Set up the msix entry table */ | 151 | /* Set up the msix entry table */ |
149 | bfad_init_msix_entry(bfad, msix_entries, mask, max_bit); | 152 | bfad_init_msix_entry(bfad, msix_entries, mask, max_bit); |
150 | 153 | ||
151 | if (!msix_disable) { | 154 | if ((pdev->device == BFA_PCI_DEVICE_ID_CT && !msix_disable_ct) || |
155 | (pdev->device != BFA_PCI_DEVICE_ID_CT && !msix_disable_cb)) { | ||
156 | |||
152 | error = pci_enable_msix(bfad->pcidev, msix_entries, bfad->nvec); | 157 | error = pci_enable_msix(bfad->pcidev, msix_entries, bfad->nvec); |
153 | if (error) { | 158 | if (error) { |
154 | /* | 159 | /* |
diff --git a/drivers/scsi/bfa/fabric.c b/drivers/scsi/bfa/fabric.c index a4b5dd449573..8166e9745ec0 100644 --- a/drivers/scsi/bfa/fabric.c +++ b/drivers/scsi/bfa/fabric.c | |||
@@ -37,7 +37,7 @@ BFA_TRC_FILE(FCS, FABRIC); | |||
37 | #define BFA_FCS_FABRIC_CLEANUP_DELAY (10000) /* Milliseconds */ | 37 | #define BFA_FCS_FABRIC_CLEANUP_DELAY (10000) /* Milliseconds */ |
38 | 38 | ||
39 | #define bfa_fcs_fabric_set_opertype(__fabric) do { \ | 39 | #define bfa_fcs_fabric_set_opertype(__fabric) do { \ |
40 | if (bfa_pport_get_topology((__fabric)->fcs->bfa) \ | 40 | if (bfa_fcport_get_topology((__fabric)->fcs->bfa) \ |
41 | == BFA_PPORT_TOPOLOGY_P2P) \ | 41 | == BFA_PPORT_TOPOLOGY_P2P) \ |
42 | (__fabric)->oper_type = BFA_PPORT_TYPE_NPORT; \ | 42 | (__fabric)->oper_type = BFA_PPORT_TYPE_NPORT; \ |
43 | else \ | 43 | else \ |
@@ -136,8 +136,7 @@ bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric, | |||
136 | case BFA_FCS_FABRIC_SM_CREATE: | 136 | case BFA_FCS_FABRIC_SM_CREATE: |
137 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created); | 137 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created); |
138 | bfa_fcs_fabric_init(fabric); | 138 | bfa_fcs_fabric_init(fabric); |
139 | bfa_fcs_lport_init(&fabric->bport, fabric->fcs, FC_VF_ID_NULL, | 139 | bfa_fcs_lport_init(&fabric->bport, &fabric->bport.port_cfg); |
140 | &fabric->bport.port_cfg, NULL); | ||
141 | break; | 140 | break; |
142 | 141 | ||
143 | case BFA_FCS_FABRIC_SM_LINK_UP: | 142 | case BFA_FCS_FABRIC_SM_LINK_UP: |
@@ -161,7 +160,7 @@ bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric, | |||
161 | 160 | ||
162 | switch (event) { | 161 | switch (event) { |
163 | case BFA_FCS_FABRIC_SM_START: | 162 | case BFA_FCS_FABRIC_SM_START: |
164 | if (bfa_pport_is_linkup(fabric->fcs->bfa)) { | 163 | if (bfa_fcport_is_linkup(fabric->fcs->bfa)) { |
165 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi); | 164 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi); |
166 | bfa_fcs_fabric_login(fabric); | 165 | bfa_fcs_fabric_login(fabric); |
167 | } else | 166 | } else |
@@ -225,7 +224,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, | |||
225 | switch (event) { | 224 | switch (event) { |
226 | case BFA_FCS_FABRIC_SM_CONT_OP: | 225 | case BFA_FCS_FABRIC_SM_CONT_OP: |
227 | 226 | ||
228 | bfa_pport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); | 227 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); |
229 | fabric->fab_type = BFA_FCS_FABRIC_SWITCHED; | 228 | fabric->fab_type = BFA_FCS_FABRIC_SWITCHED; |
230 | 229 | ||
231 | if (fabric->auth_reqd && fabric->is_auth) { | 230 | if (fabric->auth_reqd && fabric->is_auth) { |
@@ -252,7 +251,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, | |||
252 | 251 | ||
253 | case BFA_FCS_FABRIC_SM_NO_FABRIC: | 252 | case BFA_FCS_FABRIC_SM_NO_FABRIC: |
254 | fabric->fab_type = BFA_FCS_FABRIC_N2N; | 253 | fabric->fab_type = BFA_FCS_FABRIC_N2N; |
255 | bfa_pport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); | 254 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); |
256 | bfa_fcs_fabric_notify_online(fabric); | 255 | bfa_fcs_fabric_notify_online(fabric); |
257 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric); | 256 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric); |
258 | break; | 257 | break; |
@@ -419,7 +418,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, | |||
419 | 418 | ||
420 | case BFA_FCS_FABRIC_SM_NO_FABRIC: | 419 | case BFA_FCS_FABRIC_SM_NO_FABRIC: |
421 | bfa_trc(fabric->fcs, fabric->bb_credit); | 420 | bfa_trc(fabric->fcs, fabric->bb_credit); |
422 | bfa_pport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); | 421 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); |
423 | break; | 422 | break; |
424 | 423 | ||
425 | default: | 424 | default: |
@@ -563,17 +562,15 @@ void | |||
563 | bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric) | 562 | bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric) |
564 | { | 563 | { |
565 | struct bfa_port_cfg_s *port_cfg = &fabric->bport.port_cfg; | 564 | struct bfa_port_cfg_s *port_cfg = &fabric->bport.port_cfg; |
566 | struct bfa_adapter_attr_s adapter_attr; | 565 | char model[BFA_ADAPTER_MODEL_NAME_LEN] = {0}; |
567 | struct bfa_fcs_driver_info_s *driver_info = &fabric->fcs->driver_info; | 566 | struct bfa_fcs_driver_info_s *driver_info = &fabric->fcs->driver_info; |
568 | 567 | ||
569 | bfa_os_memset((void *)&adapter_attr, 0, | 568 | bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model); |
570 | sizeof(struct bfa_adapter_attr_s)); | ||
571 | bfa_ioc_get_adapter_attr(&fabric->fcs->bfa->ioc, &adapter_attr); | ||
572 | 569 | ||
573 | /* | 570 | /* |
574 | * Model name/number | 571 | * Model name/number |
575 | */ | 572 | */ |
576 | strncpy((char *)&port_cfg->sym_name, adapter_attr.model, | 573 | strncpy((char *)&port_cfg->sym_name, model, |
577 | BFA_FCS_PORT_SYMBNAME_MODEL_SZ); | 574 | BFA_FCS_PORT_SYMBNAME_MODEL_SZ); |
578 | strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, | 575 | strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, |
579 | sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); | 576 | sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); |
@@ -719,10 +716,10 @@ bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric) | |||
719 | struct bfa_port_cfg_s *pcfg = &fabric->bport.port_cfg; | 716 | struct bfa_port_cfg_s *pcfg = &fabric->bport.port_cfg; |
720 | u8 alpa = 0; | 717 | u8 alpa = 0; |
721 | 718 | ||
722 | if (bfa_pport_get_topology(bfa) == BFA_PPORT_TOPOLOGY_LOOP) | 719 | if (bfa_fcport_get_topology(bfa) == BFA_PPORT_TOPOLOGY_LOOP) |
723 | alpa = bfa_pport_get_myalpa(bfa); | 720 | alpa = bfa_fcport_get_myalpa(bfa); |
724 | 721 | ||
725 | bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_pport_get_maxfrsize(bfa), | 722 | bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa), |
726 | pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd); | 723 | pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd); |
727 | 724 | ||
728 | fabric->stats.flogi_sent++; | 725 | fabric->stats.flogi_sent++; |
@@ -814,10 +811,10 @@ bfa_fcs_fabric_delete_comp(void *cbarg) | |||
814 | */ | 811 | */ |
815 | 812 | ||
816 | /** | 813 | /** |
817 | * Module initialization | 814 | * Attach time initialization |
818 | */ | 815 | */ |
819 | void | 816 | void |
820 | bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs) | 817 | bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs) |
821 | { | 818 | { |
822 | struct bfa_fcs_fabric_s *fabric; | 819 | struct bfa_fcs_fabric_s *fabric; |
823 | 820 | ||
@@ -841,7 +838,13 @@ bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs) | |||
841 | bfa_wc_up(&fabric->wc); /* For the base port */ | 838 | bfa_wc_up(&fabric->wc); /* For the base port */ |
842 | 839 | ||
843 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); | 840 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); |
844 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_CREATE); | 841 | bfa_fcs_lport_attach(&fabric->bport, fabric->fcs, FC_VF_ID_NULL, NULL); |
842 | } | ||
843 | |||
844 | void | ||
845 | bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs) | ||
846 | { | ||
847 | bfa_sm_send_event(&fcs->fabric, BFA_FCS_FABRIC_SM_CREATE); | ||
845 | bfa_trc(fcs, 0); | 848 | bfa_trc(fcs, 0); |
846 | } | 849 | } |
847 | 850 | ||
@@ -890,6 +893,12 @@ bfa_fcs_fabric_is_loopback(struct bfa_fcs_fabric_s *fabric) | |||
890 | return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_loopback); | 893 | return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_loopback); |
891 | } | 894 | } |
892 | 895 | ||
896 | bfa_boolean_t | ||
897 | bfa_fcs_fabric_is_auth_failed(struct bfa_fcs_fabric_s *fabric) | ||
898 | { | ||
899 | return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_auth_failed); | ||
900 | } | ||
901 | |||
893 | enum bfa_pport_type | 902 | enum bfa_pport_type |
894 | bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric) | 903 | bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric) |
895 | { | 904 | { |
@@ -1165,8 +1174,8 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric) | |||
1165 | reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), | 1174 | reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), |
1166 | bfa_os_hton3b(FC_FABRIC_PORT), | 1175 | bfa_os_hton3b(FC_FABRIC_PORT), |
1167 | n2n_port->reply_oxid, pcfg->pwwn, | 1176 | n2n_port->reply_oxid, pcfg->pwwn, |
1168 | pcfg->nwwn, bfa_pport_get_maxfrsize(bfa), | 1177 | pcfg->nwwn, bfa_fcport_get_maxfrsize(bfa), |
1169 | bfa_pport_get_rx_bbcredit(bfa)); | 1178 | bfa_fcport_get_rx_bbcredit(bfa)); |
1170 | 1179 | ||
1171 | bfa_fcxp_send(fcxp, NULL, fabric->vf_id, bfa_lps_get_tag(fabric->lps), | 1180 | bfa_fcxp_send(fcxp, NULL, fabric->vf_id, bfa_lps_get_tag(fabric->lps), |
1172 | BFA_FALSE, FC_CLASS_3, reqlen, &fchs, | 1181 | BFA_FALSE, FC_CLASS_3, reqlen, &fchs, |
@@ -1224,14 +1233,8 @@ bfa_fcs_fabric_aen_post(struct bfa_fcs_port_s *port, | |||
1224 | wwn2str(pwwn_ptr, pwwn); | 1233 | wwn2str(pwwn_ptr, pwwn); |
1225 | wwn2str(fwwn_ptr, fwwn); | 1234 | wwn2str(fwwn_ptr, fwwn); |
1226 | 1235 | ||
1227 | switch (event) { | 1236 | bfa_log(logmod, BFA_LOG_CREATE_ID(BFA_AEN_CAT_PORT, event), |
1228 | case BFA_PORT_AEN_FABRIC_NAME_CHANGE: | 1237 | pwwn_ptr, fwwn_ptr); |
1229 | bfa_log(logmod, BFA_AEN_PORT_FABRIC_NAME_CHANGE, pwwn_ptr, | ||
1230 | fwwn_ptr); | ||
1231 | break; | ||
1232 | default: | ||
1233 | break; | ||
1234 | } | ||
1235 | 1238 | ||
1236 | aen_data.port.pwwn = pwwn; | 1239 | aen_data.port.pwwn = pwwn; |
1237 | aen_data.port.fwwn = fwwn; | 1240 | aen_data.port.fwwn = fwwn; |
diff --git a/drivers/scsi/bfa/fcbuild.h b/drivers/scsi/bfa/fcbuild.h index 8fa7f270ef7b..981d98d542b9 100644 --- a/drivers/scsi/bfa/fcbuild.h +++ b/drivers/scsi/bfa/fcbuild.h | |||
@@ -72,6 +72,9 @@ fc_rpsc_operspeed_to_bfa_speed(enum fc_rpsc_op_speed_s speed) | |||
72 | case RPSC_OP_SPEED_8G: | 72 | case RPSC_OP_SPEED_8G: |
73 | return BFA_PPORT_SPEED_8GBPS; | 73 | return BFA_PPORT_SPEED_8GBPS; |
74 | 74 | ||
75 | case RPSC_OP_SPEED_10G: | ||
76 | return BFA_PPORT_SPEED_10GBPS; | ||
77 | |||
75 | default: | 78 | default: |
76 | return BFA_PPORT_SPEED_UNKNOWN; | 79 | return BFA_PPORT_SPEED_UNKNOWN; |
77 | } | 80 | } |
@@ -97,6 +100,9 @@ fc_bfa_speed_to_rpsc_operspeed(enum bfa_pport_speed op_speed) | |||
97 | case BFA_PPORT_SPEED_8GBPS: | 100 | case BFA_PPORT_SPEED_8GBPS: |
98 | return RPSC_OP_SPEED_8G; | 101 | return RPSC_OP_SPEED_8G; |
99 | 102 | ||
103 | case BFA_PPORT_SPEED_10GBPS: | ||
104 | return RPSC_OP_SPEED_10G; | ||
105 | |||
100 | default: | 106 | default: |
101 | return RPSC_OP_SPEED_NOT_EST; | 107 | return RPSC_OP_SPEED_NOT_EST; |
102 | } | 108 | } |
diff --git a/drivers/scsi/bfa/fcpim.c b/drivers/scsi/bfa/fcpim.c index 1f3c06efaa9e..8ae4a2cfa85b 100644 --- a/drivers/scsi/bfa/fcpim.c +++ b/drivers/scsi/bfa/fcpim.c | |||
@@ -126,7 +126,7 @@ bfa_fcs_itnim_sm_offline(struct bfa_fcs_itnim_s *itnim, | |||
126 | break; | 126 | break; |
127 | 127 | ||
128 | default: | 128 | default: |
129 | bfa_assert(0); | 129 | bfa_sm_fault(itnim->fcs, event); |
130 | } | 130 | } |
131 | 131 | ||
132 | } | 132 | } |
@@ -161,7 +161,7 @@ bfa_fcs_itnim_sm_prli_send(struct bfa_fcs_itnim_s *itnim, | |||
161 | break; | 161 | break; |
162 | 162 | ||
163 | default: | 163 | default: |
164 | bfa_assert(0); | 164 | bfa_sm_fault(itnim->fcs, event); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
@@ -205,7 +205,7 @@ bfa_fcs_itnim_sm_prli(struct bfa_fcs_itnim_s *itnim, | |||
205 | break; | 205 | break; |
206 | 206 | ||
207 | default: | 207 | default: |
208 | bfa_assert(0); | 208 | bfa_sm_fault(itnim->fcs, event); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
@@ -240,7 +240,7 @@ bfa_fcs_itnim_sm_prli_retry(struct bfa_fcs_itnim_s *itnim, | |||
240 | break; | 240 | break; |
241 | 241 | ||
242 | default: | 242 | default: |
243 | bfa_assert(0); | 243 | bfa_sm_fault(itnim->fcs, event); |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
@@ -270,7 +270,7 @@ bfa_fcs_itnim_sm_hcb_online(struct bfa_fcs_itnim_s *itnim, | |||
270 | break; | 270 | break; |
271 | 271 | ||
272 | default: | 272 | default: |
273 | bfa_assert(0); | 273 | bfa_sm_fault(itnim->fcs, event); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
@@ -298,7 +298,7 @@ bfa_fcs_itnim_sm_online(struct bfa_fcs_itnim_s *itnim, | |||
298 | break; | 298 | break; |
299 | 299 | ||
300 | default: | 300 | default: |
301 | bfa_assert(0); | 301 | bfa_sm_fault(itnim->fcs, event); |
302 | } | 302 | } |
303 | } | 303 | } |
304 | 304 | ||
@@ -321,7 +321,7 @@ bfa_fcs_itnim_sm_hcb_offline(struct bfa_fcs_itnim_s *itnim, | |||
321 | break; | 321 | break; |
322 | 322 | ||
323 | default: | 323 | default: |
324 | bfa_assert(0); | 324 | bfa_sm_fault(itnim->fcs, event); |
325 | } | 325 | } |
326 | } | 326 | } |
327 | 327 | ||
@@ -354,7 +354,7 @@ bfa_fcs_itnim_sm_initiator(struct bfa_fcs_itnim_s *itnim, | |||
354 | break; | 354 | break; |
355 | 355 | ||
356 | default: | 356 | default: |
357 | bfa_assert(0); | 357 | bfa_sm_fault(itnim->fcs, event); |
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
@@ -385,19 +385,8 @@ bfa_fcs_itnim_aen_post(struct bfa_fcs_itnim_s *itnim, | |||
385 | wwn2str(lpwwn_ptr, lpwwn); | 385 | wwn2str(lpwwn_ptr, lpwwn); |
386 | wwn2str(rpwwn_ptr, rpwwn); | 386 | wwn2str(rpwwn_ptr, rpwwn); |
387 | 387 | ||
388 | switch (event) { | 388 | bfa_log(logmod, BFA_LOG_CREATE_ID(BFA_AEN_CAT_ITNIM, event), |
389 | case BFA_ITNIM_AEN_ONLINE: | 389 | rpwwn_ptr, lpwwn_ptr); |
390 | bfa_log(logmod, BFA_AEN_ITNIM_ONLINE, rpwwn_ptr, lpwwn_ptr); | ||
391 | break; | ||
392 | case BFA_ITNIM_AEN_OFFLINE: | ||
393 | bfa_log(logmod, BFA_AEN_ITNIM_OFFLINE, rpwwn_ptr, lpwwn_ptr); | ||
394 | break; | ||
395 | case BFA_ITNIM_AEN_DISCONNECT: | ||
396 | bfa_log(logmod, BFA_AEN_ITNIM_DISCONNECT, rpwwn_ptr, lpwwn_ptr); | ||
397 | break; | ||
398 | default: | ||
399 | break; | ||
400 | } | ||
401 | 390 | ||
402 | aen_data.itnim.vf_id = rport->port->fabric->vf_id; | 391 | aen_data.itnim.vf_id = rport->port->fabric->vf_id; |
403 | aen_data.itnim.ppwwn = | 392 | aen_data.itnim.ppwwn = |
@@ -689,7 +678,6 @@ bfa_cb_itnim_tov_begin(void *cb_arg) | |||
689 | struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *)cb_arg; | 678 | struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *)cb_arg; |
690 | 679 | ||
691 | bfa_trc(itnim->fcs, itnim->rport->pwwn); | 680 | bfa_trc(itnim->fcs, itnim->rport->pwwn); |
692 | bfa_fcb_itnim_tov_begin(itnim->itnim_drv); | ||
693 | } | 681 | } |
694 | 682 | ||
695 | /** | 683 | /** |
@@ -822,22 +810,3 @@ void | |||
822 | bfa_fcs_itnim_resume(struct bfa_fcs_itnim_s *itnim) | 810 | bfa_fcs_itnim_resume(struct bfa_fcs_itnim_s *itnim) |
823 | { | 811 | { |
824 | } | 812 | } |
825 | |||
826 | /** | ||
827 | * Module initialization | ||
828 | */ | ||
829 | void | ||
830 | bfa_fcs_fcpim_modinit(struct bfa_fcs_s *fcs) | ||
831 | { | ||
832 | } | ||
833 | |||
834 | /** | ||
835 | * Module cleanup | ||
836 | */ | ||
837 | void | ||
838 | bfa_fcs_fcpim_modexit(struct bfa_fcs_s *fcs) | ||
839 | { | ||
840 | bfa_fcs_modexit_comp(fcs); | ||
841 | } | ||
842 | |||
843 | |||
diff --git a/drivers/scsi/bfa/fcs_fabric.h b/drivers/scsi/bfa/fcs_fabric.h index eee960820f86..244c3f00c50c 100644 --- a/drivers/scsi/bfa/fcs_fabric.h +++ b/drivers/scsi/bfa/fcs_fabric.h | |||
@@ -29,6 +29,7 @@ | |||
29 | /* | 29 | /* |
30 | * fcs friend functions: only between fcs modules | 30 | * fcs friend functions: only between fcs modules |
31 | */ | 31 | */ |
32 | void bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs); | ||
32 | void bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs); | 33 | void bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs); |
33 | void bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs); | 34 | void bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs); |
34 | void bfa_fcs_fabric_modsusp(struct bfa_fcs_s *fcs); | 35 | void bfa_fcs_fabric_modsusp(struct bfa_fcs_s *fcs); |
@@ -46,6 +47,7 @@ void bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, | |||
46 | struct fchs_s *fchs, u16 len); | 47 | struct fchs_s *fchs, u16 len); |
47 | u16 bfa_fcs_fabric_vport_count(struct bfa_fcs_fabric_s *fabric); | 48 | u16 bfa_fcs_fabric_vport_count(struct bfa_fcs_fabric_s *fabric); |
48 | bfa_boolean_t bfa_fcs_fabric_is_loopback(struct bfa_fcs_fabric_s *fabric); | 49 | bfa_boolean_t bfa_fcs_fabric_is_loopback(struct bfa_fcs_fabric_s *fabric); |
50 | bfa_boolean_t bfa_fcs_fabric_is_auth_failed(struct bfa_fcs_fabric_s *fabric); | ||
49 | enum bfa_pport_type bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric); | 51 | enum bfa_pport_type bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric); |
50 | void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric); | 52 | void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric); |
51 | void bfa_fcs_fabric_port_delete_comp(struct bfa_fcs_fabric_s *fabric); | 53 | void bfa_fcs_fabric_port_delete_comp(struct bfa_fcs_fabric_s *fabric); |
diff --git a/drivers/scsi/bfa/fcs_fcpim.h b/drivers/scsi/bfa/fcs_fcpim.h index 61e9e2687de3..11e6e7bce9f6 100644 --- a/drivers/scsi/bfa/fcs_fcpim.h +++ b/drivers/scsi/bfa/fcs_fcpim.h | |||
@@ -34,11 +34,6 @@ void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim); | |||
34 | void bfa_fcs_itnim_pause(struct bfa_fcs_itnim_s *itnim); | 34 | void bfa_fcs_itnim_pause(struct bfa_fcs_itnim_s *itnim); |
35 | void bfa_fcs_itnim_resume(struct bfa_fcs_itnim_s *itnim); | 35 | void bfa_fcs_itnim_resume(struct bfa_fcs_itnim_s *itnim); |
36 | 36 | ||
37 | /* | ||
38 | * Modudle init/cleanup routines. | ||
39 | */ | ||
40 | void bfa_fcs_fcpim_modinit(struct bfa_fcs_s *fcs); | ||
41 | void bfa_fcs_fcpim_modexit(struct bfa_fcs_s *fcs); | ||
42 | void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim, struct fchs_s *fchs, | 37 | void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim, struct fchs_s *fchs, |
43 | u16 len); | 38 | u16 len); |
44 | #endif /* __FCS_FCPIM_H__ */ | 39 | #endif /* __FCS_FCPIM_H__ */ |
diff --git a/drivers/scsi/bfa/fcs_lport.h b/drivers/scsi/bfa/fcs_lport.h index ae744ba35671..a6508c8ab184 100644 --- a/drivers/scsi/bfa/fcs_lport.h +++ b/drivers/scsi/bfa/fcs_lport.h | |||
@@ -84,9 +84,10 @@ void bfa_fcs_port_uf_recv(struct bfa_fcs_port_s *lport, struct fchs_s *fchs, | |||
84 | * Following routines will be called by Fabric to indicate port | 84 | * Following routines will be called by Fabric to indicate port |
85 | * online/offline to vport. | 85 | * online/offline to vport. |
86 | */ | 86 | */ |
87 | void bfa_fcs_lport_init(struct bfa_fcs_port_s *lport, struct bfa_fcs_s *fcs, | 87 | void bfa_fcs_lport_attach(struct bfa_fcs_port_s *lport, struct bfa_fcs_s *fcs, |
88 | u16 vf_id, struct bfa_port_cfg_s *port_cfg, | 88 | uint16_t vf_id, struct bfa_fcs_vport_s *vport); |
89 | struct bfa_fcs_vport_s *vport); | 89 | void bfa_fcs_lport_init(struct bfa_fcs_port_s *lport, |
90 | struct bfa_port_cfg_s *port_cfg); | ||
90 | void bfa_fcs_port_online(struct bfa_fcs_port_s *port); | 91 | void bfa_fcs_port_online(struct bfa_fcs_port_s *port); |
91 | void bfa_fcs_port_offline(struct bfa_fcs_port_s *port); | 92 | void bfa_fcs_port_offline(struct bfa_fcs_port_s *port); |
92 | void bfa_fcs_port_delete(struct bfa_fcs_port_s *port); | 93 | void bfa_fcs_port_delete(struct bfa_fcs_port_s *port); |
diff --git a/drivers/scsi/bfa/fcs_port.h b/drivers/scsi/bfa/fcs_port.h index abb65191dd27..408c06a7d164 100644 --- a/drivers/scsi/bfa/fcs_port.h +++ b/drivers/scsi/bfa/fcs_port.h | |||
@@ -26,7 +26,6 @@ | |||
26 | /* | 26 | /* |
27 | * fcs friend functions: only between fcs modules | 27 | * fcs friend functions: only between fcs modules |
28 | */ | 28 | */ |
29 | void bfa_fcs_pport_modinit(struct bfa_fcs_s *fcs); | 29 | void bfa_fcs_pport_attach(struct bfa_fcs_s *fcs); |
30 | void bfa_fcs_pport_modexit(struct bfa_fcs_s *fcs); | ||
31 | 30 | ||
32 | #endif /* __FCS_PPORT_H__ */ | 31 | #endif /* __FCS_PPORT_H__ */ |
diff --git a/drivers/scsi/bfa/fcs_rport.h b/drivers/scsi/bfa/fcs_rport.h index f601e9d74236..9c8d1d292380 100644 --- a/drivers/scsi/bfa/fcs_rport.h +++ b/drivers/scsi/bfa/fcs_rport.h | |||
@@ -24,9 +24,6 @@ | |||
24 | 24 | ||
25 | #include <fcs/bfa_fcs_rport.h> | 25 | #include <fcs/bfa_fcs_rport.h> |
26 | 26 | ||
27 | void bfa_fcs_rport_modinit(struct bfa_fcs_s *fcs); | ||
28 | void bfa_fcs_rport_modexit(struct bfa_fcs_s *fcs); | ||
29 | |||
30 | void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs, | 27 | void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs, |
31 | u16 len); | 28 | u16 len); |
32 | void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport); | 29 | void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport); |
diff --git a/drivers/scsi/bfa/fcs_uf.h b/drivers/scsi/bfa/fcs_uf.h index 96f1bdcb31ed..f591072214fe 100644 --- a/drivers/scsi/bfa/fcs_uf.h +++ b/drivers/scsi/bfa/fcs_uf.h | |||
@@ -26,7 +26,6 @@ | |||
26 | /* | 26 | /* |
27 | * fcs friend functions: only between fcs modules | 27 | * fcs friend functions: only between fcs modules |
28 | */ | 28 | */ |
29 | void bfa_fcs_uf_modinit(struct bfa_fcs_s *fcs); | 29 | void bfa_fcs_uf_attach(struct bfa_fcs_s *fcs); |
30 | void bfa_fcs_uf_modexit(struct bfa_fcs_s *fcs); | ||
31 | 30 | ||
32 | #endif /* __FCS_UF_H__ */ | 31 | #endif /* __FCS_UF_H__ */ |
diff --git a/drivers/scsi/bfa/fcs_vport.h b/drivers/scsi/bfa/fcs_vport.h index 9e80b6a97b7f..13c32ebf946c 100644 --- a/drivers/scsi/bfa/fcs_vport.h +++ b/drivers/scsi/bfa/fcs_vport.h | |||
@@ -22,18 +22,10 @@ | |||
22 | #include <fcs/bfa_fcs_vport.h> | 22 | #include <fcs/bfa_fcs_vport.h> |
23 | #include <defs/bfa_defs_pci.h> | 23 | #include <defs/bfa_defs_pci.h> |
24 | 24 | ||
25 | /* | ||
26 | * Modudle init/cleanup routines. | ||
27 | */ | ||
28 | |||
29 | void bfa_fcs_vport_modinit(struct bfa_fcs_s *fcs); | ||
30 | void bfa_fcs_vport_modexit(struct bfa_fcs_s *fcs); | ||
31 | |||
32 | void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport); | 25 | void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport); |
33 | void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport); | 26 | void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport); |
34 | void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport); | 27 | void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport); |
35 | void bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport); | 28 | void bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport); |
36 | u32 bfa_fcs_vport_get_max(struct bfa_fcs_s *fcs); | ||
37 | 29 | ||
38 | #endif /* __FCS_VPORT_H__ */ | 30 | #endif /* __FCS_VPORT_H__ */ |
39 | 31 | ||
diff --git a/drivers/scsi/bfa/fdmi.c b/drivers/scsi/bfa/fdmi.c index df2a1e54e16b..8f17076d1a87 100644 --- a/drivers/scsi/bfa/fdmi.c +++ b/drivers/scsi/bfa/fdmi.c | |||
@@ -116,6 +116,9 @@ static void bfa_fcs_port_fdmi_sm_rpa_retry(struct bfa_fcs_port_fdmi_s *fdmi, | |||
116 | enum port_fdmi_event event); | 116 | enum port_fdmi_event event); |
117 | static void bfa_fcs_port_fdmi_sm_online(struct bfa_fcs_port_fdmi_s *fdmi, | 117 | static void bfa_fcs_port_fdmi_sm_online(struct bfa_fcs_port_fdmi_s *fdmi, |
118 | enum port_fdmi_event event); | 118 | enum port_fdmi_event event); |
119 | static void bfa_fcs_port_fdmi_sm_disabled(struct bfa_fcs_port_fdmi_s *fdmi, | ||
120 | enum port_fdmi_event event); | ||
121 | |||
119 | /** | 122 | /** |
120 | * Start in offline state - awaiting MS to send start. | 123 | * Start in offline state - awaiting MS to send start. |
121 | */ | 124 | */ |
@@ -155,7 +158,7 @@ bfa_fcs_port_fdmi_sm_offline(struct bfa_fcs_port_fdmi_s *fdmi, | |||
155 | break; | 158 | break; |
156 | 159 | ||
157 | default: | 160 | default: |
158 | bfa_assert(0); | 161 | bfa_sm_fault(port->fcs, event); |
159 | } | 162 | } |
160 | } | 163 | } |
161 | 164 | ||
@@ -180,7 +183,7 @@ bfa_fcs_port_fdmi_sm_sending_rhba(struct bfa_fcs_port_fdmi_s *fdmi, | |||
180 | break; | 183 | break; |
181 | 184 | ||
182 | default: | 185 | default: |
183 | bfa_assert(0); | 186 | bfa_sm_fault(port->fcs, event); |
184 | } | 187 | } |
185 | } | 188 | } |
186 | 189 | ||
@@ -227,7 +230,7 @@ bfa_fcs_port_fdmi_sm_rhba(struct bfa_fcs_port_fdmi_s *fdmi, | |||
227 | break; | 230 | break; |
228 | 231 | ||
229 | default: | 232 | default: |
230 | bfa_assert(0); | 233 | bfa_sm_fault(port->fcs, event); |
231 | } | 234 | } |
232 | } | 235 | } |
233 | 236 | ||
@@ -255,7 +258,7 @@ bfa_fcs_port_fdmi_sm_rhba_retry(struct bfa_fcs_port_fdmi_s *fdmi, | |||
255 | break; | 258 | break; |
256 | 259 | ||
257 | default: | 260 | default: |
258 | bfa_assert(0); | 261 | bfa_sm_fault(port->fcs, event); |
259 | } | 262 | } |
260 | } | 263 | } |
261 | 264 | ||
@@ -283,7 +286,7 @@ bfa_fcs_port_fdmi_sm_sending_rprt(struct bfa_fcs_port_fdmi_s *fdmi, | |||
283 | break; | 286 | break; |
284 | 287 | ||
285 | default: | 288 | default: |
286 | bfa_assert(0); | 289 | bfa_sm_fault(port->fcs, event); |
287 | } | 290 | } |
288 | } | 291 | } |
289 | 292 | ||
@@ -328,7 +331,7 @@ bfa_fcs_port_fdmi_sm_rprt(struct bfa_fcs_port_fdmi_s *fdmi, | |||
328 | break; | 331 | break; |
329 | 332 | ||
330 | default: | 333 | default: |
331 | bfa_assert(0); | 334 | bfa_sm_fault(port->fcs, event); |
332 | } | 335 | } |
333 | } | 336 | } |
334 | 337 | ||
@@ -356,7 +359,7 @@ bfa_fcs_port_fdmi_sm_rprt_retry(struct bfa_fcs_port_fdmi_s *fdmi, | |||
356 | break; | 359 | break; |
357 | 360 | ||
358 | default: | 361 | default: |
359 | bfa_assert(0); | 362 | bfa_sm_fault(port->fcs, event); |
360 | } | 363 | } |
361 | } | 364 | } |
362 | 365 | ||
@@ -384,7 +387,7 @@ bfa_fcs_port_fdmi_sm_sending_rpa(struct bfa_fcs_port_fdmi_s *fdmi, | |||
384 | break; | 387 | break; |
385 | 388 | ||
386 | default: | 389 | default: |
387 | bfa_assert(0); | 390 | bfa_sm_fault(port->fcs, event); |
388 | } | 391 | } |
389 | } | 392 | } |
390 | 393 | ||
@@ -428,7 +431,7 @@ bfa_fcs_port_fdmi_sm_rpa(struct bfa_fcs_port_fdmi_s *fdmi, | |||
428 | break; | 431 | break; |
429 | 432 | ||
430 | default: | 433 | default: |
431 | bfa_assert(0); | 434 | bfa_sm_fault(port->fcs, event); |
432 | } | 435 | } |
433 | } | 436 | } |
434 | 437 | ||
@@ -456,7 +459,7 @@ bfa_fcs_port_fdmi_sm_rpa_retry(struct bfa_fcs_port_fdmi_s *fdmi, | |||
456 | break; | 459 | break; |
457 | 460 | ||
458 | default: | 461 | default: |
459 | bfa_assert(0); | 462 | bfa_sm_fault(port->fcs, event); |
460 | } | 463 | } |
461 | } | 464 | } |
462 | 465 | ||
@@ -475,10 +478,24 @@ bfa_fcs_port_fdmi_sm_online(struct bfa_fcs_port_fdmi_s *fdmi, | |||
475 | break; | 478 | break; |
476 | 479 | ||
477 | default: | 480 | default: |
478 | bfa_assert(0); | 481 | bfa_sm_fault(port->fcs, event); |
479 | } | 482 | } |
480 | } | 483 | } |
481 | 484 | ||
485 | /** | ||
486 | * FDMI is disabled state. | ||
487 | */ | ||
488 | static void | ||
489 | bfa_fcs_port_fdmi_sm_disabled(struct bfa_fcs_port_fdmi_s *fdmi, | ||
490 | enum port_fdmi_event event) | ||
491 | { | ||
492 | struct bfa_fcs_port_s *port = fdmi->ms->port; | ||
493 | |||
494 | bfa_trc(port->fcs, port->port_cfg.pwwn); | ||
495 | bfa_trc(port->fcs, event); | ||
496 | |||
497 | /* No op State. It can only be enabled at Driver Init. */ | ||
498 | } | ||
482 | 499 | ||
483 | /** | 500 | /** |
484 | * RHBA : Register HBA Attributes. | 501 | * RHBA : Register HBA Attributes. |
@@ -1097,36 +1114,23 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_port_fdmi_s *fdmi, | |||
1097 | { | 1114 | { |
1098 | struct bfa_fcs_port_s *port = fdmi->ms->port; | 1115 | struct bfa_fcs_port_s *port = fdmi->ms->port; |
1099 | struct bfa_fcs_driver_info_s *driver_info = &port->fcs->driver_info; | 1116 | struct bfa_fcs_driver_info_s *driver_info = &port->fcs->driver_info; |
1100 | struct bfa_adapter_attr_s adapter_attr; | ||
1101 | 1117 | ||
1102 | bfa_os_memset(hba_attr, 0, sizeof(struct bfa_fcs_fdmi_hba_attr_s)); | 1118 | bfa_os_memset(hba_attr, 0, sizeof(struct bfa_fcs_fdmi_hba_attr_s)); |
1103 | bfa_os_memset(&adapter_attr, 0, sizeof(struct bfa_adapter_attr_s)); | ||
1104 | |||
1105 | bfa_ioc_get_adapter_attr(&port->fcs->bfa->ioc, &adapter_attr); | ||
1106 | |||
1107 | strncpy(hba_attr->manufacturer, adapter_attr.manufacturer, | ||
1108 | sizeof(adapter_attr.manufacturer)); | ||
1109 | |||
1110 | strncpy(hba_attr->serial_num, adapter_attr.serial_num, | ||
1111 | sizeof(adapter_attr.serial_num)); | ||
1112 | 1119 | ||
1113 | strncpy(hba_attr->model, adapter_attr.model, sizeof(hba_attr->model)); | 1120 | bfa_ioc_get_adapter_manufacturer(&port->fcs->bfa->ioc, |
1114 | 1121 | hba_attr->manufacturer); | |
1115 | strncpy(hba_attr->model_desc, adapter_attr.model_descr, | 1122 | bfa_ioc_get_adapter_serial_num(&port->fcs->bfa->ioc, |
1116 | sizeof(hba_attr->model_desc)); | 1123 | hba_attr->serial_num); |
1117 | 1124 | bfa_ioc_get_adapter_model(&port->fcs->bfa->ioc, hba_attr->model); | |
1118 | strncpy(hba_attr->hw_version, adapter_attr.hw_ver, | 1125 | bfa_ioc_get_adapter_model(&port->fcs->bfa->ioc, hba_attr->model_desc); |
1119 | sizeof(hba_attr->hw_version)); | 1126 | bfa_ioc_get_pci_chip_rev(&port->fcs->bfa->ioc, hba_attr->hw_version); |
1127 | bfa_ioc_get_adapter_optrom_ver(&port->fcs->bfa->ioc, | ||
1128 | hba_attr->option_rom_ver); | ||
1129 | bfa_ioc_get_adapter_fw_ver(&port->fcs->bfa->ioc, hba_attr->fw_version); | ||
1120 | 1130 | ||
1121 | strncpy(hba_attr->driver_version, (char *)driver_info->version, | 1131 | strncpy(hba_attr->driver_version, (char *)driver_info->version, |
1122 | sizeof(hba_attr->driver_version)); | 1132 | sizeof(hba_attr->driver_version)); |
1123 | 1133 | ||
1124 | strncpy(hba_attr->option_rom_ver, adapter_attr.optrom_ver, | ||
1125 | sizeof(hba_attr->option_rom_ver)); | ||
1126 | |||
1127 | strncpy(hba_attr->fw_version, adapter_attr.fw_ver, | ||
1128 | sizeof(hba_attr->fw_version)); | ||
1129 | |||
1130 | strncpy(hba_attr->os_name, driver_info->host_os_name, | 1134 | strncpy(hba_attr->os_name, driver_info->host_os_name, |
1131 | sizeof(hba_attr->os_name)); | 1135 | sizeof(hba_attr->os_name)); |
1132 | 1136 | ||
@@ -1158,7 +1162,7 @@ bfa_fcs_fdmi_get_portattr(struct bfa_fcs_port_fdmi_s *fdmi, | |||
1158 | /* | 1162 | /* |
1159 | * get pport attributes from hal | 1163 | * get pport attributes from hal |
1160 | */ | 1164 | */ |
1161 | bfa_pport_get_attr(port->fcs->bfa, &pport_attr); | 1165 | bfa_fcport_get_attr(port->fcs->bfa, &pport_attr); |
1162 | 1166 | ||
1163 | /* | 1167 | /* |
1164 | * get FC4 type Bitmask | 1168 | * get FC4 type Bitmask |
@@ -1201,7 +1205,10 @@ bfa_fcs_port_fdmi_init(struct bfa_fcs_port_ms_s *ms) | |||
1201 | struct bfa_fcs_port_fdmi_s *fdmi = &ms->fdmi; | 1205 | struct bfa_fcs_port_fdmi_s *fdmi = &ms->fdmi; |
1202 | 1206 | ||
1203 | fdmi->ms = ms; | 1207 | fdmi->ms = ms; |
1204 | bfa_sm_set_state(fdmi, bfa_fcs_port_fdmi_sm_offline); | 1208 | if (ms->port->fcs->fdmi_enabled) |
1209 | bfa_sm_set_state(fdmi, bfa_fcs_port_fdmi_sm_offline); | ||
1210 | else | ||
1211 | bfa_sm_set_state(fdmi, bfa_fcs_port_fdmi_sm_disabled); | ||
1205 | } | 1212 | } |
1206 | 1213 | ||
1207 | void | 1214 | void |
diff --git a/drivers/scsi/bfa/include/aen/bfa_aen.h b/drivers/scsi/bfa/include/aen/bfa_aen.h index d9cbc2a783d4..6abbab005db6 100644 --- a/drivers/scsi/bfa/include/aen/bfa_aen.h +++ b/drivers/scsi/bfa/include/aen/bfa_aen.h | |||
@@ -18,21 +18,24 @@ | |||
18 | #define __BFA_AEN_H__ | 18 | #define __BFA_AEN_H__ |
19 | 19 | ||
20 | #include "defs/bfa_defs_aen.h" | 20 | #include "defs/bfa_defs_aen.h" |
21 | #include "defs/bfa_defs_status.h" | ||
22 | #include "cs/bfa_debug.h" | ||
21 | 23 | ||
22 | #define BFA_AEN_MAX_ENTRY 512 | 24 | #define BFA_AEN_MAX_ENTRY 512 |
23 | 25 | ||
24 | extern s32 bfa_aen_max_cfg_entry; | 26 | extern int bfa_aen_max_cfg_entry; |
25 | struct bfa_aen_s { | 27 | struct bfa_aen_s { |
26 | void *bfad; | 28 | void *bfad; |
27 | s32 max_entry; | 29 | int max_entry; |
28 | s32 write_index; | 30 | int write_index; |
29 | s32 read_index; | 31 | int read_index; |
30 | u32 bfad_num; | 32 | int bfad_num; |
31 | u32 seq_num; | 33 | int seq_num; |
32 | void (*aen_cb_notify)(void *bfad); | 34 | void (*aen_cb_notify)(void *bfad); |
33 | void (*gettimeofday)(struct bfa_timeval_s *tv); | 35 | void (*gettimeofday)(struct bfa_timeval_s *tv); |
34 | struct bfa_trc_mod_s *trcmod; | 36 | struct bfa_trc_mod_s *trcmod; |
35 | struct bfa_aen_entry_s list[BFA_AEN_MAX_ENTRY]; /* Must be the last */ | 37 | int app_ri[BFA_AEN_MAX_APP]; /* For multiclient support */ |
38 | struct bfa_aen_entry_s list[BFA_AEN_MAX_ENTRY]; /* Must be the last */ | ||
36 | }; | 39 | }; |
37 | 40 | ||
38 | 41 | ||
@@ -45,48 +48,49 @@ bfa_aen_set_max_cfg_entry(int max_entry) | |||
45 | bfa_aen_max_cfg_entry = max_entry; | 48 | bfa_aen_max_cfg_entry = max_entry; |
46 | } | 49 | } |
47 | 50 | ||
48 | static inline s32 | 51 | static inline int |
49 | bfa_aen_get_max_cfg_entry(void) | 52 | bfa_aen_get_max_cfg_entry(void) |
50 | { | 53 | { |
51 | return bfa_aen_max_cfg_entry; | 54 | return bfa_aen_max_cfg_entry; |
52 | } | 55 | } |
53 | 56 | ||
54 | static inline s32 | 57 | static inline int |
55 | bfa_aen_get_meminfo(void) | 58 | bfa_aen_get_meminfo(void) |
56 | { | 59 | { |
57 | return sizeof(struct bfa_aen_entry_s) * bfa_aen_get_max_cfg_entry(); | 60 | return sizeof(struct bfa_aen_entry_s) * bfa_aen_get_max_cfg_entry(); |
58 | } | 61 | } |
59 | 62 | ||
60 | static inline s32 | 63 | static inline int |
61 | bfa_aen_get_wi(struct bfa_aen_s *aen) | 64 | bfa_aen_get_wi(struct bfa_aen_s *aen) |
62 | { | 65 | { |
63 | return aen->write_index; | 66 | return aen->write_index; |
64 | } | 67 | } |
65 | 68 | ||
66 | static inline s32 | 69 | static inline int |
67 | bfa_aen_get_ri(struct bfa_aen_s *aen) | 70 | bfa_aen_get_ri(struct bfa_aen_s *aen) |
68 | { | 71 | { |
69 | return aen->read_index; | 72 | return aen->read_index; |
70 | } | 73 | } |
71 | 74 | ||
72 | static inline s32 | 75 | static inline int |
73 | bfa_aen_fetch_count(struct bfa_aen_s *aen, s32 read_index) | 76 | bfa_aen_fetch_count(struct bfa_aen_s *aen, enum bfa_aen_app app_id) |
74 | { | 77 | { |
75 | return ((aen->write_index + aen->max_entry) - read_index) | 78 | bfa_assert((app_id < BFA_AEN_MAX_APP) && (app_id >= bfa_aen_app_bcu)); |
79 | return ((aen->write_index + aen->max_entry) - aen->app_ri[app_id]) | ||
76 | % aen->max_entry; | 80 | % aen->max_entry; |
77 | } | 81 | } |
78 | 82 | ||
79 | s32 bfa_aen_init(struct bfa_aen_s *aen, struct bfa_trc_mod_s *trcmod, | 83 | int bfa_aen_init(struct bfa_aen_s *aen, struct bfa_trc_mod_s *trcmod, |
80 | void *bfad, u32 inst_id, void (*aen_cb_notify)(void *), | 84 | void *bfad, int bfad_num, void (*aen_cb_notify)(void *), |
81 | void (*gettimeofday)(struct bfa_timeval_s *)); | 85 | void (*gettimeofday)(struct bfa_timeval_s *)); |
82 | 86 | ||
83 | s32 bfa_aen_post(struct bfa_aen_s *aen, enum bfa_aen_category aen_category, | 87 | void bfa_aen_post(struct bfa_aen_s *aen, enum bfa_aen_category aen_category, |
84 | int aen_type, union bfa_aen_data_u *aen_data); | 88 | int aen_type, union bfa_aen_data_u *aen_data); |
85 | 89 | ||
86 | s32 bfa_aen_fetch(struct bfa_aen_s *aen, struct bfa_aen_entry_s *aen_entry, | 90 | bfa_status_t bfa_aen_fetch(struct bfa_aen_s *aen, |
87 | s32 entry_space, s32 rii, s32 *ri_arr, | 91 | struct bfa_aen_entry_s *aen_entry, |
88 | s32 ri_arr_cnt); | 92 | int entry_req, enum bfa_aen_app app_id, int *entry_ret); |
89 | 93 | ||
90 | s32 bfa_aen_get_inst(struct bfa_aen_s *aen); | 94 | int bfa_aen_get_inst(struct bfa_aen_s *aen); |
91 | 95 | ||
92 | #endif /* __BFA_AEN_H__ */ | 96 | #endif /* __BFA_AEN_H__ */ |
diff --git a/drivers/scsi/bfa/include/bfa.h b/drivers/scsi/bfa/include/bfa.h index d4bc0d9fa42c..1f5966cfbd16 100644 --- a/drivers/scsi/bfa/include/bfa.h +++ b/drivers/scsi/bfa/include/bfa.h | |||
@@ -106,6 +106,26 @@ struct bfa_sge_s { | |||
106 | bfa_ioc_fetch_stats(&(__bfa)->ioc, __ioc_stats) | 106 | bfa_ioc_fetch_stats(&(__bfa)->ioc, __ioc_stats) |
107 | #define bfa_ioc_clear_stats(__bfa) \ | 107 | #define bfa_ioc_clear_stats(__bfa) \ |
108 | bfa_ioc_clr_stats(&(__bfa)->ioc) | 108 | bfa_ioc_clr_stats(&(__bfa)->ioc) |
109 | #define bfa_get_nports(__bfa) \ | ||
110 | bfa_ioc_get_nports(&(__bfa)->ioc) | ||
111 | #define bfa_get_adapter_manufacturer(__bfa, __manufacturer) \ | ||
112 | bfa_ioc_get_adapter_manufacturer(&(__bfa)->ioc, __manufacturer) | ||
113 | #define bfa_get_adapter_model(__bfa, __model) \ | ||
114 | bfa_ioc_get_adapter_model(&(__bfa)->ioc, __model) | ||
115 | #define bfa_get_adapter_serial_num(__bfa, __serial_num) \ | ||
116 | bfa_ioc_get_adapter_serial_num(&(__bfa)->ioc, __serial_num) | ||
117 | #define bfa_get_adapter_fw_ver(__bfa, __fw_ver) \ | ||
118 | bfa_ioc_get_adapter_fw_ver(&(__bfa)->ioc, __fw_ver) | ||
119 | #define bfa_get_adapter_optrom_ver(__bfa, __optrom_ver) \ | ||
120 | bfa_ioc_get_adapter_optrom_ver(&(__bfa)->ioc, __optrom_ver) | ||
121 | #define bfa_get_pci_chip_rev(__bfa, __chip_rev) \ | ||
122 | bfa_ioc_get_pci_chip_rev(&(__bfa)->ioc, __chip_rev) | ||
123 | #define bfa_get_ioc_state(__bfa) \ | ||
124 | bfa_ioc_get_state(&(__bfa)->ioc) | ||
125 | #define bfa_get_type(__bfa) \ | ||
126 | bfa_ioc_get_type(&(__bfa)->ioc) | ||
127 | #define bfa_get_mac(__bfa) \ | ||
128 | bfa_ioc_get_mac(&(__bfa)->ioc) | ||
109 | 129 | ||
110 | /* | 130 | /* |
111 | * bfa API functions | 131 | * bfa API functions |
@@ -161,6 +181,7 @@ bfa_status_t bfa_iocfc_israttr_set(struct bfa_s *bfa, | |||
161 | void bfa_iocfc_enable(struct bfa_s *bfa); | 181 | void bfa_iocfc_enable(struct bfa_s *bfa); |
162 | void bfa_iocfc_disable(struct bfa_s *bfa); | 182 | void bfa_iocfc_disable(struct bfa_s *bfa); |
163 | void bfa_ioc_auto_recover(bfa_boolean_t auto_recover); | 183 | void bfa_ioc_auto_recover(bfa_boolean_t auto_recover); |
184 | void bfa_chip_reset(struct bfa_s *bfa); | ||
164 | void bfa_cb_ioc_disable(void *bfad); | 185 | void bfa_cb_ioc_disable(void *bfad); |
165 | void bfa_timer_tick(struct bfa_s *bfa); | 186 | void bfa_timer_tick(struct bfa_s *bfa); |
166 | #define bfa_timer_start(_bfa, _timer, _timercb, _arg, _timeout) \ | 187 | #define bfa_timer_start(_bfa, _timer, _timercb, _arg, _timeout) \ |
@@ -171,6 +192,7 @@ void bfa_timer_tick(struct bfa_s *bfa); | |||
171 | */ | 192 | */ |
172 | bfa_status_t bfa_debug_fwtrc(struct bfa_s *bfa, void *trcdata, int *trclen); | 193 | bfa_status_t bfa_debug_fwtrc(struct bfa_s *bfa, void *trcdata, int *trclen); |
173 | bfa_status_t bfa_debug_fwsave(struct bfa_s *bfa, void *trcdata, int *trclen); | 194 | bfa_status_t bfa_debug_fwsave(struct bfa_s *bfa, void *trcdata, int *trclen); |
195 | void bfa_debug_fwsave_clear(struct bfa_s *bfa); | ||
174 | 196 | ||
175 | #include "bfa_priv.h" | 197 | #include "bfa_priv.h" |
176 | 198 | ||
diff --git a/drivers/scsi/bfa/include/bfa_svc.h b/drivers/scsi/bfa/include/bfa_svc.h index 268d956bad89..1349b99a3c6d 100644 --- a/drivers/scsi/bfa/include/bfa_svc.h +++ b/drivers/scsi/bfa/include/bfa_svc.h | |||
@@ -26,6 +26,7 @@ struct bfa_fcxp_s; | |||
26 | #include <defs/bfa_defs_pport.h> | 26 | #include <defs/bfa_defs_pport.h> |
27 | #include <defs/bfa_defs_rport.h> | 27 | #include <defs/bfa_defs_rport.h> |
28 | #include <defs/bfa_defs_qos.h> | 28 | #include <defs/bfa_defs_qos.h> |
29 | #include <defs/bfa_defs_fcport.h> | ||
29 | #include <cs/bfa_sm.h> | 30 | #include <cs/bfa_sm.h> |
30 | #include <bfa.h> | 31 | #include <bfa.h> |
31 | 32 | ||
@@ -35,7 +36,7 @@ struct bfa_fcxp_s; | |||
35 | struct bfa_rport_info_s { | 36 | struct bfa_rport_info_s { |
36 | u16 max_frmsz; /* max rcv pdu size */ | 37 | u16 max_frmsz; /* max rcv pdu size */ |
37 | u32 pid:24, /* remote port ID */ | 38 | u32 pid:24, /* remote port ID */ |
38 | lp_tag:8; | 39 | lp_tag:8; /* tag */ |
39 | u32 local_pid:24, /* local port ID */ | 40 | u32 local_pid:24, /* local port ID */ |
40 | cisc:8; /* CIRO supported */ | 41 | cisc:8; /* CIRO supported */ |
41 | u8 fc_class; /* supported FC classes. enum fc_cos */ | 42 | u8 fc_class; /* supported FC classes. enum fc_cos */ |
@@ -54,7 +55,7 @@ struct bfa_rport_s { | |||
54 | void *rport_drv; /* fcs/driver rport object */ | 55 | void *rport_drv; /* fcs/driver rport object */ |
55 | u16 fw_handle; /* firmware rport handle */ | 56 | u16 fw_handle; /* firmware rport handle */ |
56 | u16 rport_tag; /* BFA rport tag */ | 57 | u16 rport_tag; /* BFA rport tag */ |
57 | struct bfa_rport_info_s rport_info; /* rport info from *fcs/driver */ | 58 | struct bfa_rport_info_s rport_info; /* rport info from fcs/driver */ |
58 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ | 59 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ |
59 | struct bfa_cb_qe_s hcb_qe; /* BFA callback qelem */ | 60 | struct bfa_cb_qe_s hcb_qe; /* BFA callback qelem */ |
60 | struct bfa_rport_hal_stats_s stats; /* BFA rport statistics */ | 61 | struct bfa_rport_hal_stats_s stats; /* BFA rport statistics */ |
@@ -101,7 +102,7 @@ struct bfa_uf_buf_s { | |||
101 | struct bfa_uf_s { | 102 | struct bfa_uf_s { |
102 | struct list_head qe; /* queue element */ | 103 | struct list_head qe; /* queue element */ |
103 | struct bfa_s *bfa; /* bfa instance */ | 104 | struct bfa_s *bfa; /* bfa instance */ |
104 | u16 uf_tag; /* identifying tag f/w messages */ | 105 | u16 uf_tag; /* identifying tag fw msgs */ |
105 | u16 vf_id; | 106 | u16 vf_id; |
106 | u16 src_rport_handle; | 107 | u16 src_rport_handle; |
107 | u16 rsvd; | 108 | u16 rsvd; |
@@ -127,7 +128,7 @@ struct bfa_lps_s { | |||
127 | u8 reqq; /* lport request queue */ | 128 | u8 reqq; /* lport request queue */ |
128 | u8 alpa; /* ALPA for loop topologies */ | 129 | u8 alpa; /* ALPA for loop topologies */ |
129 | u32 lp_pid; /* lport port ID */ | 130 | u32 lp_pid; /* lport port ID */ |
130 | bfa_boolean_t fdisc; /* send FDISC instead of FLOGI*/ | 131 | bfa_boolean_t fdisc; /* send FDISC instead of FLOGI */ |
131 | bfa_boolean_t auth_en; /* enable authentication */ | 132 | bfa_boolean_t auth_en; /* enable authentication */ |
132 | bfa_boolean_t auth_req; /* authentication required */ | 133 | bfa_boolean_t auth_req; /* authentication required */ |
133 | bfa_boolean_t npiv_en; /* NPIV is allowed by peer */ | 134 | bfa_boolean_t npiv_en; /* NPIV is allowed by peer */ |
@@ -151,60 +152,69 @@ struct bfa_lps_s { | |||
151 | bfa_eproto_status_t ext_status; | 152 | bfa_eproto_status_t ext_status; |
152 | }; | 153 | }; |
153 | 154 | ||
155 | #define BFA_FCPORT(_bfa) (&((_bfa)->modules.port)) | ||
156 | |||
154 | /* | 157 | /* |
155 | * bfa pport API functions | 158 | * bfa pport API functions |
156 | */ | 159 | */ |
157 | bfa_status_t bfa_pport_enable(struct bfa_s *bfa); | 160 | bfa_status_t bfa_fcport_enable(struct bfa_s *bfa); |
158 | bfa_status_t bfa_pport_disable(struct bfa_s *bfa); | 161 | bfa_status_t bfa_fcport_disable(struct bfa_s *bfa); |
159 | bfa_status_t bfa_pport_cfg_speed(struct bfa_s *bfa, | 162 | bfa_status_t bfa_fcport_cfg_speed(struct bfa_s *bfa, |
160 | enum bfa_pport_speed speed); | 163 | enum bfa_pport_speed speed); |
161 | enum bfa_pport_speed bfa_pport_get_speed(struct bfa_s *bfa); | 164 | enum bfa_pport_speed bfa_fcport_get_speed(struct bfa_s *bfa); |
162 | bfa_status_t bfa_pport_cfg_topology(struct bfa_s *bfa, | 165 | bfa_status_t bfa_fcport_cfg_topology(struct bfa_s *bfa, |
163 | enum bfa_pport_topology topo); | 166 | enum bfa_pport_topology topo); |
164 | enum bfa_pport_topology bfa_pport_get_topology(struct bfa_s *bfa); | 167 | enum bfa_pport_topology bfa_fcport_get_topology(struct bfa_s *bfa); |
165 | bfa_status_t bfa_pport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa); | 168 | bfa_status_t bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa); |
166 | bfa_boolean_t bfa_pport_get_hardalpa(struct bfa_s *bfa, u8 *alpa); | 169 | bfa_boolean_t bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa); |
167 | u8 bfa_pport_get_myalpa(struct bfa_s *bfa); | 170 | u8 bfa_fcport_get_myalpa(struct bfa_s *bfa); |
168 | bfa_status_t bfa_pport_clr_hardalpa(struct bfa_s *bfa); | 171 | bfa_status_t bfa_fcport_clr_hardalpa(struct bfa_s *bfa); |
169 | bfa_status_t bfa_pport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxsize); | 172 | bfa_status_t bfa_fcport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxsize); |
170 | u16 bfa_pport_get_maxfrsize(struct bfa_s *bfa); | 173 | u16 bfa_fcport_get_maxfrsize(struct bfa_s *bfa); |
171 | u32 bfa_pport_mypid(struct bfa_s *bfa); | 174 | u32 bfa_fcport_mypid(struct bfa_s *bfa); |
172 | u8 bfa_pport_get_rx_bbcredit(struct bfa_s *bfa); | 175 | u8 bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa); |
173 | bfa_status_t bfa_pport_trunk_enable(struct bfa_s *bfa, u8 bitmap); | 176 | bfa_status_t bfa_fcport_trunk_enable(struct bfa_s *bfa, u8 bitmap); |
174 | bfa_status_t bfa_pport_trunk_disable(struct bfa_s *bfa); | 177 | bfa_status_t bfa_fcport_trunk_disable(struct bfa_s *bfa); |
175 | bfa_boolean_t bfa_pport_trunk_query(struct bfa_s *bfa, u32 *bitmap); | 178 | bfa_boolean_t bfa_fcport_trunk_query(struct bfa_s *bfa, u32 *bitmap); |
176 | void bfa_pport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr); | 179 | void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr); |
177 | wwn_t bfa_pport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node); | 180 | wwn_t bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node); |
178 | bfa_status_t bfa_pport_get_stats(struct bfa_s *bfa, | 181 | void bfa_fcport_event_register(struct bfa_s *bfa, |
179 | union bfa_pport_stats_u *stats, | ||
180 | bfa_cb_pport_t cbfn, void *cbarg); | ||
181 | bfa_status_t bfa_pport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, | ||
182 | void *cbarg); | ||
183 | void bfa_pport_event_register(struct bfa_s *bfa, | ||
184 | void (*event_cbfn) (void *cbarg, | 182 | void (*event_cbfn) (void *cbarg, |
185 | bfa_pport_event_t event), void *event_cbarg); | 183 | bfa_pport_event_t event), void *event_cbarg); |
186 | bfa_boolean_t bfa_pport_is_disabled(struct bfa_s *bfa); | 184 | bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa); |
187 | void bfa_pport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off); | 185 | void bfa_fcport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off); |
188 | void bfa_pport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off); | 186 | void bfa_fcport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off); |
189 | bfa_status_t bfa_pport_cfg_ratelim_speed(struct bfa_s *bfa, | 187 | bfa_status_t bfa_fcport_cfg_ratelim_speed(struct bfa_s *bfa, |
190 | enum bfa_pport_speed speed); | 188 | enum bfa_pport_speed speed); |
191 | enum bfa_pport_speed bfa_pport_get_ratelim_speed(struct bfa_s *bfa); | 189 | enum bfa_pport_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa); |
192 | 190 | ||
193 | void bfa_pport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit); | 191 | void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit); |
194 | void bfa_pport_busy(struct bfa_s *bfa, bfa_boolean_t status); | 192 | void bfa_fcport_busy(struct bfa_s *bfa, bfa_boolean_t status); |
195 | void bfa_pport_beacon(struct bfa_s *bfa, bfa_boolean_t beacon, | 193 | void bfa_fcport_beacon(struct bfa_s *bfa, bfa_boolean_t beacon, |
196 | bfa_boolean_t link_e2e_beacon); | 194 | bfa_boolean_t link_e2e_beacon); |
197 | void bfa_cb_pport_event(void *cbarg, bfa_pport_event_t event); | 195 | void bfa_cb_pport_event(void *cbarg, bfa_pport_event_t event); |
198 | void bfa_pport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr); | 196 | void bfa_fcport_qos_get_attr(struct bfa_s *bfa, |
199 | void bfa_pport_qos_get_vc_attr(struct bfa_s *bfa, | 197 | struct bfa_qos_attr_s *qos_attr); |
198 | void bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa, | ||
200 | struct bfa_qos_vc_attr_s *qos_vc_attr); | 199 | struct bfa_qos_vc_attr_s *qos_vc_attr); |
201 | bfa_status_t bfa_pport_get_qos_stats(struct bfa_s *bfa, | 200 | bfa_status_t bfa_fcport_get_qos_stats(struct bfa_s *bfa, |
202 | union bfa_pport_stats_u *stats, | 201 | union bfa_fcport_stats_u *stats, |
203 | bfa_cb_pport_t cbfn, void *cbarg); | 202 | bfa_cb_pport_t cbfn, void *cbarg); |
204 | bfa_status_t bfa_pport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, | 203 | bfa_status_t bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, |
205 | void *cbarg); | 204 | void *cbarg); |
206 | bfa_boolean_t bfa_pport_is_ratelim(struct bfa_s *bfa); | 205 | bfa_status_t bfa_fcport_get_fcoe_stats(struct bfa_s *bfa, |
207 | bfa_boolean_t bfa_pport_is_linkup(struct bfa_s *bfa); | 206 | union bfa_fcport_stats_u *stats, |
207 | bfa_cb_pport_t cbfn, void *cbarg); | ||
208 | bfa_status_t bfa_fcport_clear_fcoe_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, | ||
209 | void *cbarg); | ||
210 | |||
211 | bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa); | ||
212 | bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa); | ||
213 | bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa, | ||
214 | union bfa_fcport_stats_u *stats, | ||
215 | bfa_cb_pport_t cbfn, void *cbarg); | ||
216 | bfa_status_t bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, | ||
217 | void *cbarg); | ||
208 | 218 | ||
209 | /* | 219 | /* |
210 | * bfa rport API functions | 220 | * bfa rport API functions |
@@ -293,6 +303,7 @@ void bfa_uf_free(struct bfa_uf_s *uf); | |||
293 | * bfa lport service api | 303 | * bfa lport service api |
294 | */ | 304 | */ |
295 | 305 | ||
306 | u32 bfa_lps_get_max_vport(struct bfa_s *bfa); | ||
296 | struct bfa_lps_s *bfa_lps_alloc(struct bfa_s *bfa); | 307 | struct bfa_lps_s *bfa_lps_alloc(struct bfa_s *bfa); |
297 | void bfa_lps_delete(struct bfa_lps_s *lps); | 308 | void bfa_lps_delete(struct bfa_lps_s *lps); |
298 | void bfa_lps_discard(struct bfa_lps_s *lps); | 309 | void bfa_lps_discard(struct bfa_lps_s *lps); |
@@ -315,10 +326,12 @@ wwn_t bfa_lps_get_peer_pwwn(struct bfa_lps_s *lps); | |||
315 | wwn_t bfa_lps_get_peer_nwwn(struct bfa_lps_s *lps); | 326 | wwn_t bfa_lps_get_peer_nwwn(struct bfa_lps_s *lps); |
316 | u8 bfa_lps_get_lsrjt_rsn(struct bfa_lps_s *lps); | 327 | u8 bfa_lps_get_lsrjt_rsn(struct bfa_lps_s *lps); |
317 | u8 bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps); | 328 | u8 bfa_lps_get_lsrjt_expl(struct bfa_lps_s *lps); |
329 | mac_t bfa_lps_get_lp_mac(struct bfa_lps_s *lps); | ||
318 | void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status); | 330 | void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status); |
319 | void bfa_cb_lps_flogo_comp(void *bfad, void *uarg); | 331 | void bfa_cb_lps_flogo_comp(void *bfad, void *uarg); |
320 | void bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status); | 332 | void bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status); |
321 | void bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg); | 333 | void bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg); |
334 | void bfa_cb_lps_cvl_event(void *bfad, void *uarg); | ||
322 | 335 | ||
323 | #endif /* __BFA_SVC_H__ */ | 336 | #endif /* __BFA_SVC_H__ */ |
324 | 337 | ||
diff --git a/drivers/scsi/bfa/include/bfa_timer.h b/drivers/scsi/bfa/include/bfa_timer.h index e407103fa565..f71087448222 100644 --- a/drivers/scsi/bfa/include/bfa_timer.h +++ b/drivers/scsi/bfa/include/bfa_timer.h | |||
@@ -41,7 +41,7 @@ struct bfa_timer_mod_s { | |||
41 | struct list_head timer_q; | 41 | struct list_head timer_q; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #define BFA_TIMER_FREQ 500 /**< specified in millisecs */ | 44 | #define BFA_TIMER_FREQ 200 /**< specified in millisecs */ |
45 | 45 | ||
46 | void bfa_timer_beat(struct bfa_timer_mod_s *mod); | 46 | void bfa_timer_beat(struct bfa_timer_mod_s *mod); |
47 | void bfa_timer_init(struct bfa_timer_mod_s *mod); | 47 | void bfa_timer_init(struct bfa_timer_mod_s *mod); |
diff --git a/drivers/scsi/bfa/include/bfi/bfi.h b/drivers/scsi/bfa/include/bfi/bfi.h index 7042c18e542d..a550e80cabd2 100644 --- a/drivers/scsi/bfa/include/bfi/bfi.h +++ b/drivers/scsi/bfa/include/bfi/bfi.h | |||
@@ -143,8 +143,8 @@ enum bfi_mclass { | |||
143 | BFI_MC_IOC = 1, /* IO Controller (IOC) */ | 143 | BFI_MC_IOC = 1, /* IO Controller (IOC) */ |
144 | BFI_MC_DIAG = 2, /* Diagnostic Msgs */ | 144 | BFI_MC_DIAG = 2, /* Diagnostic Msgs */ |
145 | BFI_MC_FLASH = 3, /* Flash message class */ | 145 | BFI_MC_FLASH = 3, /* Flash message class */ |
146 | BFI_MC_CEE = 4, | 146 | BFI_MC_CEE = 4, /* CEE */ |
147 | BFI_MC_FC_PORT = 5, /* FC port */ | 147 | BFI_MC_FCPORT = 5, /* FC port */ |
148 | BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */ | 148 | BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */ |
149 | BFI_MC_LL = 7, /* Link Layer */ | 149 | BFI_MC_LL = 7, /* Link Layer */ |
150 | BFI_MC_UF = 8, /* Unsolicited frame receive */ | 150 | BFI_MC_UF = 8, /* Unsolicited frame receive */ |
diff --git a/drivers/scsi/bfa/include/bfi/bfi_cbreg.h b/drivers/scsi/bfa/include/bfi/bfi_cbreg.h index b3bb52b565b1..a51ee61ddb19 100644 --- a/drivers/scsi/bfa/include/bfi/bfi_cbreg.h +++ b/drivers/scsi/bfa/include/bfi/bfi_cbreg.h | |||
@@ -177,7 +177,21 @@ | |||
177 | #define __PSS_LMEM_INIT_EN 0x00000100 | 177 | #define __PSS_LMEM_INIT_EN 0x00000100 |
178 | #define __PSS_LPU1_RESET 0x00000002 | 178 | #define __PSS_LPU1_RESET 0x00000002 |
179 | #define __PSS_LPU0_RESET 0x00000001 | 179 | #define __PSS_LPU0_RESET 0x00000001 |
180 | 180 | #define PSS_ERR_STATUS_REG 0x00018810 | |
181 | #define __PSS_LMEM1_CORR_ERR 0x00000800 | ||
182 | #define __PSS_LMEM0_CORR_ERR 0x00000400 | ||
183 | #define __PSS_LMEM1_UNCORR_ERR 0x00000200 | ||
184 | #define __PSS_LMEM0_UNCORR_ERR 0x00000100 | ||
185 | #define __PSS_BAL_PERR 0x00000080 | ||
186 | #define __PSS_DIP_IF_ERR 0x00000040 | ||
187 | #define __PSS_IOH_IF_ERR 0x00000020 | ||
188 | #define __PSS_TDS_IF_ERR 0x00000010 | ||
189 | #define __PSS_RDS_IF_ERR 0x00000008 | ||
190 | #define __PSS_SGM_IF_ERR 0x00000004 | ||
191 | #define __PSS_LPU1_RAM_ERR 0x00000002 | ||
192 | #define __PSS_LPU0_RAM_ERR 0x00000001 | ||
193 | #define ERR_SET_REG 0x00018818 | ||
194 | #define __PSS_ERR_STATUS_SET 0x00000fff | ||
181 | 195 | ||
182 | /* | 196 | /* |
183 | * These definitions are either in error/missing in spec. Its auto-generated | 197 | * These definitions are either in error/missing in spec. Its auto-generated |
diff --git a/drivers/scsi/bfa/include/bfi/bfi_ctreg.h b/drivers/scsi/bfa/include/bfi/bfi_ctreg.h index d3caa58c0a0a..57a8497105af 100644 --- a/drivers/scsi/bfa/include/bfi/bfi_ctreg.h +++ b/drivers/scsi/bfa/include/bfi/bfi_ctreg.h | |||
@@ -430,6 +430,31 @@ enum { | |||
430 | #define __PSS_LMEM_INIT_EN 0x00000100 | 430 | #define __PSS_LMEM_INIT_EN 0x00000100 |
431 | #define __PSS_LPU1_RESET 0x00000002 | 431 | #define __PSS_LPU1_RESET 0x00000002 |
432 | #define __PSS_LPU0_RESET 0x00000001 | 432 | #define __PSS_LPU0_RESET 0x00000001 |
433 | #define PSS_ERR_STATUS_REG 0x00018810 | ||
434 | #define __PSS_LPU1_TCM_READ_ERR 0x00200000 | ||
435 | #define __PSS_LPU0_TCM_READ_ERR 0x00100000 | ||
436 | #define __PSS_LMEM5_CORR_ERR 0x00080000 | ||
437 | #define __PSS_LMEM4_CORR_ERR 0x00040000 | ||
438 | #define __PSS_LMEM3_CORR_ERR 0x00020000 | ||
439 | #define __PSS_LMEM2_CORR_ERR 0x00010000 | ||
440 | #define __PSS_LMEM1_CORR_ERR 0x00008000 | ||
441 | #define __PSS_LMEM0_CORR_ERR 0x00004000 | ||
442 | #define __PSS_LMEM5_UNCORR_ERR 0x00002000 | ||
443 | #define __PSS_LMEM4_UNCORR_ERR 0x00001000 | ||
444 | #define __PSS_LMEM3_UNCORR_ERR 0x00000800 | ||
445 | #define __PSS_LMEM2_UNCORR_ERR 0x00000400 | ||
446 | #define __PSS_LMEM1_UNCORR_ERR 0x00000200 | ||
447 | #define __PSS_LMEM0_UNCORR_ERR 0x00000100 | ||
448 | #define __PSS_BAL_PERR 0x00000080 | ||
449 | #define __PSS_DIP_IF_ERR 0x00000040 | ||
450 | #define __PSS_IOH_IF_ERR 0x00000020 | ||
451 | #define __PSS_TDS_IF_ERR 0x00000010 | ||
452 | #define __PSS_RDS_IF_ERR 0x00000008 | ||
453 | #define __PSS_SGM_IF_ERR 0x00000004 | ||
454 | #define __PSS_LPU1_RAM_ERR 0x00000002 | ||
455 | #define __PSS_LPU0_RAM_ERR 0x00000001 | ||
456 | #define ERR_SET_REG 0x00018818 | ||
457 | #define __PSS_ERR_STATUS_SET 0x003fffff | ||
433 | #define HQM_QSET0_RXQ_DRBL_P0 0x00038000 | 458 | #define HQM_QSET0_RXQ_DRBL_P0 0x00038000 |
434 | #define __RXQ0_ADD_VECTORS_P 0x80000000 | 459 | #define __RXQ0_ADD_VECTORS_P 0x80000000 |
435 | #define __RXQ0_STOP_P 0x40000000 | 460 | #define __RXQ0_STOP_P 0x40000000 |
@@ -589,6 +614,7 @@ enum { | |||
589 | #define __HFN_INT_MBOX_LPU1 0x00200000U | 614 | #define __HFN_INT_MBOX_LPU1 0x00200000U |
590 | #define __HFN_INT_MBOX1_LPU0 0x00400000U | 615 | #define __HFN_INT_MBOX1_LPU0 0x00400000U |
591 | #define __HFN_INT_MBOX1_LPU1 0x00800000U | 616 | #define __HFN_INT_MBOX1_LPU1 0x00800000U |
617 | #define __HFN_INT_LL_HALT 0x01000000U | ||
592 | #define __HFN_INT_CPE_MASK 0x000000ffU | 618 | #define __HFN_INT_CPE_MASK 0x000000ffU |
593 | #define __HFN_INT_RME_MASK 0x0000ff00U | 619 | #define __HFN_INT_RME_MASK 0x0000ff00U |
594 | 620 | ||
diff --git a/drivers/scsi/bfa/include/bfi/bfi_ioc.h b/drivers/scsi/bfa/include/bfi/bfi_ioc.h index 96ef05670659..a0158aac0024 100644 --- a/drivers/scsi/bfa/include/bfi/bfi_ioc.h +++ b/drivers/scsi/bfa/include/bfi/bfi_ioc.h | |||
@@ -123,7 +123,7 @@ enum bfi_ioc_state { | |||
123 | BFI_IOC_DISABLING = 5, /* IOC is being disabled */ | 123 | BFI_IOC_DISABLING = 5, /* IOC is being disabled */ |
124 | BFI_IOC_DISABLED = 6, /* IOC is disabled */ | 124 | BFI_IOC_DISABLED = 6, /* IOC is disabled */ |
125 | BFI_IOC_CFG_DISABLED = 7, /* IOC is being disabled;transient */ | 125 | BFI_IOC_CFG_DISABLED = 7, /* IOC is being disabled;transient */ |
126 | BFI_IOC_HBFAIL = 8, /* IOC heart-beat failure */ | 126 | BFI_IOC_FAIL = 8, /* IOC heart-beat failure */ |
127 | BFI_IOC_MEMTEST = 9, /* IOC is doing memtest */ | 127 | BFI_IOC_MEMTEST = 9, /* IOC is doing memtest */ |
128 | }; | 128 | }; |
129 | 129 | ||
diff --git a/drivers/scsi/bfa/include/bfi/bfi_lps.h b/drivers/scsi/bfa/include/bfi/bfi_lps.h index c59d47badb4b..7ed31bbb8696 100644 --- a/drivers/scsi/bfa/include/bfi/bfi_lps.h +++ b/drivers/scsi/bfa/include/bfi/bfi_lps.h | |||
@@ -30,6 +30,7 @@ enum bfi_lps_h2i_msgs { | |||
30 | enum bfi_lps_i2h_msgs { | 30 | enum bfi_lps_i2h_msgs { |
31 | BFI_LPS_H2I_LOGIN_RSP = BFA_I2HM(1), | 31 | BFI_LPS_H2I_LOGIN_RSP = BFA_I2HM(1), |
32 | BFI_LPS_H2I_LOGOUT_RSP = BFA_I2HM(2), | 32 | BFI_LPS_H2I_LOGOUT_RSP = BFA_I2HM(2), |
33 | BFI_LPS_H2I_CVL_EVENT = BFA_I2HM(3), | ||
33 | }; | 34 | }; |
34 | 35 | ||
35 | struct bfi_lps_login_req_s { | 36 | struct bfi_lps_login_req_s { |
@@ -77,6 +78,12 @@ struct bfi_lps_logout_rsp_s { | |||
77 | u8 rsvd[2]; | 78 | u8 rsvd[2]; |
78 | }; | 79 | }; |
79 | 80 | ||
81 | struct bfi_lps_cvl_event_s { | ||
82 | struct bfi_mhdr_s mh; /* common msg header */ | ||
83 | u8 lp_tag; | ||
84 | u8 rsvd[3]; | ||
85 | }; | ||
86 | |||
80 | union bfi_lps_h2i_msg_u { | 87 | union bfi_lps_h2i_msg_u { |
81 | struct bfi_mhdr_s *msg; | 88 | struct bfi_mhdr_s *msg; |
82 | struct bfi_lps_login_req_s *login_req; | 89 | struct bfi_lps_login_req_s *login_req; |
@@ -87,6 +94,7 @@ union bfi_lps_i2h_msg_u { | |||
87 | struct bfi_msg_s *msg; | 94 | struct bfi_msg_s *msg; |
88 | struct bfi_lps_login_rsp_s *login_rsp; | 95 | struct bfi_lps_login_rsp_s *login_rsp; |
89 | struct bfi_lps_logout_rsp_s *logout_rsp; | 96 | struct bfi_lps_logout_rsp_s *logout_rsp; |
97 | struct bfi_lps_cvl_event_s *cvl_event; | ||
90 | }; | 98 | }; |
91 | 99 | ||
92 | #pragma pack() | 100 | #pragma pack() |
diff --git a/drivers/scsi/bfa/include/bfi/bfi_pport.h b/drivers/scsi/bfa/include/bfi/bfi_pport.h index c96d246851af..50dcf45c7470 100644 --- a/drivers/scsi/bfa/include/bfi/bfi_pport.h +++ b/drivers/scsi/bfa/include/bfi/bfi_pport.h | |||
@@ -22,163 +22,97 @@ | |||
22 | 22 | ||
23 | #pragma pack(1) | 23 | #pragma pack(1) |
24 | 24 | ||
25 | enum bfi_pport_h2i { | 25 | enum bfi_fcport_h2i { |
26 | BFI_PPORT_H2I_ENABLE_REQ = (1), | 26 | BFI_FCPORT_H2I_ENABLE_REQ = (1), |
27 | BFI_PPORT_H2I_DISABLE_REQ = (2), | 27 | BFI_FCPORT_H2I_DISABLE_REQ = (2), |
28 | BFI_PPORT_H2I_GET_STATS_REQ = (3), | 28 | BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ = (3), |
29 | BFI_PPORT_H2I_CLEAR_STATS_REQ = (4), | 29 | BFI_FCPORT_H2I_STATS_GET_REQ = (4), |
30 | BFI_PPORT_H2I_SET_SVC_PARAMS_REQ = (5), | 30 | BFI_FCPORT_H2I_STATS_CLEAR_REQ = (5), |
31 | BFI_PPORT_H2I_ENABLE_RX_VF_TAG_REQ = (6), | ||
32 | BFI_PPORT_H2I_ENABLE_TX_VF_TAG_REQ = (7), | ||
33 | BFI_PPORT_H2I_GET_QOS_STATS_REQ = (8), | ||
34 | BFI_PPORT_H2I_CLEAR_QOS_STATS_REQ = (9), | ||
35 | }; | 31 | }; |
36 | 32 | ||
37 | enum bfi_pport_i2h { | 33 | enum bfi_fcport_i2h { |
38 | BFI_PPORT_I2H_ENABLE_RSP = BFA_I2HM(1), | 34 | BFI_FCPORT_I2H_ENABLE_RSP = BFA_I2HM(1), |
39 | BFI_PPORT_I2H_DISABLE_RSP = BFA_I2HM(2), | 35 | BFI_FCPORT_I2H_DISABLE_RSP = BFA_I2HM(2), |
40 | BFI_PPORT_I2H_GET_STATS_RSP = BFA_I2HM(3), | 36 | BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(3), |
41 | BFI_PPORT_I2H_CLEAR_STATS_RSP = BFA_I2HM(4), | 37 | BFI_FCPORT_I2H_STATS_GET_RSP = BFA_I2HM(4), |
42 | BFI_PPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(5), | 38 | BFI_FCPORT_I2H_STATS_CLEAR_RSP = BFA_I2HM(5), |
43 | BFI_PPORT_I2H_ENABLE_RX_VF_TAG_RSP = BFA_I2HM(6), | 39 | BFI_FCPORT_I2H_EVENT = BFA_I2HM(6), |
44 | BFI_PPORT_I2H_ENABLE_TX_VF_TAG_RSP = BFA_I2HM(7), | ||
45 | BFI_PPORT_I2H_EVENT = BFA_I2HM(8), | ||
46 | BFI_PPORT_I2H_GET_QOS_STATS_RSP = BFA_I2HM(9), | ||
47 | BFI_PPORT_I2H_CLEAR_QOS_STATS_RSP = BFA_I2HM(10), | ||
48 | }; | 40 | }; |
49 | 41 | ||
50 | /** | 42 | /** |
51 | * Generic REQ type | 43 | * Generic REQ type |
52 | */ | 44 | */ |
53 | struct bfi_pport_generic_req_s { | 45 | struct bfi_fcport_req_s { |
54 | struct bfi_mhdr_s mh; /* msg header */ | 46 | struct bfi_mhdr_s mh; /* msg header */ |
55 | u32 msgtag; /* msgtag for reply */ | 47 | u32 msgtag; /* msgtag for reply */ |
56 | }; | 48 | }; |
57 | 49 | ||
58 | /** | 50 | /** |
59 | * Generic RSP type | 51 | * Generic RSP type |
60 | */ | 52 | */ |
61 | struct bfi_pport_generic_rsp_s { | 53 | struct bfi_fcport_rsp_s { |
62 | struct bfi_mhdr_s mh; /* common msg header */ | 54 | struct bfi_mhdr_s mh; /* common msg header */ |
63 | u8 status; /* port enable status */ | 55 | u8 status; /* port enable status */ |
64 | u8 rsvd[3]; | 56 | u8 rsvd[3]; |
65 | u32 msgtag; /* msgtag for reply */ | 57 | u32 msgtag; /* msgtag for reply */ |
66 | }; | 58 | }; |
67 | 59 | ||
68 | /** | 60 | /** |
69 | * BFI_PPORT_H2I_ENABLE_REQ | 61 | * BFI_FCPORT_H2I_ENABLE_REQ |
70 | */ | 62 | */ |
71 | struct bfi_pport_enable_req_s { | 63 | struct bfi_fcport_enable_req_s { |
72 | struct bfi_mhdr_s mh; /* msg header */ | 64 | struct bfi_mhdr_s mh; /* msg header */ |
73 | u32 rsvd1; | 65 | u32 rsvd1; |
74 | wwn_t nwwn; /* node wwn of physical port */ | 66 | wwn_t nwwn; /* node wwn of physical port */ |
75 | wwn_t pwwn; /* port wwn of physical port */ | 67 | wwn_t pwwn; /* port wwn of physical port */ |
76 | struct bfa_pport_cfg_s port_cfg; /* port configuration */ | 68 | struct bfa_pport_cfg_s port_cfg; /* port configuration */ |
77 | union bfi_addr_u stats_dma_addr; /* DMA address for stats */ | 69 | union bfi_addr_u stats_dma_addr; /* DMA address for stats */ |
78 | u32 msgtag; /* msgtag for reply */ | 70 | u32 msgtag; /* msgtag for reply */ |
79 | u32 rsvd2; | 71 | u32 rsvd2; |
80 | }; | 72 | }; |
81 | 73 | ||
82 | /** | 74 | /** |
83 | * BFI_PPORT_I2H_ENABLE_RSP | 75 | * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ |
84 | */ | 76 | */ |
85 | #define bfi_pport_enable_rsp_t struct bfi_pport_generic_rsp_s | 77 | struct bfi_fcport_set_svc_params_req_s { |
86 | |||
87 | /** | ||
88 | * BFI_PPORT_H2I_DISABLE_REQ | ||
89 | */ | ||
90 | #define bfi_pport_disable_req_t struct bfi_pport_generic_req_s | ||
91 | |||
92 | /** | ||
93 | * BFI_PPORT_I2H_DISABLE_RSP | ||
94 | */ | ||
95 | #define bfi_pport_disable_rsp_t struct bfi_pport_generic_rsp_s | ||
96 | |||
97 | /** | ||
98 | * BFI_PPORT_H2I_GET_STATS_REQ | ||
99 | */ | ||
100 | #define bfi_pport_get_stats_req_t struct bfi_pport_generic_req_s | ||
101 | |||
102 | /** | ||
103 | * BFI_PPORT_I2H_GET_STATS_RSP | ||
104 | */ | ||
105 | #define bfi_pport_get_stats_rsp_t struct bfi_pport_generic_rsp_s | ||
106 | |||
107 | /** | ||
108 | * BFI_PPORT_H2I_CLEAR_STATS_REQ | ||
109 | */ | ||
110 | #define bfi_pport_clear_stats_req_t struct bfi_pport_generic_req_s | ||
111 | |||
112 | /** | ||
113 | * BFI_PPORT_I2H_CLEAR_STATS_RSP | ||
114 | */ | ||
115 | #define bfi_pport_clear_stats_rsp_t struct bfi_pport_generic_rsp_s | ||
116 | |||
117 | /** | ||
118 | * BFI_PPORT_H2I_GET_QOS_STATS_REQ | ||
119 | */ | ||
120 | #define bfi_pport_get_qos_stats_req_t struct bfi_pport_generic_req_s | ||
121 | |||
122 | /** | ||
123 | * BFI_PPORT_H2I_GET_QOS_STATS_RSP | ||
124 | */ | ||
125 | #define bfi_pport_get_qos_stats_rsp_t struct bfi_pport_generic_rsp_s | ||
126 | |||
127 | /** | ||
128 | * BFI_PPORT_H2I_CLEAR_QOS_STATS_REQ | ||
129 | */ | ||
130 | #define bfi_pport_clear_qos_stats_req_t struct bfi_pport_generic_req_s | ||
131 | |||
132 | /** | ||
133 | * BFI_PPORT_H2I_CLEAR_QOS_STATS_RSP | ||
134 | */ | ||
135 | #define bfi_pport_clear_qos_stats_rsp_t struct bfi_pport_generic_rsp_s | ||
136 | |||
137 | /** | ||
138 | * BFI_PPORT_H2I_SET_SVC_PARAMS_REQ | ||
139 | */ | ||
140 | struct bfi_pport_set_svc_params_req_s { | ||
141 | struct bfi_mhdr_s mh; /* msg header */ | 78 | struct bfi_mhdr_s mh; /* msg header */ |
142 | u16 tx_bbcredit; /* Tx credits */ | 79 | u16 tx_bbcredit; /* Tx credits */ |
143 | u16 rsvd; | 80 | u16 rsvd; |
144 | }; | 81 | }; |
145 | 82 | ||
146 | /** | 83 | /** |
147 | * BFI_PPORT_I2H_SET_SVC_PARAMS_RSP | 84 | * BFI_FCPORT_I2H_EVENT |
148 | */ | ||
149 | |||
150 | /** | ||
151 | * BFI_PPORT_I2H_EVENT | ||
152 | */ | 85 | */ |
153 | struct bfi_pport_event_s { | 86 | struct bfi_fcport_event_s { |
154 | struct bfi_mhdr_s mh; /* common msg header */ | 87 | struct bfi_mhdr_s mh; /* common msg header */ |
155 | struct bfa_pport_link_s link_state; | 88 | struct bfa_pport_link_s link_state; |
156 | }; | 89 | }; |
157 | 90 | ||
158 | union bfi_pport_h2i_msg_u { | 91 | /** |
92 | * fcport H2I message | ||
93 | */ | ||
94 | union bfi_fcport_h2i_msg_u { | ||
159 | struct bfi_mhdr_s *mhdr; | 95 | struct bfi_mhdr_s *mhdr; |
160 | struct bfi_pport_enable_req_s *penable; | 96 | struct bfi_fcport_enable_req_s *penable; |
161 | struct bfi_pport_generic_req_s *pdisable; | 97 | struct bfi_fcport_req_s *pdisable; |
162 | struct bfi_pport_generic_req_s *pgetstats; | 98 | struct bfi_fcport_set_svc_params_req_s *psetsvcparams; |
163 | struct bfi_pport_generic_req_s *pclearstats; | 99 | struct bfi_fcport_req_s *pstatsget; |
164 | struct bfi_pport_set_svc_params_req_s *psetsvcparams; | 100 | struct bfi_fcport_req_s *pstatsclear; |
165 | struct bfi_pport_get_qos_stats_req_s *pgetqosstats; | ||
166 | struct bfi_pport_generic_req_s *pclearqosstats; | ||
167 | }; | 101 | }; |
168 | 102 | ||
169 | union bfi_pport_i2h_msg_u { | 103 | /** |
104 | * fcport I2H message | ||
105 | */ | ||
106 | union bfi_fcport_i2h_msg_u { | ||
170 | struct bfi_msg_s *msg; | 107 | struct bfi_msg_s *msg; |
171 | struct bfi_pport_generic_rsp_s *enable_rsp; | 108 | struct bfi_fcport_rsp_s *penable_rsp; |
172 | struct bfi_pport_disable_rsp_s *disable_rsp; | 109 | struct bfi_fcport_rsp_s *pdisable_rsp; |
173 | struct bfi_pport_generic_rsp_s *getstats_rsp; | 110 | struct bfi_fcport_rsp_s *psetsvcparams_rsp; |
174 | struct bfi_pport_clear_stats_rsp_s *clearstats_rsp; | 111 | struct bfi_fcport_rsp_s *pstatsget_rsp; |
175 | struct bfi_pport_set_svc_params_rsp_s *setsvcparasm_rsp; | 112 | struct bfi_fcport_rsp_s *pstatsclear_rsp; |
176 | struct bfi_pport_get_qos_stats_rsp_s *getqosstats_rsp; | 113 | struct bfi_fcport_event_s *event; |
177 | struct bfi_pport_clear_qos_stats_rsp_s *clearqosstats_rsp; | ||
178 | struct bfi_pport_event_s *event; | ||
179 | }; | 114 | }; |
180 | 115 | ||
181 | #pragma pack() | 116 | #pragma pack() |
182 | 117 | ||
183 | #endif /* __BFI_PPORT_H__ */ | 118 | #endif /* __BFI_PPORT_H__ */ |
184 | |||
diff --git a/drivers/scsi/bfa/include/cna/bfa_cna_trcmod.h b/drivers/scsi/bfa/include/cna/bfa_cna_trcmod.h index 43ba7064e81a..a75a1f3be315 100644 --- a/drivers/scsi/bfa/include/cna/bfa_cna_trcmod.h +++ b/drivers/scsi/bfa/include/cna/bfa_cna_trcmod.h | |||
@@ -31,6 +31,10 @@ | |||
31 | enum { | 31 | enum { |
32 | BFA_TRC_CNA_CEE = 1, | 32 | BFA_TRC_CNA_CEE = 1, |
33 | BFA_TRC_CNA_PORT = 2, | 33 | BFA_TRC_CNA_PORT = 2, |
34 | BFA_TRC_CNA_IOC = 3, | ||
35 | BFA_TRC_CNA_DIAG = 4, | ||
36 | BFA_TRC_CNA_IOC_CB = 5, | ||
37 | BFA_TRC_CNA_IOC_CT = 6, | ||
34 | }; | 38 | }; |
35 | 39 | ||
36 | #endif /* __BFA_CNA_TRCMOD_H__ */ | 40 | #endif /* __BFA_CNA_TRCMOD_H__ */ |
diff --git a/drivers/scsi/bfa/include/cs/bfa_log.h b/drivers/scsi/bfa/include/cs/bfa_log.h index 761cbe22130a..bc334e0a93fa 100644 --- a/drivers/scsi/bfa/include/cs/bfa_log.h +++ b/drivers/scsi/bfa/include/cs/bfa_log.h | |||
@@ -157,7 +157,7 @@ typedef void (*bfa_log_cb_t)(struct bfa_log_mod_s *log_mod, u32 msg_id, | |||
157 | 157 | ||
158 | 158 | ||
159 | struct bfa_log_mod_s { | 159 | struct bfa_log_mod_s { |
160 | char instance_info[16]; /* instance info */ | 160 | char instance_info[BFA_STRING_32]; /* instance info */ |
161 | int log_level[BFA_LOG_MODULE_ID_MAX + 1]; | 161 | int log_level[BFA_LOG_MODULE_ID_MAX + 1]; |
162 | /* log level for modules */ | 162 | /* log level for modules */ |
163 | bfa_log_cb_t cbfn; /* callback function */ | 163 | bfa_log_cb_t cbfn; /* callback function */ |
diff --git a/drivers/scsi/bfa/include/cs/bfa_plog.h b/drivers/scsi/bfa/include/cs/bfa_plog.h index 670f86e5fc6e..f5bef63b5877 100644 --- a/drivers/scsi/bfa/include/cs/bfa_plog.h +++ b/drivers/scsi/bfa/include/cs/bfa_plog.h | |||
@@ -80,7 +80,8 @@ enum bfa_plog_mid { | |||
80 | BFA_PL_MID_HAL_FCXP = 4, | 80 | BFA_PL_MID_HAL_FCXP = 4, |
81 | BFA_PL_MID_HAL_UF = 5, | 81 | BFA_PL_MID_HAL_UF = 5, |
82 | BFA_PL_MID_FCS = 6, | 82 | BFA_PL_MID_FCS = 6, |
83 | BFA_PL_MID_MAX = 7 | 83 | BFA_PL_MID_LPS = 7, |
84 | BFA_PL_MID_MAX = 8 | ||
84 | }; | 85 | }; |
85 | 86 | ||
86 | #define BFA_PL_MID_STRLEN 8 | 87 | #define BFA_PL_MID_STRLEN 8 |
@@ -118,7 +119,11 @@ enum bfa_plog_eid { | |||
118 | BFA_PL_EID_RSCN = 17, | 119 | BFA_PL_EID_RSCN = 17, |
119 | BFA_PL_EID_DEBUG = 18, | 120 | BFA_PL_EID_DEBUG = 18, |
120 | BFA_PL_EID_MISC = 19, | 121 | BFA_PL_EID_MISC = 19, |
121 | BFA_PL_EID_MAX = 20 | 122 | BFA_PL_EID_FIP_FCF_DISC = 20, |
123 | BFA_PL_EID_FIP_FCF_CVL = 21, | ||
124 | BFA_PL_EID_LOGIN = 22, | ||
125 | BFA_PL_EID_LOGO = 23, | ||
126 | BFA_PL_EID_MAX = 24 | ||
122 | }; | 127 | }; |
123 | 128 | ||
124 | #define BFA_PL_ENAME_STRLEN 8 | 129 | #define BFA_PL_ENAME_STRLEN 8 |
diff --git a/drivers/scsi/bfa/include/cs/bfa_sm.h b/drivers/scsi/bfa/include/cs/bfa_sm.h index b0a92baf6657..11fba9082f05 100644 --- a/drivers/scsi/bfa/include/cs/bfa_sm.h +++ b/drivers/scsi/bfa/include/cs/bfa_sm.h | |||
@@ -23,6 +23,14 @@ | |||
23 | #define __BFA_SM_H__ | 23 | #define __BFA_SM_H__ |
24 | 24 | ||
25 | typedef void (*bfa_sm_t)(void *sm, int event); | 25 | typedef void (*bfa_sm_t)(void *sm, int event); |
26 | /** | ||
27 | * oc - object class eg. bfa_ioc | ||
28 | * st - state, eg. reset | ||
29 | * otype - object type, eg. struct bfa_ioc_s | ||
30 | * etype - object type, eg. enum ioc_event | ||
31 | */ | ||
32 | #define bfa_sm_state_decl(oc, st, otype, etype) \ | ||
33 | static void oc ## _sm_ ## st(otype * fsm, etype event) | ||
26 | 34 | ||
27 | #define bfa_sm_set_state(_sm, _state) ((_sm)->sm = (bfa_sm_t)(_state)) | 35 | #define bfa_sm_set_state(_sm, _state) ((_sm)->sm = (bfa_sm_t)(_state)) |
28 | #define bfa_sm_send_event(_sm, _event) ((_sm)->sm((_sm), (_event))) | 36 | #define bfa_sm_send_event(_sm, _event) ((_sm)->sm((_sm), (_event))) |
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_aen.h b/drivers/scsi/bfa/include/defs/bfa_defs_aen.h index 4c81a613db3d..35244698fcdc 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_aen.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_aen.h | |||
@@ -30,6 +30,16 @@ | |||
30 | #include <defs/bfa_defs_audit.h> | 30 | #include <defs/bfa_defs_audit.h> |
31 | #include <defs/bfa_defs_ethport.h> | 31 | #include <defs/bfa_defs_ethport.h> |
32 | 32 | ||
33 | #define BFA_AEN_MAX_APP 5 | ||
34 | |||
35 | enum bfa_aen_app { | ||
36 | bfa_aen_app_bcu = 0, /* No thread for bcu */ | ||
37 | bfa_aen_app_hcm = 1, | ||
38 | bfa_aen_app_cim = 2, | ||
39 | bfa_aen_app_snia = 3, | ||
40 | bfa_aen_app_test = 4, /* To be removed after unit test */ | ||
41 | }; | ||
42 | |||
33 | enum bfa_aen_category { | 43 | enum bfa_aen_category { |
34 | BFA_AEN_CAT_ADAPTER = 1, | 44 | BFA_AEN_CAT_ADAPTER = 1, |
35 | BFA_AEN_CAT_PORT = 2, | 45 | BFA_AEN_CAT_PORT = 2, |
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_auth.h b/drivers/scsi/bfa/include/defs/bfa_defs_auth.h index dd19c83aba58..45df32820911 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_auth.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_auth.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define PRIVATE_KEY 19009 | 23 | #define PRIVATE_KEY 19009 |
24 | #define KEY_LEN 32399 | 24 | #define KEY_LEN 32399 |
25 | #define BFA_AUTH_SECRET_STRING_LEN 256 | 25 | #define BFA_AUTH_SECRET_STRING_LEN 256 |
26 | #define BFA_AUTH_FAIL_NO_PASSWORD 0xFE | ||
26 | #define BFA_AUTH_FAIL_TIMEOUT 0xFF | 27 | #define BFA_AUTH_FAIL_TIMEOUT 0xFF |
27 | 28 | ||
28 | /** | 29 | /** |
@@ -41,6 +42,27 @@ enum bfa_auth_status { | |||
41 | BFA_AUTH_STATUS_UNKNOWN = 9, /* authentication status unknown */ | 42 | BFA_AUTH_STATUS_UNKNOWN = 9, /* authentication status unknown */ |
42 | }; | 43 | }; |
43 | 44 | ||
45 | enum bfa_auth_rej_code { | ||
46 | BFA_AUTH_RJT_CODE_AUTH_FAILURE = 1, /* auth failure */ | ||
47 | BFA_AUTH_RJT_CODE_LOGICAL_ERR = 2, /* logical error */ | ||
48 | }; | ||
49 | |||
50 | /** | ||
51 | * Authentication reject codes | ||
52 | */ | ||
53 | enum bfa_auth_rej_code_exp { | ||
54 | BFA_AUTH_MECH_NOT_USABLE = 1, /* auth. mechanism not usable */ | ||
55 | BFA_AUTH_DH_GROUP_NOT_USABLE = 2, /* DH Group not usable */ | ||
56 | BFA_AUTH_HASH_FUNC_NOT_USABLE = 3, /* hash Function not usable */ | ||
57 | BFA_AUTH_AUTH_XACT_STARTED = 4, /* auth xact started */ | ||
58 | BFA_AUTH_AUTH_FAILED = 5, /* auth failed */ | ||
59 | BFA_AUTH_INCORRECT_PLD = 6, /* incorrect payload */ | ||
60 | BFA_AUTH_INCORRECT_PROTO_MSG = 7, /* incorrect proto msg */ | ||
61 | BFA_AUTH_RESTART_AUTH_PROTO = 8, /* restart auth protocol */ | ||
62 | BFA_AUTH_AUTH_CONCAT_NOT_SUPP = 9, /* auth concat not supported */ | ||
63 | BFA_AUTH_PROTO_VER_NOT_SUPP = 10,/* proto version not supported */ | ||
64 | }; | ||
65 | |||
44 | struct auth_proto_stats_s { | 66 | struct auth_proto_stats_s { |
45 | u32 auth_rjts; | 67 | u32 auth_rjts; |
46 | u32 auth_negs; | 68 | u32 auth_negs; |
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_cee.h b/drivers/scsi/bfa/include/defs/bfa_defs_cee.h index 6217eec8c604..6eaf519eccdc 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_cee.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_cee.h | |||
@@ -28,10 +28,6 @@ | |||
28 | 28 | ||
29 | #define BFA_CEE_LLDP_MAX_STRING_LEN (128) | 29 | #define BFA_CEE_LLDP_MAX_STRING_LEN (128) |
30 | 30 | ||
31 | |||
32 | /* FIXME: this is coming from the protocol spec. Can the host & apps share the | ||
33 | protocol .h files ? | ||
34 | */ | ||
35 | #define BFA_CEE_LLDP_SYS_CAP_OTHER 0x0001 | 31 | #define BFA_CEE_LLDP_SYS_CAP_OTHER 0x0001 |
36 | #define BFA_CEE_LLDP_SYS_CAP_REPEATER 0x0002 | 32 | #define BFA_CEE_LLDP_SYS_CAP_REPEATER 0x0002 |
37 | #define BFA_CEE_LLDP_SYS_CAP_MAC_BRIDGE 0x0004 | 33 | #define BFA_CEE_LLDP_SYS_CAP_MAC_BRIDGE 0x0004 |
@@ -94,9 +90,10 @@ struct bfa_cee_dcbx_cfg_s { | |||
94 | /* CEE status */ | 90 | /* CEE status */ |
95 | /* Making this to tri-state for the benefit of port list command */ | 91 | /* Making this to tri-state for the benefit of port list command */ |
96 | enum bfa_cee_status_e { | 92 | enum bfa_cee_status_e { |
97 | CEE_PHY_DOWN = 0, | 93 | CEE_UP = 0, |
98 | CEE_PHY_UP = 1, | 94 | CEE_PHY_UP = 1, |
99 | CEE_UP = 2, | 95 | CEE_LOOPBACK = 2, |
96 | CEE_PHY_DOWN = 3, | ||
100 | }; | 97 | }; |
101 | 98 | ||
102 | /* CEE Query */ | 99 | /* CEE Query */ |
@@ -107,7 +104,8 @@ struct bfa_cee_attr_s { | |||
107 | struct bfa_cee_dcbx_cfg_s dcbx_remote; | 104 | struct bfa_cee_dcbx_cfg_s dcbx_remote; |
108 | mac_t src_mac; | 105 | mac_t src_mac; |
109 | u8 link_speed; | 106 | u8 link_speed; |
110 | u8 filler[3]; | 107 | u8 nw_priority; |
108 | u8 filler[2]; | ||
111 | }; | 109 | }; |
112 | 110 | ||
113 | 111 | ||
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_driver.h b/drivers/scsi/bfa/include/defs/bfa_defs_driver.h index 57049805762b..50382dd2ab41 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_driver.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_driver.h | |||
@@ -21,6 +21,7 @@ | |||
21 | /** | 21 | /** |
22 | * Driver statistics | 22 | * Driver statistics |
23 | */ | 23 | */ |
24 | struct bfa_driver_stats_s { | ||
24 | u16 tm_io_abort; | 25 | u16 tm_io_abort; |
25 | u16 tm_io_abort_comp; | 26 | u16 tm_io_abort_comp; |
26 | u16 tm_lun_reset; | 27 | u16 tm_lun_reset; |
@@ -34,7 +35,7 @@ | |||
34 | u64 output_req; | 35 | u64 output_req; |
35 | u64 input_words; | 36 | u64 input_words; |
36 | u64 output_words; | 37 | u64 output_words; |
37 | } bfa_driver_stats_t; | 38 | }; |
38 | 39 | ||
39 | 40 | ||
40 | #endif /* __BFA_DEFS_DRIVER_H__ */ | 41 | #endif /* __BFA_DEFS_DRIVER_H__ */ |
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_ethport.h b/drivers/scsi/bfa/include/defs/bfa_defs_ethport.h index 79f9b3e146f7..b4fa0923aa89 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_ethport.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_ethport.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #define __BFA_DEFS_ETHPORT_H__ | 19 | #define __BFA_DEFS_ETHPORT_H__ |
20 | 20 | ||
21 | #include <defs/bfa_defs_status.h> | 21 | #include <defs/bfa_defs_status.h> |
22 | #include <defs/bfa_defs_port.h> | ||
22 | #include <protocol/types.h> | 23 | #include <protocol/types.h> |
23 | #include <cna/pstats/phyport_defs.h> | 24 | #include <cna/pstats/phyport_defs.h> |
24 | #include <cna/pstats/ethport_defs.h> | 25 | #include <cna/pstats/ethport_defs.h> |
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_fcport.h b/drivers/scsi/bfa/include/defs/bfa_defs_fcport.h new file mode 100644 index 000000000000..a07ef4a3cd78 --- /dev/null +++ b/drivers/scsi/bfa/include/defs/bfa_defs_fcport.h | |||
@@ -0,0 +1,94 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2009 Brocade Communications Systems, Inc. | ||
3 | * All rights reserved | ||
4 | * www.brocade.com | ||
5 | * | ||
6 | * bfa_defs_fcport.h | ||
7 | * | ||
8 | * Linux driver for Brocade Fibre Channel Host Bus Adapter. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License (GPL) Version 2 as | ||
12 | * published by the Free Software Foundation | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, but | ||
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
17 | * General Public License for more details. | ||
18 | */ | ||
19 | #ifndef __BFA_DEFS_FCPORT_H__ | ||
20 | #define __BFA_DEFS_FCPORT_H__ | ||
21 | |||
22 | #include <defs/bfa_defs_types.h> | ||
23 | #include <protocol/types.h> | ||
24 | |||
25 | #pragma pack(1) | ||
26 | |||
27 | /** | ||
28 | * FCoE statistics | ||
29 | */ | ||
30 | struct bfa_fcoe_stats_s { | ||
31 | u64 secs_reset; /* Seconds since stats reset */ | ||
32 | u64 cee_linkups; /* CEE link up */ | ||
33 | u64 cee_linkdns; /* CEE link down */ | ||
34 | u64 fip_linkups; /* FIP link up */ | ||
35 | u64 fip_linkdns; /* FIP link down */ | ||
36 | u64 fip_fails; /* FIP failures */ | ||
37 | u64 mac_invalids; /* Invalid mac assignments */ | ||
38 | u64 vlan_req; /* Vlan requests */ | ||
39 | u64 vlan_notify; /* Vlan notifications */ | ||
40 | u64 vlan_err; /* Vlan notification errors */ | ||
41 | u64 vlan_timeouts; /* Vlan request timeouts */ | ||
42 | u64 vlan_invalids; /* Vlan invalids */ | ||
43 | u64 disc_req; /* Discovery requests */ | ||
44 | u64 disc_rsp; /* Discovery responses */ | ||
45 | u64 disc_err; /* Discovery error frames */ | ||
46 | u64 disc_unsol; /* Discovery unsolicited */ | ||
47 | u64 disc_timeouts; /* Discovery timeouts */ | ||
48 | u64 disc_fcf_unavail; /* Discovery FCF not avail */ | ||
49 | u64 linksvc_unsupp; /* FIP link service req unsupp. */ | ||
50 | u64 linksvc_err; /* FIP link service req errors */ | ||
51 | u64 logo_req; /* FIP logo */ | ||
52 | u64 clrvlink_req; /* Clear virtual link requests */ | ||
53 | u64 op_unsupp; /* FIP operation unsupp. */ | ||
54 | u64 untagged; /* FIP untagged frames */ | ||
55 | u64 txf_ucast; /* Tx FCoE unicast frames */ | ||
56 | u64 txf_ucast_vlan; /* Tx FCoE unicast vlan frames */ | ||
57 | u64 txf_ucast_octets; /* Tx FCoE unicast octets */ | ||
58 | u64 txf_mcast; /* Tx FCoE mutlicast frames */ | ||
59 | u64 txf_mcast_vlan; /* Tx FCoE mutlicast vlan frames */ | ||
60 | u64 txf_mcast_octets; /* Tx FCoE multicast octets */ | ||
61 | u64 txf_bcast; /* Tx FCoE broadcast frames */ | ||
62 | u64 txf_bcast_vlan; /* Tx FCoE broadcast vlan frames */ | ||
63 | u64 txf_bcast_octets; /* Tx FCoE broadcast octets */ | ||
64 | u64 txf_timeout; /* Tx timeouts */ | ||
65 | u64 txf_parity_errors; /* Transmit parity err */ | ||
66 | u64 txf_fid_parity_errors; /* Transmit FID parity err */ | ||
67 | u64 tx_pause; /* Tx pause frames */ | ||
68 | u64 tx_zero_pause; /* Tx zero pause frames */ | ||
69 | u64 tx_first_pause; /* Tx first pause frames */ | ||
70 | u64 rx_pause; /* Rx pause frames */ | ||
71 | u64 rx_zero_pause; /* Rx zero pause frames */ | ||
72 | u64 rx_first_pause; /* Rx first pause frames */ | ||
73 | u64 rxf_ucast_octets; /* Rx unicast octets */ | ||
74 | u64 rxf_ucast; /* Rx unicast frames */ | ||
75 | u64 rxf_ucast_vlan; /* Rx unicast vlan frames */ | ||
76 | u64 rxf_mcast_octets; /* Rx multicast octets */ | ||
77 | u64 rxf_mcast; /* Rx multicast frames */ | ||
78 | u64 rxf_mcast_vlan; /* Rx multicast vlan frames */ | ||
79 | u64 rxf_bcast_octets; /* Rx broadcast octests */ | ||
80 | u64 rxf_bcast; /* Rx broadcast frames */ | ||
81 | u64 rxf_bcast_vlan; /* Rx broadcast vlan frames */ | ||
82 | }; | ||
83 | |||
84 | /** | ||
85 | * QoS or FCoE stats (fcport stats excluding physical FC port stats) | ||
86 | */ | ||
87 | union bfa_fcport_stats_u { | ||
88 | struct bfa_qos_stats_s fcqos; | ||
89 | struct bfa_fcoe_stats_s fcoe; | ||
90 | }; | ||
91 | |||
92 | #pragma pack() | ||
93 | |||
94 | #endif /* __BFA_DEFS_FCPORT_H__ */ | ||
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_im_common.h b/drivers/scsi/bfa/include/defs/bfa_defs_im_common.h deleted file mode 100644 index 9ccf53bef65a..000000000000 --- a/drivers/scsi/bfa/include/defs/bfa_defs_im_common.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2009 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_DEFS_IM_COMMON_H__ | ||
19 | #define __BFA_DEFS_IM_COMMON_H__ | ||
20 | |||
21 | #define BFA_ADAPTER_NAME_LEN 256 | ||
22 | #define BFA_ADAPTER_GUID_LEN 256 | ||
23 | #define RESERVED_VLAN_NAME L"PORT VLAN" | ||
24 | #define PASSTHRU_VLAN_NAME L"PASSTHRU VLAN" | ||
25 | |||
26 | u64 tx_pkt_cnt; | ||
27 | u64 rx_pkt_cnt; | ||
28 | u32 duration; | ||
29 | u8 status; | ||
30 | } bfa_im_stats_t, *pbfa_im_stats_t; | ||
31 | |||
32 | #endif /* __BFA_DEFS_IM_COMMON_H__ */ | ||
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_im_team.h b/drivers/scsi/bfa/include/defs/bfa_defs_im_team.h deleted file mode 100644 index a486a7eb81d6..000000000000 --- a/drivers/scsi/bfa/include/defs/bfa_defs_im_team.h +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2009 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_DEFS_IM_TEAM_H__ | ||
19 | #define __BFA_DEFS_IM_TEAM_H__ | ||
20 | |||
21 | #include <protocol/types.h> | ||
22 | |||
23 | #define BFA_TEAM_MAX_PORTS 8 | ||
24 | #define BFA_TEAM_NAME_LEN 256 | ||
25 | #define BFA_MAX_NUM_TEAMS 16 | ||
26 | #define BFA_TEAM_INVALID_DELAY -1 | ||
27 | |||
28 | BFA_LACP_RATE_SLOW = 1, | ||
29 | BFA_LACP_RATE_FAST | ||
30 | } bfa_im_lacp_rate_t; | ||
31 | |||
32 | BFA_TEAM_MODE_FAIL_OVER = 1, | ||
33 | BFA_TEAM_MODE_FAIL_BACK, | ||
34 | BFA_TEAM_MODE_LACP, | ||
35 | BFA_TEAM_MODE_NONE | ||
36 | } bfa_im_team_mode_t; | ||
37 | |||
38 | BFA_XMIT_POLICY_L2 = 1, | ||
39 | BFA_XMIT_POLICY_L3_L4 | ||
40 | } bfa_im_xmit_policy_t; | ||
41 | |||
42 | bfa_im_team_mode_t team_mode; | ||
43 | bfa_im_lacp_rate_t lacp_rate; | ||
44 | bfa_im_xmit_policy_t xmit_policy; | ||
45 | int delay; | ||
46 | wchar_t primary[BFA_ADAPTER_NAME_LEN]; | ||
47 | wchar_t preferred_primary[BFA_ADAPTER_NAME_LEN]; | ||
48 | mac_t mac; | ||
49 | u16 num_ports; | ||
50 | u16 num_vlans; | ||
51 | u16 vlan_list[BFA_MAX_VLANS_PER_PORT]; | ||
52 | wchar_t team_guid_list[BFA_TEAM_MAX_PORTS][BFA_ADAPTER_GUID_LEN]; | ||
53 | wchar_t ioc_name_list[BFA_TEAM_MAX_PORTS][BFA_ADAPTER_NAME_LEN]; | ||
54 | } bfa_im_team_attr_t; | ||
55 | |||
56 | wchar_t team_name[BFA_TEAM_NAME_LEN]; | ||
57 | bfa_im_xmit_policy_t xmit_policy; | ||
58 | int delay; | ||
59 | wchar_t primary[BFA_ADAPTER_NAME_LEN]; | ||
60 | wchar_t preferred_primary[BFA_ADAPTER_NAME_LEN]; | ||
61 | } bfa_im_team_edit_t, *pbfa_im_team_edit_t; | ||
62 | |||
63 | wchar_t team_name[BFA_TEAM_NAME_LEN]; | ||
64 | bfa_im_team_mode_t team_mode; | ||
65 | mac_t mac; | ||
66 | } bfa_im_team_info_t; | ||
67 | |||
68 | bfa_im_team_info_t team_info[BFA_MAX_NUM_TEAMS]; | ||
69 | u16 num_teams; | ||
70 | } bfa_im_team_list_t, *pbfa_im_team_list_t; | ||
71 | |||
72 | #endif /* __BFA_DEFS_IM_TEAM_H__ */ | ||
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_ioc.h b/drivers/scsi/bfa/include/defs/bfa_defs_ioc.h index b1d532da3a9d..8d8e6a966537 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_ioc.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_ioc.h | |||
@@ -126,6 +126,7 @@ struct bfa_ioc_attr_s { | |||
126 | struct bfa_ioc_driver_attr_s driver_attr; /* driver attr */ | 126 | struct bfa_ioc_driver_attr_s driver_attr; /* driver attr */ |
127 | struct bfa_ioc_pci_attr_s pci_attr; | 127 | struct bfa_ioc_pci_attr_s pci_attr; |
128 | u8 port_id; /* port number */ | 128 | u8 port_id; /* port number */ |
129 | u8 rsvd[7]; /*!< 64bit align */ | ||
129 | }; | 130 | }; |
130 | 131 | ||
131 | /** | 132 | /** |
@@ -143,8 +144,8 @@ enum bfa_ioc_aen_event { | |||
143 | * BFA IOC level event data, now just a place holder | 144 | * BFA IOC level event data, now just a place holder |
144 | */ | 145 | */ |
145 | struct bfa_ioc_aen_data_s { | 146 | struct bfa_ioc_aen_data_s { |
146 | enum bfa_ioc_type_e ioc_type; | ||
147 | wwn_t pwwn; | 147 | wwn_t pwwn; |
148 | s16 ioc_type; | ||
148 | mac_t mac; | 149 | mac_t mac; |
149 | }; | 150 | }; |
150 | 151 | ||
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_iocfc.h b/drivers/scsi/bfa/include/defs/bfa_defs_iocfc.h index d76bcbd9820f..c290fb13d2d1 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_iocfc.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_iocfc.h | |||
@@ -26,6 +26,8 @@ | |||
26 | 26 | ||
27 | #define BFA_IOCFC_INTR_DELAY 1125 | 27 | #define BFA_IOCFC_INTR_DELAY 1125 |
28 | #define BFA_IOCFC_INTR_LATENCY 225 | 28 | #define BFA_IOCFC_INTR_LATENCY 225 |
29 | #define BFA_IOCFCOE_INTR_DELAY 25 | ||
30 | #define BFA_IOCFCOE_INTR_LATENCY 5 | ||
29 | 31 | ||
30 | /** | 32 | /** |
31 | * Interrupt coalescing configuration. | 33 | * Interrupt coalescing configuration. |
@@ -50,7 +52,7 @@ struct bfa_iocfc_fwcfg_s { | |||
50 | u16 num_fcxp_reqs; /* unassisted FC exchanges */ | 52 | u16 num_fcxp_reqs; /* unassisted FC exchanges */ |
51 | u16 num_uf_bufs; /* unsolicited recv buffers */ | 53 | u16 num_uf_bufs; /* unsolicited recv buffers */ |
52 | u8 num_cqs; | 54 | u8 num_cqs; |
53 | u8 rsvd; | 55 | u8 rsvd[5]; |
54 | }; | 56 | }; |
55 | 57 | ||
56 | struct bfa_iocfc_drvcfg_s { | 58 | struct bfa_iocfc_drvcfg_s { |
@@ -224,18 +226,24 @@ struct bfa_fw_port_physm_stats_s { | |||
224 | 226 | ||
225 | 227 | ||
226 | struct bfa_fw_fip_stats_s { | 228 | struct bfa_fw_fip_stats_s { |
229 | u32 vlan_req; /* vlan discovery requests */ | ||
230 | u32 vlan_notify; /* vlan notifications */ | ||
231 | u32 vlan_err; /* vlan response error */ | ||
232 | u32 vlan_timeouts; /* vlan disvoery timeouts */ | ||
233 | u32 vlan_invalids; /* invalid vlan in discovery advert. */ | ||
227 | u32 disc_req; /* Discovery solicit requests */ | 234 | u32 disc_req; /* Discovery solicit requests */ |
228 | u32 disc_rsp; /* Discovery solicit response */ | 235 | u32 disc_rsp; /* Discovery solicit response */ |
229 | u32 disc_err; /* Discovery advt. parse errors */ | 236 | u32 disc_err; /* Discovery advt. parse errors */ |
230 | u32 disc_unsol; /* Discovery unsolicited */ | 237 | u32 disc_unsol; /* Discovery unsolicited */ |
231 | u32 disc_timeouts; /* Discovery timeouts */ | 238 | u32 disc_timeouts; /* Discovery timeouts */ |
239 | u32 disc_fcf_unavail; /* Discovery FCF Not Avail. */ | ||
232 | u32 linksvc_unsupp; /* Unsupported link service req */ | 240 | u32 linksvc_unsupp; /* Unsupported link service req */ |
233 | u32 linksvc_err; /* Parse error in link service req */ | 241 | u32 linksvc_err; /* Parse error in link service req */ |
234 | u32 logo_req; /* Number of FIP logos received */ | 242 | u32 logo_req; /* Number of FIP logos received */ |
235 | u32 clrvlink_req; /* Clear virtual link req */ | 243 | u32 clrvlink_req; /* Clear virtual link req */ |
236 | u32 op_unsupp; /* Unsupported FIP operation */ | 244 | u32 op_unsupp; /* Unsupported FIP operation */ |
237 | u32 untagged; /* Untagged frames (ignored) */ | 245 | u32 untagged; /* Untagged frames (ignored) */ |
238 | u32 rsvd; | 246 | u32 invalid_version; /*!< Invalid FIP version */ |
239 | }; | 247 | }; |
240 | 248 | ||
241 | 249 | ||
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_lport.h b/drivers/scsi/bfa/include/defs/bfa_defs_lport.h index 7359f82aacfc..0952a139c47c 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_lport.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_lport.h | |||
@@ -59,8 +59,8 @@ enum bfa_lport_aen_event { | |||
59 | */ | 59 | */ |
60 | struct bfa_lport_aen_data_s { | 60 | struct bfa_lport_aen_data_s { |
61 | u16 vf_id; /* vf_id of this logical port */ | 61 | u16 vf_id; /* vf_id of this logical port */ |
62 | u16 rsvd; | 62 | s16 roles; /* Logical port mode,IM/TM/IP etc */ |
63 | enum bfa_port_role roles; /* Logical port mode,IM/TM/IP etc */ | 63 | u32 rsvd; |
64 | wwn_t ppwwn; /* WWN of its physical port */ | 64 | wwn_t ppwwn; /* WWN of its physical port */ |
65 | wwn_t lpwwn; /* WWN of this logical port */ | 65 | wwn_t lpwwn; /* WWN of this logical port */ |
66 | }; | 66 | }; |
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_mfg.h b/drivers/scsi/bfa/include/defs/bfa_defs_mfg.h index 13fd4ab6aae2..c5bd9c36ad4d 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_mfg.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_mfg.h | |||
@@ -22,7 +22,47 @@ | |||
22 | /** | 22 | /** |
23 | * Manufacturing block version | 23 | * Manufacturing block version |
24 | */ | 24 | */ |
25 | #define BFA_MFG_VERSION 1 | 25 | #define BFA_MFG_VERSION 2 |
26 | |||
27 | /** | ||
28 | * Manufacturing block encrypted version | ||
29 | */ | ||
30 | #define BFA_MFG_ENC_VER 2 | ||
31 | |||
32 | /** | ||
33 | * Manufacturing block version 1 length | ||
34 | */ | ||
35 | #define BFA_MFG_VER1_LEN 128 | ||
36 | |||
37 | /** | ||
38 | * Manufacturing block header length | ||
39 | */ | ||
40 | #define BFA_MFG_HDR_LEN 4 | ||
41 | |||
42 | /** | ||
43 | * Checksum size | ||
44 | */ | ||
45 | #define BFA_MFG_CHKSUM_SIZE 16 | ||
46 | |||
47 | /** | ||
48 | * Manufacturing block encrypted version | ||
49 | */ | ||
50 | #define BFA_MFG_ENC_VER 2 | ||
51 | |||
52 | /** | ||
53 | * Manufacturing block version 1 length | ||
54 | */ | ||
55 | #define BFA_MFG_VER1_LEN 128 | ||
56 | |||
57 | /** | ||
58 | * Manufacturing block header length | ||
59 | */ | ||
60 | #define BFA_MFG_HDR_LEN 4 | ||
61 | |||
62 | /** | ||
63 | * Checksum size | ||
64 | */ | ||
65 | #define BFA_MFG_CHKSUM_SIZE 16 | ||
26 | 66 | ||
27 | /** | 67 | /** |
28 | * Manufacturing block format | 68 | * Manufacturing block format |
@@ -30,29 +70,74 @@ | |||
30 | #define BFA_MFG_SERIALNUM_SIZE 11 | 70 | #define BFA_MFG_SERIALNUM_SIZE 11 |
31 | #define BFA_MFG_PARTNUM_SIZE 14 | 71 | #define BFA_MFG_PARTNUM_SIZE 14 |
32 | #define BFA_MFG_SUPPLIER_ID_SIZE 10 | 72 | #define BFA_MFG_SUPPLIER_ID_SIZE 10 |
33 | #define BFA_MFG_SUPPLIER_PARTNUM_SIZE 20 | 73 | #define BFA_MFG_SUPPLIER_PARTNUM_SIZE 20 |
34 | #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE 20 | 74 | #define BFA_MFG_SUPPLIER_SERIALNUM_SIZE 20 |
35 | #define BFA_MFG_SUPPLIER_REVISION_SIZE 4 | 75 | #define BFA_MFG_SUPPLIER_REVISION_SIZE 4 |
36 | #define STRSZ(_n) (((_n) + 4) & ~3) | 76 | #define STRSZ(_n) (((_n) + 4) & ~3) |
37 | 77 | ||
38 | /** | 78 | /** |
79 | * Manufacturing card type | ||
80 | */ | ||
81 | enum { | ||
82 | BFA_MFG_TYPE_CB_MAX = 825, /* Crossbow card type max */ | ||
83 | BFA_MFG_TYPE_FC8P2 = 825, /* 8G 2port FC card */ | ||
84 | BFA_MFG_TYPE_FC8P1 = 815, /* 8G 1port FC card */ | ||
85 | BFA_MFG_TYPE_FC4P2 = 425, /* 4G 2port FC card */ | ||
86 | BFA_MFG_TYPE_FC4P1 = 415, /* 4G 1port FC card */ | ||
87 | BFA_MFG_TYPE_CNA10P2 = 1020, /* 10G 2port CNA card */ | ||
88 | BFA_MFG_TYPE_CNA10P1 = 1010, /* 10G 1port CNA card */ | ||
89 | }; | ||
90 | |||
91 | #pragma pack(1) | ||
92 | |||
93 | /** | ||
94 | * Card type to port number conversion | ||
95 | */ | ||
96 | #define bfa_mfg_type2port_num(card_type) (((card_type) / 10) % 10) | ||
97 | |||
98 | |||
99 | /** | ||
100 | * All numerical fields are in big-endian format. | ||
101 | */ | ||
102 | struct bfa_mfg_block_s { | ||
103 | }; | ||
104 | |||
105 | /** | ||
39 | * VPD data length | 106 | * VPD data length |
40 | */ | 107 | */ |
41 | #define BFA_MFG_VPD_LEN 256 | 108 | #define BFA_MFG_VPD_LEN 512 |
109 | |||
110 | #define BFA_MFG_VPD_PCI_HDR_OFF 137 | ||
111 | #define BFA_MFG_VPD_PCI_VER_MASK 0x07 /* version mask 3 bits */ | ||
112 | #define BFA_MFG_VPD_PCI_VDR_MASK 0xf8 /* vendor mask 5 bits */ | ||
113 | |||
114 | /** | ||
115 | * VPD vendor tag | ||
116 | */ | ||
117 | enum { | ||
118 | BFA_MFG_VPD_UNKNOWN = 0, /* vendor unknown */ | ||
119 | BFA_MFG_VPD_IBM = 1, /* vendor IBM */ | ||
120 | BFA_MFG_VPD_HP = 2, /* vendor HP */ | ||
121 | BFA_MFG_VPD_DELL = 3, /* vendor DELL */ | ||
122 | BFA_MFG_VPD_PCI_IBM = 0x08, /* PCI VPD IBM */ | ||
123 | BFA_MFG_VPD_PCI_HP = 0x10, /* PCI VPD HP */ | ||
124 | BFA_MFG_VPD_PCI_DELL = 0x20, /* PCI VPD DELL */ | ||
125 | BFA_MFG_VPD_PCI_BRCD = 0xf8, /* PCI VPD Brocade */ | ||
126 | }; | ||
42 | 127 | ||
43 | /** | 128 | /** |
44 | * All numerical fields are in big-endian format. | 129 | * All numerical fields are in big-endian format. |
45 | */ | 130 | */ |
46 | struct bfa_mfg_vpd_s { | 131 | struct bfa_mfg_vpd_s { |
47 | u8 version; /* vpd data version */ | 132 | u8 version; /* vpd data version */ |
48 | u8 vpd_sig[3]; /* characters 'V', 'P', 'D' */ | 133 | u8 vpd_sig[3]; /* characters 'V', 'P', 'D' */ |
49 | u8 chksum; /* u8 checksum */ | 134 | u8 chksum; /* u8 checksum */ |
50 | u8 vendor; /* vendor */ | 135 | u8 vendor; /* vendor */ |
51 | u8 len; /* vpd data length excluding header */ | 136 | u8 len; /* vpd data length excluding header */ |
52 | u8 rsv; | 137 | u8 rsv; |
53 | u8 data[BFA_MFG_VPD_LEN]; /* vpd data */ | 138 | u8 data[BFA_MFG_VPD_LEN]; /* vpd data */ |
54 | }; | 139 | }; |
55 | 140 | ||
56 | #pragma pack(1) | 141 | #pragma pack() |
57 | 142 | ||
58 | #endif /* __BFA_DEFS_MFG_H__ */ | 143 | #endif /* __BFA_DEFS_MFG_H__ */ |
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_port.h b/drivers/scsi/bfa/include/defs/bfa_defs_port.h index de0696c81bc4..501bc9739d9d 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_port.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_port.h | |||
@@ -185,6 +185,8 @@ struct bfa_port_attr_s { | |||
185 | wwn_t fabric_name; /* attached switch's nwwn */ | 185 | wwn_t fabric_name; /* attached switch's nwwn */ |
186 | u8 fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ]; /* attached | 186 | u8 fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ]; /* attached |
187 | * fabric's ip addr */ | 187 | * fabric's ip addr */ |
188 | struct mac_s fpma_mac; /* Lport's FPMA Mac address */ | ||
189 | u16 authfail; /* auth failed state */ | ||
188 | }; | 190 | }; |
189 | 191 | ||
190 | /** | 192 | /** |
@@ -232,14 +234,15 @@ enum bfa_port_aen_sfp_pom { | |||
232 | }; | 234 | }; |
233 | 235 | ||
234 | struct bfa_port_aen_data_s { | 236 | struct bfa_port_aen_data_s { |
235 | enum bfa_ioc_type_e ioc_type; | 237 | wwn_t pwwn; /* WWN of the physical port */ |
236 | wwn_t pwwn; /* WWN of the physical port */ | 238 | wwn_t fwwn; /* WWN of the fabric port */ |
237 | wwn_t fwwn; /* WWN of the fabric port */ | 239 | s32 phy_port_num; /*! For SFP related events */ |
238 | mac_t mac; /* MAC addres of the ethernet port, | 240 | s16 ioc_type; |
239 | * applicable to CNA port only */ | 241 | s16 level; /* Only transitions will |
240 | int phy_port_num; /*! For SFP related events */ | 242 | * be informed */ |
241 | enum bfa_port_aen_sfp_pom level; /* Only transitions will | 243 | struct mac_s mac; /* MAC address of the ethernet port, |
242 | * be informed */ | 244 | * applicable to CNA port only */ |
245 | s16 rsvd; | ||
243 | }; | 246 | }; |
244 | 247 | ||
245 | #endif /* __BFA_DEFS_PORT_H__ */ | 248 | #endif /* __BFA_DEFS_PORT_H__ */ |
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_pport.h b/drivers/scsi/bfa/include/defs/bfa_defs_pport.h index bf320412ee24..26e5cc78095d 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_pport.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_pport.h | |||
@@ -232,7 +232,7 @@ struct bfa_pport_attr_s { | |||
232 | u32 pid; /* port ID */ | 232 | u32 pid; /* port ID */ |
233 | enum bfa_pport_type port_type; /* current topology */ | 233 | enum bfa_pport_type port_type; /* current topology */ |
234 | u32 loopback; /* external loopback */ | 234 | u32 loopback; /* external loopback */ |
235 | u32 rsvd1; | 235 | u32 authfail; /* auth fail state */ |
236 | u32 rsvd2; /* padding for 64 bit */ | 236 | u32 rsvd2; /* padding for 64 bit */ |
237 | }; | 237 | }; |
238 | 238 | ||
@@ -240,73 +240,79 @@ struct bfa_pport_attr_s { | |||
240 | * FC Port statistics. | 240 | * FC Port statistics. |
241 | */ | 241 | */ |
242 | struct bfa_pport_fc_stats_s { | 242 | struct bfa_pport_fc_stats_s { |
243 | u64 secs_reset; /* seconds since stats is reset */ | 243 | u64 secs_reset; /* Seconds since stats is reset */ |
244 | u64 tx_frames; /* transmitted frames */ | 244 | u64 tx_frames; /* Tx frames */ |
245 | u64 tx_words; /* transmitted words */ | 245 | u64 tx_words; /* Tx words */ |
246 | u64 rx_frames; /* received frames */ | 246 | u64 tx_lip; /* TX LIP */ |
247 | u64 rx_words; /* received words */ | 247 | u64 tx_nos; /* Tx NOS */ |
248 | u64 lip_count; /* LIPs seen */ | 248 | u64 tx_ols; /* Tx OLS */ |
249 | u64 nos_count; /* NOS count */ | 249 | u64 tx_lr; /* Tx LR */ |
250 | u64 error_frames; /* errored frames (sent?) */ | 250 | u64 tx_lrr; /* Tx LRR */ |
251 | u64 dropped_frames; /* dropped frames */ | 251 | u64 rx_frames; /* Rx frames */ |
252 | u64 link_failures; /* link failure count */ | 252 | u64 rx_words; /* Rx words */ |
253 | u64 loss_of_syncs; /* loss of sync count */ | 253 | u64 lip_count; /* Rx LIP */ |
254 | u64 loss_of_signals;/* loss of signal count */ | 254 | u64 nos_count; /* Rx NOS */ |
255 | u64 primseq_errs; /* primitive sequence protocol */ | 255 | u64 ols_count; /* Rx OLS */ |
256 | u64 bad_os_count; /* invalid ordered set */ | 256 | u64 lr_count; /* Rx LR */ |
257 | u64 err_enc_out; /* Encoding error outside frame */ | 257 | u64 lrr_count; /* Rx LRR */ |
258 | u64 invalid_crcs; /* frames received with invalid CRC*/ | 258 | u64 invalid_crcs; /* Rx CRC err frames */ |
259 | u64 undersized_frm; /* undersized frames */ | 259 | u64 invalid_crc_gd_eof; /* Rx CRC err good EOF frames */ |
260 | u64 oversized_frm; /* oversized frames */ | 260 | u64 undersized_frm; /* Rx undersized frames */ |
261 | u64 bad_eof_frm; /* frames with bad EOF */ | 261 | u64 oversized_frm; /* Rx oversized frames */ |
262 | struct bfa_qos_stats_s qos_stats; /* QoS statistics */ | 262 | u64 bad_eof_frm; /* Rx frames with bad EOF */ |
263 | u64 error_frames; /* Errored frames */ | ||
264 | u64 dropped_frames; /* Dropped frames */ | ||
265 | u64 link_failures; /* Link Failure (LF) count */ | ||
266 | u64 loss_of_syncs; /* Loss of sync count */ | ||
267 | u64 loss_of_signals;/* Loss of signal count */ | ||
268 | u64 primseq_errs; /* Primitive sequence protocol err. */ | ||
269 | u64 bad_os_count; /* Invalid ordered sets */ | ||
270 | u64 err_enc_out; /* Encoding err nonframe_8b10b */ | ||
271 | u64 err_enc; /* Encoding err frame_8b10b */ | ||
263 | }; | 272 | }; |
264 | 273 | ||
265 | /** | 274 | /** |
266 | * Eth Port statistics. | 275 | * Eth Port statistics. |
267 | */ | 276 | */ |
268 | struct bfa_pport_eth_stats_s { | 277 | struct bfa_pport_eth_stats_s { |
269 | u64 secs_reset; /* seconds since stats is reset */ | 278 | u64 secs_reset; /* Seconds since stats is reset */ |
270 | u64 frame_64; /* both rx and tx counter */ | 279 | u64 frame_64; /* Frames 64 bytes */ |
271 | u64 frame_65_127; /* both rx and tx counter */ | 280 | u64 frame_65_127; /* Frames 65-127 bytes */ |
272 | u64 frame_128_255; /* both rx and tx counter */ | 281 | u64 frame_128_255; /* Frames 128-255 bytes */ |
273 | u64 frame_256_511; /* both rx and tx counter */ | 282 | u64 frame_256_511; /* Frames 256-511 bytes */ |
274 | u64 frame_512_1023; /* both rx and tx counter */ | 283 | u64 frame_512_1023; /* Frames 512-1023 bytes */ |
275 | u64 frame_1024_1518; /* both rx and tx counter */ | 284 | u64 frame_1024_1518; /* Frames 1024-1518 bytes */ |
276 | u64 frame_1519_1522; /* both rx and tx counter */ | 285 | u64 frame_1519_1522; /* Frames 1519-1522 bytes */ |
277 | 286 | u64 tx_bytes; /* Tx bytes */ | |
278 | u64 tx_bytes; | 287 | u64 tx_packets; /* Tx packets */ |
279 | u64 tx_packets; | 288 | u64 tx_mcast_packets; /* Tx multicast packets */ |
280 | u64 tx_mcast_packets; | 289 | u64 tx_bcast_packets; /* Tx broadcast packets */ |
281 | u64 tx_bcast_packets; | 290 | u64 tx_control_frame; /* Tx control frame */ |
282 | u64 tx_control_frame; | 291 | u64 tx_drop; /* Tx drops */ |
283 | u64 tx_drop; | 292 | u64 tx_jabber; /* Tx jabber */ |
284 | u64 tx_jabber; | 293 | u64 tx_fcs_error; /* Tx FCS error */ |
285 | u64 tx_fcs_error; | 294 | u64 tx_fragments; /* Tx fragments */ |
286 | u64 tx_fragments; | 295 | u64 rx_bytes; /* Rx bytes */ |
287 | 296 | u64 rx_packets; /* Rx packets */ | |
288 | u64 rx_bytes; | 297 | u64 rx_mcast_packets; /* Rx multicast packets */ |
289 | u64 rx_packets; | 298 | u64 rx_bcast_packets; /* Rx broadcast packets */ |
290 | u64 rx_mcast_packets; | 299 | u64 rx_control_frames; /* Rx control frames */ |
291 | u64 rx_bcast_packets; | 300 | u64 rx_unknown_opcode; /* Rx unknown opcode */ |
292 | u64 rx_control_frames; | 301 | u64 rx_drop; /* Rx drops */ |
293 | u64 rx_unknown_opcode; | 302 | u64 rx_jabber; /* Rx jabber */ |
294 | u64 rx_drop; | 303 | u64 rx_fcs_error; /* Rx FCS errors */ |
295 | u64 rx_jabber; | 304 | u64 rx_alignment_error; /* Rx alignment errors */ |
296 | u64 rx_fcs_error; | 305 | u64 rx_frame_length_error; /* Rx frame len errors */ |
297 | u64 rx_alignment_error; | 306 | u64 rx_code_error; /* Rx code errors */ |
298 | u64 rx_frame_length_error; | 307 | u64 rx_fragments; /* Rx fragments */ |
299 | u64 rx_code_error; | 308 | u64 rx_pause; /* Rx pause */ |
300 | u64 rx_fragments; | 309 | u64 rx_zero_pause; /* Rx zero pause */ |
301 | 310 | u64 tx_pause; /* Tx pause */ | |
302 | u64 rx_pause; /* BPC */ | 311 | u64 tx_zero_pause; /* Tx zero pause */ |
303 | u64 rx_zero_pause; /* BPC Pause cancellation */ | 312 | u64 rx_fcoe_pause; /* Rx fcoe pause */ |
304 | u64 tx_pause; /* BPC */ | 313 | u64 rx_fcoe_zero_pause; /* Rx FCoE zero pause */ |
305 | u64 tx_zero_pause; /* BPC Pause cancellation */ | 314 | u64 tx_fcoe_pause; /* Tx FCoE pause */ |
306 | u64 rx_fcoe_pause; /* BPC */ | 315 | u64 tx_fcoe_zero_pause; /* Tx FCoE zero pause */ |
307 | u64 rx_fcoe_zero_pause; /* BPC Pause cancellation */ | ||
308 | u64 tx_fcoe_pause; /* BPC */ | ||
309 | u64 tx_fcoe_zero_pause; /* BPC Pause cancellation */ | ||
310 | }; | 316 | }; |
311 | 317 | ||
312 | /** | 318 | /** |
@@ -333,8 +339,7 @@ struct bfa_pport_fcpmap_s { | |||
333 | }; | 339 | }; |
334 | 340 | ||
335 | /** | 341 | /** |
336 | * Port RNID info. | 342 | * Port RNI */ |
337 | */ | ||
338 | struct bfa_pport_rnid_s { | 343 | struct bfa_pport_rnid_s { |
339 | wwn_t wwn; | 344 | wwn_t wwn; |
340 | u32 unittype; | 345 | u32 unittype; |
@@ -347,6 +352,23 @@ struct bfa_pport_rnid_s { | |||
347 | u16 topologydiscoveryflags; | 352 | u16 topologydiscoveryflags; |
348 | }; | 353 | }; |
349 | 354 | ||
355 | struct bfa_fcport_fcf_s { | ||
356 | wwn_t name; /* FCF name */ | ||
357 | wwn_t fabric_name; /* Fabric Name */ | ||
358 | u8 fipenabled; /* FIP enabled or not */ | ||
359 | u8 fipfailed; /* FIP failed or not */ | ||
360 | u8 resv[2]; | ||
361 | u8 pri; /* FCF priority */ | ||
362 | u8 version; /* FIP version used */ | ||
363 | u8 available; /* Available for login */ | ||
364 | u8 fka_disabled; /* FKA is disabled */ | ||
365 | u8 maxsz_verified; /* FCoE max size verified */ | ||
366 | u8 fc_map[3]; /* FC map */ | ||
367 | u16 vlan; /* FCoE vlan tag/priority */ | ||
368 | u32 fka_adv_per; /* FIP ka advert. period */ | ||
369 | struct mac_s mac; /* FCF mac */ | ||
370 | }; | ||
371 | |||
350 | /** | 372 | /** |
351 | * Link state information | 373 | * Link state information |
352 | */ | 374 | */ |
@@ -378,6 +400,7 @@ struct bfa_pport_link_s { | |||
378 | struct fc_alpabm_s alpabm; /* alpa bitmap */ | 400 | struct fc_alpabm_s alpabm; /* alpa bitmap */ |
379 | } loop_info; | 401 | } loop_info; |
380 | } tl; | 402 | } tl; |
403 | struct bfa_fcport_fcf_s fcf; /*!< FCF information (for FCoE) */ | ||
381 | }; | 404 | }; |
382 | 405 | ||
383 | #endif /* __BFA_DEFS_PPORT_H__ */ | 406 | #endif /* __BFA_DEFS_PPORT_H__ */ |
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_status.h b/drivers/scsi/bfa/include/defs/bfa_defs_status.h index 03ce0331eb48..ec78b4cb121a 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_status.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_status.h | |||
@@ -180,8 +180,8 @@ enum bfa_status { | |||
180 | BFA_STATUS_IM_ADAPT_ALREADY_IN_TEAM = 114, /* Given adapter is part | 180 | BFA_STATUS_IM_ADAPT_ALREADY_IN_TEAM = 114, /* Given adapter is part |
181 | * of another team */ | 181 | * of another team */ |
182 | BFA_STATUS_IM_ADAPT_HAS_VLANS = 115, /* Adapter has VLANs configured. | 182 | BFA_STATUS_IM_ADAPT_HAS_VLANS = 115, /* Adapter has VLANs configured. |
183 | * Delete all VLANs before | 183 | * Delete all VLANs to become |
184 | * creating team */ | 184 | * part of the team */ |
185 | BFA_STATUS_IM_PVID_MISMATCH = 116, /* Mismatching PVIDs configured | 185 | BFA_STATUS_IM_PVID_MISMATCH = 116, /* Mismatching PVIDs configured |
186 | * for adapters */ | 186 | * for adapters */ |
187 | BFA_STATUS_IM_LINK_SPEED_MISMATCH = 117, /* Mismatching link speeds | 187 | BFA_STATUS_IM_LINK_SPEED_MISMATCH = 117, /* Mismatching link speeds |
@@ -213,7 +213,7 @@ enum bfa_status { | |||
213 | * loaded */ | 213 | * loaded */ |
214 | BFA_STATUS_CARD_TYPE_MISMATCH = 131, /* Card type mismatch */ | 214 | BFA_STATUS_CARD_TYPE_MISMATCH = 131, /* Card type mismatch */ |
215 | BFA_STATUS_BAD_ASICBLK = 132, /* Bad ASIC block */ | 215 | BFA_STATUS_BAD_ASICBLK = 132, /* Bad ASIC block */ |
216 | BFA_STATUS_NO_DRIVER = 133, /* Storage/Ethernet driver not loaded */ | 216 | BFA_STATUS_NO_DRIVER = 133, /* Brocade adapter/driver not installed or loaded */ |
217 | BFA_STATUS_INVALID_MAC = 134, /* Invalid mac address */ | 217 | BFA_STATUS_INVALID_MAC = 134, /* Invalid mac address */ |
218 | BFA_STATUS_IM_NO_VLAN = 135, /* No VLANs configured on the adapter */ | 218 | BFA_STATUS_IM_NO_VLAN = 135, /* No VLANs configured on the adapter */ |
219 | BFA_STATUS_IM_ETH_LB_FAILED = 136, /* Ethernet loopback test failed */ | 219 | BFA_STATUS_IM_ETH_LB_FAILED = 136, /* Ethernet loopback test failed */ |
@@ -228,8 +228,7 @@ enum bfa_status { | |||
228 | BFA_STATUS_IM_GET_INETCFG_FAILED = 142, /* Acquiring Network Subsystem | 228 | BFA_STATUS_IM_GET_INETCFG_FAILED = 142, /* Acquiring Network Subsystem |
229 | * handle Failed. Please try | 229 | * handle Failed. Please try |
230 | * after some time */ | 230 | * after some time */ |
231 | BFA_STATUS_IM_NOT_BOUND = 143, /* Brocade 10G Ethernet Service is not | 231 | BFA_STATUS_IM_NOT_BOUND = 143, /* IM driver is not active */ |
232 | * Enabled on this port */ | ||
233 | BFA_STATUS_INSUFFICIENT_PERMS = 144, /* User doesn't have sufficient | 232 | BFA_STATUS_INSUFFICIENT_PERMS = 144, /* User doesn't have sufficient |
234 | * permissions to execute the BCU | 233 | * permissions to execute the BCU |
235 | * application */ | 234 | * application */ |
@@ -242,6 +241,14 @@ enum bfa_status { | |||
242 | * failed */ | 241 | * failed */ |
243 | BFA_STATUS_IM_UNBIND_FAILED = 149, /* ! < IM Driver unbind operation | 242 | BFA_STATUS_IM_UNBIND_FAILED = 149, /* ! < IM Driver unbind operation |
244 | * failed */ | 243 | * failed */ |
244 | BFA_STATUS_IM_PORT_IN_TEAM = 150, /* Port is already part of the | ||
245 | * team */ | ||
246 | BFA_STATUS_IM_VLAN_NOT_FOUND = 151, /* VLAN ID doesn't exists */ | ||
247 | BFA_STATUS_IM_TEAM_NOT_FOUND = 152, /* Teaming configuration doesn't | ||
248 | * exists */ | ||
249 | BFA_STATUS_IM_TEAM_CFG_NOT_ALLOWED = 153, /* Given settings are not | ||
250 | * allowed for the current | ||
251 | * Teaming mode */ | ||
245 | BFA_STATUS_MAX_VAL /* Unknown error code */ | 252 | BFA_STATUS_MAX_VAL /* Unknown error code */ |
246 | }; | 253 | }; |
247 | #define bfa_status_t enum bfa_status | 254 | #define bfa_status_t enum bfa_status |
diff --git a/drivers/scsi/bfa/include/fcb/bfa_fcb_fcpim.h b/drivers/scsi/bfa/include/fcb/bfa_fcb_fcpim.h index a6c70aee0aa3..52585d3dd891 100644 --- a/drivers/scsi/bfa/include/fcb/bfa_fcb_fcpim.h +++ b/drivers/scsi/bfa/include/fcb/bfa_fcb_fcpim.h | |||
@@ -70,7 +70,6 @@ void bfa_fcb_itnim_online(struct bfad_itnim_s *itnim_drv); | |||
70 | */ | 70 | */ |
71 | void bfa_fcb_itnim_offline(struct bfad_itnim_s *itnim_drv); | 71 | void bfa_fcb_itnim_offline(struct bfad_itnim_s *itnim_drv); |
72 | 72 | ||
73 | void bfa_fcb_itnim_tov_begin(struct bfad_itnim_s *itnim_drv); | ||
74 | void bfa_fcb_itnim_tov(struct bfad_itnim_s *itnim_drv); | 73 | void bfa_fcb_itnim_tov(struct bfad_itnim_s *itnim_drv); |
75 | 74 | ||
76 | #endif /* __BFAD_FCB_FCPIM_H__ */ | 75 | #endif /* __BFAD_FCB_FCPIM_H__ */ |
diff --git a/drivers/scsi/bfa/include/fcs/bfa_fcs.h b/drivers/scsi/bfa/include/fcs/bfa_fcs.h index 627669c65546..f2fd35fdee28 100644 --- a/drivers/scsi/bfa/include/fcs/bfa_fcs.h +++ b/drivers/scsi/bfa/include/fcs/bfa_fcs.h | |||
@@ -49,6 +49,7 @@ struct bfa_fcs_s { | |||
49 | struct bfa_trc_mod_s *trcmod; /* tracing module */ | 49 | struct bfa_trc_mod_s *trcmod; /* tracing module */ |
50 | struct bfa_aen_s *aen; /* aen component */ | 50 | struct bfa_aen_s *aen; /* aen component */ |
51 | bfa_boolean_t vf_enabled; /* VF mode is enabled */ | 51 | bfa_boolean_t vf_enabled; /* VF mode is enabled */ |
52 | bfa_boolean_t fdmi_enabled; /*!< FDMI is enabled */ | ||
52 | bfa_boolean_t min_cfg; /* min cfg enabled/disabled */ | 53 | bfa_boolean_t min_cfg; /* min cfg enabled/disabled */ |
53 | u16 port_vfid; /* port default VF ID */ | 54 | u16 port_vfid; /* port default VF ID */ |
54 | struct bfa_fcs_driver_info_s driver_info; | 55 | struct bfa_fcs_driver_info_s driver_info; |
@@ -60,10 +61,12 @@ struct bfa_fcs_s { | |||
60 | /* | 61 | /* |
61 | * bfa fcs API functions | 62 | * bfa fcs API functions |
62 | */ | 63 | */ |
63 | void bfa_fcs_init(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, | 64 | void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad, |
64 | bfa_boolean_t min_cfg); | 65 | bfa_boolean_t min_cfg); |
66 | void bfa_fcs_init(struct bfa_fcs_s *fcs); | ||
65 | void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, | 67 | void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, |
66 | struct bfa_fcs_driver_info_s *driver_info); | 68 | struct bfa_fcs_driver_info_s *driver_info); |
69 | void bfa_fcs_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable); | ||
67 | void bfa_fcs_exit(struct bfa_fcs_s *fcs); | 70 | void bfa_fcs_exit(struct bfa_fcs_s *fcs); |
68 | void bfa_fcs_trc_init(struct bfa_fcs_s *fcs, struct bfa_trc_mod_s *trcmod); | 71 | void bfa_fcs_trc_init(struct bfa_fcs_s *fcs, struct bfa_trc_mod_s *trcmod); |
69 | void bfa_fcs_log_init(struct bfa_fcs_s *fcs, struct bfa_log_mod_s *logmod); | 72 | void bfa_fcs_log_init(struct bfa_fcs_s *fcs, struct bfa_log_mod_s *logmod); |
diff --git a/drivers/scsi/bfa/include/fcs/bfa_fcs_lport.h b/drivers/scsi/bfa/include/fcs/bfa_fcs_lport.h index 967ceb0eb074..ceaefd3060f4 100644 --- a/drivers/scsi/bfa/include/fcs/bfa_fcs_lport.h +++ b/drivers/scsi/bfa/include/fcs/bfa_fcs_lport.h | |||
@@ -34,14 +34,6 @@ struct bfa_fcs_s; | |||
34 | struct bfa_fcs_fabric_s; | 34 | struct bfa_fcs_fabric_s; |
35 | 35 | ||
36 | /* | 36 | /* |
37 | * @todo : need to move to a global config file. | ||
38 | * Maximum Vports supported per physical port or vf. | ||
39 | */ | ||
40 | #define BFA_FCS_MAX_VPORTS_SUPP_CB 255 | ||
41 | #define BFA_FCS_MAX_VPORTS_SUPP_CT 191 | ||
42 | |||
43 | /* | ||
44 | * @todo : need to move to a global config file. | ||
45 | * Maximum Rports supported per port (physical/logical). | 37 | * Maximum Rports supported per port (physical/logical). |
46 | */ | 38 | */ |
47 | #define BFA_FCS_MAX_RPORTS_SUPP 256 /* @todo : tentative value */ | 39 | #define BFA_FCS_MAX_RPORTS_SUPP 256 /* @todo : tentative value */ |
diff --git a/drivers/scsi/bfa/include/log/bfa_log_hal.h b/drivers/scsi/bfa/include/log/bfa_log_hal.h index 0412aea2ec30..5f8f5e30b9e8 100644 --- a/drivers/scsi/bfa/include/log/bfa_log_hal.h +++ b/drivers/scsi/bfa/include/log/bfa_log_hal.h | |||
@@ -27,4 +27,10 @@ | |||
27 | (((u32) BFA_LOG_HAL_ID << BFA_LOG_MODID_OFFSET) | 3) | 27 | (((u32) BFA_LOG_HAL_ID << BFA_LOG_MODID_OFFSET) | 3) |
28 | #define BFA_LOG_HAL_SM_ASSERT \ | 28 | #define BFA_LOG_HAL_SM_ASSERT \ |
29 | (((u32) BFA_LOG_HAL_ID << BFA_LOG_MODID_OFFSET) | 4) | 29 | (((u32) BFA_LOG_HAL_ID << BFA_LOG_MODID_OFFSET) | 4) |
30 | #define BFA_LOG_HAL_DRIVER_ERROR \ | ||
31 | (((u32) BFA_LOG_HAL_ID << BFA_LOG_MODID_OFFSET) | 5) | ||
32 | #define BFA_LOG_HAL_DRIVER_CONFIG_ERROR \ | ||
33 | (((u32) BFA_LOG_HAL_ID << BFA_LOG_MODID_OFFSET) | 6) | ||
34 | #define BFA_LOG_HAL_MBOX_ERROR \ | ||
35 | (((u32) BFA_LOG_HAL_ID << BFA_LOG_MODID_OFFSET) | 7) | ||
30 | #endif | 36 | #endif |
diff --git a/drivers/scsi/bfa/include/log/bfa_log_linux.h b/drivers/scsi/bfa/include/log/bfa_log_linux.h index 317c0547ee16..bd451db4c30a 100644 --- a/drivers/scsi/bfa/include/log/bfa_log_linux.h +++ b/drivers/scsi/bfa/include/log/bfa_log_linux.h | |||
@@ -41,4 +41,20 @@ | |||
41 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 10) | 41 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 10) |
42 | #define BFA_LOG_LINUX_SCSI_ABORT_COMP \ | 42 | #define BFA_LOG_LINUX_SCSI_ABORT_COMP \ |
43 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 11) | 43 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 11) |
44 | #define BFA_LOG_LINUX_DRIVER_CONFIG_ERROR \ | ||
45 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 12) | ||
46 | #define BFA_LOG_LINUX_BNA_STATE_MACHINE \ | ||
47 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 13) | ||
48 | #define BFA_LOG_LINUX_IOC_ERROR \ | ||
49 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 14) | ||
50 | #define BFA_LOG_LINUX_RESOURCE_ALLOC_ERROR \ | ||
51 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 15) | ||
52 | #define BFA_LOG_LINUX_RING_BUFFER_ERROR \ | ||
53 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 16) | ||
54 | #define BFA_LOG_LINUX_DRIVER_ERROR \ | ||
55 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 17) | ||
56 | #define BFA_LOG_LINUX_DRIVER_DIAG \ | ||
57 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 18) | ||
58 | #define BFA_LOG_LINUX_DRIVER_AEN \ | ||
59 | (((u32) BFA_LOG_LINUX_ID << BFA_LOG_MODID_OFFSET) | 19) | ||
44 | #endif | 60 | #endif |
diff --git a/drivers/scsi/bfa/include/protocol/fc.h b/drivers/scsi/bfa/include/protocol/fc.h index 14969eecf6a9..8d1038035a76 100644 --- a/drivers/scsi/bfa/include/protocol/fc.h +++ b/drivers/scsi/bfa/include/protocol/fc.h | |||
@@ -50,6 +50,11 @@ struct fchs_s { | |||
50 | 50 | ||
51 | u32 ro; /* relative offset */ | 51 | u32 ro; /* relative offset */ |
52 | }; | 52 | }; |
53 | |||
54 | #define FC_SOF_LEN 4 | ||
55 | #define FC_EOF_LEN 4 | ||
56 | #define FC_CRC_LEN 4 | ||
57 | |||
53 | /* | 58 | /* |
54 | * Fibre Channel BB_E Header Structure | 59 | * Fibre Channel BB_E Header Structure |
55 | */ | 60 | */ |
diff --git a/drivers/scsi/bfa/include/protocol/pcifw.h b/drivers/scsi/bfa/include/protocol/pcifw.h deleted file mode 100644 index 6830dc3ee58a..000000000000 --- a/drivers/scsi/bfa/include/protocol/pcifw.h +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2009 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 | /** | ||
19 | * pcifw.h PCI FW related headers | ||
20 | */ | ||
21 | |||
22 | #ifndef __PCIFW_H__ | ||
23 | #define __PCIFW_H__ | ||
24 | |||
25 | #pragma pack(1) | ||
26 | |||
27 | struct pnp_hdr_s{ | ||
28 | u32 signature; /* "$PnP" */ | ||
29 | u8 rev; /* Struct revision */ | ||
30 | u8 len; /* Header structure len in multiples | ||
31 | * of 16 bytes */ | ||
32 | u16 off; /* Offset to next header 00 if none */ | ||
33 | u8 rsvd; /* Reserved byte */ | ||
34 | u8 cksum; /* 8-bit checksum for this header */ | ||
35 | u32 pnp_dev_id; /* PnP Device Id */ | ||
36 | u16 mfstr; /* Pointer to manufacturer string */ | ||
37 | u16 prstr; /* Pointer to product string */ | ||
38 | u8 devtype[3]; /* Device Type Code */ | ||
39 | u8 devind; /* Device Indicator */ | ||
40 | u16 bcventr; /* Bootstrap entry vector */ | ||
41 | u16 rsvd2; /* Reserved */ | ||
42 | u16 sriv; /* Static resource information vector */ | ||
43 | }; | ||
44 | |||
45 | struct pci_3_0_ds_s{ | ||
46 | u32 sig; /* Signature "PCIR" */ | ||
47 | u16 vendid; /* Vendor ID */ | ||
48 | u16 devid; /* Device ID */ | ||
49 | u16 devlistoff; /* Device List Offset */ | ||
50 | u16 len; /* PCI Data Structure Length */ | ||
51 | u8 rev; /* PCI Data Structure Revision */ | ||
52 | u8 clcode[3]; /* Class Code */ | ||
53 | u16 imglen; /* Code image length in multiples of | ||
54 | * 512 bytes */ | ||
55 | u16 coderev; /* Revision level of code/data */ | ||
56 | u8 codetype; /* Code type 0x00 - BIOS */ | ||
57 | u8 indr; /* Last image indicator */ | ||
58 | u16 mrtimglen; /* Max Run Time Image Length */ | ||
59 | u16 cuoff; /* Config Utility Code Header Offset */ | ||
60 | u16 dmtfclp; /* DMTF CLP entry point offset */ | ||
61 | }; | ||
62 | |||
63 | struct pci_optrom_hdr_s{ | ||
64 | u16 sig; /* Signature 0x55AA */ | ||
65 | u8 len; /* Option ROM length in units of 512 bytes */ | ||
66 | u8 inivec[3]; /* Initialization vector */ | ||
67 | u8 rsvd[16]; /* Reserved field */ | ||
68 | u16 verptr; /* Pointer to version string - private */ | ||
69 | u16 pcids; /* Pointer to PCI data structure */ | ||
70 | u16 pnphdr; /* Pointer to PnP expansion header */ | ||
71 | }; | ||
72 | |||
73 | #pragma pack() | ||
74 | |||
75 | #endif | ||
diff --git a/drivers/scsi/bfa/loop.c b/drivers/scsi/bfa/loop.c index f7c7f4f3c640..f6342efb6a90 100644 --- a/drivers/scsi/bfa/loop.c +++ b/drivers/scsi/bfa/loop.c | |||
@@ -162,7 +162,7 @@ bfa_fcs_port_loop_send_plogi(struct bfa_fcs_port_s *port, u8 alpa) | |||
162 | len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), alpa, | 162 | len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), alpa, |
163 | bfa_fcs_port_get_fcid(port), 0, | 163 | bfa_fcs_port_get_fcid(port), 0, |
164 | port->port_cfg.pwwn, port->port_cfg.nwwn, | 164 | port->port_cfg.pwwn, port->port_cfg.nwwn, |
165 | bfa_pport_get_maxfrsize(port->fcs->bfa)); | 165 | bfa_fcport_get_maxfrsize(port->fcs->bfa)); |
166 | 166 | ||
167 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, | 167 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, |
168 | FC_CLASS_3, len, &fchs, | 168 | FC_CLASS_3, len, &fchs, |
diff --git a/drivers/scsi/bfa/lport_api.c b/drivers/scsi/bfa/lport_api.c index 1e06792cd4c2..d3907d184e2b 100644 --- a/drivers/scsi/bfa/lport_api.c +++ b/drivers/scsi/bfa/lport_api.c | |||
@@ -156,7 +156,7 @@ bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port) | |||
156 | /* | 156 | /* |
157 | * Get Physical port's current speed | 157 | * Get Physical port's current speed |
158 | */ | 158 | */ |
159 | bfa_pport_get_attr(port->fcs->bfa, &pport_attr); | 159 | bfa_fcport_get_attr(port->fcs->bfa, &pport_attr); |
160 | pport_speed = pport_attr.speed; | 160 | pport_speed = pport_attr.speed; |
161 | bfa_trc(fcs, pport_speed); | 161 | bfa_trc(fcs, pport_speed); |
162 | 162 | ||
@@ -235,7 +235,8 @@ bfa_fcs_port_get_info(struct bfa_fcs_port_s *port, | |||
235 | port_info->port_wwn = bfa_fcs_port_get_pwwn(port); | 235 | port_info->port_wwn = bfa_fcs_port_get_pwwn(port); |
236 | port_info->node_wwn = bfa_fcs_port_get_nwwn(port); | 236 | port_info->node_wwn = bfa_fcs_port_get_nwwn(port); |
237 | 237 | ||
238 | port_info->max_vports_supp = bfa_fcs_vport_get_max(port->fcs); | 238 | port_info->max_vports_supp = |
239 | bfa_lps_get_max_vport(port->fcs->bfa); | ||
239 | port_info->num_vports_inuse = | 240 | port_info->num_vports_inuse = |
240 | bfa_fcs_fabric_vport_count(port->fabric); | 241 | bfa_fcs_fabric_vport_count(port->fabric); |
241 | port_info->max_rports_supp = BFA_FCS_MAX_RPORTS_SUPP; | 242 | port_info->max_rports_supp = BFA_FCS_MAX_RPORTS_SUPP; |
diff --git a/drivers/scsi/bfa/ms.c b/drivers/scsi/bfa/ms.c index c96b3ca007ae..5e8c8dee6c97 100644 --- a/drivers/scsi/bfa/ms.c +++ b/drivers/scsi/bfa/ms.c | |||
@@ -118,7 +118,7 @@ bfa_fcs_port_ms_sm_offline(struct bfa_fcs_port_ms_s *ms, | |||
118 | break; | 118 | break; |
119 | 119 | ||
120 | default: | 120 | default: |
121 | bfa_assert(0); | 121 | bfa_sm_fault(ms->port->fcs, event); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
@@ -141,7 +141,7 @@ bfa_fcs_port_ms_sm_plogi_sending(struct bfa_fcs_port_ms_s *ms, | |||
141 | break; | 141 | break; |
142 | 142 | ||
143 | default: | 143 | default: |
144 | bfa_assert(0); | 144 | bfa_sm_fault(ms->port->fcs, event); |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
@@ -190,7 +190,7 @@ bfa_fcs_port_ms_sm_plogi(struct bfa_fcs_port_ms_s *ms, enum port_ms_event event) | |||
190 | break; | 190 | break; |
191 | 191 | ||
192 | default: | 192 | default: |
193 | bfa_assert(0); | 193 | bfa_sm_fault(ms->port->fcs, event); |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
@@ -216,7 +216,7 @@ bfa_fcs_port_ms_sm_plogi_retry(struct bfa_fcs_port_ms_s *ms, | |||
216 | break; | 216 | break; |
217 | 217 | ||
218 | default: | 218 | default: |
219 | bfa_assert(0); | 219 | bfa_sm_fault(ms->port->fcs, event); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
@@ -230,10 +230,6 @@ bfa_fcs_port_ms_sm_online(struct bfa_fcs_port_ms_s *ms, | |||
230 | switch (event) { | 230 | switch (event) { |
231 | case MSSM_EVENT_PORT_OFFLINE: | 231 | case MSSM_EVENT_PORT_OFFLINE: |
232 | bfa_sm_set_state(ms, bfa_fcs_port_ms_sm_offline); | 232 | bfa_sm_set_state(ms, bfa_fcs_port_ms_sm_offline); |
233 | /* | ||
234 | * now invoke MS related sub-modules | ||
235 | */ | ||
236 | bfa_fcs_port_fdmi_offline(ms); | ||
237 | break; | 233 | break; |
238 | 234 | ||
239 | case MSSM_EVENT_PORT_FABRIC_RSCN: | 235 | case MSSM_EVENT_PORT_FABRIC_RSCN: |
@@ -243,7 +239,7 @@ bfa_fcs_port_ms_sm_online(struct bfa_fcs_port_ms_s *ms, | |||
243 | break; | 239 | break; |
244 | 240 | ||
245 | default: | 241 | default: |
246 | bfa_assert(0); | 242 | bfa_sm_fault(ms->port->fcs, event); |
247 | } | 243 | } |
248 | } | 244 | } |
249 | 245 | ||
@@ -266,7 +262,7 @@ bfa_fcs_port_ms_sm_gmal_sending(struct bfa_fcs_port_ms_s *ms, | |||
266 | break; | 262 | break; |
267 | 263 | ||
268 | default: | 264 | default: |
269 | bfa_assert(0); | 265 | bfa_sm_fault(ms->port->fcs, event); |
270 | } | 266 | } |
271 | } | 267 | } |
272 | 268 | ||
@@ -304,7 +300,7 @@ bfa_fcs_port_ms_sm_gmal(struct bfa_fcs_port_ms_s *ms, enum port_ms_event event) | |||
304 | break; | 300 | break; |
305 | 301 | ||
306 | default: | 302 | default: |
307 | bfa_assert(0); | 303 | bfa_sm_fault(ms->port->fcs, event); |
308 | } | 304 | } |
309 | } | 305 | } |
310 | 306 | ||
@@ -330,7 +326,7 @@ bfa_fcs_port_ms_sm_gmal_retry(struct bfa_fcs_port_ms_s *ms, | |||
330 | break; | 326 | break; |
331 | 327 | ||
332 | default: | 328 | default: |
333 | bfa_assert(0); | 329 | bfa_sm_fault(ms->port->fcs, event); |
334 | } | 330 | } |
335 | } | 331 | } |
336 | 332 | ||
@@ -466,7 +462,7 @@ bfa_fcs_port_ms_sm_gfn_sending(struct bfa_fcs_port_ms_s *ms, | |||
466 | break; | 462 | break; |
467 | 463 | ||
468 | default: | 464 | default: |
469 | bfa_assert(0); | 465 | bfa_sm_fault(ms->port->fcs, event); |
470 | } | 466 | } |
471 | } | 467 | } |
472 | 468 | ||
@@ -502,7 +498,7 @@ bfa_fcs_port_ms_sm_gfn(struct bfa_fcs_port_ms_s *ms, enum port_ms_event event) | |||
502 | break; | 498 | break; |
503 | 499 | ||
504 | default: | 500 | default: |
505 | bfa_assert(0); | 501 | bfa_sm_fault(ms->port->fcs, event); |
506 | } | 502 | } |
507 | } | 503 | } |
508 | 504 | ||
@@ -528,7 +524,7 @@ bfa_fcs_port_ms_sm_gfn_retry(struct bfa_fcs_port_ms_s *ms, | |||
528 | break; | 524 | break; |
529 | 525 | ||
530 | default: | 526 | default: |
531 | bfa_assert(0); | 527 | bfa_sm_fault(ms->port->fcs, event); |
532 | } | 528 | } |
533 | } | 529 | } |
534 | 530 | ||
@@ -637,7 +633,7 @@ bfa_fcs_port_ms_send_plogi(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
637 | bfa_os_hton3b(FC_MGMT_SERVER), | 633 | bfa_os_hton3b(FC_MGMT_SERVER), |
638 | bfa_fcs_port_get_fcid(port), 0, | 634 | bfa_fcs_port_get_fcid(port), 0, |
639 | port->port_cfg.pwwn, port->port_cfg.nwwn, | 635 | port->port_cfg.pwwn, port->port_cfg.nwwn, |
640 | bfa_pport_get_maxfrsize(port->fcs->bfa)); | 636 | bfa_fcport_get_maxfrsize(port->fcs->bfa)); |
641 | 637 | ||
642 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, | 638 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, |
643 | FC_CLASS_3, len, &fchs, bfa_fcs_port_ms_plogi_response, | 639 | FC_CLASS_3, len, &fchs, bfa_fcs_port_ms_plogi_response, |
@@ -735,6 +731,7 @@ bfa_fcs_port_ms_offline(struct bfa_fcs_port_s *port) | |||
735 | 731 | ||
736 | ms->port = port; | 732 | ms->port = port; |
737 | bfa_sm_send_event(ms, MSSM_EVENT_PORT_OFFLINE); | 733 | bfa_sm_send_event(ms, MSSM_EVENT_PORT_OFFLINE); |
734 | bfa_fcs_port_fdmi_offline(ms); | ||
738 | } | 735 | } |
739 | 736 | ||
740 | void | 737 | void |
diff --git a/drivers/scsi/bfa/ns.c b/drivers/scsi/bfa/ns.c index 2f8b880060bb..d20dd7e15742 100644 --- a/drivers/scsi/bfa/ns.c +++ b/drivers/scsi/bfa/ns.c | |||
@@ -164,7 +164,7 @@ bfa_fcs_port_ns_sm_offline(struct bfa_fcs_port_ns_s *ns, | |||
164 | break; | 164 | break; |
165 | 165 | ||
166 | default: | 166 | default: |
167 | bfa_assert(0); | 167 | bfa_sm_fault(ns->port->fcs, event); |
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
@@ -187,7 +187,7 @@ bfa_fcs_port_ns_sm_plogi_sending(struct bfa_fcs_port_ns_s *ns, | |||
187 | break; | 187 | break; |
188 | 188 | ||
189 | default: | 189 | default: |
190 | bfa_assert(0); | 190 | bfa_sm_fault(ns->port->fcs, event); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
@@ -221,7 +221,7 @@ bfa_fcs_port_ns_sm_plogi(struct bfa_fcs_port_ns_s *ns, | |||
221 | break; | 221 | break; |
222 | 222 | ||
223 | default: | 223 | default: |
224 | bfa_assert(0); | 224 | bfa_sm_fault(ns->port->fcs, event); |
225 | } | 225 | } |
226 | } | 226 | } |
227 | 227 | ||
@@ -247,7 +247,7 @@ bfa_fcs_port_ns_sm_plogi_retry(struct bfa_fcs_port_ns_s *ns, | |||
247 | break; | 247 | break; |
248 | 248 | ||
249 | default: | 249 | default: |
250 | bfa_assert(0); | 250 | bfa_sm_fault(ns->port->fcs, event); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
@@ -270,7 +270,7 @@ bfa_fcs_port_ns_sm_sending_rspn_id(struct bfa_fcs_port_ns_s *ns, | |||
270 | break; | 270 | break; |
271 | 271 | ||
272 | default: | 272 | default: |
273 | bfa_assert(0); | 273 | bfa_sm_fault(ns->port->fcs, event); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
@@ -304,7 +304,7 @@ bfa_fcs_port_ns_sm_rspn_id(struct bfa_fcs_port_ns_s *ns, | |||
304 | break; | 304 | break; |
305 | 305 | ||
306 | default: | 306 | default: |
307 | bfa_assert(0); | 307 | bfa_sm_fault(ns->port->fcs, event); |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
@@ -330,7 +330,7 @@ bfa_fcs_port_ns_sm_rspn_id_retry(struct bfa_fcs_port_ns_s *ns, | |||
330 | break; | 330 | break; |
331 | 331 | ||
332 | default: | 332 | default: |
333 | bfa_assert(0); | 333 | bfa_sm_fault(ns->port->fcs, event); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | 336 | ||
@@ -353,7 +353,7 @@ bfa_fcs_port_ns_sm_sending_rft_id(struct bfa_fcs_port_ns_s *ns, | |||
353 | break; | 353 | break; |
354 | 354 | ||
355 | default: | 355 | default: |
356 | bfa_assert(0); | 356 | bfa_sm_fault(ns->port->fcs, event); |
357 | } | 357 | } |
358 | } | 358 | } |
359 | 359 | ||
@@ -390,7 +390,7 @@ bfa_fcs_port_ns_sm_rft_id(struct bfa_fcs_port_ns_s *ns, | |||
390 | break; | 390 | break; |
391 | 391 | ||
392 | default: | 392 | default: |
393 | bfa_assert(0); | 393 | bfa_sm_fault(ns->port->fcs, event); |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
@@ -413,7 +413,7 @@ bfa_fcs_port_ns_sm_rft_id_retry(struct bfa_fcs_port_ns_s *ns, | |||
413 | break; | 413 | break; |
414 | 414 | ||
415 | default: | 415 | default: |
416 | bfa_assert(0); | 416 | bfa_sm_fault(ns->port->fcs, event); |
417 | } | 417 | } |
418 | } | 418 | } |
419 | 419 | ||
@@ -436,7 +436,7 @@ bfa_fcs_port_ns_sm_sending_rff_id(struct bfa_fcs_port_ns_s *ns, | |||
436 | break; | 436 | break; |
437 | 437 | ||
438 | default: | 438 | default: |
439 | bfa_assert(0); | 439 | bfa_sm_fault(ns->port->fcs, event); |
440 | } | 440 | } |
441 | } | 441 | } |
442 | 442 | ||
@@ -494,7 +494,7 @@ bfa_fcs_port_ns_sm_rff_id(struct bfa_fcs_port_ns_s *ns, | |||
494 | break; | 494 | break; |
495 | 495 | ||
496 | default: | 496 | default: |
497 | bfa_assert(0); | 497 | bfa_sm_fault(ns->port->fcs, event); |
498 | } | 498 | } |
499 | } | 499 | } |
500 | 500 | ||
@@ -517,7 +517,7 @@ bfa_fcs_port_ns_sm_rff_id_retry(struct bfa_fcs_port_ns_s *ns, | |||
517 | break; | 517 | break; |
518 | 518 | ||
519 | default: | 519 | default: |
520 | bfa_assert(0); | 520 | bfa_sm_fault(ns->port->fcs, event); |
521 | } | 521 | } |
522 | } | 522 | } |
523 | static void | 523 | static void |
@@ -539,7 +539,7 @@ bfa_fcs_port_ns_sm_sending_gid_ft(struct bfa_fcs_port_ns_s *ns, | |||
539 | break; | 539 | break; |
540 | 540 | ||
541 | default: | 541 | default: |
542 | bfa_assert(0); | 542 | bfa_sm_fault(ns->port->fcs, event); |
543 | } | 543 | } |
544 | } | 544 | } |
545 | 545 | ||
@@ -575,7 +575,7 @@ bfa_fcs_port_ns_sm_gid_ft(struct bfa_fcs_port_ns_s *ns, | |||
575 | break; | 575 | break; |
576 | 576 | ||
577 | default: | 577 | default: |
578 | bfa_assert(0); | 578 | bfa_sm_fault(ns->port->fcs, event); |
579 | } | 579 | } |
580 | } | 580 | } |
581 | 581 | ||
@@ -598,7 +598,7 @@ bfa_fcs_port_ns_sm_gid_ft_retry(struct bfa_fcs_port_ns_s *ns, | |||
598 | break; | 598 | break; |
599 | 599 | ||
600 | default: | 600 | default: |
601 | bfa_assert(0); | 601 | bfa_sm_fault(ns->port->fcs, event); |
602 | } | 602 | } |
603 | } | 603 | } |
604 | 604 | ||
@@ -626,7 +626,7 @@ bfa_fcs_port_ns_sm_online(struct bfa_fcs_port_ns_s *ns, | |||
626 | break; | 626 | break; |
627 | 627 | ||
628 | default: | 628 | default: |
629 | bfa_assert(0); | 629 | bfa_sm_fault(ns->port->fcs, event); |
630 | } | 630 | } |
631 | } | 631 | } |
632 | 632 | ||
@@ -660,7 +660,7 @@ bfa_fcs_port_ns_send_plogi(void *ns_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
660 | bfa_os_hton3b(FC_NAME_SERVER), | 660 | bfa_os_hton3b(FC_NAME_SERVER), |
661 | bfa_fcs_port_get_fcid(port), 0, | 661 | bfa_fcs_port_get_fcid(port), 0, |
662 | port->port_cfg.pwwn, port->port_cfg.nwwn, | 662 | port->port_cfg.pwwn, port->port_cfg.nwwn, |
663 | bfa_pport_get_maxfrsize(port->fcs->bfa)); | 663 | bfa_fcport_get_maxfrsize(port->fcs->bfa)); |
664 | 664 | ||
665 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, | 665 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, |
666 | FC_CLASS_3, len, &fchs, bfa_fcs_port_ns_plogi_response, | 666 | FC_CLASS_3, len, &fchs, bfa_fcs_port_ns_plogi_response, |
diff --git a/drivers/scsi/bfa/rport.c b/drivers/scsi/bfa/rport.c index 9cf58bb138dc..7b096f2e3836 100644 --- a/drivers/scsi/bfa/rport.c +++ b/drivers/scsi/bfa/rport.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * rport.c Remote port implementation. | 19 | * rport.c Remote port implementation. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/slab.h> | ||
22 | #include <bfa.h> | 23 | #include <bfa.h> |
23 | #include <bfa_svc.h> | 24 | #include <bfa_svc.h> |
24 | #include "fcbuild.h" | 25 | #include "fcbuild.h" |
@@ -224,7 +225,7 @@ bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
224 | break; | 225 | break; |
225 | 226 | ||
226 | default: | 227 | default: |
227 | bfa_assert(0); | 228 | bfa_sm_fault(rport->fcs, event); |
228 | } | 229 | } |
229 | } | 230 | } |
230 | 231 | ||
@@ -276,7 +277,7 @@ bfa_fcs_rport_sm_plogi_sending(struct bfa_fcs_rport_s *rport, | |||
276 | break; | 277 | break; |
277 | 278 | ||
278 | default: | 279 | default: |
279 | bfa_assert(0); | 280 | bfa_sm_fault(rport->fcs, event); |
280 | } | 281 | } |
281 | } | 282 | } |
282 | 283 | ||
@@ -332,7 +333,7 @@ bfa_fcs_rport_sm_plogiacc_sending(struct bfa_fcs_rport_s *rport, | |||
332 | break; | 333 | break; |
333 | 334 | ||
334 | default: | 335 | default: |
335 | bfa_assert(0); | 336 | bfa_sm_fault(rport->fcs, event); |
336 | } | 337 | } |
337 | } | 338 | } |
338 | 339 | ||
@@ -406,7 +407,7 @@ bfa_fcs_rport_sm_plogi_retry(struct bfa_fcs_rport_s *rport, | |||
406 | break; | 407 | break; |
407 | 408 | ||
408 | default: | 409 | default: |
409 | bfa_assert(0); | 410 | bfa_sm_fault(rport->fcs, event); |
410 | } | 411 | } |
411 | } | 412 | } |
412 | 413 | ||
@@ -481,7 +482,7 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
481 | break; | 482 | break; |
482 | 483 | ||
483 | default: | 484 | default: |
484 | bfa_assert(0); | 485 | bfa_sm_fault(rport->fcs, event); |
485 | } | 486 | } |
486 | } | 487 | } |
487 | 488 | ||
@@ -534,7 +535,7 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport, | |||
534 | break; | 535 | break; |
535 | 536 | ||
536 | default: | 537 | default: |
537 | bfa_assert(0); | 538 | bfa_sm_fault(rport->fcs, event); |
538 | } | 539 | } |
539 | } | 540 | } |
540 | 541 | ||
@@ -589,7 +590,7 @@ bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
589 | break; | 590 | break; |
590 | 591 | ||
591 | default: | 592 | default: |
592 | bfa_assert(0); | 593 | bfa_sm_fault(rport->fcs, event); |
593 | } | 594 | } |
594 | } | 595 | } |
595 | 596 | ||
@@ -646,7 +647,7 @@ bfa_fcs_rport_sm_nsquery_sending(struct bfa_fcs_rport_s *rport, | |||
646 | break; | 647 | break; |
647 | 648 | ||
648 | default: | 649 | default: |
649 | bfa_assert(0); | 650 | bfa_sm_fault(rport->fcs, event); |
650 | } | 651 | } |
651 | } | 652 | } |
652 | 653 | ||
@@ -704,7 +705,7 @@ bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
704 | break; | 705 | break; |
705 | 706 | ||
706 | default: | 707 | default: |
707 | bfa_assert(0); | 708 | bfa_sm_fault(rport->fcs, event); |
708 | } | 709 | } |
709 | } | 710 | } |
710 | 711 | ||
@@ -754,7 +755,7 @@ bfa_fcs_rport_sm_adisc_sending(struct bfa_fcs_rport_s *rport, | |||
754 | break; | 755 | break; |
755 | 756 | ||
756 | default: | 757 | default: |
757 | bfa_assert(0); | 758 | bfa_sm_fault(rport->fcs, event); |
758 | } | 759 | } |
759 | } | 760 | } |
760 | 761 | ||
@@ -816,7 +817,7 @@ bfa_fcs_rport_sm_adisc(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
816 | break; | 817 | break; |
817 | 818 | ||
818 | default: | 819 | default: |
819 | bfa_assert(0); | 820 | bfa_sm_fault(rport->fcs, event); |
820 | } | 821 | } |
821 | } | 822 | } |
822 | 823 | ||
@@ -846,7 +847,7 @@ bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport, | |||
846 | break; | 847 | break; |
847 | 848 | ||
848 | default: | 849 | default: |
849 | bfa_assert(0); | 850 | bfa_sm_fault(rport->fcs, event); |
850 | } | 851 | } |
851 | } | 852 | } |
852 | 853 | ||
@@ -869,7 +870,7 @@ bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport, | |||
869 | break; | 870 | break; |
870 | 871 | ||
871 | default: | 872 | default: |
872 | bfa_assert(0); | 873 | bfa_sm_fault(rport->fcs, event); |
873 | } | 874 | } |
874 | } | 875 | } |
875 | 876 | ||
@@ -905,7 +906,7 @@ bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport, | |||
905 | break; | 906 | break; |
906 | 907 | ||
907 | default: | 908 | default: |
908 | bfa_assert(0); | 909 | bfa_sm_fault(rport->fcs, event); |
909 | } | 910 | } |
910 | } | 911 | } |
911 | 912 | ||
@@ -925,10 +926,17 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport, | |||
925 | case RPSM_EVENT_HCB_OFFLINE: | 926 | case RPSM_EVENT_HCB_OFFLINE: |
926 | case RPSM_EVENT_ADDRESS_CHANGE: | 927 | case RPSM_EVENT_ADDRESS_CHANGE: |
927 | if (bfa_fcs_port_is_online(rport->port)) { | 928 | if (bfa_fcs_port_is_online(rport->port)) { |
928 | bfa_sm_set_state(rport, | 929 | if (bfa_fcs_fabric_is_switched(rport->port->fabric)) { |
929 | bfa_fcs_rport_sm_nsdisc_sending); | 930 | bfa_sm_set_state(rport, |
930 | rport->ns_retries = 0; | 931 | bfa_fcs_rport_sm_nsdisc_sending); |
931 | bfa_fcs_rport_send_gidpn(rport, NULL); | 932 | rport->ns_retries = 0; |
933 | bfa_fcs_rport_send_gidpn(rport, NULL); | ||
934 | } else { | ||
935 | bfa_sm_set_state(rport, | ||
936 | bfa_fcs_rport_sm_plogi_sending); | ||
937 | rport->plogi_retries = 0; | ||
938 | bfa_fcs_rport_send_plogi(rport, NULL); | ||
939 | } | ||
932 | } else { | 940 | } else { |
933 | rport->pid = 0; | 941 | rport->pid = 0; |
934 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); | 942 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); |
@@ -951,7 +959,7 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport, | |||
951 | break; | 959 | break; |
952 | 960 | ||
953 | default: | 961 | default: |
954 | bfa_assert(0); | 962 | bfa_sm_fault(rport->fcs, event); |
955 | } | 963 | } |
956 | } | 964 | } |
957 | 965 | ||
@@ -1011,7 +1019,7 @@ bfa_fcs_rport_sm_hcb_logorcv(struct bfa_fcs_rport_s *rport, | |||
1011 | break; | 1019 | break; |
1012 | 1020 | ||
1013 | default: | 1021 | default: |
1014 | bfa_assert(0); | 1022 | bfa_sm_fault(rport->fcs, event); |
1015 | } | 1023 | } |
1016 | } | 1024 | } |
1017 | 1025 | ||
@@ -1038,7 +1046,7 @@ bfa_fcs_rport_sm_hcb_logosend(struct bfa_fcs_rport_s *rport, | |||
1038 | break; | 1046 | break; |
1039 | 1047 | ||
1040 | default: | 1048 | default: |
1041 | bfa_assert(0); | 1049 | bfa_sm_fault(rport->fcs, event); |
1042 | } | 1050 | } |
1043 | } | 1051 | } |
1044 | 1052 | ||
@@ -1073,7 +1081,7 @@ bfa_fcs_rport_sm_logo_sending(struct bfa_fcs_rport_s *rport, | |||
1073 | break; | 1081 | break; |
1074 | 1082 | ||
1075 | default: | 1083 | default: |
1076 | bfa_assert(0); | 1084 | bfa_sm_fault(rport->fcs, event); |
1077 | } | 1085 | } |
1078 | } | 1086 | } |
1079 | 1087 | ||
@@ -1132,7 +1140,7 @@ bfa_fcs_rport_sm_offline(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
1132 | break; | 1140 | break; |
1133 | 1141 | ||
1134 | default: | 1142 | default: |
1135 | bfa_assert(0); | 1143 | bfa_sm_fault(rport->fcs, event); |
1136 | } | 1144 | } |
1137 | } | 1145 | } |
1138 | 1146 | ||
@@ -1188,7 +1196,7 @@ bfa_fcs_rport_sm_nsdisc_sending(struct bfa_fcs_rport_s *rport, | |||
1188 | break; | 1196 | break; |
1189 | 1197 | ||
1190 | default: | 1198 | default: |
1191 | bfa_assert(0); | 1199 | bfa_sm_fault(rport->fcs, event); |
1192 | } | 1200 | } |
1193 | } | 1201 | } |
1194 | 1202 | ||
@@ -1249,7 +1257,7 @@ bfa_fcs_rport_sm_nsdisc_retry(struct bfa_fcs_rport_s *rport, | |||
1249 | break; | 1257 | break; |
1250 | 1258 | ||
1251 | default: | 1259 | default: |
1252 | bfa_assert(0); | 1260 | bfa_sm_fault(rport->fcs, event); |
1253 | } | 1261 | } |
1254 | } | 1262 | } |
1255 | 1263 | ||
@@ -1334,7 +1342,7 @@ bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport, | |||
1334 | break; | 1342 | break; |
1335 | 1343 | ||
1336 | default: | 1344 | default: |
1337 | bfa_assert(0); | 1345 | bfa_sm_fault(rport->fcs, event); |
1338 | } | 1346 | } |
1339 | } | 1347 | } |
1340 | 1348 | ||
@@ -1366,7 +1374,7 @@ bfa_fcs_rport_send_plogi(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
1366 | len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid, | 1374 | len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid, |
1367 | bfa_fcs_port_get_fcid(port), 0, | 1375 | bfa_fcs_port_get_fcid(port), 0, |
1368 | port->port_cfg.pwwn, port->port_cfg.nwwn, | 1376 | port->port_cfg.pwwn, port->port_cfg.nwwn, |
1369 | bfa_pport_get_maxfrsize(port->fcs->bfa)); | 1377 | bfa_fcport_get_maxfrsize(port->fcs->bfa)); |
1370 | 1378 | ||
1371 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, | 1379 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, |
1372 | FC_CLASS_3, len, &fchs, bfa_fcs_rport_plogi_response, | 1380 | FC_CLASS_3, len, &fchs, bfa_fcs_rport_plogi_response, |
@@ -1478,7 +1486,7 @@ bfa_fcs_rport_send_plogiacc(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
1478 | len = fc_plogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid, | 1486 | len = fc_plogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid, |
1479 | bfa_fcs_port_get_fcid(port), rport->reply_oxid, | 1487 | bfa_fcs_port_get_fcid(port), rport->reply_oxid, |
1480 | port->port_cfg.pwwn, port->port_cfg.nwwn, | 1488 | port->port_cfg.pwwn, port->port_cfg.nwwn, |
1481 | bfa_pport_get_maxfrsize(port->fcs->bfa)); | 1489 | bfa_fcport_get_maxfrsize(port->fcs->bfa)); |
1482 | 1490 | ||
1483 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, | 1491 | bfa_fcxp_send(fcxp, NULL, port->fabric->vf_id, port->lp_tag, BFA_FALSE, |
1484 | FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0); | 1492 | FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0); |
@@ -1813,7 +1821,7 @@ bfa_fcs_rport_process_rpsc(struct bfa_fcs_rport_s *rport, | |||
1813 | /* | 1821 | /* |
1814 | * get curent speed from pport attributes from BFA | 1822 | * get curent speed from pport attributes from BFA |
1815 | */ | 1823 | */ |
1816 | bfa_pport_get_attr(port->fcs->bfa, &pport_attr); | 1824 | bfa_fcport_get_attr(port->fcs->bfa, &pport_attr); |
1817 | 1825 | ||
1818 | speeds.port_op_speed = fc_bfa_speed_to_rpsc_operspeed(pport_attr.speed); | 1826 | speeds.port_op_speed = fc_bfa_speed_to_rpsc_operspeed(pport_attr.speed); |
1819 | 1827 | ||
@@ -2032,13 +2040,10 @@ bfa_fcs_rport_aen_post(struct bfa_fcs_rport_s *rport, | |||
2032 | 2040 | ||
2033 | switch (event) { | 2041 | switch (event) { |
2034 | case BFA_RPORT_AEN_ONLINE: | 2042 | case BFA_RPORT_AEN_ONLINE: |
2035 | bfa_log(logmod, BFA_AEN_RPORT_ONLINE, rpwwn_ptr, lpwwn_ptr); | ||
2036 | break; | ||
2037 | case BFA_RPORT_AEN_OFFLINE: | 2043 | case BFA_RPORT_AEN_OFFLINE: |
2038 | bfa_log(logmod, BFA_AEN_RPORT_OFFLINE, rpwwn_ptr, lpwwn_ptr); | ||
2039 | break; | ||
2040 | case BFA_RPORT_AEN_DISCONNECT: | 2044 | case BFA_RPORT_AEN_DISCONNECT: |
2041 | bfa_log(logmod, BFA_AEN_RPORT_DISCONNECT, rpwwn_ptr, lpwwn_ptr); | 2045 | bfa_log(logmod, BFA_LOG_CREATE_ID(BFA_AEN_CAT_RPORT, event), |
2046 | rpwwn_ptr, lpwwn_ptr); | ||
2042 | break; | 2047 | break; |
2043 | case BFA_RPORT_AEN_QOS_PRIO: | 2048 | case BFA_RPORT_AEN_QOS_PRIO: |
2044 | aen_data.rport.priv.qos = data->priv.qos; | 2049 | aen_data.rport.priv.qos = data->priv.qos; |
@@ -2164,7 +2169,7 @@ bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi) | |||
2164 | bfa_trc(port->fcs, port->fabric->bb_credit); | 2169 | bfa_trc(port->fcs, port->fabric->bb_credit); |
2165 | 2170 | ||
2166 | port->fabric->bb_credit = bfa_os_ntohs(plogi->csp.bbcred); | 2171 | port->fabric->bb_credit = bfa_os_ntohs(plogi->csp.bbcred); |
2167 | bfa_pport_set_tx_bbcredit(port->fcs->bfa, | 2172 | bfa_fcport_set_tx_bbcredit(port->fcs->bfa, |
2168 | port->fabric->bb_credit); | 2173 | port->fabric->bb_credit); |
2169 | } | 2174 | } |
2170 | 2175 | ||
@@ -2575,23 +2580,6 @@ bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs, | |||
2575 | } | 2580 | } |
2576 | 2581 | ||
2577 | /** | 2582 | /** |
2578 | * Module initialization | ||
2579 | */ | ||
2580 | void | ||
2581 | bfa_fcs_rport_modinit(struct bfa_fcs_s *fcs) | ||
2582 | { | ||
2583 | } | ||
2584 | |||
2585 | /** | ||
2586 | * Module cleanup | ||
2587 | */ | ||
2588 | void | ||
2589 | bfa_fcs_rport_modexit(struct bfa_fcs_s *fcs) | ||
2590 | { | ||
2591 | bfa_fcs_modexit_comp(fcs); | ||
2592 | } | ||
2593 | |||
2594 | /** | ||
2595 | * Return state of rport. | 2583 | * Return state of rport. |
2596 | */ | 2584 | */ |
2597 | int | 2585 | int |
diff --git a/drivers/scsi/bfa/rport_api.c b/drivers/scsi/bfa/rport_api.c index 3dae1774181e..a441f41d2a64 100644 --- a/drivers/scsi/bfa/rport_api.c +++ b/drivers/scsi/bfa/rport_api.c | |||
@@ -102,7 +102,7 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport, | |||
102 | rport_attr->qos_attr = qos_attr; | 102 | rport_attr->qos_attr = qos_attr; |
103 | 103 | ||
104 | rport_attr->trl_enforced = BFA_FALSE; | 104 | rport_attr->trl_enforced = BFA_FALSE; |
105 | if (bfa_pport_is_ratelim(port->fcs->bfa)) { | 105 | if (bfa_fcport_is_ratelim(port->fcs->bfa)) { |
106 | if ((rport->rpf.rpsc_speed == BFA_PPORT_SPEED_UNKNOWN) || | 106 | if ((rport->rpf.rpsc_speed == BFA_PPORT_SPEED_UNKNOWN) || |
107 | (rport->rpf.rpsc_speed < | 107 | (rport->rpf.rpsc_speed < |
108 | bfa_fcs_port_get_rport_max_speed(port))) | 108 | bfa_fcs_port_get_rport_max_speed(port))) |
diff --git a/drivers/scsi/bfa/rport_ftrs.c b/drivers/scsi/bfa/rport_ftrs.c index e1932c885ac2..ae7bba67ae2a 100644 --- a/drivers/scsi/bfa/rport_ftrs.c +++ b/drivers/scsi/bfa/rport_ftrs.c | |||
@@ -91,7 +91,7 @@ bfa_fcs_rpf_sm_uninit(struct bfa_fcs_rpf_s *rpf, enum rpf_event event) | |||
91 | break; | 91 | break; |
92 | 92 | ||
93 | default: | 93 | default: |
94 | bfa_assert(0); | 94 | bfa_sm_fault(rport->fcs, event); |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
@@ -114,7 +114,7 @@ bfa_fcs_rpf_sm_rpsc_sending(struct bfa_fcs_rpf_s *rpf, enum rpf_event event) | |||
114 | break; | 114 | break; |
115 | 115 | ||
116 | default: | 116 | default: |
117 | bfa_assert(0); | 117 | bfa_sm_fault(rport->fcs, event); |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
@@ -160,7 +160,7 @@ bfa_fcs_rpf_sm_rpsc(struct bfa_fcs_rpf_s *rpf, enum rpf_event event) | |||
160 | break; | 160 | break; |
161 | 161 | ||
162 | default: | 162 | default: |
163 | bfa_assert(0); | 163 | bfa_sm_fault(rport->fcs, event); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
@@ -186,7 +186,7 @@ bfa_fcs_rpf_sm_rpsc_retry(struct bfa_fcs_rpf_s *rpf, enum rpf_event event) | |||
186 | break; | 186 | break; |
187 | 187 | ||
188 | default: | 188 | default: |
189 | bfa_assert(0); | 189 | bfa_sm_fault(rport->fcs, event); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
@@ -206,7 +206,7 @@ bfa_fcs_rpf_sm_online(struct bfa_fcs_rpf_s *rpf, enum rpf_event event) | |||
206 | break; | 206 | break; |
207 | 207 | ||
208 | default: | 208 | default: |
209 | bfa_assert(0); | 209 | bfa_sm_fault(rport->fcs, event); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
@@ -229,7 +229,7 @@ bfa_fcs_rpf_sm_offline(struct bfa_fcs_rpf_s *rpf, enum rpf_event event) | |||
229 | break; | 229 | break; |
230 | 230 | ||
231 | default: | 231 | default: |
232 | bfa_assert(0); | 232 | bfa_sm_fault(rport->fcs, event); |
233 | } | 233 | } |
234 | } | 234 | } |
235 | /** | 235 | /** |
diff --git a/drivers/scsi/bfa/scn.c b/drivers/scsi/bfa/scn.c index bd4771ff62c8..8fe09ba88a91 100644 --- a/drivers/scsi/bfa/scn.c +++ b/drivers/scsi/bfa/scn.c | |||
@@ -90,7 +90,7 @@ bfa_fcs_port_scn_sm_offline(struct bfa_fcs_port_scn_s *scn, | |||
90 | break; | 90 | break; |
91 | 91 | ||
92 | default: | 92 | default: |
93 | bfa_assert(0); | 93 | bfa_sm_fault(scn->port->fcs, event); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | 96 | ||
@@ -109,7 +109,7 @@ bfa_fcs_port_scn_sm_sending_scr(struct bfa_fcs_port_scn_s *scn, | |||
109 | break; | 109 | break; |
110 | 110 | ||
111 | default: | 111 | default: |
112 | bfa_assert(0); | 112 | bfa_sm_fault(scn->port->fcs, event); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
@@ -137,7 +137,7 @@ bfa_fcs_port_scn_sm_scr(struct bfa_fcs_port_scn_s *scn, | |||
137 | break; | 137 | break; |
138 | 138 | ||
139 | default: | 139 | default: |
140 | bfa_assert(0); | 140 | bfa_sm_fault(scn->port->fcs, event); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
@@ -157,7 +157,7 @@ bfa_fcs_port_scn_sm_scr_retry(struct bfa_fcs_port_scn_s *scn, | |||
157 | break; | 157 | break; |
158 | 158 | ||
159 | default: | 159 | default: |
160 | bfa_assert(0); | 160 | bfa_sm_fault(scn->port->fcs, event); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
@@ -171,7 +171,7 @@ bfa_fcs_port_scn_sm_online(struct bfa_fcs_port_scn_s *scn, | |||
171 | break; | 171 | break; |
172 | 172 | ||
173 | default: | 173 | default: |
174 | bfa_assert(0); | 174 | bfa_sm_fault(scn->port->fcs, event); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
diff --git a/drivers/scsi/bfa/vport.c b/drivers/scsi/bfa/vport.c index e90f1e38c32d..27cd619a227a 100644 --- a/drivers/scsi/bfa/vport.c +++ b/drivers/scsi/bfa/vport.c | |||
@@ -122,7 +122,7 @@ bfa_fcs_vport_sm_uninit(struct bfa_fcs_vport_s *vport, | |||
122 | break; | 122 | break; |
123 | 123 | ||
124 | default: | 124 | default: |
125 | bfa_assert(0); | 125 | bfa_sm_fault(__vport_fcs(vport), event); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
@@ -165,7 +165,7 @@ bfa_fcs_vport_sm_created(struct bfa_fcs_vport_s *vport, | |||
165 | break; | 165 | break; |
166 | 166 | ||
167 | default: | 167 | default: |
168 | bfa_assert(0); | 168 | bfa_sm_fault(__vport_fcs(vport), event); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
@@ -202,7 +202,7 @@ bfa_fcs_vport_sm_offline(struct bfa_fcs_vport_s *vport, | |||
202 | break; | 202 | break; |
203 | 203 | ||
204 | default: | 204 | default: |
205 | bfa_assert(0); | 205 | bfa_sm_fault(__vport_fcs(vport), event); |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
@@ -249,7 +249,7 @@ bfa_fcs_vport_sm_fdisc(struct bfa_fcs_vport_s *vport, | |||
249 | break; | 249 | break; |
250 | 250 | ||
251 | default: | 251 | default: |
252 | bfa_assert(0); | 252 | bfa_sm_fault(__vport_fcs(vport), event); |
253 | } | 253 | } |
254 | } | 254 | } |
255 | 255 | ||
@@ -283,7 +283,7 @@ bfa_fcs_vport_sm_fdisc_retry(struct bfa_fcs_vport_s *vport, | |||
283 | break; | 283 | break; |
284 | 284 | ||
285 | default: | 285 | default: |
286 | bfa_assert(0); | 286 | bfa_sm_fault(__vport_fcs(vport), event); |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
@@ -310,7 +310,7 @@ bfa_fcs_vport_sm_online(struct bfa_fcs_vport_s *vport, | |||
310 | break; | 310 | break; |
311 | 311 | ||
312 | default: | 312 | default: |
313 | bfa_assert(0); | 313 | bfa_sm_fault(__vport_fcs(vport), event); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
@@ -339,7 +339,7 @@ bfa_fcs_vport_sm_deleting(struct bfa_fcs_vport_s *vport, | |||
339 | break; | 339 | break; |
340 | 340 | ||
341 | default: | 341 | default: |
342 | bfa_assert(0); | 342 | bfa_sm_fault(__vport_fcs(vport), event); |
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ||
@@ -387,7 +387,7 @@ bfa_fcs_vport_sm_cleanup(struct bfa_fcs_vport_s *vport, | |||
387 | break; | 387 | break; |
388 | 388 | ||
389 | default: | 389 | default: |
390 | bfa_assert(0); | 390 | bfa_sm_fault(__vport_fcs(vport), event); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | 393 | ||
@@ -419,7 +419,7 @@ bfa_fcs_vport_sm_logo(struct bfa_fcs_vport_s *vport, | |||
419 | break; | 419 | break; |
420 | 420 | ||
421 | default: | 421 | default: |
422 | bfa_assert(0); | 422 | bfa_sm_fault(__vport_fcs(vport), event); |
423 | } | 423 | } |
424 | } | 424 | } |
425 | 425 | ||
@@ -447,22 +447,8 @@ bfa_fcs_vport_aen_post(bfa_fcs_lport_t *port, enum bfa_lport_aen_event event) | |||
447 | 447 | ||
448 | bfa_assert(role <= BFA_PORT_ROLE_FCP_MAX); | 448 | bfa_assert(role <= BFA_PORT_ROLE_FCP_MAX); |
449 | 449 | ||
450 | switch (event) { | 450 | bfa_log(logmod, BFA_LOG_CREATE_ID(BFA_AEN_CAT_LPORT, event), lpwwn_ptr, |
451 | case BFA_LPORT_AEN_NPIV_DUP_WWN: | 451 | role_str[role/2]); |
452 | bfa_log(logmod, BFA_AEN_LPORT_NPIV_DUP_WWN, lpwwn_ptr, | ||
453 | role_str[role / 2]); | ||
454 | break; | ||
455 | case BFA_LPORT_AEN_NPIV_FABRIC_MAX: | ||
456 | bfa_log(logmod, BFA_AEN_LPORT_NPIV_FABRIC_MAX, lpwwn_ptr, | ||
457 | role_str[role / 2]); | ||
458 | break; | ||
459 | case BFA_LPORT_AEN_NPIV_UNKNOWN: | ||
460 | bfa_log(logmod, BFA_AEN_LPORT_NPIV_UNKNOWN, lpwwn_ptr, | ||
461 | role_str[role / 2]); | ||
462 | break; | ||
463 | default: | ||
464 | break; | ||
465 | } | ||
466 | 452 | ||
467 | aen_data.lport.vf_id = port->fabric->vf_id; | 453 | aen_data.lport.vf_id = port->fabric->vf_id; |
468 | aen_data.lport.roles = role; | 454 | aen_data.lport.roles = role; |
@@ -478,7 +464,7 @@ static void | |||
478 | bfa_fcs_vport_do_fdisc(struct bfa_fcs_vport_s *vport) | 464 | bfa_fcs_vport_do_fdisc(struct bfa_fcs_vport_s *vport) |
479 | { | 465 | { |
480 | bfa_lps_fdisc(vport->lps, vport, | 466 | bfa_lps_fdisc(vport->lps, vport, |
481 | bfa_pport_get_maxfrsize(__vport_bfa(vport)), | 467 | bfa_fcport_get_maxfrsize(__vport_bfa(vport)), |
482 | __vport_pwwn(vport), __vport_nwwn(vport)); | 468 | __vport_pwwn(vport), __vport_nwwn(vport)); |
483 | vport->vport_stats.fdisc_sent++; | 469 | vport->vport_stats.fdisc_sent++; |
484 | } | 470 | } |
@@ -617,38 +603,6 @@ bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport) | |||
617 | } | 603 | } |
618 | 604 | ||
619 | /** | 605 | /** |
620 | * Module initialization | ||
621 | */ | ||
622 | void | ||
623 | bfa_fcs_vport_modinit(struct bfa_fcs_s *fcs) | ||
624 | { | ||
625 | } | ||
626 | |||
627 | /** | ||
628 | * Module cleanup | ||
629 | */ | ||
630 | void | ||
631 | bfa_fcs_vport_modexit(struct bfa_fcs_s *fcs) | ||
632 | { | ||
633 | bfa_fcs_modexit_comp(fcs); | ||
634 | } | ||
635 | |||
636 | u32 | ||
637 | bfa_fcs_vport_get_max(struct bfa_fcs_s *fcs) | ||
638 | { | ||
639 | struct bfa_ioc_attr_s ioc_attr; | ||
640 | |||
641 | bfa_get_attr(fcs->bfa, &ioc_attr); | ||
642 | |||
643 | if (ioc_attr.pci_attr.device_id == BFA_PCI_DEVICE_ID_CT) | ||
644 | return BFA_FCS_MAX_VPORTS_SUPP_CT; | ||
645 | else | ||
646 | return BFA_FCS_MAX_VPORTS_SUPP_CB; | ||
647 | } | ||
648 | |||
649 | |||
650 | |||
651 | /** | ||
652 | * fcs_vport_api Virtual port API | 606 | * fcs_vport_api Virtual port API |
653 | */ | 607 | */ |
654 | 608 | ||
@@ -684,7 +638,7 @@ bfa_fcs_vport_create(struct bfa_fcs_vport_s *vport, struct bfa_fcs_s *fcs, | |||
684 | return BFA_STATUS_VPORT_EXISTS; | 638 | return BFA_STATUS_VPORT_EXISTS; |
685 | 639 | ||
686 | if (bfa_fcs_fabric_vport_count(&fcs->fabric) == | 640 | if (bfa_fcs_fabric_vport_count(&fcs->fabric) == |
687 | bfa_fcs_vport_get_max(fcs)) | 641 | bfa_lps_get_max_vport(fcs->bfa)) |
688 | return BFA_STATUS_VPORT_MAX; | 642 | return BFA_STATUS_VPORT_MAX; |
689 | 643 | ||
690 | vport->lps = bfa_lps_alloc(fcs->bfa); | 644 | vport->lps = bfa_lps_alloc(fcs->bfa); |
@@ -694,7 +648,8 @@ bfa_fcs_vport_create(struct bfa_fcs_vport_s *vport, struct bfa_fcs_s *fcs, | |||
694 | vport->vport_drv = vport_drv; | 648 | vport->vport_drv = vport_drv; |
695 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_uninit); | 649 | bfa_sm_set_state(vport, bfa_fcs_vport_sm_uninit); |
696 | 650 | ||
697 | bfa_fcs_lport_init(&vport->lport, fcs, vf_id, vport_cfg, vport); | 651 | bfa_fcs_lport_attach(&vport->lport, fcs, vf_id, vport); |
652 | bfa_fcs_lport_init(&vport->lport, vport_cfg); | ||
698 | 653 | ||
699 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_CREATE); | 654 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_CREATE); |
700 | 655 | ||
@@ -888,4 +843,15 @@ bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg) | |||
888 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_OK); | 843 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_RSP_OK); |
889 | } | 844 | } |
890 | 845 | ||
846 | /** | ||
847 | * Received clear virtual link | ||
848 | */ | ||
849 | void | ||
850 | bfa_cb_lps_cvl_event(void *bfad, void *uarg) | ||
851 | { | ||
852 | struct bfa_fcs_vport_s *vport = uarg; | ||
891 | 853 | ||
854 | /* Send an Offline followed by an ONLINE */ | ||
855 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_OFFLINE); | ||
856 | bfa_sm_send_event(vport, BFA_FCS_VPORT_SM_ONLINE); | ||
857 | } | ||