All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: netdev@oss.sgi.com
Cc: "David S. Miller" <davem@redhat.com>
Subject: [PATCH] tg3 shutdown sequence update
Date: Mon, 25 Nov 2002 01:34:16 -0500	[thread overview]
Message-ID: <3DE1C468.1060806@pobox.com> (raw)

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

This patch is only for testing and comment, _not_ for applying.
(testers requested)

The attached patch updates the tg3 net driver shutdown sequence to be a 
bit more correct WRT the documented sequence.  Detailed changes:

* bail out of tg3_stop_block ASAP if block is already disabled
* use standard tg3_stop_block to disable RX MAC mode.  this adds polling 
of the the enable bit to the standard code.
* just in case, shut down DMA completion between send data completion 
shutdown and send DB completion shutdown
* use standard tg3_stop_block to disable TX MAC mode.
* don't bother to disable MAC_MODE_TDE_ENABLE bit manually, TX MAC mode 
disable does it for us.
* add PCI posting flush for flow-through queues

Does this look ok WRT errata and hardware seen in the field?

One potential concern is that the error handling if tg3_stop_block fails 
runs through all the blocks unconditionally, and then returns an error. 
  It does not bail early if some of the stop-block calls fail.

Comments?

	Jeff



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


--- drivers/net/tg3.c.~1~	Tue Nov 19 15:30:41 2002
+++ drivers/net/tg3.c	Tue Nov 19 15:31:34 2002
@@ -2367,6 +2367,7 @@
 	unsigned int i;
 	u32 len, entry, base_flags, mss;
 	int would_hit_hwbug;
+	unsigned long flags;
 
 	len = (skb->len - skb->data_len);
 
@@ -2389,12 +2390,12 @@
 	 * So we really do need to disable interrupts when taking
 	 * tx_lock here.
 	 */
-	spin_lock_irq(&tp->tx_lock);
+	spin_lock_irqsave(&tp->tx_lock, flags);
 
 	/* This is a hard error, log it. */
 	if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
 		netif_stop_queue(dev);
-		spin_unlock_irq(&tp->tx_lock);
+		spin_unlock_irqrestore(&tp->tx_lock, flags);
 		printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n",
 		       dev->name);
 		return 1;
@@ -2535,7 +2536,7 @@
 		netif_stop_queue(dev);
 
 out_unlock:
-	spin_unlock_irq(&tp->tx_lock);
+	spin_unlock_irqrestore(&tp->tx_lock, flags);
 
 	dev->trans_start = jiffies;
 
@@ -2547,6 +2548,7 @@
 	struct tg3 *tp = dev->priv;
 	dma_addr_t mapping;
 	u32 len, entry, base_flags, mss;
+	unsigned long flags;
 
 	len = (skb->len - skb->data_len);
 
@@ -2569,12 +2571,12 @@
 	 * So we really do need to disable interrupts when taking
 	 * tx_lock here.
 	 */
-	spin_lock_irq(&tp->tx_lock);
+	spin_lock_irqsave(&tp->tx_lock, flags);
 
 	/* This is a hard error, log it. */
 	if (unlikely(TX_BUFFS_AVAIL(tp) <= (skb_shinfo(skb)->nr_frags + 1))) {
 		netif_stop_queue(dev);
-		spin_unlock_irq(&tp->tx_lock);
+		spin_unlock_irqrestore(&tp->tx_lock, flags);
 		printk(KERN_ERR PFX "%s: BUG! Tx Ring full when queue awake!\n",
 		       dev->name);
 		return 1;
@@ -2665,7 +2667,7 @@
 	if (TX_BUFFS_AVAIL(tp) <= (MAX_SKB_FRAGS + 1))
 		netif_stop_queue(dev);
 
-	spin_unlock_irq(&tp->tx_lock);
+	spin_unlock_irqrestore(&tp->tx_lock, flags);
 
 	dev->trans_start = jiffies;
 


             reply	other threads:[~2002-11-25  6:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-25  6:34 Jeff Garzik [this message]
2002-11-25  6:38 ` [PATCH] tg3 shutdown sequence update David S. Miller
2002-11-25  6:40 ` Jeff Garzik
2002-11-25  6:48 ` [PATCH] tg3 shutdown sequence update (try 2) Jeff Garzik

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=3DE1C468.1060806@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.