git: 1e9df419f14c - stable/14 - mlx4(5): fix driver initialization

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 30 Dec 2023 00:24:44 UTC
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=1e9df419f14c059aba8d6704256da5c7af4f182a

commit 1e9df419f14c059aba8d6704256da5c7af4f182a
Author:     Yuji Hagiwara <yuuzi41@hotmail.com>
AuthorDate: 2023-12-23 20:53:02 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-12-30 00:24:07 +0000

    mlx4(5): fix driver initialization
    
    PR:     275897
    MFC after:      1 week
    
    (cherry picked from commit 553ed8e38bfdd4832deecdec1c0b023824dcff94)
---
 sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
index c26afc0099b5..583de1816d1b 100644
--- a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
+++ b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c
@@ -2293,7 +2293,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 		dev_addr[ETHER_ADDR_LEN - 1 - i] = (u8) (priv->mac >> (8 * i));
 
 
-	ether_ifattach(dev, dev_addr);
 	if_link_state_change(dev, LINK_STATE_DOWN);
 	ifmedia_init(&priv->media, IFM_IMASK | IFM_ETH_FMASK,
 	    mlx4_en_media_change, mlx4_en_media_status);
@@ -2306,6 +2305,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 
 	DEBUGNET_SET(dev, mlx4_en);
 
+	ether_ifattach(dev, dev_addr);
+
 	en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num);
 	en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num);