Re: [PATCH V5 net-next 05/11] net: hibmcge: Implement some .ndo functions
From: Jijie Shao
Date: Wed Aug 28 2024 - 22:40:25 EST
on 2024/8/29 9:39, Jakub Kicinski wrote:
On Tue, 27 Aug 2024 21:14:49 +0800 Jijie Shao wrote:
+static int hbg_net_open(struct net_device *dev)
+{
+ struct hbg_priv *priv = netdev_priv(dev);
+
+ if (test_and_set_bit(HBG_NIC_STATE_OPEN, &priv->state))
+ return 0;
+
+ netif_carrier_off(dev);
Why clear the carrier during open? You should probably clear it once on
the probe path and then on stop.
In net_open(), the GMAC is not ready to receive or transmit packets.
Therefore, netif_carrier_off() is called.
Packets can be received or transmitted only after the PHY is linked.
Therefore, netif_carrier_on() should be called in adjust_link.
In net_stop() we also call netif_carrier_off()
Thanks,
Jijie Shao