All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Saeed Mahameed <saeedm@mellanox.com>
Subject: [PATCH net 11/12] net/mlx5e: Don't sync netdev state when not registered
Date: Wed, 28 Dec 2016 14:58:41 +0200	[thread overview]
Message-ID: <1482929922-32626-12-git-send-email-saeedm@mellanox.com> (raw)
In-Reply-To: <1482929922-32626-1-git-send-email-saeedm@mellanox.com>

Skip setting netdev vxlan ports and netdev rx_mode on driver load
when netdev is not yet registered.

Synchronizing with netdev state is needed only on reset flow where the
netdev remains registered for the whole reset period.

This also fixes an access before initialization of net_device.addr_list_lock
- which for some reason initialized on register_netdev - where we queued
set_rx_mode work on driver load before netdev registration.

Fixes: 26e59d8077a3 ("net/mlx5e: Implement mlx5e interface attach/detach callbacks")
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reported-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Reviewed-by: Mohamad Haj Yahia <mohamad@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index be5ef03..cf270f6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -3781,14 +3781,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
 
 	mlx5_lag_add(mdev, netdev);
 
-	if (mlx5e_vxlan_allowed(mdev)) {
-		rtnl_lock();
-		udp_tunnel_get_rx_info(netdev);
-		rtnl_unlock();
-	}
-
 	mlx5e_enable_async_events(priv);
-	queue_work(priv->wq, &priv->set_rx_mode_work);
 
 	if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
 		mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id);
@@ -3798,6 +3791,18 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
 		rep.netdev = netdev;
 		mlx5_eswitch_register_vport_rep(esw, 0, &rep);
 	}
+
+	if (netdev->reg_state != NETREG_REGISTERED)
+		return;
+
+	/* Device already registered: sync netdev system state */
+	if (mlx5e_vxlan_allowed(mdev)) {
+		rtnl_lock();
+		udp_tunnel_get_rx_info(netdev);
+		rtnl_unlock();
+	}
+
+	queue_work(priv->wq, &priv->set_rx_mode_work);
 }
 
 static void mlx5e_nic_disable(struct mlx5e_priv *priv)
-- 
2.7.4

  parent reply	other threads:[~2016-12-28 12:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28 12:58 [PATCH net 00/12] Mellanox 100G mlx5 fixes 28-12-2016 Saeed Mahameed
2016-12-28 12:58 ` [PATCH net 01/12] net/mlx5: Disable RoCE on the e-switch management port under switchdev mode Saeed Mahameed
2016-12-28 12:58 ` [PATCH net 02/12] net/mlx5: Check FW limitations on log_max_qp before setting it Saeed Mahameed
2016-12-28 12:58 ` [PATCH net 03/12] net/mlx5: Cancel recovery work in remove flow Saeed Mahameed
2016-12-28 12:58 ` [PATCH net 04/12] net/mlx5: Avoid shadowing numa_node Saeed Mahameed
2016-12-28 12:58 ` [PATCH net 05/12] net/mlx5: Mask destination mac value in ethtool steering rules Saeed Mahameed
2016-12-28 12:58 ` [PATCH net 06/12] net/mlx5: Release FTE lock in error flow Saeed Mahameed
2016-12-28 12:58 ` [PATCH net 07/12] net/mlx5: Prevent setting multicast macs for VFs Saeed Mahameed
2016-12-28 12:58 ` [PATCH net 08/12] Revert "net/mlx5e: Expose PCIe statistics to ethtool" Saeed Mahameed
2016-12-28 12:58 ` [PATCH net 09/12] Revert "net/mlx5: Add MPCNT register infrastructure" Saeed Mahameed
2016-12-28 12:58 ` [PATCH net 10/12] net/mlx5e: Check ets capability before initializing ets settings Saeed Mahameed
2016-12-28 12:58 ` Saeed Mahameed [this message]
2016-12-28 12:58 ` [PATCH net 12/12] net/mlx5e: Disable netdev after close Saeed Mahameed
2016-12-28 19:38 ` [PATCH net 00/12] Mellanox 100G mlx5 fixes 28-12-2016 David Miller

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=1482929922-32626-12-git-send-email-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.