Re: [PATCH net-next 6/9] net/mlx4_en: Adding support of turning off link autonegotiation via ethtool
On Tue, Jan 17, 2017 at 1:08 AM, Ariel Levkovich wrote: > + MLX4_PTYS_AN_DISABLE_CAP = 1 << 5, > > It's there. I'll look, but please bring a cake to the office, we started doing that in order to prevent people from replying in top posting to linux mailing list. Or.
Re: [PATCH net-next 6/9] net/mlx4_en: Adding support of turning off link autonegotiation via ethtool
On Tue, Jan 17, 2017 at 1:08 AM, Ariel Levkovich wrote: > + MLX4_PTYS_AN_DISABLE_CAP = 1 << 5, > > It's there. It would be good to spare few words on that aspect in the change log.
RE: [PATCH net-next 6/9] net/mlx4_en: Adding support of turning off link autonegotiation via ethtool
+ MLX4_PTYS_AN_DISABLE_CAP = 1 << 5, It's there. Best Regards, Ariel Levkovich Staff Engineer, SW Mellanox Technologies Beit Mellanox, Yokneam, P.O.Box 586, Israel 20692 Office: +972-74723-7652, Mobile: +972-52-3947-704 www.mellanox.com Follow us on Facebook and Twitter > -Original Message- > From: Or Gerlitz [mailto:gerlitz...@gmail.com] > Sent: Monday, January 16, 2017 4:48 PM > To: Tariq Toukan ; Ariel Levkovich > > Cc: David S. Miller ; Linux Netdev List > ; Eran Ben Elisha > Subject: Re: [PATCH net-next 6/9] net/mlx4_en: Adding support of turning > off link autonegotiation via ethtool > > On Mon, Jan 16, 2017 at 7:30 PM, Tariq Toukan > wrote: > 0644 > > --- a/include/linux/mlx4/device.h > > +++ b/include/linux/mlx4/device.h > > @@ -1539,8 +1539,13 @@ enum mlx4_ptys_proto { > > MLX4_PTYS_EN = 1<<2, > > }; > > > > +enum mlx4_ptys_flags { > > + MLX4_PTYS_AN_DISABLE_CAP = 1 << 5, > > + MLX4_PTYS_AN_DISABLE_ADMIN = 1 << 6, }; > > + > > struct mlx4_ptys_reg { > > - u8 resrvd1; > > + u8 flags; > > u8 local_port; > > u8 resrvd2; > > u8 proto_mask; > > Hi Ariel, > > I didn't see any new dev cap bit, what happens with FW version which don't > support this, is the result well defined? what is it? > > Or.
Re: [PATCH net-next 6/9] net/mlx4_en: Adding support of turning off link autonegotiation via ethtool
On Mon, Jan 16, 2017 at 7:30 PM, Tariq Toukan wrote: 0644 > --- a/include/linux/mlx4/device.h > +++ b/include/linux/mlx4/device.h > @@ -1539,8 +1539,13 @@ enum mlx4_ptys_proto { > MLX4_PTYS_EN = 1<<2, > }; > > +enum mlx4_ptys_flags { > + MLX4_PTYS_AN_DISABLE_CAP = 1 << 5, > + MLX4_PTYS_AN_DISABLE_ADMIN = 1 << 6, > +}; > + > struct mlx4_ptys_reg { > - u8 resrvd1; > + u8 flags; > u8 local_port; > u8 resrvd2; > u8 proto_mask; Hi Ariel, I didn't see any new dev cap bit, what happens with FW version which don't support this, is the result well defined? what is it? Or.
[PATCH net-next 6/9] net/mlx4_en: Adding support of turning off link autonegotiation via ethtool
From: Ariel Levkovich This feature will allow the user to disable auto negotiation on the port for mlx4 devices while setting the speed is limited to 1GbE speeds. Other speeds will not be accepted in autoneg off mode. Signed-off-by: Ariel Levkovich Signed-off-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 24 +++- include/linux/mlx4/device.h | 7 ++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index 0ab644b6c2e6..5d11433fcc37 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c @@ -902,6 +902,7 @@ static __be32 speed_set_ptys_admin(struct mlx4_en_priv *priv, u32 speed, struct mlx4_en_priv *priv = netdev_priv(dev); struct mlx4_ptys_reg ptys_reg; __be32 proto_admin; + u8 cur_autoneg; int ret; u32 ptys_adv = ethtool2ptys_link_modes( @@ -931,10 +932,21 @@ static __be32 speed_set_ptys_admin(struct mlx4_en_priv *priv, u32 speed, return 0; } - proto_admin = link_ksettings->base.autoneg == AUTONEG_ENABLE ? - cpu_to_be32(ptys_adv) : - speed_set_ptys_admin(priv, speed, -ptys_reg.eth_proto_cap); + cur_autoneg = ptys_reg.flags & MLX4_PTYS_AN_DISABLE_ADMIN ? + AUTONEG_DISABLE : AUTONEG_ENABLE; + + if (link_ksettings->base.autoneg == AUTONEG_DISABLE) { + proto_admin = speed_set_ptys_admin(priv, speed, + ptys_reg.eth_proto_cap); + if ((be32_to_cpu(proto_admin) & +(MLX4_PROT_MASK(MLX4_1000BASE_CX_SGMII) | + MLX4_PROT_MASK(MLX4_1000BASE_KX))) && + (ptys_reg.flags & MLX4_PTYS_AN_DISABLE_CAP)) + ptys_reg.flags |= MLX4_PTYS_AN_DISABLE_ADMIN; + } else { + proto_admin = cpu_to_be32(ptys_adv); + ptys_reg.flags &= ~MLX4_PTYS_AN_DISABLE_ADMIN; + } proto_admin &= ptys_reg.eth_proto_cap; if (!proto_admin) { @@ -942,7 +954,9 @@ static __be32 speed_set_ptys_admin(struct mlx4_en_priv *priv, u32 speed, return -EINVAL; /* nothing to change due to bad input */ } - if (proto_admin == ptys_reg.eth_proto_admin) + if ((proto_admin == ptys_reg.eth_proto_admin) && + ((ptys_reg.flags & MLX4_PTYS_AN_DISABLE_CAP) && +(link_ksettings->base.autoneg == cur_autoneg))) return 0; /* Nothing to change */ en_dbg(DRV, priv, "mlx4_ACCESS_PTYS_REG SET: ptys_reg.eth_proto_admin = 0x%x\n", diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 6533c16e27ad..c3ac945b2759 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h @@ -1539,8 +1539,13 @@ enum mlx4_ptys_proto { MLX4_PTYS_EN = 1<<2, }; +enum mlx4_ptys_flags { + MLX4_PTYS_AN_DISABLE_CAP = 1 << 5, + MLX4_PTYS_AN_DISABLE_ADMIN = 1 << 6, +}; + struct mlx4_ptys_reg { - u8 resrvd1; + u8 flags; u8 local_port; u8 resrvd2; u8 proto_mask; -- 1.8.3.1