blob: 9272840a2409fe6075c26604d9d62bc135e0774c [file] [log] [blame]
Jing Huang7725ccf2009-09-23 17:46:15 -07001/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07002 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
Jing Huang7725ccf2009-09-23 17:46:15 -07003 * All rights reserved
4 * www.brocade.com
5 *
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
Jing Huang5fbe25c2010-10-18 17:17:23 -070018/*
Jing Huang7725ccf2009-09-23 17:46:15 -070019 * fcpim.c - FCP initiator mode i-t nexus state machine
20 */
21
Maggie Zhangf16a1752010-12-09 19:12:32 -080022#include "bfad_drv.h"
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070023#include "bfa_fcs.h"
24#include "bfa_fcbuild.h"
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070025#include "bfad_im.h"
Jing Huang7725ccf2009-09-23 17:46:15 -070026
27BFA_TRC_FILE(FCS, FCPIM);
28
29/*
30 * forward declarations
31 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070032static void bfa_fcs_itnim_timeout(void *arg);
33static void bfa_fcs_itnim_free(struct bfa_fcs_itnim_s *itnim);
34static void bfa_fcs_itnim_send_prli(void *itnim_cbarg,
Jing Huang7725ccf2009-09-23 17:46:15 -070035 struct bfa_fcxp_s *fcxp_alloced);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070036static void bfa_fcs_itnim_prli_response(void *fcsarg,
37 struct bfa_fcxp_s *fcxp, void *cbarg,
38 bfa_status_t req_status, u32 rsp_len,
39 u32 resid_len, struct fchs_s *rsp_fchs);
Krishna Gudipati7826f302011-07-20 16:59:13 -070040static void bfa_fcs_itnim_aen_post(struct bfa_fcs_itnim_s *itnim,
41 enum bfa_itnim_aen_event event);
Jing Huang7725ccf2009-09-23 17:46:15 -070042
Jing Huang5fbe25c2010-10-18 17:17:23 -070043/*
Jing Huang7725ccf2009-09-23 17:46:15 -070044 * fcs_itnim_sm FCS itnim state machine events
45 */
46
47enum bfa_fcs_itnim_event {
48 BFA_FCS_ITNIM_SM_ONLINE = 1, /* rport online event */
49 BFA_FCS_ITNIM_SM_OFFLINE = 2, /* rport offline */
50 BFA_FCS_ITNIM_SM_FRMSENT = 3, /* prli frame is sent */
51 BFA_FCS_ITNIM_SM_RSP_OK = 4, /* good response */
52 BFA_FCS_ITNIM_SM_RSP_ERROR = 5, /* error response */
53 BFA_FCS_ITNIM_SM_TIMEOUT = 6, /* delay timeout */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070054 BFA_FCS_ITNIM_SM_HCB_OFFLINE = 7, /* BFA online callback */
55 BFA_FCS_ITNIM_SM_HCB_ONLINE = 8, /* BFA offline callback */
Jing Huang7725ccf2009-09-23 17:46:15 -070056 BFA_FCS_ITNIM_SM_INITIATOR = 9, /* rport is initiator */
57 BFA_FCS_ITNIM_SM_DELETE = 10, /* delete event from rport */
58 BFA_FCS_ITNIM_SM_PRLO = 11, /* delete event from rport */
Krishna Gudipatid7be54c2011-06-24 20:24:52 -070059 BFA_FCS_ITNIM_SM_RSP_NOT_SUPP = 12, /* cmd not supported rsp */
Jing Huang7725ccf2009-09-23 17:46:15 -070060};
61
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070062static void bfa_fcs_itnim_sm_offline(struct bfa_fcs_itnim_s *itnim,
Jing Huang7725ccf2009-09-23 17:46:15 -070063 enum bfa_fcs_itnim_event event);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070064static void bfa_fcs_itnim_sm_prli_send(struct bfa_fcs_itnim_s *itnim,
Jing Huang7725ccf2009-09-23 17:46:15 -070065 enum bfa_fcs_itnim_event event);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070066static void bfa_fcs_itnim_sm_prli(struct bfa_fcs_itnim_s *itnim,
Jing Huang7725ccf2009-09-23 17:46:15 -070067 enum bfa_fcs_itnim_event event);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070068static void bfa_fcs_itnim_sm_prli_retry(struct bfa_fcs_itnim_s *itnim,
Jing Huang7725ccf2009-09-23 17:46:15 -070069 enum bfa_fcs_itnim_event event);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070070static void bfa_fcs_itnim_sm_hcb_online(struct bfa_fcs_itnim_s *itnim,
Jing Huang7725ccf2009-09-23 17:46:15 -070071 enum bfa_fcs_itnim_event event);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070072static void bfa_fcs_itnim_sm_online(struct bfa_fcs_itnim_s *itnim,
Jing Huang7725ccf2009-09-23 17:46:15 -070073 enum bfa_fcs_itnim_event event);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070074static void bfa_fcs_itnim_sm_hcb_offline(struct bfa_fcs_itnim_s *itnim,
Jing Huang7725ccf2009-09-23 17:46:15 -070075 enum bfa_fcs_itnim_event event);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070076static void bfa_fcs_itnim_sm_initiator(struct bfa_fcs_itnim_s *itnim,
Jing Huang7725ccf2009-09-23 17:46:15 -070077 enum bfa_fcs_itnim_event event);
78
79static struct bfa_sm_table_s itnim_sm_table[] = {
80 {BFA_SM(bfa_fcs_itnim_sm_offline), BFA_ITNIM_OFFLINE},
81 {BFA_SM(bfa_fcs_itnim_sm_prli_send), BFA_ITNIM_PRLI_SEND},
82 {BFA_SM(bfa_fcs_itnim_sm_prli), BFA_ITNIM_PRLI_SENT},
83 {BFA_SM(bfa_fcs_itnim_sm_prli_retry), BFA_ITNIM_PRLI_RETRY},
84 {BFA_SM(bfa_fcs_itnim_sm_hcb_online), BFA_ITNIM_HCB_ONLINE},
85 {BFA_SM(bfa_fcs_itnim_sm_online), BFA_ITNIM_ONLINE},
86 {BFA_SM(bfa_fcs_itnim_sm_hcb_offline), BFA_ITNIM_HCB_OFFLINE},
87 {BFA_SM(bfa_fcs_itnim_sm_initiator), BFA_ITNIM_INITIATIOR},
88};
89
Jing Huang5fbe25c2010-10-18 17:17:23 -070090/*
Jing Huang7725ccf2009-09-23 17:46:15 -070091 * fcs_itnim_sm FCS itnim state machine
92 */
93
94static void
95bfa_fcs_itnim_sm_offline(struct bfa_fcs_itnim_s *itnim,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070096 enum bfa_fcs_itnim_event event)
Jing Huang7725ccf2009-09-23 17:46:15 -070097{
98 bfa_trc(itnim->fcs, itnim->rport->pwwn);
99 bfa_trc(itnim->fcs, event);
100
101 switch (event) {
102 case BFA_FCS_ITNIM_SM_ONLINE:
103 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_prli_send);
Jing Huang41188cf2010-07-08 19:52:00 -0700104 itnim->prli_retries = 0;
Jing Huang7725ccf2009-09-23 17:46:15 -0700105 bfa_fcs_itnim_send_prli(itnim, NULL);
106 break;
107
108 case BFA_FCS_ITNIM_SM_OFFLINE:
Maggie Zhangf7f738122010-12-09 19:08:43 -0800109 bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE);
Jing Huang7725ccf2009-09-23 17:46:15 -0700110 break;
111
112 case BFA_FCS_ITNIM_SM_INITIATOR:
113 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_initiator);
114 break;
115
116 case BFA_FCS_ITNIM_SM_DELETE:
117 bfa_fcs_itnim_free(itnim);
118 break;
119
120 default:
Krishna Gudipatie641de32010-03-05 19:35:02 -0800121 bfa_sm_fault(itnim->fcs, event);
Jing Huang7725ccf2009-09-23 17:46:15 -0700122 }
123
124}
125
126static void
127bfa_fcs_itnim_sm_prli_send(struct bfa_fcs_itnim_s *itnim,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700128 enum bfa_fcs_itnim_event event)
Jing Huang7725ccf2009-09-23 17:46:15 -0700129{
130 bfa_trc(itnim->fcs, itnim->rport->pwwn);
131 bfa_trc(itnim->fcs, event);
132
133 switch (event) {
134 case BFA_FCS_ITNIM_SM_FRMSENT:
135 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_prli);
136 break;
137
138 case BFA_FCS_ITNIM_SM_INITIATOR:
139 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_initiator);
140 bfa_fcxp_walloc_cancel(itnim->fcs->bfa, &itnim->fcxp_wqe);
141 break;
142
143 case BFA_FCS_ITNIM_SM_OFFLINE:
144 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
145 bfa_fcxp_walloc_cancel(itnim->fcs->bfa, &itnim->fcxp_wqe);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800146 bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE);
Jing Huang7725ccf2009-09-23 17:46:15 -0700147 break;
148
149 case BFA_FCS_ITNIM_SM_DELETE:
150 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
151 bfa_fcxp_walloc_cancel(itnim->fcs->bfa, &itnim->fcxp_wqe);
152 bfa_fcs_itnim_free(itnim);
153 break;
154
155 default:
Krishna Gudipatie641de32010-03-05 19:35:02 -0800156 bfa_sm_fault(itnim->fcs, event);
Jing Huang7725ccf2009-09-23 17:46:15 -0700157 }
158}
159
160static void
161bfa_fcs_itnim_sm_prli(struct bfa_fcs_itnim_s *itnim,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700162 enum bfa_fcs_itnim_event event)
Jing Huang7725ccf2009-09-23 17:46:15 -0700163{
164 bfa_trc(itnim->fcs, itnim->rport->pwwn);
165 bfa_trc(itnim->fcs, event);
166
167 switch (event) {
168 case BFA_FCS_ITNIM_SM_RSP_OK:
Jing Huang4b5e7592010-07-08 19:55:41 -0700169 if (itnim->rport->scsi_function == BFA_RPORT_INITIATOR) {
170 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_initiator);
171 } else {
172 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_hcb_online);
173 bfa_itnim_online(itnim->bfa_itnim, itnim->seq_rec);
174 }
Jing Huang7725ccf2009-09-23 17:46:15 -0700175 break;
176
177 case BFA_FCS_ITNIM_SM_RSP_ERROR:
178 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_prli_retry);
179 bfa_timer_start(itnim->fcs->bfa, &itnim->timer,
180 bfa_fcs_itnim_timeout, itnim,
181 BFA_FCS_RETRY_TIMEOUT);
182 break;
183
Krishna Gudipatid7be54c2011-06-24 20:24:52 -0700184 case BFA_FCS_ITNIM_SM_RSP_NOT_SUPP:
185 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
186 break;
187
Jing Huang7725ccf2009-09-23 17:46:15 -0700188 case BFA_FCS_ITNIM_SM_OFFLINE:
189 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
190 bfa_fcxp_discard(itnim->fcxp);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800191 bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE);
Jing Huang7725ccf2009-09-23 17:46:15 -0700192 break;
193
194 case BFA_FCS_ITNIM_SM_INITIATOR:
195 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_initiator);
Jing Huang4b5e7592010-07-08 19:55:41 -0700196 bfa_fcxp_discard(itnim->fcxp);
Jing Huang7725ccf2009-09-23 17:46:15 -0700197 break;
198
199 case BFA_FCS_ITNIM_SM_DELETE:
200 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
201 bfa_fcxp_discard(itnim->fcxp);
202 bfa_fcs_itnim_free(itnim);
203 break;
204
205 default:
Krishna Gudipatie641de32010-03-05 19:35:02 -0800206 bfa_sm_fault(itnim->fcs, event);
Jing Huang7725ccf2009-09-23 17:46:15 -0700207 }
208}
209
210static void
211bfa_fcs_itnim_sm_prli_retry(struct bfa_fcs_itnim_s *itnim,
212 enum bfa_fcs_itnim_event event)
213{
214 bfa_trc(itnim->fcs, itnim->rport->pwwn);
215 bfa_trc(itnim->fcs, event);
216
217 switch (event) {
218 case BFA_FCS_ITNIM_SM_TIMEOUT:
Jing Huang41188cf2010-07-08 19:52:00 -0700219 if (itnim->prli_retries < BFA_FCS_RPORT_MAX_RETRIES) {
220 itnim->prli_retries++;
221 bfa_trc(itnim->fcs, itnim->prli_retries);
222 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_prli_send);
223 bfa_fcs_itnim_send_prli(itnim, NULL);
224 } else {
225 /* invoke target offline */
226 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800227 bfa_sm_send_event(itnim->rport, RPSM_EVENT_LOGO_IMP);
Jing Huang41188cf2010-07-08 19:52:00 -0700228 }
Jing Huang7725ccf2009-09-23 17:46:15 -0700229 break;
230
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700231
Jing Huang7725ccf2009-09-23 17:46:15 -0700232 case BFA_FCS_ITNIM_SM_OFFLINE:
233 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
234 bfa_timer_stop(&itnim->timer);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800235 bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE);
Jing Huang7725ccf2009-09-23 17:46:15 -0700236 break;
237
238 case BFA_FCS_ITNIM_SM_INITIATOR:
239 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_initiator);
240 bfa_timer_stop(&itnim->timer);
241 break;
242
243 case BFA_FCS_ITNIM_SM_DELETE:
244 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
245 bfa_timer_stop(&itnim->timer);
246 bfa_fcs_itnim_free(itnim);
247 break;
248
249 default:
Krishna Gudipatie641de32010-03-05 19:35:02 -0800250 bfa_sm_fault(itnim->fcs, event);
Jing Huang7725ccf2009-09-23 17:46:15 -0700251 }
252}
253
254static void
255bfa_fcs_itnim_sm_hcb_online(struct bfa_fcs_itnim_s *itnim,
256 enum bfa_fcs_itnim_event event)
257{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700258 struct bfad_s *bfad = (struct bfad_s *)itnim->fcs->bfad;
259 char lpwwn_buf[BFA_STRING_32];
260 char rpwwn_buf[BFA_STRING_32];
261
Jing Huang7725ccf2009-09-23 17:46:15 -0700262 bfa_trc(itnim->fcs, itnim->rport->pwwn);
263 bfa_trc(itnim->fcs, event);
264
265 switch (event) {
266 case BFA_FCS_ITNIM_SM_HCB_ONLINE:
267 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_online);
268 bfa_fcb_itnim_online(itnim->itnim_drv);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700269 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port));
270 wwn2str(rpwwn_buf, itnim->rport->pwwn);
Jing Huang88166242010-12-09 17:11:53 -0800271 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700272 "Target (WWN = %s) is online for initiator (WWN = %s)\n",
273 rpwwn_buf, lpwwn_buf);
Krishna Gudipati7826f302011-07-20 16:59:13 -0700274 bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_ONLINE);
Jing Huang7725ccf2009-09-23 17:46:15 -0700275 break;
276
277 case BFA_FCS_ITNIM_SM_OFFLINE:
278 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
279 bfa_itnim_offline(itnim->bfa_itnim);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800280 bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE);
Jing Huang7725ccf2009-09-23 17:46:15 -0700281 break;
282
283 case BFA_FCS_ITNIM_SM_DELETE:
284 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
285 bfa_fcs_itnim_free(itnim);
286 break;
287
288 default:
Krishna Gudipatie641de32010-03-05 19:35:02 -0800289 bfa_sm_fault(itnim->fcs, event);
Jing Huang7725ccf2009-09-23 17:46:15 -0700290 }
291}
292
293static void
294bfa_fcs_itnim_sm_online(struct bfa_fcs_itnim_s *itnim,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700295 enum bfa_fcs_itnim_event event)
Jing Huang7725ccf2009-09-23 17:46:15 -0700296{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700297 struct bfad_s *bfad = (struct bfad_s *)itnim->fcs->bfad;
298 char lpwwn_buf[BFA_STRING_32];
299 char rpwwn_buf[BFA_STRING_32];
300
Jing Huang7725ccf2009-09-23 17:46:15 -0700301 bfa_trc(itnim->fcs, itnim->rport->pwwn);
302 bfa_trc(itnim->fcs, event);
303
304 switch (event) {
305 case BFA_FCS_ITNIM_SM_OFFLINE:
306 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_hcb_offline);
307 bfa_fcb_itnim_offline(itnim->itnim_drv);
308 bfa_itnim_offline(itnim->bfa_itnim);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700309 wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(itnim->rport->port));
310 wwn2str(rpwwn_buf, itnim->rport->pwwn);
Krishna Gudipati7826f302011-07-20 16:59:13 -0700311 if (bfa_fcs_lport_is_online(itnim->rport->port) == BFA_TRUE) {
Jing Huang88166242010-12-09 17:11:53 -0800312 BFA_LOG(KERN_ERR, bfad, bfa_log_level,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700313 "Target (WWN = %s) connectivity lost for "
314 "initiator (WWN = %s)\n", rpwwn_buf, lpwwn_buf);
Krishna Gudipati7826f302011-07-20 16:59:13 -0700315 bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_DISCONNECT);
316 } else {
Jing Huang88166242010-12-09 17:11:53 -0800317 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700318 "Target (WWN = %s) offlined by initiator (WWN = %s)\n",
319 rpwwn_buf, lpwwn_buf);
Krishna Gudipati7826f302011-07-20 16:59:13 -0700320 bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_OFFLINE);
321 }
Jing Huang7725ccf2009-09-23 17:46:15 -0700322 break;
323
324 case BFA_FCS_ITNIM_SM_DELETE:
325 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
326 bfa_fcs_itnim_free(itnim);
327 break;
328
329 default:
Krishna Gudipatie641de32010-03-05 19:35:02 -0800330 bfa_sm_fault(itnim->fcs, event);
Jing Huang7725ccf2009-09-23 17:46:15 -0700331 }
332}
333
334static void
335bfa_fcs_itnim_sm_hcb_offline(struct bfa_fcs_itnim_s *itnim,
336 enum bfa_fcs_itnim_event event)
337{
338 bfa_trc(itnim->fcs, itnim->rport->pwwn);
339 bfa_trc(itnim->fcs, event);
340
341 switch (event) {
342 case BFA_FCS_ITNIM_SM_HCB_OFFLINE:
343 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800344 bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE);
Jing Huang7725ccf2009-09-23 17:46:15 -0700345 break;
346
347 case BFA_FCS_ITNIM_SM_DELETE:
348 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
349 bfa_fcs_itnim_free(itnim);
350 break;
351
352 default:
Krishna Gudipatie641de32010-03-05 19:35:02 -0800353 bfa_sm_fault(itnim->fcs, event);
Jing Huang7725ccf2009-09-23 17:46:15 -0700354 }
355}
356
357/*
358 * This state is set when a discovered rport is also in intiator mode.
359 * This ITN is marked as no_op and is not active and will not be truned into
360 * online state.
361 */
362static void
363bfa_fcs_itnim_sm_initiator(struct bfa_fcs_itnim_s *itnim,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700364 enum bfa_fcs_itnim_event event)
Jing Huang7725ccf2009-09-23 17:46:15 -0700365{
366 bfa_trc(itnim->fcs, itnim->rport->pwwn);
367 bfa_trc(itnim->fcs, event);
368
369 switch (event) {
370 case BFA_FCS_ITNIM_SM_OFFLINE:
371 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800372 bfa_sm_send_event(itnim->rport, RPSM_EVENT_FC4_OFFLINE);
Jing Huang7725ccf2009-09-23 17:46:15 -0700373 break;
374
375 case BFA_FCS_ITNIM_SM_RSP_ERROR:
376 case BFA_FCS_ITNIM_SM_ONLINE:
377 case BFA_FCS_ITNIM_SM_INITIATOR:
378 break;
379
380 case BFA_FCS_ITNIM_SM_DELETE:
381 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
382 bfa_fcs_itnim_free(itnim);
383 break;
384
385 default:
Krishna Gudipatie641de32010-03-05 19:35:02 -0800386 bfa_sm_fault(itnim->fcs, event);
Jing Huang7725ccf2009-09-23 17:46:15 -0700387 }
388}
389
Jing Huang7725ccf2009-09-23 17:46:15 -0700390static void
Krishna Gudipati7826f302011-07-20 16:59:13 -0700391bfa_fcs_itnim_aen_post(struct bfa_fcs_itnim_s *itnim,
392 enum bfa_itnim_aen_event event)
393{
394 struct bfa_fcs_rport_s *rport = itnim->rport;
395 struct bfad_s *bfad = (struct bfad_s *)itnim->fcs->bfad;
396 struct bfa_aen_entry_s *aen_entry;
397
398 /* Don't post events for well known addresses */
399 if (BFA_FCS_PID_IS_WKA(rport->pid))
400 return;
401
402 bfad_get_aen_entry(bfad, aen_entry);
403 if (!aen_entry)
404 return;
405
406 aen_entry->aen_data.itnim.vf_id = rport->port->fabric->vf_id;
407 aen_entry->aen_data.itnim.ppwwn = bfa_fcs_lport_get_pwwn(
408 bfa_fcs_get_base_port(itnim->fcs));
409 aen_entry->aen_data.itnim.lpwwn = bfa_fcs_lport_get_pwwn(rport->port);
410 aen_entry->aen_data.itnim.rpwwn = rport->pwwn;
411
412 /* Send the AEN notification */
413 bfad_im_post_vendor_event(aen_entry, bfad, ++rport->fcs->fcs_aen_seq,
414 BFA_AEN_CAT_ITNIM, event);
415}
416
417static void
Jing Huang7725ccf2009-09-23 17:46:15 -0700418bfa_fcs_itnim_send_prli(void *itnim_cbarg, struct bfa_fcxp_s *fcxp_alloced)
419{
420 struct bfa_fcs_itnim_s *itnim = itnim_cbarg;
421 struct bfa_fcs_rport_s *rport = itnim->rport;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700422 struct bfa_fcs_lport_s *port = rport->port;
423 struct fchs_s fchs;
Jing Huang7725ccf2009-09-23 17:46:15 -0700424 struct bfa_fcxp_s *fcxp;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700425 int len;
Jing Huang7725ccf2009-09-23 17:46:15 -0700426
427 bfa_trc(itnim->fcs, itnim->rport->pwwn);
428
429 fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs);
430 if (!fcxp) {
431 itnim->stats.fcxp_alloc_wait++;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700432 bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &itnim->fcxp_wqe,
Jing Huang7725ccf2009-09-23 17:46:15 -0700433 bfa_fcs_itnim_send_prli, itnim);
434 return;
435 }
436 itnim->fcxp = fcxp;
437
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700438 len = fc_prli_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
439 itnim->rport->pid, bfa_fcs_lport_get_fcid(port), 0);
Jing Huang7725ccf2009-09-23 17:46:15 -0700440
441 bfa_fcxp_send(fcxp, rport->bfa_rport, port->fabric->vf_id, port->lp_tag,
442 BFA_FALSE, FC_CLASS_3, len, &fchs,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700443 bfa_fcs_itnim_prli_response, (void *)itnim,
444 FC_MAX_PDUSZ, FC_ELS_TOV);
Jing Huang7725ccf2009-09-23 17:46:15 -0700445
446 itnim->stats.prli_sent++;
447 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_FRMSENT);
448}
449
450static void
451bfa_fcs_itnim_prli_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
452 bfa_status_t req_status, u32 rsp_len,
453 u32 resid_len, struct fchs_s *rsp_fchs)
454{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700455 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *) cbarg;
456 struct fc_els_cmd_s *els_cmd;
457 struct fc_prli_s *prli_resp;
458 struct fc_ls_rjt_s *ls_rjt;
Jing Huang7725ccf2009-09-23 17:46:15 -0700459 struct fc_prli_params_s *sparams;
460
461 bfa_trc(itnim->fcs, req_status);
462
463 /*
464 * Sanity Checks
465 */
466 if (req_status != BFA_STATUS_OK) {
467 itnim->stats.prli_rsp_err++;
468 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_RSP_ERROR);
469 return;
470 }
471
472 els_cmd = (struct fc_els_cmd_s *) BFA_FCXP_RSP_PLD(fcxp);
473
474 if (els_cmd->els_code == FC_ELS_ACC) {
475 prli_resp = (struct fc_prli_s *) els_cmd;
476
477 if (fc_prli_rsp_parse(prli_resp, rsp_len) != FC_PARSE_OK) {
478 bfa_trc(itnim->fcs, rsp_len);
479 /*
480 * Check if this r-port is also in Initiator mode.
481 * If so, we need to set this ITN as a no-op.
482 */
483 if (prli_resp->parampage.servparams.initiator) {
484 bfa_trc(itnim->fcs, prli_resp->parampage.type);
485 itnim->rport->scsi_function =
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700486 BFA_RPORT_INITIATOR;
Jing Huang7725ccf2009-09-23 17:46:15 -0700487 itnim->stats.prli_rsp_acc++;
Krishna Gudipatid7be54c2011-06-24 20:24:52 -0700488 itnim->stats.initiator++;
Jing Huang7725ccf2009-09-23 17:46:15 -0700489 bfa_sm_send_event(itnim,
Jing Huang4b5e7592010-07-08 19:55:41 -0700490 BFA_FCS_ITNIM_SM_RSP_OK);
Jing Huang7725ccf2009-09-23 17:46:15 -0700491 return;
492 }
493
494 itnim->stats.prli_rsp_parse_err++;
495 return;
496 }
497 itnim->rport->scsi_function = BFA_RPORT_TARGET;
498
499 sparams = &prli_resp->parampage.servparams;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700500 itnim->seq_rec = sparams->retry;
501 itnim->rec_support = sparams->rec_support;
Jing Huang7725ccf2009-09-23 17:46:15 -0700502 itnim->task_retry_id = sparams->task_retry_id;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700503 itnim->conf_comp = sparams->confirm;
Jing Huang7725ccf2009-09-23 17:46:15 -0700504
505 itnim->stats.prli_rsp_acc++;
506 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_RSP_OK);
507 } else {
508 ls_rjt = (struct fc_ls_rjt_s *) BFA_FCXP_RSP_PLD(fcxp);
509
510 bfa_trc(itnim->fcs, ls_rjt->reason_code);
511 bfa_trc(itnim->fcs, ls_rjt->reason_code_expl);
512
513 itnim->stats.prli_rsp_rjt++;
Krishna Gudipatid7be54c2011-06-24 20:24:52 -0700514 if (ls_rjt->reason_code == FC_LS_RJT_RSN_CMD_NOT_SUPP) {
515 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_RSP_NOT_SUPP);
516 return;
517 }
Jing Huang7725ccf2009-09-23 17:46:15 -0700518 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_RSP_ERROR);
519 }
520}
521
522static void
523bfa_fcs_itnim_timeout(void *arg)
524{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700525 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *) arg;
Jing Huang7725ccf2009-09-23 17:46:15 -0700526
527 itnim->stats.timeout++;
528 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_TIMEOUT);
529}
530
531static void
532bfa_fcs_itnim_free(struct bfa_fcs_itnim_s *itnim)
533{
534 bfa_itnim_delete(itnim->bfa_itnim);
535 bfa_fcb_itnim_free(itnim->fcs->bfad, itnim->itnim_drv);
536}
537
538
539
Jing Huang5fbe25c2010-10-18 17:17:23 -0700540/*
Jing Huang7725ccf2009-09-23 17:46:15 -0700541 * itnim_public FCS ITNIM public interfaces
542 */
543
Jing Huang5fbe25c2010-10-18 17:17:23 -0700544/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700545 * Called by rport when a new rport is created.
Jing Huang7725ccf2009-09-23 17:46:15 -0700546 *
547 * @param[in] rport - remote port.
548 */
549struct bfa_fcs_itnim_s *
550bfa_fcs_itnim_create(struct bfa_fcs_rport_s *rport)
551{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700552 struct bfa_fcs_lport_s *port = rport->port;
Jing Huang7725ccf2009-09-23 17:46:15 -0700553 struct bfa_fcs_itnim_s *itnim;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700554 struct bfad_itnim_s *itnim_drv;
Jing Huang7725ccf2009-09-23 17:46:15 -0700555 struct bfa_itnim_s *bfa_itnim;
556
557 /*
558 * call bfad to allocate the itnim
559 */
560 bfa_fcb_itnim_alloc(port->fcs->bfad, &itnim, &itnim_drv);
561 if (itnim == NULL) {
562 bfa_trc(port->fcs, rport->pwwn);
563 return NULL;
564 }
565
566 /*
567 * Initialize itnim
568 */
569 itnim->rport = rport;
570 itnim->fcs = rport->fcs;
571 itnim->itnim_drv = itnim_drv;
572
573 /*
574 * call BFA to create the itnim
575 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700576 bfa_itnim =
577 bfa_itnim_create(port->fcs->bfa, rport->bfa_rport, itnim);
Jing Huang7725ccf2009-09-23 17:46:15 -0700578
579 if (bfa_itnim == NULL) {
580 bfa_trc(port->fcs, rport->pwwn);
581 bfa_fcb_itnim_free(port->fcs->bfad, itnim_drv);
Jing Huangd4b671c2010-12-26 21:46:35 -0800582 WARN_ON(1);
Jing Huang7725ccf2009-09-23 17:46:15 -0700583 return NULL;
584 }
585
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700586 itnim->bfa_itnim = bfa_itnim;
587 itnim->seq_rec = BFA_FALSE;
588 itnim->rec_support = BFA_FALSE;
589 itnim->conf_comp = BFA_FALSE;
Jing Huang7725ccf2009-09-23 17:46:15 -0700590 itnim->task_retry_id = BFA_FALSE;
591
592 /*
593 * Set State machine
594 */
595 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
596
597 return itnim;
598}
599
Jing Huang5fbe25c2010-10-18 17:17:23 -0700600/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700601 * Called by rport to delete the instance of FCPIM.
Jing Huang7725ccf2009-09-23 17:46:15 -0700602 *
603 * @param[in] rport - remote port.
604 */
605void
606bfa_fcs_itnim_delete(struct bfa_fcs_itnim_s *itnim)
607{
608 bfa_trc(itnim->fcs, itnim->rport->pid);
609 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_DELETE);
610}
611
Jing Huang5fbe25c2010-10-18 17:17:23 -0700612/*
Jing Huang7725ccf2009-09-23 17:46:15 -0700613 * Notification from rport that PLOGI is complete to initiate FC-4 session.
614 */
615void
616bfa_fcs_itnim_rport_online(struct bfa_fcs_itnim_s *itnim)
617{
618 itnim->stats.onlines++;
619
620 if (!BFA_FCS_PID_IS_WKA(itnim->rport->pid)) {
621 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_ONLINE);
622 } else {
623 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700624 * For well known addresses, we set the itnim to initiator
625 * state
Jing Huang7725ccf2009-09-23 17:46:15 -0700626 */
627 itnim->stats.initiator++;
628 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_INITIATOR);
629 }
630}
631
Jing Huang5fbe25c2010-10-18 17:17:23 -0700632/*
Jing Huang7725ccf2009-09-23 17:46:15 -0700633 * Called by rport to handle a remote device offline.
634 */
635void
636bfa_fcs_itnim_rport_offline(struct bfa_fcs_itnim_s *itnim)
637{
638 itnim->stats.offlines++;
639 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_OFFLINE);
640}
641
Jing Huang5fbe25c2010-10-18 17:17:23 -0700642/*
Jing Huang7725ccf2009-09-23 17:46:15 -0700643 * Called by rport when remote port is known to be an initiator from
644 * PRLI received.
645 */
646void
647bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim)
648{
649 bfa_trc(itnim->fcs, itnim->rport->pid);
650 itnim->stats.initiator++;
651 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_INITIATOR);
652}
653
Jing Huang5fbe25c2010-10-18 17:17:23 -0700654/*
Jing Huang7725ccf2009-09-23 17:46:15 -0700655 * Called by rport to check if the itnim is online.
656 */
657bfa_status_t
658bfa_fcs_itnim_get_online_state(struct bfa_fcs_itnim_s *itnim)
659{
660 bfa_trc(itnim->fcs, itnim->rport->pid);
661 switch (bfa_sm_to_state(itnim_sm_table, itnim->sm)) {
662 case BFA_ITNIM_ONLINE:
663 case BFA_ITNIM_INITIATIOR:
664 return BFA_STATUS_OK;
665
666 default:
667 return BFA_STATUS_NO_FCPIM_NEXUS;
Jing Huang7725ccf2009-09-23 17:46:15 -0700668 }
669}
670
Jing Huang5fbe25c2010-10-18 17:17:23 -0700671/*
Jing Huang7725ccf2009-09-23 17:46:15 -0700672 * BFA completion callback for bfa_itnim_online().
673 */
674void
675bfa_cb_itnim_online(void *cbarg)
676{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700677 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *) cbarg;
Jing Huang7725ccf2009-09-23 17:46:15 -0700678
679 bfa_trc(itnim->fcs, itnim->rport->pwwn);
680 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_HCB_ONLINE);
681}
682
Jing Huang5fbe25c2010-10-18 17:17:23 -0700683/*
Jing Huang7725ccf2009-09-23 17:46:15 -0700684 * BFA completion callback for bfa_itnim_offline().
685 */
686void
687bfa_cb_itnim_offline(void *cb_arg)
688{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700689 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *) cb_arg;
Jing Huang7725ccf2009-09-23 17:46:15 -0700690
691 bfa_trc(itnim->fcs, itnim->rport->pwwn);
692 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_HCB_OFFLINE);
693}
694
Jing Huang5fbe25c2010-10-18 17:17:23 -0700695/*
Jing Huang7725ccf2009-09-23 17:46:15 -0700696 * Mark the beginning of PATH TOV handling. IO completion callbacks
697 * are still pending.
698 */
699void
700bfa_cb_itnim_tov_begin(void *cb_arg)
701{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700702 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *) cb_arg;
Jing Huang7725ccf2009-09-23 17:46:15 -0700703
704 bfa_trc(itnim->fcs, itnim->rport->pwwn);
Jing Huang7725ccf2009-09-23 17:46:15 -0700705}
706
Jing Huang5fbe25c2010-10-18 17:17:23 -0700707/*
Jing Huang7725ccf2009-09-23 17:46:15 -0700708 * Mark the end of PATH TOV handling. All pending IOs are already cleaned up.
709 */
710void
711bfa_cb_itnim_tov(void *cb_arg)
712{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700713 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *) cb_arg;
714 struct bfad_itnim_s *itnim_drv = itnim->itnim_drv;
Jing Huang7725ccf2009-09-23 17:46:15 -0700715
716 bfa_trc(itnim->fcs, itnim->rport->pwwn);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700717 itnim_drv->state = ITNIM_STATE_TIMEOUT;
Jing Huang7725ccf2009-09-23 17:46:15 -0700718}
719
Jing Huang5fbe25c2010-10-18 17:17:23 -0700720/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700721 * BFA notification to FCS/driver for second level error recovery.
Jing Huang7725ccf2009-09-23 17:46:15 -0700722 *
723 * Atleast one I/O request has timedout and target is unresponsive to
724 * repeated abort requests. Second level error recovery should be initiated
725 * by starting implicit logout and recovery procedures.
726 */
727void
728bfa_cb_itnim_sler(void *cb_arg)
729{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700730 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *) cb_arg;
Jing Huang7725ccf2009-09-23 17:46:15 -0700731
732 itnim->stats.sler++;
733 bfa_trc(itnim->fcs, itnim->rport->pwwn);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800734 bfa_sm_send_event(itnim->rport, RPSM_EVENT_LOGO_IMP);
Jing Huang7725ccf2009-09-23 17:46:15 -0700735}
736
737struct bfa_fcs_itnim_s *
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700738bfa_fcs_itnim_lookup(struct bfa_fcs_lport_s *port, wwn_t rpwwn)
Jing Huang7725ccf2009-09-23 17:46:15 -0700739{
740 struct bfa_fcs_rport_s *rport;
741 rport = bfa_fcs_rport_lookup(port, rpwwn);
742
743 if (!rport)
744 return NULL;
745
Jing Huangd4b671c2010-12-26 21:46:35 -0800746 WARN_ON(rport->itnim == NULL);
Jing Huangf8ceafd2009-09-25 12:29:54 -0700747 return rport->itnim;
Jing Huang7725ccf2009-09-23 17:46:15 -0700748}
749
750bfa_status_t
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700751bfa_fcs_itnim_attr_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn,
Jing Huang7725ccf2009-09-23 17:46:15 -0700752 struct bfa_itnim_attr_s *attr)
753{
754 struct bfa_fcs_itnim_s *itnim = NULL;
755
756 itnim = bfa_fcs_itnim_lookup(port, rpwwn);
757
758 if (itnim == NULL)
759 return BFA_STATUS_NO_FCPIM_NEXUS;
760
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700761 attr->state = bfa_sm_to_state(itnim_sm_table, itnim->sm);
762 attr->retry = itnim->seq_rec;
763 attr->rec_support = itnim->rec_support;
764 attr->conf_comp = itnim->conf_comp;
Jing Huang7725ccf2009-09-23 17:46:15 -0700765 attr->task_retry_id = itnim->task_retry_id;
Jing Huang7725ccf2009-09-23 17:46:15 -0700766 return BFA_STATUS_OK;
767}
768
769bfa_status_t
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700770bfa_fcs_itnim_stats_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn,
Jing Huang7725ccf2009-09-23 17:46:15 -0700771 struct bfa_itnim_stats_s *stats)
772{
773 struct bfa_fcs_itnim_s *itnim = NULL;
774
Jing Huangd4b671c2010-12-26 21:46:35 -0800775 WARN_ON(port == NULL);
Jing Huang7725ccf2009-09-23 17:46:15 -0700776
777 itnim = bfa_fcs_itnim_lookup(port, rpwwn);
778
779 if (itnim == NULL)
780 return BFA_STATUS_NO_FCPIM_NEXUS;
781
Jing Huang6a18b162010-10-18 17:08:54 -0700782 memcpy(stats, &itnim->stats, sizeof(struct bfa_itnim_stats_s));
Jing Huang7725ccf2009-09-23 17:46:15 -0700783
784 return BFA_STATUS_OK;
785}
786
787bfa_status_t
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700788bfa_fcs_itnim_stats_clear(struct bfa_fcs_lport_s *port, wwn_t rpwwn)
Jing Huang7725ccf2009-09-23 17:46:15 -0700789{
790 struct bfa_fcs_itnim_s *itnim = NULL;
791
Jing Huangd4b671c2010-12-26 21:46:35 -0800792 WARN_ON(port == NULL);
Jing Huang7725ccf2009-09-23 17:46:15 -0700793
794 itnim = bfa_fcs_itnim_lookup(port, rpwwn);
795
796 if (itnim == NULL)
797 return BFA_STATUS_NO_FCPIM_NEXUS;
798
Jing Huang6a18b162010-10-18 17:08:54 -0700799 memset(&itnim->stats, 0, sizeof(struct bfa_itnim_stats_s));
Jing Huang7725ccf2009-09-23 17:46:15 -0700800 return BFA_STATUS_OK;
801}
802
803void
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700804bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim,
805 struct fchs_s *fchs, u16 len)
Jing Huang7725ccf2009-09-23 17:46:15 -0700806{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700807 struct fc_els_cmd_s *els_cmd;
Jing Huang7725ccf2009-09-23 17:46:15 -0700808
809 bfa_trc(itnim->fcs, fchs->type);
810
811 if (fchs->type != FC_TYPE_ELS)
812 return;
813
814 els_cmd = (struct fc_els_cmd_s *) (fchs + 1);
815
816 bfa_trc(itnim->fcs, els_cmd->els_code);
817
818 switch (els_cmd->els_code) {
819 case FC_ELS_PRLO:
Jing Huang4b5e7592010-07-08 19:55:41 -0700820 bfa_fcs_rport_prlo(itnim->rport, fchs->ox_id);
Jing Huang7725ccf2009-09-23 17:46:15 -0700821 break;
822
823 default:
Jing Huangd4b671c2010-12-26 21:46:35 -0800824 WARN_ON(1);
Jing Huang7725ccf2009-09-23 17:46:15 -0700825 }
826}