public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] net: at91_ether.c - Allow transmitter interrupt to be handled first in ISR
@ 2010-01-13 17:46 James Kosin
  2010-01-13 18:08 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: James Kosin @ 2010-01-13 17:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linux Netdev List, Eric Dumazet

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

Ok,

This next patch is optional....

The idea is TUND should only happen on occasions when the PHY is unable
to receive the transmitter data in a timely fashion to successfully send
the data in a single burst.  This is not a hard error; so, why do we
treat it as such.

This patch allows the transmitter to resend the failed skb inside the
ISR without having to deal with the overhead of freeing the skb then
having the main task re-allocate a new skb for the failed packet.

James Kosin


[-- Attachment #2: ether_patch_2.patch --]
[-- Type: application/octet-stream, Size: 1348 bytes --]

--- C:/Documents and Settings/jkosin/My Documents/junk/kernel/Copy of linux-2.6.31.5/drivers/net/arm/at91_ether.c	Wed Jan 13 12:26:13 2010
+++ C:/Documents and Settings/jkosin/My Documents/junk/kernel/linux-2.6.31.5/drivers/net/arm/at91_ether.c	Wed Jan 13 12:38:55 2010
@@ -927,15 +927,24 @@
 
 	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 (intstatus & AT91_EMAC_TUND) {
+			if (lp->skb) {
+				/* 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, lp->skb->len);
+			}
+		} else {
+			if (intstatus & 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);
+			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);
 		}
-		netif_wake_queue(dev);
 	}
 
 	if (intstatus & AT91_EMAC_RCOM)		/* Receive complete */

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13 17:46 [PATCH 2/2] net: at91_ether.c - Allow transmitter interrupt to be handled first in ISR James Kosin
2010-01-13 18:08 ` Eric Dumazet
2010-01-13 21:13   ` James Kosin

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