Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 5/11] [IPSEC]: Fix length check in xfrm_parse_spi
From: David Miller @ 2007-10-18  4:30 UTC (permalink / raw)
  To: herbert; +Cc: yoshfuji, kaber, netdev
In-Reply-To: <E1Ii9yP-0006HD-00@gondolin.me.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 17 Oct 2007 22:34:13 +0800

> [IPSEC]: Fix length check in xfrm_parse_spi
> 
> Currently xfrm_parse_spi requires there to be 16 bytes for AH and ESP.
> In contrived cases there may not actually be 16 bytes there since the
> respective header sizes are less than that (8 and 12 currently).
> 
> This patch changes the test to use the actual header length instead of 16.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied.

^ permalink raw reply

* Re: [PATCH 6/11] [IPSEC]: Move type and mode map into xfrm_state.c
From: David Miller @ 2007-10-18  4:31 UTC (permalink / raw)
  To: herbert; +Cc: yoshfuji, kaber, netdev
In-Reply-To: <E1Ii9yQ-0006HL-00@gondolin.me.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 17 Oct 2007 22:34:14 +0800

> [IPSEC]: Move type and mode map into xfrm_state.c
> 
> The type and mode maps are only used by SAs, not policies.  So it makes
> sense to move them from xfrm_policy.c into xfrm_state.c.  This alos allows
> us to mark xfrm_get_type/xfrm_put_type/xfrm_get_mode/xfrm_put_mode as
> static.
> 
> The only other change I've made in the move is to get rid of the casts
> on the request_module call for types.  They're unnecessary because C
> will promote them to ints anyway.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied.

^ permalink raw reply

* Re: [PATCH 7/11] [IPSEC]: Add missing BEET checks
From: David Miller @ 2007-10-18  4:31 UTC (permalink / raw)
  To: herbert; +Cc: yoshfuji, kaber, netdev
In-Reply-To: <E1Ii9yR-0006HT-00@gondolin.me.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 17 Oct 2007 22:34:15 +0800

> [IPSEC]: Add missing BEET checks
> 
> Currently BEET mode does not reinject the packet back into the stack
> like tunnel mode does.  Since BEET should behave just like tunnel mode
> this is incorrect.
> 
> This patch fixes this by introducing a flags field to xfrm_mode that
> tells the IPsec code whether it should terminate and reinject the packet
> back into the stack.
> 
> It then sets the flag for BEET and tunnel mode.
> 
> I've also added a number of missing BEET checks elsewhere where we check
> whether a given mode is a tunnel or not.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied.

^ permalink raw reply

* Re: [PATCH 8/11] [IPSEC]: Store afinfo pointer in xfrm_mode
From: David Miller @ 2007-10-18  4:34 UTC (permalink / raw)
  To: herbert; +Cc: yoshfuji, kaber, netdev
In-Reply-To: <E1Ii9yS-0006Hb-00@gondolin.me.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 17 Oct 2007 22:34:16 +0800

> [IPSEC]: Store afinfo pointer in xfrm_mode
> 
> It is convenient to have a pointer from xfrm_state to address-specific
> functions such as the output function for a family.  Currently the
> address-specific policy code calls out to the xfrm state code to get
> those pointers when we could get it in an easier way via the state
> itself.
> 
> This patch adds an xfrm_state_afinfo to xfrm_mode (since they're
> address-specific) and changes the policy code to use it.  I've also
> added an owner field to do reference counting on the module providing
> the afinfo even though it isn't strictly necessary today since IPv6
> can't be unloaded yet.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied.

Thanks for doing this, those afinfo get/put things all over
the place really bugged me.

^ permalink raw reply

* Re: [PATCH 9/11] [IPSEC]: Use the top IPv4 route's peer instead of the bottom
From: David Miller @ 2007-10-18  4:34 UTC (permalink / raw)
  To: herbert; +Cc: yoshfuji, kaber, netdev
In-Reply-To: <E1Ii9yT-0006Hj-00@gondolin.me.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 17 Oct 2007 22:34:17 +0800

> [IPSEC]: Use the top IPv4 route's peer instead of the bottom
> 
> For IPv4 we were using the bottom route's peer instead of the top one.
> This is wrong because the peer is only used by TCP to keep track of
> information about the TCP destination address which certainly does not
> live in the bottom route.
> 
> This patch fixes that which allows us to get rid of the family check
> since the bottom route could be IPv6 while the top one must always
> be IPv4.
> 
> I've also changed the other fields which are IPv4-specific to get the
> info from the top route instead of potentially bogus data from the
> bottom route.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH 10/11] [IPSEC]: Disallow combinations of RO and AH/ESP/IPCOMP
From: David Miller @ 2007-10-18  4:35 UTC (permalink / raw)
  To: herbert; +Cc: yoshfuji, kaber, netdev
In-Reply-To: <E1Ii9yU-0006Hr-00@gondolin.me.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 17 Oct 2007 22:34:18 +0800

> [IPSEC]: Disallow combinations of RO and AH/ESP/IPCOMP
> 
> Combining RO and AH/ESP/IPCOMP does not make sense.  So this patch adds a
> check in the state initialisation function to prevent this.
> 
> This allows us to safely remove the mode input function of RO since it
> can never be called anymore.  Indeed, if somehow it does get called we'll
> know about it through an OOPS instead of it slipping past silently.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied.

^ permalink raw reply

* Re: [PATCH 11/11] [IPSEC]: Rename mode to outer_mode and add inner_mode
From: David Miller @ 2007-10-18  4:36 UTC (permalink / raw)
  To: herbert; +Cc: yoshfuji, kaber, netdev
In-Reply-To: <20071017152602.GA25116@gondor.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 17 Oct 2007 23:26:02 +0800

> On Wed, Oct 17, 2007 at 10:34:19PM +0800, Herbert Xu wrote:
> > [IPSEC]: Rename mode to outer_mode and add inner_mode
> 
> Oops.  This patch is missing two files.  Here is the correct
> version.
> 
> 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
> --
> [IPSEC]: Rename mode to outer_mode and add inner_mode
> 
> This patch adds a new field to xfrm states called inner_mode.  The existing
> mode object is renamed to outer_mode.
> 
> This is the first part of an attempt to fix inter-family transforms.  As it
> is we always use the outer family when determining which mode to use.  As a
> result we may end up shoving IPv4 packets into netfilter6 and vice versa.
> 
> What we really want is to use the inner family for the first part of outbound
> processing and the outer family for the second part.  For inbound processing
> we'd use the opposite pairing.
> 
> I've also added a check to prevent silly combinations such as transport mode
> with inter-family transforms.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied, thanks Herbert.

^ permalink raw reply

* Re: [PATCH] NET: Fix uninitialised variable in ip_frag_reasm()
From: David Miller @ 2007-10-18  4:37 UTC (permalink / raw)
  To: dhowells; +Cc: netdev
In-Reply-To: <20071017150248.22323.39167.stgit@warthog.procyon.org.uk>

From: David Howells <dhowells@redhat.com>
Date: Wed, 17 Oct 2007 16:02:48 +0100

> Fix uninitialised variable in ip_frag_reasm().  err should be set to -ENOMEM
> if the initial call of skb_clone() fails.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>

Applied, thanks David.

^ permalink raw reply

* Re: Virtual Netdevice
From: David Miller @ 2007-10-18  5:34 UTC (permalink / raw)
  To: ashokrajjb; +Cc: linux-kernel, netdev
In-Reply-To: <13230720.post@talk.nabble.com>

From: rajashok <ashokrajjb@gmail.com>
Date: Wed, 17 Oct 2007 22:10:43 -0700 (PDT)

> we are trying to to integrate our ipsec onto linux 2.6 kernel

Why not use the already existing 2.6.x kernel IPSEC stack?
It works quite well.

And for this reason, it is unlikely you will get much help
on these mailing lists in your efforts to replace it with
your own. :-)

^ permalink raw reply

* Re: [PATCH] vortex_up should initialize "err"
From: Steffen Klassert @ 2007-10-18  6:05 UTC (permalink / raw)
  To: Jeff Garzik, akpm; +Cc: Badari Pulavarty, netdev, lkml, satyam
In-Reply-To: <4716A8B4.5060406@garzik.org>

On Wed, Oct 17, 2007 at 08:28:36PM -0400, Jeff Garzik wrote:
> Badari Pulavarty wrote:
> >Simple compile warning fix. (against 2.6.23-git12)
> >
> >Thanks,
> >Badari
> >
> >vortex_up() should initialize 'err' for a successful return.
> >
> >drivers/net/3c59x.c: In function `vortex_up':
> >drivers/net/3c59x.c:1494: warning: `err' might be used uninitialized in 
> >this function
> 
> applied as an obvious bug fix (Steffen added to CC)
> 

Hm, we had already the 3c59x-fix-uninitialized-variable-bug.patch from
Satyam Sharma in -mm to fix this, but the patch was removed from -mm
some time ago. Andrew, what happened to this one?

However, this issue should be fixed.

Thanks,

Steffen

^ permalink raw reply

* Re: [PATCH/RFA] sch_generic: fix carrier-on bug?
From: David Miller @ 2007-10-18  6:26 UTC (permalink / raw)
  To: jeff; +Cc: netdev, linux-kernel
In-Reply-To: <20071016215555.GA4732@havoc.gtf.org>

From: Jeff Garzik <jeff@garzik.org>
Date: Tue, 16 Oct 2007 17:55:55 -0400

> While looking at a net driver with the following construct,
> 
> 	if (!netif_carrier_ok(dev))
> 		netif_carrier_on(dev);
> 
> it stuck me that the netif_carrier_ok() check was redundant, since
> netif_carrier_on() checks bit __LINK_STATE_NOCARRIER anyway.  This is
> the same reason why netif_queue_stopped() need not be called prior to
> netif_wake_queue().
> 
> This is true, but there is however an unwanted side effect from assuming
> that netif_carrier_on() can be called multiple times:  it touches the
> watchdog, regardless of pre-existing carrier state.
> 
> The fix:  move watchdog-up inside the bit-cleared code path.
> 
> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

I see no problems with this patch, I'll apply it, thanks!

^ permalink raw reply

* Re: [RFC] remove netpoll receive code
From: David Miller @ 2007-10-18  6:28 UTC (permalink / raw)
  To: shemminger; +Cc: akpm, netdev, linux-kernel
In-Reply-To: <20071017132131.1992bedd@freepuppy.rosehill>

From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Wed, 17 Oct 2007 13:21:31 -0700

> I propose that we take out all the whole netpoll rx path. If/when
> kgdb gets submitted a better and alternative receive path can be
> added.

I would like to kill the RX side handling of netpoll too,
but I don't think that's reasonable as kgdb is actively
being pushed for 2.6.25 inclusion.

Andrew is likely to add it to his -mm tree soon and therefore kgdb
will need to work properly now.

The RX netpoll thing has a long precedence, it's been in the tree for
a long time, so we are in some ways stuck with it until we have a
complete replacement facility.  That means we can't yank it out first
and implement the replacement later.

^ permalink raw reply

* Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes
From: Jarek Poplawski @ 2007-10-18  6:31 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: Andy Fleming, Andrew Morton, Jeff Garzik, netdev, linux-kernel
In-Reply-To: <20071017085809.GA1658@ff.dom.local>

On Wed, Oct 17, 2007 at 10:58:09AM +0200, Jarek Poplawski wrote:
...
> 8) phy_stop_interrupts(): I'm not sure this additional call from
> DEBUG_SHIRQ should be so dangerous, eg.:
> 
> 	/*
> 	 * status == PHY_HALTED &&
> 	 * interrupts are stopped after phy_stop()
> 	 */
> 	if (cancel_work_sync(...))
> 		enable_irq();
> 
> 	free_irq(...);
> 	/*
> 	 * possible schedule_work() from DEBUG_SHIRQ only,
> 	 * but proper check for PHY_HALTED is done;
> 	 * so, let's flush after this too:
> 	 */
> 	cancel_work_sync();

After rethinking, it looks like this last cancel should be useless.
So, if phy_interrupt() schedules only if !PHY_HALTED and phy_change()
does enable_irq() with no exeptions, it seems phy_interrupt() even
without lock must see PHY_HALTED state before this free_irq() with
possible DEBUG_SHIRQ call, then maybe only this safety:

	WARN_ON(work_pending(&phydev->phy_queue));


Btw, I've read this was considered and not liked, but IMHO, if this
really has to be like this, creating phy's own workqueue seems to be
resonable, at the very least to reduce latencies to other users of
this irq.

Jarek P.

^ permalink raw reply

* [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes
From: Jarek Poplawski @ 2007-10-18  7:05 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Maciej W. Rozycki, Andy Fleming, Andrew Morton, Jeff Garzik,
	netdev, linux-kernel
In-Reply-To: <20071018063157.GA1694@ff.dom.local>

After reading this and earlier threads about phylib's way of using
workqueue I think such a lighter and safer wrt. locking alternative
for flush_scheduled_work should be useful, but maybe it's only my
imagination.

So, let's ask Oleg Nesterov, whose solutions are here only
copy-cut-pasted & possibly abused by myslef.

--------->
Subject: flush_work_sync as an alternative for flush_scheduled_work

Similar to cancel_work_sync() but will only busy wait & block
(without cancel).

Signed-off-by: Jarek Poplawski <jarkao2@o2.pl>

---

 include/linux/workqueue.h |    1 +
 kernel/workqueue.c        |   24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff -Nurp 2.6.23-mm1-/include/linux/workqueue.h 2.6.23-mm1/include/linux/workqueue.h
--- 2.6.23-mm1-/include/linux/workqueue.h	2007-10-12 23:45:24.000000000 +0200
+++ 2.6.23-mm1/include/linux/workqueue.h	2007-10-17 20:55:26.000000000 +0200
@@ -192,6 +192,7 @@ extern void init_workqueues(void);
 int execute_in_process_context(work_func_t fn, struct execute_work *);
 
 extern int cancel_work_sync(struct work_struct *work);
+extern void flush_work_sync(struct work_struct *work);
 
 /*
  * Kill off a pending schedule_delayed_work().  Note that the work callback
diff -Nurp 2.6.23-mm1-/kernel/workqueue.c 2.6.23-mm1/kernel/workqueue.c
--- 2.6.23-mm1-/kernel/workqueue.c	2007-10-12 23:45:25.000000000 +0200
+++ 2.6.23-mm1/kernel/workqueue.c	2007-10-17 20:54:03.000000000 +0200
@@ -539,6 +539,30 @@ int cancel_delayed_work_sync(struct dela
 }
 EXPORT_SYMBOL(cancel_delayed_work_sync);
 
+/**
+ * flush_work_sync - block until a work_struct's callback has terminated
+ * @work: the work which is to be flushed
+ *
+ * Similar to cancel_work_sync() but will only busy wait (without cancel)
+ * if the work is queued. If the work's callback appears to be running,
+ * flush_work_sync() will block until it has completed (but doesn't block
+ * while other callbacks are running, like flush_scheduled_work() does).
+ *
+ * It is not allowed to use this function if the work re-queues itself.
+ */
+void flush_work_sync(struct work_struct *work)
+{
+	int ret;
+
+	do {
+		ret = work_pending(work);
+		wait_on_work(work);
+		if (ret)
+			cpu_relax();
+	} while (ret);
+}
+EXPORT_SYMBOL(flush_work_sync);
+
 static struct workqueue_struct *keventd_wq __read_mostly;
 
 /**

^ permalink raw reply

* Re: [RFC] remove netpoll receive code
From: Andrew Morton @ 2007-10-18  7:02 UTC (permalink / raw)
  To: David Miller; +Cc: shemminger, netdev, linux-kernel, Jason Wessel
In-Reply-To: <20071017.232838.41634977.davem@davemloft.net>

On Wed, 17 Oct 2007 23:28:38 -0700 (PDT) David Miller <davem@davemloft.net> wrote:

> From: Stephen Hemminger <shemminger@linux-foundation.org>
> Date: Wed, 17 Oct 2007 13:21:31 -0700
> 
> > I propose that we take out all the whole netpoll rx path. If/when
> > kgdb gets submitted a better and alternative receive path can be
> > added.
> 
> I would like to kill the RX side handling of netpoll too,
> but I don't think that's reasonable as kgdb is actively
> being pushed for 2.6.25 inclusion.
> 
> Andrew is likely to add it to his -mm tree soon and therefore kgdb
> will need to work properly now.

git-kgdb.patch has been in there for ages - maybe a year.  Although I
disabled it a week or so ago due to the sheer number of rejects.  Will
bring it back when things settle down a bit.

> The RX netpoll thing has a long precedence, it's been in the tree for
> a long time, so we are in some ways stuck with it until we have a
> complete replacement facility.  That means we can't yank it out first
> and implement the replacement later.

^ permalink raw reply

* Re: [PATCH] vortex_up should initialize "err"
From: Andrew Morton @ 2007-10-18  6:58 UTC (permalink / raw)
  To: Steffen Klassert; +Cc: Jeff Garzik, Badari Pulavarty, netdev, lkml, satyam
In-Reply-To: <20071018060506.GA30544@newton.mathematik.tu-chemnitz.de>

On Thu, 18 Oct 2007 08:05:06 +0200 Steffen Klassert <klassert@mathematik.tu-chemnitz.de> wrote:

> On Wed, Oct 17, 2007 at 08:28:36PM -0400, Jeff Garzik wrote:
> > Badari Pulavarty wrote:
> > >Simple compile warning fix. (against 2.6.23-git12)
> > >
> > >Thanks,
> > >Badari
> > >
> > >vortex_up() should initialize 'err' for a successful return.
> > >
> > >drivers/net/3c59x.c: In function `vortex_up':
> > >drivers/net/3c59x.c:1494: warning: `err' might be used uninitialized in 
> > >this function
> > 
> > applied as an obvious bug fix (Steffen added to CC)
> > 
> 
> Hm, we had already the 3c59x-fix-uninitialized-variable-bug.patch from
> Satyam Sharma in -mm to fix this, but the patch was removed from -mm
> some time ago. Andrew, what happened to this one?

It's fixed in Jeff's netdev tree.

^ permalink raw reply

* Re: [PATCH 12/12] Drop bogus reference to tc-filters and add lartc.org link to manpage.
From: Andreas Henriksson @ 2007-10-18  8:13 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Alexander Wirt
In-Reply-To: <20071017110257.05991840@freepuppy.rosehill>

On Wed, Oct 17, 2007 at 11:02:57AM -0700, Stephen Hemminger wrote:
> 
> The tagging naming convention is messed up, but they are there:
> 
> $ git tag -l

I don't want to be a pain in the ass, but....

this is the list from my clone of 
git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git

ss-050808
ss-050816
ss-050901
ss-050929
ss-051006
ss-051007
ss-051101
ss-051107
ss-060110
ss-060314
ss-060323
ss050607
v2.6.19-061214
v2_6_10-050124
v2_6_10-050207
v2_6_10-050209
v2_6_11-050310
v2_6_11-050314
v2_6_11-050318
v2_6_11-050330
v2_6_7-040701
v2_6_7-040702
v2_6_7-ss040608
v2_6_8-040730
v2_6_8-040813-jamal
v2_6_8-040823
v2_6_8-ss040831
v2_6_9-041019
v2_6_9-jamal
v2_6_9-ss040831


None of the tags are from (20)07.... 

And none of the tags at the gitweb have a tag from this year eigther.
http://git.kernel.org/?p=linux/kernel/git/shemminger/iproute2.git;a=tags

Any chance you forgot to push the tags out to the public repo?
(Which you seem to have to do explicitly in git.)

--
Regards,
Andreas Henriksson

^ permalink raw reply

* s390x: getting ipv6 bugs on mainline since 2.6.23-git3
From: Andy Whitcroft @ 2007-10-18  9:35 UTC (permalink / raw)
  To: linux390; +Cc: linux-s390, netdev, linux-kernel, Kamalesh Babulal

Seems we are getting some kind of bug out of our s390x partition (lnxabat1)
when booting latest mainline releases, specifically since 2.6.23-git3.

Kernel BUG at 0000000000000002 Ýverbose debug info unavailable¨
illegal operation: 0001 Ý#1¨
Modules linked in: dm_mod sit tunnel4 ipv6 qeth ccwgroup qdio dasd_fba_mod dasd_
eckd_mod dasd_mod
CPU:    0    Not tainted
Process ip (pid: 2614, task: 000000003f42f680, ksp: 000000003cf2feb8)
Krnl PSW : 0704200180000000 0000000000000002 (0x2)
           R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:2 PM:0 EA:3
Krnl GPRS: 0000000000000000 0000000000000000 000000003e6d5d00 000000003e01f000
           00000000000086dd 000000003cdac144 0000000000000000 0000000000000010
           000000003e01f000 000000003d97e3c0 0000000100eaaa00 000000003cdac100
           000000003e6d5d00 00000001018fb1d0 0000000000286da8 000000003cf2f5e8
Krnl Code:>0000000000000002: 0000               unknown
           0000000000000004: 0000               unknown
           0000000000000006: 0000               unknown
           0000000000000008: 0000               unknown
           000000000000000a: 0000               unknown
           000000000000000c: 0000               unknown
           000000000000000e: 0000               unknown
           0000000000000010: 0000               unknown
Call Trace:
(Ý<0000000000286d60>¨ neigh_connected_output+0x68/0xfc)
 Ý<00000001018cc7fe>¨ ip6_output2+0x416/0x4ac Ýipv6¨
 Ý<00000001018ceaa8>¨ ip6_output+0xfc4/0xfd4 Ýipv6¨
 Ý<00000001018dfe40>¨ __ndisc_send+0x52c/0x6f0 Ýipv6¨
 Ý<00000001018e0218>¨ ndisc_send_rs+0x4c/0x5c Ýipv6¨
 Ý<00000001018d40e6>¨ addrconf_dad_completed+0xa2/0xf0 Ýipv6¨
 Ý<00000001018d4880>¨ addrconf_dad_start+0xa0/0x124 Ýipv6¨
 Ý<00000001018d496a>¨ addrconf_add_linklocal+0x66/0x98 Ýipv6¨
 Ý<00000001018d7a3c>¨ addrconf_notify+0x6cc/0x898 Ýipv6¨
 Ý<000000000004ad7c>¨ notifier_call_chain+0x50/0x8c
 Ý<000000000004b0b6>¨ __raw_notifier_call_chain+0x1a/0x28
 Ý<000000000004b0e6>¨ raw_notifier_call_chain+0x22/0x30
 Ý<000000000027f014>¨ call_netdevice_notifiers+0x28/0x38
 Ý<0000000000281732>¨ dev_open+0xba/0xd0
 Ý<0000000000281cce>¨ dev_change_flags+0xbe/0x198
 Ý<00000000002d681c>¨ devinet_ioctl+0x2c8/0x6c0
 Ý<000000000027138a>¨ sock_ioctl+0x26e/0x2a0
 Ý<00000000000ab1ce>¨ do_ioctl+0x4a/0xac
 Ý<00000000000ab5f2>¨ vfs_ioctl+0x3c2/0x3d8
 Ý<00000000000ab676>¨ sys_ioctl+0x6e/0x94
 Ý<00000000000215c6>¨ sysc_noemu+0x10/0x16
 Ý<00000200001201ca>¨ 0x200001201ca

 <0>Kernel panic - not syncing: Fatal exception in interrupt
01: HCPGSP2629I The virtual machine is placed in CP mode due to a SIGP stop from
 CPU 00.
02: HCPGSP2629I The virtual machine is placed in CP mode due to a SIGP stop from
 CPU 00.
03: HCPGSP2629I The virtual machine is placed in CP mode due to a SIGP stop from
 CPU 00.
00: HCPGIR450W CP entered; disabled wait PSW 00020001 80000000 00000000 00015FDE

-apw

^ permalink raw reply

* [PATCH] [TCP]: Add highest_sack_end_seq check back to lost_retrans call
From: Ilpo Järvinen @ 2007-10-18  9:40 UTC (permalink / raw)
  To: TAKANO Ryousei; +Cc: David Miller, y-kodama, Netdev
In-Reply-To: <20071018.125045.90803775.takano@axe-inc.co.jp>

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

On Thu, 18 Oct 2007, TAKANO Ryousei wrote:

> From: David Miller <davem@davemloft.net>
> Subject: Re: [PATCH 7/7] [TCP]: Limit processing lost_retrans loop to work-to-do cases
> Date: Thu, 11 Oct 2007 17:36:22 -0700 (PDT)
> 
> > From: "Ilpo_Järvinen" <ilpo.jarvinen@helsinki.fi>
> > Date: Thu, 11 Oct 2007 14:41:07 +0300
> > 
> > > This addition of lost_retrans_low to tcp_sock might be
> > > unnecessary, it's not clear how often lost_retrans worker is
> > > executed when there wasn't work to do.
> > > 
> > > Cc: TAKANO Ryousei <takano@axe-inc.co.jp>
> > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> > 
> > Applied.
> 
> > +	    after(highest_sack_end_seq, tp->lost_retrans_low) &&
>
> This limit degrades the performance of my test case described before,

Thanks for testing.... Btw, just noticed that lost_retrans_low addition 
patch incorrectly dropped check for highest_sack_end_seq (probably due to 
incorrect resolution from my side at some point of development of those 
two patches as I added that check later on when realized it's necessary), 
patching that below... Since it causes zero received_upto in 
tcp_mark_lost_retrans, some RETRANS bits got cleared unintentionally
because of that.

> since it misses opportunities of detecting loss of retransmitted packets.

Do you have an idea how it does that except the problem now being fixed?
The lost_retrans_low was supposed to contain the minimum 
TCP_SKB_CB(skb)->ack_seq of those packets that hav TCPCB_SACKED_RETRANS 
set, so if the condition won't match, there shouldn't be any misses. Do 
you think there's something wrong in that approach?

The point of lost_retrans_low is to limit walking in retrans queue to two 
cases:

- There's at least one skb with SACKED_RETRANS to clear (except perhaps 
some corner cases where that specific skb got DSACKed in between and the 
R-bit was therefore cleared).

 or

- New lost_retrans_low has to calculated (should only occur if snd_una 
advanced past it and there are still some retransmissions, not too sure 
if that can occur, and that won't be very likely case anyway).


> "no limit" does as follows:
>         if (tp->retrans_out && highest_sack_end_seq &&
>             icsk->icsk_ca_state == TCP_CA_Recovery)
>                 flag |= tcp_mark_lost_retrans(sk, highest_sack_end_seq);

Having that highest_sack_end_seq there probably solved the problem. Yet 
it won't be good in performance wise like that because many unnecessary 
walks would occur during CA_Recovery, which all are prone to induce some 
cache misses.


--

[PATCH] [TCP]: Add highest_sack_end_seq check back to lost_retrans call

This was unintentionally dropped (probably due to incorrect
resolution from my side at some point of development of those
two patches as I added that check later on when realized it's
necessary). There won't be anything to mark if SACKs didn't
advance.

It causes passing of zero received_upto to tcp_mark_lost_retrans
which confuses after relations within the marker loop causing
incorrect TCPCB_SACKED_RETRANS clearing.

This problem was noticed because of a performance report from
TAKANO Ryousei <takano@axe-inc.co.jp>.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 net/ipv4/tcp_input.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0f00966..c3c0183 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1489,7 +1489,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
 		}
 	}
 
-	if (tp->retrans_out &&
+	if (tp->retrans_out && highest_sack_end_seq &&
 	    after(highest_sack_end_seq, tp->lost_retrans_low) &&
 	    icsk->icsk_ca_state == TCP_CA_Recovery)
 		flag |= tcp_mark_lost_retrans(sk, highest_sack_end_seq);
-- 
1.5.0.6

^ permalink raw reply related

* Re: [PATCH][NET] gianfar: fix obviously wrong #ifdef CONFIG_GFAR_NAPI placement
From: Andy Whitcroft @ 2007-10-18  9:40 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: leoli, jgarzik, paulus, galak, afleming, linuxppc-dev, netdev,
	linux-kernel
In-Reply-To: <20071017195746.GA15592@localhost.localdomain>

The check then is to see if a non {}'d block has no statements in it if the
ifdef is null.  Hmmm.  May be possible.  Will think on it.

        if (err)
+#ifdef CONFIG_GFAR_NAPI
                napi_disable(&priv->napi);
+#endif

-apw

^ permalink raw reply

* Re: bizarre network timing problem
From: Felix von Leitner @ 2007-10-18  9:42 UTC (permalink / raw)
  To: Rick Jones; +Cc: Chuck Ebbert, linux-kernel, Netdev
In-Reply-To: <471689BF.2040909@hp.com>

> the packet trace was a bit too cooked perhaps, but there were indications 
> that at times the TCP window was going to zero - perhaps something with 
> window updates or persist timers?

Does TCP use different window sizes on loopback?  Why is this not
happening on ethernet?

How could I test this theory?

My initial idea was that it has something todo with the different MTU on
loopback.  My initial block size was 16k, but the problem stayed when I
changed it to 64k.

Felix

^ permalink raw reply

* [PATCH 0/3] netdev: ARRAY_SIZE() cleanups
From: Alejandro Martinez Ruiz @ 2007-10-18  9:47 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Hi,

these patches convert more cases of array size calculations to use the
ARRAY_SIZE() macro.

First patch converts those of the form 'sizeof(arr) / ETH_GSTRING_LEN',
second one some other mostly obvious cases, and the third applies to the
almost dead sk98lin driver (which also removes a useless check AFAICS).

Alex


^ permalink raw reply

* Re: s390x: getting ipv6 bugs on mainline since 2.6.23-git3
From: Patrick McHardy @ 2007-10-18  9:43 UTC (permalink / raw)
  To: Andy Whitcroft
  Cc: linux390, linux-s390, netdev, linux-kernel, Kamalesh Babulal
In-Reply-To: <20071018093556.GT21136@shadowen.org>

Andy Whitcroft wrote:
> Seems we are getting some kind of bug out of our s390x partition (lnxabat1)
> when booting latest mainline releases, specifically since 2.6.23-git3.
> 
> Kernel BUG at 0000000000000002 Ýverbose debug info unavailable?
> illegal operation: 0001 Ý#1?
> Modules linked in: dm_mod sit tunnel4 ipv6 qeth ccwgroup qdio dasd_fba_mod dasd_
> eckd_mod dasd_mod
> CPU:    0    Not tainted
> Process ip (pid: 2614, task: 000000003f42f680, ksp: 000000003cf2feb8)
> Krnl PSW : 0704200180000000 0000000000000002 (0x2)
>            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:2 PM:0 EA:3
> Krnl GPRS: 0000000000000000 0000000000000000 000000003e6d5d00 000000003e01f000
>            00000000000086dd 000000003cdac144 0000000000000000 0000000000000010
>            000000003e01f000 000000003d97e3c0 0000000100eaaa00 000000003cdac100
>            000000003e6d5d00 00000001018fb1d0 0000000000286da8 000000003cf2f5e8
> Krnl Code:>0000000000000002: 0000               unknown
>            0000000000000004: 0000               unknown
>            0000000000000006: 0000               unknown
>            0000000000000008: 0000               unknown
>            000000000000000a: 0000               unknown
>            000000000000000c: 0000               unknown
>            000000000000000e: 0000               unknown
>            0000000000000010: 0000               unknown
> Call Trace:
> (Ý<0000000000286d60>? neigh_connected_output+0x68/0xfc)


Which network driver are you using? Please post the output of
"ip link list <dev>".

^ permalink raw reply

* [PATCH 1/3] netdev: use ARRAY_SIZE() instead of sizeof(array) / ETH_GSTRING_LEN
From: Alejandro Martinez Ruiz @ 2007-10-18  9:49 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev
In-Reply-To: <20071018094706.GA23058@inspiron>


From: Alejandro Martinez Ruiz <alex@flawedcode.org>
Date: Thu, 18 Oct 2007 10:00:15 +0200
Subject: [PATCH] netdev: use ARRAY_SIZE() instead of sizeof(array) / ETH_GSTRING_LEN

Using ARRAY_SIZE() on arrays of the form array[][K] makes it unnecessary
to know the value of K when checking its size.

Signed-off-by: Alejandro Martinez Ruiz <alex@flawedcode.org>
---
 drivers/net/cassini.c                   |    2 +-
 drivers/net/e100.c                      |    4 ++--
 drivers/net/e1000/e1000_ethtool.c       |    2 +-
 drivers/net/e1000e/ethtool.c            |    2 +-
 drivers/net/myri10ge/myri10ge.c         |    2 +-
 drivers/net/netxen/netxen_nic_ethtool.c |    2 +-
 drivers/net/pcnet32.c                   |    2 +-
 drivers/net/s2io.c                      |    9 ++++-----
 drivers/net/tehuti.c                    |    8 +++-----
 9 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 7df31b5..30ecbf5 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -4419,7 +4419,7 @@ static struct {
 	{"tx_fifo_errors"},
 	{"tx_packets"}
 };
-#define CAS_NUM_STAT_KEYS (sizeof(ethtool_cassini_statnames)/ETH_GSTRING_LEN)
+#define CAS_NUM_STAT_KEYS ARRAY_SIZE(ethtool_cassini_statnames)
 
 static struct {
 	const int offsets;	/* neg. values for 2nd arg to cas_read_phy */
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 64f35e2..bcb940b 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2372,7 +2372,7 @@ static const char e100_gstrings_test[][ETH_GSTRING_LEN] = {
 	"Mac loopback     (offline)",
 	"Phy loopback     (offline)",
 };
-#define E100_TEST_LEN	sizeof(e100_gstrings_test) / ETH_GSTRING_LEN
+#define E100_TEST_LEN	ARRAY_SIZE(e100_gstrings_test)
 
 static void e100_diag_test(struct net_device *netdev,
 	struct ethtool_test *test, u64 *data)
@@ -2434,7 +2434,7 @@ static const char e100_gstrings_stats[][ETH_GSTRING_LEN] = {
 	"rx_flow_control_unsupported", "tx_tco_packets", "rx_tco_packets",
 };
 #define E100_NET_STATS_LEN	21
-#define E100_STATS_LEN	sizeof(e100_gstrings_stats) / ETH_GSTRING_LEN
+#define E100_STATS_LEN	ARRAY_SIZE(e100_gstrings_stats)
 
 static int e100_get_sset_count(struct net_device *netdev, int sset)
 {
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 6c9a643..6b97361 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -113,7 +113,7 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
 	"Interrupt test (offline)", "Loopback test  (offline)",
 	"Link test   (on/offline)"
 };
-#define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
+#define E1000_TEST_LEN	ARRAY_SIZE(e1000_gstrings_test)
 
 static int
 e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 0666e62..61c84c0 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -103,7 +103,7 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
 	"Interrupt test (offline)", "Loopback test  (offline)",
 	"Link test   (on/offline)"
 };
-#define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
+#define E1000_TEST_LEN	ARRAY_SIZE(e1000_gstrings_test)
 
 static int e1000_get_settings(struct net_device *netdev,
 			      struct ethtool_cmd *ecmd)
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 64c8151..31b33c9 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1431,7 +1431,7 @@ static const char myri10ge_gstrings_stats[][ETH_GSTRING_LEN] = {
 };
 
 #define MYRI10GE_NET_STATS_LEN      21
-#define MYRI10GE_STATS_LEN  sizeof(myri10ge_gstrings_stats) / ETH_GSTRING_LEN
+#define MYRI10GE_STATS_LEN	ARRAY_SIZE(myri10ge_gstrings_stats)
 
 static void
 myri10ge_get_strings(struct net_device *netdev, u32 stringset, u8 * data)
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index cfb847b..cdec4f8 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -86,7 +86,7 @@ static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = {
 	"Link_Test_on_offline"
 };
 
-#define NETXEN_NIC_TEST_LEN sizeof(netxen_nic_gstrings_test) / ETH_GSTRING_LEN
+#define NETXEN_NIC_TEST_LEN	ARRAY_SIZE(netxen_nic_gstrings_test)
 
 #define NETXEN_NIC_REGS_COUNT 42
 #define NETXEN_NIC_REGS_LEN (NETXEN_NIC_REGS_COUNT * sizeof(__le32))
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 5f994b5..642adac 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -137,7 +137,7 @@ static const char pcnet32_gstrings_test[][ETH_GSTRING_LEN] = {
 	"Loopback test  (offline)"
 };
 
-#define PCNET32_TEST_LEN (sizeof(pcnet32_gstrings_test) / ETH_GSTRING_LEN)
+#define PCNET32_TEST_LEN	ARRAY_SIZE(pcnet32_gstrings_test)
 
 #define PCNET32_NUM_REGS 136
 
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 22e4054..7502f34 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -335,10 +335,9 @@ static char ethtool_driver_stats_keys[][ETH_GSTRING_LEN] = {
 	{"mc_err_cnt"}
 };
 
-#define S2IO_XENA_STAT_LEN sizeof(ethtool_xena_stats_keys)/ ETH_GSTRING_LEN
-#define S2IO_ENHANCED_STAT_LEN sizeof(ethtool_enhanced_stats_keys)/ \
-					ETH_GSTRING_LEN
-#define S2IO_DRIVER_STAT_LEN sizeof(ethtool_driver_stats_keys)/ ETH_GSTRING_LEN
+#define S2IO_XENA_STAT_LEN	ARRAY_SIZE(ethtool_xena_stats_keys)
+#define S2IO_ENHANCED_STAT_LEN	ARRAY_SIZE(ethtool_enhanced_stats_keys)
+#define S2IO_DRIVER_STAT_LEN	ARRAY_SIZE(ethtool_driver_stats_keys)
 
 #define XFRAME_I_STAT_LEN (S2IO_XENA_STAT_LEN + S2IO_DRIVER_STAT_LEN )
 #define XFRAME_II_STAT_LEN (XFRAME_I_STAT_LEN + S2IO_ENHANCED_STAT_LEN )
@@ -346,7 +345,7 @@ static char ethtool_driver_stats_keys[][ETH_GSTRING_LEN] = {
 #define XFRAME_I_STAT_STRINGS_LEN ( XFRAME_I_STAT_LEN * ETH_GSTRING_LEN )
 #define XFRAME_II_STAT_STRINGS_LEN ( XFRAME_II_STAT_LEN * ETH_GSTRING_LEN )
 
-#define S2IO_TEST_LEN	sizeof(s2io_gstrings) / ETH_GSTRING_LEN
+#define S2IO_TEST_LEN	ARRAY_SIZE(s2io_gstrings)
 #define S2IO_STRINGS_LEN	S2IO_TEST_LEN * ETH_GSTRING_LEN
 
 #define S2IO_TIMER_CONF(timer, handle, arg, exp)		\
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 4e1b84e..7334d09 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -2174,8 +2174,7 @@ bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
 	strncat(drvinfo->bus_info, pci_name(priv->pdev),
 		sizeof(drvinfo->bus_info));
 
-	drvinfo->n_stats = ((priv->stats_flag) ?
-			    (sizeof(bdx_stat_names) / ETH_GSTRING_LEN) : 0);
+	drvinfo->n_stats = ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0);
 	drvinfo->testinfo_len = 0;
 	drvinfo->regdump_len = 0;
 	drvinfo->eedump_len = 0;
@@ -2375,10 +2374,9 @@ static void bdx_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
 static int bdx_get_stats_count(struct net_device *netdev)
 {
 	struct bdx_priv *priv = netdev->priv;
-	BDX_ASSERT(sizeof(bdx_stat_names) / ETH_GSTRING_LEN
+	BDX_ASSERT(ARRAY_SIZE(bdx_stat_names)
 		   != sizeof(struct bdx_stats) / sizeof(u64));
-	return ((priv->stats_flag) ? (sizeof(bdx_stat_names) / ETH_GSTRING_LEN)
-		: 0);
+	return ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names)	: 0);
 }
 
 /*
-- 
1.5.3.4



^ permalink raw reply related

* [PATCH 2/3] netdev: ARRAY_SIZE() cleanups
From: Alejandro Martinez Ruiz @ 2007-10-18  9:50 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev
In-Reply-To: <20071018094706.GA23058@inspiron>

From: Alejandro Martinez Ruiz <alex@flawedcode.org>
Date: Thu, 18 Oct 2007 10:16:33 +0200
Subject: [PATCH] netdev: ARRAY_SIZE() cleanups

Convert array size calculations to use ARRAY_SIZE().

Signed-off-by: Alejandro Martinez Ruiz <alex@flawedcode.org>
---
 drivers/net/e1000e/ethtool.c         |    3 +--
 drivers/net/e1000e/phy.c             |    3 +--
 drivers/net/ixgbe/ixgbe_ethtool.c    |    3 +--
 drivers/net/tehuti.c                 |    2 +-
 drivers/net/tulip/de4x5.c            |    2 +-
 drivers/net/wireless/ipw2100.c       |    3 +--
 drivers/net/wireless/libertas/11d.c  |   24 +++++++-----------------
 drivers/net/wireless/libertas/wext.c |   11 +++--------
 drivers/net/wireless/wavelan.c       |    2 +-
 drivers/net/wireless/wavelan_cs.c    |    4 ++--
 10 files changed, 19 insertions(+), 38 deletions(-)

diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 61c84c0..85297cd 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -95,8 +95,7 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
 	{ "tx_dma_failed", E1000_STAT(tx_dma_failed) },
 };
 
-#define E1000_GLOBAL_STATS_LEN	\
-	sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats)
+#define E1000_GLOBAL_STATS_LEN	ARRAY_SIZE(e1000_gstrings_stats)
 #define E1000_STATS_LEN (E1000_GLOBAL_STATS_LEN)
 static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
 	"Register test  (offline)", "Eeprom test    (offline)",
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 7932318..fc6fee1 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -49,8 +49,7 @@ static const u16 e1000_igp_2_cable_length_table[] =
 	  100, 105, 109, 113, 116, 119, 122, 124, 104, 109, 114, 118, 121,
 	  124};
 #define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \
-		(sizeof(e1000_igp_2_cable_length_table) / \
-		 sizeof(e1000_igp_2_cable_length_table[0]))
+		ARRAY_SIZE(e1000_igp_2_cable_length_table)
 
 /**
  *  e1000e_check_reset_block_generic - Check if PHY reset is blocked
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index a4e576a..3635344 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -96,8 +96,7 @@ static struct ixgbe_stats ixgbe_gstrings_stats[] = {
 		((((struct ixgbe_adapter *)netdev->priv)->num_tx_queues + \
 		 ((struct ixgbe_adapter *)netdev->priv)->num_rx_queues) * \
 		 (sizeof(struct ixgbe_queue_stats) / sizeof(u64)))
-#define IXGBE_GLOBAL_STATS_LEN \
-	sizeof(ixgbe_gstrings_stats) / sizeof(struct ixgbe_stats)
+#define IXGBE_GLOBAL_STATS_LEN	ARRAY_SIZE(ixgbe_gstrings_stats)
 #define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + IXGBE_QUEUE_STATS_LEN)
 
 static int ixgbe_get_settings(struct net_device *netdev,
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index 7334d09..db59c48 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -621,7 +621,7 @@ err:
 static void __init bdx_firmware_endianess(void)
 {
 	int i;
-	for (i = 0; i < sizeof(s_firmLoad) / sizeof(u32); i++)
+	for (i = 0; i < ARRAY_SIZE(s_firmLoad); i++)
 		s_firmLoad[i] = CPU_CHIP_SWAP32(s_firmLoad[i]);
 }
 
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index 41f34bb..c5ebf00 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -4175,7 +4175,7 @@ de4x5_bad_srom(struct de4x5_private *lp)
 {
     int i, status = 0;
 
-    for (i=0; i<sizeof(enet_det)/ETH_ALEN; i++) {
+    for (i=0; i < ARRAY_SIZE(enet_det); i++) {
 	if (!de4x5_strncmp((char *)&lp->srom, (char *)&enet_det[i], 3) &&
 	    !de4x5_strncmp((char *)&lp->srom+0x10, (char *)&enet_det[i], 3)) {
 	    if (i == 0) {
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index 2d46a16..8f5497b 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -6582,8 +6582,7 @@ static const long ipw2100_frequencies[] = {
 	2472, 2484
 };
 
-#define FREQ_COUNT (sizeof(ipw2100_frequencies) / \
-                    sizeof(ipw2100_frequencies[0]))
+#define FREQ_COUNT	ARRAY_SIZE(ipw2100_frequencies)
 
 static const long ipw2100_rates_11b[] = {
 	1000000,
diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c
index 9cf0211..8bbd322 100644
--- a/drivers/net/wireless/libertas/11d.c
+++ b/drivers/net/wireless/libertas/11d.c
@@ -46,13 +46,11 @@ static struct chan_freq_power channel_freq_power_UN_BG[] = {
 static u8 wlan_region_2_code(u8 * region)
 {
 	u8 i;
-	u8 size = sizeof(region_code_mapping)/
-		  sizeof(struct region_code_mapping);
 
 	for (i = 0; region[i] && i < COUNTRY_CODE_LEN; i++)
 		region[i] = toupper(region[i]);
 
-	for (i = 0; i < size; i++) {
+	for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) {
 		if (!memcmp(region, region_code_mapping[i].region,
 			    COUNTRY_CODE_LEN))
 			return (region_code_mapping[i].code);
@@ -65,9 +63,8 @@ static u8 wlan_region_2_code(u8 * region)
 static u8 *wlan_code_2_region(u8 code)
 {
 	u8 i;
-	u8 size = sizeof(region_code_mapping)
-		  / sizeof(struct region_code_mapping);
-	for (i = 0; i < size; i++) {
+
+	for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) {
 		if (region_code_mapping[i].code == code)
 			return (region_code_mapping[i].region);
 	}
@@ -90,8 +87,7 @@ static u8 wlan_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 * chan)
 	u8 cfp_no;
 
 	cfp = channel_freq_power_UN_BG;
-	cfp_no = sizeof(channel_freq_power_UN_BG) /
-	    sizeof(struct chan_freq_power);
+	cfp_no = ARRAY_SIZE(channel_freq_power_UN_BG);
 
 	for (i = 0; i < cfp_no; i++) {
 		if ((cfp + i)->channel == firstchan) {
@@ -141,16 +137,12 @@ static u8 wlan_channel_known_11d(u8 chan,
 u32 libertas_chan_2_freq(u8 chan, u8 band)
 {
 	struct chan_freq_power *cf;
-	u16 cnt;
 	u16 i;
 	u32 freq = 0;
 
 	cf = channel_freq_power_UN_BG;
-	cnt =
-	    sizeof(channel_freq_power_UN_BG) /
-	    sizeof(struct chan_freq_power);
 
-	for (i = 0; i < cnt; i++) {
+	for (i = 0; i < ARRAY_SIZE(channel_freq_power_UN_BG); i++) {
 		if (chan == cf[i].channel)
 			freq = cf[i].freq;
 	}
@@ -664,8 +656,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
 	if (priv->adapter->enable11d) {
 		/* update parsed_region_chan_11; dnld domaininf to FW */
 
-		for (j = 0; j < sizeof(adapter->region_channel) /
-		     sizeof(adapter->region_channel[0]); j++) {
+		for (j = 0; j < ARRAY_SIZE(adapter->region_channel); j++) {
 			region_chan = &adapter->region_channel[j];
 
 			lbs_deb_11d("%d region_chan->band %d\n", j,
@@ -679,8 +670,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
 			break;
 		}
 
-		if (j >= sizeof(adapter->region_channel) /
-		    sizeof(adapter->region_channel[0])) {
+		if (j >= ARRAY_SIZE(adapter->region_channel)) {
 			lbs_deb_11d("region_chan not found, band %d\n",
 			       adapter->curbssparams.band);
 			ret = -1;
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index c6f5aa3..37b1777 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -34,11 +34,9 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada
 {
 	struct chan_freq_power *cfp = NULL;
 	struct region_channel *rc;
-	int count = sizeof(adapter->region_channel) /
-	    sizeof(adapter->region_channel[0]);
 	int i, j;
 
-	for (j = 0; !cfp && (j < count); j++) {
+	for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) {
 		rc = &adapter->region_channel[j];
 
 		if (adapter->enable11d)
@@ -75,11 +73,9 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter,
 {
 	struct chan_freq_power *cfp = NULL;
 	struct region_channel *rc;
-	int count = sizeof(adapter->region_channel) /
-	    sizeof(adapter->region_channel[0]);
 	int i, j;
 
-	for (j = 0; !cfp && (j < count); j++) {
+	for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) {
 		rc = &adapter->region_channel[j];
 
 		if (adapter->enable11d)
@@ -606,8 +602,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
 	}
 	if (!flag) {
 		for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
-		     && (j < sizeof(adapter->region_channel)
-			 / sizeof(adapter->region_channel[0])); j++) {
+		     && (j < ARRAY_SIZE(adapter->region_channel)); j++) {
 			cfp = adapter->region_channel[j].CFP;
 			for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
 			     && adapter->region_channel[j].valid
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c
index a1f8a16..b343ce2 100644
--- a/drivers/net/wireless/wavelan.c
+++ b/drivers/net/wireless/wavelan.c
@@ -3740,7 +3740,7 @@ static int wv_check_ioaddr(unsigned long ioaddr, u8 * mac)
 	 * non-NCR/AT&T/Lucent ISA card.  See wavelan.p.h for detail on
 	 * how to configure your card.
 	 */
-	for (i = 0; i < (sizeof(MAC_ADDRESSES) / sizeof(char) / 3); i++)
+	for (i = 0; i < ARRAY_SIZE(MAC_ADDRESSES); i++)
 		if ((mac[0] == MAC_ADDRESSES[i][0]) &&
 		    (mac[1] == MAC_ADDRESSES[i][1]) &&
 		    (mac[2] == MAC_ADDRESSES[i][2]))
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 577c647..f5b38de 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -3223,14 +3223,14 @@ wv_mmc_init(struct net_device *	dev)
    * non-NCR/AT&T/Lucent PCMCIA cards, see wavelan_cs.h for detail on
    * how to configure your card...
    */
-  for(i = 0; i < (sizeof(MAC_ADDRESSES) / sizeof(char) / 3); i++)
+  for(i = 0; i < ARRAY_SIZE(MAC_ADDRESSES); i++)
     if((psa.psa_univ_mac_addr[0] == MAC_ADDRESSES[i][0]) &&
        (psa.psa_univ_mac_addr[1] == MAC_ADDRESSES[i][1]) &&
        (psa.psa_univ_mac_addr[2] == MAC_ADDRESSES[i][2]))
       break;
 
   /* If we have not found it... */
-  if(i == (sizeof(MAC_ADDRESSES) / sizeof(char) / 3))
+  if(i == ARRAY_SIZE(MAC_ADDRESSES))
     {
 #ifdef DEBUG_CONFIG_ERRORS
       printk(KERN_WARNING "%s: wv_mmc_init(): Invalid MAC address: %02X:%02X:%02X:...\n",
-- 
1.5.3.4



^ permalink raw reply related


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