@@ -87,6 +87,7 @@ mlxsw_env_validate_cable_ident(struct mlxsw_core *core, int id, bool *qsfp,
87
87
* qsfp = true;
88
88
break ;
89
89
case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_DD :
90
+ case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_OSFP :
90
91
* qsfp = true;
91
92
* cmis = true;
92
93
break ;
@@ -303,6 +304,7 @@ int mlxsw_env_get_module_info(struct net_device *netdev,
303
304
modinfo -> eeprom_len = ETH_MODULE_SFF_8472_LEN / 2 ;
304
305
break ;
305
306
case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_QSFP_DD :
307
+ case MLXSW_REG_MCIA_EEPROM_MODULE_INFO_ID_OSFP :
306
308
/* Use SFF_8636 as base type. ethtool should recognize specific
307
309
* type through the identifier value.
308
310
*/
@@ -462,9 +464,6 @@ int mlxsw_env_reset_module(struct net_device *netdev,
462
464
!(req & (ETH_RESET_PHY << ETH_RESET_SHARED_SHIFT )))
463
465
return 0 ;
464
466
465
- if (WARN_ON_ONCE (module >= mlxsw_env -> module_count ))
466
- return - EINVAL ;
467
-
468
467
mutex_lock (& mlxsw_env -> module_info_lock );
469
468
470
469
err = __mlxsw_env_validate_module_type (mlxsw_core , module );
@@ -510,9 +509,6 @@ mlxsw_env_get_module_power_mode(struct mlxsw_core *mlxsw_core, u8 module,
510
509
u32 status_bits ;
511
510
int err ;
512
511
513
- if (WARN_ON_ONCE (module >= mlxsw_env -> module_count ))
514
- return - EINVAL ;
515
-
516
512
mutex_lock (& mlxsw_env -> module_info_lock );
517
513
518
514
err = __mlxsw_env_validate_module_type (mlxsw_core , module );
@@ -620,9 +616,6 @@ mlxsw_env_set_module_power_mode(struct mlxsw_core *mlxsw_core, u8 module,
620
616
bool low_power ;
621
617
int err = 0 ;
622
618
623
- if (WARN_ON_ONCE (module >= mlxsw_env -> module_count ))
624
- return - EINVAL ;
625
-
626
619
if (policy != ETHTOOL_MODULE_POWER_MODE_POLICY_HIGH &&
627
620
policy != ETHTOOL_MODULE_POWER_MODE_POLICY_AUTO ) {
628
621
NL_SET_ERR_MSG_MOD (extack , "Unsupported power mode policy" );
@@ -831,19 +824,13 @@ static int mlxsw_env_temp_warn_event_register(struct mlxsw_core *mlxsw_core)
831
824
{
832
825
struct mlxsw_env * mlxsw_env = mlxsw_core_env (mlxsw_core );
833
826
834
- if (!mlxsw_core_temp_warn_enabled (mlxsw_core ))
835
- return 0 ;
836
-
837
827
return mlxsw_core_trap_register (mlxsw_core ,
838
828
& mlxsw_env_temp_warn_listener ,
839
829
mlxsw_env );
840
830
}
841
831
842
832
static void mlxsw_env_temp_warn_event_unregister (struct mlxsw_env * mlxsw_env )
843
833
{
844
- if (!mlxsw_core_temp_warn_enabled (mlxsw_env -> core ))
845
- return ;
846
-
847
834
mlxsw_core_trap_unregister (mlxsw_env -> core ,
848
835
& mlxsw_env_temp_warn_listener , mlxsw_env );
849
836
}
@@ -922,9 +909,6 @@ mlxsw_env_module_plug_event_register(struct mlxsw_core *mlxsw_core)
922
909
{
923
910
struct mlxsw_env * mlxsw_env = mlxsw_core_env (mlxsw_core );
924
911
925
- if (!mlxsw_core_temp_warn_enabled (mlxsw_core ))
926
- return 0 ;
927
-
928
912
return mlxsw_core_trap_register (mlxsw_core ,
929
913
& mlxsw_env_module_plug_listener ,
930
914
mlxsw_env );
@@ -933,9 +917,6 @@ mlxsw_env_module_plug_event_register(struct mlxsw_core *mlxsw_core)
933
917
static void
934
918
mlxsw_env_module_plug_event_unregister (struct mlxsw_env * mlxsw_env )
935
919
{
936
- if (!mlxsw_core_temp_warn_enabled (mlxsw_env -> core ))
937
- return ;
938
-
939
920
mlxsw_core_trap_unregister (mlxsw_env -> core ,
940
921
& mlxsw_env_module_plug_listener ,
941
922
mlxsw_env );
@@ -966,9 +947,6 @@ mlxsw_env_module_overheat_counter_get(struct mlxsw_core *mlxsw_core, u8 module,
966
947
{
967
948
struct mlxsw_env * mlxsw_env = mlxsw_core_env (mlxsw_core );
968
949
969
- if (WARN_ON_ONCE (module >= mlxsw_env -> module_count ))
970
- return - EINVAL ;
971
-
972
950
mutex_lock (& mlxsw_env -> module_info_lock );
973
951
* p_counter = mlxsw_env -> module_info [module ].module_overheat_counter ;
974
952
mutex_unlock (& mlxsw_env -> module_info_lock );
@@ -981,9 +959,6 @@ void mlxsw_env_module_port_map(struct mlxsw_core *mlxsw_core, u8 module)
981
959
{
982
960
struct mlxsw_env * mlxsw_env = mlxsw_core_env (mlxsw_core );
983
961
984
- if (WARN_ON_ONCE (module >= mlxsw_env -> module_count ))
985
- return ;
986
-
987
962
mutex_lock (& mlxsw_env -> module_info_lock );
988
963
mlxsw_env -> module_info [module ].num_ports_mapped ++ ;
989
964
mutex_unlock (& mlxsw_env -> module_info_lock );
@@ -994,9 +969,6 @@ void mlxsw_env_module_port_unmap(struct mlxsw_core *mlxsw_core, u8 module)
994
969
{
995
970
struct mlxsw_env * mlxsw_env = mlxsw_core_env (mlxsw_core );
996
971
997
- if (WARN_ON_ONCE (module >= mlxsw_env -> module_count ))
998
- return ;
999
-
1000
972
mutex_lock (& mlxsw_env -> module_info_lock );
1001
973
mlxsw_env -> module_info [module ].num_ports_mapped -- ;
1002
974
mutex_unlock (& mlxsw_env -> module_info_lock );
@@ -1008,9 +980,6 @@ int mlxsw_env_module_port_up(struct mlxsw_core *mlxsw_core, u8 module)
1008
980
struct mlxsw_env * mlxsw_env = mlxsw_core_env (mlxsw_core );
1009
981
int err = 0 ;
1010
982
1011
- if (WARN_ON_ONCE (module >= mlxsw_env -> module_count ))
1012
- return - EINVAL ;
1013
-
1014
983
mutex_lock (& mlxsw_env -> module_info_lock );
1015
984
1016
985
if (mlxsw_env -> module_info [module ].power_mode_policy !=
@@ -1040,9 +1009,6 @@ void mlxsw_env_module_port_down(struct mlxsw_core *mlxsw_core, u8 module)
1040
1009
{
1041
1010
struct mlxsw_env * mlxsw_env = mlxsw_core_env (mlxsw_core );
1042
1011
1043
- if (WARN_ON_ONCE (module >= mlxsw_env -> module_count ))
1044
- return ;
1045
-
1046
1012
mutex_lock (& mlxsw_env -> module_info_lock );
1047
1013
1048
1014
mlxsw_env -> module_info [module ].num_ports_up -- ;
0 commit comments