From 7c22ae80d2f2c6a514fc67e8cd076a4ece8810e1 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Thu, 8 Mar 2018 15:43:41 +0000 Subject: [PATCH] Use the device unit number for naming the ifnet interface in mlx5en(4). Currently the ifnet interface is named mceX, where X is a monotonically incremented value. If the device is reset due to a fatal error, then the interface name will change. Using the device unit number will keep the naming consistent across the reset logic. Submitted by: Matthew Finlay MFC after: 1 week Sponsored by: Mellanox Technologies --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index f5d94505a49d..87ca7e572006 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3442,7 +3442,6 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv) static void * mlx5e_create_ifp(struct mlx5_core_dev *mdev) { - static volatile int mlx5_en_unit; struct ifnet *ifp; struct mlx5e_priv *priv; u8 dev_addr[ETHER_ADDR_LEN] __aligned(4); @@ -3466,7 +3465,7 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) goto err_free_priv; } ifp->if_softc = priv; - if_initname(ifp, "mce", atomic_fetchadd_int(&mlx5_en_unit, 1)); + if_initname(ifp, "mce", device_get_unit(mdev->pdev->dev.bsddev)); ifp->if_mtu = ETHERMTU; ifp->if_init = mlx5e_open; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;