summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-12-20 11:41:16 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2013-12-20 11:41:16 +0000
commitc1515c7bc708079826f2d5f04354a95d07eddb32 (patch)
tree145ed86bb462b0e94e50e84d4bcaa8fb4a23811d /target
parent30f6063468b76c18c0f784eff05d04d579b69335 (diff)
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> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39144 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-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 b0df017571..f6d85b9084 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 622ffed1ea..a129a6f291 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);