mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "James Kosin" <JKosin@intcomgrp.com>
To: <linux-kernel@vger.kernel.org>
Cc: "Linux Netdev List" <netdev@vger.kernel.org>,
	"Eric Dumazet" <eric.dumazet@gmail.com>
Subject: [PATCH 2/2] net: at91_ether.c - Allow transmitter interrupt to be handled first in ISR
Date: Wed, 13 Jan 2010 12:46:05 -0500	[thread overview]
Message-ID: <3DBBD805E3BA064A87F551C0E8BD367402897491@MAILSRV.intcomgrp.com> (raw)

[-- 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 */

             reply	other threads:[~2010-01-13 17:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13 17:46 James Kosin [this message]
2010-01-13 18:08 ` Eric Dumazet
2010-01-13 21:13   ` James Kosin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3DBBD805E3BA064A87F551C0E8BD367402897491@MAILSRV.intcomgrp.com \
    --to=jkosin@intcomgrp.com \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®