summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
diff options
context:
space:
mode:
authorRayagond Kokatanur2013-03-26 05:43:09 +0100
committerDavid S. Miller2013-03-26 17:53:37 +0100
commitcf32deec16e4e8d47305bdc638fd108c88e06081 (patch)
tree1ea6ae2de2f92f18fff9332410f403f923e6cb99 /drivers/net/ethernet/stmicro/stmmac/ring_mode.c
parentstmmac: initial support to manage pcs modes (diff)
downloadkernel-qcow2-linux-cf32deec16e4e8d47305bdc638fd108c88e06081.tar.gz
kernel-qcow2-linux-cf32deec16e4e8d47305bdc638fd108c88e06081.tar.xz
kernel-qcow2-linux-cf32deec16e4e8d47305bdc638fd108c88e06081.zip
stmmac: add tx_skbuff_dma to save descriptors used by PTP
This patch adds a new pointer variable called "tx_skbuff_dma" to private data structure. This variable will holds the physical address of packet to be transmitted & same will be used to free/unmap the memory once the corresponding packet is transmitted by device. Prior to this patch the descriptor buffer pointer(ie des2) itself was being used for freeing/unmapping the buffer memory. But in case PTP v1 with normal descriptor the field(des2) will be overwritten by device with timestamp value, hence driver will loose the buffer pointer to be freed/unmapped. Signed-off-by: Rayagond Kokatanur <rayagond@vayavyalabs.com> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/stmicro/stmmac/ring_mode.c')
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/ring_mode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
index 8a5e661f4fda..43fc699b21cc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
+++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
@@ -48,6 +48,7 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum)
desc->des2 = dma_map_single(priv->device, skb->data,
bmax, DMA_TO_DEVICE);
+ priv->tx_skbuff_dma[entry] = desc->des2;
desc->des3 = desc->des2 + BUF_SIZE_4KiB;
priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum,
STMMAC_RING_MODE);
@@ -57,6 +58,7 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum)
desc->des2 = dma_map_single(priv->device, skb->data + bmax,
len, DMA_TO_DEVICE);
+ priv->tx_skbuff_dma[entry] = desc->des2;
desc->des3 = desc->des2 + BUF_SIZE_4KiB;
priv->hw->desc->prepare_tx_desc(desc, 0, len, csum,
STMMAC_RING_MODE);
@@ -66,6 +68,7 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum)
} else {
desc->des2 = dma_map_single(priv->device, skb->data,
nopaged_len, DMA_TO_DEVICE);
+ priv->tx_skbuff_dma[entry] = desc->des2;
desc->des3 = desc->des2 + BUF_SIZE_4KiB;
priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, csum,
STMMAC_RING_MODE);