From: Beniamino Galvani <b.galvani@gmail.com>
To: netdev@vger.kernel.org
Cc: "Alexey Brodkin" <Alexey.Brodkin@synopsys.com>,
"Vineet Gupta" <Vineet.Gupta1@synopsys.com>,
"Heiko Stübner" <heiko@sntech.de>,
"Max Schwarz" <max.schwarz@online.de>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Wei Yongjun" <yongjun_wei@trendmicro.com.cn>,
"Thierry Reding" <thierry.reding@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <eric.dumazet@gmail.com>,
linux-kernel@vger.kernel.org,
"Beniamino Galvani" <b.galvani@gmail.com>
Subject: [RFC PATCH 1/2] net: arc_emac: enable tx interrupts
Date: Sun, 20 Jul 2014 17:44:57 +0200 [thread overview]
Message-ID: <1405871098-5663-2-git-send-email-b.galvani@gmail.com> (raw)
In-Reply-To: <1405871098-5663-1-git-send-email-b.galvani@gmail.com>
arc_emac_tx_clean() is called by the the napi poll handler, which is
scheduled only when a rx interrupt is raised. In absence of received
packets the reclaim of used buffers is not executed, blocking further
transmissions.
This can be easily reproduced starting the transmission of a UDP flow
with iperf, which blocks almost immediately because skbs are not freed
and the socket send buffer becomes full:
iperf S c037a308 0 87 82 0x00000000
[<c037a308>] (__schedule) from [<c0379da4>] (schedule_timeout+0x124/0x178)
[<c0379da4>] (schedule_timeout) from [<c02c253c>] (sock_alloc_send_pskb+0x2a8/0x3a4)
[<c02c253c>] (sock_alloc_send_pskb) from [<c02c265c>] (sock_alloc_send_skb+0x24/0x2c)
[<c02c265c>] (sock_alloc_send_skb) from [<c02fd0e4>] (__ip_append_data+0x670/0x9b0)
[<c02fd0e4>] (__ip_append_data) from [<c02ffd1c>] (ip_make_skb+0xb0/0xe4)
[<c02ffd1c>] (ip_make_skb) from [<c0322c78>] (udp_sendmsg+0x210/0x7d4)
[<c0322c78>] (udp_sendmsg) from [<c032c798>] (inet_sendmsg+0x7c/0xb4)
[<c032c798>] (inet_sendmsg) from [<c02bf734>] (sock_aio_write+0xcc/0xec)
[<c02bf734>] (sock_aio_write) from [<c00e0bfc>] (do_sync_write+0x84/0xac)
[<c00e0bfc>] (do_sync_write) from [<c00e174c>] (vfs_write+0x108/0x1ac)
[<c00e174c>] (vfs_write) from [<c00e1af8>] (SyS_write+0x40/0x8c)
[<c00e1af8>] (SyS_write) from [<c000e620>] (ret_fast_syscall+0x0/0x30)
The patch schedules a napi poll after tx interrupts to allow the tx
reclaim to run in the described situation.
Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
---
drivers/net/ethernet/arc/emac_main.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index 18e2fac..4adc01f 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -298,7 +298,7 @@ static int arc_emac_poll(struct napi_struct *napi, int budget)
work_done = arc_emac_rx(ndev, budget);
if (work_done < budget) {
napi_complete(napi);
- arc_reg_or(priv, R_ENABLE, RXINT_MASK);
+ arc_reg_or(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
}
return work_done;
@@ -327,9 +327,9 @@ static irqreturn_t arc_emac_intr(int irq, void *dev_instance)
/* Reset all flags except "MDIO complete" */
arc_reg_set(priv, R_STATUS, status);
- if (status & RXINT_MASK) {
+ if (status & (RXINT_MASK | TXINT_MASK)) {
if (likely(napi_schedule_prep(&priv->napi))) {
- arc_reg_clr(priv, R_ENABLE, RXINT_MASK);
+ arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK);
__napi_schedule(&priv->napi);
}
}
@@ -440,7 +440,7 @@ static int arc_emac_open(struct net_device *ndev)
arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma);
/* Enable interrupts */
- arc_reg_set(priv, R_ENABLE, RXINT_MASK | ERR_MASK);
+ arc_reg_set(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
/* Set CONTROL */
arc_reg_set(priv, R_CTRL,
@@ -511,7 +511,7 @@ static int arc_emac_stop(struct net_device *ndev)
netif_stop_queue(ndev);
/* Disable interrupts */
- arc_reg_clr(priv, R_ENABLE, RXINT_MASK | ERR_MASK);
+ arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
/* Disable EMAC */
arc_reg_clr(priv, R_CTRL, EN_MASK);
--
1.7.10.4
next prev parent reply other threads:[~2014-07-20 15:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-20 15:44 [RFC PATCH 0/2] net: arc_emac: fix tx issues Beniamino Galvani
2014-07-20 15:44 ` Beniamino Galvani [this message]
2014-07-20 15:44 ` [RFC PATCH 2/2] net: arc_emac: prevent reuse of unreclaimed tx descriptors Beniamino Galvani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1405871098-5663-2-git-send-email-b.galvani@gmail.com \
--to=b.galvani@gmail.com \
--cc=Alexey.Brodkin@synopsys.com \
--cc=Vineet.Gupta1@synopsys.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=heiko@sntech.de \
--cc=linux-kernel@vger.kernel.org \
--cc=max.schwarz@online.de \
--cc=netdev@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=yongjun_wei@trendmicro.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).