Commit 401c8b4e authored by Elad Raz's avatar Elad Raz Committed by David S. Miller

mlxsw: reg: Add eth prefix to PTYS pack and unpack

We want to add Infiniband support to PTYS. In order to maintain proper
conventions, we will change pack and unpack prefix to eth.
Signed-off-by: default avatarElad Raz <eladr@mellanox.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 10dbf8f8
...@@ -2131,8 +2131,8 @@ MLXSW_ITEM32(reg, ptys, eth_proto_oper, 0x24, 0, 32); ...@@ -2131,8 +2131,8 @@ MLXSW_ITEM32(reg, ptys, eth_proto_oper, 0x24, 0, 32);
*/ */
MLXSW_ITEM32(reg, ptys, eth_proto_lp_advertise, 0x30, 0, 32); MLXSW_ITEM32(reg, ptys, eth_proto_lp_advertise, 0x30, 0, 32);
static inline void mlxsw_reg_ptys_pack(char *payload, u8 local_port, static inline void mlxsw_reg_ptys_eth_pack(char *payload, u8 local_port,
u32 proto_admin) u32 proto_admin)
{ {
MLXSW_REG_ZERO(ptys, payload); MLXSW_REG_ZERO(ptys, payload);
mlxsw_reg_ptys_local_port_set(payload, local_port); mlxsw_reg_ptys_local_port_set(payload, local_port);
...@@ -2140,9 +2140,10 @@ static inline void mlxsw_reg_ptys_pack(char *payload, u8 local_port, ...@@ -2140,9 +2140,10 @@ static inline void mlxsw_reg_ptys_pack(char *payload, u8 local_port,
mlxsw_reg_ptys_eth_proto_admin_set(payload, proto_admin); mlxsw_reg_ptys_eth_proto_admin_set(payload, proto_admin);
} }
static inline void mlxsw_reg_ptys_unpack(char *payload, u32 *p_eth_proto_cap, static inline void mlxsw_reg_ptys_eth_unpack(char *payload,
u32 *p_eth_proto_adm, u32 *p_eth_proto_cap,
u32 *p_eth_proto_oper) u32 *p_eth_proto_adm,
u32 *p_eth_proto_oper)
{ {
if (p_eth_proto_cap) if (p_eth_proto_cap)
*p_eth_proto_cap = mlxsw_reg_ptys_eth_proto_cap_get(payload); *p_eth_proto_cap = mlxsw_reg_ptys_eth_proto_cap_get(payload);
......
...@@ -2003,12 +2003,12 @@ static int mlxsw_sp_port_get_link_ksettings(struct net_device *dev, ...@@ -2003,12 +2003,12 @@ static int mlxsw_sp_port_get_link_ksettings(struct net_device *dev,
int err; int err;
autoneg = mlxsw_sp_port->link.autoneg; autoneg = mlxsw_sp_port->link.autoneg;
mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sp_port->local_port, 0); mlxsw_reg_ptys_eth_pack(ptys_pl, mlxsw_sp_port->local_port, 0);
err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl); err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl);
if (err) if (err)
return err; return err;
mlxsw_reg_ptys_unpack(ptys_pl, &eth_proto_cap, &eth_proto_admin, mlxsw_reg_ptys_eth_unpack(ptys_pl, &eth_proto_cap, &eth_proto_admin,
&eth_proto_oper); &eth_proto_oper);
mlxsw_sp_port_get_link_supported(eth_proto_cap, cmd); mlxsw_sp_port_get_link_supported(eth_proto_cap, cmd);
...@@ -2037,11 +2037,11 @@ mlxsw_sp_port_set_link_ksettings(struct net_device *dev, ...@@ -2037,11 +2037,11 @@ mlxsw_sp_port_set_link_ksettings(struct net_device *dev,
bool autoneg; bool autoneg;
int err; int err;
mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sp_port->local_port, 0); mlxsw_reg_ptys_eth_pack(ptys_pl, mlxsw_sp_port->local_port, 0);
err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl); err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl);
if (err) if (err)
return err; return err;
mlxsw_reg_ptys_unpack(ptys_pl, &eth_proto_cap, NULL, NULL); mlxsw_reg_ptys_eth_unpack(ptys_pl, &eth_proto_cap, NULL, NULL);
autoneg = cmd->base.autoneg == AUTONEG_ENABLE; autoneg = cmd->base.autoneg == AUTONEG_ENABLE;
eth_proto_new = autoneg ? eth_proto_new = autoneg ?
...@@ -2054,7 +2054,8 @@ mlxsw_sp_port_set_link_ksettings(struct net_device *dev, ...@@ -2054,7 +2054,8 @@ mlxsw_sp_port_set_link_ksettings(struct net_device *dev,
return -EINVAL; return -EINVAL;
} }
mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sp_port->local_port, eth_proto_new); mlxsw_reg_ptys_eth_pack(ptys_pl, mlxsw_sp_port->local_port,
eth_proto_new);
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl); err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl);
if (err) if (err)
return err; return err;
...@@ -2092,8 +2093,8 @@ mlxsw_sp_port_speed_by_width_set(struct mlxsw_sp_port *mlxsw_sp_port, u8 width) ...@@ -2092,8 +2093,8 @@ mlxsw_sp_port_speed_by_width_set(struct mlxsw_sp_port *mlxsw_sp_port, u8 width)
u32 eth_proto_admin; u32 eth_proto_admin;
eth_proto_admin = mlxsw_sp_to_ptys_upper_speed(upper_speed); eth_proto_admin = mlxsw_sp_to_ptys_upper_speed(upper_speed);
mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sp_port->local_port, mlxsw_reg_ptys_eth_pack(ptys_pl, mlxsw_sp_port->local_port,
eth_proto_admin); eth_proto_admin);
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl); return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptys), ptys_pl);
} }
......
...@@ -762,14 +762,14 @@ static int mlxsw_sx_port_get_settings(struct net_device *dev, ...@@ -762,14 +762,14 @@ static int mlxsw_sx_port_get_settings(struct net_device *dev,
u32 eth_proto_oper; u32 eth_proto_oper;
int err; int err;
mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sx_port->local_port, 0); mlxsw_reg_ptys_eth_pack(ptys_pl, mlxsw_sx_port->local_port, 0);
err = mlxsw_reg_query(mlxsw_sx->core, MLXSW_REG(ptys), ptys_pl); err = mlxsw_reg_query(mlxsw_sx->core, MLXSW_REG(ptys), ptys_pl);
if (err) { if (err) {
netdev_err(dev, "Failed to get proto"); netdev_err(dev, "Failed to get proto");
return err; return err;
} }
mlxsw_reg_ptys_unpack(ptys_pl, &eth_proto_cap, mlxsw_reg_ptys_eth_unpack(ptys_pl, &eth_proto_cap,
&eth_proto_admin, &eth_proto_oper); &eth_proto_admin, &eth_proto_oper);
cmd->supported = mlxsw_sx_from_ptys_supported_port(eth_proto_cap) | cmd->supported = mlxsw_sx_from_ptys_supported_port(eth_proto_cap) |
mlxsw_sx_from_ptys_supported_link(eth_proto_cap) | mlxsw_sx_from_ptys_supported_link(eth_proto_cap) |
...@@ -841,13 +841,14 @@ static int mlxsw_sx_port_set_settings(struct net_device *dev, ...@@ -841,13 +841,14 @@ static int mlxsw_sx_port_set_settings(struct net_device *dev,
mlxsw_sx_to_ptys_advert_link(cmd->advertising) : mlxsw_sx_to_ptys_advert_link(cmd->advertising) :
mlxsw_sx_to_ptys_speed(speed); mlxsw_sx_to_ptys_speed(speed);
mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sx_port->local_port, 0); mlxsw_reg_ptys_eth_pack(ptys_pl, mlxsw_sx_port->local_port, 0);
err = mlxsw_reg_query(mlxsw_sx->core, MLXSW_REG(ptys), ptys_pl); err = mlxsw_reg_query(mlxsw_sx->core, MLXSW_REG(ptys), ptys_pl);
if (err) { if (err) {
netdev_err(dev, "Failed to get proto"); netdev_err(dev, "Failed to get proto");
return err; return err;
} }
mlxsw_reg_ptys_unpack(ptys_pl, &eth_proto_cap, &eth_proto_admin, NULL); mlxsw_reg_ptys_eth_unpack(ptys_pl, &eth_proto_cap, &eth_proto_admin,
NULL);
eth_proto_new = eth_proto_new & eth_proto_cap; eth_proto_new = eth_proto_new & eth_proto_cap;
if (!eth_proto_new) { if (!eth_proto_new) {
...@@ -857,7 +858,8 @@ static int mlxsw_sx_port_set_settings(struct net_device *dev, ...@@ -857,7 +858,8 @@ static int mlxsw_sx_port_set_settings(struct net_device *dev,
if (eth_proto_new == eth_proto_admin) if (eth_proto_new == eth_proto_admin)
return 0; return 0;
mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sx_port->local_port, eth_proto_new); mlxsw_reg_ptys_eth_pack(ptys_pl, mlxsw_sx_port->local_port,
eth_proto_new);
err = mlxsw_reg_write(mlxsw_sx->core, MLXSW_REG(ptys), ptys_pl); err = mlxsw_reg_write(mlxsw_sx->core, MLXSW_REG(ptys), ptys_pl);
if (err) { if (err) {
netdev_err(dev, "Failed to set proto admin"); netdev_err(dev, "Failed to set proto admin");
...@@ -977,8 +979,8 @@ mlxsw_sx_port_speed_by_width_set(struct mlxsw_sx_port *mlxsw_sx_port, u8 width) ...@@ -977,8 +979,8 @@ mlxsw_sx_port_speed_by_width_set(struct mlxsw_sx_port *mlxsw_sx_port, u8 width)
u32 eth_proto_admin; u32 eth_proto_admin;
eth_proto_admin = mlxsw_sx_to_ptys_upper_speed(upper_speed); eth_proto_admin = mlxsw_sx_to_ptys_upper_speed(upper_speed);
mlxsw_reg_ptys_pack(ptys_pl, mlxsw_sx_port->local_port, mlxsw_reg_ptys_eth_pack(ptys_pl, mlxsw_sx_port->local_port,
eth_proto_admin); eth_proto_admin);
return mlxsw_reg_write(mlxsw_sx->core, MLXSW_REG(ptys), ptys_pl); return mlxsw_reg_write(mlxsw_sx->core, MLXSW_REG(ptys), ptys_pl);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment