Subject: Re: [PATCH V10 net-next 05/10] net: hibmcge: Implement some .ndo functions

From: Jakub Kicinski <[email-masked]>
Date: Sun, 15 Sep 2024 17:14:10 +0200

On Thu, 12 Sep 2024 10:51:22 +0800 Jijie Shao wrote:
> +static int hbg_net_change_mtu(struct net_device *netdev, int new_mtu)
> +{
> +	struct hbg_priv *priv = netdev_priv(netdev);
> +	bool is_running = netif_running(netdev);
> +
> +	if (is_running)
> +		hbg_net_stop(netdev);
> +
> +	hbg_change_mtu(priv, new_mtu);
> +	WRITE_ONCE(netdev->mtu, new_mtu);
> +
> +	dev_dbg(&priv->pdev->dev,
> +		"change mtu from %u to %u\n", netdev->mtu, new_mtu);
> +	if (is_running)
> +		hbg_net_open(netdev);

What if open() fails? You either have to pre-allocate the new resources
or find a way of resetting without reallocating memory. Or return -EBUSY
if interface is running