* [PATCH net 0/2] net: renesas: rswitch: Fix a lot of redundant irq issue
@ 2023-09-12 1:49 Yoshihiro Shimoda
2023-09-12 1:49 ` [PATCH net 1/2] net: renesas: rswitch: Fix unmasking irq condition Yoshihiro Shimoda
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2023-09-12 1:49 UTC (permalink / raw)
To: s.shtylyov, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
After this patch series was applied, a lot of redundant interrupts
no longer occur.
For example: when "iperf3 -c <ipaddr> -R" on R-Car S4-8 Spider
Before the patches are applied: about 800,000 times happened
After the patches were applied: about 100,000 times happened
Yoshihiro Shimoda (2):
net: renesas: rswitch: Fix unmasking irq condition
net: renesas: rswitch: Add spin lock protection for irq {un}mask
drivers/net/ethernet/renesas/rswitch.c | 20 ++++++++++++++++----
drivers/net/ethernet/renesas/rswitch.h | 2 ++
2 files changed, 18 insertions(+), 4 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net 1/2] net: renesas: rswitch: Fix unmasking irq condition
2023-09-12 1:49 [PATCH net 0/2] net: renesas: rswitch: Fix a lot of redundant irq issue Yoshihiro Shimoda
@ 2023-09-12 1:49 ` Yoshihiro Shimoda
2023-09-12 1:49 ` [PATCH net 2/2] net: renesas: rswitch: Add spin lock protection for irq {un}mask Yoshihiro Shimoda
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2023-09-12 1:49 UTC (permalink / raw)
To: s.shtylyov, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
Fix unmasking irq condition by using napi_complete_done(). Otherwise,
redundant interrupts happen.
Fixes: 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/net/ethernet/renesas/rswitch.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 6083b1c8e4fb..26c8807d7dea 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -816,10 +816,10 @@ static int rswitch_poll(struct napi_struct *napi, int budget)
netif_wake_subqueue(ndev, 0);
- napi_complete(napi);
-
- rswitch_enadis_data_irq(priv, rdev->tx_queue->index, true);
- rswitch_enadis_data_irq(priv, rdev->rx_queue->index, true);
+ if (napi_complete_done(napi, budget - quota)) {
+ rswitch_enadis_data_irq(priv, rdev->tx_queue->index, true);
+ rswitch_enadis_data_irq(priv, rdev->rx_queue->index, true);
+ }
out:
return budget - quota;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net 2/2] net: renesas: rswitch: Add spin lock protection for irq {un}mask
2023-09-12 1:49 [PATCH net 0/2] net: renesas: rswitch: Fix a lot of redundant irq issue Yoshihiro Shimoda
2023-09-12 1:49 ` [PATCH net 1/2] net: renesas: rswitch: Fix unmasking irq condition Yoshihiro Shimoda
@ 2023-09-12 1:49 ` Yoshihiro Shimoda
2023-09-13 11:24 ` [PATCH net 0/2] net: renesas: rswitch: Fix a lot of redundant irq issue Simon Horman
2023-09-14 8:40 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Yoshihiro Shimoda @ 2023-09-12 1:49 UTC (permalink / raw)
To: s.shtylyov, davem, edumazet, kuba, pabeni
Cc: netdev, linux-renesas-soc, Yoshihiro Shimoda
Add spin lock protection for irq {un}mask registers' control.
After napi_complete_done() and this protection were applied,
a lot of redundant interrupts no longer occur.
For example: when "iperf3 -c <ipaddr> -R" on R-Car S4-8 Spider
Before the patches are applied: about 800,000 times happened
After the patches were applied: about 100,000 times happened
Fixes: 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/net/ethernet/renesas/rswitch.c | 12 ++++++++++++
drivers/net/ethernet/renesas/rswitch.h | 2 ++
2 files changed, 14 insertions(+)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index 26c8807d7dea..ea9186178091 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -799,6 +799,7 @@ static int rswitch_poll(struct napi_struct *napi, int budget)
struct net_device *ndev = napi->dev;
struct rswitch_private *priv;
struct rswitch_device *rdev;
+ unsigned long flags;
int quota = budget;
rdev = netdev_priv(ndev);
@@ -817,8 +818,10 @@ static int rswitch_poll(struct napi_struct *napi, int budget)
netif_wake_subqueue(ndev, 0);
if (napi_complete_done(napi, budget - quota)) {
+ spin_lock_irqsave(&priv->lock, flags);
rswitch_enadis_data_irq(priv, rdev->tx_queue->index, true);
rswitch_enadis_data_irq(priv, rdev->rx_queue->index, true);
+ spin_unlock_irqrestore(&priv->lock, flags);
}
out:
@@ -835,8 +838,10 @@ static void rswitch_queue_interrupt(struct net_device *ndev)
struct rswitch_device *rdev = netdev_priv(ndev);
if (napi_schedule_prep(&rdev->napi)) {
+ spin_lock(&rdev->priv->lock);
rswitch_enadis_data_irq(rdev->priv, rdev->tx_queue->index, false);
rswitch_enadis_data_irq(rdev->priv, rdev->rx_queue->index, false);
+ spin_unlock(&rdev->priv->lock);
__napi_schedule(&rdev->napi);
}
}
@@ -1440,14 +1445,17 @@ static void rswitch_ether_port_deinit_all(struct rswitch_private *priv)
static int rswitch_open(struct net_device *ndev)
{
struct rswitch_device *rdev = netdev_priv(ndev);
+ unsigned long flags;
phy_start(ndev->phydev);
napi_enable(&rdev->napi);
netif_start_queue(ndev);
+ spin_lock_irqsave(&rdev->priv->lock, flags);
rswitch_enadis_data_irq(rdev->priv, rdev->tx_queue->index, true);
rswitch_enadis_data_irq(rdev->priv, rdev->rx_queue->index, true);
+ spin_unlock_irqrestore(&rdev->priv->lock, flags);
if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS))
iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDIE);
@@ -1461,6 +1469,7 @@ static int rswitch_stop(struct net_device *ndev)
{
struct rswitch_device *rdev = netdev_priv(ndev);
struct rswitch_gwca_ts_info *ts_info, *ts_info2;
+ unsigned long flags;
netif_tx_stop_all_queues(ndev);
bitmap_clear(rdev->priv->opened_ports, rdev->port, 1);
@@ -1476,8 +1485,10 @@ static int rswitch_stop(struct net_device *ndev)
kfree(ts_info);
}
+ spin_lock_irqsave(&rdev->priv->lock, flags);
rswitch_enadis_data_irq(rdev->priv, rdev->tx_queue->index, false);
rswitch_enadis_data_irq(rdev->priv, rdev->rx_queue->index, false);
+ spin_unlock_irqrestore(&rdev->priv->lock, flags);
phy_stop(ndev->phydev);
napi_disable(&rdev->napi);
@@ -1887,6 +1898,7 @@ static int renesas_eth_sw_probe(struct platform_device *pdev)
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
+ spin_lock_init(&priv->lock);
attr = soc_device_match(rswitch_soc_no_speed_change);
if (attr)
diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h
index 54f397effbc6..f0c16a37ea55 100644
--- a/drivers/net/ethernet/renesas/rswitch.h
+++ b/drivers/net/ethernet/renesas/rswitch.h
@@ -1011,6 +1011,8 @@ struct rswitch_private {
struct rswitch_etha etha[RSWITCH_NUM_PORTS];
struct rswitch_mfwd mfwd;
+ spinlock_t lock; /* lock interrupt registers' control */
+
bool etha_no_runtime_change;
bool gwca_halt;
};
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net 0/2] net: renesas: rswitch: Fix a lot of redundant irq issue
2023-09-12 1:49 [PATCH net 0/2] net: renesas: rswitch: Fix a lot of redundant irq issue Yoshihiro Shimoda
2023-09-12 1:49 ` [PATCH net 1/2] net: renesas: rswitch: Fix unmasking irq condition Yoshihiro Shimoda
2023-09-12 1:49 ` [PATCH net 2/2] net: renesas: rswitch: Add spin lock protection for irq {un}mask Yoshihiro Shimoda
@ 2023-09-13 11:24 ` Simon Horman
2023-09-14 8:40 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2023-09-13 11:24 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: s.shtylyov, davem, edumazet, kuba, pabeni, netdev,
linux-renesas-soc
On Tue, Sep 12, 2023 at 10:49:34AM +0900, Yoshihiro Shimoda wrote:
> After this patch series was applied, a lot of redundant interrupts
> no longer occur.
>
> For example: when "iperf3 -c <ipaddr> -R" on R-Car S4-8 Spider
> Before the patches are applied: about 800,000 times happened
> After the patches were applied: about 100,000 times happened
>
> Yoshihiro Shimoda (2):
> net: renesas: rswitch: Fix unmasking irq condition
> net: renesas: rswitch: Add spin lock protection for irq {un}mask
>
> drivers/net/ethernet/renesas/rswitch.c | 20 ++++++++++++++++----
> drivers/net/ethernet/renesas/rswitch.h | 2 ++
> 2 files changed, 18 insertions(+), 4 deletions(-)
For series,
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net 0/2] net: renesas: rswitch: Fix a lot of redundant irq issue
2023-09-12 1:49 [PATCH net 0/2] net: renesas: rswitch: Fix a lot of redundant irq issue Yoshihiro Shimoda
` (2 preceding siblings ...)
2023-09-13 11:24 ` [PATCH net 0/2] net: renesas: rswitch: Fix a lot of redundant irq issue Simon Horman
@ 2023-09-14 8:40 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-09-14 8:40 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: s.shtylyov, davem, edumazet, kuba, pabeni, netdev,
linux-renesas-soc
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 12 Sep 2023 10:49:34 +0900 you wrote:
> After this patch series was applied, a lot of redundant interrupts
> no longer occur.
>
> For example: when "iperf3 -c <ipaddr> -R" on R-Car S4-8 Spider
> Before the patches are applied: about 800,000 times happened
> After the patches were applied: about 100,000 times happened
>
> [...]
Here is the summary with links:
- [net,1/2] net: renesas: rswitch: Fix unmasking irq condition
https://git.kernel.org/netdev/net/c/e7b1ef29420f
- [net,2/2] net: renesas: rswitch: Add spin lock protection for irq {un}mask
https://git.kernel.org/netdev/net/c/c4f922e86c8e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-14 8:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-12 1:49 [PATCH net 0/2] net: renesas: rswitch: Fix a lot of redundant irq issue Yoshihiro Shimoda
2023-09-12 1:49 ` [PATCH net 1/2] net: renesas: rswitch: Fix unmasking irq condition Yoshihiro Shimoda
2023-09-12 1:49 ` [PATCH net 2/2] net: renesas: rswitch: Add spin lock protection for irq {un}mask Yoshihiro Shimoda
2023-09-13 11:24 ` [PATCH net 0/2] net: renesas: rswitch: Fix a lot of redundant irq issue Simon Horman
2023-09-14 8:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).