Skip to contentSkip to conversation

tg3: Remove unnecessary tx_lock

PATCH Applied Michael Chan 3 participants 3 messages Jun 5, 2006 – Jun 18, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 tg3: Remove unnecessary tx_lock

Remove tx_lock where it is unnecessary. tg3 runs lockless and so it requires interrupts to be disabled and sync'ed, netif_queue and NAPI poll to be stopped before the device can be reconfigured. After stopping everything, it is no longer necessary to get the tx_lock.

drivers/net/tg3.c +0 -4
index f2382aa..4cda2af 100644
@@ -2984,9 +2984,7 @@ static void tg3_tx_recover(struct tg3 *t
 	       "and include system chipset information.\n", tp->dev->name);
 
 	spin_lock(&tp->lock);
-	spin_lock(&tp->tx_lock);
 	tp->tg3_flags |= TG3_FLAG_TX_RECOVERY_PENDING;
-	spin_unlock(&tp->tx_lock);
 	spin_unlock(&tp->lock);
 }
 
@@ -3429,12 +3427,10 @@ static inline void tg3_full_lock(struct 
 	if (irq_sync)
 		tg3_irq_quiesce(tp);
 	spin_lock_bh(&tp->lock);
-	spin_lock(&tp->tx_lock);
 }
 
 static inline void tg3_full_unlock(struct tg3 *tp)
 {
-	spin_unlock(&tp->tx_lock);
 	spin_unlock_bh(&tp->lock);
 }
 
#1 lore raw
Quoted 4 lines · Michael Chan

Remove tx_lock where it is unnecessary. tg3 runs lockless and so it requires interrupts to be disabled and sync'ed, netif_queue and NAPI poll to be stopped before the device can be reconfigured. After stopping everything, it is no longer necessary to get the tx_lock.

The paths where full lock is preceded by netif_tx_disable are obviously safe (well, once you take off the LLTX flag anyway). However, there are paths that don't do netif_tx_disable (e.g., tg3_set_rx_mode), are they safe as well?

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer Applied
#2 lore raw
In reply to Michael Chan

From: "Michael Chan" <[email protected]>
Date: Mon, 05 Jun 2006 12:47:23 -0700

Quoted 6 lines

Remove tx_lock where it is unnecessary. tg3 runs lockless and so it requires interrupts to be disabled and sync'ed, netif_queue and NAPI poll to be stopped before the device can be reconfigured. After stopping everything, it is no longer necessary to get the tx_lock.

Applied, thanks.