diff mbox series

[net] net: wangxun: Fix vector length of interrupt cause

Message ID 20230322103632.132011-1-jiawenwu@trustnetic.com (mailing list archive)
State Accepted
Commit 59513714f6659409adf717b0f85e0a6e35480a01
Delegated to: Netdev Maintainers
Headers show
Series [net] net: wangxun: Fix vector length of interrupt cause | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers fail 1 blamed authors not CCed: davem@davemloft.net; 4 maintainers not CCed: kuba@kernel.org edumazet@google.com pabeni@redhat.com davem@davemloft.net
netdev/build_clang success Errors and warnings before: 18 this patch: 18
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 Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 25 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jiawen Wu March 22, 2023, 10:36 a.m. UTC
There is 64-bit interrupt cause register for txgbe. Fix to clear upper
32 bits.

Fixes: 3f703186113f ("net: libwx: Add irq flow functions")
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/ethernet/wangxun/libwx/wx_type.h    | 2 +-
 drivers/net/ethernet/wangxun/ngbe/ngbe_main.c   | 2 +-
 drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

Comments

Leon Romanovsky March 23, 2023, 10:26 a.m. UTC | #1
On Wed, Mar 22, 2023 at 06:36:32PM +0800, Jiawen Wu wrote:
> There is 64-bit interrupt cause register for txgbe. Fix to clear upper
> 32 bits.
> 
> Fixes: 3f703186113f ("net: libwx: Add irq flow functions")

It is worth to add two Fixes lines, as in this commit you added WX_PX_IC,
but actual bug started to be when you used it in commit:
5d3ac705c281 ("net: txgbe: Add interrupt support")

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Steen Hegelund March 23, 2023, 10:49 a.m. UTC | #2
Hi Jiawen,


On Wed Mar 22, 2023 at 11:36 AM CET, Jiawen Wu wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> There is 64-bit interrupt cause register for txgbe. Fix to clear upper
> 32 bits.
>
> Fixes: 3f703186113f ("net: libwx: Add irq flow functions")
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> ---
>  drivers/net/ethernet/wangxun/libwx/wx_type.h    | 2 +-
>  drivers/net/ethernet/wangxun/ngbe/ngbe_main.c   | 2 +-
>  drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 3 ++-
>  3 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_type.h b/drivers/net/ethernet/wangxun/libwx/wx_type.h
> index 77d8d7f1707e..97e2c1e13b80 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_type.h
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_type.h
> @@ -222,7 +222,7 @@
>  #define WX_PX_INTA                   0x110
>  #define WX_PX_GPIE                   0x118
>  #define WX_PX_GPIE_MODEL             BIT(0)
> -#define WX_PX_IC                     0x120
> +#define WX_PX_IC(_i)                 (0x120 + (_i) * 4)
>  #define WX_PX_IMS(_i)                (0x140 + (_i) * 4)
>  #define WX_PX_IMC(_i)                (0x150 + (_i) * 4)
>  #define WX_PX_ISB_ADDR_L             0x160
> diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> index 5b564d348c09..17412e5282de 100644
> --- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> +++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> @@ -352,7 +352,7 @@ static void ngbe_up(struct wx *wx)
>         netif_tx_start_all_queues(wx->netdev);
>
>         /* clear any pending interrupts, may auto mask */
> -       rd32(wx, WX_PX_IC);
> +       rd32(wx, WX_PX_IC(0));

Here you only clear irq 0 but not 1...

>         rd32(wx, WX_PX_MISC_IC);
>         ngbe_irq_enable(wx, true);
>         if (wx->gpio_ctrl)
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> index 6c0a98230557..a58ce5463686 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> @@ -229,7 +229,8 @@ static void txgbe_up_complete(struct wx *wx)
>         wx_napi_enable_all(wx);
>
>         /* clear any pending interrupts, may auto mask */
> -       rd32(wx, WX_PX_IC);
> +       rd32(wx, WX_PX_IC(0));
> +       rd32(wx, WX_PX_IC(1));

Here you clear irq 0 and 1

>         rd32(wx, WX_PX_MISC_IC);
>         txgbe_irq_enable(wx, true);
>
> --
> 2.27.0

Why is there a difference between the two situations?

BR
Steen
Jiawen Wu March 24, 2023, 2:01 a.m. UTC | #3
On Thursday, March 23, 2023 6:50 PM, Steen.Hegelund@microchip.com wrote:
> 
> Hi Jiawen,
> 
> 
> On Wed Mar 22, 2023 at 11:36 AM CET, Jiawen Wu wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know
> > the content is safe
> >
> > There is 64-bit interrupt cause register for txgbe. Fix to clear upper
> > 32 bits.
> >
> > Fixes: 3f703186113f ("net: libwx: Add irq flow functions")
> > Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> > ---
> >  drivers/net/ethernet/wangxun/libwx/wx_type.h    | 2 +-
> >  drivers/net/ethernet/wangxun/ngbe/ngbe_main.c   | 2 +-
> >  drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 3 ++-
> >  3 files changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/wangxun/libwx/wx_type.h
> > b/drivers/net/ethernet/wangxun/libwx/wx_type.h
> > index 77d8d7f1707e..97e2c1e13b80 100644
> > --- a/drivers/net/ethernet/wangxun/libwx/wx_type.h
> > +++ b/drivers/net/ethernet/wangxun/libwx/wx_type.h
> > @@ -222,7 +222,7 @@
> >  #define WX_PX_INTA                   0x110
> >  #define WX_PX_GPIE                   0x118
> >  #define WX_PX_GPIE_MODEL             BIT(0)
> > -#define WX_PX_IC                     0x120
> > +#define WX_PX_IC(_i)                 (0x120 + (_i) * 4)
> >  #define WX_PX_IMS(_i)                (0x140 + (_i) * 4)
> >  #define WX_PX_IMC(_i)                (0x150 + (_i) * 4)
> >  #define WX_PX_ISB_ADDR_L             0x160
> > diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> > b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> > index 5b564d348c09..17412e5282de 100644
> > --- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> > +++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
> > @@ -352,7 +352,7 @@ static void ngbe_up(struct wx *wx)
> >         netif_tx_start_all_queues(wx->netdev);
> >
> >         /* clear any pending interrupts, may auto mask */
> > -       rd32(wx, WX_PX_IC);
> > +       rd32(wx, WX_PX_IC(0));
> 
> Here you only clear irq 0 but not 1...
> 
> >         rd32(wx, WX_PX_MISC_IC);
> >         ngbe_irq_enable(wx, true);
> >         if (wx->gpio_ctrl)
> > diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > index 6c0a98230557..a58ce5463686 100644
> > --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > @@ -229,7 +229,8 @@ static void txgbe_up_complete(struct wx *wx)
> >         wx_napi_enable_all(wx);
> >
> >         /* clear any pending interrupts, may auto mask */
> > -       rd32(wx, WX_PX_IC);
> > +       rd32(wx, WX_PX_IC(0));
> > +       rd32(wx, WX_PX_IC(1));
> 
> Here you clear irq 0 and 1
> 
> >         rd32(wx, WX_PX_MISC_IC);
> >         txgbe_irq_enable(wx, true);
> >
> > --
> > 2.27.0
> 
> Why is there a difference between the two situations?
> 
> BR
> Steen

There is two different chip with different hardware design.
The register WX_PX_IC has total 64 bits in its low and high registers, which names WX_PX_IC(0) and WX_PX_IC(1).
For txgbe, it's necessary to clear irq 0-63, but 0-8 for ngbe.
patchwork-bot+netdevbpf@kernel.org March 24, 2023, 6 p.m. UTC | #4
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 22 Mar 2023 18:36:32 +0800 you wrote:
> There is 64-bit interrupt cause register for txgbe. Fix to clear upper
> 32 bits.
> 
> Fixes: 3f703186113f ("net: libwx: Add irq flow functions")
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> ---
>  drivers/net/ethernet/wangxun/libwx/wx_type.h    | 2 +-
>  drivers/net/ethernet/wangxun/ngbe/ngbe_main.c   | 2 +-
>  drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 3 ++-
>  3 files changed, 4 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [net] net: wangxun: Fix vector length of interrupt cause
    https://git.kernel.org/netdev/net/c/59513714f665

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/wangxun/libwx/wx_type.h b/drivers/net/ethernet/wangxun/libwx/wx_type.h
index 77d8d7f1707e..97e2c1e13b80 100644
--- a/drivers/net/ethernet/wangxun/libwx/wx_type.h
+++ b/drivers/net/ethernet/wangxun/libwx/wx_type.h
@@ -222,7 +222,7 @@ 
 #define WX_PX_INTA                   0x110
 #define WX_PX_GPIE                   0x118
 #define WX_PX_GPIE_MODEL             BIT(0)
-#define WX_PX_IC                     0x120
+#define WX_PX_IC(_i)                 (0x120 + (_i) * 4)
 #define WX_PX_IMS(_i)                (0x140 + (_i) * 4)
 #define WX_PX_IMC(_i)                (0x150 + (_i) * 4)
 #define WX_PX_ISB_ADDR_L             0x160
diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
index 5b564d348c09..17412e5282de 100644
--- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
+++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
@@ -352,7 +352,7 @@  static void ngbe_up(struct wx *wx)
 	netif_tx_start_all_queues(wx->netdev);
 
 	/* clear any pending interrupts, may auto mask */
-	rd32(wx, WX_PX_IC);
+	rd32(wx, WX_PX_IC(0));
 	rd32(wx, WX_PX_MISC_IC);
 	ngbe_irq_enable(wx, true);
 	if (wx->gpio_ctrl)
diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
index 6c0a98230557..a58ce5463686 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
@@ -229,7 +229,8 @@  static void txgbe_up_complete(struct wx *wx)
 	wx_napi_enable_all(wx);
 
 	/* clear any pending interrupts, may auto mask */
-	rd32(wx, WX_PX_IC);
+	rd32(wx, WX_PX_IC(0));
+	rd32(wx, WX_PX_IC(1));
 	rd32(wx, WX_PX_MISC_IC);
 	txgbe_irq_enable(wx, true);