@@ -746,19 +746,24 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
746
746
break ;
747
747
default :
748
748
if ((id .b24 != fcport -> d_id .b24 &&
749
- fcport -> d_id .b24 ) ||
749
+ fcport -> d_id .b24 &&
750
+ fcport -> loop_id != FC_NO_LOOP_ID ) ||
750
751
(fcport -> loop_id != FC_NO_LOOP_ID &&
751
752
fcport -> loop_id != loop_id )) {
752
753
ql_dbg (ql_dbg_disc , vha , 0x20e3 ,
753
754
"%s %d %8phC post del sess\n" ,
754
755
__func__ , __LINE__ , fcport -> port_name );
756
+ if (fcport -> n2n_flag )
757
+ fcport -> d_id .b24 = 0 ;
755
758
qlt_schedule_sess_for_deletion (fcport );
756
759
return ;
757
760
}
758
761
break ;
759
762
}
760
763
761
764
fcport -> loop_id = loop_id ;
765
+ if (fcport -> n2n_flag )
766
+ fcport -> d_id .b24 = id .b24 ;
762
767
763
768
wwn = wwn_to_u64 (fcport -> port_name );
764
769
qlt_find_sess_invalidate_other (vha , wwn ,
@@ -972,7 +977,7 @@ static void qla24xx_async_gnl_sp_done(srb_t *sp, int res)
972
977
wwn = wwn_to_u64 (e -> port_name );
973
978
974
979
ql_dbg (ql_dbg_disc + ql_dbg_verbose , vha , 0x20e8 ,
975
- "%s %8phC %02x:%02x:%02x state %d/%d lid %x \n" ,
980
+ "%s %8phC %02x:%02x:%02x CLS %x/%x lid %x \n" ,
976
981
__func__ , (void * )& wwn , e -> port_id [2 ], e -> port_id [1 ],
977
982
e -> port_id [0 ], e -> current_login_state , e -> last_login_state ,
978
983
(loop_id & 0x7fff ));
@@ -1499,7 +1504,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
1499
1504
(fcport -> fw_login_state == DSC_LS_PRLI_PEND )))
1500
1505
return 0 ;
1501
1506
1502
- if (fcport -> fw_login_state == DSC_LS_PLOGI_COMP ) {
1507
+ if (fcport -> fw_login_state == DSC_LS_PLOGI_COMP &&
1508
+ !N2N_TOPO (vha -> hw )) {
1503
1509
if (time_before_eq (jiffies , fcport -> plogi_nack_done_deadline )) {
1504
1510
set_bit (RELOGIN_NEEDED , & vha -> dpc_flags );
1505
1511
return 0 ;
@@ -1570,8 +1576,9 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
1570
1576
qla24xx_post_gpdb_work (vha , fcport , 0 );
1571
1577
} else {
1572
1578
ql_dbg (ql_dbg_disc , vha , 0x2118 ,
1573
- "%s %d %8phC post NVMe PRLI\n" ,
1574
- __func__ , __LINE__ , fcport -> port_name );
1579
+ "%s %d %8phC post %s PRLI\n" ,
1580
+ __func__ , __LINE__ , fcport -> port_name ,
1581
+ fcport -> fc4f_nvme ? "NVME" : "FC" );
1575
1582
qla24xx_post_prli_work (vha , fcport );
1576
1583
}
1577
1584
break ;
@@ -1853,17 +1860,38 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
1853
1860
break ;
1854
1861
}
1855
1862
1856
- if (ea -> fcport -> n2n_flag ) {
1863
+ if (ea -> fcport -> fc4f_nvme ) {
1857
1864
ql_dbg (ql_dbg_disc , vha , 0x2118 ,
1858
1865
"%s %d %8phC post fc4 prli\n" ,
1859
1866
__func__ , __LINE__ , ea -> fcport -> port_name );
1860
1867
ea -> fcport -> fc4f_nvme = 0 ;
1861
- ea -> fcport -> n2n_flag = 0 ;
1862
1868
qla24xx_post_prli_work (vha , ea -> fcport );
1869
+ return ;
1870
+ }
1871
+
1872
+ /* at this point both PRLI NVME & PRLI FCP failed */
1873
+ if (N2N_TOPO (vha -> hw )) {
1874
+ if (ea -> fcport -> n2n_link_reset_cnt < 3 ) {
1875
+ ea -> fcport -> n2n_link_reset_cnt ++ ;
1876
+ /*
1877
+ * remote port is not sending Plogi. Reset
1878
+ * link to kick start his state machine
1879
+ */
1880
+ set_bit (N2N_LINK_RESET , & vha -> dpc_flags );
1881
+ } else {
1882
+ ql_log (ql_log_warn , vha , 0x2119 ,
1883
+ "%s %d %8phC Unable to reconnect\n" ,
1884
+ __func__ , __LINE__ , ea -> fcport -> port_name );
1885
+ }
1886
+ } else {
1887
+ /*
1888
+ * switch connect. login failed. Take connection
1889
+ * down and allow relogin to retrigger
1890
+ */
1891
+ ea -> fcport -> flags &= ~FCF_ASYNC_SENT ;
1892
+ ea -> fcport -> keep_nport_handle = 0 ;
1893
+ qlt_schedule_sess_for_deletion (ea -> fcport );
1863
1894
}
1864
- ql_dbg (ql_dbg_disc , vha , 0x2119 ,
1865
- "%s %d %8phC unhandle event of %x\n" ,
1866
- __func__ , __LINE__ , ea -> fcport -> port_name , ea -> data [0 ]);
1867
1895
break ;
1868
1896
}
1869
1897
}
@@ -5000,28 +5028,47 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
5000
5028
unsigned long flags ;
5001
5029
5002
5030
/* Inititae N2N login. */
5003
- if (test_and_clear_bit (N2N_LOGIN_NEEDED , & vha -> dpc_flags )) {
5004
- /* borrowing */
5005
- u32 * bp , i , sz ;
5006
-
5007
- memset (ha -> init_cb , 0 , ha -> init_cb_size );
5008
- sz = min_t (int , sizeof (struct els_plogi_payload ),
5009
- ha -> init_cb_size );
5010
- rval = qla24xx_get_port_login_templ (vha , ha -> init_cb_dma ,
5011
- (void * )ha -> init_cb , sz );
5012
- if (rval == QLA_SUCCESS ) {
5013
- bp = (uint32_t * )ha -> init_cb ;
5014
- for (i = 0 ; i < sz /4 ; i ++ , bp ++ )
5015
- * bp = cpu_to_be32 (* bp );
5031
+ if (N2N_TOPO (ha )) {
5032
+ if (test_and_clear_bit (N2N_LOGIN_NEEDED , & vha -> dpc_flags )) {
5033
+ /* borrowing */
5034
+ u32 * bp , i , sz ;
5035
+
5036
+ memset (ha -> init_cb , 0 , ha -> init_cb_size );
5037
+ sz = min_t (int , sizeof (struct els_plogi_payload ),
5038
+ ha -> init_cb_size );
5039
+ rval = qla24xx_get_port_login_templ (vha ,
5040
+ ha -> init_cb_dma , (void * )ha -> init_cb , sz );
5041
+ if (rval == QLA_SUCCESS ) {
5042
+ bp = (uint32_t * )ha -> init_cb ;
5043
+ for (i = 0 ; i < sz /4 ; i ++ , bp ++ )
5044
+ * bp = cpu_to_be32 (* bp );
5016
5045
5017
- memcpy (& ha -> plogi_els_payld .data , (void * )ha -> init_cb ,
5018
- sizeof (ha -> plogi_els_payld .data ));
5019
- set_bit (RELOGIN_NEEDED , & vha -> dpc_flags );
5020
- } else {
5021
- ql_dbg (ql_dbg_init , vha , 0x00d1 ,
5022
- "PLOGI ELS param read fail.\n" );
5046
+ memcpy (& ha -> plogi_els_payld .data ,
5047
+ (void * )ha -> init_cb ,
5048
+ sizeof (ha -> plogi_els_payld .data ));
5049
+ set_bit (RELOGIN_NEEDED , & vha -> dpc_flags );
5050
+ } else {
5051
+ ql_dbg (ql_dbg_init , vha , 0x00d1 ,
5052
+ "PLOGI ELS param read fail.\n" );
5053
+ goto skip_login ;
5054
+ }
5055
+ }
5056
+
5057
+ list_for_each_entry (fcport , & vha -> vp_fcports , list ) {
5058
+ if (fcport -> n2n_flag ) {
5059
+ qla24xx_fcport_handle_login (vha , fcport );
5060
+ return QLA_SUCCESS ;
5061
+ }
5062
+ }
5063
+ skip_login :
5064
+ spin_lock_irqsave (& vha -> work_lock , flags );
5065
+ vha -> scan .scan_retry ++ ;
5066
+ spin_unlock_irqrestore (& vha -> work_lock , flags );
5067
+
5068
+ if (vha -> scan .scan_retry < MAX_SCAN_RETRIES ) {
5069
+ set_bit (LOCAL_LOOP_UPDATE , & vha -> dpc_flags );
5070
+ set_bit (LOOP_RESYNC_NEEDED , & vha -> dpc_flags );
5023
5071
}
5024
- return QLA_SUCCESS ;
5025
5072
}
5026
5073
5027
5074
found_devs = 0 ;
0 commit comments