@@ -328,7 +328,7 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
328328 else
329329 lio -> u .logio .flags |= SRB_LOGIN_COND_PLOGI ;
330330
331- if (fcport -> fc4f_nvme )
331+ if (NVME_TARGET ( vha -> hw , fcport ) )
332332 lio -> u .logio .flags |= SRB_LOGIN_SKIP_PRLI ;
333333
334334 ql_dbg (ql_dbg_disc , vha , 0x2072 ,
@@ -726,19 +726,17 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
726726
727727 loop_id = le16_to_cpu (e -> nport_handle );
728728 loop_id = (loop_id & 0x7fff );
729- if ( fcport -> fc4f_nvme )
729+ if ( NVME_TARGET ( vha -> hw , fcport ) )
730730 current_login_state = e -> current_login_state >> 4 ;
731731 else
732732 current_login_state = e -> current_login_state & 0xf ;
733733
734-
735734 ql_dbg (ql_dbg_disc , vha , 0x20e2 ,
736- "%s found %8phC CLS [%x|%x] nvme %d ID[%02x%02x%02x|%02x%02x%02x ] lid[%d|%d]\n" ,
735+ "%s found %8phC CLS [%x|%x] fc4_type %d ID[%06x|%06x ] lid[%d|%d]\n" ,
737736 __func__ , fcport -> port_name ,
738737 e -> current_login_state , fcport -> fw_login_state ,
739- fcport -> fc4f_nvme , id .b .domain , id .b .area , id .b .al_pa ,
740- fcport -> d_id .b .domain , fcport -> d_id .b .area ,
741- fcport -> d_id .b .al_pa , loop_id , fcport -> loop_id );
738+ fcport -> fc4_type , id .b24 , fcport -> d_id .b24 ,
739+ loop_id , fcport -> loop_id );
742740
743741 switch (fcport -> disc_state ) {
744742 case DSC_DELETE_PEND :
@@ -1225,13 +1223,13 @@ qla24xx_async_prli(struct scsi_qla_host *vha, fc_port_t *fcport)
12251223 sp -> done = qla2x00_async_prli_sp_done ;
12261224 lio -> u .logio .flags = 0 ;
12271225
1228- if ( fcport -> fc4f_nvme )
1226+ if ( NVME_TARGET ( vha -> hw , fcport ) )
12291227 lio -> u .logio .flags |= SRB_LOGIN_NVME_PRLI ;
12301228
12311229 ql_dbg (ql_dbg_disc , vha , 0x211b ,
12321230 "Async-prli - %8phC hdl=%x, loopid=%x portid=%06x retries=%d %s.\n" ,
12331231 fcport -> port_name , sp -> handle , fcport -> loop_id , fcport -> d_id .b24 ,
1234- fcport -> login_retry , fcport -> fc4f_nvme ? "nvme" : "fc" );
1232+ fcport -> login_retry , NVME_TARGET ( vha -> hw , fcport ) ? "nvme" : "fc" );
12351233
12361234 rval = qla2x00_start_sp (sp );
12371235 if (rval != QLA_SUCCESS ) {
@@ -1382,14 +1380,14 @@ void qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, struct event_arg *ea)
13821380 fcport -> flags &= ~FCF_ASYNC_SENT ;
13831381
13841382 ql_dbg (ql_dbg_disc , vha , 0x20d2 ,
1385- "%s %8phC DS %d LS %d nvme %x rc %d\n" , __func__ , fcport -> port_name ,
1386- fcport -> disc_state , pd -> current_login_state , fcport -> fc4f_nvme ,
1387- ea -> rc );
1383+ "%s %8phC DS %d LS %d fc4_type %x rc %d\n" , __func__ ,
1384+ fcport -> port_name , fcport -> disc_state , pd -> current_login_state ,
1385+ fcport -> fc4_type , ea -> rc );
13881386
13891387 if (fcport -> disc_state == DSC_DELETE_PEND )
13901388 return ;
13911389
1392- if (fcport -> fc4f_nvme )
1390+ if (NVME_TARGET ( vha -> hw , fcport ) )
13931391 ls = pd -> current_login_state >> 4 ;
13941392 else
13951393 ls = pd -> current_login_state & 0xf ;
@@ -1578,7 +1576,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
15781576 ql_dbg (ql_dbg_disc , vha , 0x2118 ,
15791577 "%s %d %8phC post %s PRLI\n" ,
15801578 __func__ , __LINE__ , fcport -> port_name ,
1581- fcport -> fc4f_nvme ? "NVME" : "FC" );
1579+ NVME_TARGET (vha -> hw , fcport ) ? "NVME" :
1580+ "FC" );
15821581 qla24xx_post_prli_work (vha , fcport );
15831582 }
15841583 break ;
@@ -1860,13 +1859,22 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
18601859 break ;
18611860 }
18621861
1863- if (ea -> fcport -> fc4f_nvme ) {
1862+ /*
1863+ * Retry PRLI with other FC-4 type if failure occurred on dual
1864+ * FCP/NVMe port
1865+ */
1866+ if (NVME_FCP_TARGET (ea -> fcport )) {
1867+ if (vha -> hw -> fc4_type_priority == FC4_PRIORITY_NVME )
1868+ ea -> fcport -> fc4_type &= ~FS_FC4TYPE_NVME ;
1869+ else
1870+ ea -> fcport -> fc4_type &= ~FS_FC4TYPE_FCP ;
18641871 ql_dbg (ql_dbg_disc , vha , 0x2118 ,
1865- "%s %d %8phC post fc4 prli\n" ,
1866- __func__ , __LINE__ , ea -> fcport -> port_name );
1867- ea -> fcport -> fc4f_nvme = 0 ;
1872+ "%s %d %8phC post %s prli\n" ,
1873+ __func__ , __LINE__ , ea -> fcport -> port_name ,
1874+ (ea -> fcport -> fc4_type & FS_FC4TYPE_NVME ) ?
1875+ "NVMe" : "FCP" );
18681876 qla24xx_post_prli_work (vha , ea -> fcport );
1869- return ;
1877+ break ;
18701878 }
18711879
18721880 /* at this point both PRLI NVME & PRLI FCP failed */
@@ -1952,7 +1960,7 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
19521960 * force a relogin attempt via implicit LOGO, PLOGI, and PRLI
19531961 * requests.
19541962 */
1955- if (ea -> fcport -> fc4f_nvme ) {
1963+ if (NVME_TARGET ( vha -> hw , ea -> fcport ) ) {
19561964 ql_dbg (ql_dbg_disc , vha , 0x2117 ,
19571965 "%s %d %8phC post prli\n" ,
19581966 __func__ , __LINE__ , ea -> fcport -> port_name );
@@ -5382,7 +5390,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
53825390
53835391 qla2x00_iidma_fcport (vha , fcport );
53845392
5385- if (fcport -> fc4f_nvme ) {
5393+ if (NVME_TARGET ( vha -> hw , fcport ) ) {
53865394 qla_nvme_register_remote (vha , fcport );
53875395 fcport -> disc_state = DSC_LOGIN_COMPLETE ;
53885396 qla2x00_set_fcport_state (fcport , FCS_ONLINE );
@@ -5710,11 +5718,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
57105718 new_fcport -> fc4_type = swl [swl_idx ].fc4_type ;
57115719
57125720 new_fcport -> nvme_flag = 0 ;
5713- new_fcport -> fc4f_nvme = 0 ;
57145721 if (vha -> flags .nvme_enabled &&
5715- swl [swl_idx ].fc4f_nvme ) {
5716- new_fcport -> fc4f_nvme =
5717- swl [swl_idx ].fc4f_nvme ;
5722+ swl [swl_idx ].fc4_type & FS_FC4TYPE_NVME ) {
57185723 ql_log (ql_log_info , vha , 0x2131 ,
57195724 "FOUND: NVME port %8phC as FC Type 28h\n" ,
57205725 new_fcport -> port_name );
@@ -5770,7 +5775,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
57705775
57715776 /* Bypass ports whose FCP-4 type is not FCP_SCSI */
57725777 if (ql2xgffidenable &&
5773- (new_fcport -> fc4_type != FC4_TYPE_FCP_SCSI &&
5778+ (!( new_fcport -> fc4_type & FS_FC4TYPE_FCP ) &&
57745779 new_fcport -> fc4_type != FC4_TYPE_UNKNOWN ))
57755780 continue ;
57765781
@@ -5839,7 +5844,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
58395844 break ;
58405845 }
58415846
5842- if (fcport -> fc4f_nvme ) {
5847+ if (NVME_TARGET ( vha -> hw , fcport ) ) {
58435848 if (fcport -> disc_state == DSC_DELETE_PEND ) {
58445849 fcport -> disc_state = DSC_GNL ;
58455850 vha -> fcport_count -- ;
@@ -8514,6 +8519,11 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
85148519 /* N2N: driver will initiate Login instead of FW */
85158520 icb -> firmware_options_3 |= BIT_8 ;
85168521
8522+ /* Determine NVMe/FCP priority for target ports */
8523+ ha -> fc4_type_priority = qla2xxx_get_fc4_priority (vha );
8524+ ql_log (ql_log_info , vha , 0xffff , "FC4 priority set to %s\n" ,
8525+ ha -> fc4_type_priority & BIT_0 ? "FCP" : "NVMe" );
8526+
85178527 if (rval ) {
85188528 ql_log (ql_log_warn , vha , 0x0076 ,
85198529 "NVRAM configuration failed.\n" );
0 commit comments