Commit 21ff0193 authored by Byungho An's avatar Byungho An Committed by David S. Miller

net: stmmac: Fixed the condition of extend_desc for jumbo frame

This patch fixed the condition of extend_desc for jumbo frame.
There is no check routine for extend_desc in the stmmac_jumbo_frm function.
Even though extend_desc is set if dma_tx is used instead of dma_etx.
It causes kernel panic.
Signed-off-by: default avatarByungho An <bh74.an@samsung.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ffbe4a53
...@@ -33,10 +33,15 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) ...@@ -33,10 +33,15 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum)
struct stmmac_priv *priv = (struct stmmac_priv *)p; struct stmmac_priv *priv = (struct stmmac_priv *)p;
unsigned int txsize = priv->dma_tx_size; unsigned int txsize = priv->dma_tx_size;
unsigned int entry = priv->cur_tx % txsize; unsigned int entry = priv->cur_tx % txsize;
struct dma_desc *desc = priv->dma_tx + entry; struct dma_desc *desc;
unsigned int nopaged_len = skb_headlen(skb); unsigned int nopaged_len = skb_headlen(skb);
unsigned int bmax, len; unsigned int bmax, len;
if (priv->extend_desc)
desc = (struct dma_desc *)(priv->dma_etx + entry);
else
desc = priv->dma_tx + entry;
if (priv->plat->enh_desc) if (priv->plat->enh_desc)
bmax = BUF_SIZE_8KiB; bmax = BUF_SIZE_8KiB;
else else
...@@ -54,7 +59,11 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) ...@@ -54,7 +59,11 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum)
STMMAC_RING_MODE); STMMAC_RING_MODE);
wmb(); wmb();
entry = (++priv->cur_tx) % txsize; entry = (++priv->cur_tx) % txsize;
desc = priv->dma_tx + entry;
if (priv->extend_desc)
desc = (struct dma_desc *)(priv->dma_etx + entry);
else
desc = priv->dma_tx + entry;
desc->des2 = dma_map_single(priv->device, skb->data + bmax, desc->des2 = dma_map_single(priv->device, skb->data + bmax,
len, DMA_TO_DEVICE); len, DMA_TO_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