From: michal.simek@xilinx.com (Michal Simek)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/14] net: axienet: Handle 0 packet receive gracefully
Date: Wed, 12 Feb 2014 16:55:38 +0100 [thread overview]
Message-ID: <f360a8bd55e2ec2b24f48acd4e85ef48ac46d55b.1392220536.git.michal.simek@xilinx.com> (raw)
In-Reply-To: <cover.1392220536.git.michal.simek@xilinx.com>
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
The AXI-DMA rx-delay interrupt can sometimes be triggered when there are 0
outstanding packets received. This is due to the fact that the receive function
will greedily consume as many packets as possible on interrupt. So if two
packets (with a very particular timing) arrive in succession they will each
cause the rx-delay interrupt, but the first interrupt will consume both packets.
This means the second interrupt is a 0 packet receive.
This is mostly OK, except that the tail pointer register is updated
unconditionally on receive. Currently the tail pointer is always set to the
current bd-ring descriptor under the assumption that the hardware has moved onto
the next descriptor. What this means for length 0 recv is the current descriptor
that the hardware is potentially yet to use will be marked as the tail. This
causes the hardware to think its run out of descriptors deadlocking the whole rx
path.
Fixed by updating the tail pointer to the most recent successfully consumed
descriptor.
Reported-by: Wendy Liang <wendy.liang@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Jason Wu <huanyu@xilinx.com>
---
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 3966d83..2e21ab2 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -726,15 +726,15 @@ static void axienet_recv(struct net_device *ndev)
u32 csumstatus;
u32 size = 0;
u32 packets = 0;
- dma_addr_t tail_p;
+ dma_addr_t tail_p = 0;
struct axienet_local *lp = netdev_priv(ndev);
struct sk_buff *skb, *new_skb;
struct axidma_bd *cur_p;
- tail_p = lp->rx_bd_p + sizeof(*lp->rx_bd_v) * lp->rx_bd_ci;
cur_p = &lp->rx_bd_v[lp->rx_bd_ci];
while ((cur_p->status & XAXIDMA_BD_STS_COMPLETE_MASK)) {
+ tail_p = lp->rx_bd_p + sizeof(*lp->rx_bd_v) * lp->rx_bd_ci;
skb = (struct sk_buff *) (cur_p->sw_id_offset);
length = cur_p->app4 & 0x0000FFFF;
@@ -786,7 +786,8 @@ static void axienet_recv(struct net_device *ndev)
ndev->stats.rx_packets += packets;
ndev->stats.rx_bytes += size;
- axienet_dma_out32(lp, XAXIDMA_RX_TDESC_OFFSET, tail_p);
+ if (tail_p)
+ axienet_dma_out32(lp, XAXIDMA_RX_TDESC_OFFSET, tail_p);
}
/**
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140212/e6875092/attachment.sig>
next prev parent reply other threads:[~2014-02-12 15:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-12 15:55 [PATCH 0/14] Xilinx axi ethernet patches Michal Simek
2014-02-12 15:55 ` [PATCH 01/14] net: axienet: Fix compilation error Michal Simek
2014-02-12 15:55 ` [PATCH 02/14] net: axienet: Fix compilation warnings Michal Simek
2014-02-12 15:55 ` [PATCH 03/14] net: axienet: Support for RGMII Michal Simek
2014-02-12 15:55 ` Michal Simek [this message]
2014-02-12 15:55 ` [PATCH 05/14] net: axienet: Service completion interrupts ASAP Michal Simek
2014-02-12 16:38 ` David Laight
2014-02-12 15:55 ` [PATCH 06/14] net: axienet: Handle jumbo frames for lesser frame sizes Michal Simek
2014-02-12 15:55 ` [PATCH 07/14] net: axienet: Support phy-less mode of operation Michal Simek
2014-02-12 15:55 ` [PATCH 08/14] net: axienet: Removed checkpatch errors/warnings Michal Simek
2014-02-13 0:31 ` Joe Perches
2014-02-13 7:19 ` Michal Simek
2014-02-13 15:51 ` Joe Perches
2014-02-14 9:21 ` Michal Simek
2014-02-12 15:55 ` [PATCH 09/14] net: axienet: Fix comments blocks Michal Simek
2014-02-12 15:55 ` [PATCH 10/14] net: axienet: Use pdev instead of op Michal Simek
2014-02-12 15:55 ` [PATCH 11/14] net: axienet: Use devm_* calls Michal Simek
2014-02-12 15:55 ` [PATCH 12/14] net: axienet: Use of_property_* calls Michal Simek
2014-02-12 15:55 ` [PATCH 13/14] net: axienet: Removed _of_ prefix in probe and remove functions Michal Simek
2014-02-12 15:55 ` [PATCH 14/14] net: axienet: Fix kernel-doc warnings Michal Simek
2014-02-13 0:18 ` [PATCH 0/14] Xilinx axi ethernet patches David Miller
2014-02-13 7:00 ` Michal Simek
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=f360a8bd55e2ec2b24f48acd4e85ef48ac46d55b.1392220536.git.michal.simek@xilinx.com \
--to=michal.simek@xilinx.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).