Re: [PATCH v3 5/5] net: rnpgbe: Add register_netdev
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Date: 2025-08-13 12:50:59
Also in:
linux-doc, lkml
On 13/08/2025 10:04, Yibo Dong wrote:
On Tue, Aug 12, 2025 at 04:32:00PM +0100, Vadim Fedorenko wrote:quoted
On 12/08/2025 10:39, Dong Yibo wrote:quoted
Initialize get mac from hw, register the netdev. Signed-off-by: Dong Yibo <dong100@mucse.com> --- drivers/net/ethernet/mucse/rnpgbe/rnpgbe.h | 22 ++++++ .../net/ethernet/mucse/rnpgbe/rnpgbe_chip.c | 73 ++++++++++++++++++ drivers/net/ethernet/mucse/rnpgbe/rnpgbe_hw.h | 1 + .../net/ethernet/mucse/rnpgbe/rnpgbe_main.c | 76 +++++++++++++++++++ 4 files changed, 172 insertions(+)diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe.h b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe.h index 6cb14b79cbfe..644b8c85c29d 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> extern const struct rnpgbe_info rnpgbe_n500_info; extern const struct rnpgbe_info rnpgbe_n210_info;@@ -86,6 +87,18 @@ struct mucse_mbx_info { u32 fw2pf_mbox_vec; }; +struct mucse_hw_operations { + int (*init_hw)(struct mucse_hw *hw); + int (*reset_hw)(struct mucse_hw *hw); + void (*start_hw)(struct mucse_hw *hw); + void (*init_rx_addrs)(struct mucse_hw *hw); + void (*driver_status)(struct mucse_hw *hw, bool enable, int mode); +}; + +enum { + mucse_driver_insmod, +}; + struct mucse_hw { void *back; u8 pfvfnum;@@ -96,12 +109,18 @@ struct mucse_hw { u32 axi_mhz; u32 bd_uid; enum rnpgbe_hw_type hw_type; + const struct mucse_hw_operations *ops; struct mucse_dma_info dma; struct mucse_eth_info eth; struct mucse_mac_info mac; struct mucse_mbx_info mbx; + u32 flags; +#define M_FLAGS_INIT_MAC_ADDRESS BIT(0) u32 driver_version; u16 usecstocount; + int lane; + u8 addr[ETH_ALEN]; + u8 perm_addr[ETH_ALEN];why do you need both addresses if you have this info already in netdev?'perm_addr' is address from firmware (fixed, can't be changed by user). 'addr' is the current netdev address (It is Initialized the same with 'perm_addr', but can be changed by user) Maybe I should add 'addr' in the patch which support ndo_set_mac_address?
But why do you need 'addr' at all? Current netdev address can be retrieved from netdev, why do you need to store it within driver's structure?