int duplex;
unsigned int max_frame_len;
+ unsigned int desc_pktlen_mask;
unsigned int rx_buf_size;
struct work_struct restart_work;
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
/* 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();
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",
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,
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);