Packet retry optimization in drivers/net/arm/at91_ehter.c

From: James Kosin
Date: Tue Jan 05 2010 - 16:39:51 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 ...

James

---- Attached 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 | AT91_EMAC_RTRY))
                                                dev->stats.tx_errors += 1;

                                if (lp->skb) {
                                                dev_kfree_skb_irq(lp->skb);
                                                lp->skb = NULL;
                                                dma_unmap_single(NULL, lp->skb_physaddr, lp->skb_length, DMA_TO_DEVICE);
                                }
                                netif_wake_queue(dev);
                }
...

---- 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 += 1;

...
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/