@@ -580,36 +580,29 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
580580
581581 if (!found ) {
582582 /* fw has no record of this port */
583- if (fcport -> loop_id == FC_NO_LOOP_ID ) {
584- qla2x00_find_new_loop_id (vha , fcport );
585- fcport -> fw_login_state = DSC_LS_PORT_UNAVAIL ;
586- } else {
587- for (i = 0 ; i < n ; i ++ ) {
588- e = & vha -> gnl .l [i ];
589- id .b .domain = e -> port_id [0 ];
590- id .b .area = e -> port_id [1 ];
591- id .b .al_pa = e -> port_id [2 ];
592- id .b .rsvd_1 = 0 ;
593- loop_id = le16_to_cpu (e -> nport_handle );
594-
595- if (fcport -> d_id .b24 == id .b24 ) {
596- conflict_fcport =
597- qla2x00_find_fcport_by_wwpn (vha ,
598- e -> port_name , 0 );
599-
600- ql_dbg (ql_dbg_disc , vha , 0x20e6 ,
601- "%s %d %8phC post del sess\n" ,
602- __func__ , __LINE__ ,
603- conflict_fcport -> port_name );
604- qlt_schedule_sess_for_deletion
605- (conflict_fcport , 1 );
606- }
607-
608- if (fcport -> loop_id == loop_id ) {
609- /* FW already picked this loop id for another fcport */
610- qla2x00_find_new_loop_id (vha , fcport );
611- }
583+ for (i = 0 ; i < n ; i ++ ) {
584+ e = & vha -> gnl .l [i ];
585+ id .b .domain = e -> port_id [0 ];
586+ id .b .area = e -> port_id [1 ];
587+ id .b .al_pa = e -> port_id [2 ];
588+ id .b .rsvd_1 = 0 ;
589+ loop_id = le16_to_cpu (e -> nport_handle );
590+
591+ if (fcport -> d_id .b24 == id .b24 ) {
592+ conflict_fcport =
593+ qla2x00_find_fcport_by_wwpn (vha ,
594+ e -> port_name , 0 );
595+ ql_dbg (ql_dbg_disc , vha , 0x20e6 ,
596+ "%s %d %8phC post del sess\n" ,
597+ __func__ , __LINE__ ,
598+ conflict_fcport -> port_name );
599+ qlt_schedule_sess_for_deletion
600+ (conflict_fcport , 1 );
612601 }
602+
603+ /* FW already picked this loop id for another fcport */
604+ if (fcport -> loop_id == loop_id )
605+ fcport -> loop_id = FC_NO_LOOP_ID ;
613606 }
614607 qla24xx_fcport_handle_login (vha , fcport );
615608 }
@@ -1104,6 +1097,7 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea)
11041097static void qla_chk_n2n_b4_login (struct scsi_qla_host * vha , fc_port_t * fcport )
11051098{
11061099 u8 login = 0 ;
1100+ int rc ;
11071101
11081102 if (qla_tgt_mode_enabled (vha ))
11091103 return ;
@@ -1129,6 +1123,18 @@ static void qla_chk_n2n_b4_login(struct scsi_qla_host *vha, fc_port_t *fcport)
11291123 }
11301124
11311125 if (login ) {
1126+ if (fcport -> loop_id == FC_NO_LOOP_ID ) {
1127+ fcport -> fw_login_state = DSC_LS_PORT_UNAVAIL ;
1128+ rc = qla2x00_find_new_loop_id (vha , fcport );
1129+ if (rc ) {
1130+ ql_dbg (ql_dbg_disc , vha , 0x20e6 ,
1131+ "%s %d %8phC post del sess - out of loopid\n" ,
1132+ __func__ , __LINE__ , fcport -> port_name );
1133+ fcport -> scan_state = 0 ;
1134+ qlt_schedule_sess_for_deletion (fcport , true);
1135+ return ;
1136+ }
1137+ }
11321138 ql_dbg (ql_dbg_disc , vha , 0x20bf ,
11331139 "%s %d %8phC post login\n" ,
11341140 __func__ , __LINE__ , fcport -> port_name );
0 commit comments