void __iomem *reg_base;
- u32 reg_sr;
unsigned int tx_head;
unsigned int tx_tail;
unsigned int rx_next;
return received;
}
-static int at91_poll_err(struct net_device *dev, int quota, u32 reg_sr)
+static void at91_irq_err_frame(struct net_device *dev, const u32 reg_sr)
{
struct net_device_stats *stats = &dev->stats;
struct at91_priv *priv = netdev_priv(dev);
priv->can.can_stats.bus_error++;
- if (quota) {
- skb = alloc_can_err_skb(dev, &cf);
- if (cf)
- cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
- }
+ skb = alloc_can_err_skb(dev, &cf);
+ if (cf)
+ cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
if (reg_sr & AT91_IRQ_CERR) {
netdev_dbg(dev, "CRC error\n");
}
if (!cf)
- return 0;
+ return;
netif_receive_skb(skb);
-
- return 1;
}
static int at91_poll(struct napi_struct *napi, int quota)
if (reg_sr & get_irq_mb_rx(priv))
work_done += at91_poll_rx(dev, quota - work_done);
- /* The error bits are clear on read,
- * so use saved value from irq handler.
- */
- reg_sr |= priv->reg_sr;
- if (reg_sr & AT91_IRQ_ERR_FRAME)
- work_done += at91_poll_err(dev, quota - work_done, reg_sr);
-
if (work_done < quota) {
/* enable IRQs for frame errors and all mailboxes >= rx_next */
u32 reg_ier = AT91_IRQ_ERR_FRAME;
handled = IRQ_HANDLED;
- /* Receive or error interrupt? -> napi */
- if (reg_sr & (get_irq_mb_rx(priv) | AT91_IRQ_ERR_FRAME)) {
- /* The error bits are clear on read,
- * save for later use.
- */
- priv->reg_sr = reg_sr;
+ /* Receive interrupt? -> napi */
+ if (reg_sr & get_irq_mb_rx(priv)) {
at91_write(priv, AT91_IDR,
- get_irq_mb_rx(priv) | AT91_IRQ_ERR_FRAME);
+ get_irq_mb_rx(priv));
napi_schedule(&priv->napi);
}
at91_irq_err(dev);
+ /* Frame Error Interrupt */
+ if (reg_sr & AT91_IRQ_ERR_FRAME)
+ at91_irq_err_frame(dev, reg_sr);
+
exit:
return handled;
}