aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_rport.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libfc/fc_rport.c')
-rw-r--r--drivers/scsi/libfc/fc_rport.c78
1 files changed, 41 insertions, 37 deletions
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index cb54115c26c..acdc72d6b87 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -912,57 +912,61 @@ static void fc_rport_enter_logo(struct fc_rport_priv *rdata)
912 * fc_rport_recv_req() - Receive a request from a rport 912 * fc_rport_recv_req() - Receive a request from a rport
913 * @sp: current sequence in the PLOGI exchange 913 * @sp: current sequence in the PLOGI exchange
914 * @fp: response frame 914 * @fp: response frame
915 * @rdata_arg: private remote port data 915 * @lport: Fibre Channel local port
916 * 916 *
917 * Locking Note: Called without the rport lock held. This 917 * Locking Note: Called with the lport lock held.
918 * function will hold the rport lock, call an _enter_*
919 * function and then unlock the rport.
920 */ 918 */
921void fc_rport_recv_req(struct fc_seq *sp, struct fc_frame *fp, 919void fc_rport_recv_req(struct fc_seq *sp, struct fc_frame *fp,
922 struct fc_rport_priv *rdata) 920 struct fc_lport *lport)
923{ 921{
924 struct fc_lport *lport = rdata->local_port; 922 struct fc_rport_priv *rdata;
925
926 struct fc_frame_header *fh; 923 struct fc_frame_header *fh;
927 struct fc_seq_els_data els_data; 924 struct fc_seq_els_data els_data;
925 u32 s_id;
928 u8 op; 926 u8 op;
929 927
930 mutex_lock(&rdata->rp_mutex);
931
932 els_data.fp = NULL; 928 els_data.fp = NULL;
933 els_data.explan = ELS_EXPL_NONE; 929 els_data.explan = ELS_EXPL_NONE;
934 els_data.reason = ELS_RJT_NONE; 930 els_data.reason = ELS_RJT_NONE;
935 931
936 fh = fc_frame_header_get(fp); 932 fh = fc_frame_header_get(fp);
933 s_id = ntoh24(fh->fh_s_id);
937 934
938 if (fh->fh_r_ctl == FC_RCTL_ELS_REQ && fh->fh_type == FC_TYPE_ELS) { 935 rdata = lport->tt.rport_lookup(lport, s_id);
939 op = fc_frame_payload_op(fp); 936 if (!rdata) {
940 switch (op) { 937 els_data.reason = ELS_RJT_UNAB;
941 case ELS_PLOGI: 938 lport->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &els_data);
942 fc_rport_recv_plogi_req(rdata, sp, fp); 939 fc_frame_free(fp);
943 break; 940 return;
944 case ELS_PRLI: 941 }
945 fc_rport_recv_prli_req(rdata, sp, fp); 942 mutex_lock(&rdata->rp_mutex);
946 break; 943
947 case ELS_PRLO: 944 op = fc_frame_payload_op(fp);
948 fc_rport_recv_prlo_req(rdata, sp, fp); 945 switch (op) {
949 break; 946 case ELS_PLOGI:
950 case ELS_LOGO: 947 fc_rport_recv_plogi_req(rdata, sp, fp);
951 fc_rport_recv_logo_req(rdata, sp, fp); 948 break;
952 break; 949 case ELS_PRLI:
953 case ELS_RRQ: 950 fc_rport_recv_prli_req(rdata, sp, fp);
954 els_data.fp = fp; 951 break;
955 lport->tt.seq_els_rsp_send(sp, ELS_RRQ, &els_data); 952 case ELS_PRLO:
956 break; 953 fc_rport_recv_prlo_req(rdata, sp, fp);
957 case ELS_REC: 954 break;
958 els_data.fp = fp; 955 case ELS_LOGO:
959 lport->tt.seq_els_rsp_send(sp, ELS_REC, &els_data); 956 fc_rport_recv_logo_req(rdata, sp, fp);
960 break; 957 break;
961 default: 958 case ELS_RRQ:
962 els_data.reason = ELS_RJT_UNSUP; 959 els_data.fp = fp;
963 lport->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &els_data); 960 lport->tt.seq_els_rsp_send(sp, ELS_RRQ, &els_data);
964 break; 961 break;
965 } 962 case ELS_REC:
963 els_data.fp = fp;
964 lport->tt.seq_els_rsp_send(sp, ELS_REC, &els_data);
965 break;
966 default:
967 els_data.reason = ELS_RJT_UNSUP;
968 lport->tt.seq_els_rsp_send(sp, ELS_LS_RJT, &els_data);
969 break;
966 } 970 }
967 971
968 mutex_unlock(&rdata->rp_mutex); 972 mutex_unlock(&rdata->rp_mutex);