aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_hbadisc.c
diff options
context:
space:
mode:
authorJames.Smart@Emulex.Com <James.Smart@Emulex.Com>2005-10-28 20:29:36 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-10-29 11:22:50 -0400
commit21568f5387636fe2bfb9ee42383d76de11ed99c7 (patch)
tree4b07a791e5d1e03607a3dd3312b85d584fb98141 /drivers/scsi/lpfc/lpfc_hbadisc.c
parent93a20f74450ca3402b3ba89fb490114cf6f2d353 (diff)
[SCSI] lpfc: Remove RPI hash from the driver
Table was not providing a lot of value and injected a couple of errors. Removed it and made functionality inline. 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_hbadisc.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c87
1 files changed, 15 insertions, 72 deletions
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