diff options
author | James.Smart@Emulex.Com <James.Smart@Emulex.Com> | 2005-10-28 20:29:36 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-10-29 11:22:50 -0400 |
commit | 21568f5387636fe2bfb9ee42383d76de11ed99c7 (patch) | |
tree | 4b07a791e5d1e03607a3dd3312b85d584fb98141 /drivers | |
parent | 93a20f74450ca3402b3ba89fb490114cf6f2d353 (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')
-rw-r--r-- | drivers/scsi/lpfc/lpfc.h | 4 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 4 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_disc.h | 1 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 87 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_nportdisc.c | 9 |
5 files changed, 15 insertions, 90 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index adb95674823..3062b39fbdb 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 bd5135d3eee..ffc58f9a5a5 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); | |||
62 | void lpfc_scan_timeout(unsigned long); | 62 | void lpfc_scan_timeout(unsigned long); |
63 | 63 | ||
64 | struct lpfc_nodelist *lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi); | 64 | struct lpfc_nodelist *lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi); |
65 | struct lpfc_nodelist *lpfc_findnode_remove_rpi(struct lpfc_hba * phba, | ||
66 | uint16_t rpi); | ||
67 | void lpfc_addnode_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, | ||
68 | uint16_t rpi); | ||
69 | 65 | ||
70 | int lpfc_workq_post_event(struct lpfc_hba *, void *, void *, uint32_t); | 66 | int lpfc_workq_post_event(struct lpfc_hba *, void *, void *, uint32_t); |
71 | int lpfc_do_work(void *); | 67 | int lpfc_do_work(void *); |
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h index 098b8b45c7f..084e7628ce1 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 6c846ad373b..cd06d4c471a 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 | */ |
2471 | struct lpfc_nodelist * | 2461 | struct lpfc_nodelist * |
2472 | lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi) | 2462 | lpfc_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 | */ | ||
2489 | struct lpfc_nodelist * | ||
2490 | lpfc_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 | */ | ||
2524 | void | ||
2525 | lpfc_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 | ||
2537 | void | 2480 | void |
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 9b35eaac781..9a58de876d4 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 | } |