Netdev List
 help / color / mirror / Atom feed
* Bonding : Monitoring of 4965 wireless card
From: patnel972-linux @ 2008-01-09  9:00 UTC (permalink / raw)
  To: netdev

Hi,

I want to make a bond with my wireless card. The ipw driver create two
 interfaces (wlan0 and wmaster0). When i switch the rf_kill button,
 ifplug detect wlan0 unplugged but not wmaster0. If i down wlan0 (while
 rf_kil ), bonding detect the inactivity when i up the interface.

Have you some idea where is the problem? the driver or the miimon of
 the module?

my module parameters mode=1 miimon=100 primary eth0

Thanks



      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr

^ permalink raw reply

* Re: [Patch 2.6.22.2 ] : drivers/net/via-rhine.c:   Offload checksum handling to VT6105M
From: Roger Luethi @ 2008-01-09  9:13 UTC (permalink / raw)
  To: Willy Tarreau; +Cc: K Naru, linux-kernel, netdev
In-Reply-To: <20071230223354.GA28568@1wt.eu>

[top posting because context may be missing otherwise, over a week later]

Excellent analysis, Willy. Quite frankly, I am not keen on making this
driver any more complex, especially if the gains are marginal at best. VIA
Rhine will never be high-performance hardware, and we have too much special
casing already.

Patches to fix actual problems (such as the recent irq init work by Dave
Jones) are much more interesting to me (and presumably to most via-rhine
users).

Roger

On Sun, 30 Dec 2007 23:33:54 +0100, Willy Tarreau wrote:
> Hi Kim,
> 
> On Fri, Aug 17, 2007 at 11:34:37AM -0700, K Naru wrote:
> > From: Kim Naru (squat_rack@yahoo.com)
> > 
> > Added support to offload TCP/UDP/IP checksum to the
> > VIA Technologies VT6105M chip.
> > Firstly, let the stack know this chip is capable of
> > doing its own checksum(IPV4 only).
> > Secondly offload checksum to VT6105M, if necessary. 
> > 
> > 
> > Verbose Mode:
> > 
> > #1. Define 3 bits(18,19,20) in Transmit Descriptor 1
> > of chip, which affect checksum processing.
> > The prefix(TDES1) for the 3 variables is the short
> > name for Transmit Descriptior 1.
> > #2. In rhine_init_one(), if pci_rev >=  VT6105M then
> > set  NETIF_F_IP_CSUM(see skbuff.h for details).
> > #3. In rhine_start_tx() if NETIF_F_IP_CSUM is set AND
> > the stack requires a checksum then
> > set either bit 19(UDP),20(TCP) AND bit 18(IP).
> > 
> > Note : The numbered items above(i.e.#1,#2,#3) denote
> > pseudo code.
> > 
> > This patch was developed and tested on Imedia
> > linux-2.6.20 under a PC-Engines Alix System board
> > (www.pcengines.ch/alix.htm). It was tested(compilation
> > only) on linux-2.6.22.2. The minor code change between
> > 2.6.20 and 2.6.22 is the use of ip_hdr() in 2.26.22.
> > 
> > In 2.6.20 :
> >                 struct iphdr *ip = skb->nh.iph;
> > In 2.6.22 :
> >                 const struct iphdr *ip = ip_hdr(skb);
> > 
> > Testing:
> > 
> > 
> > ttcp,netperf ftp and top  where used. There appears to
> > be a small CPU utilization gain. Throughput results 
> > where more inconclusive.
> > 
> > The data sheet used to get information is 'VT6105M
> > Data Sheet, Revision 1.63  June21,2006'.
> > 
> > Signed-off-by: Kim Naru (squat_rack@yahoo.com)
> > 
> > ---
> 
> Well, I've reformated your patch so that it can be applied, and very
> slightly arranged it in order to save 13 bytes of code and a few CPU
> cycles.
> 
> Also, I moved the if block before the spinlock as there is no reason
> for this code to be run with the lock held.
> 
> I have run some performance measurements on an ALIX 3C2 motherboard
> with a 2.6.22-stable kernel. What I see is a reduction of CPU usage
> by about 20% when the network is saturated, but also a reduction of
> the network speed by 8%!
> 
> Without the patch, I can produce a continuous traffic of about 99 Mbps with
> about 11% CPU (system only, 89% idle).
> 
> With the patch, the traffic drops to 91 Mbps but CPU usage decreases to 9%.
> 
> Now, if I reduce the MTU to exactly 1000, then the traffic increases to about
> 98 Mbps, but it progressively reduces when the MTU moves away from 1000.
> 
> So I have run some deeper tests consisting in leaving NETIF_F_IP_CSUM unset
> and still asking the NIC to compute the checksums. The conclusion is very
> clear: as soon as *any* checksum bit is set (IP, TCP, UDP), the traffic
> immediately drops.
> 
> I think that what happens is that the NIC is not pipelined at all and that
> no data is transferred while a checksum is being computed. This would also
> explain why reducing the MTU increases performance, since it reduces the
> time required to compute a checksum, reducing the off time. And the more I
> think about it, the more I think this is the problem, because the VT6105M
> has a 2kB transmit buffer, so it cannot checksum a 1.5kB frame while sending
> another one if it does it inside the buffer.
> 
> And I'm pretty sure that the checksum is computed in the buffer and that the
> data is not transferred twice on the bus, because playing with PCI latency
> timer and other parameters does not change anything.
> 
> So basically, we're there with a chip which can offload the CPU by performing
> the checksums itself, but it reduces performance for packets larger than 1kB
> (or possibly 500 bytes if there's a 1.5kB packet being transferred).
> 
> The driver should be adjusted to permit the user to enable and disable this
> feature with ethtool. Right now, its status can only be consulted, and I'm
> using dd on /dev/mem and /dev/kmem to change the values on the fly.
> 
> Given the fact that a 20% reduction on CPU usage which was already 10% only
> leaves a net gain of about 2% more CPU available, I'm not convinced that there
> is any advantage in enabling this feature by default with this NIC.
> 
> Here's the updated patch for reference (maybe you'd want to enhance it).
> 
> --- linux-2.6.22-wt3/drivers/net/via-rhine.c	2007-11-22 17:48:34 +0100
> +++ linux-2.6.22-wt3.via-cksum/drivers/net/via-rhine.c	2007-12-30 20:53:30 +0100
> @@ -95,6 +95,8 @@
>  #include <linux/netdevice.h>
>  #include <linux/etherdevice.h>
>  #include <linux/skbuff.h>
> +#include <linux/in.h>
> +#include <linux/ip.h>
>  #include <linux/init.h>
>  #include <linux/delay.h>
>  #include <linux/mii.h>
> @@ -343,6 +345,9 @@
>  
>  /* Initial value for tx_desc.desc_length, Buffer size goes to bits 0-10 */
>  #define TXDESC		0x00e08000
> +#define TDES1_TCPCK	0x00100000  /* Bit 20, Transmit Desc 1  */
> +#define TDES1_UDPCK	0x00080000  /* Bit 19, Transmit Desc 1  */
> +#define TDES1_IPCK	0x00040000  /* Bit 18, Transmit Desc 1  */
>  
>  enum rx_status_bits {
>  	RxOK=0x8000, RxWholePkt=0x0300, RxErr=0x008F
> @@ -788,6 +793,9 @@
>  	if (rp->quirks & rqRhineI)
>  		dev->features |= NETIF_F_SG|NETIF_F_HW_CSUM;
>  
> +	if (pci_rev >=  VT6105M)
> +		dev->features |= NETIF_F_IP_CSUM;   /* chip does checksum */
> +
>  	/* dev->name not defined before register_netdev()! */
>  	rc = register_netdev(dev);
>  	if (rc)
> @@ -1260,6 +1268,18 @@
>  	rp->tx_ring[entry].desc_length =
>  		cpu_to_le32(TXDESC | (skb->len >= ETH_ZLEN ? skb->len : ETH_ZLEN));
>  
> +	if ((dev->features & NETIF_F_IP_CSUM) &&
> +	    (skb->ip_summed == CHECKSUM_PARTIAL)) {
> +		/* Offload checksum to chip. */
> +		const struct iphdr *ip = ip_hdr(skb);
> +		unsigned long flag;
> +
> +		flag = (ip->protocol == IPPROTO_TCP) ? TDES1_TCPCK|TDES1_IPCK :
> +		       (ip->protocol == IPPROTO_UDP) ? TDES1_UDPCK|TDES1_IPCK :
> +		       TDES1_IPCK;
> +		rp->tx_ring[entry].desc_length |= flag;
> +	}
> +
>  	/* lock eth irq */
>  	spin_lock_irq(&rp->lock);
>  	wmb();
> 
> Best regards,
> Willy
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
If you make people think they're thinking, they'll love you;
but if you really make them think they'll hate you.

^ permalink raw reply

* Re: SACK scoreboard
From: Evgeniy Polyakov @ 2008-01-09  9:47 UTC (permalink / raw)
  To: Andi Kleen
  Cc: David Miller, jheffner, ilpo.jarvinen, lachlan.andrew, netdev,
	quetchen
In-Reply-To: <20080109070318.GA8581@one.firstfloor.org>

Hi.

On Wed, Jan 09, 2008 at 08:03:18AM +0100, Andi Kleen (andi@firstfloor.org) wrote:
> > It adds severe spikes in CPU utilization that are even moderate
> > line rates begins to affect RTTs.
> > 
> > Or do you think it's OK to process 500,000 SKBs while locked
> > in a software interrupt.
> 
> You can always push it into a work queue.  Even put it to
> other cores if you want. 
> 
> In fact this is already done partly for the ->completion_queue.
> Wouldn't be a big change to queue it another level down.
> 
> Also even freeing a lot of objects doesn't have to be
> that expensive. I suspect the most cost is in taking
> the slab locks, but that could be batched. Without
> that the kmem_free fast path isn't particularly
> expensive, as long as the headers are still in cache.

Postponing freeing of the skb has major drawbacks. Some time ago I
made a patch to postpone skb freeing behind rcu and got 2.5 times slower
connection speed on some machines with decreased CPU usage though.
So, queueing solution has to be proven with real data and although it
looks good in one situation, it can be really bad in another.

For interested reader: results of the RCUfication of the kfree_skbmem()
http://tservice.net.ru/~s0mbre/blog/devel/networking/2006/12/05

-- 
	Evgeniy Polyakov

^ permalink raw reply

* Re: [NET] ROUTE: fix rcu_dereference() uses in /proc/net/rt_cache
From: Herbert Xu @ 2008-01-09  9:46 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Paul E. McKenney, davem, dipankar, netdev
In-Reply-To: <47847A10.1020508@cosmosbay.com>

On Wed, Jan 09, 2008 at 08:38:56AM +0100, Eric Dumazet wrote:
> 
> I am not sure this is valid, since it will do this :
> 
> r = rt_hash_table[st->bucket].chain;
> if (r)
>     return rcu_dereference(r);
> 
> So compiler might be dumb enough do dereference 
> &rt_hash_table[st->bucket].chain two times.

That wouldn't be a problem at all.  The key is to add a barrier between
reading the pointer:

	r = rt_hash_table[st->bucket].chain

and dereferencing it later, e.g.,

	r->u.dst.rt_next

The barrier is there so that when we dereference r we don't read
stale cache that was there before the memory at r was initialised.
How many times you read the pointer value before the barrier is
irrelevant to the effectiveness of the barrier preceding the
dereference.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* Re: make ipv6_sysctl_register to return a value
From: Daniel Lezcano @ 2008-01-09  9:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20080109.002632.136758957.davem@davemloft.net>

David Miller wrote:
> Why did you post this again?  It's identical to patch 1/9
> from the previous series you sent out.
> 
> This is confusing, since it makes me think you wanted me to
> perhaps do something different or update an already
> submitted patch.

I thought you was expecting a new netns ipv6 sysctl series and ignored 
the current one. While I was looking at them again I found a problem and 
I wanted to fix that before resending. In the meantime, there were three 
independant trivial patches I wanted to send as a pre-requesite for the 
incoming sysctl patches. Bad idea ... :)

  - make ipv6_sysctl_register to return a value
  - make a subsystem for af_inet6
  - add ipv6 structure for netns

With the sysctl Pavel's patch, the first one does not apply.

To clear out any confusion, please can you just ignore all my previous 
patches, I will resend a new serie rebased on the work done by Pavel.

Sorry for the inconvenience.

Thanks.

   -- Daniel


^ permalink raw reply

* [PATCH] AX25: kill user triggable printks
From: maximilian attems @ 2008-01-09 10:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, maximilian attems

sfuzz can easily trigger any of those.

move the printk message to the corresponding comment:
makes the intention of the code clear and easy
to pick up on an scheduled removal.
as bonus simplify the braces placement.

Signed-off-by: maximilian attems <max@stro.at>
---
 net/ax25/af_ax25.c |   39 ++++++++++++++++++---------------------
 1 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 8378afd..9b04b48 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1109,21 +1109,19 @@ static int __must_check ax25_connect(struct socket *sock,
 	 * some sanity checks. code further down depends on this
 	 */
 
-	if (addr_len == sizeof(struct sockaddr_ax25)) {
-		/* support for this will go away in early 2.5.x */
-		printk(KERN_WARNING "ax25_connect(): %s uses obsolete socket structure\n",
-			current->comm);
-	}
-	else if (addr_len != sizeof(struct full_sockaddr_ax25)) {
-		/* support for old structure may go away some time */
+	if (addr_len == sizeof(struct sockaddr_ax25))
+		/* support for this will go away in early 2.5.x
+		 * ax25_connect(): uses obsolete socket structure
+		 */
+		;
+	else if (addr_len != sizeof(struct full_sockaddr_ax25))
+		/* support for old structure may go away some time
+		 * ax25_connect(): uses old (6 digipeater) socket structure.
+		 */
 		if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
-		    (addr_len > sizeof(struct full_sockaddr_ax25))) {
+		    (addr_len > sizeof(struct full_sockaddr_ax25)))
 			return -EINVAL;
-		}
 
-		printk(KERN_WARNING "ax25_connect(): %s uses old (6 digipeater) socket structure.\n",
-			current->comm);
-	}
 
 	if (fsa->fsa_ax25.sax25_family != AF_AX25)
 		return -EINVAL;
@@ -1467,21 +1465,20 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
 			goto out;
 		}
 
-		if (addr_len == sizeof(struct sockaddr_ax25)) {
-			printk(KERN_WARNING "ax25_sendmsg(): %s uses obsolete socket structure\n",
-				current->comm);
-		}
-		else if (addr_len != sizeof(struct full_sockaddr_ax25)) {
-			/* support for old structure may go away some time */
+		if (addr_len == sizeof(struct sockaddr_ax25))
+			/* ax25_sendmsg(): uses obsolete socket structure */
+			;
+		else if (addr_len != sizeof(struct full_sockaddr_ax25))
+			/* support for old structure may go away some time
+			 * ax25_sendmsg(): uses old (6 digipeater)
+			 * socket structure.\n",
+			 */
 			if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
 			    (addr_len > sizeof(struct full_sockaddr_ax25))) {
 				err = -EINVAL;
 				goto out;
 			}
 
-			printk(KERN_WARNING "ax25_sendmsg(): %s uses old (6 digipeater) socket structure.\n",
-				current->comm);
-		}
 
 		if (addr_len > sizeof(struct sockaddr_ax25) && usax->sax25_ndigis != 0) {
 			int ct           = 0;
-- 
debian.1.5.3.7.1-dirty


^ permalink raw reply related

* Re: [PATCH] AX25: kill user triggable printks
From: maximilian attems @ 2008-01-09 10:15 UTC (permalink / raw)
  To: davem; +Cc: netdev
In-Reply-To: <1199873483-8844-1-git-send-email-max@stro.at>

On Wed, Jan 09, 2008 at 11:11:23AM +0100, maximilian attems wrote:
> +			/* support for old structure may go away some time
> +			 * ax25_sendmsg(): uses old (6 digipeater)
> +			 * socket structure.\n",
> +			 */
urrgs overseen \n",
will resend in a second.

-- 
maks

^ permalink raw reply

* Re: [PATCH 0/3] bonding: 3 fixes for 2.6.24
From: Krzysztof Oledzki @ 2008-01-09  9:36 UTC (permalink / raw)
  To: Jay Vosburgh
  Cc: netdev, Jeff Garzik, David Miller, Andy Gospodarek, Herbert Xu
In-Reply-To: <17850.1199865514@death>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 800 bytes --]



On Tue, 8 Jan 2008, Jay Vosburgh wrote:

> Krzysztof Oledzki <olel@ans.pl> wrote:
>
>> Fine. Just let you know that someone test your patches and everything
>> works, except mentioned problem.
>
> 	And I appreciate it; I just wanted to make sure our many fans
> following along at home didn't misunderstand.
>
> 	Could you let me know if the patch below make the lockdep
> warning go away?  This applies on top of the previous three, although it
> should be trivial to do by hand.
>
> 	I'm still checking to make sure this is safe with regard to
> mutexing the bonding structures, but it would be good to know if it
> eliminates the warning.

I can confirm that the warning went away.

Tested-by: Krzysztof Piotr Oledzki <ole@ans.pl>

Best regards,

 				Krzysztof Olędzki

^ permalink raw reply

* [PATCH v3] AX25: kill user triggable printks
From: maximilian attems @ 2008-01-09 10:21 UTC (permalink / raw)
  To: davem; +Cc: netdev, maximilian attems

sfuzz can easily trigger any of those.

move the printk message to the corresponding comment:
makes the intention of the code clear and easy
to pick up on an scheduled removal.
as bonus simplify the braces placement.

Signed-off-by: maximilian attems <max@stro.at>
---
 net/ax25/af_ax25.c |   39 ++++++++++++++++++---------------------
 1 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 8378afd..ecb14ee 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1109,21 +1109,19 @@ static int __must_check ax25_connect(struct socket *sock,
 	 * some sanity checks. code further down depends on this
 	 */
 
-	if (addr_len == sizeof(struct sockaddr_ax25)) {
-		/* support for this will go away in early 2.5.x */
-		printk(KERN_WARNING "ax25_connect(): %s uses obsolete socket structure\n",
-			current->comm);
-	}
-	else if (addr_len != sizeof(struct full_sockaddr_ax25)) {
-		/* support for old structure may go away some time */
+	if (addr_len == sizeof(struct sockaddr_ax25))
+		/* support for this will go away in early 2.5.x
+		 * ax25_connect(): uses obsolete socket structure
+		 */
+		;
+	else if (addr_len != sizeof(struct full_sockaddr_ax25))
+		/* support for old structure may go away some time
+		 * ax25_connect(): uses old (6 digipeater) socket structure.
+		 */
 		if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
-		    (addr_len > sizeof(struct full_sockaddr_ax25))) {
+		    (addr_len > sizeof(struct full_sockaddr_ax25)))
 			return -EINVAL;
-		}
 
-		printk(KERN_WARNING "ax25_connect(): %s uses old (6 digipeater) socket structure.\n",
-			current->comm);
-	}
 
 	if (fsa->fsa_ax25.sax25_family != AF_AX25)
 		return -EINVAL;
@@ -1467,21 +1465,20 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
 			goto out;
 		}
 
-		if (addr_len == sizeof(struct sockaddr_ax25)) {
-			printk(KERN_WARNING "ax25_sendmsg(): %s uses obsolete socket structure\n",
-				current->comm);
-		}
-		else if (addr_len != sizeof(struct full_sockaddr_ax25)) {
-			/* support for old structure may go away some time */
+		if (addr_len == sizeof(struct sockaddr_ax25))
+			/* ax25_sendmsg(): uses obsolete socket structure */
+			;
+		else if (addr_len != sizeof(struct full_sockaddr_ax25))
+			/* support for old structure may go away some time
+			 * ax25_sendmsg(): uses old (6 digipeater)
+			 * socket structure.
+			 */
 			if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
 			    (addr_len > sizeof(struct full_sockaddr_ax25))) {
 				err = -EINVAL;
 				goto out;
 			}
 
-			printk(KERN_WARNING "ax25_sendmsg(): %s uses old (6 digipeater) socket structure.\n",
-				current->comm);
-		}
 
 		if (addr_len > sizeof(struct sockaddr_ax25) && usax->sax25_ndigis != 0) {
 			int ct           = 0;
-- 
debian.1.5.3.7.1-dirty


^ permalink raw reply related

* [ATM]: Check IP header validity in mpc_send_packet
From: Herbert Xu @ 2008-01-09 10:27 UTC (permalink / raw)
  To: David S. Miller, netdev; +Cc: Al Viro, Chas Williams

Hi Dave:

[ATM]: Check IP header validity in mpc_send_packet

Al went through the ip_fast_csum callers and found this piece of code
that did not validate the IP header.  While root crashing the machine
by sending bogus packets through raw or AF_PACKET sockets isn't that
serious, it is still nice to react gracefully.

This patch ensures that the skb has enough data for an IP header and
that the header length field is valid.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 2086396..9c7f712 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -542,6 +542,13 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev)
 	if (eth->h_proto != htons(ETH_P_IP))
 		goto non_ip; /* Multi-Protocol Over ATM :-) */
 
+	/* Weed out funny packets (e.g., AF_PACKET or raw). */
+	if (skb->len < ETH_HLEN + sizeof(struct iphdr))
+		goto non_ip;
+	skb_set_network_header(skb, ETH_HLEN);
+	if (skb->len < ETH_HLEN + ip_hdr(skb)->ihl * 4 || ip_hdr(skb)->ihl < 5)
+		goto non_ip;
+
 	while (i < mpc->number_of_mps_macs) {
 		if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN)))
 			if ( send_via_shortcut(skb, mpc) == 0 )           /* try shortcut */

^ permalink raw reply related

* Re: [NET] ROUTE: fix rcu_dereference() uses in /proc/net/rt_cache
From: Eric Dumazet @ 2008-01-09 10:37 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Paul E. McKenney, davem, dipankar, netdev
In-Reply-To: <20080109094637.GA28874@gondor.apana.org.au>

On Wed, 9 Jan 2008 20:46:37 +1100
Herbert Xu <herbert@gondor.apana.org.au> wrote:

> On Wed, Jan 09, 2008 at 08:38:56AM +0100, Eric Dumazet wrote:
> > 
> > I am not sure this is valid, since it will do this :
> > 
> > r = rt_hash_table[st->bucket].chain;
> > if (r)
> >     return rcu_dereference(r);
> > 
> > So compiler might be dumb enough do dereference 
> > &rt_hash_table[st->bucket].chain two times.
> 
> That wouldn't be a problem at all.  The key is to add a barrier between
> reading the pointer:
> 
> 	r = rt_hash_table[st->bucket].chain
> 
> and dereferencing it later, e.g.,
> 
> 	r->u.dst.rt_next
> 
> The barrier is there so that when we dereference r we don't read
> stale cache that was there before the memory at r was initialised.
> How many times you read the pointer value before the barrier is
> irrelevant to the effectiveness of the barrier preceding the
> dereference.

You are absolutely right Herbert, so I changed the patch to :

[NET] ROUTE: fix rcu_dereference() uses in /proc/net/rt_cache

In rt_cache_get_next(), no need to guard seq->private by a rcu_dereference()
since seq is private to the thread running this function. Reading seq.private
once (as guaranted bu rcu_dereference()) or several time if compiler really is 
dumb enough wont change the result.

But we miss real spots where rcu_dereference() are needed, both in 
rt_cache_get_first() and rt_cache_get_next()

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index d337706..28484f3 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -283,12 +283,12 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq)
 			break;
 		rcu_read_unlock_bh();
 	}
-	return r;
+	return rcu_dereference(r);
 }
 
 static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r)
 {
-	struct rt_cache_iter_state *st = rcu_dereference(seq->private);
+	struct rt_cache_iter_state *st = seq->private;
 
 	r = r->u.dst.rt_next;
 	while (!r) {
@@ -298,7 +298,7 @@ static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r)
 		rcu_read_lock_bh();
 		r = rt_hash_table[st->bucket].chain;
 	}
-	return r;
+	return rcu_dereference(r);
 }
 
 static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos)

^ permalink raw reply related

* [PATCH 0/5] iwlwifi: iwl3945 fix races, getting rid of sleep from context
From: Joonwoo Park @ 2008-01-09 11:01 UTC (permalink / raw)
  To: Zhu Yi, netdev; +Cc: linux-wireless, lkml, Joonwoo Park, ipw3945-devel

Hello,
This patchset does fix iwl3945's races and some other stuff.
For now it works for just iwl3945 but if some of them is needed for iwl4965, I would work for it.

patch against 2.6.24-rc7

[PATCH 1/5] iwlwifi: iwl3945 flush interrupt mask
[PATCH 2/5] iwlwifi: iwl3945 synchronize interrupt and tasklet for down iwlwifi
[PATCH 3/5] iwlwifi: iwl3945 fix oops while pci remove
[PATCH 4/5] iwlwifi: iwl3945 eliminate sleepable task queue from context
[PATCH 5/5] iwlwifi: iwl3945 switch private workqueue to ieee80211->workqueue

Thanks,
Joonwoo

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply

* [PATCH 1/5] iwlwifi: iwl3945 flush interrupt mask
From: Joonwoo Park @ 2008-01-09 11:02 UTC (permalink / raw)
  To: Zhu Yi, netdev; +Cc: linux-wireless, lkml, Joonwoo Park, ipw3945-devel

After enabling/disabling interrupts flushing is required

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
---
 drivers/net/wireless/iwlwifi/iwl-io.h       |    2 ++
 drivers/net/wireless/iwlwifi/iwl3945-base.c |    6 ++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h
index 8a8b96f..f2bc30e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -87,6 +87,8 @@ static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs)
 #define iwl_read32(p, o) _iwl_read32(p, o)
 #endif
 
+#define iwl_flush32(iwl, ofs) iwl_read32(iwl, ofs)
+
 static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr,
 				u32 bits, u32 mask, int timeout)
 {
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 8ed898d..85f1112 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -4410,6 +4410,7 @@ static void iwl_enable_interrupts(struct iwl_priv *priv)
 	IWL_DEBUG_ISR("Enabling interrupts\n");
 	set_bit(STATUS_INT_ENABLED, &priv->status);
 	iwl_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK);
+	iwl_flush32(priv, CSR_INT_MASK);
 }
 
 static inline void iwl_disable_interrupts(struct iwl_priv *priv)
@@ -4418,11 +4419,15 @@ static inline void iwl_disable_interrupts(struct iwl_priv *priv)
 
 	/* disable interrupts from uCode/NIC to host */
 	iwl_write32(priv, CSR_INT_MASK, 0x00000000);
+	iwl_flush32(priv, CSR_INT_MASK);
 
 	/* acknowledge/clear/reset any interrupts still pending
 	 * from uCode or flow handler (Rx/Tx DMA) */
 	iwl_write32(priv, CSR_INT, 0xffffffff);
+	iwl_flush32(priv, CSR_INT);
 	iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff);
+	iwl_flush32(priv, CSR_FH_INT_STATUS);
+
 	IWL_DEBUG_ISR("Disabled interrupts\n");
 }
 
@@ -4840,6 +4845,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
 	 * If we *don't* have something, we'll re-enable before leaving here. */
 	inta_mask = iwl_read32(priv, CSR_INT_MASK);  /* just for debug */
 	iwl_write32(priv, CSR_INT_MASK, 0x00000000);
+	iwl_flush32(priv, CSR_INT_MASK);
 
 	/* Discover which interrupts are active/pending */
 	inta = iwl_read32(priv, CSR_INT);
-- 
1.5.3.rc5


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related

* [PATCH 2/5] iwlwifi: iwl3945 synchronize interrupt and tasklet for down iwlwifi
From: Joonwoo Park @ 2008-01-09 11:02 UTC (permalink / raw)
  To: Zhu Yi, netdev; +Cc: linux-wireless, lkml, Joonwoo Park, ipw3945-devel

After disabling interrupts, it's possible irq & tasklet is pending or running
This patch eleminates races for down iwlwifi

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
---
 drivers/net/wireless/iwlwifi/iwl3945-base.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index c97448d..3986aaf 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6262,6 +6262,10 @@ static void __iwl_down(struct iwl_priv *priv)
 	/* tell the device to stop sending interrupts */
 	iwl_disable_interrupts(priv);
 
+	/* synchronize irq and tasklet */
+	synchronize_irq(priv->pci_dev->irq);
+	tasklet_kill(&priv->irq_tasklet);
+
 	if (priv->mac80211_registered)
 		ieee80211_stop_queues(priv->hw);
 
-- 
1.5.3.rc5


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related

* [PATCH 3/5] iwlwifi: iwl3945 fix oops while pci remove
From: Joonwoo Park @ 2008-01-09 11:02 UTC (permalink / raw)
  To: Zhu Yi, netdev; +Cc: linux-wireless, lkml, Joonwoo Park, ipw3945-devel

The nic controller's clock on/off irq (CSR_INT_BIT_MAC_CLK_ACTV) is generated when device goes on/off
Unlikely turning on the device, irq by off the device may cause oops because iwl_pci_remove already freed required resources
The irq_tasklet should not be invoked at that condition

$sudo modprobe -r iwl3945
 BUG: unable to handle kernel paging request at virtual address f8864008
 printing eip: f8b633bd *pdpt = 0000000000003001 *pde = 0000000037c12067 *pte = 0000000000000000
 Oops: 0000 [#1] SMP
 Modules linked in: netconsole iwl3945 e1000

 EIP is at iwl_irq_tasklet+0x82d/0x1010 [iwl3945]
 ...

 Call Trace:
  [<c40053ba>] show_trace_log_lvl+0x1a/0x30
  [<c4005479>] show_stack_log_lvl+0xa9/0xd0
  [<c400556a>] show_registers+0xca/0x1c0
  [<c4005776>] die+0x116/0x230
  [<c4020cbb>] do_page_fault+0x35b/0x7f0
  [<c43eeeda>] error_code+0x72/0x78
  [<c4032ceb>] tasklet_action+0x4b/0xc0
  [<c4032687>] __do_softirq+0x87/0x100
  [<c4032757>] do_softirq+0x57/0x60
  ...
 EIP: [<f8b633bd>] iwl_irq_tasklet+0x82d/0x1010 [iwl3945] SS:ESP 0068:f7c4ff1c
 Kernel panic - not syncing: Fatal exception in interrupt

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
---
 drivers/net/wireless/iwlwifi/iwl3945-base.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 3986aaf..f95f226 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -4867,8 +4867,11 @@ static irqreturn_t iwl_isr(int irq, void *data)
 	IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
 		      inta, inta_mask, inta_fh);
 
+	inta &= ~CSR_INT_BIT_MAC_CLK_ACTV;
+
 	/* iwl_irq_tasklet() will service interrupts and re-enable them */
-	tasklet_schedule(&priv->irq_tasklet);
+	if (likely(inta || inta_fh))
+		tasklet_schedule(&priv->irq_tasklet);
 unplugged:
 	spin_unlock(&priv->lock);
 
-- 
1.5.3.rc5


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related

* [PATCH 4/5] iwlwifi: iwl3945 eliminate sleepable task queue from context
From: Joonwoo Park @ 2008-01-09 11:02 UTC (permalink / raw)
  To: Zhu Yi, netdev; +Cc: linux-wireless, lkml, Joonwoo Park, ipw3945-devel

Eleminiate task queuing of iwl_pci_probe, register hw to ieee80211 immediately

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
---
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   66 +++++++++++++++++---------
 1 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index f95f226..7e8d8b3 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6171,27 +6171,9 @@ static void iwl_alive_start(struct iwl_priv *priv)
 	if (iwl_is_rfkill(priv))
 		return;
 
-	if (!priv->mac80211_registered) {
-		/* Unlock so any user space entry points can call back into
-		 * the driver without a deadlock... */
-		mutex_unlock(&priv->mutex);
-		iwl_rate_control_register(priv->hw);
-		rc = ieee80211_register_hw(priv->hw);
-		priv->hw->conf.beacon_int = 100;
-		mutex_lock(&priv->mutex);
-
-		if (rc) {
-			iwl_rate_control_unregister(priv->hw);
-			IWL_ERROR("Failed to register network "
-				  "device (error %d)\n", rc);
-			return;
-		}
-
-		priv->mac80211_registered = 1;
+	iwl_reset_channel_flag(priv);
 
-		iwl_reset_channel_flag(priv);
-	} else
-		ieee80211_start_queues(priv->hw);
+	ieee80211_start_queues(priv->hw);
 
 	priv->active_rate = priv->rates_mask;
 	priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
@@ -6369,7 +6351,8 @@ static int __iwl_up(struct iwl_priv *priv)
 
 	/* clear (again), then enable host interrupts */
 	iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
-	iwl_enable_interrupts(priv);
+	if (priv->mac80211_registered)
+		iwl_enable_interrupts(priv);
 
 	/* really make sure rfkill handshake bits are cleared */
 	iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
@@ -6887,10 +6870,21 @@ static void iwl_bg_scan_completed(struct work_struct *work)
 
 static int iwl_mac_start(struct ieee80211_hw *hw)
 {
+	int ret;
 	struct iwl_priv *priv = hw->priv;
 
 	IWL_DEBUG_MAC80211("enter\n");
 
+	ret = wait_event_interruptible_timeout(priv->wait_command_queue,
+			iwl_is_ready(priv), HOST_COMPLETE_TIMEOUT);
+
+	if (ret == -ERESTARTSYS)
+		return ret;
+	else if (ret == 0 && !iwl_is_ready(priv)) {
+		IWL_ERROR("IWL ready timeout\n");
+		return -ETIMEDOUT;
+	}
+
 	/* we should be verifying the device is ready to be opened */
 	mutex_lock(&priv->mutex);
 
@@ -8299,6 +8293,19 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv)
 	cancel_work_sync(&priv->beacon_update);
 }
 
+static int iwl_register_hw(struct iwl_priv *priv)
+{
+	int err;
+	IWL_DEBUG_INFO("register_hw\n");
+	iwl_rate_control_register(priv->hw);
+	err = ieee80211_register_hw(priv->hw);
+	if (!err) {
+		priv->hw->conf.beacon_int = 100;
+		priv->mac80211_registered = 1;
+	}
+	return err;
+}
+
 static struct attribute *iwl_sysfs_entries[] = {
 	&dev_attr_antenna.attr,
 	&dev_attr_channels.attr,
@@ -8546,11 +8553,24 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto out_pci_alloc;
 	}
 
+	err = __iwl_up(priv);
+	if (err) {
+		IWL_ERROR("Could not make up interface : %d\n", err);
+		mutex_unlock(&priv->mutex);
+		goto out_pci_alloc;
+	}
+
 	mutex_unlock(&priv->mutex);
 
-	IWL_DEBUG_INFO("Queing UP work.\n");
+	err = iwl_register_hw(priv);
+	if (err) {
+		iwl_rate_control_unregister(priv->hw);
+		IWL_ERROR("Failed to register network "
+			  "device (error %d)\n", err);
+		goto out_pci_alloc;
+	}
 
-	queue_work(priv->workqueue, &priv->up);
+	iwl_enable_interrupts(priv);
 
 	return 0;
 
-- 
1.5.3.rc5


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related

* [PATCH 5/5] iwlwifi: iwl3945 switch private workqueue to ieee80211->workqueue
From: Joonwoo Park @ 2008-01-09 11:03 UTC (permalink / raw)
  To: Zhu Yi, netdev; +Cc: linux-wireless, lkml, Joonwoo Park, ipw3945-devel

The ieee80211 provides workqueue for nic drivers. private workqueue dosen't need anymore
TODO: remove workqueue in iwl_priv

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
---
 drivers/net/wireless/iwlwifi/iwl-3945.c     |    6 ++--
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   53 ++++++++++-----------------
 2 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 3a45fe9..65283e9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -423,7 +423,7 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
 					if (priv->call_post_assoc_from_beacon &&
 					    (priv->iw_mode ==
 						IEEE80211_IF_TYPE_STA))
-						queue_work(priv->workqueue,
+						queue_work(priv->hw->workqueue,
 						    &priv->post_associate.work);
 
 					priv->call_post_assoc_from_beacon = 0;
@@ -452,7 +452,7 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
 				priv->assoc_capability =
 				    le16_to_cpu(mgnt->u.assoc_resp.capab_info);
 				if (priv->beacon_int)
-					queue_work(priv->workqueue,
+					queue_work(priv->hw->workqueue,
 					    &priv->post_associate.work);
 				else
 					priv->call_post_assoc_from_beacon = 1;
@@ -1775,7 +1775,7 @@ void iwl3945_reg_txpower_periodic(struct iwl_priv *priv)
 	iwl_hw_reg_comp_txpower_temp(priv);
 
  reschedule:
-	queue_delayed_work(priv->workqueue,
+	queue_delayed_work(priv->hw->workqueue,
 			   &priv->thermal_periodic, REG_RECALIB_PERIOD * HZ);
 }
 
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 7e8d8b3..bf1fd56 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2248,7 +2248,7 @@ static int iwl_scan_cancel(struct iwl_priv *priv)
 		if (!test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
 			IWL_DEBUG_SCAN("Queuing scan abort.\n");
 			set_bit(STATUS_SCAN_ABORTING, &priv->status);
-			queue_work(priv->workqueue, &priv->abort_scan);
+			queue_work(priv->hw->workqueue, &priv->abort_scan);
 
 		} else
 			IWL_DEBUG_SCAN("Scan abort already in progress.\n");
@@ -2399,7 +2399,7 @@ static int iwl_scan_initiate(struct iwl_priv *priv)
 	priv->scan_start = jiffies;
 	priv->scan_pass_start = priv->scan_start;
 
-	queue_work(priv->workqueue, &priv->request_scan);
+	queue_work(priv->hw->workqueue, &priv->request_scan);
 
 	return 0;
 }
@@ -3014,7 +3014,7 @@ static void iwl_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
 		return;
 	}
 
-	queue_work(priv->workqueue, &priv->restart);
+	queue_work(priv->hw->workqueue, &priv->restart);
 	return;
 }
 
@@ -3389,7 +3389,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
 		} else if (nfreed > 1) {
 			IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index,
 					q->first_empty, q->last_used);
-			queue_work(priv->workqueue, &priv->restart);
+			queue_work(priv->hw->workqueue, &priv->restart);
 		}
 		nfreed++;
 	}
@@ -3489,7 +3489,7 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv,
 	/* We delay the ALIVE response by 5ms to
 	 * give the HW RF Kill time to activate... */
 	if (palive->is_valid == UCODE_VALID_OK)
-		queue_delayed_work(priv->workqueue, pwork,
+		queue_delayed_work(priv->hw->workqueue, pwork,
 				   msecs_to_jiffies(5));
 	else
 		IWL_WARNING("uCode did not respond OK.\n");
@@ -3614,7 +3614,7 @@ static void iwl_rx_beacon_notif(struct iwl_priv *priv,
 
 	if ((priv->iw_mode == IEEE80211_IF_TYPE_AP) &&
 	    (!test_bit(STATUS_EXIT_PENDING, &priv->status)))
-		queue_work(priv->workqueue, &priv->beacon_update);
+		queue_work(priv->hw->workqueue, &priv->beacon_update);
 }
 
 /* Service response to REPLY_SCAN_CMD (0x80) */
@@ -3718,13 +3718,13 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
 	IWL_DEBUG_INFO("Scan took %dms\n",
 		jiffies_to_msecs(elapsed_jiffies(priv->scan_start, jiffies)));
 
-	queue_work(priv->workqueue, &priv->scan_completed);
+	queue_work(priv->hw->workqueue, &priv->scan_completed);
 
 	return;
 
 reschedule:
 	priv->scan_pass_start = jiffies;
-	queue_work(priv->workqueue, &priv->request_scan);
+	queue_work(priv->hw->workqueue, &priv->request_scan);
 }
 
 /* Handle notification from uCode that card's power state is changing
@@ -3760,7 +3760,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
 	     test_bit(STATUS_RF_KILL_HW, &priv->status)) ||
 	    (test_bit(STATUS_RF_KILL_SW, &status) !=
 	     test_bit(STATUS_RF_KILL_SW, &priv->status)))
-		queue_work(priv->workqueue, &priv->rf_kill);
+		queue_work(priv->hw->workqueue, &priv->rf_kill);
 	else
 		wake_up_interruptible(&priv->wait_command_queue);
 }
@@ -4029,7 +4029,7 @@ int iwl_rx_queue_restock(struct iwl_priv *priv)
 	/* If the pre-allocated buffer pool is dropping low, schedule to
 	 * refill it */
 	if (rxq->free_count <= RX_LOW_WATERMARK)
-		queue_work(priv->workqueue, &priv->rx_replenish);
+		queue_work(priv->hw->workqueue, &priv->rx_replenish);
 
 
 	/* If we've added more space for the firmware to place data, tell it */
@@ -4642,7 +4642,7 @@ static void iwl_irq_handle_error(struct iwl_priv *priv)
 			       sizeof(priv->recovery_rxon));
 			priv->error_recovering = 1;
 		}
-		queue_work(priv->workqueue, &priv->restart);
+		queue_work(priv->hw->workqueue, &priv->restart);
 	}
 }
 
@@ -4750,7 +4750,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
 		 *   iwl_rx_card_state_notif() */
 		if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) {
 			clear_bit(STATUS_RF_KILL_HW, &priv->status);
-			queue_work(priv->workqueue, &priv->restart);
+			queue_work(priv->hw->workqueue, &priv->restart);
 		}
 
 		handled |= CSR_INT_BIT_RF_KILL;
@@ -6093,7 +6093,7 @@ static void iwl_init_alive_start(struct iwl_priv *priv)
 	return;
 
  restart:
-	queue_work(priv->workqueue, &priv->restart);
+	queue_work(priv->hw->workqueue, &priv->restart);
 }
 
 
@@ -6213,7 +6213,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
 	return;
 
  restart:
-	queue_work(priv->workqueue, &priv->restart);
+	queue_work(priv->hw->workqueue, &priv->restart);
 }
 
 static void iwl_cancel_deferred_work(struct iwl_priv *priv);
@@ -6451,7 +6451,7 @@ static void iwl_bg_rf_kill(struct work_struct *work)
 			  "HW and/or SW RF Kill no longer active, restarting "
 			  "device\n");
 		if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
-			queue_work(priv->workqueue, &priv->restart);
+			queue_work(priv->hw->workqueue, &priv->restart);
 	} else {
 
 		if (!test_bit(STATUS_RF_KILL_HW, &priv->status))
@@ -6676,7 +6676,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
 	if (rc)
 		goto done;
 
-	queue_delayed_work(priv->workqueue, &priv->scan_check,
+	queue_delayed_work(priv->hw->workqueue, &priv->scan_check,
 			   IWL_SCAN_CHECK_WATCHDOG);
 
 	mutex_unlock(&priv->mutex);
@@ -6684,7 +6684,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
 
  done:
 	/* inform mac80211 sacn aborted */
-	queue_work(priv->workqueue, &priv->scan_completed);
+	queue_work(priv->hw->workqueue, &priv->scan_completed);
 	mutex_unlock(&priv->mutex);
 }
 
@@ -6708,7 +6708,7 @@ static void iwl_bg_restart(struct work_struct *data)
 		return;
 
 	iwl_down(priv);
-	queue_work(priv->workqueue, &priv->up);
+	queue_work(priv->hw->workqueue, &priv->up);
 }
 
 static void iwl_bg_rx_replenish(struct work_struct *data)
@@ -7593,7 +7593,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
 	iwl_reset_qos(priv);
 #endif
 
-	queue_work(priv->workqueue, &priv->post_associate.work);
+	queue_work(priv->hw->workqueue, &priv->post_associate.work);
 
 	mutex_unlock(&priv->mutex);
 
@@ -8259,8 +8259,6 @@ static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log);
 
 static void iwl_setup_deferred_work(struct iwl_priv *priv)
 {
-	priv->workqueue = create_workqueue(DRV_NAME);
-
 	init_waitqueue_head(&priv->wait_command_queue);
 
 	INIT_WORK(&priv->up, iwl_bg_up);
@@ -8584,8 +8582,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
  out_disable_msi:
 	pci_disable_msi(pdev);
-	destroy_workqueue(priv->workqueue);
-	priv->workqueue = NULL;
 	iwl_unset_hw_setting(priv);
 
  out_iounmap:
@@ -8640,15 +8636,6 @@ static void iwl_pci_remove(struct pci_dev *pdev)
 		iwl_rate_control_unregister(priv->hw);
 	}
 
-	/*netif_stop_queue(dev); */
-	flush_workqueue(priv->workqueue);
-
-	/* ieee80211_unregister_hw calls iwl_mac_stop, which flushes
-	 * priv->workqueue... so we can't take down the workqueue
-	 * until now... */
-	destroy_workqueue(priv->workqueue);
-	priv->workqueue = NULL;
-
 	free_irq(pdev->irq, priv);
 	pci_disable_msi(pdev);
 	pci_iounmap(pdev, priv->hw_base);
@@ -8732,7 +8719,7 @@ static void iwl_resume(struct iwl_priv *priv)
 
 	/* Bring the device back up */
 	clear_bit(STATUS_IN_SUSPEND, &priv->status);
-	queue_work(priv->workqueue, &priv->up);
+	queue_work(priv->hw->workqueue, &priv->up);
 }
 
 static int iwl_pci_resume(struct pci_dev *pdev)
-- 
1.5.3.rc5


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply related

* Re: AF_UNIX MSG_PEEK bug?
From: Tetsuo Handa @ 2008-01-09 11:04 UTC (permalink / raw)
  To: bcasavan; +Cc: netdev, davem, linux-kernel
In-Reply-To: <alpine.BSF.1.00.0801081556580.24286@pkunk.americas.sgi.com>

Hello.

Brent Casavant wrote:
> However, the program would occasionally get into a situation where
> a call to recv(sockfd, &buf, len, MSG_PEEK) returns some number
> of bytes less than the requested length, and persists in this state
> (i.e. retrying the call continues to return the same amount of data)
> even when more than sufficient data is known to have been successfully
> written to the socket.
Did you try MSG_WAITALL flag? See "man 2 recv".
A TCP socket handles data in bytes.
You cannot complain if the amount received by recv() is smaller than expected
unless you use MSG_WAITALL flag.

Thanks.

^ permalink raw reply

* Re: [PATCH for 2.6.24][NET] fs_enet: check for phydev existence in the ethtool handlers
From: Sergej Stepanov @ 2008-01-09 10:46 UTC (permalink / raw)
  To: avorontsov; +Cc: Jeff Garzik, netdev, linuxppc-dev
In-Reply-To: <20080108190555.GA23302@localhost.localdomain>


Am Dienstag, den 08.01.2008, 22:05 +0300 schrieb Anton Vorontsov:
> Otherwise oops will happen if ethernet device has not been opened:
> 
> Unable to handle kernel paging request for data at address 0x0000014c
> Faulting instruction address: 0xc016f7f0
> Oops: Kernel access of bad area, sig: 11 [#1]
> MPC85xx
> NIP: c016f7f0 LR: c01722a0 CTR: 00000000
> REGS: c79ddc70 TRAP: 0300   Not tainted  (2.6.24-rc3-g820a386b)
> MSR: 00029000 <EE,ME>  CR: 20004428  XER: 20000000
> DEAR: 0000014c, ESR: 00000000
> TASK = c789f5e0[999] 'snmpd' THREAD: c79dc000
> GPR00: c01aceb8 c79ddd20 c789f5e0 00000000 c79ddd3c 00000000 c79ddd64 00000000
> GPR08: 00000000 c7845b60 c79dde3c c01ace80 20004422 200249fc 000002a0 100da728
> GPR16: 100c0000 00000000 00000000 00000000 20022078 00000009 200220e0 bfc85558
> GPR24: c79ddd3c 00000000 00000000 c02e0e70 c022fc64 ffffffff c7845800 bfc85498
> NIP [c016f7f0] phy_ethtool_gset+0x0/0x4c
> LR [c01722a0] fs_get_settings+0x18/0x28
> Call Trace:
> [c79ddd20] [c79dde38] 0xc79dde38 (unreliable)
> [c79ddd30] [c01aceb8] dev_ethtool+0x294/0x11ec
> [c79dde30] [c01aaa44] dev_ioctl+0x454/0x6a8
> [c79ddeb0] [c019b9d4] sock_ioctl+0x84/0x230
> [c79dded0] [c007ded8] do_ioctl+0x34/0x8c
> [c79ddee0] [c007dfbc] vfs_ioctl+0x8c/0x41c
> [c79ddf10] [c007e38c] sys_ioctl+0x40/0x74
> [c79ddf40] [c000d4c0] ret_from_syscall+0x0/0x3c
> Instruction dump:
> 81630000 800b0030 2f800000 419e0010 7c0803a6 4e800021 7c691b78 80010014
> 7d234b78 38210010 7c0803a6 4e800020 <8003014c> 7c6b1b78 38600000 90040004
> 
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> Acked-by: Vitaly Bordug <vitb@kernel.crashing.org>
> ---
> 
> Just resending it, it feels like it got lost during holidays.
> 
>  drivers/net/fs_enet/fs_enet-main.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
> index f2a4d39..23fddc3 100644
> --- a/drivers/net/fs_enet/fs_enet-main.c
> +++ b/drivers/net/fs_enet/fs_enet-main.c
> @@ -897,14 +897,21 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs,
>  static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
>  {
>  	struct fs_enet_private *fep = netdev_priv(dev);
> +
> +	if (!fep->phydev)
> +		return -ENODEV;
> +
>  	return phy_ethtool_gset(fep->phydev, cmd);
>  }
>  
>  static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
>  {
>  	struct fs_enet_private *fep = netdev_priv(dev);
> -	phy_ethtool_sset(fep->phydev, cmd);
> -	return 0;
> +
> +	if (!fep->phydev)
> +		return -ENODEV;
> +
> +	return phy_ethtool_sset(fep->phydev, cmd);
>  }
>  
>  static int fs_nway_reset(struct net_device *dev)

I got also oops problem with the driver.
What could be false?
After the following patch it functions.
Thanks for any advance.

diff --git a/drivers/net/fs_enet/fs_enet-main.c
b/drivers/net/fs_enet/fs_enet-main.c
index f2a4d39..d5081b1 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -99,6 +99,8 @@ static int fs_enet_rx_napi(struct napi_struct *napi,
int budget)
        if (!netif_running(dev))
                return 0;
 
+       if (fep->cur_rx == NULL)
+               return 0;
        /*
         * First, grab all of the stats for the incoming packet.
         * These get messed up if we get called due to a busy condition.



^ permalink raw reply related

* [patch] pegasus.c
From: Petko Manolov @ 2008-01-09 10:30 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 315 bytes --]

 	Hi Jeff,

Attached you'll find a patch that is fixing a driver bug triggered when 
malformed string is passed to the 'devid' module parameter.  The expected 
format is:

 	"device_name:vendor_id:device_id:flags"

but it turned out people often type:

 	"somename::0"

instead of:

 	"somename:::0"


cheers,
Petko

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: TEXT/x-diff; name=pegasus.c.patch, Size: 1373 bytes --]

--- drivers/net/usb/pegasus.c.orig	2008-01-09 12:16:52.000000000 +0200
+++ drivers/net/usb/pegasus.c	2008-01-09 12:16:58.000000000 +0200
@@ -1461,12 +1461,24 @@ static void parse_id(char *id)
 
 	if ((token = strsep(&id, ":")) != NULL)
 		name = token;
+	else
+		goto err;
 	/* name now points to a null terminated string*/
 	if ((token = strsep(&id, ":")) != NULL)
 		vendor_id = simple_strtoul(token, NULL, 16);
+	else
+		goto err;
+
 	if ((token = strsep(&id, ":")) != NULL)
 		device_id = simple_strtoul(token, NULL, 16);
-	flags = simple_strtoul(id, NULL, 16);
+	else
+		goto err;
+
+	if (id != NULL)
+		flags = simple_strtoul(id, NULL, 16);
+	else
+		goto err;
+
 	pr_info("%s: new device %s, vendor ID 0x%04x, device ID 0x%04x, flags: 0x%x\n",
 	        driver_name, name, vendor_id, device_id, flags);
 
@@ -1476,6 +1488,7 @@ static void parse_id(char *id)
 		return;
 
 	for (i=0; usb_dev_id[i].name; i++);
+
 	usb_dev_id[i].name = name;
 	usb_dev_id[i].vendor = vendor_id;
 	usb_dev_id[i].device = device_id;
@@ -1483,6 +1496,11 @@ static void parse_id(char *id)
 	pegasus_ids[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE;
 	pegasus_ids[i].idVendor = vendor_id;
 	pegasus_ids[i].idProduct = device_id;
+
+	return;
+
+err:
+	pr_info("malformed 'devid' module parameter\n");
 }
 
 static int __init pegasus_init(void)

^ permalink raw reply

* [PATCH net-2.6.25] [IPVS] Added include for ip_vs.h for ctl_path (build was broken)
From: Rami Rosen @ 2008-01-09 11:33 UTC (permalink / raw)
  To: David Miller, netdev

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

Hi,
   The build was broken with this error:
	
  In file included from net/ipv4/ipvs/ip_vs_rr.c:27:
  include/net/ip_vs.h:857: error: array type has incomplete element type
  make[3]: *** [net/ipv4/ipvs/ip_vs_rr.o] Error 1

	This was due to missing include to the header file for ctl_path.
	
	This patch added #include <linux/sysctl.h> to ip_vs_.h to avoid it

Regards,
Rami Rosen


Signed-off-by: Rami Rosen <ramirose@gmail.com>

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 409 bytes --]

diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 02ab7ca..56f3c94 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -9,6 +9,8 @@
 #include <asm/types.h>		/* For __uXX types */
 #include <linux/types.h>	/* For __beXX types in userland */
 
+#include <linux/sysctl.h>	/* For ctl_path */
+
 #define IP_VS_VERSION_CODE	0x010201
 #define NVERSION(version)			\
 	(version >> 16) & 0xFF,			\

^ permalink raw reply related

* Re: [PATCH net-2.6.25 0/4] [NET]: Bloat, bloat and more bloat
From: Ilpo Järvinen @ 2008-01-09 11:35 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Netdev
In-Reply-To: <20080105144608.GD12379@ghostprotocols.net>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1247 bytes --]

On Sat, 5 Jan 2008, Arnaldo Carvalho de Melo wrote:

> Em Sat, Jan 05, 2008 at 03:39:04PM +0200, Ilpo Järvinen escreveu:
> > Hi Dave,
> > 
> > After Arnaldo got codiff's inline instrumentation bugs fixed
> > (thanks! :-)), I got my .c-inline-bloat-o-meter to power up
> > reliably after some tweaking and bug fixing on my behalf...
> > It shows some very high readings every now and then in the
> > code under net/.
> 
> Thank you for the reports and for showing how these tools can be put to
> good use! 
> 
> If you have any further suggestions on how to make codiff and the
> dwarves to be of more help or find any other bug, please let me know.

It could use a bit less memory because my header inline checking attempt 
on a machine with 2G+2G ends up like this:

$ codiff vmlinux.o.base vmlinux.o
libclasses: out of memory(inline_expansion__new)
$ ls -al vmlinux.o{,.base}
-rw-r----- 1 ijjarvin tkol 633132586 Jan  9 13:11 vmlinux.o
-rw-r----- 1 ijjarvin tkol 633132572 Jan  9 00:58 vmlinux.o.base
$

Considering that's only 0.6G+0.6G I've a problem in understanding why 
codiff's number crunching eats up so much memory.

I just hope there isn't any O(n^2) or worse algos in it either once
the memory consumption gets resolved. :-)


-- 
 i.

^ permalink raw reply

* Re: make ipv6_sysctl_register to return a value
From: David Miller @ 2008-01-09 11:50 UTC (permalink / raw)
  To: dlezcano; +Cc: netdev
In-Reply-To: <47849A60.1020909@fr.ibm.com>

From: Daniel Lezcano <dlezcano@fr.ibm.com>
Date: Wed, 09 Jan 2008 10:56:48 +0100

> To clear out any confusion, please can you just ignore all my previous 
> patches, I will resend a new serie rebased on the work done by Pavel.

Ok, thanks.

^ permalink raw reply

* Re: [ATM]: Check IP header validity in mpc_send_packet
From: David Miller @ 2008-01-09 11:52 UTC (permalink / raw)
  To: herbert; +Cc: netdev, viro, chas
In-Reply-To: <20080109102745.GA29297@gondor.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 9 Jan 2008 21:27:45 +1100

> [ATM]: Check IP header validity in mpc_send_packet
> 
> Al went through the ip_fast_csum callers and found this piece of code
> that did not validate the IP header.  While root crashing the machine
> by sending bogus packets through raw or AF_PACKET sockets isn't that
> serious, it is still nice to react gracefully.
> 
> This patch ensures that the skb has enough data for an IP header and
> that the header length field is valid.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied, thanks for following up on this.

^ permalink raw reply

* Re: [PATCH net-2.6.25] [IPVS] Added include for ip_vs.h for ctl_path (build was broken)
From: David Miller @ 2008-01-09 11:57 UTC (permalink / raw)
  To: ramirose; +Cc: netdev
In-Reply-To: <eb3ff54b0801090333r4c1770dakd65f61e356aa0304@mail.gmail.com>

From: "Rami Rosen" <ramirose@gmail.com>
Date: Wed, 9 Jan 2008 13:33:49 +0200

> Hi,
>    The build was broken with this error:
> 	
>   In file included from net/ipv4/ipvs/ip_vs_rr.c:27:
>   include/net/ip_vs.h:857: error: array type has incomplete element type
>   make[3]: *** [net/ipv4/ipvs/ip_vs_rr.o] Error 1
> 
> 	This was due to missing include to the header file for ctl_path.
> 	
> 	This patch added #include <linux/sysctl.h> to ip_vs_.h to avoid it
> 
> Signed-off-by: Rami Rosen <ramirose@gmail.com>

Applied, thanks.

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox