@@ -590,12 +590,13 @@ static enum sas_linkrate mpi3mr_convert_phy_link_rate(u8 link_rate)
590
590
* @mrioc: Adapter instance reference
591
591
* @mr_sas_port: Internal Port object
592
592
* @mr_sas_phy: Internal Phy object
593
+ * @host_node: Flag to indicate this is a host_node
593
594
*
594
595
* Return: None.
595
596
*/
596
597
static void mpi3mr_delete_sas_phy (struct mpi3mr_ioc * mrioc ,
597
598
struct mpi3mr_sas_port * mr_sas_port ,
598
- struct mpi3mr_sas_phy * mr_sas_phy )
599
+ struct mpi3mr_sas_phy * mr_sas_phy , u8 host_node )
599
600
{
600
601
u64 sas_address = mr_sas_port -> remote_identify .sas_address ;
601
602
@@ -605,9 +606,13 @@ static void mpi3mr_delete_sas_phy(struct mpi3mr_ioc *mrioc,
605
606
606
607
list_del (& mr_sas_phy -> port_siblings );
607
608
mr_sas_port -> num_phys -- ;
608
- mr_sas_port -> phy_mask &= ~(1 << mr_sas_phy -> phy_id );
609
- if (mr_sas_port -> lowest_phy == mr_sas_phy -> phy_id )
610
- mr_sas_port -> lowest_phy = ffs (mr_sas_port -> phy_mask ) - 1 ;
609
+
610
+ if (host_node ) {
611
+ mr_sas_port -> phy_mask &= ~(1 << mr_sas_phy -> phy_id );
612
+
613
+ if (mr_sas_port -> lowest_phy == mr_sas_phy -> phy_id )
614
+ mr_sas_port -> lowest_phy = ffs (mr_sas_port -> phy_mask ) - 1 ;
615
+ }
611
616
sas_port_delete_phy (mr_sas_port -> port , mr_sas_phy -> phy );
612
617
mr_sas_phy -> phy_belongs_to_port = 0 ;
613
618
}
@@ -617,12 +622,13 @@ static void mpi3mr_delete_sas_phy(struct mpi3mr_ioc *mrioc,
617
622
* @mrioc: Adapter instance reference
618
623
* @mr_sas_port: Internal Port object
619
624
* @mr_sas_phy: Internal Phy object
625
+ * @host_node: Flag to indicate this is a host_node
620
626
*
621
627
* Return: None.
622
628
*/
623
629
static void mpi3mr_add_sas_phy (struct mpi3mr_ioc * mrioc ,
624
630
struct mpi3mr_sas_port * mr_sas_port ,
625
- struct mpi3mr_sas_phy * mr_sas_phy )
631
+ struct mpi3mr_sas_phy * mr_sas_phy , u8 host_node )
626
632
{
627
633
u64 sas_address = mr_sas_port -> remote_identify .sas_address ;
628
634
@@ -632,9 +638,12 @@ static void mpi3mr_add_sas_phy(struct mpi3mr_ioc *mrioc,
632
638
633
639
list_add_tail (& mr_sas_phy -> port_siblings , & mr_sas_port -> phy_list );
634
640
mr_sas_port -> num_phys ++ ;
635
- mr_sas_port -> phy_mask |= (1 << mr_sas_phy -> phy_id );
636
- if (mr_sas_phy -> phy_id < mr_sas_port -> lowest_phy )
637
- mr_sas_port -> lowest_phy = ffs (mr_sas_port -> phy_mask ) - 1 ;
641
+ if (host_node ) {
642
+ mr_sas_port -> phy_mask |= (1 << mr_sas_phy -> phy_id );
643
+
644
+ if (mr_sas_phy -> phy_id < mr_sas_port -> lowest_phy )
645
+ mr_sas_port -> lowest_phy = ffs (mr_sas_port -> phy_mask ) - 1 ;
646
+ }
638
647
sas_port_add_phy (mr_sas_port -> port , mr_sas_phy -> phy );
639
648
mr_sas_phy -> phy_belongs_to_port = 1 ;
640
649
}
@@ -675,7 +684,7 @@ static void mpi3mr_add_phy_to_an_existing_port(struct mpi3mr_ioc *mrioc,
675
684
if (srch_phy == mr_sas_phy )
676
685
return ;
677
686
}
678
- mpi3mr_add_sas_phy (mrioc , mr_sas_port , mr_sas_phy );
687
+ mpi3mr_add_sas_phy (mrioc , mr_sas_port , mr_sas_phy , mr_sas_node -> host_node );
679
688
return ;
680
689
}
681
690
}
@@ -736,7 +745,7 @@ static void mpi3mr_del_phy_from_an_existing_port(struct mpi3mr_ioc *mrioc,
736
745
mpi3mr_delete_sas_port (mrioc , mr_sas_port );
737
746
else
738
747
mpi3mr_delete_sas_phy (mrioc , mr_sas_port ,
739
- mr_sas_phy );
748
+ mr_sas_phy , mr_sas_node -> host_node );
740
749
return ;
741
750
}
742
751
}
@@ -1028,7 +1037,7 @@ mpi3mr_alloc_hba_port(struct mpi3mr_ioc *mrioc, u16 port_id)
1028
1037
/**
1029
1038
* mpi3mr_get_hba_port_by_id - find hba port by id
1030
1039
* @mrioc: Adapter instance reference
1031
- * @port_id - Port ID to search
1040
+ * @port_id: Port ID to search
1032
1041
*
1033
1042
* Return: mpi3mr_hba_port reference for the matched port
1034
1043
*/
@@ -1367,7 +1376,8 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
1367
1376
mpi3mr_sas_port_sanity_check (mrioc , mr_sas_node ,
1368
1377
mr_sas_port -> remote_identify .sas_address , hba_port );
1369
1378
1370
- if (mr_sas_node -> num_phys >= sizeof (mr_sas_port -> phy_mask ) * 8 )
1379
+ if (mr_sas_node -> host_node && mr_sas_node -> num_phys >=
1380
+ sizeof (mr_sas_port -> phy_mask ) * 8 )
1371
1381
ioc_info (mrioc , "max port count %u could be too high\n" ,
1372
1382
mr_sas_node -> num_phys );
1373
1383
@@ -1377,15 +1387,16 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
1377
1387
(mr_sas_node -> phy [i ].hba_port != hba_port ))
1378
1388
continue ;
1379
1389
1380
- if (i >= sizeof (mr_sas_port -> phy_mask ) * 8 ) {
1390
+ if (mr_sas_node -> host_node && ( i >= sizeof (mr_sas_port -> phy_mask ) * 8 ) ) {
1381
1391
ioc_warn (mrioc , "skipping port %u, max allowed value is %zu\n" ,
1382
1392
i , sizeof (mr_sas_port -> phy_mask ) * 8 );
1383
1393
goto out_fail ;
1384
1394
}
1385
1395
list_add_tail (& mr_sas_node -> phy [i ].port_siblings ,
1386
1396
& mr_sas_port -> phy_list );
1387
1397
mr_sas_port -> num_phys ++ ;
1388
- mr_sas_port -> phy_mask |= (1 << i );
1398
+ if (mr_sas_node -> host_node )
1399
+ mr_sas_port -> phy_mask |= (1 << i );
1389
1400
}
1390
1401
1391
1402
if (!mr_sas_port -> num_phys ) {
@@ -1394,7 +1405,8 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
1394
1405
goto out_fail ;
1395
1406
}
1396
1407
1397
- mr_sas_port -> lowest_phy = ffs (mr_sas_port -> phy_mask ) - 1 ;
1408
+ if (mr_sas_node -> host_node )
1409
+ mr_sas_port -> lowest_phy = ffs (mr_sas_port -> phy_mask ) - 1 ;
1398
1410
1399
1411
if (mr_sas_port -> remote_identify .device_type == SAS_END_DEVICE ) {
1400
1412
tgtdev = mpi3mr_get_tgtdev_by_addr (mrioc ,
0 commit comments