Commit 1f397d89 authored by Feng Tang's avatar Feng Tang Committed by Kamal Mostafa

net: alx: Work around the DMA RX overflow issue

BugLink: http://bugs.launchpad.net/bugs/1601952

[ Upstream commit 881d0327 ]

Note: This is a verified backported patch for stable 4.4 kernel, and it
could also be applied to 4.3/4.2/4.1/3.18/3.16

There is a problem with alx devices, that the network link will be
lost in 1-5 minutes after the device is up.

>From debugging without datasheet, we found the error always
happen when the DMA RX address is set to 0x....fc0, which is very
likely to be a HW/silicon problem.

This patch will apply rx skb with 64 bytes longer space, and if the
allocated skb has a 0x...fc0 address, it will use skb_resever(skb, 64)
to advance the address, so that the RX overflow can be avoided.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=70761Signed-off-by: default avatarFeng Tang <feng.tang@intel.com>
Suggested-by: default avatarEric Dumazet <edumazet@google.com>
Tested-by: default avatarOle Lukoie <olelukoie@mail.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
parent f37a5461
...@@ -86,9 +86,14 @@ static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp) ...@@ -86,9 +86,14 @@ static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp)
while (!cur_buf->skb && next != rxq->read_idx) { while (!cur_buf->skb && next != rxq->read_idx) {
struct alx_rfd *rfd = &rxq->rfd[cur]; struct alx_rfd *rfd = &rxq->rfd[cur];
skb = __netdev_alloc_skb(alx->dev, alx->rxbuf_size, gfp); skb = __netdev_alloc_skb(alx->dev, alx->rxbuf_size + 64, gfp);
if (!skb) if (!skb)
break; break;
/* Workround for the HW RX DMA overflow issue */
if (((unsigned long)skb->data & 0xfff) == 0xfc0)
skb_reserve(skb, 64);
dma = dma_map_single(&alx->hw.pdev->dev, dma = dma_map_single(&alx->hw.pdev->dev,
skb->data, alx->rxbuf_size, skb->data, alx->rxbuf_size,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment