From: Amir Vadai <amirv@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
Amir Vadai <amirv@mellanox.com>,
Yevgeny Petrilin <yevgenyp@mellanox.com>,
Saeed Mahameed <saeedm@mellanox.com>
Subject: [PATCH net-next 08/10] net/mlx4_en: Use ethtool cmd->autoneg as a hint for ethtool set settings
Date: Tue, 27 Jan 2015 11:32:57 +0200 [thread overview]
Message-ID: <1422351179-27284-9-git-send-email-amirv@mellanox.com> (raw)
In-Reply-To: <1422351179-27284-1-git-send-email-amirv@mellanox.com>
From: Saeed Mahameed <saeedm@mellanox.com>
Use cmd->autoneg as a user hint to decide what to set in ethtool set settings callback.
When cmd->autoneg == AUTONEG_ENABLE set according to ethtool->advertise otherwise,
set according to ethtool->speed.
Usage:
- ethtool -s eth<x> speed 56000 autoneg off
- ethtool -s eth<x> advertise 0x800000 autoneg on
While we're here:
- Move proto_admin masking outcome check to be adjacent to the operation.
- Move en_warn("port reset..") print to "port reset" block.
Fixes: 312df74 ("net/mlx4_en: mlx4_en_set_settings() always fails when autoneg is set")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index 569eda9..a7b58ba 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -770,22 +770,20 @@ static int mlx4_en_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return 0;
}
- proto_admin = cpu_to_be32(ptys_adv);
- if (speed >= 0 && speed != priv->port_state.link_speed)
- /* If speed was set then speed decides :-) */
- proto_admin = speed_set_ptys_admin(priv, speed,
- ptys_reg.eth_proto_cap);
+ proto_admin = cmd->autoneg == AUTONEG_ENABLE ?
+ cpu_to_be32(ptys_adv) :
+ speed_set_ptys_admin(priv, speed,
+ ptys_reg.eth_proto_cap);
proto_admin &= ptys_reg.eth_proto_cap;
-
- if (proto_admin == ptys_reg.eth_proto_admin)
- return 0; /* Nothing to change */
-
if (!proto_admin) {
en_warn(priv, "Not supported link mode(s) requested, check supported link modes.\n");
return -EINVAL; /* nothing to change due to bad input */
}
+ if (proto_admin == ptys_reg.eth_proto_admin)
+ return 0; /* Nothing to change */
+
en_dbg(DRV, priv, "mlx4_ACCESS_PTYS_REG SET: ptys_reg.eth_proto_admin = 0x%x\n",
be32_to_cpu(proto_admin));
@@ -798,9 +796,9 @@ static int mlx4_en_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return ret;
}
- en_warn(priv, "Port link mode changed, restarting port...\n");
mutex_lock(&priv->mdev->state_lock);
if (priv->port_up) {
+ en_warn(priv, "Port link mode changed, restarting port...\n");
mlx4_en_stop_port(dev, 1);
if (mlx4_en_start_port(dev))
en_err(priv, "Failed restarting port %d\n", priv->port);
--
1.9.3
next prev parent reply other threads:[~2015-01-27 9:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-27 9:32 [PATCH net-next 00/10] Mellanox ethernet driver updates Jan-27-2015 Amir Vadai
2015-01-27 9:32 ` [PATCH net-next 01/10] net/mlx4_core: Add bad-cable event support Amir Vadai
2015-01-27 9:32 ` [PATCH net-next 02/10] net/mlx4_core: Add reserved lkey for VFs to QUERY_FUNC_CAP Amir Vadai
2015-01-27 9:32 ` [PATCH net-next 03/10] net/mlx4_core: Fix mem leak in SRIOV mlx4_init_one error flow Amir Vadai
2015-01-27 9:32 ` [PATCH net-next 04/10] net/mlx4_core: Adjust command timeouts to conform to the firmware spec Amir Vadai
2015-01-27 9:32 ` [PATCH net-next 05/10] net/mlx4_core: Fix HW2SW_EQ " Amir Vadai
2015-01-27 9:32 ` [PATCH net-next 06/10] net/mlx4_core: Fix struct mlx4_vhcr_cmd to make implicit padding explicit Amir Vadai
2015-01-27 9:43 ` David Laight
2015-01-27 13:00 ` Jack Morgenstein
2015-01-27 13:38 ` David Laight
2015-01-27 14:43 ` Jack Morgenstein
2015-01-27 19:13 ` David Miller
2015-01-27 19:50 ` Jack Morgenstein
2015-01-28 15:16 ` Jack Morgenstein
2015-01-27 9:32 ` [PATCH net-next 07/10] net/mlx4_core: Remove duplicate code line from procedure mlx4_bf_alloc Amir Vadai
2015-01-27 9:32 ` Amir Vadai [this message]
2015-01-27 9:32 ` [PATCH net-next 09/10] net/mlx4: Fix memory corruption in mlx4_MAD_IFC_wrapper Amir Vadai
2015-01-27 9:32 ` [PATCH net-next 10/10] net/mlx4_core: Fix device capabilities dumping Amir Vadai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1422351179-27284-9-git-send-email-amirv@mellanox.com \
--to=amirv@mellanox.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=saeedm@mellanox.com \
--cc=yevgenyp@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox