[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <354593d1-2504-407e-98fb-235fcaf61d87@linux.dev>
Date: Wed, 13 Aug 2025 13:50:34 +0100
From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
To: Yibo Dong <dong100@...se.com>
Cc: andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, horms@...nel.org, corbet@....net,
gur.stavi@...wei.com, maddy@...ux.ibm.com, mpe@...erman.id.au,
danishanwar@...com, lee@...ger.us, gongfan1@...wei.com, lorenzo@...nel.org,
geert+renesas@...der.be, Parthiban.Veerasooran@...rochip.com,
lukas.bulwahn@...hat.com, alexanderduyck@...com, richardcochran@...il.com,
netdev@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 5/5] net: rnpgbe: Add register_netdev
On 13/08/2025 10:04, Yibo Dong wrote:
> On Tue, Aug 12, 2025 at 04:32:00PM +0100, Vadim Fedorenko wrote:
>> On 12/08/2025 10:39, Dong Yibo wrote:
>>> Initialize get mac from hw, register the netdev.
>>>
>>> Signed-off-by: Dong Yibo <dong100@...se.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?
Powered by blists - more mailing lists