Date: Sun, 18 Jun 2017 11:48:40 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r320067 - stable/10/sys/ofed/drivers/net/mlx4 Message-ID: <201706181148.v5IBmeWI017527@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Sun Jun 18 11:48:40 2017 New Revision: 320067 URL: https://svnweb.freebsd.org/changeset/base/320067 Log: MFC r319972: Use static device numbering instead of dynamic one when creating mlx4en network interfaces. This prevents infinite unit number growth typically when the mlx4en driver is used inside virtual machines which support runtime PCI attach and detach. Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Sun Jun 18 11:46:17 2017 (r320066) +++ stable/10/sys/ofed/drivers/net/mlx4/en_netdev.c Sun Jun 18 11:48:40 2017 (r320067) @@ -54,7 +54,6 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv); static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv); -static int mlx4_en_unit; #ifdef CONFIG_NET_RX_BUSY_POLL /* must be called with local_bh_disable()d */ @@ -2053,7 +2052,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int return -ENOMEM; } dev->if_softc = priv; - if_initname(dev, "mlxen", atomic_fetchadd_int(&mlx4_en_unit, 1)); + if_initname(dev, "mlxen", (device_get_unit( + mdev->pdev->dev.bsddev) * MLX4_MAX_PORTS) + port - 1); dev->if_mtu = ETHERMTU; dev->if_init = mlx4_en_open; dev->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706181148.v5IBmeWI017527>