mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 16:41:25 +00:00
p54pci: update receive dma buffers before and after processing
Documentation/DMA-API-HOWTO.txt states: "DMA transfers need to be synced properly in order for the cpu and device to see the most uptodate and correct copy of the DMA buffer." Cc: <stable@kernel.org> Signed-off-by: Christian Lamparter <chunkeey@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
4f919a3bc5
commit
0bf719dfde
1 changed files with 9 additions and 5 deletions
|
@ -199,6 +199,7 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index,
|
||||||
while (i != idx) {
|
while (i != idx) {
|
||||||
u16 len;
|
u16 len;
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
|
dma_addr_t dma_addr;
|
||||||
desc = &ring[i];
|
desc = &ring[i];
|
||||||
len = le16_to_cpu(desc->len);
|
len = le16_to_cpu(desc->len);
|
||||||
skb = rx_buf[i];
|
skb = rx_buf[i];
|
||||||
|
@ -216,17 +217,20 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index,
|
||||||
|
|
||||||
len = priv->common.rx_mtu;
|
len = priv->common.rx_mtu;
|
||||||
}
|
}
|
||||||
|
dma_addr = le32_to_cpu(desc->host_addr);
|
||||||
|
pci_dma_sync_single_for_cpu(priv->pdev, dma_addr,
|
||||||
|
priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE);
|
||||||
skb_put(skb, len);
|
skb_put(skb, len);
|
||||||
|
|
||||||
if (p54_rx(dev, skb)) {
|
if (p54_rx(dev, skb)) {
|
||||||
pci_unmap_single(priv->pdev,
|
pci_unmap_single(priv->pdev, dma_addr,
|
||||||
le32_to_cpu(desc->host_addr),
|
priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE);
|
||||||
priv->common.rx_mtu + 32,
|
|
||||||
PCI_DMA_FROMDEVICE);
|
|
||||||
rx_buf[i] = NULL;
|
rx_buf[i] = NULL;
|
||||||
desc->host_addr = 0;
|
desc->host_addr = cpu_to_le32(0);
|
||||||
} else {
|
} else {
|
||||||
skb_trim(skb, 0);
|
skb_trim(skb, 0);
|
||||||
|
pci_dma_sync_single_for_device(priv->pdev, dma_addr,
|
||||||
|
priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE);
|
||||||
desc->len = cpu_to_le16(priv->common.rx_mtu + 32);
|
desc->len = cpu_to_le16(priv->common.rx_mtu + 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue