@@ -580,36 +580,29 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
580
580
581
581
if (!found ) {
582
582
/* 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 );
612
601
}
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 ;
613
606
}
614
607
qla24xx_fcport_handle_login (vha , fcport );
615
608
}
@@ -1104,6 +1097,7 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea)
1104
1097
static void qla_chk_n2n_b4_login (struct scsi_qla_host * vha , fc_port_t * fcport )
1105
1098
{
1106
1099
u8 login = 0 ;
1100
+ int rc ;
1107
1101
1108
1102
if (qla_tgt_mode_enabled (vha ))
1109
1103
return ;
@@ -1129,6 +1123,18 @@ static void qla_chk_n2n_b4_login(struct scsi_qla_host *vha, fc_port_t *fcport)
1129
1123
}
1130
1124
1131
1125
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
+ }
1132
1138
ql_dbg (ql_dbg_disc , vha , 0x20bf ,
1133
1139
"%s %d %8phC post login\n" ,
1134
1140
__func__ , __LINE__ , fcport -> port_name );
0 commit comments