linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Dong Yibo <dong100@mucse.com>,
	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, kees@kernel.org,
	gustavoars@kernel.org, rdunlap@infradead.org
Cc: netdev@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH net-next v11 5/5] net: rnpgbe: Add register_netdev
Date: Tue, 9 Sep 2025 15:37:19 +0100	[thread overview]
Message-ID: <2ec8c7f8-cf79-4701-97dc-2d0a687f0f3b@linux.dev> (raw)
In-Reply-To: <20250909120906.1781444-6-dong100@mucse.com>

On 09/09/2025 13:09, Dong Yibo wrote:
> Complete the network device (netdev) registration flow for Mucse Gbe
> Ethernet chips, including:
> 1. Hardware state initialization:
>     - Send powerup notification to firmware (via echo_fw_status)
>     - Sync with firmware
>     - Reset hardware
> 2. MAC address handling:
>     - Retrieve permanent MAC from firmware (via mucse_mbx_get_macaddr)
>     - Fallback to random valid MAC (eth_random_addr) if not valid mac
>       from Fw
> 
> Signed-off-by: Dong Yibo <dong100@mucse.com>

[...]

> +struct mucse_hw;

why do you need this forward declaration ...> +
> +struct mucse_hw_operations {
> +	int (*reset_hw)(struct mucse_hw *hw);
> +	int (*get_perm_mac)(struct mucse_hw *hw);
> +	int (*mbx_send_notify)(struct mucse_hw *hw, bool enable, int mode);
> +};
> +
> +enum {
> +	mucse_fw_powerup,
> +};
> +
>   struct mucse_hw {
>   	void __iomem *hw_addr;
> +	struct pci_dev *pdev;
> +	const struct mucse_hw_operations *ops;
> +	struct mucse_dma_info dma;
>   	struct mucse_mbx_info mbx;
> +	int port;
> +	u8 perm_addr[ETH_ALEN];
>   	u8 pfvfnum;
>   };

... if you can simply move mucse_hw_operations down here?

>   
> @@ -54,4 +76,7 @@ int rnpgbe_init_hw(struct mucse_hw *hw, int board_type);
>   #define PCI_DEVICE_ID_N500_DUAL_PORT 0x8318
>   #define PCI_DEVICE_ID_N210 0x8208
>   #define PCI_DEVICE_ID_N210L 0x820a
> +
> +#define rnpgbe_dma_wr32(dma, reg, val) \
> +	writel((val), (dma)->dma_base_addr + (reg))

[...]

> @@ -48,8 +127,14 @@ static void rnpgbe_init_n210(struct mucse_hw *hw)
>    **/
>   int rnpgbe_init_hw(struct mucse_hw *hw, int board_type)
>   {
> +	struct mucse_dma_info *dma = &hw->dma;
>   	struct mucse_mbx_info *mbx = &hw->mbx;
>   
> +	hw->ops = &rnpgbe_hw_ops;
> +	hw->port = 0;
> +
> +	dma->dma_base_addr = hw->hw_addr;

not quite sure why do you need additional structure just to store the
value that already exists in mucse_hw?

> +
>   	mbx->pf2fw_mbx_ctrl = MUCSE_GBE_PFFW_MBX_CTRL_OFFSET;
>   	mbx->fwpf_mbx_mask = MUCSE_GBE_FWPF_MBX_MASK_OFFSET;
>   

  parent reply	other threads:[~2025-09-09 14:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 12:09 [PATCH net-next v11 0/5] Add driver for 1Gbe network chips from MUCSE Dong Yibo
2025-09-09 12:09 ` [PATCH net-next v11 1/5] net: rnpgbe: Add build support for rnpgbe Dong Yibo
2025-09-09 12:37   ` Vadim Fedorenko
2025-09-09 12:09 ` [PATCH net-next v11 2/5] net: rnpgbe: Add n500/n210 chip support with BAR2 mapping Dong Yibo
2025-09-09 12:41   ` Vadim Fedorenko
2025-09-09 12:09 ` [PATCH net-next v11 3/5] net: rnpgbe: Add basic mbx ops support Dong Yibo
2025-09-09 14:22   ` Anwar, Md Danish
2025-09-09 20:55     ` Jakub Kicinski
2025-09-10  5:56       ` Yibo Dong
2025-09-11  1:02         ` Jakub Kicinski
2025-09-11  1:38           ` Yibo Dong
2025-09-10  5:52     ` Yibo Dong
2025-09-09 12:09 ` [PATCH net-next v11 4/5] net: rnpgbe: Add basic mbx_fw support Dong Yibo
2025-09-09 14:29   ` Anwar, Md Danish
2025-09-09 20:58     ` Jakub Kicinski
2025-09-10  6:08       ` Yibo Dong
2025-09-10  8:21         ` Jörg Sommer
2025-09-11  1:46           ` Yibo Dong
2025-09-11  1:03         ` Jakub Kicinski
2025-09-11  1:41           ` Yibo Dong
2025-09-09 12:09 ` [PATCH net-next v11 5/5] net: rnpgbe: Add register_netdev Dong Yibo
2025-09-09 14:31   ` Anwar, Md Danish
2025-09-10  6:10     ` Yibo Dong
2025-09-09 14:37   ` Vadim Fedorenko [this message]
2025-09-10  6:22     ` 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=2ec8c7f8-cf79-4701-97dc-2d0a687f0f3b@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --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=gustavoars@kernel.org \
    --cc=horms@kernel.org \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lee@trager.us \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@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=rdunlap@infradead.org \
    --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).