diff mbox series

[net-next,v2,5/8] dpaa2-switch: do not clear any interrupts automatically

Message ID 20231213121411.3091597-6-ioana.ciornei@nxp.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series dpaa2-switch: small improvements | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1115 this patch: 1115
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 1142 this patch: 1142
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
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: 1142 this patch: 1142
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 21 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ioana Ciornei Dec. 13, 2023, 12:14 p.m. UTC
The DPSW object has multiple event sources multiplexed over the same
IRQ. The driver has the capability to configure only some of these
events to trigger the IRQ.

The dpsw_get_irq_status() can clear events automatically based on the
value stored in the 'status' variable passed to it. We don't want that
to happen because we could get into a situation when we are clearing
more events than we actually handled.
Just resort to manually clearing the events that we handled.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
Changes in v2:
- add a bit more info in the commit message

 drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Horman Dec. 15, 2023, 11:31 a.m. UTC | #1
On Wed, Dec 13, 2023 at 02:14:08PM +0200, Ioana Ciornei wrote:
> The DPSW object has multiple event sources multiplexed over the same
> IRQ. The driver has the capability to configure only some of these
> events to trigger the IRQ.
> 
> The dpsw_get_irq_status() can clear events automatically based on the
> value stored in the 'status' variable passed to it. We don't want that
> to happen because we could get into a situation when we are clearing
> more events than we actually handled.
> Just resort to manually clearing the events that we handled.

Hi Ioana,

Continuing the theme of Jakub's review of v1,
I think it would be useful to state that
there is no user-visible effect of this change.
And, ideally, explain why that is so.

> Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
> ---
> Changes in v2:
> - add a bit more info in the commit message
> 
>  drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
> index e91ade7c7c93..d9906573f71f 100644
> --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
> +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
> @@ -1509,7 +1509,7 @@ static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
>  	struct device *dev = (struct device *)arg;
>  	struct ethsw_core *ethsw = dev_get_drvdata(dev);
>  	struct ethsw_port_priv *port_priv;
> -	u32 status = ~0;
> +	u32 status = 0;
>  	int err, if_id;
>  	bool had_mac;

As status is no longer used in the 'out' unwind path,
I don't think the initialisation above is needed any more.

	...
	int err, if_id;
	bool had_mac;
	u32 status;

>  
> @@ -1539,12 +1539,12 @@ static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
>  			dpaa2_switch_port_connect_mac(port_priv);
>  	}
>  
> -out:
>  	err = dpsw_clear_irq_status(ethsw->mc_io, 0, ethsw->dpsw_handle,
>  				    DPSW_IRQ_INDEX_IF, status);
>  	if (err)
>  		dev_err(dev, "Can't clear irq status (err %d)\n", err);
>  
> +out:
>  	return IRQ_HANDLED;
>  }
>  
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
index e91ade7c7c93..d9906573f71f 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
@@ -1509,7 +1509,7 @@  static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
 	struct device *dev = (struct device *)arg;
 	struct ethsw_core *ethsw = dev_get_drvdata(dev);
 	struct ethsw_port_priv *port_priv;
-	u32 status = ~0;
+	u32 status = 0;
 	int err, if_id;
 	bool had_mac;
 
@@ -1539,12 +1539,12 @@  static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg)
 			dpaa2_switch_port_connect_mac(port_priv);
 	}
 
-out:
 	err = dpsw_clear_irq_status(ethsw->mc_io, 0, ethsw->dpsw_handle,
 				    DPSW_IRQ_INDEX_IF, status);
 	if (err)
 		dev_err(dev, "Can't clear irq status (err %d)\n", err);
 
+out:
 	return IRQ_HANDLED;
 }