From: Jacob Keller <jacob.e.keller@intel.com>
To: Jijie Shao <shaojijie@huawei.com>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<andrew+netdev@lunn.ch>, <horms@kernel.org>
Cc: <shenjian15@huawei.com>, <liuyonglong@huawei.com>,
<chenhao418@huawei.com>, <lantao5@huawei.com>,
<huangdonghua3@h-partners.com>, <yangshuaisong@h-partners.com>,
<jonathan.cameron@huawei.com>, <salil.mehta@huawei.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net 3/3] net: hibmcge: fix the inappropriate netif_device_detach()
Date: Thu, 23 Oct 2025 18:05:14 -0700 [thread overview]
Message-ID: <02692f16-b238-49d7-a618-150a03cb1674@intel.com> (raw)
In-Reply-To: <20251021140016.3020739-4-shaojijie@huawei.com>
[-- Attachment #1.1: Type: text/plain, Size: 2763 bytes --]
On 10/21/2025 7:00 AM, Jijie Shao wrote:
> current, driver will call netif_device_detach() in
> pci_error_handlers.error_detected() and do reset in
> pci_error_handlers.slot_reset().
> However, if pci_error_handlers.slot_reset() is not called
> after pci_error_handlers.error_detected(),
> driver will be detached and unable to recover.
>
> drivers/pci/pcie/err.c/report_error_detected() says:
> If any device in the subtree does not have an error_detected
> callback, PCI_ERS_RESULT_NO_AER_DRIVER prevents subsequent
> error callbacks of any device in the subtree, and will
> exit in the disconnected error state.
>
> Therefore, when the hibmcge device and other devices that do not
> support the error_detected callback are under the same subtree,
> hibmcge will be unable to do slot_reset.
>
Hmm.
In the example case, the slot_reset never happens, but the PCI device is
still in an error state, which means that the device is not functional..
In that case detaching the netdev and remaining detached seems like an
expected outcome?
I guess I don't fully understand the setup in this scenario.
> This path move netif_device_detach from error_detected to slot_reset,
> ensuring that detach and reset are always executed together.
>
> Fixes: fd394a334b1c ("net: hibmcge: Add support for abnormal irq handling feature")
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> ---
> drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c b/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
> index 83cf75bf7a17..e11495b7ee98 100644
> --- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
> +++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_err.c
> @@ -136,12 +136,11 @@ static pci_ers_result_t hbg_pci_err_detected(struct pci_dev *pdev,
> {
> struct net_device *netdev = pci_get_drvdata(pdev);
>
> - netif_device_detach(netdev);
> -
> - if (state == pci_channel_io_perm_failure)
> + if (state == pci_channel_io_perm_failure) {
> + netif_device_detach(netdev);
> return PCI_ERS_RESULT_DISCONNECT;
> + }
>
> - pci_disable_device(pdev);
> return PCI_ERS_RESULT_NEED_RESET;
> }
>
> @@ -150,6 +149,9 @@ static pci_ers_result_t hbg_pci_err_slot_reset(struct pci_dev *pdev)
> struct net_device *netdev = pci_get_drvdata(pdev);
> struct hbg_priv *priv = netdev_priv(netdev);
>
> + netif_device_detach(netdev);
> + pci_disable_device(pdev);
> +
> if (pci_enable_device(pdev)) {
> dev_err(&pdev->dev,
> "failed to re-enable PCI device after reset\n");
Here, we disable the device only to immediately attempt to re-enable it?
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
next prev parent reply other threads:[~2025-10-24 1:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 14:00 [PATCH net 0/3] There are some bugfix for hibmcge ethernet driver Jijie Shao
2025-10-21 14:00 ` [PATCH net 1/3] net: hibmcge: fix rx buf avl irq is not re-enabled in irq_handle issue Jijie Shao
2025-10-24 1:15 ` Jacob Keller
2025-10-24 6:39 ` Jijie Shao
2025-10-24 20:23 ` Jacob Keller
2025-10-21 14:00 ` [PATCH net 2/3] net: hibmcge: remove unnecessary check for np_link_fail in scenarios without phy Jijie Shao
2025-10-24 1:10 ` Jacob Keller
2025-10-24 6:44 ` Jijie Shao
2025-10-21 14:00 ` [PATCH net 3/3] net: hibmcge: fix the inappropriate netif_device_detach() Jijie Shao
2025-10-24 1:05 ` Jacob Keller [this message]
2025-10-24 7:21 ` Jijie Shao
2025-10-24 20:24 ` Jacob Keller
2025-10-24 1:08 ` [PATCH net 0/3] There are some bugfix for hibmcge ethernet driver Jacob Keller
2025-10-24 7:24 ` Jijie Shao
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=02692f16-b238-49d7-a618-150a03cb1674@intel.com \
--to=jacob.e.keller@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=chenhao418@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=huangdonghua3@h-partners.com \
--cc=jonathan.cameron@huawei.com \
--cc=kuba@kernel.org \
--cc=lantao5@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=salil.mehta@huawei.com \
--cc=shaojijie@huawei.com \
--cc=shenjian15@huawei.com \
--cc=yangshuaisong@h-partners.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
all inboxes | Powered by JetHome®