diff options
author | James Smart <James.Smart@Emulex.Com> | 2007-06-17 20:56:36 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-06-17 23:05:45 -0400 |
commit | 2e0fef85e098f6794956b8b80b111179fbb4cbb7 (patch) | |
tree | f632090be67f95e9a637eeb044938ba1591e848f /drivers/scsi/lpfc/lpfc_ct.c | |
parent | 4c2baaaf2ba4875d1d2d59b3b3e1216d3277b17a (diff) |
[SCSI] lpfc: NPIV: split ports
The driver is reorganized to separate the handling of the adapter from
the handling of the FC port. Adapter handling includes submissions of
command requests, receiving responses, and managing adapter resources.
The FC port includes the discovery engine, login handling, and the
mapping of a Scsi_Host on the "port". Although not a large functional
change, as it touches core structures and functions, resulting in a
large text delta.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_ct.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_ct.c | 225 |
1 files changed, 105 insertions, 120 deletions
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 34a9e3bb2614..dc25a53524c4 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -59,13 +59,13 @@ static char *lpfc_release_version = LPFC_DRIVER_VERSION; | |||
59 | * lpfc_ct_unsol_event | 59 | * lpfc_ct_unsol_event |
60 | */ | 60 | */ |
61 | void | 61 | void |
62 | lpfc_ct_unsol_event(struct lpfc_hba * phba, | 62 | lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, |
63 | struct lpfc_sli_ring * pring, struct lpfc_iocbq * piocbq) | 63 | struct lpfc_iocbq *piocbq) |
64 | { | 64 | { |
65 | 65 | ||
66 | struct lpfc_iocbq *next_piocbq; | 66 | struct lpfc_iocbq *next_piocbq; |
67 | struct lpfc_dmabuf *pmbuf = NULL; | 67 | struct lpfc_dmabuf *pmbuf = NULL; |
68 | struct lpfc_dmabuf *matp, *next_matp; | 68 | struct lpfc_dmabuf *matp = NULL, *next_matp; |
69 | uint32_t ctx = 0, size = 0, cnt = 0; | 69 | uint32_t ctx = 0, size = 0, cnt = 0; |
70 | IOCB_t *icmd = &piocbq->iocb; | 70 | IOCB_t *icmd = &piocbq->iocb; |
71 | IOCB_t *save_icmd = icmd; | 71 | IOCB_t *save_icmd = icmd; |
@@ -145,7 +145,7 @@ ct_unsol_event_exit_piocbq: | |||
145 | } | 145 | } |
146 | 146 | ||
147 | static void | 147 | static void |
148 | lpfc_free_ct_rsp(struct lpfc_hba * phba, struct lpfc_dmabuf * mlist) | 148 | lpfc_free_ct_rsp(struct lpfc_hba *phba, struct lpfc_dmabuf *mlist) |
149 | { | 149 | { |
150 | struct lpfc_dmabuf *mlast, *next_mlast; | 150 | struct lpfc_dmabuf *mlast, *next_mlast; |
151 | 151 | ||
@@ -160,7 +160,7 @@ lpfc_free_ct_rsp(struct lpfc_hba * phba, struct lpfc_dmabuf * mlist) | |||
160 | } | 160 | } |
161 | 161 | ||
162 | static struct lpfc_dmabuf * | 162 | static struct lpfc_dmabuf * |
163 | lpfc_alloc_ct_rsp(struct lpfc_hba * phba, int cmdcode, struct ulp_bde64 * bpl, | 163 | lpfc_alloc_ct_rsp(struct lpfc_hba *phba, int cmdcode, struct ulp_bde64 *bpl, |
164 | uint32_t size, int *entries) | 164 | uint32_t size, int *entries) |
165 | { | 165 | { |
166 | struct lpfc_dmabuf *mlist = NULL; | 166 | struct lpfc_dmabuf *mlist = NULL; |
@@ -216,23 +216,21 @@ lpfc_alloc_ct_rsp(struct lpfc_hba * phba, int cmdcode, struct ulp_bde64 * bpl, | |||
216 | } | 216 | } |
217 | 217 | ||
218 | static int | 218 | static int |
219 | lpfc_gen_req(struct lpfc_hba *phba, struct lpfc_dmabuf *bmp, | 219 | lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, |
220 | struct lpfc_dmabuf *inp, struct lpfc_dmabuf *outp, | 220 | struct lpfc_dmabuf *inp, struct lpfc_dmabuf *outp, |
221 | void (*cmpl) (struct lpfc_hba *, struct lpfc_iocbq *, | 221 | void (*cmpl) (struct lpfc_hba *, struct lpfc_iocbq *, |
222 | struct lpfc_iocbq *), | 222 | struct lpfc_iocbq *), |
223 | struct lpfc_nodelist *ndlp, uint32_t usr_flg, uint32_t num_entry, | 223 | struct lpfc_nodelist *ndlp, uint32_t usr_flg, uint32_t num_entry, |
224 | uint32_t tmo) | 224 | uint32_t tmo) |
225 | { | 225 | { |
226 | 226 | struct lpfc_hba *phba = vport->phba; | |
227 | struct lpfc_sli *psli = &phba->sli; | 227 | struct lpfc_sli *psli = &phba->sli; |
228 | struct lpfc_sli_ring *pring = &psli->ring[LPFC_ELS_RING]; | 228 | struct lpfc_sli_ring *pring = &psli->ring[LPFC_ELS_RING]; |
229 | IOCB_t *icmd; | 229 | IOCB_t *icmd; |
230 | struct lpfc_iocbq *geniocb; | 230 | struct lpfc_iocbq *geniocb; |
231 | 231 | ||
232 | /* Allocate buffer for command iocb */ | 232 | /* Allocate buffer for command iocb */ |
233 | spin_lock_irq(phba->host->host_lock); | ||
234 | geniocb = lpfc_sli_get_iocbq(phba); | 233 | geniocb = lpfc_sli_get_iocbq(phba); |
235 | spin_unlock_irq(phba->host->host_lock); | ||
236 | 234 | ||
237 | if (geniocb == NULL) | 235 | if (geniocb == NULL) |
238 | return 1; | 236 | return 1; |
@@ -276,27 +274,26 @@ lpfc_gen_req(struct lpfc_hba *phba, struct lpfc_dmabuf *bmp, | |||
276 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 274 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
277 | "%d:0119 Issue GEN REQ IOCB for NPORT x%x " | 275 | "%d:0119 Issue GEN REQ IOCB for NPORT x%x " |
278 | "Data: x%x x%x\n", phba->brd_no, icmd->un.ulpWord[5], | 276 | "Data: x%x x%x\n", phba->brd_no, icmd->un.ulpWord[5], |
279 | icmd->ulpIoTag, phba->hba_state); | 277 | icmd->ulpIoTag, vport->port_state); |
280 | geniocb->iocb_cmpl = cmpl; | 278 | geniocb->iocb_cmpl = cmpl; |
281 | geniocb->drvrTimeout = icmd->ulpTimeout + LPFC_DRVR_TIMEOUT; | 279 | geniocb->drvrTimeout = icmd->ulpTimeout + LPFC_DRVR_TIMEOUT; |
282 | spin_lock_irq(phba->host->host_lock); | 280 | geniocb->vport = vport; |
283 | if (lpfc_sli_issue_iocb(phba, pring, geniocb, 0) == IOCB_ERROR) { | 281 | if (lpfc_sli_issue_iocb(phba, pring, geniocb, 0) == IOCB_ERROR) { |
284 | lpfc_sli_release_iocbq(phba, geniocb); | 282 | lpfc_sli_release_iocbq(phba, geniocb); |
285 | spin_unlock_irq(phba->host->host_lock); | ||
286 | return 1; | 283 | return 1; |
287 | } | 284 | } |
288 | spin_unlock_irq(phba->host->host_lock); | ||
289 | 285 | ||
290 | return 0; | 286 | return 0; |
291 | } | 287 | } |
292 | 288 | ||
293 | static int | 289 | static int |
294 | lpfc_ct_cmd(struct lpfc_hba *phba, struct lpfc_dmabuf *inmp, | 290 | lpfc_ct_cmd(struct lpfc_vport *vport, struct lpfc_dmabuf *inmp, |
295 | struct lpfc_dmabuf *bmp, struct lpfc_nodelist *ndlp, | 291 | struct lpfc_dmabuf *bmp, struct lpfc_nodelist *ndlp, |
296 | void (*cmpl) (struct lpfc_hba *, struct lpfc_iocbq *, | 292 | void (*cmpl) (struct lpfc_hba *, struct lpfc_iocbq *, |
297 | struct lpfc_iocbq *), | 293 | struct lpfc_iocbq *), |
298 | uint32_t rsp_size) | 294 | uint32_t rsp_size) |
299 | { | 295 | { |
296 | struct lpfc_hba *phba = vport->phba; | ||
300 | struct ulp_bde64 *bpl = (struct ulp_bde64 *) bmp->virt; | 297 | struct ulp_bde64 *bpl = (struct ulp_bde64 *) bmp->virt; |
301 | struct lpfc_dmabuf *outmp; | 298 | struct lpfc_dmabuf *outmp; |
302 | int cnt = 0, status; | 299 | int cnt = 0, status; |
@@ -310,7 +307,7 @@ lpfc_ct_cmd(struct lpfc_hba *phba, struct lpfc_dmabuf *inmp, | |||
310 | if (!outmp) | 307 | if (!outmp) |
311 | return -ENOMEM; | 308 | return -ENOMEM; |
312 | 309 | ||
313 | status = lpfc_gen_req(phba, bmp, inmp, outmp, cmpl, ndlp, 0, | 310 | status = lpfc_gen_req(vport, bmp, inmp, outmp, cmpl, ndlp, 0, |
314 | cnt+1, 0); | 311 | cnt+1, 0); |
315 | if (status) { | 312 | if (status) { |
316 | lpfc_free_ct_rsp(phba, outmp); | 313 | lpfc_free_ct_rsp(phba, outmp); |
@@ -320,19 +317,20 @@ lpfc_ct_cmd(struct lpfc_hba *phba, struct lpfc_dmabuf *inmp, | |||
320 | } | 317 | } |
321 | 318 | ||
322 | static int | 319 | static int |
323 | lpfc_ns_rsp(struct lpfc_hba * phba, struct lpfc_dmabuf * mp, uint32_t Size) | 320 | lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size) |
324 | { | 321 | { |
322 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | ||
323 | struct lpfc_hba *phba = vport->phba; | ||
325 | struct lpfc_sli_ct_request *Response = | 324 | struct lpfc_sli_ct_request *Response = |
326 | (struct lpfc_sli_ct_request *) mp->virt; | 325 | (struct lpfc_sli_ct_request *) mp->virt; |
327 | struct lpfc_nodelist *ndlp = NULL; | 326 | struct lpfc_nodelist *ndlp = NULL; |
328 | struct lpfc_dmabuf *mlast, *next_mp; | 327 | struct lpfc_dmabuf *mlast, *next_mp; |
329 | uint32_t *ctptr = (uint32_t *) & Response->un.gid.PortType; | 328 | uint32_t *ctptr = (uint32_t *) & Response->un.gid.PortType; |
330 | uint32_t Did; | 329 | uint32_t Did, CTentry; |
331 | uint32_t CTentry; | ||
332 | int Cnt; | 330 | int Cnt; |
333 | struct list_head head; | 331 | struct list_head head; |
334 | 332 | ||
335 | lpfc_set_disctmo(phba); | 333 | lpfc_set_disctmo(vport); |
336 | 334 | ||
337 | 335 | ||
338 | list_add_tail(&head, &mp->list); | 336 | list_add_tail(&head, &mp->list); |
@@ -350,39 +348,31 @@ lpfc_ns_rsp(struct lpfc_hba * phba, struct lpfc_dmabuf * mp, uint32_t Size) | |||
350 | 348 | ||
351 | /* Loop through entire NameServer list of DIDs */ | 349 | /* Loop through entire NameServer list of DIDs */ |
352 | while (Cnt >= sizeof (uint32_t)) { | 350 | while (Cnt >= sizeof (uint32_t)) { |
353 | |||
354 | /* Get next DID from NameServer List */ | 351 | /* Get next DID from NameServer List */ |
355 | CTentry = *ctptr++; | 352 | CTentry = *ctptr++; |
356 | Did = ((be32_to_cpu(CTentry)) & Mask_DID); | 353 | Did = ((be32_to_cpu(CTentry)) & Mask_DID); |
357 | |||
358 | ndlp = NULL; | 354 | ndlp = NULL; |
359 | if (Did != phba->fc_myDID) { | 355 | /* Check for rscn processing or not */ |
360 | /* Check for rscn processing or not */ | 356 | if (Did != vport->fc_myDID) |
361 | ndlp = lpfc_setup_disc_node(phba, Did); | 357 | ndlp = lpfc_setup_disc_node(vport, Did); |
362 | } | ||
363 | /* Mark all node table entries that are in the | ||
364 | Nameserver */ | ||
365 | if (ndlp) { | 358 | if (ndlp) { |
366 | /* NameServer Rsp */ | ||
367 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 359 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
368 | "%d:0238 Process x%x NameServer" | 360 | "%d:0238 Process x%x NameServer" |
369 | " Rsp Data: x%x x%x x%x\n", | 361 | " Rsp Data: x%x x%x x%x\n", |
370 | phba->brd_no, | 362 | phba->brd_no, |
371 | Did, ndlp->nlp_flag, | 363 | Did, ndlp->nlp_flag, |
372 | phba->fc_flag, | 364 | vport->fc_flag, |
373 | phba->fc_rscn_id_cnt); | 365 | vport->fc_rscn_id_cnt); |
374 | } else { | 366 | } else { |
375 | /* NameServer Rsp */ | ||
376 | lpfc_printf_log(phba, | 367 | lpfc_printf_log(phba, |
377 | KERN_INFO, | 368 | KERN_INFO, |
378 | LOG_DISCOVERY, | 369 | LOG_DISCOVERY, |
379 | "%d:0239 Skip x%x NameServer " | 370 | "%d:0239 Skip x%x NameServer " |
380 | "Rsp Data: x%x x%x x%x\n", | 371 | "Rsp Data: x%x x%x x%x\n", |
381 | phba->brd_no, | 372 | phba->brd_no, |
382 | Did, Size, phba->fc_flag, | 373 | Did, Size, vport->fc_flag, |
383 | phba->fc_rscn_id_cnt); | 374 | vport->fc_rscn_id_cnt); |
384 | } | 375 | } |
385 | |||
386 | if (CTentry & (be32_to_cpu(SLI_CT_LAST_ENTRY))) | 376 | if (CTentry & (be32_to_cpu(SLI_CT_LAST_ENTRY))) |
387 | goto nsout1; | 377 | goto nsout1; |
388 | Cnt -= sizeof (uint32_t); | 378 | Cnt -= sizeof (uint32_t); |
@@ -395,15 +385,15 @@ nsout1: | |||
395 | list_del(&head); | 385 | list_del(&head); |
396 | 386 | ||
397 | /* | 387 | /* |
398 | * The driver has cycled through all Nports in the RSCN payload. | 388 | * The driver has cycled through all Nports in the RSCN payload. |
399 | * Complete the handling by cleaning up and marking the | 389 | * Complete the handling by cleaning up and marking the |
400 | * current driver state. | 390 | * current driver state. |
401 | */ | 391 | */ |
402 | if (phba->hba_state == LPFC_HBA_READY) { | 392 | if (vport->port_state == LPFC_VPORT_READY) { |
403 | lpfc_els_flush_rscn(phba); | 393 | lpfc_els_flush_rscn(vport); |
404 | spin_lock_irq(phba->host->host_lock); | 394 | spin_lock_irq(shost->host_lock); |
405 | phba->fc_flag |= FC_RSCN_MODE; /* we are still in RSCN mode */ | 395 | vport->fc_flag |= FC_RSCN_MODE; /* we are still in RSCN mode */ |
406 | spin_unlock_irq(phba->host->host_lock); | 396 | spin_unlock_irq(shost->host_lock); |
407 | } | 397 | } |
408 | return 0; | 398 | return 0; |
409 | } | 399 | } |
@@ -412,18 +402,18 @@ nsout1: | |||
412 | 402 | ||
413 | 403 | ||
414 | static void | 404 | static void |
415 | lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | 405 | lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
416 | struct lpfc_iocbq * rspiocb) | 406 | struct lpfc_iocbq *rspiocb) |
417 | { | 407 | { |
408 | struct lpfc_vport *vport = cmdiocb->vport; | ||
418 | IOCB_t *irsp; | 409 | IOCB_t *irsp; |
419 | struct lpfc_sli *psli; | ||
420 | struct lpfc_dmabuf *bmp; | 410 | struct lpfc_dmabuf *bmp; |
421 | struct lpfc_dmabuf *inp; | 411 | struct lpfc_dmabuf *inp; |
422 | struct lpfc_dmabuf *outp; | 412 | struct lpfc_dmabuf *outp; |
423 | struct lpfc_nodelist *ndlp; | 413 | struct lpfc_nodelist *ndlp; |
424 | struct lpfc_sli_ct_request *CTrsp; | 414 | struct lpfc_sli_ct_request *CTrsp; |
415 | int rc; | ||
425 | 416 | ||
426 | psli = &phba->sli; | ||
427 | /* we pass cmdiocb to state machine which needs rspiocb as well */ | 417 | /* we pass cmdiocb to state machine which needs rspiocb as well */ |
428 | cmdiocb->context_un.rsp_iocb = rspiocb; | 418 | cmdiocb->context_un.rsp_iocb = rspiocb; |
429 | 419 | ||
@@ -435,22 +425,20 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
435 | if (irsp->ulpStatus) { | 425 | if (irsp->ulpStatus) { |
436 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && | 426 | if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && |
437 | ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) || | 427 | ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) || |
438 | (irsp->un.ulpWord[4] == IOERR_SLI_ABORTED))) { | 428 | (irsp->un.ulpWord[4] == IOERR_SLI_ABORTED))) |
439 | goto out; | 429 | goto out; |
440 | } | ||
441 | 430 | ||
442 | /* Check for retry */ | 431 | /* Check for retry */ |
443 | if (phba->fc_ns_retry < LPFC_MAX_NS_RETRY) { | 432 | if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { |
444 | phba->fc_ns_retry++; | 433 | vport->fc_ns_retry++; |
445 | /* CT command is being retried */ | 434 | /* CT command is being retried */ |
446 | ndlp = lpfc_findnode_did(phba, NameServer_DID); | 435 | ndlp = lpfc_findnode_did(vport, NameServer_DID); |
447 | if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { | 436 | if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { |
448 | if (lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT) == | 437 | rc = lpfc_ns_cmd(vport, ndlp, SLI_CTNS_GID_FT); |
449 | 0) { | 438 | if (rc == 0) |
450 | goto out; | 439 | goto out; |
451 | } | 440 | } |
452 | } | 441 | } |
453 | } | ||
454 | } else { | 442 | } else { |
455 | /* Good status, continue checking */ | 443 | /* Good status, continue checking */ |
456 | CTrsp = (struct lpfc_sli_ct_request *) outp->virt; | 444 | CTrsp = (struct lpfc_sli_ct_request *) outp->virt; |
@@ -460,8 +448,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
460 | "%d:0208 NameServer Rsp " | 448 | "%d:0208 NameServer Rsp " |
461 | "Data: x%x\n", | 449 | "Data: x%x\n", |
462 | phba->brd_no, | 450 | phba->brd_no, |
463 | phba->fc_flag); | 451 | vport->fc_flag); |
464 | lpfc_ns_rsp(phba, outp, | 452 | lpfc_ns_rsp(vport, outp, |
465 | (uint32_t) (irsp->un.genreq64.bdl.bdeSize)); | 453 | (uint32_t) (irsp->un.genreq64.bdl.bdeSize)); |
466 | } else if (CTrsp->CommandResponse.bits.CmdRsp == | 454 | } else if (CTrsp->CommandResponse.bits.CmdRsp == |
467 | be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { | 455 | be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { |
@@ -473,7 +461,7 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
473 | CTrsp->CommandResponse.bits.CmdRsp, | 461 | CTrsp->CommandResponse.bits.CmdRsp, |
474 | (uint32_t) CTrsp->ReasonCode, | 462 | (uint32_t) CTrsp->ReasonCode, |
475 | (uint32_t) CTrsp->Explanation, | 463 | (uint32_t) CTrsp->Explanation, |
476 | phba->fc_flag); | 464 | vport->fc_flag); |
477 | } else { | 465 | } else { |
478 | /* NameServer Rsp Error */ | 466 | /* NameServer Rsp Error */ |
479 | lpfc_printf_log(phba, | 467 | lpfc_printf_log(phba, |
@@ -485,35 +473,31 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
485 | CTrsp->CommandResponse.bits.CmdRsp, | 473 | CTrsp->CommandResponse.bits.CmdRsp, |
486 | (uint32_t) CTrsp->ReasonCode, | 474 | (uint32_t) CTrsp->ReasonCode, |
487 | (uint32_t) CTrsp->Explanation, | 475 | (uint32_t) CTrsp->Explanation, |
488 | phba->fc_flag); | 476 | vport->fc_flag); |
489 | } | 477 | } |
490 | } | 478 | } |
491 | /* Link up / RSCN discovery */ | 479 | /* Link up / RSCN discovery */ |
492 | lpfc_disc_start(phba); | 480 | lpfc_disc_start(vport); |
493 | out: | 481 | out: |
494 | lpfc_free_ct_rsp(phba, outp); | 482 | lpfc_free_ct_rsp(phba, outp); |
495 | lpfc_mbuf_free(phba, inp->virt, inp->phys); | 483 | lpfc_mbuf_free(phba, inp->virt, inp->phys); |
496 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | 484 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); |
497 | kfree(inp); | 485 | kfree(inp); |
498 | kfree(bmp); | 486 | kfree(bmp); |
499 | spin_lock_irq(phba->host->host_lock); | ||
500 | lpfc_sli_release_iocbq(phba, cmdiocb); | 487 | lpfc_sli_release_iocbq(phba, cmdiocb); |
501 | spin_unlock_irq(phba->host->host_lock); | ||
502 | return; | 488 | return; |
503 | } | 489 | } |
504 | 490 | ||
505 | static void | 491 | static void |
506 | lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | 492 | lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
507 | struct lpfc_iocbq * rspiocb) | 493 | struct lpfc_iocbq *rspiocb) |
508 | { | 494 | { |
509 | struct lpfc_sli *psli; | ||
510 | struct lpfc_dmabuf *bmp; | 495 | struct lpfc_dmabuf *bmp; |
511 | struct lpfc_dmabuf *inp; | 496 | struct lpfc_dmabuf *inp; |
512 | struct lpfc_dmabuf *outp; | 497 | struct lpfc_dmabuf *outp; |
513 | IOCB_t *irsp; | 498 | IOCB_t *irsp; |
514 | struct lpfc_sli_ct_request *CTrsp; | 499 | struct lpfc_sli_ct_request *CTrsp; |
515 | 500 | ||
516 | psli = &phba->sli; | ||
517 | /* we pass cmdiocb to state machine which needs rspiocb as well */ | 501 | /* we pass cmdiocb to state machine which needs rspiocb as well */ |
518 | cmdiocb->context_un.rsp_iocb = rspiocb; | 502 | cmdiocb->context_un.rsp_iocb = rspiocb; |
519 | 503 | ||
@@ -527,31 +511,31 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
527 | /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */ | 511 | /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */ |
528 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, | 512 | lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, |
529 | "%d:0209 RFT request completes ulpStatus x%x " | 513 | "%d:0209 RFT request completes ulpStatus x%x " |
530 | "CmdRsp x%x\n", phba->brd_no, irsp->ulpStatus, | 514 | "CmdRsp x%x, Context x%x, Tag x%x\n", |
531 | CTrsp->CommandResponse.bits.CmdRsp); | 515 | phba->brd_no, irsp->ulpStatus, |
516 | CTrsp->CommandResponse.bits.CmdRsp, | ||
517 | cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag); | ||
532 | 518 | ||
533 | lpfc_free_ct_rsp(phba, outp); | 519 | lpfc_free_ct_rsp(phba, outp); |
534 | lpfc_mbuf_free(phba, inp->virt, inp->phys); | 520 | lpfc_mbuf_free(phba, inp->virt, inp->phys); |
535 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | 521 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); |
536 | kfree(inp); | 522 | kfree(inp); |
537 | kfree(bmp); | 523 | kfree(bmp); |
538 | spin_lock_irq(phba->host->host_lock); | ||
539 | lpfc_sli_release_iocbq(phba, cmdiocb); | 524 | lpfc_sli_release_iocbq(phba, cmdiocb); |
540 | spin_unlock_irq(phba->host->host_lock); | ||
541 | return; | 525 | return; |
542 | } | 526 | } |
543 | 527 | ||
544 | static void | 528 | static void |
545 | lpfc_cmpl_ct_cmd_rnn_id(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | 529 | lpfc_cmpl_ct_cmd_rnn_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
546 | struct lpfc_iocbq * rspiocb) | 530 | struct lpfc_iocbq *rspiocb) |
547 | { | 531 | { |
548 | lpfc_cmpl_ct_cmd_rft_id(phba, cmdiocb, rspiocb); | 532 | lpfc_cmpl_ct_cmd_rft_id(phba, cmdiocb, rspiocb); |
549 | return; | 533 | return; |
550 | } | 534 | } |
551 | 535 | ||
552 | static void | 536 | static void |
553 | lpfc_cmpl_ct_cmd_rsnn_nn(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | 537 | lpfc_cmpl_ct_cmd_rsnn_nn(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
554 | struct lpfc_iocbq * rspiocb) | 538 | struct lpfc_iocbq *rspiocb) |
555 | { | 539 | { |
556 | lpfc_cmpl_ct_cmd_rft_id(phba, cmdiocb, rspiocb); | 540 | lpfc_cmpl_ct_cmd_rft_id(phba, cmdiocb, rspiocb); |
557 | return; | 541 | return; |
@@ -566,7 +550,7 @@ lpfc_cmpl_ct_cmd_rff_id(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
566 | } | 550 | } |
567 | 551 | ||
568 | void | 552 | void |
569 | lpfc_get_hba_sym_node_name(struct lpfc_hba * phba, uint8_t * symbp) | 553 | lpfc_get_hba_sym_node_name(struct lpfc_hba *phba, uint8_t *symbp) |
570 | { | 554 | { |
571 | char fwrev[16]; | 555 | char fwrev[16]; |
572 | 556 | ||
@@ -585,8 +569,9 @@ lpfc_get_hba_sym_node_name(struct lpfc_hba * phba, uint8_t * symbp) | |||
585 | * LI_CTNS_RFT_ID | 569 | * LI_CTNS_RFT_ID |
586 | */ | 570 | */ |
587 | int | 571 | int |
588 | lpfc_ns_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | 572 | lpfc_ns_cmd(struct lpfc_vport *vport, struct lpfc_nodelist * ndlp, int cmdcode) |
589 | { | 573 | { |
574 | struct lpfc_hba *phba = vport->phba; | ||
590 | struct lpfc_dmabuf *mp, *bmp; | 575 | struct lpfc_dmabuf *mp, *bmp; |
591 | struct lpfc_sli_ct_request *CtReq; | 576 | struct lpfc_sli_ct_request *CtReq; |
592 | struct ulp_bde64 *bpl; | 577 | struct ulp_bde64 *bpl; |
@@ -620,8 +605,8 @@ lpfc_ns_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
620 | KERN_INFO, | 605 | KERN_INFO, |
621 | LOG_DISCOVERY, | 606 | LOG_DISCOVERY, |
622 | "%d:0236 NameServer Req Data: x%x x%x x%x\n", | 607 | "%d:0236 NameServer Req Data: x%x x%x x%x\n", |
623 | phba->brd_no, cmdcode, phba->fc_flag, | 608 | phba->brd_no, cmdcode, vport->fc_flag, |
624 | phba->fc_rscn_id_cnt); | 609 | vport->fc_rscn_id_cnt); |
625 | 610 | ||
626 | bpl = (struct ulp_bde64 *) bmp->virt; | 611 | bpl = (struct ulp_bde64 *) bmp->virt; |
627 | memset(bpl, 0, sizeof(struct ulp_bde64)); | 612 | memset(bpl, 0, sizeof(struct ulp_bde64)); |
@@ -654,9 +639,9 @@ lpfc_ns_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
654 | CtReq->CommandResponse.bits.CmdRsp = | 639 | CtReq->CommandResponse.bits.CmdRsp = |
655 | be16_to_cpu(SLI_CTNS_GID_FT); | 640 | be16_to_cpu(SLI_CTNS_GID_FT); |
656 | CtReq->un.gid.Fc4Type = SLI_CTPT_FCP; | 641 | CtReq->un.gid.Fc4Type = SLI_CTPT_FCP; |
657 | if (phba->hba_state < LPFC_HBA_READY) | 642 | if (vport->port_state < LPFC_VPORT_READY) |
658 | phba->hba_state = LPFC_NS_QRY; | 643 | vport->port_state = LPFC_NS_QRY; |
659 | lpfc_set_disctmo(phba); | 644 | lpfc_set_disctmo(vport); |
660 | cmpl = lpfc_cmpl_ct_cmd_gid_ft; | 645 | cmpl = lpfc_cmpl_ct_cmd_gid_ft; |
661 | rsp_size = FC_MAX_NS_RSP; | 646 | rsp_size = FC_MAX_NS_RSP; |
662 | break; | 647 | break; |
@@ -664,7 +649,7 @@ lpfc_ns_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
664 | case SLI_CTNS_RFT_ID: | 649 | case SLI_CTNS_RFT_ID: |
665 | CtReq->CommandResponse.bits.CmdRsp = | 650 | CtReq->CommandResponse.bits.CmdRsp = |
666 | be16_to_cpu(SLI_CTNS_RFT_ID); | 651 | be16_to_cpu(SLI_CTNS_RFT_ID); |
667 | CtReq->un.rft.PortId = be32_to_cpu(phba->fc_myDID); | 652 | CtReq->un.rft.PortId = be32_to_cpu(vport->fc_myDID); |
668 | CtReq->un.rft.fcpReg = 1; | 653 | CtReq->un.rft.fcpReg = 1; |
669 | cmpl = lpfc_cmpl_ct_cmd_rft_id; | 654 | cmpl = lpfc_cmpl_ct_cmd_rft_id; |
670 | break; | 655 | break; |
@@ -672,7 +657,7 @@ lpfc_ns_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
672 | case SLI_CTNS_RFF_ID: | 657 | case SLI_CTNS_RFF_ID: |
673 | CtReq->CommandResponse.bits.CmdRsp = | 658 | CtReq->CommandResponse.bits.CmdRsp = |
674 | be16_to_cpu(SLI_CTNS_RFF_ID); | 659 | be16_to_cpu(SLI_CTNS_RFF_ID); |
675 | CtReq->un.rff.PortId = be32_to_cpu(phba->fc_myDID); | 660 | CtReq->un.rff.PortId = be32_to_cpu(vport->fc_myDID); |
676 | CtReq->un.rff.feature_res = 0; | 661 | CtReq->un.rff.feature_res = 0; |
677 | CtReq->un.rff.feature_tgt = 0; | 662 | CtReq->un.rff.feature_tgt = 0; |
678 | CtReq->un.rff.type_code = FC_FCP_DATA; | 663 | CtReq->un.rff.type_code = FC_FCP_DATA; |
@@ -683,8 +668,8 @@ lpfc_ns_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
683 | case SLI_CTNS_RNN_ID: | 668 | case SLI_CTNS_RNN_ID: |
684 | CtReq->CommandResponse.bits.CmdRsp = | 669 | CtReq->CommandResponse.bits.CmdRsp = |
685 | be16_to_cpu(SLI_CTNS_RNN_ID); | 670 | be16_to_cpu(SLI_CTNS_RNN_ID); |
686 | CtReq->un.rnn.PortId = be32_to_cpu(phba->fc_myDID); | 671 | CtReq->un.rnn.PortId = be32_to_cpu(vport->fc_myDID); |
687 | memcpy(CtReq->un.rnn.wwnn, &phba->fc_nodename, | 672 | memcpy(CtReq->un.rnn.wwnn, &vport->fc_nodename, |
688 | sizeof (struct lpfc_name)); | 673 | sizeof (struct lpfc_name)); |
689 | cmpl = lpfc_cmpl_ct_cmd_rnn_id; | 674 | cmpl = lpfc_cmpl_ct_cmd_rnn_id; |
690 | break; | 675 | break; |
@@ -692,7 +677,7 @@ lpfc_ns_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
692 | case SLI_CTNS_RSNN_NN: | 677 | case SLI_CTNS_RSNN_NN: |
693 | CtReq->CommandResponse.bits.CmdRsp = | 678 | CtReq->CommandResponse.bits.CmdRsp = |
694 | be16_to_cpu(SLI_CTNS_RSNN_NN); | 679 | be16_to_cpu(SLI_CTNS_RSNN_NN); |
695 | memcpy(CtReq->un.rsnn.wwnn, &phba->fc_nodename, | 680 | memcpy(CtReq->un.rsnn.wwnn, &vport->fc_nodename, |
696 | sizeof (struct lpfc_name)); | 681 | sizeof (struct lpfc_name)); |
697 | lpfc_get_hba_sym_node_name(phba, CtReq->un.rsnn.symbname); | 682 | lpfc_get_hba_sym_node_name(phba, CtReq->un.rsnn.symbname); |
698 | CtReq->un.rsnn.len = strlen(CtReq->un.rsnn.symbname); | 683 | CtReq->un.rsnn.len = strlen(CtReq->un.rsnn.symbname); |
@@ -700,7 +685,7 @@ lpfc_ns_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
700 | break; | 685 | break; |
701 | } | 686 | } |
702 | 687 | ||
703 | if (!lpfc_ct_cmd(phba, mp, bmp, ndlp, cmpl, rsp_size)) | 688 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size)) |
704 | /* On success, The cmpl function will free the buffers */ | 689 | /* On success, The cmpl function will free the buffers */ |
705 | return 0; | 690 | return 0; |
706 | 691 | ||
@@ -716,8 +701,8 @@ ns_cmd_exit: | |||
716 | } | 701 | } |
717 | 702 | ||
718 | static void | 703 | static void |
719 | lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba * phba, | 704 | lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
720 | struct lpfc_iocbq * cmdiocb, struct lpfc_iocbq * rspiocb) | 705 | struct lpfc_iocbq * rspiocb) |
721 | { | 706 | { |
722 | struct lpfc_dmabuf *bmp = cmdiocb->context3; | 707 | struct lpfc_dmabuf *bmp = cmdiocb->context3; |
723 | struct lpfc_dmabuf *inp = cmdiocb->context1; | 708 | struct lpfc_dmabuf *inp = cmdiocb->context1; |
@@ -727,8 +712,9 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba * phba, | |||
727 | struct lpfc_nodelist *ndlp; | 712 | struct lpfc_nodelist *ndlp; |
728 | uint16_t fdmi_cmd = CTcmd->CommandResponse.bits.CmdRsp; | 713 | uint16_t fdmi_cmd = CTcmd->CommandResponse.bits.CmdRsp; |
729 | uint16_t fdmi_rsp = CTrsp->CommandResponse.bits.CmdRsp; | 714 | uint16_t fdmi_rsp = CTrsp->CommandResponse.bits.CmdRsp; |
715 | struct lpfc_vport *vport = cmdiocb->vport; | ||
730 | 716 | ||
731 | ndlp = lpfc_findnode_did(phba, FDMI_DID); | 717 | ndlp = lpfc_findnode_did(vport, FDMI_DID); |
732 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { | 718 | if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) { |
733 | /* FDMI rsp failed */ | 719 | /* FDMI rsp failed */ |
734 | lpfc_printf_log(phba, | 720 | lpfc_printf_log(phba, |
@@ -741,18 +727,18 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba * phba, | |||
741 | 727 | ||
742 | switch (be16_to_cpu(fdmi_cmd)) { | 728 | switch (be16_to_cpu(fdmi_cmd)) { |
743 | case SLI_MGMT_RHBA: | 729 | case SLI_MGMT_RHBA: |
744 | lpfc_fdmi_cmd(phba, ndlp, SLI_MGMT_RPA); | 730 | lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_RPA); |
745 | break; | 731 | break; |
746 | 732 | ||
747 | case SLI_MGMT_RPA: | 733 | case SLI_MGMT_RPA: |
748 | break; | 734 | break; |
749 | 735 | ||
750 | case SLI_MGMT_DHBA: | 736 | case SLI_MGMT_DHBA: |
751 | lpfc_fdmi_cmd(phba, ndlp, SLI_MGMT_DPRT); | 737 | lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DPRT); |
752 | break; | 738 | break; |
753 | 739 | ||
754 | case SLI_MGMT_DPRT: | 740 | case SLI_MGMT_DPRT: |
755 | lpfc_fdmi_cmd(phba, ndlp, SLI_MGMT_RHBA); | 741 | lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_RHBA); |
756 | break; | 742 | break; |
757 | } | 743 | } |
758 | 744 | ||
@@ -761,14 +747,14 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba * phba, | |||
761 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | 747 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); |
762 | kfree(inp); | 748 | kfree(inp); |
763 | kfree(bmp); | 749 | kfree(bmp); |
764 | spin_lock_irq(phba->host->host_lock); | ||
765 | lpfc_sli_release_iocbq(phba, cmdiocb); | 750 | lpfc_sli_release_iocbq(phba, cmdiocb); |
766 | spin_unlock_irq(phba->host->host_lock); | ||
767 | return; | 751 | return; |
768 | } | 752 | } |
753 | |||
769 | int | 754 | int |
770 | lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | 755 | lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) |
771 | { | 756 | { |
757 | struct lpfc_hba *phba = vport->phba; | ||
772 | struct lpfc_dmabuf *mp, *bmp; | 758 | struct lpfc_dmabuf *mp, *bmp; |
773 | struct lpfc_sli_ct_request *CtReq; | 759 | struct lpfc_sli_ct_request *CtReq; |
774 | struct ulp_bde64 *bpl; | 760 | struct ulp_bde64 *bpl; |
@@ -810,7 +796,7 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
810 | LOG_DISCOVERY, | 796 | LOG_DISCOVERY, |
811 | "%d:0218 FDMI Request Data: x%x x%x x%x\n", | 797 | "%d:0218 FDMI Request Data: x%x x%x x%x\n", |
812 | phba->brd_no, | 798 | phba->brd_no, |
813 | phba->fc_flag, phba->hba_state, cmdcode); | 799 | vport->fc_flag, vport->port_state, cmdcode); |
814 | 800 | ||
815 | CtReq = (struct lpfc_sli_ct_request *) mp->virt; | 801 | CtReq = (struct lpfc_sli_ct_request *) mp->virt; |
816 | 802 | ||
@@ -833,11 +819,11 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
833 | be16_to_cpu(SLI_MGMT_RHBA); | 819 | be16_to_cpu(SLI_MGMT_RHBA); |
834 | CtReq->CommandResponse.bits.Size = 0; | 820 | CtReq->CommandResponse.bits.Size = 0; |
835 | rh = (REG_HBA *) & CtReq->un.PortID; | 821 | rh = (REG_HBA *) & CtReq->un.PortID; |
836 | memcpy(&rh->hi.PortName, &phba->fc_sparam.portName, | 822 | memcpy(&rh->hi.PortName, &vport->fc_sparam.portName, |
837 | sizeof (struct lpfc_name)); | 823 | sizeof (struct lpfc_name)); |
838 | /* One entry (port) per adapter */ | 824 | /* One entry (port) per adapter */ |
839 | rh->rpl.EntryCnt = be32_to_cpu(1); | 825 | rh->rpl.EntryCnt = be32_to_cpu(1); |
840 | memcpy(&rh->rpl.pe, &phba->fc_sparam.portName, | 826 | memcpy(&rh->rpl.pe, &vport->fc_sparam.portName, |
841 | sizeof (struct lpfc_name)); | 827 | sizeof (struct lpfc_name)); |
842 | 828 | ||
843 | /* point to the HBA attribute block */ | 829 | /* point to the HBA attribute block */ |
@@ -853,7 +839,7 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
853 | ae->ad.bits.AttrType = be16_to_cpu(NODE_NAME); | 839 | ae->ad.bits.AttrType = be16_to_cpu(NODE_NAME); |
854 | ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES | 840 | ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES |
855 | + sizeof (struct lpfc_name)); | 841 | + sizeof (struct lpfc_name)); |
856 | memcpy(&ae->un.NodeName, &phba->fc_sparam.nodeName, | 842 | memcpy(&ae->un.NodeName, &vport->fc_sparam.nodeName, |
857 | sizeof (struct lpfc_name)); | 843 | sizeof (struct lpfc_name)); |
858 | ab->EntryCnt++; | 844 | ab->EntryCnt++; |
859 | size += FOURBYTES + sizeof (struct lpfc_name); | 845 | size += FOURBYTES + sizeof (struct lpfc_name); |
@@ -991,7 +977,7 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
991 | pab = (REG_PORT_ATTRIBUTE *) & CtReq->un.PortID; | 977 | pab = (REG_PORT_ATTRIBUTE *) & CtReq->un.PortID; |
992 | size = sizeof (struct lpfc_name) + FOURBYTES; | 978 | size = sizeof (struct lpfc_name) + FOURBYTES; |
993 | memcpy((uint8_t *) & pab->PortName, | 979 | memcpy((uint8_t *) & pab->PortName, |
994 | (uint8_t *) & phba->fc_sparam.portName, | 980 | (uint8_t *) & vport->fc_sparam.portName, |
995 | sizeof (struct lpfc_name)); | 981 | sizeof (struct lpfc_name)); |
996 | pab->ab.EntryCnt = 0; | 982 | pab->ab.EntryCnt = 0; |
997 | 983 | ||
@@ -1053,7 +1039,7 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
1053 | ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab + size); | 1039 | ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab + size); |
1054 | ae->ad.bits.AttrType = be16_to_cpu(MAX_FRAME_SIZE); | 1040 | ae->ad.bits.AttrType = be16_to_cpu(MAX_FRAME_SIZE); |
1055 | ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + 4); | 1041 | ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + 4); |
1056 | hsp = (struct serv_parm *) & phba->fc_sparam; | 1042 | hsp = (struct serv_parm *) & vport->fc_sparam; |
1057 | ae->un.MaxFrameSize = | 1043 | ae->un.MaxFrameSize = |
1058 | (((uint32_t) hsp->cmn. | 1044 | (((uint32_t) hsp->cmn. |
1059 | bbRcvSizeMsb) << 8) | (uint32_t) hsp->cmn. | 1045 | bbRcvSizeMsb) << 8) | (uint32_t) hsp->cmn. |
@@ -1097,7 +1083,7 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
1097 | CtReq->CommandResponse.bits.Size = 0; | 1083 | CtReq->CommandResponse.bits.Size = 0; |
1098 | pe = (PORT_ENTRY *) & CtReq->un.PortID; | 1084 | pe = (PORT_ENTRY *) & CtReq->un.PortID; |
1099 | memcpy((uint8_t *) & pe->PortName, | 1085 | memcpy((uint8_t *) & pe->PortName, |
1100 | (uint8_t *) & phba->fc_sparam.portName, | 1086 | (uint8_t *) & vport->fc_sparam.portName, |
1101 | sizeof (struct lpfc_name)); | 1087 | sizeof (struct lpfc_name)); |
1102 | size = GID_REQUEST_SZ - 4 + sizeof (struct lpfc_name); | 1088 | size = GID_REQUEST_SZ - 4 + sizeof (struct lpfc_name); |
1103 | break; | 1089 | break; |
@@ -1107,7 +1093,7 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
1107 | CtReq->CommandResponse.bits.Size = 0; | 1093 | CtReq->CommandResponse.bits.Size = 0; |
1108 | pe = (PORT_ENTRY *) & CtReq->un.PortID; | 1094 | pe = (PORT_ENTRY *) & CtReq->un.PortID; |
1109 | memcpy((uint8_t *) & pe->PortName, | 1095 | memcpy((uint8_t *) & pe->PortName, |
1110 | (uint8_t *) & phba->fc_sparam.portName, | 1096 | (uint8_t *) & vport->fc_sparam.portName, |
1111 | sizeof (struct lpfc_name)); | 1097 | sizeof (struct lpfc_name)); |
1112 | size = GID_REQUEST_SZ - 4 + sizeof (struct lpfc_name); | 1098 | size = GID_REQUEST_SZ - 4 + sizeof (struct lpfc_name); |
1113 | break; | 1099 | break; |
@@ -1122,7 +1108,7 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode) | |||
1122 | 1108 | ||
1123 | cmpl = lpfc_cmpl_ct_cmd_fdmi; | 1109 | cmpl = lpfc_cmpl_ct_cmd_fdmi; |
1124 | 1110 | ||
1125 | if (!lpfc_ct_cmd(phba, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP)) | 1111 | if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP)) |
1126 | return 0; | 1112 | return 0; |
1127 | 1113 | ||
1128 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); | 1114 | lpfc_mbuf_free(phba, bmp->virt, bmp->phys); |
@@ -1146,37 +1132,36 @@ fdmi_cmd_exit: | |||
1146 | void | 1132 | void |
1147 | lpfc_fdmi_tmo(unsigned long ptr) | 1133 | lpfc_fdmi_tmo(unsigned long ptr) |
1148 | { | 1134 | { |
1149 | struct lpfc_hba *phba = (struct lpfc_hba *)ptr; | 1135 | struct lpfc_vport *vport = (struct lpfc_vport *)ptr; |
1136 | struct lpfc_hba *phba = vport->phba; | ||
1150 | unsigned long iflag; | 1137 | unsigned long iflag; |
1151 | 1138 | ||
1152 | spin_lock_irqsave(phba->host->host_lock, iflag); | 1139 | spin_lock_irqsave(&vport->work_port_lock, iflag); |
1153 | if (!(phba->work_hba_events & WORKER_FDMI_TMO)) { | 1140 | if (!(vport->work_port_events & WORKER_FDMI_TMO)) { |
1154 | phba->work_hba_events |= WORKER_FDMI_TMO; | 1141 | vport->work_port_events |= WORKER_FDMI_TMO; |
1155 | if (phba->work_wait) | 1142 | if (phba->work_wait) |
1156 | wake_up(phba->work_wait); | 1143 | wake_up(phba->work_wait); |
1157 | } | 1144 | } |
1158 | spin_unlock_irqrestore(phba->host->host_lock,iflag); | 1145 | spin_unlock_irqrestore(&vport->work_port_lock, iflag); |
1159 | } | 1146 | } |
1160 | 1147 | ||
1161 | void | 1148 | void |
1162 | lpfc_fdmi_tmo_handler(struct lpfc_hba *phba) | 1149 | lpfc_fdmi_timeout_handler(struct lpfc_vport *vport) |
1163 | { | 1150 | { |
1164 | struct lpfc_nodelist *ndlp; | 1151 | struct lpfc_nodelist *ndlp; |
1165 | 1152 | ||
1166 | ndlp = lpfc_findnode_did(phba, FDMI_DID); | 1153 | ndlp = lpfc_findnode_did(vport, FDMI_DID); |
1167 | if (ndlp) { | 1154 | if (ndlp) { |
1168 | if (init_utsname()->nodename[0] != '\0') { | 1155 | if (init_utsname()->nodename[0] != '\0') |
1169 | lpfc_fdmi_cmd(phba, ndlp, SLI_MGMT_DHBA); | 1156 | lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA); |
1170 | } else { | 1157 | else |
1171 | mod_timer(&phba->fc_fdmitmo, jiffies + HZ * 60); | 1158 | mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60); |
1172 | } | ||
1173 | } | 1159 | } |
1174 | return; | 1160 | return; |
1175 | } | 1161 | } |
1176 | 1162 | ||
1177 | |||
1178 | void | 1163 | void |
1179 | lpfc_decode_firmware_rev(struct lpfc_hba * phba, char *fwrevision, int flag) | 1164 | lpfc_decode_firmware_rev(struct lpfc_hba *phba, char *fwrevision, int flag) |
1180 | { | 1165 | { |
1181 | struct lpfc_sli *psli = &phba->sli; | 1166 | struct lpfc_sli *psli = &phba->sli; |
1182 | lpfc_vpd_t *vp = &phba->vpd; | 1167 | lpfc_vpd_t *vp = &phba->vpd; |