Skip to contentSkip to conversation

gso: Fix reversed error test in netif_tx_trylock

NET Herbert Xu 1 participant 1 message Jul 20, 2006

lore
Share & tools
lore

Herbert Xu

author
#0 lore raw

Hi Keir:

Here is a bug fix that just got merged upstream that affects the GSO patch as well.

[NET] gso: Fix reversed error test in netif_tx_trylock

Original changelog:

[NET]: Fix reversed error test in netif_tx_trylock

A non-zero return value indicates success from spin_trylock, not error.

Thanks,

Signature · 31 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
--
diff -r bbabdebc54ad patches/linux-2.6.16.13/net-gso.patch
--- a/patches/linux-2.6.16.13/net-gso.patch	Wed Jul 19 21:13:36 2006 +0100
+++ b/patches/linux-2.6.16.13/net-gso.patch	Thu Jul 20 23:06:23 2006 +1000
@@ -837,7 +837,7 @@ index 93535f0..9269df7 100644
  /* compatibility with older code */
  #define SPARC_ETH_GSET		ETHTOOL_GSET
 diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
-index 7fda03d..9865736 100644
+index 7fda03d..f2fbeb7 100644
 --- a/include/linux/netdevice.h
 +++ b/include/linux/netdevice.h
 @@ -230,7 +230,8 @@ enum netdev_state_t
@@ -927,10 +927,10 @@ index 7fda03d..9865736 100644
 +
 +static inline int netif_tx_trylock(struct net_device *dev)
 +{
-+	int err = spin_trylock(&dev->_xmit_lock);
-+	if (!err)
++	int ok = spin_trylock(&dev->_xmit_lock);
++	if (likely(ok))
 +		dev->xmit_lock_owner = smp_processor_id();
-+	return err;
++	return ok;
 +}
 +
 +static inline void netif_tx_unlock(struct net_device *dev)