diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-02-11 15:12:02 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2012-02-11 15:12:02 +0000 |
commit | edf1212d0f3a220d93278bc50280104ce4f1ac4b (patch) | |
tree | 2f1f4e59d10a43db4b3f92ff7b7bd023b0a5987e /target/linux/ramips/files | |
parent | b527da9716653621f148ab24167ed5a043c73a9e (diff) | |
download | upstream-edf1212d0f3a220d93278bc50280104ce4f1ac4b.tar.gz upstream-edf1212d0f3a220d93278bc50280104ce4f1ac4b.tar.bz2 upstream-edf1212d0f3a220d93278bc50280104ce4f1ac4b.zip |
ramips: raeth: add rx_dma array to store the DMA address of the rx packets
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30445 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ramips/files')
-rw-r--r-- | target/linux/ramips/files/drivers/net/ramips.c | 26 | ||||
-rw-r--r-- | target/linux/ramips/files/drivers/net/ramips_eth.h | 1 |
2 files changed, 17 insertions, 10 deletions
diff --git a/target/linux/ramips/files/drivers/net/ramips.c b/target/linux/ramips/files/drivers/net/ramips.c index 6066852152..c9eecc2240 100644 --- a/target/linux/ramips/files/drivers/net/ramips.c +++ b/target/linux/ramips/files/drivers/net/ramips.c @@ -172,6 +172,7 @@ ramips_alloc_dma(struct raeth_priv *re) memset(re->rx, 0, sizeof(struct ramips_rx_dma) * NUM_RX_DESC); for (i = 0; i < NUM_RX_DESC; i++) { + dma_addr_t dma_addr; struct sk_buff *new_skb = dev_alloc_skb(MAX_RX_LENGTH + NET_IP_ALIGN); @@ -179,10 +180,11 @@ ramips_alloc_dma(struct raeth_priv *re) goto err_cleanup; skb_reserve(new_skb, NET_IP_ALIGN); - re->rx[i].rxd1 = dma_map_single(NULL, - new_skb->data, - MAX_RX_LENGTH, - DMA_FROM_DEVICE); + + dma_addr = dma_map_single(NULL, new_skb->data, + MAX_RX_LENGTH, DMA_FROM_DEVICE); + re->rx_dma[i] = dma_addr; + re->rx[i].rxd1 = (unsigned int) re->rx_dma[i]; re->rx[i].rxd2 |= RX_DMA_LSO; re->rx_skb[i] = new_skb; } @@ -282,8 +284,9 @@ ramips_eth_rx_hw(unsigned long ptr) new_skb = netdev_alloc_skb(dev, MAX_RX_LENGTH + NET_IP_ALIGN); /* Reuse the buffer on allocation failures */ if (new_skb) { - /* TODO: convert to use dma_addr_t */ - dma_unmap_single(NULL, priv->rx[rx].rxd1, MAX_RX_LENGTH, + dma_addr_t dma_addr; + + dma_unmap_single(NULL, priv->rx_dma[rx], MAX_RX_LENGTH, DMA_FROM_DEVICE); skb_put(rx_skb, pktlen); @@ -296,10 +299,13 @@ ramips_eth_rx_hw(unsigned long ptr) priv->rx_skb[rx] = new_skb; skb_reserve(new_skb, NET_IP_ALIGN); - priv->rx[rx].rxd1 = dma_map_single(NULL, - new_skb->data, - MAX_RX_LENGTH, - DMA_FROM_DEVICE); + + dma_addr = dma_map_single(NULL, + new_skb->data, + MAX_RX_LENGTH, + DMA_FROM_DEVICE); + priv->rx_dma[rx] = dma_addr; + priv->rx[rx].rxd1 = (unsigned int) dma_addr; } else { dev->stats.rx_dropped++; } diff --git a/target/linux/ramips/files/drivers/net/ramips_eth.h b/target/linux/ramips/files/drivers/net/ramips_eth.h index a69754b77a..7d5296b21b 100644 --- a/target/linux/ramips/files/drivers/net/ramips_eth.h +++ b/target/linux/ramips/files/drivers/net/ramips_eth.h @@ -219,6 +219,7 @@ struct raeth_priv struct tasklet_struct rx_tasklet; struct ramips_rx_dma *rx; struct sk_buff *rx_skb[NUM_RX_DESC]; + dma_addr_t rx_dma[NUM_RX_DESC]; dma_addr_t tx_desc_dma; struct tasklet_struct tx_housekeeping_tasklet; |