linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Dong Yibo <dong100@mucse.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	corbet@lwn.net, gur.stavi@huawei.com, maddy@linux.ibm.com,
	mpe@ellerman.id.au, danishanwar@ti.com, lee@trager.us,
	gongfan1@huawei.com, lorenzo@kernel.org, geert+renesas@glider.be,
	Parthiban.Veerasooran@microchip.com, lukas.bulwahn@redhat.com,
	alexanderduyck@fb.com, richardcochran@gmail.com,
	netdev@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 5/5] net: rnpgbe: Add register_netdev
Date: Fri, 15 Aug 2025 05:42:05 +0200	[thread overview]
Message-ID: <099a6006-02e4-44f0-ae47-7de14cc58a12@lunn.ch> (raw)
In-Reply-To: <20250814073855.1060601-6-dong100@mucse.com>

> +struct mucse_hw_operations {
> +	int (*reset_hw)(struct mucse_hw *hw);
> +	void (*driver_status)(struct mucse_hw *hw, bool enable, int mode);
> +};

Again, there is only one instance of this. Will there be more?

> + * rnpgbe_get_permanent_mac - Get permanent mac
> + * @hw: hw information structure
> + * @mac_addr: pointer to store mac
> + *
> + * rnpgbe_get_permanent_mac tries to get mac from hw.
> + * It use eth_random_addr if failed.
> + **/
> +static void rnpgbe_get_permanent_mac(struct mucse_hw *hw,
> +				     u8 *mac_addr)
> +{
> +	struct device *dev = &hw->pdev->dev;
> +
> +	if (mucse_fw_get_macaddr(hw, hw->pfvfnum, mac_addr, hw->lane) ||
> +	    !is_valid_ether_addr(mac_addr)) {
> +		dev_warn(dev, "Failed to get valid MAC from FW, using random\n");
> +		eth_random_addr(mac_addr);
> +	}

With a function named rnpgbe_get_permanent_mac(), i would not expect
it to return a random MAC address. If there is no permanent MAC
address, return -EINVAL, and let the caller does with the error.

> +static int rnpgbe_reset_hw_ops(struct mucse_hw *hw)
> +{
> +	struct mucse_dma_info *dma = &hw->dma;
> +	int err;
> +
> +	dma_wr32(dma, RNPGBE_DMA_AXI_EN, 0);
> +	err = mucse_mbx_fw_reset_phy(hw);
> +	if (err)
> +		return err;
> +	/* Store the permanent mac address */
> +	if (!(hw->flags & M_FLAGS_INIT_MAC_ADDRESS))

What do this hw->flags add to the driver? Why is it here?

>  static void rnpgbe_rm_adapter(struct pci_dev *pdev)
>  {
>  	struct mucse *mucse = pci_get_drvdata(pdev);
> +	struct mucse_hw *hw = &mucse->hw;
>  	struct net_device *netdev;
>  
>  	if (!mucse)
>  		return;
>  	netdev = mucse->netdev;
> +	if (netdev->reg_state == NETREG_REGISTERED)
> +		unregister_netdev(netdev);

Is that possible?

>  	mucse->netdev = NULL;
> +	hw->ops->driver_status(hw, false, mucse_driver_insmod);
>  	free_netdev(netdev);
>  }
>  
> -- 
> 2.25.1
> 

  parent reply	other threads:[~2025-08-15  3:42 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14  7:38 [PATCH v4 0/5] Add driver for 1Gbe network chips from MUCSE Dong Yibo
2025-08-14  7:38 ` [PATCH v4 1/5] net: rnpgbe: Add build support for rnpgbe Dong Yibo
2025-08-15  1:58   ` Andrew Lunn
2025-08-14  7:38 ` [PATCH v4 2/5] net: rnpgbe: Add n500/n210 chip support Dong Yibo
2025-08-14 12:07   ` MD Danish Anwar
2025-08-14 13:52     ` Yibo Dong
2025-08-15  2:07       ` Andrew Lunn
2025-08-15  2:05   ` Andrew Lunn
2025-08-15  2:38     ` Yibo Dong
2025-08-15  3:56       ` Andrew Lunn
2025-08-15  7:21         ` Yibo Dong
2025-08-15 13:36           ` Andrew Lunn
2025-08-18  1:14             ` Yibo Dong
2025-08-14  7:38 ` [PATCH v4 3/5] net: rnpgbe: Add basic mbx ops support Dong Yibo
2025-08-15  2:13   ` Andrew Lunn
2025-08-15  2:43     ` Yibo Dong
2025-08-15  3:59       ` Andrew Lunn
2025-08-15  7:22         ` Yibo Dong
2025-08-15  2:29   ` Andrew Lunn
2025-08-15  3:15     ` Yibo Dong
2025-08-14  7:38 ` [PATCH v4 4/5] net: rnpgbe: Add basic mbx_fw support Dong Yibo
2025-08-14 12:10   ` MD Danish Anwar
2025-08-14 13:54     ` Yibo Dong
2025-08-15  3:27   ` Andrew Lunn
2025-08-15  6:36     ` Yibo Dong
2025-08-15 13:21       ` Andrew Lunn
2025-08-18  2:14         ` Yibo Dong
2025-08-14  7:38 ` [PATCH v4 5/5] net: rnpgbe: Add register_netdev Dong Yibo
2025-08-14 12:14   ` MD Danish Anwar
2025-08-14 13:59     ` Yibo Dong
2025-08-15  2:28     ` Yibo Dong
2025-08-15  3:42   ` Andrew Lunn [this message]
2025-08-15  6:44     ` Yibo Dong
2025-08-15 18:06       ` Andrew Lunn
2025-08-18  1:21         ` Yibo Dong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=099a6006-02e4-44f0-ae47-7de14cc58a12@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Parthiban.Veerasooran@microchip.com \
    --cc=alexanderduyck@fb.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=dong100@mucse.com \
    --cc=edumazet@google.com \
    --cc=geert+renesas@glider.be \
    --cc=gongfan1@huawei.com \
    --cc=gur.stavi@huawei.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lee@trager.us \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=lukas.bulwahn@redhat.com \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).