aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc.h4
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h4
-rw-r--r--drivers/scsi/lpfc/lpfc_disc.h1
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c87
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c9
5 files changed, 15 insertions, 90 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index adb95674823f..3062b39fbdb9 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -267,10 +267,6 @@ struct lpfc_hba {
267 struct lpfc_nodelist fc_fcpnodev; /* nodelist entry for no device */ 267 struct lpfc_nodelist fc_fcpnodev; /* nodelist entry for no device */
268 uint32_t nport_event_cnt; /* timestamp for nlplist entry */ 268 uint32_t nport_event_cnt; /* timestamp for nlplist entry */
269 269
270#define LPFC_RPI_HASH_SIZE 64
271#define LPFC_RPI_HASH_FUNC(x) ((x) & (0x3f))
272 /* ptr to active D_ID / RPIs */
273 struct lpfc_nodelist *fc_nlplookup[LPFC_RPI_HASH_SIZE];
274 uint32_t wwnn[2]; 270 uint32_t wwnn[2];
275 uint32_t RandomData[7]; 271 uint32_t RandomData[7];
276 272
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index bd5135d3eee4..ffc58f9a5a59 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -62,10 +62,6 @@ void lpfc_disc_timeout(unsigned long);
62void lpfc_scan_timeout(unsigned long); 62void lpfc_scan_timeout(unsigned long);
63 63
64struct lpfc_nodelist *lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi); 64struct lpfc_nodelist *lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi);
65struct lpfc_nodelist *lpfc_findnode_remove_rpi(struct lpfc_hba * phba,
66 uint16_t rpi);
67void lpfc_addnode_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
68 uint16_t rpi);
69 65
70int lpfc_workq_post_event(struct lpfc_hba *, void *, void *, uint32_t); 66int lpfc_workq_post_event(struct lpfc_hba *, void *, void *, uint32_t);
71int lpfc_do_work(void *); 67int lpfc_do_work(void *);
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h
index 098b8b45c7f1..084e7628ce17 100644
--- a/drivers/scsi/lpfc/lpfc_disc.h
+++ b/drivers/scsi/lpfc/lpfc_disc.h
@@ -70,7 +70,6 @@ struct lpfc_nodelist {
70 struct timer_list nlp_tmofunc; /* Used for nodev tmo */ 70 struct timer_list nlp_tmofunc; /* Used for nodev tmo */
71 struct fc_rport *rport; /* Corresponding FC transport 71 struct fc_rport *rport; /* Corresponding FC transport
72 port structure */ 72 port structure */
73 struct lpfc_nodelist *nlp_rpi_hash_next;
74 struct lpfc_hba *nlp_phba; 73 struct lpfc_hba *nlp_phba;
75 struct lpfc_work_evt nodev_timeout_evt; 74 struct lpfc_work_evt nodev_timeout_evt;
76 struct lpfc_work_evt els_retry_evt; 75 struct lpfc_work_evt els_retry_evt;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 6c846ad373bc..cd06d4c471ac 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -890,10 +890,7 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
890 890
891 pmb->context1 = NULL; 891 pmb->context1 = NULL;
892 892
893 if (ndlp->nlp_rpi != 0)
894 lpfc_findnode_remove_rpi(phba, ndlp->nlp_rpi);
895 ndlp->nlp_rpi = mb->un.varWords[0]; 893 ndlp->nlp_rpi = mb->un.varWords[0];
896 lpfc_addnode_rpi(phba, ndlp, ndlp->nlp_rpi);
897 ndlp->nlp_type |= NLP_FABRIC; 894 ndlp->nlp_type |= NLP_FABRIC;
898 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 895 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
899 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); 896 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
@@ -981,10 +978,7 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
981 978
982 pmb->context1 = NULL; 979 pmb->context1 = NULL;
983 980
984 if (ndlp->nlp_rpi != 0)
985 lpfc_findnode_remove_rpi(phba, ndlp->nlp_rpi);
986 ndlp->nlp_rpi = mb->un.varWords[0]; 981 ndlp->nlp_rpi = mb->un.varWords[0];
987 lpfc_addnode_rpi(phba, ndlp, ndlp->nlp_rpi);
988 ndlp->nlp_type |= NLP_FABRIC; 982 ndlp->nlp_type |= NLP_FABRIC;
989 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 983 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
990 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); 984 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
@@ -1488,7 +1482,6 @@ lpfc_unreg_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
1488 if (rc == MBX_NOT_FINISHED) 1482 if (rc == MBX_NOT_FINISHED)
1489 mempool_free( mbox, phba->mbox_mem_pool); 1483 mempool_free( mbox, phba->mbox_mem_pool);
1490 } 1484 }
1491 lpfc_findnode_remove_rpi(phba, ndlp->nlp_rpi);
1492 lpfc_no_rpi(phba, ndlp); 1485 lpfc_no_rpi(phba, ndlp);
1493 ndlp->nlp_rpi = 0; 1486 ndlp->nlp_rpi = 0;
1494 return 1; 1487 return 1;
@@ -2434,10 +2427,7 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
2434 2427
2435 pmb->context1 = NULL; 2428 pmb->context1 = NULL;
2436 2429
2437 if (ndlp->nlp_rpi != 0)
2438 lpfc_findnode_remove_rpi(phba, ndlp->nlp_rpi);
2439 ndlp->nlp_rpi = mb->un.varWords[0]; 2430 ndlp->nlp_rpi = mb->un.varWords[0];
2440 lpfc_addnode_rpi(phba, ndlp, ndlp->nlp_rpi);
2441 ndlp->nlp_type |= NLP_FABRIC; 2431 ndlp->nlp_type |= NLP_FABRIC;
2442 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 2432 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
2443 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); 2433 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
@@ -2463,75 +2453,28 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
2463} 2453}
2464 2454
2465/* 2455/*
2466 * This routine looks up the ndlp hash 2456 * This routine looks up the ndlp lists
2467 * table for the given RPI. If rpi found 2457 * for the given RPI. If rpi found
2468 * it return the node list pointer 2458 * it return the node list pointer
2469 * else return 0. 2459 * else return NULL.
2470 */ 2460 */
2471struct lpfc_nodelist * 2461struct lpfc_nodelist *
2472lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi) 2462lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi)
2473{ 2463{
2474 struct lpfc_nodelist *ret; 2464 struct lpfc_nodelist *ndlp;
2475 2465 struct list_head * lists[]={&phba->fc_nlpunmap_list,
2476 ret = phba->fc_nlplookup[LPFC_RPI_HASH_FUNC(rpi)]; 2466 &phba->fc_nlpmap_list,
2477 while ((ret != 0) && (ret->nlp_rpi != rpi)) { 2467 &phba->fc_plogi_list,
2478 ret = ret->nlp_rpi_hash_next; 2468 &phba->fc_adisc_list,
2479 } 2469 &phba->fc_reglogin_list};
2480 return ret; 2470 int i;
2481}
2482
2483/*
2484 * This routine looks up the ndlp hash table for the
2485 * given RPI. If rpi found it return the node list
2486 * pointer else return 0 after deleting the entry
2487 * from hash table.
2488 */
2489struct lpfc_nodelist *
2490lpfc_findnode_remove_rpi(struct lpfc_hba * phba, uint16_t rpi)
2491{
2492 struct lpfc_nodelist *ret, *temp;;
2493
2494 ret = phba->fc_nlplookup[LPFC_RPI_HASH_FUNC(rpi)];
2495 if (ret == 0)
2496 return NULL;
2497
2498 if (ret->nlp_rpi == rpi) {
2499 phba->fc_nlplookup[LPFC_RPI_HASH_FUNC(rpi)] =
2500 ret->nlp_rpi_hash_next;
2501 ret->nlp_rpi_hash_next = NULL;
2502 return ret;
2503 }
2504
2505 while ((ret->nlp_rpi_hash_next != 0) &&
2506 (ret->nlp_rpi_hash_next->nlp_rpi != rpi)) {
2507 ret = ret->nlp_rpi_hash_next;
2508 }
2509
2510 if (ret->nlp_rpi_hash_next != 0) {
2511 temp = ret->nlp_rpi_hash_next;
2512 ret->nlp_rpi_hash_next = temp->nlp_rpi_hash_next;
2513 temp->nlp_rpi_hash_next = NULL;
2514 return temp;
2515 } else {
2516 return NULL;
2517 }
2518}
2519
2520/*
2521 * This routine adds the node list entry to the
2522 * ndlp hash table.
2523 */
2524void
2525lpfc_addnode_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
2526 uint16_t rpi)
2527{
2528 2471
2529 uint32_t index; 2472 for (i = 0; i < ARRAY_SIZE(lists); i++ )
2473 list_for_each_entry(ndlp, lists[i], nlp_listp)
2474 if (ndlp->nlp_rpi == rpi)
2475 return (ndlp);
2530 2476
2531 index = LPFC_RPI_HASH_FUNC(rpi); 2477 return NULL;
2532 ndlp->nlp_rpi_hash_next = phba->fc_nlplookup[index];
2533 phba->fc_nlplookup[index] = ndlp;
2534 return;
2535} 2478}
2536 2479
2537void 2480void
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 9b35eaac781d..9a58de876d40 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -1086,11 +1086,7 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba,
1086 return (ndlp->nlp_state); 1086 return (ndlp->nlp_state);
1087 } 1087 }
1088 1088
1089 if (ndlp->nlp_rpi != 0)
1090 lpfc_findnode_remove_rpi(phba, ndlp->nlp_rpi);
1091
1092 ndlp->nlp_rpi = mb->un.varWords[0]; 1089 ndlp->nlp_rpi = mb->un.varWords[0];
1093 lpfc_addnode_rpi(phba, ndlp, ndlp->nlp_rpi);
1094 1090
1095 /* Only if we are not a fabric nport do we issue PRLI */ 1091 /* Only if we are not a fabric nport do we issue PRLI */
1096 if (!(ndlp->nlp_type & NLP_FABRIC)) { 1092 if (!(ndlp->nlp_type & NLP_FABRIC)) {
@@ -1593,12 +1589,7 @@ lpfc_cmpl_reglogin_npr_node(struct lpfc_hba * phba,
1593 pmb = (LPFC_MBOXQ_t *) arg; 1589 pmb = (LPFC_MBOXQ_t *) arg;
1594 mb = &pmb->mb; 1590 mb = &pmb->mb;
1595 1591
1596 /* save rpi */
1597 if (ndlp->nlp_rpi != 0)
1598 lpfc_findnode_remove_rpi(phba, ndlp->nlp_rpi);
1599
1600 ndlp->nlp_rpi = mb->un.varWords[0]; 1592 ndlp->nlp_rpi = mb->un.varWords[0];
1601 lpfc_addnode_rpi(phba, ndlp, ndlp->nlp_rpi);
1602 1593
1603 return (ndlp->nlp_state); 1594 return (ndlp->nlp_state);
1604} 1595}