diff options
author | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-12-17 16:27:44 +0000 |
---|---|---|
committer | juhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-12-17 16:27:44 +0000 |
commit | 86d058eb85a409a7fbe244426ce568d5246eb911 (patch) | |
tree | 5c49a4d469009f28b522929af30415e9e4de184a /target | |
parent | 6701817df9a68bd79a88058ef5600b9c4f45a59e (diff) |
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>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39120 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h | 2 | ||||
-rw-r--r-- | target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c | 12 |
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; |