All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next] net: mvpp2: fix interrupt mask/unmask skip condition
@ 2021-02-11 15:13 stefanc
  2021-02-11 17:10 ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 2+ messages in thread
From: stefanc @ 2021-02-11 15:13 UTC (permalink / raw)
  To: netdev
  Cc: thomas.petazzoni, davem, nadavh, ymarkman, linux-kernel, stefanc,
	kuba, linux, mw, andrew, rmk+kernel, atenart

From: Stefan Chulski <stefanc@marvell.com>

The condition should be skipped if CPU ID equal to nthreads.
The patch doesn't fix any actual issue since
nthreads = min_t(unsigned int, num_present_cpus(), MVPP2_MAX_THREADS).
On all current Armada platforms, the number of CPU's is
less than MVPP2_MAX_THREADS.

Fixes: e531f76757eb ("net: mvpp2: handle cases where more CPUs are available than s/w threads")
Reported-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Stefan Chulski <stefanc@marvell.com>
---
 drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
index a07cf60..74613d3 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
@@ -1135,7 +1135,7 @@ static void mvpp2_interrupts_mask(void *arg)
 	struct mvpp2_port *port = arg;
 
 	/* If the thread isn't used, don't do anything */
-	if (smp_processor_id() > port->priv->nthreads)
+	if (smp_processor_id() >= port->priv->nthreads)
 		return;
 
 	mvpp2_thread_write(port->priv,
@@ -1153,7 +1153,7 @@ static void mvpp2_interrupts_unmask(void *arg)
 	u32 val;
 
 	/* If the thread isn't used, don't do anything */
-	if (smp_processor_id() > port->priv->nthreads)
+	if (smp_processor_id() >= port->priv->nthreads)
 		return;
 
 	val = MVPP2_CAUSE_MISC_SUM_MASK |
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [net-next] net: mvpp2: fix interrupt mask/unmask skip condition
  2021-02-11 15:13 [net-next] net: mvpp2: fix interrupt mask/unmask skip condition stefanc
@ 2021-02-11 17:10 ` Russell King - ARM Linux admin
  0 siblings, 0 replies; 2+ messages in thread
From: Russell King - ARM Linux admin @ 2021-02-11 17:10 UTC (permalink / raw)
  To: stefanc
  Cc: netdev, thomas.petazzoni, davem, nadavh, ymarkman, linux-kernel,
	kuba, mw, andrew, atenart

On Thu, Feb 11, 2021 at 05:13:19PM +0200, stefanc@marvell.com wrote:
> From: Stefan Chulski <stefanc@marvell.com>
> 
> The condition should be skipped if CPU ID equal to nthreads.
> The patch doesn't fix any actual issue since
> nthreads = min_t(unsigned int, num_present_cpus(), MVPP2_MAX_THREADS).
> On all current Armada platforms, the number of CPU's is
> less than MVPP2_MAX_THREADS.
> 
> Fixes: e531f76757eb ("net: mvpp2: handle cases where more CPUs are available than s/w threads")
> Reported-by: Russell King <rmk+kernel@armlinux.org.uk>
> Signed-off-by: Stefan Chulski <stefanc@marvell.com>

Reviewed-by: Russell King <rmk+kernel@armlinux.org.uk>

Thanks.

> ---
>  drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index a07cf60..74613d3 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -1135,7 +1135,7 @@ static void mvpp2_interrupts_mask(void *arg)
>  	struct mvpp2_port *port = arg;
>  
>  	/* If the thread isn't used, don't do anything */
> -	if (smp_processor_id() > port->priv->nthreads)
> +	if (smp_processor_id() >= port->priv->nthreads)
>  		return;
>  
>  	mvpp2_thread_write(port->priv,
> @@ -1153,7 +1153,7 @@ static void mvpp2_interrupts_unmask(void *arg)
>  	u32 val;
>  
>  	/* If the thread isn't used, don't do anything */
> -	if (smp_processor_id() > port->priv->nthreads)
> +	if (smp_processor_id() >= port->priv->nthreads)
>  		return;
>  
>  	val = MVPP2_CAUSE_MISC_SUM_MASK |
> -- 
> 1.9.1
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-11 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-11 15:13 [net-next] net: mvpp2: fix interrupt mask/unmask skip condition stefanc
2021-02-11 17:10 ` Russell King - ARM Linux admin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.