mlxsw: Add RJ45 ports support
Subsystems (3)
Ido Schimmel
maintainercover mlxsw: Add RJ45 ports support
We are in the process of qualifying a new system that has RJ45 ports as opposed to the transceiver modules (e.g., SFP, QSFP) present on all existing systems.
This patchset adds support for these ports in mlxsw by adding a couple of missing BaseT link modes and rejecting ethtool operations that are specific to transceiver modules.
Patchset overview:
Patches #1-#3 are cleanups and preparations.
Patch #4 adds support for two new link modes.
Patches #5-#6 query and cache the port module's type (e.g., QSFP, RJ45) during initialization.
Patches #7-#9 forbid ethtool operations that are invalid on RJ45 ports.
Danielle Ratson (7):
mlxsw: Add netdev argument to mlxsw_env_get_module_info()
mlxsw: spectrum_ethtool: Add support for two new link modes
mlxsw: reg: Add Port Module Type Mapping register
mlxsw: core_env: Query and store port module's type during
initialization
mlxsw: core_env: Forbid getting module EEPROM on RJ45 ports
mlxsw: core_env: Forbid power mode set and get on RJ45 ports
mlxsw: core_env: Forbid module reset on RJ45 ports
Ido Schimmel (2):
mlxsw: spectrum_ethtool: Remove redundant variable
mlxsw: core_env: Do not pass number of modules as argument
.../net/ethernet/mellanox/mlxsw/core_env.c | 117 ++++++++++++++++-- .../net/ethernet/mellanox/mlxsw/core_env.h | 3 +- drivers/net/ethernet/mellanox/mlxsw/minimal.c | 3 +- drivers/net/ethernet/mellanox/mlxsw/reg.h | 55 ++++++++ .../mellanox/mlxsw/spectrum_ethtool.c | 28 +++-- 5 files changed, 179 insertions(+), 27 deletions(-)
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 1/9 mlxsw: spectrum_ethtool: Remove redundant variable
Remove the 'err' variable and simply return.
--- .../ethernet/mellanox/mlxsw/spectrum_ethtool.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +6 -12
@@ -1034,13 +1034,10 @@ static int mlxsw_sp_get_module_info(struct net_device *netdev, {struct mlxsw_sp_port *mlxsw_sp_port =netdev_priv (netdev);struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; -int err; - - err =mlxsw_env_get_module_info (mlxsw_sp->core, - mlxsw_sp_port->mapping.module, - modinfo); -return err; +return mlxsw_env_get_module_info (mlxsw_sp->core, + mlxsw_sp_port->mapping.module, + modinfo); } static int mlxsw_sp_get_module_eeprom(struct net_device *netdev,
@@ -1048,13 +1045,10 @@ static int mlxsw_sp_get_module_eeprom(struct net_device *netdev, {struct mlxsw_sp_port *mlxsw_sp_port =netdev_priv (netdev);struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; -int err; - - err =mlxsw_env_get_module_eeprom (netdev, mlxsw_sp->core, - mlxsw_sp_port->mapping.module, ee, - data); -return err; +return mlxsw_env_get_module_eeprom (netdev, mlxsw_sp->core, + mlxsw_sp_port->mapping.module, ee, + data); } static int
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 2/9 mlxsw: core_env: Do not pass number of modules as argument
In reply to Ido SchimmelThe number of modules can be resolved from the first argument, so do not pass it.
--- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +6 -9
@@ -661,13 +661,12 @@ static int mlxsw_env_temp_event_set(struct mlxsw_core *mlxsw_core,return mlxsw_reg_write (mlxsw_core,MLXSW_REG (mtmp), mtmp_pl); } -static int mlxsw_env_module_temp_event_enable (struct mlxsw_core *mlxsw_core, -u8 module_count) +static int mlxsw_env_module_temp_event_enable (struct mlxsw_core *mlxsw_core) {int i, err, sensor_index;bool has_temp_sensor; -for (i =0 ; i < module_count; i++) { +for (i =0 ; i <mlxsw_core_env (mlxsw_core)->module_count; i++) { err =mlxsw_env_module_has_temp_sensor (mlxsw_core, i, &has_temp_sensor);if (err)
@@ -876,12 +875,11 @@ mlxsw_env_module_plug_event_unregister(struct mlxsw_env *mlxsw_env) }static int -mlxsw_env_module_oper_state_event_enable (struct mlxsw_core *mlxsw_core, -u8 module_count) +mlxsw_env_module_oper_state_event_enable (struct mlxsw_core *mlxsw_core) {int i, err; -for (i =0 ; i < module_count; i++) { +for (i =0 ; i <mlxsw_core_env (mlxsw_core)->module_count; i++) {char pmaos_pl[MLXSW_REG_PMAOS_LEN ];mlxsw_reg_pmaos_pack (pmaos_pl, i);
@@ -1037,12 +1035,11 @@ int mlxsw_env_init(struct mlxsw_core *mlxsw_core, struct mlxsw_env **p_env)if (err) goto err_module_plug_event_register; - err =mlxsw_env_module_oper_state_event_enable (mlxsw_core, - env->module_count); + err =mlxsw_env_module_oper_state_event_enable (mlxsw_core);if (err) goto err_oper_state_event_enable; - err =mlxsw_env_module_temp_event_enable (mlxsw_core, env->module_count); + err =mlxsw_env_module_temp_event_enable (mlxsw_core);if (err) goto err_temp_event_enable;
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 3/9 mlxsw: Add netdev argument to mlxsw_env_get_module_info()
In reply to Ido SchimmelFrom: Danielle Ratson <[email protected]>
The next patches will forbid querying the port module's EEPROM info when its type is RJ45 as in this case no transceiver module can ever be connected to the port.
Add netdev argument to mlxsw_env_get_module_info() so it could be used to print an error to the kernel log via netdev_err().
--- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 3 ++- drivers/net/ethernet/mellanox/mlxsw/core_env.h | 3 ++- drivers/net/ethernet/mellanox/mlxsw/minimal.c | 3 ++- drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +2 -1
@@ -206,7 +206,8 @@ int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, int module,return 0 ; } -int mlxsw_env_get_module_info (struct mlxsw_core *mlxsw_core,int module, +int mlxsw_env_get_module_info (struct net_device *netdev, +struct mlxsw_core *mlxsw_core,int module,struct ethtool_modinfo *modinfo) {u8 module_info[MLXSW_REG_MCIA_EEPROM_MODULE_INFO_SIZE ];
drivers/net/ethernet/mellanox/mlxsw/core_env.h +2 -1
@@ -12,7 +12,8 @@ struct ethtool_eeprom;int mlxsw_env_module_temp_thresholds_get (struct mlxsw_core *core,int module,int off,int *temp); -int mlxsw_env_get_module_info (struct mlxsw_core *mlxsw_core,int module, +int mlxsw_env_get_module_info (struct net_device *netdev, +struct mlxsw_core *mlxsw_core,int module,struct ethtool_modinfo *modinfo); int mlxsw_env_get_module_eeprom(struct net_device *netdev,
drivers/net/ethernet/mellanox/mlxsw/minimal.c +2 -1
@@ -110,7 +110,8 @@ static int mlxsw_m_get_module_info(struct net_device *netdev,struct mlxsw_m_port *mlxsw_m_port =netdev_priv (netdev);struct mlxsw_core *core = mlxsw_m_port->mlxsw_m->core; -return mlxsw_env_get_module_info (core, mlxsw_m_port->module, modinfo); +return mlxsw_env_get_module_info (netdev, core, mlxsw_m_port->module, + modinfo); } static int
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +1 -1
@@ -1035,7 +1035,7 @@ static int mlxsw_sp_get_module_info(struct net_device *netdev,struct mlxsw_sp_port *mlxsw_sp_port =netdev_priv (netdev);struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; -return mlxsw_env_get_module_info (mlxsw_sp->core, +return mlxsw_env_get_module_info (netdev, mlxsw_sp->core, mlxsw_sp_port->mapping.module, modinfo); }
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 4/9 mlxsw: spectrum_ethtool: Add support for two new link modes
In reply to Ido SchimmelFrom: Danielle Ratson <[email protected]>
As part of a process for supporting a new system with RJ45 connectors, 100BaseT and 1000BaseT link modes need to be supported.
Add support for these two link modes by adding the two corresponding bits in PTYS (Port Type and Speed) register.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 2 ++ drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c | 10 ++++++++++ 2 files changed, 12 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +2 -0
@@ -4482,6 +4482,8 @@ MLXSW_ITEM32(reg, ptys, ext_eth_proto_cap, 0x08, 0, 32);#define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_SR4 BIT(21)#define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_KR4 BIT(22)#define MLXSW_REG_PTYS_ETH_SPEED_100GBASE_LR4_ER4 BIT(23) +#define MLXSW_REG_PTYS_ETH_SPEED_100BASE_T BIT(24) +#define MLXSW_REG_PTYS_ETH_SPEED_1000BASE_T BIT(25)#define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_CR BIT(27)#define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_KR BIT(28)#define MLXSW_REG_PTYS_ETH_SPEED_25GBASE_SR BIT(29)
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +10 -0
@@ -1266,12 +1266,22 @@ struct mlxsw_sp1_port_link_mode { };static const struct mlxsw_sp1_port_link_mode mlxsw_sp1_port_link_mode[] = { + { + .mask =MLXSW_REG_PTYS_ETH_SPEED_100BASE_T , + .mask_ethtool = ETHTOOL_LINK_MODE_100baseT_Full_BIT, + .speed =SPEED_100 , + }, { .mask =MLXSW_REG_PTYS_ETH_SPEED_SGMII |MLXSW_REG_PTYS_ETH_SPEED_1000BASE_KX , .mask_ethtool = ETHTOOL_LINK_MODE_1000baseKX_Full_BIT, .speed =SPEED_1000 , }, + { + .mask =MLXSW_REG_PTYS_ETH_SPEED_1000BASE_T , + .mask_ethtool = ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + .speed =SPEED_1000 , + }, { .mask =MLXSW_REG_PTYS_ETH_SPEED_10GBASE_CX4 |MLXSW_REG_PTYS_ETH_SPEED_10GBASE_KX4 ,
Signature · 1 line
2.33.1
Re: [PATCH net-next 4/9] mlxsw: spectrum_ethtool: Add support for two new link modes
Quoted 4 lines · Ido Schimmel
From: Danielle Ratson <[email protected]>
As part of a process for supporting a new system with RJ45 connectors, 100BaseT and 1000BaseT link modes need to be supported.
I'm surprised you don't have 2500BaseT, 5000baseT and 10000BaseT?
Andrew
Re: [PATCH net-next 4/9] mlxsw: spectrum_ethtool: Add support for two new link modes
Quoted 7 lines · Andrew Lunn
Quoted 4 lines · Ido Schimmel
From: Danielle Ratson <[email protected]>
As part of a process for supporting a new system with RJ45 connectors, 100BaseT and 1000BaseT link modes need to be supported.
I'm surprised you don't have 2500BaseT, 5000baseT and 10000BaseT?
I believe there weren't any requirements for these link modes on the new system, so it wasn't designed to support them. I see it is still not listed on the web site. Will send you a link once it's there.
Ido Schimmel
maintainerPATCH 5/9 mlxsw: reg: Add Port Module Type Mapping register
In reply to Ido SchimmelFrom: Danielle Ratson <[email protected]>
Add the Port Module Type Mapping (PMTP) register. It will be used by subsequent patches to query port module types and forbid certain configurations based on the port module's type.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 53 +++++++++++++++++++++++ 1 file changed, 53 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +53 -0
@@ -6064,6 +6064,58 @@ static inline void mlxsw_reg_pllp_unpack(char *payload, u8 *label_port, *slot_index =mlxsw_reg_pllp_slot_index_get (payload); } +/* PMTM - Port Module Type Mapping Register +* ---------------------------------------- +* The PMTM register allows query or configuration of module types. +* The register can only be set when the module is disabled by PMAOS register +*/ +#define MLXSW_REG_PMTM_ID 0x5067 +#define MLXSW_REG_PMTM_LEN 0x10 + +MLXSW_REG_DEFINE (pmtm,MLXSW_REG_PMTM_ID ,MLXSW_REG_PMTM_LEN ); + +/* reg_pmtm_slot_index +* Slot index. +* Access: Index +*/ +MLXSW_ITEM32 (reg, pmtm, slot_index,0x00 ,24 ,4 ); + +/* reg_pmtm_module +* Module number. +* Access: Index +*/ +MLXSW_ITEM32 (reg, pmtm, module,0x00 ,16 ,8 ); + +enum mlxsw_reg_pmtm_module_type { +MLXSW_REG_PMTM_MODULE_TYPE_BACKPLANE_4_LANES =0 , +MLXSW_REG_PMTM_MODULE_TYPE_QSFP =1 , +MLXSW_REG_PMTM_MODULE_TYPE_SFP =2 , +MLXSW_REG_PMTM_MODULE_TYPE_BACKPLANE_SINGLE_LANE =4 , +MLXSW_REG_PMTM_MODULE_TYPE_BACKPLANE_2_LANES =8 , +MLXSW_REG_PMTM_MODULE_TYPE_CHIP2CHIP4X =10 , +MLXSW_REG_PMTM_MODULE_TYPE_CHIP2CHIP2X =11 , +MLXSW_REG_PMTM_MODULE_TYPE_CHIP2CHIP1X =12 , +MLXSW_REG_PMTM_MODULE_TYPE_QSFP_DD =14 , +MLXSW_REG_PMTM_MODULE_TYPE_OSFP =15 , +MLXSW_REG_PMTM_MODULE_TYPE_SFP_DD =16 , +MLXSW_REG_PMTM_MODULE_TYPE_DSFP =17 , +MLXSW_REG_PMTM_MODULE_TYPE_CHIP2CHIP8X =18 , +MLXSW_REG_PMTM_MODULE_TYPE_TWISTED_PAIR =19 , +}; + +/* reg_pmtm_module_type +* Module type. +* Access: RW +*/ +MLXSW_ITEM32 (reg, pmtm, module_type,0x04 ,0 ,5 ); + +static inline void mlxsw_reg_pmtm_pack (char *payload,u8 slot_index,u8 module) +{ +MLXSW_REG_ZERO (pmtm, payload); +mlxsw_reg_pmtm_slot_index_set (payload, slot_index); +mlxsw_reg_pmtm_module_set (payload, module); +} +/* HTGT - Host Trap Group Table * ---------------------------- * Configures the properties for forwarding to CPU.
@@ -12570,6 +12622,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {MLXSW_REG (pddr),MLXSW_REG (pmmp),MLXSW_REG (pllp), +MLXSW_REG (pmtm),MLXSW_REG (htgt),MLXSW_REG (hpkt), MLXSW_REG(rgcr),
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 6/9 mlxsw: core_env: Query and store port module's type during initialization
In reply to Ido SchimmelFrom: Danielle Ratson <[email protected]>
Query and store port module's type during initialization so that it could be later used to determine if certain configurations are allowed based on the type.
--- .../net/ethernet/mellanox/mlxsw/core_env.c | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +28 -0
@@ -18,6 +18,7 @@ struct mlxsw_env_module_info {int num_ports_mapped;int num_ports_up;enum ethtool_module_power_mode_policy power_mode_policy; +enum mlxsw_reg_pmtm_module_type type; };struct mlxsw_env {
@@ -998,6 +999,28 @@ void mlxsw_env_module_port_down(struct mlxsw_core *mlxsw_core, u8 module) }EXPORT_SYMBOL (mlxsw_env_module_port_down); +static int +mlxsw_env_module_type_set (struct mlxsw_core *mlxsw_core) +{ +struct mlxsw_env *mlxsw_env =mlxsw_core_env (mlxsw_core); +int i; + +for (i =0 ; i < mlxsw_env->module_count; i++) { +char pmtm_pl[MLXSW_REG_PMTM_LEN ]; +int err; + +mlxsw_reg_pmtm_pack (pmtm_pl,0 , i); + err =mlxsw_reg_query (mlxsw_core,MLXSW_REG (pmtm), pmtm_pl); +if (err) +return err; + + mlxsw_env->module_info[i].type = +mlxsw_reg_pmtm_module_type_get (pmtm_pl); + } + +return 0 ; +} +int mlxsw_env_init (struct mlxsw_core *mlxsw_core,struct mlxsw_env **p_env) {char mgpir_pl[MLXSW_REG_MGPIR_LEN ];
@@ -1044,8 +1067,13 @@ int mlxsw_env_init(struct mlxsw_core *mlxsw_core, struct mlxsw_env **p_env)if (err) goto err_temp_event_enable; + err =mlxsw_env_module_type_set (mlxsw_core); +if (err) + goto err_type_set; +return 0 ; +err_type_set: err_temp_event_enable: err_oper_state_event_enable:mlxsw_env_module_plug_event_unregister (env);
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 7/9 mlxsw: core_env: Forbid getting module EEPROM on RJ45 ports
In reply to Ido SchimmelFrom: Danielle Ratson <[email protected]>
MCIA (Management Cable Info Access) register is not supported on RJ45 ports, so getting module EEPROM should be rejected.
Therefore, before trying to access this register, validate the port module type that was queried during initialization and return an error to user space in case the port module type is RJ45 (twisted pair).
Examples for output when trying to get EEPROM module:
Using netlink:
# ethtool -m swp1 netlink error: mlxsw_core: EEPROM is not equipped on port module type netlink error: Invalid argument
Using IOCTL:
# ethtool -m swp1 Cannot get module EEPROM information: Invalid argument $ dmesg mlxsw_spectrum 0000:03:00.0 swp1: EEPROM is not equipped on port module type
--- .../net/ethernet/mellanox/mlxsw/core_env.c | 52 +++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +49 -3
@@ -28,14 +28,47 @@ struct mlxsw_env {struct mlxsw_env_module_info module_info[]; }; -static int mlxsw_env_validate_cable_ident (struct mlxsw_core *core,int id, -bool *qsfp,bool *cmis) +static int __mlxsw_env_validate_module_type (struct mlxsw_core *core,u8 module) +{ +struct mlxsw_env *mlxsw_env =mlxsw_core_env (core); +int err; + +switch (mlxsw_env->module_info[module].type) { +case MLXSW_REG_PMTM_MODULE_TYPE_TWISTED_PAIR : + err = -EINVAL ; +break ; +default : + err =0 ; + } + +return err; +} + +static int mlxsw_env_validate_module_type (struct mlxsw_core *core,u8 module) +{ +struct mlxsw_env *mlxsw_env =mlxsw_core_env (core); +int err; + +mutex_lock (&mlxsw_env->module_info_lock); + err =__mlxsw_env_validate_module_type (core, module); +mutex_unlock (&mlxsw_env->module_info_lock); + +return err; +} + +static int +mlxsw_env_validate_cable_ident (struct mlxsw_core *core,int id,bool *qsfp, +bool *cmis) {char mcia_pl[MLXSW_REG_MCIA_LEN ];char *eeprom_tmp;u8 ident;int err; + err =mlxsw_env_validate_module_type (core, id); +if (err) +return err; +mlxsw_reg_mcia_pack (mcia_pl, id,0 ,MLXSW_REG_MCIA_PAGE0_LO_OFF ,0 ,1 ,MLXSW_REG_MCIA_I2C_ADDR_LOW ); err =mlxsw_reg_query (core,MLXSW_REG (mcia), mcia_pl);
@@ -217,6 +250,13 @@ int mlxsw_env_get_module_info(struct net_device *netdev,unsigned int read_size;int err; + err =mlxsw_env_validate_module_type (mlxsw_core, module); +if (err) { +netdev_err (netdev, +"EEPROM is not equipped on port module type" ); +return err; + } + err =mlxsw_env_query_module_eeprom (mlxsw_core, module,0 , offset, module_info, false, &read_size);if (err)
@@ -358,6 +398,13 @@ mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core, u8 module, {u32 bytes_read =0 ;u16 device_addr; +int err; + + err =mlxsw_env_validate_module_type (mlxsw_core, module); +if (err) { +NL_SET_ERR_MSG_MOD (extack,"EEPROM is not equipped on port module type" ); +return err; + }/* Offset cannot be larger than 2 * ETH_MODULE_EEPROM_PAGE_LEN */ device_addr = page->offset;
@@ -366,7 +413,6 @@ mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core, u8 module,char mcia_pl[MLXSW_REG_MCIA_LEN ];char *eeprom_tmp;u8 size; -int err; size =min_t (u8, page->length - bytes_read,MLXSW_REG_MCIA_EEPROM_SIZE );
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 8/9 mlxsw: core_env: Forbid power mode set and get on RJ45 ports
In reply to Ido SchimmelFrom: Danielle Ratson <[email protected]>
PMMP (Port Module Memory Map Properties) and MCION (Management Cable IO and Notifications) registers are not supported on RJ45 ports, so setting and getting power mode should be rejected.
Therefore, before trying to access those registers, validate the port module type that was queried during initialization and return an error to user space in case the port module type is RJ45 (twisted pair).
Set output example:
# ethtool --set-module swp1 power-mode-policy auto netlink error: mlxsw_core: Power mode is not supported on port module type netlink error: Invalid argument
Get output example:
$ ethtool --show-module swp11 netlink error: mlxsw_core: Power mode is not supported on port module type netlink error: Invalid argument
--- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +13 -0
@@ -509,6 +509,12 @@ mlxsw_env_get_module_power_mode(struct mlxsw_core *mlxsw_core, u8 module,mutex_lock (&mlxsw_env->module_info_lock); + err =__mlxsw_env_validate_module_type (mlxsw_core, module); +if (err) { +NL_SET_ERR_MSG_MOD (extack,"Power mode is not supported on port module type" ); + goto out; + } + params->policy = mlxsw_env->module_info[module].power_mode_policy;mlxsw_reg_mcion_pack (mcion_pl, module);
@@ -619,6 +625,13 @@ mlxsw_env_set_module_power_mode(struct mlxsw_core *mlxsw_core, u8 module,mutex_lock (&mlxsw_env->module_info_lock); + err =__mlxsw_env_validate_module_type (mlxsw_core, module); +if (err) { +NL_SET_ERR_MSG_MOD (extack, +"Power mode set is not supported on port module type" ); + goto out; + } +if (mlxsw_env->module_info[module].power_mode_policy == policy) goto out;
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 9/9 mlxsw: core_env: Forbid module reset on RJ45 ports
In reply to Ido SchimmelFrom: Danielle Ratson <[email protected]>
Transceiver module reset through 'rst' field in PMAOS register is not supported on RJ45 ports, so module reset should be rejected.
Therefore, before trying to access this field, validate the port module type that was queried during initialization and return an error to user space in case the port module type is RJ45 (twisted pair).
Output example:
# ethtool --reset swp11 phy ETHTOOL_RESET 0x40 Cannot issue ETHTOOL_RESET: Invalid argument $ dmesg mlxsw_spectrum 0000:03:00.0 swp11: Reset module is not supported on port module type
--- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +6 -0
@@ -467,6 +467,12 @@ int mlxsw_env_reset_module(struct net_device *netdev,mutex_lock (&mlxsw_env->module_info_lock); + err =__mlxsw_env_validate_module_type (mlxsw_core, module); +if (err) { +netdev_err (netdev,"Reset module is not supported on port module type\n" ); + goto out; + } +if (mlxsw_env->module_info[module].num_ports_up) {netdev_err (netdev,"Cannot reset module when ports using it are administratively up\n" ); err = -EINVAL ;
Signature · 1 line
2.33.1
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 9 lines · On Wed, 26 Jan 2022 12:30:28 +0200 you wrote:
We are in the process of qualifying a new system that has RJ45 ports as opposed to the transceiver modules (e.g., SFP, QSFP) present on all existing systems.
This patchset adds support for these ports in mlxsw by adding a couple of missing BaseT link modes and rejecting ethtool operations that are specific to transceiver modules.
[...]
Here is the summary with links:
- [net-next,1/9] mlxsw: spectrum_ethtool: Remove redundant variable
https://git.kernel.org/netdev/net-next/c/5c759fe24cdb - [net-next,2/9] mlxsw: core_env: Do not pass number of modules as argument https://git.kernel.org/netdev/net-next/c/6af5f7b674e4 - [net-next,3/9] mlxsw: Add netdev argument to mlxsw_env_get_module_info() https://git.kernel.org/netdev/net-next/c/5eaec6d86805 - [net-next,4/9] mlxsw: spectrum_ethtool: Add support for two new link modes https://git.kernel.org/netdev/net-next/c/78cf4b92218b - [net-next,5/9] mlxsw: reg: Add Port Module Type Mapping register https://git.kernel.org/netdev/net-next/c/0d31441e8793 - [net-next,6/9] mlxsw: core_env: Query and store port module's type during initialization https://git.kernel.org/netdev/net-next/c/e62f5b0e3faa - [net-next,7/9] mlxsw: core_env: Forbid getting module EEPROM on RJ45 ports https://git.kernel.org/netdev/net-next/c/615ebb8cc4e2 - [net-next,8/9] mlxsw: core_env: Forbid power mode set and get on RJ45 ports https://git.kernel.org/netdev/net-next/c/c8f994ccdd9a - [net-next,9/9] mlxsw: core_env: Forbid module reset on RJ45 ports https://git.kernel.org/netdev/net-next/c/b7347cdf10fa
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html