[PATCH net v2 6/7] net: hibmcge: fix not restore rx pause mac addr after reset issue

Jijie Shao posted 7 patches 1 week ago
There is a newer version of this series
[PATCH net v2 6/7] net: hibmcge: fix not restore rx pause mac addr after reset issue
Posted by Jijie Shao 1 week ago
In normal cases, the driver must ensure that the value
of rx pause mac addr is the same as the MAC address of
the network port. This ensures that the driver can
receive pause frames whose destination address is
the MAC address of the network port.

Currently, the rx pause addr does not restored after reset.

The index of the MAC address of the host is always 0.
Therefore, this patch sets rx pause addr to
the MAC address with index 0.

Fixes: 3f5a61f6d504 ("net: hibmcge: Add reset supported in this module")
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
---
 drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c b/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
index 4e8cb66f601c..a0bcfb5a713d 100644
--- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
+++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
@@ -26,12 +26,15 @@ static void hbg_restore_mac_table(struct hbg_priv *priv)
 
 static void hbg_restore_user_def_settings(struct hbg_priv *priv)
 {
+	/* The index of host mac is always 0. */
+	u64 rx_pause_addr = ether_addr_to_u64(priv->filter.mac_table[0].addr);
 	struct ethtool_pauseparam *pause_param = &priv->user_def.pause_param;
 
 	hbg_restore_mac_table(priv);
 	hbg_hw_set_mtu(priv, priv->netdev->mtu);
 	hbg_hw_set_pause_enable(priv, pause_param->tx_pause,
 				pause_param->rx_pause);
+	hbg_hw_set_rx_pause_mac_addr(priv, rx_pause_addr);
 }
 
 int hbg_rebuild(struct hbg_priv *priv)
-- 
2.33.0
Re: [PATCH net v2 6/7] net: hibmcge: fix not restore rx pause mac addr after reset issue
Posted by Jakub Kicinski 6 days, 5 hours ago
On Thu, 3 Apr 2025 21:53:10 +0800 Jijie Shao wrote:
> In normal cases, the driver must ensure that the value
> of rx pause mac addr is the same as the MAC address of
> the network port. This ensures that the driver can
> receive pause frames whose destination address is
> the MAC address of the network port.

I thought "in normal cases" pause frames use 01:80:C2:00:00:01
as the destination address!?

Are you sure this patch is not a misunderstanding, and the issue
is already fixed by patch 2?

> Currently, the rx pause addr does not restored after reset.
> 
> The index of the MAC address of the host is always 0.
> Therefore, this patch sets rx pause addr to
> the MAC address with index 0.
-- 
pw-bot: cr
Re: [PATCH net v2 6/7] net: hibmcge: fix not restore rx pause mac addr after reset issue
Posted by Jijie Shao 3 days, 19 hours ago
on 2025/4/4 22:58, Jakub Kicinski wrote:
> On Thu, 3 Apr 2025 21:53:10 +0800 Jijie Shao wrote:
>> In normal cases, the driver must ensure that the value
>> of rx pause mac addr is the same as the MAC address of
>> the network port. This ensures that the driver can
>> receive pause frames whose destination address is
>> the MAC address of the network port.
> I thought "in normal cases" pause frames use 01:80:C2:00:00:01
> as the destination address!?

No, the address set in .ndo_set_mac_address() is used.
01:80:C2:00:00:01 is supported by default. No additional configuration is required.

>
> Are you sure this patch is not a misunderstanding, and the issue
> is already fixed by patch 2?

It's a different issue. This patch is used to solve the problem that
the configuration is lost after reset.

>
>> Currently, the rx pause addr does not restored after reset.

Here.

>>
>> The index of the MAC address of the host is always 0.
>> Therefore, this patch sets rx pause addr to
>> the MAC address with index 0.
Re: [PATCH net v2 6/7] net: hibmcge: fix not restore rx pause mac addr after reset issue
Posted by Jakub Kicinski 3 days, 3 hours ago
On Mon, 7 Apr 2025 09:06:42 +0800 Jijie Shao wrote:
> on 2025/4/4 22:58, Jakub Kicinski wrote:
> > On Thu, 3 Apr 2025 21:53:10 +0800 Jijie Shao wrote:  
> >> In normal cases, the driver must ensure that the value
> >> of rx pause mac addr is the same as the MAC address of
> >> the network port. This ensures that the driver can
> >> receive pause frames whose destination address is
> >> the MAC address of the network port.  
> > I thought "in normal cases" pause frames use 01:80:C2:00:00:01
> > as the destination address!?  
> 
> No, the address set in .ndo_set_mac_address() is used.
> 01:80:C2:00:00:01 is supported by default. No additional configuration is required.

Are you talking about source or destination?
How does the sender learn the receiver's address? Via LLDP?
You need to explain all this much better in the commit message.
It is not "normal" for a switched Ethernet network.
Re: [PATCH net v2 6/7] net: hibmcge: fix not restore rx pause mac addr after reset issue
Posted by Jijie Shao 19 hours ago
on 2025/4/8 1:11, Jakub Kicinski wrote:
> On Mon, 7 Apr 2025 09:06:42 +0800 Jijie Shao wrote:
>> on 2025/4/4 22:58, Jakub Kicinski wrote:
>>> On Thu, 3 Apr 2025 21:53:10 +0800 Jijie Shao wrote:
>>>> In normal cases, the driver must ensure that the value
>>>> of rx pause mac addr is the same as the MAC address of
>>>> the network port. This ensures that the driver can
>>>> receive pause frames whose destination address is
>>>> the MAC address of the network port.
>>> I thought "in normal cases" pause frames use 01:80:C2:00:00:01
>>> as the destination address!?
>> No, the address set in .ndo_set_mac_address() is used.
>> 01:80:C2:00:00:01 is supported by default. No additional configuration is required.
> Are you talking about source or destination?
> How does the sender learn the receiver's address? Via LLDP?
> You need to explain all this much better in the commit message.
> It is not "normal" for a switched Ethernet network.


ok,

Thanks
Jijie Shao