arm: Optimization for ethernet MAC handling at91_ether.c

From: James Kosin
Date: Tue Jan 12 2010 - 10:37:48 EST


Since, a AT91_EMAC_TUND only happens when the transmitter is unable to
transfer the frame in time for a frame to be sent. It makes sense to
RETRY the packet in this condition in the ISR.
Or would this overcomplicate a simple task?
... see below ...


---- code snippet ----

* MAC interrupt handler
static irqreturn_t at91ether_interrupt(int irq, void *dev_id) { ...

if (intstatus & AT91_EMAC_TCOM) { /* Transmit
complete */
/* The TCOM bit is set even if the
transmission failed. */
if (intstatus & (AT91_EMAC_TUND |
dev->stats.tx_errors +=

if (lp->skb) {

lp->skb = NULL;
lp->skb_physaddr, lp->skb_length, DMA_TO_DEVICE);

---- Alternate approach ----

/* The TCOM bit is set even if the
transmission failed. */
if (intstatus & (AT91_EMAC_TUND)) {
/* Set address of the
data in the Transmit Address register */

at91_emac_write(AT91_EMAC_TAR, lp->skb_physaddr);
/* Set length of the
packet in the Transmit Control register */

at91_emac_write(AT91_EMAC_TCR, skb->len);
else if (intstatus & (AT91_EMAC_RTRY))
dev->stats.tx_errors +=

I do know there needs to be a bit more code then to handle the
successful case below this; but, this is enough to understand what I am
talking about. The UNDERRUN error should happen infrequently and in
ideal circumstances not happen at all.

James Kosin
Software Engineer
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at