@@ -492,11 +492,13 @@ mlxsw_sp_port_module_info_parse(struct mlxsw_sp *mlxsw_sp,
492492{
493493 bool separate_rxtx ;
494494 u8 first_lane ;
495+ u8 slot_index ;
495496 u8 module ;
496497 u8 width ;
497498 int i ;
498499
499500 module = mlxsw_reg_pmlp_module_get (pmlp_pl , 0 );
501+ slot_index = mlxsw_reg_pmlp_slot_index_get (pmlp_pl , 0 );
500502 width = mlxsw_reg_pmlp_width_get (pmlp_pl );
501503 separate_rxtx = mlxsw_reg_pmlp_rxtx_get (pmlp_pl );
502504 first_lane = mlxsw_reg_pmlp_tx_lane_get (pmlp_pl , 0 );
@@ -513,6 +515,11 @@ mlxsw_sp_port_module_info_parse(struct mlxsw_sp *mlxsw_sp,
513515 local_port );
514516 return - EINVAL ;
515517 }
518+ if (mlxsw_reg_pmlp_slot_index_get (pmlp_pl , i ) != slot_index ) {
519+ dev_err (mlxsw_sp -> bus_info -> dev , "Port %d: Unsupported module config: contains multiple slot indexes\n" ,
520+ local_port );
521+ return - EINVAL ;
522+ }
516523 if (separate_rxtx &&
517524 mlxsw_reg_pmlp_tx_lane_get (pmlp_pl , i ) !=
518525 mlxsw_reg_pmlp_rx_lane_get (pmlp_pl , i )) {
@@ -528,6 +535,7 @@ mlxsw_sp_port_module_info_parse(struct mlxsw_sp *mlxsw_sp,
528535 }
529536
530537 port_mapping -> module = module ;
538+ port_mapping -> slot_index = slot_index ;
531539 port_mapping -> width = width ;
532540 port_mapping -> module_width = width ;
533541 port_mapping -> lane = mlxsw_reg_pmlp_tx_lane_get (pmlp_pl , 0 );
@@ -556,11 +564,14 @@ mlxsw_sp_port_module_map(struct mlxsw_sp *mlxsw_sp, u16 local_port,
556564 char pmlp_pl [MLXSW_REG_PMLP_LEN ];
557565 int i , err ;
558566
559- mlxsw_env_module_port_map (mlxsw_sp -> core , 0 , port_mapping -> module );
567+ mlxsw_env_module_port_map (mlxsw_sp -> core , port_mapping -> slot_index ,
568+ port_mapping -> module );
560569
561570 mlxsw_reg_pmlp_pack (pmlp_pl , local_port );
562571 mlxsw_reg_pmlp_width_set (pmlp_pl , port_mapping -> width );
563572 for (i = 0 ; i < port_mapping -> width ; i ++ ) {
573+ mlxsw_reg_pmlp_slot_index_set (pmlp_pl , i ,
574+ port_mapping -> slot_index );
564575 mlxsw_reg_pmlp_module_set (pmlp_pl , i , port_mapping -> module );
565576 mlxsw_reg_pmlp_tx_lane_set (pmlp_pl , i , port_mapping -> lane + i ); /* Rx & Tx */
566577 }
@@ -571,7 +582,8 @@ mlxsw_sp_port_module_map(struct mlxsw_sp *mlxsw_sp, u16 local_port,
571582 return 0 ;
572583
573584err_pmlp_write :
574- mlxsw_env_module_port_unmap (mlxsw_sp -> core , 0 , port_mapping -> module );
585+ mlxsw_env_module_port_unmap (mlxsw_sp -> core , port_mapping -> slot_index ,
586+ port_mapping -> module );
575587 return err ;
576588}
577589
@@ -592,7 +604,8 @@ static int mlxsw_sp_port_open(struct net_device *dev)
592604 struct mlxsw_sp * mlxsw_sp = mlxsw_sp_port -> mlxsw_sp ;
593605 int err ;
594606
595- err = mlxsw_env_module_port_up (mlxsw_sp -> core , 0 ,
607+ err = mlxsw_env_module_port_up (mlxsw_sp -> core ,
608+ mlxsw_sp_port -> mapping .slot_index ,
596609 mlxsw_sp_port -> mapping .module );
597610 if (err )
598611 return err ;
@@ -603,7 +616,8 @@ static int mlxsw_sp_port_open(struct net_device *dev)
603616 return 0 ;
604617
605618err_port_admin_status_set :
606- mlxsw_env_module_port_down (mlxsw_sp -> core , 0 ,
619+ mlxsw_env_module_port_down (mlxsw_sp -> core ,
620+ mlxsw_sp_port -> mapping .slot_index ,
607621 mlxsw_sp_port -> mapping .module );
608622 return err ;
609623}
@@ -615,7 +629,8 @@ static int mlxsw_sp_port_stop(struct net_device *dev)
615629
616630 netif_stop_queue (dev );
617631 mlxsw_sp_port_admin_status_set (mlxsw_sp_port , false);
618- mlxsw_env_module_port_down (mlxsw_sp -> core , 0 ,
632+ mlxsw_env_module_port_down (mlxsw_sp -> core ,
633+ mlxsw_sp_port -> mapping .slot_index ,
619634 mlxsw_sp_port -> mapping .module );
620635 return 0 ;
621636}
@@ -1462,12 +1477,13 @@ static int mlxsw_sp_port_tc_mc_mode_set(struct mlxsw_sp_port *mlxsw_sp_port,
14621477static int mlxsw_sp_port_overheat_init_val_set (struct mlxsw_sp_port * mlxsw_sp_port )
14631478{
14641479 struct mlxsw_sp * mlxsw_sp = mlxsw_sp_port -> mlxsw_sp ;
1480+ u8 slot_index = mlxsw_sp_port -> mapping .slot_index ;
14651481 u8 module = mlxsw_sp_port -> mapping .module ;
14661482 u64 overheat_counter ;
14671483 int err ;
14681484
1469- err = mlxsw_env_module_overheat_counter_get (mlxsw_sp -> core , 0 , module ,
1470- & overheat_counter );
1485+ err = mlxsw_env_module_overheat_counter_get (mlxsw_sp -> core , slot_index ,
1486+ module , & overheat_counter );
14711487 if (err )
14721488 return err ;
14731489
@@ -1542,7 +1558,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u16 local_port,
15421558 }
15431559
15441560 splittable = lanes > 1 && !split ;
1545- err = mlxsw_core_port_init (mlxsw_sp -> core , local_port ,
1561+ err = mlxsw_core_port_init (mlxsw_sp -> core , local_port , slot_index ,
15461562 port_number , split , split_port_subnumber ,
15471563 splittable , lanes , mlxsw_sp -> base_mac ,
15481564 sizeof (mlxsw_sp -> base_mac ));
@@ -1792,14 +1808,16 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u16 local_port,
17921808 mlxsw_sp_port_swid_set (mlxsw_sp , local_port ,
17931809 MLXSW_PORT_SWID_DISABLED_PORT );
17941810err_port_swid_set :
1795- mlxsw_sp_port_module_unmap (mlxsw_sp , local_port , 0 ,
1811+ mlxsw_sp_port_module_unmap (mlxsw_sp , local_port ,
1812+ port_mapping -> slot_index ,
17961813 port_mapping -> module );
17971814 return err ;
17981815}
17991816
18001817static void mlxsw_sp_port_remove (struct mlxsw_sp * mlxsw_sp , u16 local_port )
18011818{
18021819 struct mlxsw_sp_port * mlxsw_sp_port = mlxsw_sp -> ports [local_port ];
1820+ u8 slot_index = mlxsw_sp_port -> mapping .slot_index ;
18031821 u8 module = mlxsw_sp_port -> mapping .module ;
18041822
18051823 cancel_delayed_work_sync (& mlxsw_sp_port -> periodic_hw_stats .update_dw );
@@ -1822,7 +1840,7 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u16 local_port)
18221840 mlxsw_core_port_fini (mlxsw_sp -> core , local_port );
18231841 mlxsw_sp_port_swid_set (mlxsw_sp , local_port ,
18241842 MLXSW_PORT_SWID_DISABLED_PORT );
1825- mlxsw_sp_port_module_unmap (mlxsw_sp , local_port , 0 , module );
1843+ mlxsw_sp_port_module_unmap (mlxsw_sp , local_port , slot_index , module );
18261844}
18271845
18281846static int mlxsw_sp_cpu_port_create (struct mlxsw_sp * mlxsw_sp )
@@ -2194,7 +2212,8 @@ static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u16 local_port,
21942212 return - EINVAL ;
21952213 }
21962214
2197- mlxsw_reg_pmtdb_pack (pmtdb_pl , 0 , mlxsw_sp_port -> mapping .module ,
2215+ mlxsw_reg_pmtdb_pack (pmtdb_pl , mlxsw_sp_port -> mapping .slot_index ,
2216+ mlxsw_sp_port -> mapping .module ,
21982217 mlxsw_sp_port -> mapping .module_width / count ,
21992218 count );
22002219 err = mlxsw_reg_query (mlxsw_core , MLXSW_REG (pmtdb ), pmtdb_pl );
@@ -2259,7 +2278,8 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u16 local_port,
22592278 count = mlxsw_sp_port -> mapping .module_width /
22602279 mlxsw_sp_port -> mapping .width ;
22612280
2262- mlxsw_reg_pmtdb_pack (pmtdb_pl , 0 , mlxsw_sp_port -> mapping .module ,
2281+ mlxsw_reg_pmtdb_pack (pmtdb_pl , mlxsw_sp_port -> mapping .slot_index ,
2282+ mlxsw_sp_port -> mapping .module ,
22632283 mlxsw_sp_port -> mapping .module_width / count ,
22642284 count );
22652285 err = mlxsw_reg_query (mlxsw_core , MLXSW_REG (pmtdb ), pmtdb_pl );
0 commit comments