* [PATCH v2 net 0/2] There are some bugfix for hibmcge driver
@ 2025-05-17 9:58 Jijie Shao
2025-05-17 9:58 ` [PATCH v2 net 1/2] net: hibmcge: fix incorrect statistics update issue Jijie Shao
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jijie Shao @ 2025-05-17 9:58 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, andrew+netdev, horms
Cc: shenjian15, wangpeiyang1, liuyonglong, chenhao418,
jonathan.cameron, shameerali.kolothum.thodi, salil.mehta, netdev,
linux-kernel, shaojijie
There are some bugfix for hibmcge driver
---
ChangeLog:
v1 -> v2:
- Use netif_device_detach() to block netdev callbacks after reset fails, suggested by Jakub.
v1: https://lore.kernel.org/all/20250430093127.2400813-1-shaojijie@huawei.com/
---
Jijie Shao (2):
net: hibmcge: fix incorrect statistics update issue
net: hibmcge: fix wrong ndo.open() after reset fail issue.
drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c | 16 ++++++++--------
.../net/ethernet/hisilicon/hibmcge/hbg_ethtool.c | 3 +++
2 files changed, 11 insertions(+), 8 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 net 1/2] net: hibmcge: fix incorrect statistics update issue
2025-05-17 9:58 [PATCH v2 net 0/2] There are some bugfix for hibmcge driver Jijie Shao
@ 2025-05-17 9:58 ` Jijie Shao
2025-05-21 9:12 ` Simon Horman
2025-05-17 9:58 ` [PATCH v2 net 2/2] net: hibmcge: fix wrong ndo.open() after reset fail issue Jijie Shao
2025-05-21 23:00 ` [PATCH v2 net 0/2] There are some bugfix for hibmcge driver patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: Jijie Shao @ 2025-05-17 9:58 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, andrew+netdev, horms
Cc: shenjian15, wangpeiyang1, liuyonglong, chenhao418,
jonathan.cameron, shameerali.kolothum.thodi, salil.mehta, netdev,
linux-kernel, shaojijie
When the user dumps statistics, the hibmcge driver automatically
updates all statistics. If the driver is performing the reset operation,
the error data of 0xFFFFFFFF is updated.
Therefore, if the driver is resetting, the hbg_update_stats_by_info()
needs to return directly.
Fixes: c0bf9bf31e79 ("net: hibmcge: Add support for dump statistics")
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
---
drivers/net/ethernet/hisilicon/hibmcge/hbg_ethtool.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_ethtool.c b/drivers/net/ethernet/hisilicon/hibmcge/hbg_ethtool.c
index 8f1107b85fbb..55520053270a 100644
--- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_ethtool.c
@@ -317,6 +317,9 @@ static void hbg_update_stats_by_info(struct hbg_priv *priv,
const struct hbg_ethtool_stats *stats;
u32 i;
+ if (test_bit(HBG_NIC_STATE_RESETTING, &priv->state))
+ return;
+
for (i = 0; i < info_len; i++) {
stats = &info[i];
if (!stats->reg)
--
2.33.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 net 2/2] net: hibmcge: fix wrong ndo.open() after reset fail issue.
2025-05-17 9:58 [PATCH v2 net 0/2] There are some bugfix for hibmcge driver Jijie Shao
2025-05-17 9:58 ` [PATCH v2 net 1/2] net: hibmcge: fix incorrect statistics update issue Jijie Shao
@ 2025-05-17 9:58 ` Jijie Shao
2025-05-21 9:12 ` Simon Horman
2025-05-21 23:00 ` [PATCH v2 net 0/2] There are some bugfix for hibmcge driver patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: Jijie Shao @ 2025-05-17 9:58 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, andrew+netdev, horms
Cc: shenjian15, wangpeiyang1, liuyonglong, chenhao418,
jonathan.cameron, shameerali.kolothum.thodi, salil.mehta, netdev,
linux-kernel, shaojijie
If the driver reset fails, it may not work properly.
Therefore, the ndo.open() operation should be rejected.
In this patch, the driver calls netif_device_detach()
before the reset and calls netif_device_attach()
after the reset succeeds. If the reset fails,
netif_device_attach() is not called. Therefore,
netdev does not present and cannot be opened.
If reset fails, only the PCI reset (via sysfs)
can be used to attempt recovery.
Fixes: 3f5a61f6d504 ("net: hibmcge: Add reset supported in this module")
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
---
ChangeLog:
v1 -> v2:
- Use netif_device_detach() to block netdev callbacks after reset fails, suggested by Jakub.
v1: https://lore.kernel.org/all/20250430093127.2400813-1-shaojijie@huawei.com/
---
drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c b/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
index a0bcfb5a713d..ff3295b60a69 100644
--- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
+++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
@@ -61,6 +61,8 @@ static int hbg_reset_prepare(struct hbg_priv *priv, enum hbg_reset_type type)
return -EBUSY;
}
+ netif_device_detach(priv->netdev);
+
priv->reset_type = type;
set_bit(HBG_NIC_STATE_RESETTING, &priv->state);
clear_bit(HBG_NIC_STATE_RESET_FAIL, &priv->state);
@@ -91,6 +93,8 @@ static int hbg_reset_done(struct hbg_priv *priv, enum hbg_reset_type type)
return ret;
}
+ netif_device_attach(priv->netdev);
+
dev_info(&priv->pdev->dev, "reset done\n");
return ret;
}
@@ -117,16 +121,13 @@ void hbg_err_reset(struct hbg_priv *priv)
if (running)
dev_close(priv->netdev);
- hbg_reset(priv);
-
- /* in hbg_pci_err_detected(), we will detach first,
- * so we need to attach before open
- */
- if (!netif_device_present(priv->netdev))
- netif_device_attach(priv->netdev);
+ if (hbg_reset(priv))
+ goto err_unlock;
if (running)
dev_open(priv->netdev, NULL);
+
+err_unlock:
rtnl_unlock();
}
@@ -160,7 +161,6 @@ static pci_ers_result_t hbg_pci_err_slot_reset(struct pci_dev *pdev)
pci_save_state(pdev);
hbg_err_reset(priv);
- netif_device_attach(netdev);
return PCI_ERS_RESULT_RECOVERED;
}
--
2.33.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 net 1/2] net: hibmcge: fix incorrect statistics update issue
2025-05-17 9:58 ` [PATCH v2 net 1/2] net: hibmcge: fix incorrect statistics update issue Jijie Shao
@ 2025-05-21 9:12 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-05-21 9:12 UTC (permalink / raw)
To: Jijie Shao
Cc: davem, edumazet, kuba, pabeni, andrew+netdev, shenjian15,
wangpeiyang1, liuyonglong, chenhao418, jonathan.cameron,
shameerali.kolothum.thodi, salil.mehta, netdev, linux-kernel
On Sat, May 17, 2025 at 05:58:27PM +0800, Jijie Shao wrote:
> When the user dumps statistics, the hibmcge driver automatically
> updates all statistics. If the driver is performing the reset operation,
> the error data of 0xFFFFFFFF is updated.
>
> Therefore, if the driver is resetting, the hbg_update_stats_by_info()
> needs to return directly.
>
> Fixes: c0bf9bf31e79 ("net: hibmcge: Add support for dump statistics")
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 net 2/2] net: hibmcge: fix wrong ndo.open() after reset fail issue.
2025-05-17 9:58 ` [PATCH v2 net 2/2] net: hibmcge: fix wrong ndo.open() after reset fail issue Jijie Shao
@ 2025-05-21 9:12 ` Simon Horman
0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-05-21 9:12 UTC (permalink / raw)
To: Jijie Shao
Cc: davem, edumazet, kuba, pabeni, andrew+netdev, shenjian15,
wangpeiyang1, liuyonglong, chenhao418, jonathan.cameron,
shameerali.kolothum.thodi, salil.mehta, netdev, linux-kernel
On Sat, May 17, 2025 at 05:58:28PM +0800, Jijie Shao wrote:
> If the driver reset fails, it may not work properly.
> Therefore, the ndo.open() operation should be rejected.
>
> In this patch, the driver calls netif_device_detach()
> before the reset and calls netif_device_attach()
> after the reset succeeds. If the reset fails,
> netif_device_attach() is not called. Therefore,
> netdev does not present and cannot be opened.
>
> If reset fails, only the PCI reset (via sysfs)
> can be used to attempt recovery.
>
> Fixes: 3f5a61f6d504 ("net: hibmcge: Add reset supported in this module")
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> ---
> ChangeLog:
> v1 -> v2:
> - Use netif_device_detach() to block netdev callbacks after reset fails, suggested by Jakub.
> v1: https://lore.kernel.org/all/20250430093127.2400813-1-shaojijie@huawei.com/
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 net 0/2] There are some bugfix for hibmcge driver
2025-05-17 9:58 [PATCH v2 net 0/2] There are some bugfix for hibmcge driver Jijie Shao
2025-05-17 9:58 ` [PATCH v2 net 1/2] net: hibmcge: fix incorrect statistics update issue Jijie Shao
2025-05-17 9:58 ` [PATCH v2 net 2/2] net: hibmcge: fix wrong ndo.open() after reset fail issue Jijie Shao
@ 2025-05-21 23:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-21 23:00 UTC (permalink / raw)
To: Jijie Shao
Cc: davem, edumazet, kuba, pabeni, andrew+netdev, horms, shenjian15,
wangpeiyang1, liuyonglong, chenhao418, jonathan.cameron,
shameerali.kolothum.thodi, salil.mehta, netdev, linux-kernel
Hello:
This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sat, 17 May 2025 17:58:26 +0800 you wrote:
> There are some bugfix for hibmcge driver
>
> ---
> ChangeLog:
> v1 -> v2:
> - Use netif_device_detach() to block netdev callbacks after reset fails, suggested by Jakub.
> v1: https://lore.kernel.org/all/20250430093127.2400813-1-shaojijie@huawei.com/
>
> [...]
Here is the summary with links:
- [v2,net,1/2] net: hibmcge: fix incorrect statistics update issue
https://git.kernel.org/netdev/net/c/009970506c92
- [v2,net,2/2] net: hibmcge: fix wrong ndo.open() after reset fail issue.
https://git.kernel.org/netdev/net/c/1b45443b8487
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-05-21 22:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-17 9:58 [PATCH v2 net 0/2] There are some bugfix for hibmcge driver Jijie Shao
2025-05-17 9:58 ` [PATCH v2 net 1/2] net: hibmcge: fix incorrect statistics update issue Jijie Shao
2025-05-21 9:12 ` Simon Horman
2025-05-17 9:58 ` [PATCH v2 net 2/2] net: hibmcge: fix wrong ndo.open() after reset fail issue Jijie Shao
2025-05-21 9:12 ` Simon Horman
2025-05-21 23:00 ` [PATCH v2 net 0/2] There are some bugfix for hibmcge driver patchwork-bot+netdevbpf
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).