Subject: Re: [PATCH net-next v16 5/5] net: rnpgbe: Add register_netdev

From: Jakub Kicinski <[email-masked]>
Date: Wed, 29 Oct 2025 19:21:35 -0700

On Mon, 27 Oct 2025 11:29:05 +0800 Dong Yibo wrote:
> diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe.h b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe.h
> index 37bd9278beaa..27fb080c0e37 100644
> --- a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe.h
> +++ b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe.h
> @@ -6,6 +6,7 @@
>  
>  #include <linux/types.h>
>  #include <linux/mutex.h>
> +#include <linux/netdevice.h>

Why do you need to include netdevice.h here now?
This patch doesn't add anything that'd need it to the header.

>  enum rnpgbe_boards {
>  	board_n500,
> @@ -26,18 +27,38 @@ struct mucse_mbx_info {
>  	u32 fwpf_ctrl_base;
>  };
>  
> +/* Enum for firmware notification modes,
> + * more modes (e.g., portup, link_report) will be added in future
> + **/
> +enum {
> +	mucse_fw_powerup,
> +};

> +	err = rnpgbe_get_permanent_mac(hw);
> +	if (err == -EINVAL) {
> +		dev_warn(&pdev->dev, "Using random MAC\n");
> +		eth_random_addr(hw->perm_addr);
> +	} else if (err) {
> +		dev_err(&pdev->dev, "get perm_addr failed %d\n", err);
> +		goto err_powerdown;
> +	}
> +
> +	eth_hw_addr_set(netdev, hw->perm_addr);

This is wrong, you may have gotten random address. This will make it
look like a real permanent address. Should be:

	err = rnpgbe_get_permanent_mac(hw);
	if (!err) {
		eth_hw_addr_set(netdev, hw->perm_addr);
	} else if (err == -EINVAL) {
		dev_warn(&pdev->dev, "Using random MAC\n");
		eth_hw_addr_random(netdev);
		ether_addr_copy(hw->perm_addr, dev->dev_addr);
	} else if (err) {
		dev_err(&pdev->dev, "get perm_addr failed %d\n", err);
		goto err_powerdown;
	}