Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Mar 2019 09:18:29 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r344920 - head/sys/dev/mlx4/mlx4_en
Message-ID:  <201903080918.x289ITVg054382@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Mar  8 09:18:29 2019
New Revision: 344920
URL: https://svnweb.freebsd.org/changeset/base/344920

Log:
  Teardown ifnet after stopping port in the mlx4en(4) driver.
  
  mlx4_en_stop_port() calls mlx4_en_put_qp() which can refer the link level
  address of the network interface, which in turn will be freed by the
  network interface detach function. Make sure the port is stopped
  before detaching the network interface.
  
  MFC after:		1 week
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
==============================================================================
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c	Fri Mar  8 09:16:29 2019	(r344919)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c	Fri Mar  8 09:18:29 2019	(r344920)
@@ -1778,13 +1778,13 @@ void mlx4_en_destroy_netdev(struct net_device *dev)
 	if (priv->vlan_detach != NULL)
 		EVENTHANDLER_DEREGISTER(vlan_unconfig, priv->vlan_detach);
 
-	/* Unregister device - this will close the port if it was up */
-	if (priv->registered)
-		ether_ifdetach(dev);
-
 	mutex_lock(&mdev->state_lock);
 	mlx4_en_stop_port(dev);
 	mutex_unlock(&mdev->state_lock);
+
+	/* Unregister device - this will close the port if it was up */
+	if (priv->registered)
+		ether_ifdetach(dev);
 
 	if (priv->allocated)
 		mlx4_free_hwq_res(mdev->dev, &priv->res, MLX4_EN_PAGE_SIZE);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903080918.x289ITVg054382>