summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-12-20 11:41:16 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-12-20 11:41:16 +0000
commit9be1e508f98abad12d099b26e2087c5e95fe2d64 (patch)
treed670d216a9f38407e32fab44d3058e5d18c57dc2 /target/linux
parent2b22d909fdc8e8c08b2209536f11db07972fa11a (diff)
downloadmtk-20170518-9be1e508f98abad12d099b26e2087c5e95fe2d64.zip
mtk-20170518-9be1e508f98abad12d099b26e2087c5e95fe2d64.tar.gz
mtk-20170518-9be1e508f98abad12d099b26e2087c5e95fe2d64.tar.bz2
ar71xx: ag71xx: store descriptor packet length mask in ag71xx struct
The currently used bitmask is not correct for all SoCs. Introduce a new field in struct ag71xx and store the bitmask in that. Use the current value for now, it will be adjusted for each SoCs in further patches. Aslo use the new field directly in the ag71xx_rx_packets and ag71xx_hard_start_xmit() functions and remove the ag71xx_desc_pktlen() helper. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 39144
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h6
-rw-r--r--target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c6
2 files changed, 5 insertions, 7 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 b0df017..f6d85b9 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
@@ -166,6 +166,7 @@ struct ag71xx {
int duplex;
unsigned int max_frame_len;
+ unsigned int desc_pktlen_mask;
unsigned int rx_buf_size;
struct work_struct restart_work;
@@ -198,11 +199,6 @@ static inline int ag71xx_desc_empty(struct ag71xx_desc *desc)
return (desc->ctrl & DESC_EMPTY) != 0;
}
-static inline int ag71xx_desc_pktlen(struct ag71xx_desc *desc)
-{
- return desc->ctrl & DESC_PKTLEN_M;
-}
-
/* Register offsets */
#define AG71XX_REG_MAC_CFG1 0x0000
#define AG71XX_REG_MAC_CFG2 0x0004
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 622ffed..a129a6f 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
@@ -692,7 +692,7 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb,
/* setup descriptor fields */
desc->data = (u32) dma_addr;
- desc->ctrl = (skb->len & DESC_PKTLEN_M);
+ desc->ctrl = skb->len & ag->desc_pktlen_mask;
/* flush descriptor */
wmb();
@@ -866,6 +866,7 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
struct net_device *dev = ag->dev;
struct ag71xx_ring *ring = &ag->rx_ring;
int offset = ag71xx_buffer_offset(ag);
+ unsigned int pktlen_mask = ag->desc_pktlen_mask;
int done = 0;
DBG("%s: rx packets, limit=%d, curr=%u, dirty=%u\n",
@@ -888,7 +889,7 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
ag71xx_wr(ag, AG71XX_REG_RX_STATUS, RX_STATUS_PR);
- pktlen = ag71xx_desc_pktlen(desc);
+ pktlen = desc->ctrl & pktlen_mask;
pktlen -= ETH_FCS_LEN;
dma_unmap_single(&dev->dev, ring->buf[i].dma_addr,
@@ -1169,6 +1170,7 @@ static int ag71xx_probe(struct platform_device *pdev)
ag->rx_ring.size = AG71XX_RX_RING_SIZE_DEFAULT;
ag->max_frame_len = AG71XX_TX_MTU_LEN;
+ ag->desc_pktlen_mask = DESC_PKTLEN_MASK;
ag->stop_desc = dma_alloc_coherent(NULL,
sizeof(struct ag71xx_desc), &ag->stop_desc_dma, GFP_KERNEL);