* [PATCH] net/tg3: Support shutdown on PCI device
@ 2013-08-08 7:26 Gavin Shan
2013-08-08 14:44 ` Nithin Sujir
0 siblings, 1 reply; 2+ messages in thread
From: Gavin Shan @ 2013-08-08 7:26 UTC (permalink / raw)
To: netdev; +Cc: nsujir, davem, Gavin Shan
Before we tries to load new kernel with "kexec", we cound't bring
the tg3 NICs down manually because dhcp daemon keeps them up. So
there're still lots of traffic (DMA operations) on the tg3 card
from the old kernel while running the new kernel. It leads to
unnecessary EEH errors on Power platform because the network traffic
(from old kernel) breaks what we have in the IOMMU, which is built
by the new kernel.
ifconfig eth0 down
kexec -l vmlinux -c "root=/dev/sda5 debug" && kexec -f -e
The patch adds the shutdown interface for the PCI device to make
things more robust. The PCI device can be put to silent state before
loading the new kernel and to avoid unnecessary EEH errors.
Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
drivers/net/ethernet/broadcom/tg3.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index ddebc7a..dc6178b 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -17663,6 +17663,17 @@ static void tg3_remove_one(struct pci_dev *pdev)
}
}
+static void tg3_shutdown_one(struct pci_dev *pdev)
+{
+ struct net_device *dev = pci_get_drvdata(pdev);
+
+ if (!dev)
+ return;
+
+ netif_device_detach(dev);
+ tg3_remove_one(pdev);
+}
+
#ifdef CONFIG_PM_SLEEP
static int tg3_suspend(struct device *device)
{
@@ -17909,6 +17920,7 @@ static struct pci_driver tg3_driver = {
.id_table = tg3_pci_tbl,
.probe = tg3_init_one,
.remove = tg3_remove_one,
+ .shutdown = tg3_shutdown_one,
.err_handler = &tg3_err_handler,
.driver.pm = &tg3_pm_ops,
};
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* RE: [PATCH] net/tg3: Support shutdown on PCI device
2013-08-08 7:26 [PATCH] net/tg3: Support shutdown on PCI device Gavin Shan
@ 2013-08-08 14:44 ` Nithin Sujir
0 siblings, 0 replies; 2+ messages in thread
From: Nithin Sujir @ 2013-08-08 14:44 UTC (permalink / raw)
To: Gavin Shan, netdev@vger.kernel.org; +Cc: davem@davemloft.net
>
> The patch adds the shutdown interface for the PCI device to make
> things more robust. The PCI device can be put to silent state before
> loading the new kernel and to avoid unnecessary EEH errors.
>
[Nithin Sujir]
Hi Gavin,
The shutdown handler implementation was recently merged into net-next.
Can you try these 2 patches from net-next?
commit 4c305fa2cbe2a85c34899763fcefb843c87b591d
Author: Nithin Sujir <nsujir@broadcom.com>
Date: Mon Jul 29 13:58:37 2013 -0700
tg3: Implement the shutdown handler
Also remove the call to tg3_power_down_prepare() in tg3_power_down()
since tg3_close() calls it.
commit 5137a2ee2007d9cbbbeebd14abe08357a079b607
Author: Nithin Sujir <nsujir@broadcom.com>
Date: Mon Jul 29 13:58:36 2013 -0700
tg3: Allow NVRAM programming when interface is down
Thanks,
Nithin.
> Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
> ---
> drivers/net/ethernet/broadcom/tg3.c | 12 ++++++++++++
> 1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c
> b/drivers/net/ethernet/broadcom/tg3.c
> index ddebc7a..dc6178b 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -17663,6 +17663,17 @@ static void tg3_remove_one(struct pci_dev *pdev)
> }
> }
>
> +static void tg3_shutdown_one(struct pci_dev *pdev)
> +{
> + struct net_device *dev = pci_get_drvdata(pdev);
> +
> + if (!dev)
> + return;
> +
> + netif_device_detach(dev);
> + tg3_remove_one(pdev);
> +}
> +
> #ifdef CONFIG_PM_SLEEP
> static int tg3_suspend(struct device *device)
> {
> @@ -17909,6 +17920,7 @@ static struct pci_driver tg3_driver = {
> .id_table = tg3_pci_tbl,
> .probe = tg3_init_one,
> .remove = tg3_remove_one,
> + .shutdown = tg3_shutdown_one,
> .err_handler = &tg3_err_handler,
> .driver.pm = &tg3_pm_ops,
> };
> --
> 1.7.5.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-08 14:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 7:26 [PATCH] net/tg3: Support shutdown on PCI device Gavin Shan
2013-08-08 14:44 ` Nithin Sujir
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox