diff mbox series

[net-next] sfc: introduce shutdown entry point in efx pci driver

Message ID 20220906105620.26179-1-pieter.jansen-van-vuuren@amd.com (mailing list archive)
State Accepted
Commit 41e3b0722f6c7c756702f50d194b0d6caa0fba26
Delegated to: Netdev Maintainers
Headers show
Series [net-next] sfc: introduce shutdown entry point in efx pci driver | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 48 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Pieter Jansen van Vuuren Sept. 6, 2022, 10:56 a.m. UTC
From: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>

Make the device inactive when the system shutdown callback has been
invoked. This is achieved by freezing the driver and disabling the
PCI bus mastering.

Co-developed-by: Martin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: Martin Habets <habetsm.xilinx@gmail.com>
Signed-off-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
---
 drivers/net/ethernet/sfc/efx.c       | 12 ++++++++++++
 drivers/net/ethernet/sfc/siena/efx.c | 12 ++++++++++++
 2 files changed, 24 insertions(+)

Comments

Edward Cree Sept. 6, 2022, 4:27 p.m. UTC | #1
On 06/09/2022 11:56, pieter.jansen-van-vuuren@amd.com wrote:
> From: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
> 
> Make the device inactive when the system shutdown callback has been
> invoked. This is achieved by freezing the driver and disabling the
> PCI bus mastering.
> 
> Co-developed-by: Martin Habets <habetsm.xilinx@gmail.com>
> Signed-off-by: Martin Habets <habetsm.xilinx@gmail.com>
> Signed-off-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>

Acked-by: Edward Cree <ecree.xilinx@gmail.com>

> ---
>  drivers/net/ethernet/sfc/efx.c       | 12 ++++++++++++
>  drivers/net/ethernet/sfc/siena/efx.c | 12 ++++++++++++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
> index 153d68e29b8b..b85c95e1ae7c 100644
> --- a/drivers/net/ethernet/sfc/efx.c
> +++ b/drivers/net/ethernet/sfc/efx.c
> @@ -1175,6 +1175,17 @@ static int efx_pm_freeze(struct device *dev)
>  	return 0;
>  }
>  
> +static void efx_pci_shutdown(struct pci_dev *pci_dev)
> +{
> +	struct efx_nic *efx = pci_get_drvdata(pci_dev);
> +
> +	if (!efx)
> +		return;
> +
> +	efx_pm_freeze(&pci_dev->dev);
> +	pci_disable_device(pci_dev);
> +}
> +
>  static int efx_pm_thaw(struct device *dev)
>  {
>  	int rc;
> @@ -1279,6 +1290,7 @@ static struct pci_driver efx_pci_driver = {
>  	.probe		= efx_pci_probe,
>  	.remove		= efx_pci_remove,
>  	.driver.pm	= &efx_pm_ops,
> +	.shutdown	= efx_pci_shutdown,
>  	.err_handler	= &efx_err_handlers,
>  #ifdef CONFIG_SFC_SRIOV
>  	.sriov_configure = efx_pci_sriov_configure,
> diff --git a/drivers/net/ethernet/sfc/siena/efx.c b/drivers/net/ethernet/sfc/siena/efx.c
> index 63d999e63960..cf09521b0c64 100644
> --- a/drivers/net/ethernet/sfc/siena/efx.c
> +++ b/drivers/net/ethernet/sfc/siena/efx.c
> @@ -1148,6 +1148,17 @@ static int efx_pm_freeze(struct device *dev)
>  	return 0;
>  }
>  
> +static void efx_pci_shutdown(struct pci_dev *pci_dev)
> +{
> +	struct efx_nic *efx = pci_get_drvdata(pci_dev);
> +
> +	if (!efx)
> +		return;
> +
> +	efx_pm_freeze(&pci_dev->dev);
> +	pci_disable_device(pci_dev);
> +}
> +
>  static int efx_pm_thaw(struct device *dev)
>  {
>  	int rc;
> @@ -1252,6 +1263,7 @@ static struct pci_driver efx_pci_driver = {
>  	.probe		= efx_pci_probe,
>  	.remove		= efx_pci_remove,
>  	.driver.pm	= &efx_pm_ops,
> +	.shutdown	= efx_pci_shutdown,
>  	.err_handler	= &efx_siena_err_handlers,
>  #ifdef CONFIG_SFC_SIENA_SRIOV
>  	.sriov_configure = efx_pci_sriov_configure,
>
patchwork-bot+netdevbpf@kernel.org Sept. 13, 2022, 8 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Tue, 6 Sep 2022 11:56:20 +0100 you wrote:
> From: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
> 
> Make the device inactive when the system shutdown callback has been
> invoked. This is achieved by freezing the driver and disabling the
> PCI bus mastering.
> 
> Co-developed-by: Martin Habets <habetsm.xilinx@gmail.com>
> Signed-off-by: Martin Habets <habetsm.xilinx@gmail.com>
> Signed-off-by: Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>
> 
> [...]

Here is the summary with links:
  - [net-next] sfc: introduce shutdown entry point in efx pci driver
    https://git.kernel.org/netdev/net-next/c/41e3b0722f6c

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 153d68e29b8b..b85c95e1ae7c 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -1175,6 +1175,17 @@  static int efx_pm_freeze(struct device *dev)
 	return 0;
 }
 
+static void efx_pci_shutdown(struct pci_dev *pci_dev)
+{
+	struct efx_nic *efx = pci_get_drvdata(pci_dev);
+
+	if (!efx)
+		return;
+
+	efx_pm_freeze(&pci_dev->dev);
+	pci_disable_device(pci_dev);
+}
+
 static int efx_pm_thaw(struct device *dev)
 {
 	int rc;
@@ -1279,6 +1290,7 @@  static struct pci_driver efx_pci_driver = {
 	.probe		= efx_pci_probe,
 	.remove		= efx_pci_remove,
 	.driver.pm	= &efx_pm_ops,
+	.shutdown	= efx_pci_shutdown,
 	.err_handler	= &efx_err_handlers,
 #ifdef CONFIG_SFC_SRIOV
 	.sriov_configure = efx_pci_sriov_configure,
diff --git a/drivers/net/ethernet/sfc/siena/efx.c b/drivers/net/ethernet/sfc/siena/efx.c
index 63d999e63960..cf09521b0c64 100644
--- a/drivers/net/ethernet/sfc/siena/efx.c
+++ b/drivers/net/ethernet/sfc/siena/efx.c
@@ -1148,6 +1148,17 @@  static int efx_pm_freeze(struct device *dev)
 	return 0;
 }
 
+static void efx_pci_shutdown(struct pci_dev *pci_dev)
+{
+	struct efx_nic *efx = pci_get_drvdata(pci_dev);
+
+	if (!efx)
+		return;
+
+	efx_pm_freeze(&pci_dev->dev);
+	pci_disable_device(pci_dev);
+}
+
 static int efx_pm_thaw(struct device *dev)
 {
 	int rc;
@@ -1252,6 +1263,7 @@  static struct pci_driver efx_pci_driver = {
 	.probe		= efx_pci_probe,
 	.remove		= efx_pci_remove,
 	.driver.pm	= &efx_pm_ops,
+	.shutdown	= efx_pci_shutdown,
 	.err_handler	= &efx_siena_err_handlers,
 #ifdef CONFIG_SFC_SIENA_SRIOV
 	.sriov_configure = efx_pci_sriov_configure,