aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-12-17 16:27:44 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-12-17 16:27:44 +0000
commitb35e0da0f4272bc5f07e8b35325c2a7a91d4d14b (patch)
treea69ef3e0c7c879420609192ea8733b668ff5a4b7 /target/linux/ar71xx
parent088eea282d0b6b33d089440e097422b7d4256145 (diff)
downloadupstream-b35e0da0f4272bc5f07e8b35325c2a7a91d4d14b.tar.gz
upstream-b35e0da0f4272bc5f07e8b35325c2a7a91d4d14b.tar.bz2
upstream-b35e0da0f4272bc5f07e8b35325c2a7a91d4d14b.zip
ar71xx: ag71xx: store RX buffer size in the ag71xx struct
This allows to change the value dynamically. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 39120
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r--target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h2
-rw-r--r--target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c12
2 files changed, 8 insertions, 6 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
index 68d2691040..f3f9f14801 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h
@@ -53,7 +53,6 @@
#define AG71XX_TX_MTU_LEN 1540
#define AG71XX_RX_PKT_SIZE \
(ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)
-#define AG71XX_RX_BUF_SIZE (AG71XX_RX_PKT_SIZE + NET_SKB_PAD + NET_IP_ALIGN)
#define AG71XX_TX_RING_SIZE_DEFAULT 32
#define AG71XX_RX_RING_SIZE_DEFAULT 128
@@ -169,6 +168,7 @@ struct ag71xx {
int duplex;
unsigned int max_frame_len;
+ unsigned int rx_buf_size;
struct work_struct restart_work;
struct delayed_work link_work;
diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index 281d0f5686..04e1e586c2 100644
--- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -191,7 +191,7 @@ static void ag71xx_ring_rx_clean(struct ag71xx *ag)
for (i = 0; i < ring->size; i++)
if (ring->buf[i].rx_buf) {
dma_unmap_single(&ag->dev->dev, ring->buf[i].dma_addr,
- AG71XX_RX_BUF_SIZE, DMA_FROM_DEVICE);
+ ag->rx_buf_size, DMA_FROM_DEVICE);
kfree(ring->buf[i].rx_buf);
}
}
@@ -217,15 +217,15 @@ static bool ag71xx_fill_rx_buf(struct ag71xx *ag, struct ag71xx_buf *buf,
{
void *data;
- data = kmalloc(AG71XX_RX_BUF_SIZE +
+ data = kmalloc(ag->rx_buf_size +
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
GFP_ATOMIC);
if (!data)
return false;
buf->rx_buf = data;
- buf->dma_addr = dma_map_single(&ag->dev->dev, data,
- AG71XX_RX_BUF_SIZE, DMA_FROM_DEVICE);
+ buf->dma_addr = dma_map_single(&ag->dev->dev, data, ag->rx_buf_size,
+ DMA_FROM_DEVICE);
buf->desc->data = (u32) buf->dma_addr + offset;
return true;
}
@@ -609,6 +609,8 @@ static int ag71xx_open(struct net_device *dev)
struct ag71xx *ag = netdev_priv(dev);
int ret;
+ ag->rx_buf_size = AG71XX_RX_PKT_SIZE + NET_SKB_PAD + NET_IP_ALIGN;
+
ret = ag71xx_rings_init(ag);
if (ret)
goto err;
@@ -890,7 +892,7 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
pktlen -= ETH_FCS_LEN;
dma_unmap_single(&dev->dev, ring->buf[i].dma_addr,
- AG71XX_RX_BUF_SIZE, DMA_FROM_DEVICE);
+ ag->rx_buf_size, DMA_FROM_DEVICE);
dev->stats.rx_packets++;
dev->stats.rx_bytes += pktlen;