diff options
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcport.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_fcport.c | 1709 |
1 files changed, 965 insertions, 744 deletions
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 | ||