linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Schleef <ds@schleef.org>
To: linuxppc-dev@lists.linuxppc.org
Subject: bugfix patch to arch/ppc/8260_io/fcc_enet.c
Date: Fri, 6 Apr 2001 07:16:44 -0700	[thread overview]
Message-ID: <20010406071644.A2517@stm.lbl.gov> (raw)

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


The attached patch fixes a bug with 8260 fcc_enet driver that
is related to when the TX buffer becomes full.  Currently,
the driver relies on the BD_ENET_TX_READY for determining if
a ring slot is available for a tx buffer.  This is not a
valid criterion, because the interrupt handler may not have
cleared the slot from a previous tx buffer.  This bug is easy
to generate by writing files over NFS with large wsize.

The patch should apply cleanly to 2_4 and 2_5.




dave...



[-- Attachment #2: patch-txring --]
[-- Type: text/plain, Size: 1209 bytes --]

--- fcc_enet.c.25	Fri Apr  6 03:29:06 2001
+++ fcc_enet.c	Fri Apr  6 04:59:36 2001
@@ -219,8 +219,8 @@
 struct fcc_enet_private {
 	/* The saved address of a sent-in-place packet/buffer, for skfree(). */
 	struct	sk_buff* tx_skbuff[TX_RING_SIZE];
-	ushort	skb_cur;
-	ushort	skb_dirty;
+	uint	skb_cur;
+	uint	skb_dirty;

 	/* CPM dual port RAM relative addresses.
 	*/
@@ -329,10 +329,10 @@

 	/* Save skb pointer.
 	*/
-	cep->tx_skbuff[cep->skb_cur] = skb;
+	cep->tx_skbuff[(cep->skb_cur & TX_RING_MOD_MASK)] = skb;

 	cep->stats.tx_bytes += skb->len;
-	cep->skb_cur = (cep->skb_cur+1) & TX_RING_MOD_MASK;
+	cep->skb_cur++;

 	spin_lock_irq(&cep->lock);

@@ -355,7 +355,7 @@
 	else
 		bdp++;

-	if (bdp->cbd_sc & BD_ENET_TX_READY) {
+	if(cep->skb_cur - cep->skb_dirty >= TX_RING_SIZE){
 		netif_stop_queue(dev);
 		cep->tx_full = 1;
 	}
@@ -475,8 +475,8 @@

 		/* Free the sk buffer associated with this last transmit.
 		*/
-		dev_kfree_skb_irq(cep->tx_skbuff[cep->skb_dirty]);
-		cep->skb_dirty = (cep->skb_dirty + 1) & TX_RING_MOD_MASK;
+		dev_kfree_skb_irq(cep->tx_skbuff[(cep->skb_dirty & TX_RING_MOD_MASK)]);
+		cep->skb_dirty++;

 		/* Update pointer to next buffer descriptor to be transmitted.
 		*/

             reply	other threads:[~2001-04-06 14:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-06 14:16 David Schleef [this message]
2001-04-08  7:15 ` bugfix patch to arch/ppc/8260_io/fcc_enet.c Dan Malek
2001-04-08 22:28   ` David Schleef
2001-04-09 17:57     ` Dan Malek
2001-04-09 20:10     ` Dan Malek

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=20010406071644.A2517@stm.lbl.gov \
    --to=ds@schleef.org \
    --cc=linuxppc-dev@lists.linuxppc.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;
as well as URLs for NNTP newsgroup(s).