diff options
Diffstat (limited to 'drivers/scsi/libfc/fc_lport.c')
-rw-r--r-- | drivers/scsi/libfc/fc_lport.c | 173 |
1 files changed, 75 insertions, 98 deletions
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index 0b9bdb1fb807..2ae50a1188e6 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -139,7 +139,7 @@ static int fc_frame_drop(struct fc_lport *lport, struct fc_frame *fp) | |||
139 | } | 139 | } |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * fc_lport_rport_callback - Event handler for rport events | 142 | * fc_lport_rport_callback() - Event handler for rport events |
143 | * @lport: The lport which is receiving the event | 143 | * @lport: The lport which is receiving the event |
144 | * @rport: The rport which the event has occured on | 144 | * @rport: The rport which the event has occured on |
145 | * @event: The event that occured | 145 | * @event: The event that occured |
@@ -195,7 +195,7 @@ static void fc_lport_rport_callback(struct fc_lport *lport, | |||
195 | } | 195 | } |
196 | 196 | ||
197 | /** | 197 | /** |
198 | * fc_lport_state - Return a string which represents the lport's state | 198 | * fc_lport_state() - Return a string which represents the lport's state |
199 | * @lport: The lport whose state is to converted to a string | 199 | * @lport: The lport whose state is to converted to a string |
200 | */ | 200 | */ |
201 | static const char *fc_lport_state(struct fc_lport *lport) | 201 | static const char *fc_lport_state(struct fc_lport *lport) |
@@ -209,7 +209,7 @@ static const char *fc_lport_state(struct fc_lport *lport) | |||
209 | } | 209 | } |
210 | 210 | ||
211 | /** | 211 | /** |
212 | * fc_lport_ptp_setup - Create an rport for point-to-point mode | 212 | * fc_lport_ptp_setup() - Create an rport for point-to-point mode |
213 | * @lport: The lport to attach the ptp rport to | 213 | * @lport: The lport to attach the ptp rport to |
214 | * @fid: The FID of the ptp rport | 214 | * @fid: The FID of the ptp rport |
215 | * @remote_wwpn: The WWPN of the ptp rport | 215 | * @remote_wwpn: The WWPN of the ptp rport |
@@ -232,7 +232,7 @@ static void fc_lport_ptp_setup(struct fc_lport *lport, | |||
232 | lport->ptp_rp = NULL; | 232 | lport->ptp_rp = NULL; |
233 | } | 233 | } |
234 | 234 | ||
235 | lport->ptp_rp = fc_rport_rogue_create(&dp); | 235 | lport->ptp_rp = lport->tt.rport_create(&dp); |
236 | 236 | ||
237 | lport->tt.rport_login(lport->ptp_rp); | 237 | lport->tt.rport_login(lport->ptp_rp); |
238 | 238 | ||
@@ -250,7 +250,7 @@ void fc_get_host_port_state(struct Scsi_Host *shost) | |||
250 | { | 250 | { |
251 | struct fc_lport *lp = shost_priv(shost); | 251 | struct fc_lport *lp = shost_priv(shost); |
252 | 252 | ||
253 | if ((lp->link_status & FC_LINK_UP) == FC_LINK_UP) | 253 | if (lp->link_up) |
254 | fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; | 254 | fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; |
255 | else | 255 | else |
256 | fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; | 256 | fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; |
@@ -351,7 +351,7 @@ static void fc_lport_add_fc4_type(struct fc_lport *lport, enum fc_fh_type type) | |||
351 | } | 351 | } |
352 | 352 | ||
353 | /** | 353 | /** |
354 | * fc_lport_recv_rlir_req - Handle received Registered Link Incident Report. | 354 | * fc_lport_recv_rlir_req() - Handle received Registered Link Incident Report. |
355 | * @lport: Fibre Channel local port recieving the RLIR | 355 | * @lport: Fibre Channel local port recieving the RLIR |
356 | * @sp: current sequence in the RLIR exchange | 356 | * @sp: current sequence in the RLIR exchange |
357 | * @fp: RLIR request frame | 357 | * @fp: RLIR request frame |
@@ -370,7 +370,7 @@ static void fc_lport_recv_rlir_req(struct fc_seq *sp, struct fc_frame *fp, | |||
370 | } | 370 | } |
371 | 371 | ||
372 | /** | 372 | /** |
373 | * fc_lport_recv_echo_req - Handle received ECHO request | 373 | * fc_lport_recv_echo_req() - Handle received ECHO request |
374 | * @lport: Fibre Channel local port recieving the ECHO | 374 | * @lport: Fibre Channel local port recieving the ECHO |
375 | * @sp: current sequence in the ECHO exchange | 375 | * @sp: current sequence in the ECHO exchange |
376 | * @fp: ECHO request frame | 376 | * @fp: ECHO request frame |
@@ -412,7 +412,7 @@ static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp, | |||
412 | } | 412 | } |
413 | 413 | ||
414 | /** | 414 | /** |
415 | * fc_lport_recv_echo_req - Handle received Request Node ID data request | 415 | * fc_lport_recv_echo_req() - Handle received Request Node ID data request |
416 | * @lport: Fibre Channel local port recieving the RNID | 416 | * @lport: Fibre Channel local port recieving the RNID |
417 | * @sp: current sequence in the RNID exchange | 417 | * @sp: current sequence in the RNID exchange |
418 | * @fp: RNID request frame | 418 | * @fp: RNID request frame |
@@ -479,7 +479,7 @@ static void fc_lport_recv_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp, | |||
479 | } | 479 | } |
480 | 480 | ||
481 | /** | 481 | /** |
482 | * fc_lport_recv_adisc_req - Handle received Address Discovery Request | 482 | * fc_lport_recv_adisc_req() - Handle received Address Discovery Request |
483 | * @lport: Fibre Channel local port recieving the ADISC | 483 | * @lport: Fibre Channel local port recieving the ADISC |
484 | * @sp: current sequence in the ADISC exchange | 484 | * @sp: current sequence in the ADISC exchange |
485 | * @fp: ADISC request frame | 485 | * @fp: ADISC request frame |
@@ -529,7 +529,7 @@ static void fc_lport_recv_adisc_req(struct fc_seq *sp, struct fc_frame *in_fp, | |||
529 | } | 529 | } |
530 | 530 | ||
531 | /** | 531 | /** |
532 | * fc_lport_recv_logo_req - Handle received fabric LOGO request | 532 | * fc_lport_recv_logo_req() - Handle received fabric LOGO request |
533 | * @lport: Fibre Channel local port recieving the LOGO | 533 | * @lport: Fibre Channel local port recieving the LOGO |
534 | * @sp: current sequence in the LOGO exchange | 534 | * @sp: current sequence in the LOGO exchange |
535 | * @fp: LOGO request frame | 535 | * @fp: LOGO request frame |
@@ -546,7 +546,7 @@ static void fc_lport_recv_logo_req(struct fc_seq *sp, struct fc_frame *fp, | |||
546 | } | 546 | } |
547 | 547 | ||
548 | /** | 548 | /** |
549 | * fc_fabric_login - Start the lport state machine | 549 | * fc_fabric_login() - Start the lport state machine |
550 | * @lport: The lport that should log into the fabric | 550 | * @lport: The lport that should log into the fabric |
551 | * | 551 | * |
552 | * Locking Note: This function should not be called | 552 | * Locking Note: This function should not be called |
@@ -568,7 +568,7 @@ int fc_fabric_login(struct fc_lport *lport) | |||
568 | EXPORT_SYMBOL(fc_fabric_login); | 568 | EXPORT_SYMBOL(fc_fabric_login); |
569 | 569 | ||
570 | /** | 570 | /** |
571 | * fc_linkup - Handler for transport linkup events | 571 | * fc_linkup() - Handler for transport linkup events |
572 | * @lport: The lport whose link is up | 572 | * @lport: The lport whose link is up |
573 | */ | 573 | */ |
574 | void fc_linkup(struct fc_lport *lport) | 574 | void fc_linkup(struct fc_lport *lport) |
@@ -577,8 +577,8 @@ void fc_linkup(struct fc_lport *lport) | |||
577 | fc_host_port_id(lport->host)); | 577 | fc_host_port_id(lport->host)); |
578 | 578 | ||
579 | mutex_lock(&lport->lp_mutex); | 579 | mutex_lock(&lport->lp_mutex); |
580 | if ((lport->link_status & FC_LINK_UP) != FC_LINK_UP) { | 580 | if (!lport->link_up) { |
581 | lport->link_status |= FC_LINK_UP; | 581 | lport->link_up = 1; |
582 | 582 | ||
583 | if (lport->state == LPORT_ST_RESET) | 583 | if (lport->state == LPORT_ST_RESET) |
584 | fc_lport_enter_flogi(lport); | 584 | fc_lport_enter_flogi(lport); |
@@ -588,7 +588,7 @@ void fc_linkup(struct fc_lport *lport) | |||
588 | EXPORT_SYMBOL(fc_linkup); | 588 | EXPORT_SYMBOL(fc_linkup); |
589 | 589 | ||
590 | /** | 590 | /** |
591 | * fc_linkdown - Handler for transport linkdown events | 591 | * fc_linkdown() - Handler for transport linkdown events |
592 | * @lport: The lport whose link is down | 592 | * @lport: The lport whose link is down |
593 | */ | 593 | */ |
594 | void fc_linkdown(struct fc_lport *lport) | 594 | void fc_linkdown(struct fc_lport *lport) |
@@ -597,8 +597,8 @@ void fc_linkdown(struct fc_lport *lport) | |||
597 | FC_DEBUG_LPORT("Link is down for port (%6x)\n", | 597 | FC_DEBUG_LPORT("Link is down for port (%6x)\n", |
598 | fc_host_port_id(lport->host)); | 598 | fc_host_port_id(lport->host)); |
599 | 599 | ||
600 | if ((lport->link_status & FC_LINK_UP) == FC_LINK_UP) { | 600 | if (lport->link_up) { |
601 | lport->link_status &= ~(FC_LINK_UP); | 601 | lport->link_up = 0; |
602 | fc_lport_enter_reset(lport); | 602 | fc_lport_enter_reset(lport); |
603 | lport->tt.fcp_cleanup(lport); | 603 | lport->tt.fcp_cleanup(lport); |
604 | } | 604 | } |
@@ -607,48 +607,25 @@ void fc_linkdown(struct fc_lport *lport) | |||
607 | EXPORT_SYMBOL(fc_linkdown); | 607 | EXPORT_SYMBOL(fc_linkdown); |
608 | 608 | ||
609 | /** | 609 | /** |
610 | * fc_pause - Pause the flow of frames | 610 | * fc_fabric_logoff() - Logout of the fabric |
611 | * @lport: The lport to be paused | ||
612 | */ | ||
613 | void fc_pause(struct fc_lport *lport) | ||
614 | { | ||
615 | mutex_lock(&lport->lp_mutex); | ||
616 | lport->link_status |= FC_PAUSE; | ||
617 | mutex_unlock(&lport->lp_mutex); | ||
618 | } | ||
619 | EXPORT_SYMBOL(fc_pause); | ||
620 | |||
621 | /** | ||
622 | * fc_unpause - Unpause the flow of frames | ||
623 | * @lport: The lport to be unpaused | ||
624 | */ | ||
625 | void fc_unpause(struct fc_lport *lport) | ||
626 | { | ||
627 | mutex_lock(&lport->lp_mutex); | ||
628 | lport->link_status &= ~(FC_PAUSE); | ||
629 | mutex_unlock(&lport->lp_mutex); | ||
630 | } | ||
631 | EXPORT_SYMBOL(fc_unpause); | ||
632 | |||
633 | /** | ||
634 | * fc_fabric_logoff - Logout of the fabric | ||
635 | * @lport: fc_lport pointer to logoff the fabric | 611 | * @lport: fc_lport pointer to logoff the fabric |
636 | * | 612 | * |
637 | * Return value: | 613 | * Return value: |
638 | * 0 for success, -1 for failure | 614 | * 0 for success, -1 for failure |
639 | **/ | 615 | */ |
640 | int fc_fabric_logoff(struct fc_lport *lport) | 616 | int fc_fabric_logoff(struct fc_lport *lport) |
641 | { | 617 | { |
642 | lport->tt.disc_stop_final(lport); | 618 | lport->tt.disc_stop_final(lport); |
643 | mutex_lock(&lport->lp_mutex); | 619 | mutex_lock(&lport->lp_mutex); |
644 | fc_lport_enter_logo(lport); | 620 | fc_lport_enter_logo(lport); |
645 | mutex_unlock(&lport->lp_mutex); | 621 | mutex_unlock(&lport->lp_mutex); |
622 | cancel_delayed_work_sync(&lport->retry_work); | ||
646 | return 0; | 623 | return 0; |
647 | } | 624 | } |
648 | EXPORT_SYMBOL(fc_fabric_logoff); | 625 | EXPORT_SYMBOL(fc_fabric_logoff); |
649 | 626 | ||
650 | /** | 627 | /** |
651 | * fc_lport_destroy - unregister a fc_lport | 628 | * fc_lport_destroy() - unregister a fc_lport |
652 | * @lport: fc_lport pointer to unregister | 629 | * @lport: fc_lport pointer to unregister |
653 | * | 630 | * |
654 | * Return value: | 631 | * Return value: |
@@ -658,26 +635,25 @@ EXPORT_SYMBOL(fc_fabric_logoff); | |||
658 | * clean-up all the allocated memory | 635 | * clean-up all the allocated memory |
659 | * and free up other system resources. | 636 | * and free up other system resources. |
660 | * | 637 | * |
661 | **/ | 638 | */ |
662 | int fc_lport_destroy(struct fc_lport *lport) | 639 | int fc_lport_destroy(struct fc_lport *lport) |
663 | { | 640 | { |
664 | lport->tt.frame_send = fc_frame_drop; | 641 | lport->tt.frame_send = fc_frame_drop; |
665 | lport->tt.fcp_abort_io(lport); | 642 | lport->tt.fcp_abort_io(lport); |
666 | lport->tt.exch_mgr_reset(lport->emp, 0, 0); | 643 | lport->tt.exch_mgr_reset(lport, 0, 0); |
667 | return 0; | 644 | return 0; |
668 | } | 645 | } |
669 | EXPORT_SYMBOL(fc_lport_destroy); | 646 | EXPORT_SYMBOL(fc_lport_destroy); |
670 | 647 | ||
671 | /** | 648 | /** |
672 | * fc_set_mfs - sets up the mfs for the corresponding fc_lport | 649 | * fc_set_mfs() - sets up the mfs for the corresponding fc_lport |
673 | * @lport: fc_lport pointer to unregister | 650 | * @lport: fc_lport pointer to unregister |
674 | * @mfs: the new mfs for fc_lport | 651 | * @mfs: the new mfs for fc_lport |
675 | * | 652 | * |
676 | * Set mfs for the given fc_lport to the new mfs. | 653 | * Set mfs for the given fc_lport to the new mfs. |
677 | * | 654 | * |
678 | * Return: 0 for success | 655 | * Return: 0 for success |
679 | * | 656 | */ |
680 | **/ | ||
681 | int fc_set_mfs(struct fc_lport *lport, u32 mfs) | 657 | int fc_set_mfs(struct fc_lport *lport, u32 mfs) |
682 | { | 658 | { |
683 | unsigned int old_mfs; | 659 | unsigned int old_mfs; |
@@ -706,7 +682,7 @@ int fc_set_mfs(struct fc_lport *lport, u32 mfs) | |||
706 | EXPORT_SYMBOL(fc_set_mfs); | 682 | EXPORT_SYMBOL(fc_set_mfs); |
707 | 683 | ||
708 | /** | 684 | /** |
709 | * fc_lport_disc_callback - Callback for discovery events | 685 | * fc_lport_disc_callback() - Callback for discovery events |
710 | * @lport: FC local port | 686 | * @lport: FC local port |
711 | * @event: The discovery event | 687 | * @event: The discovery event |
712 | */ | 688 | */ |
@@ -731,7 +707,7 @@ void fc_lport_disc_callback(struct fc_lport *lport, enum fc_disc_event event) | |||
731 | } | 707 | } |
732 | 708 | ||
733 | /** | 709 | /** |
734 | * fc_rport_enter_ready - Enter the ready state and start discovery | 710 | * fc_rport_enter_ready() - Enter the ready state and start discovery |
735 | * @lport: Fibre Channel local port that is ready | 711 | * @lport: Fibre Channel local port that is ready |
736 | * | 712 | * |
737 | * Locking Note: The lport lock is expected to be held before calling | 713 | * Locking Note: The lport lock is expected to be held before calling |
@@ -748,7 +724,7 @@ static void fc_lport_enter_ready(struct fc_lport *lport) | |||
748 | } | 724 | } |
749 | 725 | ||
750 | /** | 726 | /** |
751 | * fc_lport_recv_flogi_req - Receive a FLOGI request | 727 | * fc_lport_recv_flogi_req() - Receive a FLOGI request |
752 | * @sp_in: The sequence the FLOGI is on | 728 | * @sp_in: The sequence the FLOGI is on |
753 | * @rx_fp: The frame the FLOGI is in | 729 | * @rx_fp: The frame the FLOGI is in |
754 | * @lport: The lport that recieved the request | 730 | * @lport: The lport that recieved the request |
@@ -838,7 +814,7 @@ out: | |||
838 | } | 814 | } |
839 | 815 | ||
840 | /** | 816 | /** |
841 | * fc_lport_recv_req - The generic lport request handler | 817 | * fc_lport_recv_req() - The generic lport request handler |
842 | * @lport: The lport that received the request | 818 | * @lport: The lport that received the request |
843 | * @sp: The sequence the request is on | 819 | * @sp: The sequence the request is on |
844 | * @fp: The frame the request is in | 820 | * @fp: The frame the request is in |
@@ -934,7 +910,7 @@ static void fc_lport_recv_req(struct fc_lport *lport, struct fc_seq *sp, | |||
934 | } | 910 | } |
935 | 911 | ||
936 | /** | 912 | /** |
937 | * fc_lport_reset - Reset an lport | 913 | * fc_lport_reset() - Reset an lport |
938 | * @lport: The lport which should be reset | 914 | * @lport: The lport which should be reset |
939 | * | 915 | * |
940 | * Locking Note: This functions should not be called with the | 916 | * Locking Note: This functions should not be called with the |
@@ -942,6 +918,7 @@ static void fc_lport_recv_req(struct fc_lport *lport, struct fc_seq *sp, | |||
942 | */ | 918 | */ |
943 | int fc_lport_reset(struct fc_lport *lport) | 919 | int fc_lport_reset(struct fc_lport *lport) |
944 | { | 920 | { |
921 | cancel_delayed_work_sync(&lport->retry_work); | ||
945 | mutex_lock(&lport->lp_mutex); | 922 | mutex_lock(&lport->lp_mutex); |
946 | fc_lport_enter_reset(lport); | 923 | fc_lport_enter_reset(lport); |
947 | mutex_unlock(&lport->lp_mutex); | 924 | mutex_unlock(&lport->lp_mutex); |
@@ -950,7 +927,7 @@ int fc_lport_reset(struct fc_lport *lport) | |||
950 | EXPORT_SYMBOL(fc_lport_reset); | 927 | EXPORT_SYMBOL(fc_lport_reset); |
951 | 928 | ||
952 | /** | 929 | /** |
953 | * fc_rport_enter_reset - Reset the local port | 930 | * fc_rport_enter_reset() - Reset the local port |
954 | * @lport: Fibre Channel local port to be reset | 931 | * @lport: Fibre Channel local port to be reset |
955 | * | 932 | * |
956 | * Locking Note: The lport lock is expected to be held before calling | 933 | * Locking Note: The lport lock is expected to be held before calling |
@@ -973,16 +950,16 @@ static void fc_lport_enter_reset(struct fc_lport *lport) | |||
973 | 950 | ||
974 | lport->tt.disc_stop(lport); | 951 | lport->tt.disc_stop(lport); |
975 | 952 | ||
976 | lport->tt.exch_mgr_reset(lport->emp, 0, 0); | 953 | lport->tt.exch_mgr_reset(lport, 0, 0); |
977 | fc_host_fabric_name(lport->host) = 0; | 954 | fc_host_fabric_name(lport->host) = 0; |
978 | fc_host_port_id(lport->host) = 0; | 955 | fc_host_port_id(lport->host) = 0; |
979 | 956 | ||
980 | if ((lport->link_status & FC_LINK_UP) == FC_LINK_UP) | 957 | if (lport->link_up) |
981 | fc_lport_enter_flogi(lport); | 958 | fc_lport_enter_flogi(lport); |
982 | } | 959 | } |
983 | 960 | ||
984 | /** | 961 | /** |
985 | * fc_lport_error - Handler for any errors | 962 | * fc_lport_error() - Handler for any errors |
986 | * @lport: The fc_lport object | 963 | * @lport: The fc_lport object |
987 | * @fp: The frame pointer | 964 | * @fp: The frame pointer |
988 | * | 965 | * |
@@ -1029,8 +1006,8 @@ static void fc_lport_error(struct fc_lport *lport, struct fc_frame *fp) | |||
1029 | } | 1006 | } |
1030 | 1007 | ||
1031 | /** | 1008 | /** |
1032 | * fc_lport_rft_id_resp - Handle response to Register Fibre | 1009 | * fc_lport_rft_id_resp() - Handle response to Register Fibre |
1033 | * Channel Types by ID (RPN_ID) request | 1010 | * Channel Types by ID (RPN_ID) request |
1034 | * @sp: current sequence in RPN_ID exchange | 1011 | * @sp: current sequence in RPN_ID exchange |
1035 | * @fp: response frame | 1012 | * @fp: response frame |
1036 | * @lp_arg: Fibre Channel host port instance | 1013 | * @lp_arg: Fibre Channel host port instance |
@@ -1053,17 +1030,17 @@ static void fc_lport_rft_id_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1053 | 1030 | ||
1054 | FC_DEBUG_LPORT("Received a RFT_ID response\n"); | 1031 | FC_DEBUG_LPORT("Received a RFT_ID response\n"); |
1055 | 1032 | ||
1033 | if (IS_ERR(fp)) { | ||
1034 | fc_lport_error(lport, fp); | ||
1035 | goto err; | ||
1036 | } | ||
1037 | |||
1056 | if (lport->state != LPORT_ST_RFT_ID) { | 1038 | if (lport->state != LPORT_ST_RFT_ID) { |
1057 | FC_DBG("Received a RFT_ID response, but in state %s\n", | 1039 | FC_DBG("Received a RFT_ID response, but in state %s\n", |
1058 | fc_lport_state(lport)); | 1040 | fc_lport_state(lport)); |
1059 | goto out; | 1041 | goto out; |
1060 | } | 1042 | } |
1061 | 1043 | ||
1062 | if (IS_ERR(fp)) { | ||
1063 | fc_lport_error(lport, fp); | ||
1064 | goto err; | ||
1065 | } | ||
1066 | |||
1067 | fh = fc_frame_header_get(fp); | 1044 | fh = fc_frame_header_get(fp); |
1068 | ct = fc_frame_payload_get(fp, sizeof(*ct)); | 1045 | ct = fc_frame_payload_get(fp, sizeof(*ct)); |
1069 | 1046 | ||
@@ -1081,8 +1058,8 @@ err: | |||
1081 | } | 1058 | } |
1082 | 1059 | ||
1083 | /** | 1060 | /** |
1084 | * fc_lport_rpn_id_resp - Handle response to Register Port | 1061 | * fc_lport_rpn_id_resp() - Handle response to Register Port |
1085 | * Name by ID (RPN_ID) request | 1062 | * Name by ID (RPN_ID) request |
1086 | * @sp: current sequence in RPN_ID exchange | 1063 | * @sp: current sequence in RPN_ID exchange |
1087 | * @fp: response frame | 1064 | * @fp: response frame |
1088 | * @lp_arg: Fibre Channel host port instance | 1065 | * @lp_arg: Fibre Channel host port instance |
@@ -1105,17 +1082,17 @@ static void fc_lport_rpn_id_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1105 | 1082 | ||
1106 | FC_DEBUG_LPORT("Received a RPN_ID response\n"); | 1083 | FC_DEBUG_LPORT("Received a RPN_ID response\n"); |
1107 | 1084 | ||
1085 | if (IS_ERR(fp)) { | ||
1086 | fc_lport_error(lport, fp); | ||
1087 | goto err; | ||
1088 | } | ||
1089 | |||
1108 | if (lport->state != LPORT_ST_RPN_ID) { | 1090 | if (lport->state != LPORT_ST_RPN_ID) { |
1109 | FC_DBG("Received a RPN_ID response, but in state %s\n", | 1091 | FC_DBG("Received a RPN_ID response, but in state %s\n", |
1110 | fc_lport_state(lport)); | 1092 | fc_lport_state(lport)); |
1111 | goto out; | 1093 | goto out; |
1112 | } | 1094 | } |
1113 | 1095 | ||
1114 | if (IS_ERR(fp)) { | ||
1115 | fc_lport_error(lport, fp); | ||
1116 | goto err; | ||
1117 | } | ||
1118 | |||
1119 | fh = fc_frame_header_get(fp); | 1096 | fh = fc_frame_header_get(fp); |
1120 | ct = fc_frame_payload_get(fp, sizeof(*ct)); | 1097 | ct = fc_frame_payload_get(fp, sizeof(*ct)); |
1121 | if (fh && ct && fh->fh_type == FC_TYPE_CT && | 1098 | if (fh && ct && fh->fh_type == FC_TYPE_CT && |
@@ -1133,7 +1110,7 @@ err: | |||
1133 | } | 1110 | } |
1134 | 1111 | ||
1135 | /** | 1112 | /** |
1136 | * fc_lport_scr_resp - Handle response to State Change Register (SCR) request | 1113 | * fc_lport_scr_resp() - Handle response to State Change Register (SCR) request |
1137 | * @sp: current sequence in SCR exchange | 1114 | * @sp: current sequence in SCR exchange |
1138 | * @fp: response frame | 1115 | * @fp: response frame |
1139 | * @lp_arg: Fibre Channel lport port instance that sent the registration request | 1116 | * @lp_arg: Fibre Channel lport port instance that sent the registration request |
@@ -1155,17 +1132,17 @@ static void fc_lport_scr_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1155 | 1132 | ||
1156 | FC_DEBUG_LPORT("Received a SCR response\n"); | 1133 | FC_DEBUG_LPORT("Received a SCR response\n"); |
1157 | 1134 | ||
1135 | if (IS_ERR(fp)) { | ||
1136 | fc_lport_error(lport, fp); | ||
1137 | goto err; | ||
1138 | } | ||
1139 | |||
1158 | if (lport->state != LPORT_ST_SCR) { | 1140 | if (lport->state != LPORT_ST_SCR) { |
1159 | FC_DBG("Received a SCR response, but in state %s\n", | 1141 | FC_DBG("Received a SCR response, but in state %s\n", |
1160 | fc_lport_state(lport)); | 1142 | fc_lport_state(lport)); |
1161 | goto out; | 1143 | goto out; |
1162 | } | 1144 | } |
1163 | 1145 | ||
1164 | if (IS_ERR(fp)) { | ||
1165 | fc_lport_error(lport, fp); | ||
1166 | goto err; | ||
1167 | } | ||
1168 | |||
1169 | op = fc_frame_payload_op(fp); | 1146 | op = fc_frame_payload_op(fp); |
1170 | if (op == ELS_LS_ACC) | 1147 | if (op == ELS_LS_ACC) |
1171 | fc_lport_enter_ready(lport); | 1148 | fc_lport_enter_ready(lport); |
@@ -1179,7 +1156,7 @@ err: | |||
1179 | } | 1156 | } |
1180 | 1157 | ||
1181 | /** | 1158 | /** |
1182 | * fc_lport_enter_scr - Send a State Change Register (SCR) request | 1159 | * fc_lport_enter_scr() - Send a State Change Register (SCR) request |
1183 | * @lport: Fibre Channel local port to register for state changes | 1160 | * @lport: Fibre Channel local port to register for state changes |
1184 | * | 1161 | * |
1185 | * Locking Note: The lport lock is expected to be held before calling | 1162 | * Locking Note: The lport lock is expected to be held before calling |
@@ -1206,7 +1183,7 @@ static void fc_lport_enter_scr(struct fc_lport *lport) | |||
1206 | } | 1183 | } |
1207 | 1184 | ||
1208 | /** | 1185 | /** |
1209 | * fc_lport_enter_rft_id - Register FC4-types with the name server | 1186 | * fc_lport_enter_rft_id() - Register FC4-types with the name server |
1210 | * @lport: Fibre Channel local port to register | 1187 | * @lport: Fibre Channel local port to register |
1211 | * | 1188 | * |
1212 | * Locking Note: The lport lock is expected to be held before calling | 1189 | * Locking Note: The lport lock is expected to be held before calling |
@@ -1248,7 +1225,7 @@ static void fc_lport_enter_rft_id(struct fc_lport *lport) | |||
1248 | } | 1225 | } |
1249 | 1226 | ||
1250 | /** | 1227 | /** |
1251 | * fc_rport_enter_rft_id - Register port name with the name server | 1228 | * fc_rport_enter_rft_id() - Register port name with the name server |
1252 | * @lport: Fibre Channel local port to register | 1229 | * @lport: Fibre Channel local port to register |
1253 | * | 1230 | * |
1254 | * Locking Note: The lport lock is expected to be held before calling | 1231 | * Locking Note: The lport lock is expected to be held before calling |
@@ -1281,7 +1258,7 @@ static struct fc_rport_operations fc_lport_rport_ops = { | |||
1281 | }; | 1258 | }; |
1282 | 1259 | ||
1283 | /** | 1260 | /** |
1284 | * fc_rport_enter_dns - Create a rport to the name server | 1261 | * fc_rport_enter_dns() - Create a rport to the name server |
1285 | * @lport: Fibre Channel local port requesting a rport for the name server | 1262 | * @lport: Fibre Channel local port requesting a rport for the name server |
1286 | * | 1263 | * |
1287 | * Locking Note: The lport lock is expected to be held before calling | 1264 | * Locking Note: The lport lock is expected to be held before calling |
@@ -1304,7 +1281,7 @@ static void fc_lport_enter_dns(struct fc_lport *lport) | |||
1304 | 1281 | ||
1305 | fc_lport_state_enter(lport, LPORT_ST_DNS); | 1282 | fc_lport_state_enter(lport, LPORT_ST_DNS); |
1306 | 1283 | ||
1307 | rport = fc_rport_rogue_create(&dp); | 1284 | rport = lport->tt.rport_create(&dp); |
1308 | if (!rport) | 1285 | if (!rport) |
1309 | goto err; | 1286 | goto err; |
1310 | 1287 | ||
@@ -1318,7 +1295,7 @@ err: | |||
1318 | } | 1295 | } |
1319 | 1296 | ||
1320 | /** | 1297 | /** |
1321 | * fc_lport_timeout - Handler for the retry_work timer. | 1298 | * fc_lport_timeout() - Handler for the retry_work timer. |
1322 | * @work: The work struct of the fc_lport | 1299 | * @work: The work struct of the fc_lport |
1323 | */ | 1300 | */ |
1324 | static void fc_lport_timeout(struct work_struct *work) | 1301 | static void fc_lport_timeout(struct work_struct *work) |
@@ -1359,7 +1336,7 @@ static void fc_lport_timeout(struct work_struct *work) | |||
1359 | } | 1336 | } |
1360 | 1337 | ||
1361 | /** | 1338 | /** |
1362 | * fc_lport_logo_resp - Handle response to LOGO request | 1339 | * fc_lport_logo_resp() - Handle response to LOGO request |
1363 | * @sp: current sequence in LOGO exchange | 1340 | * @sp: current sequence in LOGO exchange |
1364 | * @fp: response frame | 1341 | * @fp: response frame |
1365 | * @lp_arg: Fibre Channel lport port instance that sent the LOGO request | 1342 | * @lp_arg: Fibre Channel lport port instance that sent the LOGO request |
@@ -1381,17 +1358,17 @@ static void fc_lport_logo_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1381 | 1358 | ||
1382 | FC_DEBUG_LPORT("Received a LOGO response\n"); | 1359 | FC_DEBUG_LPORT("Received a LOGO response\n"); |
1383 | 1360 | ||
1361 | if (IS_ERR(fp)) { | ||
1362 | fc_lport_error(lport, fp); | ||
1363 | goto err; | ||
1364 | } | ||
1365 | |||
1384 | if (lport->state != LPORT_ST_LOGO) { | 1366 | if (lport->state != LPORT_ST_LOGO) { |
1385 | FC_DBG("Received a LOGO response, but in state %s\n", | 1367 | FC_DBG("Received a LOGO response, but in state %s\n", |
1386 | fc_lport_state(lport)); | 1368 | fc_lport_state(lport)); |
1387 | goto out; | 1369 | goto out; |
1388 | } | 1370 | } |
1389 | 1371 | ||
1390 | if (IS_ERR(fp)) { | ||
1391 | fc_lport_error(lport, fp); | ||
1392 | goto err; | ||
1393 | } | ||
1394 | |||
1395 | op = fc_frame_payload_op(fp); | 1372 | op = fc_frame_payload_op(fp); |
1396 | if (op == ELS_LS_ACC) | 1373 | if (op == ELS_LS_ACC) |
1397 | fc_lport_enter_reset(lport); | 1374 | fc_lport_enter_reset(lport); |
@@ -1405,7 +1382,7 @@ err: | |||
1405 | } | 1382 | } |
1406 | 1383 | ||
1407 | /** | 1384 | /** |
1408 | * fc_rport_enter_logo - Logout of the fabric | 1385 | * fc_rport_enter_logo() - Logout of the fabric |
1409 | * @lport: Fibre Channel local port to be logged out | 1386 | * @lport: Fibre Channel local port to be logged out |
1410 | * | 1387 | * |
1411 | * Locking Note: The lport lock is expected to be held before calling | 1388 | * Locking Note: The lport lock is expected to be held before calling |
@@ -1437,7 +1414,7 @@ static void fc_lport_enter_logo(struct fc_lport *lport) | |||
1437 | } | 1414 | } |
1438 | 1415 | ||
1439 | /** | 1416 | /** |
1440 | * fc_lport_flogi_resp - Handle response to FLOGI request | 1417 | * fc_lport_flogi_resp() - Handle response to FLOGI request |
1441 | * @sp: current sequence in FLOGI exchange | 1418 | * @sp: current sequence in FLOGI exchange |
1442 | * @fp: response frame | 1419 | * @fp: response frame |
1443 | * @lp_arg: Fibre Channel lport port instance that sent the FLOGI request | 1420 | * @lp_arg: Fibre Channel lport port instance that sent the FLOGI request |
@@ -1465,17 +1442,17 @@ static void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1465 | 1442 | ||
1466 | FC_DEBUG_LPORT("Received a FLOGI response\n"); | 1443 | FC_DEBUG_LPORT("Received a FLOGI response\n"); |
1467 | 1444 | ||
1445 | if (IS_ERR(fp)) { | ||
1446 | fc_lport_error(lport, fp); | ||
1447 | goto err; | ||
1448 | } | ||
1449 | |||
1468 | if (lport->state != LPORT_ST_FLOGI) { | 1450 | if (lport->state != LPORT_ST_FLOGI) { |
1469 | FC_DBG("Received a FLOGI response, but in state %s\n", | 1451 | FC_DBG("Received a FLOGI response, but in state %s\n", |
1470 | fc_lport_state(lport)); | 1452 | fc_lport_state(lport)); |
1471 | goto out; | 1453 | goto out; |
1472 | } | 1454 | } |
1473 | 1455 | ||
1474 | if (IS_ERR(fp)) { | ||
1475 | fc_lport_error(lport, fp); | ||
1476 | goto err; | ||
1477 | } | ||
1478 | |||
1479 | fh = fc_frame_header_get(fp); | 1456 | fh = fc_frame_header_get(fp); |
1480 | did = ntoh24(fh->fh_d_id); | 1457 | did = ntoh24(fh->fh_d_id); |
1481 | if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) { | 1458 | if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) { |
@@ -1532,7 +1509,7 @@ err: | |||
1532 | } | 1509 | } |
1533 | 1510 | ||
1534 | /** | 1511 | /** |
1535 | * fc_rport_enter_flogi - Send a FLOGI request to the fabric manager | 1512 | * fc_rport_enter_flogi() - Send a FLOGI request to the fabric manager |
1536 | * @lport: Fibre Channel local port to be logged in to the fabric | 1513 | * @lport: Fibre Channel local port to be logged in to the fabric |
1537 | * | 1514 | * |
1538 | * Locking Note: The lport lock is expected to be held before calling | 1515 | * Locking Note: The lport lock is expected to be held before calling |