public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* arm: Optimization for ethernet MAC handling at91_ether.c
@ 2010-01-12 15:39 James Kosin
  2010-01-12 16:35 ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: James Kosin @ 2010-01-12 15:39 UTC (permalink / raw)
  To: linux-kernel

Everyone,

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

---- 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
Software Engineer

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-01-12 19:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-12 15:39 arm: Optimization for ethernet MAC handling at91_ether.c James Kosin
2010-01-12 16:35 ` Eric Dumazet
2010-01-12 17:51   ` James Kosin
2010-01-12 18:08     ` Eric Dumazet
2010-01-12 18:42       ` James Kosin
2010-01-12 19:03         ` James Kosin
2010-01-12 19:24           ` Eric Dumazet
2010-01-12 19:39             ` James Kosin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox