lkml.org 
[lkml]   [2010]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectPacket retry optimization in drivers/net/arm/at91_ehter.c
Date
From

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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-01-05 22:43    [W:0.067 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site