* Re: [PATCH 0/4] Pull request for 'ipg-fixes' branch
From: Francois Romieu @ 2008-01-13 22:34 UTC (permalink / raw)
To: Jeff Garzik; +Cc: David Miller, linux, Andrew Morton, netdev
In-Reply-To: <20080113155028.GA30392@electric-eye.fr.zoreil.com>
Francois Romieu <romieu@fr.zoreil.com> :
> Jeff Garzik <jeff@garzik.org> :
> > Francois Romieu wrote:
> [...]
> >> Distance from 'net-2.6/master' (27d1cba21fcc50c37eef5042c6be9fa7135e88fc)
> >> -------------------------------------------------------------------------
> [...]
> > hrm... tried to pull this, but received non-ipg stuff too
>
> It is based on one of davem's branches (see the 'distance' line above).
>
> Do you want a branch against your upstream-fixes ?
It is available at:
git://git.kernel.org/pub/scm/linux/kernel/git/romieu/netdev-2.6.git upstream-jeff
Distance from 'upstream-linus' (cb8da8a38015ded1df319a39b7298e69f89036ac)
-------------------------------------------------------------------------
f1f443e6276aae3862a970b141102c51f5e25e4b
b76c7331afe11544063d2c3390de8c9a7ba6db83
98ae57a0dada63ab9b811e89a4b70ca4e4da7497
184c6cf5e4b8e659095fd9e2b54ef37f131b5810
It is up to you and davem to decide who wants to pull it.
--
Ueimor
^ permalink raw reply
* [FIB]: full_children & empty_children should be uint, not ushort
From: Robert Olsson @ 2008-01-13 22:02 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, Stephen Hemminger, Robert Olsson, netdev
In-Reply-To: <478A58BD.8010304@cosmosbay.com>
Eric Dumazet writes:
> Eric Dumazet a écrit :
> > 4) full_children & empty_children being 'unsigned short',
> > we probably are limited to 2^15 elements, but I could not
> > find this limit enforced somewhere.
> Two fixes are possible : Enlarge full_children & empty_children to 32bits, or
> force a limit in code to never exceed 2^15 children in a tnode. I chose the
> first solution since it can be done with 0 memory cost on 64bit arches.
Hello,
Thanks for spotting this. No we don't want put limits on the (root) node size.
You see the comment in code is correct so unsigned short are some leftover from
old testing which could have hit us hard as the routing table slowly grows.
Cheers
--ro
Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
> [FIB]: full_children & empty_children should be uint, not ushort
>
> If declared as unsigned short, these fields can overflow, and whole trie logic
> is broken. I could not make the machine crash, but some tnode can never
> be freed.
>
> Note for 64 bit arches : By reordering t_key and parent in [node, leaf, tnode]
> structures, we can use 32 bits hole after t_key so that sizeof(struct tnode)
> doesnt change after this patch.
>
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
>
> diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> index f26ba31..9696722 100644
> --- a/net/ipv4/fib_trie.c
> +++ b/net/ipv4/fib_trie.c
> @@ -97,13 +97,13 @@ typedef unsigned int t_key;
> #define IS_LEAF(n) (n->parent & T_LEAF)
>
> struct node {
> - t_key key;
> unsigned long parent;
> + t_key key;
> };
>
> struct leaf {
> - t_key key;
> unsigned long parent;
> + t_key key;
> struct hlist_head list;
> struct rcu_head rcu;
> };
> @@ -116,12 +116,12 @@ struct leaf_info {
> };
>
> struct tnode {
> - t_key key;
> unsigned long parent;
> + t_key key;
> unsigned char pos; /* 2log(KEYLENGTH) bits needed */
> unsigned char bits; /* 2log(KEYLENGTH) bits needed */
> - unsigned short full_children; /* KEYLENGTH bits needed */
> - unsigned short empty_children; /* KEYLENGTH bits needed */
> + unsigned int full_children; /* KEYLENGTH bits needed */
> + unsigned int empty_children; /* KEYLENGTH bits needed */
> struct rcu_head rcu;
> struct node *child[0];
> };
> @@ -329,12 +329,12 @@ static inline void free_leaf_info(struct leaf_info *leaf)
> call_rcu(&leaf->rcu, __leaf_info_free_rcu);
> }
>
> -static struct tnode *tnode_alloc(unsigned int size)
> +static struct tnode *tnode_alloc(size_t size)
> {
> struct page *pages;
>
> if (size <= PAGE_SIZE)
> - return kcalloc(size, 1, GFP_KERNEL);
> + return kzalloc(size, GFP_KERNEL);
>
> pages = alloc_pages(GFP_KERNEL|__GFP_ZERO, get_order(size));
> if (!pages)
> @@ -346,8 +346,8 @@ static struct tnode *tnode_alloc(unsigned int size)
> static void __tnode_free_rcu(struct rcu_head *head)
> {
> struct tnode *tn = container_of(head, struct tnode, rcu);
> - unsigned int size = sizeof(struct tnode) +
> - (1 << tn->bits) * sizeof(struct node *);
> + size_t size = sizeof(struct tnode) +
> + (sizeof(struct node *) << tn->bits);
>
> if (size <= PAGE_SIZE)
> kfree(tn);
> @@ -386,8 +386,7 @@ static struct leaf_info *leaf_info_new(int plen)
>
> static struct tnode* tnode_new(t_key key, int pos, int bits)
> {
> - int nchildren = 1<<bits;
> - int sz = sizeof(struct tnode) + nchildren * sizeof(struct node *);
> + size_t sz = sizeof(struct tnode) + (sizeof(struct node *) << bits);
> struct tnode *tn = tnode_alloc(sz);
>
> if (tn) {
> @@ -399,8 +398,8 @@ static struct tnode* tnode_new(t_key key, int pos, int bits)
> tn->empty_children = 1<<bits;
> }
>
> - pr_debug("AT %p s=%u %u\n", tn, (unsigned int) sizeof(struct tnode),
> - (unsigned int) (sizeof(struct node) * 1<<bits));
> + pr_debug("AT %p s=%u %lu\n", tn, (unsigned int) sizeof(struct tnode),
> + (unsigned long) (sizeof(struct node) << bits));
> return tn;
> }
>
^ permalink raw reply
* Re: 2.6.24-rc6-mm1 - oddness with IPv4/v6 mapped sockets hanging...
From: Herbert Xu @ 2008-01-13 21:46 UTC (permalink / raw)
To: Valdis.Kletnieks; +Cc: akpm, linux-kernel, netdev
In-Reply-To: <30887.1200209733@turing-police.cc.vt.edu>
Valdis.Kletnieks@vt.edu wrote:
>
> Any ideas?
Please provide a packet dump on both sides (or at least the sender
side).
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
^ permalink raw reply
* Re: [PATCH v2] Documentation: add a guideline for hard_start_xmit method
From: Herbert Xu @ 2008-01-13 21:45 UTC (permalink / raw)
To: Matti Linnanvuori; +Cc: jgarzik, netdev
In-Reply-To: <13447.65555.qm@web52011.mail.re2.yahoo.com>
Matti Linnanvuori <mattilinnanvuori@yahoo.com> wrote:
>
> -3) Do not forget that once you return 0 from your hard_start_xmit
> +3) A hard_start_xmit method must not modify the shared parts of the SKB.
Only if it's cloned.
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: [Bugme-new] [Bug 9721] New: wake on lan fails with sky2 module
From: Rafael J. Wysocki @ 2008-01-13 21:27 UTC (permalink / raw)
To: Andrew Morton
Cc: supersud501, Stephen Hemminger, netdev, linux-acpi, bugme-daemon
In-Reply-To: <20080113125708.070b4843.akpm@linux-foundation.org>
I wonder if commit 84cd2dfb04d23a961c5f537baa243fa54d0987ac
"sky2: remove check for PCI wakeup setting from BIOS" has anything to do with
it, btw.
supersud501, can you please check if the bug is still present in the current
Linus' tree?
^ permalink raw reply
* Re: [Bugme-new] [Bug 9721] New: wake on lan fails with sky2 module
From: Rafael J. Wysocki @ 2008-01-13 21:25 UTC (permalink / raw)
To: Andrew Morton
Cc: supersud501, Stephen Hemminger, netdev, linux-acpi, bugme-daemon
In-Reply-To: <20080113125708.070b4843.akpm@linux-foundation.org>
On Sunday, 13 of January 2008, Andrew Morton wrote:
>
> 2.6.23 also has this warning in sky2_err_intr() but it doesn't trigger
> there. Rafael, I think we'd have to class this as a post-2.6.23
> regression.
Yes, it's been being tracked already.
^ permalink raw reply
* Re: [Bugme-new] [Bug 9721] New: wake on lan fails with sky2 module
From: Andrew Morton @ 2008-01-13 20:57 UTC (permalink / raw)
To: supersud501
Cc: Rafael J. Wysocki, Stephen Hemminger, netdev, linux-acpi,
bugme-daemon
In-Reply-To: <478A743C.9050405@yahoo.de>
On Sun, 13 Jan 2008 21:27:40 +0100 supersud501 <supersud501@yahoo.de> wrote:
>
>
> Andrew Morton wrote:
> >
> > So simply reverting this:
> >
> > commit ac93a3946b676025fa55356180e8321639744b31
> > Author: Stephen Hemminger <shemminger@linux-foundation.org>
> > Date: Mon Nov 5 15:52:08 2007 -0800
> >
> > sky2: enable PCI config writes
> >
> > On some boards, PCI configuration space access is turned off by default.
> > The 2.6.24 driver doesn't turn it on, and should have.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
> > Signed-off-by: Jeff Garzik <jeff@garzik.org>
> >
> > diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
> > index c27c7d6..4f41a94 100644
> > --- a/drivers/net/sky2.c
> > +++ b/drivers/net/sky2.c
> > @@ -2791,6 +2791,9 @@ static void sky2_reset(struct sky2_hw *hw)
> > sky2_write8(hw, B0_CTST, CS_RST_SET);
> > sky2_write8(hw, B0_CTST, CS_RST_CLR);
> >
> > + /* allow writes to PCI config */
> > + sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
> > +
> > /* clear PCI errors, if any */
> > pci_read_config_word(pdev, PCI_STATUS, &status);
> > status |= PCI_STATUS_ERROR_BITS;
> >
> > fixes this regression?
> >
> > If so, we should revert that change.
> >
>
>
> yes, it does.
>
OK, thanks. I queued up the revert and shall wait to hear from
Stephen/David/Jeff on this.
>
> >> but i noticed another "bug" on 2.6.24-rc7-git with sky2: dmesg shows a
> >> lot of lines every 5 seconds:
> >>
> >> [...]
> >> [ 357.400462] sky2 0000:02:00.0: error interrupt status=0xc0000000
> >> [ 362.442039] printk: 41 messages suppressed.
> >> [ 362.442043] sky2 0000:02:00.0: error interrupt status=0x80000000
> >> [ 367.439151] printk: 18 messages suppressed.
> >> [ 367.439156] sky2 0000:02:00.0: error interrupt status=0x80000000
> >> [ 372.436267] printk: 30 messages suppressed.
> >> [ 372.436271] sky2 0000:02:00.0: error interrupt status=0x80000000
> >> [ 377.350236] printk: 19 messages suppressed.
> >> [...]
> >>
> >> since i do not notice any errors (yet) i'll wait till next rc, maybe it
> >> will be gone then...
> >
> > That's not good. is this new behaviour?
> >
> >
>
> at least on 2.6.23.12 i doesn't happen, so it's now for me in
> 2.6.24-rc7-git4 (but again, not testet in earlier versions of 2.6.24).
>
> since i do not feel any sideeffects yet after using it for ~6 hours
> (besides a really long dmesg-output), it's just a little bit annoying.
>
> if there's a way to identify the source of the problem besides of
> bisecting, just say so and i will take a look into it the next days. if
> bisecting is the only (time-consuming) way you have to wait at least
> until the next weekend :)
2.6.23 also has this warning in sky2_err_intr() but it doesn't trigger
there. Rafael, I think we'd have to class this as a post-2.6.23
regression.
^ permalink raw reply
* Re: [Bugme-new] [Bug 9721] New: wake on lan fails with sky2 module
From: supersud501 @ 2008-01-13 20:27 UTC (permalink / raw)
To: Andrew Morton
Cc: Rafael J. Wysocki, Stephen Hemminger, netdev, linux-acpi,
bugme-daemon
In-Reply-To: <20080113112712.e93f07a4.akpm@linux-foundation.org>
Andrew Morton wrote:
>
> So simply reverting this:
>
> commit ac93a3946b676025fa55356180e8321639744b31
> Author: Stephen Hemminger <shemminger@linux-foundation.org>
> Date: Mon Nov 5 15:52:08 2007 -0800
>
> sky2: enable PCI config writes
>
> On some boards, PCI configuration space access is turned off by default.
> The 2.6.24 driver doesn't turn it on, and should have.
>
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
> Signed-off-by: Jeff Garzik <jeff@garzik.org>
>
> diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
> index c27c7d6..4f41a94 100644
> --- a/drivers/net/sky2.c
> +++ b/drivers/net/sky2.c
> @@ -2791,6 +2791,9 @@ static void sky2_reset(struct sky2_hw *hw)
> sky2_write8(hw, B0_CTST, CS_RST_SET);
> sky2_write8(hw, B0_CTST, CS_RST_CLR);
>
> + /* allow writes to PCI config */
> + sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
> +
> /* clear PCI errors, if any */
> pci_read_config_word(pdev, PCI_STATUS, &status);
> status |= PCI_STATUS_ERROR_BITS;
>
> fixes this regression?
>
> If so, we should revert that change.
>
yes, it does.
>> but i noticed another "bug" on 2.6.24-rc7-git with sky2: dmesg shows a
>> lot of lines every 5 seconds:
>>
>> [...]
>> [ 357.400462] sky2 0000:02:00.0: error interrupt status=0xc0000000
>> [ 362.442039] printk: 41 messages suppressed.
>> [ 362.442043] sky2 0000:02:00.0: error interrupt status=0x80000000
>> [ 367.439151] printk: 18 messages suppressed.
>> [ 367.439156] sky2 0000:02:00.0: error interrupt status=0x80000000
>> [ 372.436267] printk: 30 messages suppressed.
>> [ 372.436271] sky2 0000:02:00.0: error interrupt status=0x80000000
>> [ 377.350236] printk: 19 messages suppressed.
>> [...]
>>
>> since i do not notice any errors (yet) i'll wait till next rc, maybe it
>> will be gone then...
>
> That's not good. is this new behaviour?
>
>
at least on 2.6.23.12 i doesn't happen, so it's now for me in
2.6.24-rc7-git4 (but again, not testet in earlier versions of 2.6.24).
since i do not feel any sideeffects yet after using it for ~6 hours
(besides a really long dmesg-output), it's just a little bit annoying.
if there's a way to identify the source of the problem besides of
bisecting, just say so and i will take a look into it the next days. if
bisecting is the only (time-consuming) way you have to wait at least
until the next weekend :)
^ permalink raw reply
* Re: [PATCH 2.6.23+] ingress classify to [nf]mark
From: jamal @ 2008-01-13 19:44 UTC (permalink / raw)
To: mahatma; +Cc: netdev
In-Reply-To: <4788FF45.702@bspu.unibel.by>
Hi,
Please CC me in your responses (the way i do when i respond to you),
that way my filters prioritize your email.
On Sat, 2008-12-01 at 15:56 -0200, Dzianis Kahanovich wrote:
> I in doubts only about "action continue".
> To "and/or" behaviour one of best usage are (example):
I dont think you should be touching the action part at all primarily
because actions can set the mark after classification.
The action code (not the default) should be the override. IOW, if i
specify a ipt mark of some value i would expect that value to be what
goes into the network stack and not the default value you want. Same if
i had a series of actions which override each others settings of mark.
When we have a metadata action, we can remove the setting of tcindex
in the action OK result case (for now it doesnt harm).
In other words, just set the #ifndef action to set both the tcindex and
mark to some policy;
> # set bit 2 of mark to 0 (mark&0xfd|0) and continue
> tc filter add ... prio 1 ... flowid fd:0 action continue
> # continue
> tc filter add ... prio 2 ...
>
> - in current ingress_enqueue() code IMHO "case TC_ACT_OK:" will not reached
> for action continue. I use old (mark=...) solution only by this.
>
> I think, "skb->mark = (skb->mark&(res.classid>>16))|TC_H_MIN(res.classid);"
> must be in the end of ingress_enqueue() before "return result". And not
> depended to "NET_CLS_ACT". But while not test it.
> Or this:
> ---
> #ifdef CONFIG_NET_SCH_INGRESS_TC2MARK
> #ifdef CONFIG_NET_CLS_ACT
> skb->mark = (skb->mark&(res.classid>>16))|TC_H_MIN(res.classid);
> #else
> skb->mark = res.classid;
> #endif
> #endif
Please refer to what i said above; if what i said still doesnt make
sense i can create (the simple) patch.
cheers,
jamal
^ permalink raw reply
* Re: [Bugme-new] [Bug 9721] New: wake on lan fails with sky2 module
From: Andrew Morton @ 2008-01-13 19:27 UTC (permalink / raw)
To: supersud501
Cc: Rafael J. Wysocki, Stephen Hemminger, netdev, linux-acpi,
bugme-daemon
In-Reply-To: <478A2976.9000204@yahoo.de>
On Sun, 13 Jan 2008 16:08:38 +0100 supersud501 <supersud501@yahoo.de> wrote:
>
>
> supersud501 wrote:
> >
> >
> > Rafael J. Wysocki wrote:
> >
> >>
> >> Since it seems to be 100% reproducible, it would be very helpful if
> >> you could
> >> use git-bisect to identify the offending commit.
> >>
> >
> > allright, bisect found the offending commit, here's what i've done:
> >
> > first i started bisect with the following command (since i assumed it is
> > a net-driver problem):
> >
> > git-bisect start 'v2.6.24-rc6' 'v2.6.23' '--' 'drivers/net/'
> >
> > after building many kernels and saying good/bad if wol worked/didn't
> > work etc. it identified the following commit:
> >
> > # bad: [ac93a3946b676025fa55356180e8321639744b31] sky2: enable PCI
> > config writes
> >
> > and refs/bisect/bad gives:
> >
> > 14:16:53 /usr/src/linux-2.6/.git # cat refs/bisect/bad
> > ac93a3946b676025fa55356180e8321639744b31
> >
> >
> > need some more info?
> >
>
> i just checked it: commented out the passage of the commit in kernel
> 2.6.24-rc7-git4 and compiled it: wol WORKS. so this one line is causing
> my wol-disturbance...
>
>
So simply reverting this:
commit ac93a3946b676025fa55356180e8321639744b31
Author: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Mon Nov 5 15:52:08 2007 -0800
sky2: enable PCI config writes
On some boards, PCI configuration space access is turned off by default.
The 2.6.24 driver doesn't turn it on, and should have.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index c27c7d6..4f41a94 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -2791,6 +2791,9 @@ static void sky2_reset(struct sky2_hw *hw)
sky2_write8(hw, B0_CTST, CS_RST_SET);
sky2_write8(hw, B0_CTST, CS_RST_CLR);
+ /* allow writes to PCI config */
+ sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
+
/* clear PCI errors, if any */
pci_read_config_word(pdev, PCI_STATUS, &status);
status |= PCI_STATUS_ERROR_BITS;
fixes this regression?
If so, we should revert that change.
> but i noticed another "bug" on 2.6.24-rc7-git with sky2: dmesg shows a
> lot of lines every 5 seconds:
>
> [...]
> [ 357.400462] sky2 0000:02:00.0: error interrupt status=0xc0000000
> [ 362.442039] printk: 41 messages suppressed.
> [ 362.442043] sky2 0000:02:00.0: error interrupt status=0x80000000
> [ 367.439151] printk: 18 messages suppressed.
> [ 367.439156] sky2 0000:02:00.0: error interrupt status=0x80000000
> [ 372.436267] printk: 30 messages suppressed.
> [ 372.436271] sky2 0000:02:00.0: error interrupt status=0x80000000
> [ 377.350236] printk: 19 messages suppressed.
> [...]
>
> since i do not notice any errors (yet) i'll wait till next rc, maybe it
> will be gone then...
That's not good. is this new behaviour?
^ permalink raw reply related
* Re: Netconf at conf.au 2008?
From: martin f krafft @ 2008-01-13 18:17 UTC (permalink / raw)
To: netdev
In-Reply-To: <147a89290801112252gfcfaf11h1d25ee3c66e75881@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 906 bytes --]
also sprach Andy Johnson <johnsonzjo@gmail.com> [2008.01.12.0752 +0100]:
> I saw somewhere (maybe in this mailing list a while ago) that
> there might be a Linux Kernel Developers' Netconf conference at
> conf.au 2008.
I think you may be mixing things up, and it may be my fault in ways.
I am developing netconf: http://netconf.alioth.debian.org. I am
aware of the NETCONF protocol and have considered renaming my
project, but looking around, it seemed to me that NETCONF isn't
really all that active, and so I chose to keep the name. If people
think that wasn't wise, I'm willing to listen...
--
martin | http://madduck.net/ | http://two.sentenc.es/
"the only difference between the saint and the sinner
is that every saint has a past and every sinner has a future."
-- oscar wilde
spamtraps: madduck.bogus@madduck.net
[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* [FIB]: full_children & empty_children should be uint, not ushort
From: Eric Dumazet @ 2008-01-13 18:30 UTC (permalink / raw)
To: David Miller; +Cc: Stephen Hemminger, Robert Olsson, netdev
In-Reply-To: <4788A17D.5070903@cosmosbay.com>
[-- Attachment #1: Type: text/plain, Size: 1328 bytes --]
Eric Dumazet a écrit :
> 4) full_children & empty_children being 'unsigned short',
> we probably are limited to 2^15 elements, but I could not
> find this limit enforced somewhere.
Hi David
In my testings, I found that once a tnode is built with 2^16 slots (or more),
it cannot be freed.
Extract of /proc/net/fib_triestat
Main:
Aver depth: 1.50
Max depth: 2
Leaves: 2
Internal nodes: 3
1: 1 2: 1 17: 1
Pointers: 131078
Null ptrs: 131074
Total size: 513 kB
# ip route
192.168.11.0/24 dev eth0 proto kernel scope link src 192.168.11.129
default via 192.168.11.2 dev eth0
Two fixes are possible : Enlarge full_children & empty_children to 32bits, or
force a limit in code to never exceed 2^15 children in a tnode. I chose the
first solution since it can be done with 0 memory cost on 64bit arches.
Thank you
[FIB]: full_children & empty_children should be uint, not ushort
If declared as unsigned short, these fields can overflow, and whole trie logic
is broken. I could not make the machine crash, but some tnode can never
be freed.
Note for 64 bit arches : By reordering t_key and parent in [node, leaf, tnode]
structures, we can use 32 bits hole after t_key so that sizeof(struct tnode)
doesnt change after this patch.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
[-- Attachment #2: fib_trie.patch --]
[-- Type: text/plain, Size: 2515 bytes --]
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index f26ba31..9696722 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -97,13 +97,13 @@ typedef unsigned int t_key;
#define IS_LEAF(n) (n->parent & T_LEAF)
struct node {
- t_key key;
unsigned long parent;
+ t_key key;
};
struct leaf {
- t_key key;
unsigned long parent;
+ t_key key;
struct hlist_head list;
struct rcu_head rcu;
};
@@ -116,12 +116,12 @@ struct leaf_info {
};
struct tnode {
- t_key key;
unsigned long parent;
+ t_key key;
unsigned char pos; /* 2log(KEYLENGTH) bits needed */
unsigned char bits; /* 2log(KEYLENGTH) bits needed */
- unsigned short full_children; /* KEYLENGTH bits needed */
- unsigned short empty_children; /* KEYLENGTH bits needed */
+ unsigned int full_children; /* KEYLENGTH bits needed */
+ unsigned int empty_children; /* KEYLENGTH bits needed */
struct rcu_head rcu;
struct node *child[0];
};
@@ -329,12 +329,12 @@ static inline void free_leaf_info(struct leaf_info *leaf)
call_rcu(&leaf->rcu, __leaf_info_free_rcu);
}
-static struct tnode *tnode_alloc(unsigned int size)
+static struct tnode *tnode_alloc(size_t size)
{
struct page *pages;
if (size <= PAGE_SIZE)
- return kcalloc(size, 1, GFP_KERNEL);
+ return kzalloc(size, GFP_KERNEL);
pages = alloc_pages(GFP_KERNEL|__GFP_ZERO, get_order(size));
if (!pages)
@@ -346,8 +346,8 @@ static struct tnode *tnode_alloc(unsigned int size)
static void __tnode_free_rcu(struct rcu_head *head)
{
struct tnode *tn = container_of(head, struct tnode, rcu);
- unsigned int size = sizeof(struct tnode) +
- (1 << tn->bits) * sizeof(struct node *);
+ size_t size = sizeof(struct tnode) +
+ (sizeof(struct node *) << tn->bits);
if (size <= PAGE_SIZE)
kfree(tn);
@@ -386,8 +386,7 @@ static struct leaf_info *leaf_info_new(int plen)
static struct tnode* tnode_new(t_key key, int pos, int bits)
{
- int nchildren = 1<<bits;
- int sz = sizeof(struct tnode) + nchildren * sizeof(struct node *);
+ size_t sz = sizeof(struct tnode) + (sizeof(struct node *) << bits);
struct tnode *tn = tnode_alloc(sz);
if (tn) {
@@ -399,8 +398,8 @@ static struct tnode* tnode_new(t_key key, int pos, int bits)
tn->empty_children = 1<<bits;
}
- pr_debug("AT %p s=%u %u\n", tn, (unsigned int) sizeof(struct tnode),
- (unsigned int) (sizeof(struct node) * 1<<bits));
+ pr_debug("AT %p s=%u %lu\n", tn, (unsigned int) sizeof(struct tnode),
+ (unsigned long) (sizeof(struct node) << bits));
return tn;
}
^ permalink raw reply related
* Re: [PATCH] fib_semantics: prevent long hash chains in access server config
From: Benjamin LaHaise @ 2008-01-13 17:58 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20080112.213857.68003780.davem@davemloft.net>
On Sat, Jan 12, 2008 at 09:38:57PM -0800, David Miller wrote:
> And guess why we don't do this? Because it's not part of
> the key. Other aspects of the base fib_info and nexthops
> provide the uniqueness, not the devindex of the first hop.
>
> So you'll need to find another way to do this.
Ah, you're right indeed. It's probably easier for me to change how the
daemon adds the local ip address for these point to point interfaces.
-ben
--
"Time is of no importance, Mr. President, only life is important."
Don't Email: <zyntrop@kvack.org>.
^ permalink raw reply
* Re: [PATCH 0/4] Pull request for 'ipg-fixes' branch
From: Francois Romieu @ 2008-01-13 15:50 UTC (permalink / raw)
To: Jeff Garzik; +Cc: David Miller, linux, Andrew Morton, netdev
In-Reply-To: <478943C3.2010805@garzik.org>
Jeff Garzik <jeff@garzik.org> :
> Francois Romieu wrote:
[...]
>> Distance from 'net-2.6/master' (27d1cba21fcc50c37eef5042c6be9fa7135e88fc)
>> -------------------------------------------------------------------------
[...]
> hrm... tried to pull this, but received non-ipg stuff too
It is based on one of davem's branches (see the 'distance' line above).
Do you want a branch against your upstream-fixes ?
--
Ueimor
^ permalink raw reply
* possible recursive locking, 2.6.24-rc7
From: Denys Fedoryshchenko @ 2008-01-13 15:48 UTC (permalink / raw)
To: kernel; +Cc: netdev
Hi, got in dmesg
Not sure where to send (there is TCP), so sending netdev@ and kernel@
[159859.491752]
[159859.491755] =============================================
[159859.492021] [ INFO: possible recursive locking detected ]
[159859.492156] 2.6.24-rc7-devel #2
[159859.492284] ---------------------------------------------
[159859.492418] swapper/0 is trying to acquire lock:
[159859.492550] (&q->lock){++..}, at: [<c01175ff>] __wake_up+0x15/0x42
[159859.492883]
[159859.492884] but task is already holding lock:
[159859.493140] (&q->lock){++..}, at: [<c01175ff>] __wake_up+0x15/0x42
[159859.493466]
[159859.493467] other info that might help us debug this:
[159859.493726] 5 locks held by swapper/0:
[159859.495687] #0: (rcu_read_lock){..--}, at: [<c02dd9af>]
netif_receive_skb+
0x9c/0x3a7
[159859.496141] #1: (rcu_read_lock){..--}, at: [<c02f8072>]
ip_local_deliver_f
inish+0x30/0x18d
[159859.496604] #2: (slock-AF_INET/1){-+..}, at: [<c0310474>]
tcp_v4_rcv+0x426
/0x812
[159859.497104] #3: (clock-AF_INET){-.-?}, at: [<c02d7684>]
sock_def_readable+
0x18/0x6e
[159859.497555] #4: (&q->lock){++..}, at: [<c01175ff>] __wake_up+0x15/0x42
[159859.497931]
[159859.497932] stack backtrace:
[159859.498185] Pid: 0, comm: swapper Not tainted 2.6.24-rc7-devel #2
[159859.498320] [<c0105e68>] show_trace_log_lvl+0x1a/0x2f
[159859.498505] [<c0106810>] show_trace+0x12/0x14
[159859.498690] [<c0107107>] dump_stack+0x6c/0x72
[159859.498872] [<c01384c0>] __lock_acquire+0x172/0xb8c
[159859.499057] [<c01392a7>] lock_acquire+0x5f/0x78
[159859.499239] [<c03299cf>] _spin_lock_irqsave+0x34/0x44
[159859.499423] [<c01175ff>] __wake_up+0x15/0x42
[159859.499604] [<c01869ea>] ep_poll_safewake+0x8e/0xbf
[159859.499787] [<c01876b3>] ep_poll_callback+0x9f/0xac
[159859.499970] [<c0115d36>] __wake_up_common+0x32/0x5c
[159859.500154] [<c011761b>] __wake_up+0x31/0x42
[159859.500335] [<c02d76ae>] sock_def_readable+0x42/0x6e
[159859.500518] [<c0309105>] tcp_rcv_established+0x3bc/0x643
[159859.500704] [<c030e588>] tcp_v4_do_rcv+0x2f/0x325
[159859.500887] [<c0310817>] tcp_v4_rcv+0x7c9/0x812
[159859.501069] [<c02f8149>] ip_local_deliver_finish+0x107/0x18d
[159859.501255] [<c02f854e>] ip_local_deliver+0x72/0x7c
[159859.501438] [<c02f8023>] ip_rcv_finish+0x2cf/0x2ee
[159859.501623] [<c02f84b2>] ip_rcv+0x211/0x23b
[159859.501805] [<c02ddc63>] netif_receive_skb+0x350/0x3a7
[159859.501989] [<f88f2b6d>] bnx2_poll+0x975/0xb45 [bnx2]
[159859.502177] [<c02dfdab>] net_rx_action+0x6c/0x116
[159859.502360] [<c0120ed8>] __do_softirq+0x6f/0xe9
[159859.502543] [<c0120f8c>] do_softirq+0x3a/0x52
[159859.502728] [<c012128b>] irq_exit+0x47/0x7b
[159859.502911] [<c01076af>] do_IRQ+0x81/0x96
[159859.503098] [<c010586a>] common_interrupt+0x2e/0x34
[159859.503288] [<c0103434>] mwait_idle+0x12/0x14
[159859.503476] [<c010353d>] cpu_idle+0x7b/0x95
[159859.503662] [<c03272c9>] rest_init+0x49/0x4b
[159859.503844] [<c0449c08>] start_kernel+0x2f9/0x301
[159859.504030] [<00000000>] 0x0
[159859.504210] =======================
--
Denys Fedoryshchenko
Technical Manager
Virtual ISP S.A.L.
^ permalink raw reply
* Re: [PATCH/RFC] synchronize_rcu(): high latency on idle system
From: Andi Kleen @ 2008-01-13 15:34 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, linux-kerne
In-Reply-To: <20080112175226.7d8f9dbc@deepthought>
> I think it should be in netdev_unregister_kobject(). But that would
> only get rid of one of the two calls to synchronize_rcu() in the unregister_netdev.
Would be already an improvement.
> The other synchronize_rcu() is for qdisc's and not sure if that one can
> be removed?
The standard way to remove such calls is to set a "deleted" flag in the object,
then check and ignore such objects in the reader and finally remove the object with
call_rcu
I have not checked if that is really feasible for qdiscs.
-Andi
^ permalink raw reply
* Re: [Bugme-new] [Bug 9721] New: wake on lan fails with sky2 module
From: supersud501 @ 2008-01-13 15:08 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Stephen Hemminger, Andrew Morton, netdev, linux-acpi,
bugme-daemon
In-Reply-To: <478A1083.5060406@yahoo.de>
supersud501 wrote:
>
>
> Rafael J. Wysocki wrote:
>
>>
>> Since it seems to be 100% reproducible, it would be very helpful if
>> you could
>> use git-bisect to identify the offending commit.
>>
>
> allright, bisect found the offending commit, here's what i've done:
>
> first i started bisect with the following command (since i assumed it is
> a net-driver problem):
>
> git-bisect start 'v2.6.24-rc6' 'v2.6.23' '--' 'drivers/net/'
>
> after building many kernels and saying good/bad if wol worked/didn't
> work etc. it identified the following commit:
>
> # bad: [ac93a3946b676025fa55356180e8321639744b31] sky2: enable PCI
> config writes
>
> and refs/bisect/bad gives:
>
> 14:16:53 /usr/src/linux-2.6/.git # cat refs/bisect/bad
> ac93a3946b676025fa55356180e8321639744b31
>
>
> need some more info?
>
i just checked it: commented out the passage of the commit in kernel
2.6.24-rc7-git4 and compiled it: wol WORKS. so this one line is causing
my wol-disturbance...
but i noticed another "bug" on 2.6.24-rc7-git with sky2: dmesg shows a
lot of lines every 5 seconds:
[...]
[ 357.400462] sky2 0000:02:00.0: error interrupt status=0xc0000000
[ 362.442039] printk: 41 messages suppressed.
[ 362.442043] sky2 0000:02:00.0: error interrupt status=0x80000000
[ 367.439151] printk: 18 messages suppressed.
[ 367.439156] sky2 0000:02:00.0: error interrupt status=0x80000000
[ 372.436267] printk: 30 messages suppressed.
[ 372.436271] sky2 0000:02:00.0: error interrupt status=0x80000000
[ 377.350236] printk: 19 messages suppressed.
[...]
since i do not notice any errors (yet) i'll wait till next rc, maybe it
will be gone then...
but i'm happy wol works again on 2.6.24 :)
^ permalink raw reply
* Re: Netconf at conf.au 2008?
From: Glen Turner @ 2008-01-13 14:53 UTC (permalink / raw)
To: Andy Johnson; +Cc: netdev
In-Reply-To: <147a89290801112252gfcfaf11h1d25ee3c66e75881@mail.gmail.com>
On Sat, 2008-01-12 at 08:52 +0200, Andy Johnson wrote:
> I saw somewhere (maybe in this mailing list a while ago) that there
> might be a Linux Kernel Developers' Netconf conference at conf.au
> 2008.
>
> Does anyone here know if such a thing is planned ?
Hi Andy,
I don't know.
However this seems a good opportunity to remind people that
AARNet will as usual be proving a 1Gbps link from linux.conf.au
to universities and national labs in the USA and beyond.
Netdev people are welcome to hammer this if they want to test
performance on a real-life long fat pipe (minimum RTT > 200ms).
If you particularly want some feature (IPv6, multicast,
whatever), some engineering detail, a real worst case RTT
(Perth-Sydney-Seattle-New York-Amsterdam-Tomsk @ 1Gbps) or
some office space before/after the conference then drop
me a mail.
There are two well-educated users of fast long-distance
networks in Melbourne doing transfers for physics and
astronomy applications. If the application/TCP interaction
is of interest then I can arrange an introduction.
Best wishes,
Glen
--
Glen Turner, Network Engineer (08) 8303 3936 or +61 8 8303 3936
Australia's Academic & Research Network www.aarnet.edu.au
^ permalink raw reply
* Re: [Bugme-new] [Bug 9721] New: wake on lan fails with sky2 module
From: supersud501 @ 2008-01-13 13:22 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Stephen Hemminger, Andrew Morton, netdev, linux-acpi,
bugme-daemon
In-Reply-To: <200801120010.22440.rjw@sisk.pl>
Rafael J. Wysocki wrote:
>
> Since it seems to be 100% reproducible, it would be very helpful if you could
> use git-bisect to identify the offending commit.
>
allright, bisect found the offending commit, here's what i've done:
first i started bisect with the following command (since i assumed it is
a net-driver problem):
git-bisect start 'v2.6.24-rc6' 'v2.6.23' '--' 'drivers/net/'
after building many kernels and saying good/bad if wol worked/didn't
work etc. it identified the following commit:
# bad: [ac93a3946b676025fa55356180e8321639744b31] sky2: enable PCI
config writes
and refs/bisect/bad gives:
14:16:53 /usr/src/linux-2.6/.git # cat refs/bisect/bad
ac93a3946b676025fa55356180e8321639744b31
need some more info?
^ permalink raw reply
* [RFC][PATCH] Fixing SA/SP dumps on netlink/af_key
From: Timo Teräs @ 2008-01-13 12:26 UTC (permalink / raw)
To: netdev
Hi all,
The problem with IPsec SP/SA dumping is that they don't work well with large SPD/SADB:s. In netlink the dumping code is O(n^2) and can miss some entries/dump duplicates if the DB is changed between the recv() calls to read the dump entries. This is due to the entry index counting done in xfrm_user code. With af_key the dump entries are just dropped when the socket receive queue is filled.
I tried to address all these problems, and added the xfrm_policy and xfrm_state structure to a new linked list that is used solely for dumping. This way the dumps can be done in O(n) and have an iterator point to them. I also modified to af_key to stop dumping when receive queue is filling up and continue it from a callback at recvfrom() when there's more room.
This patch is against 2.6.23 vanilla. I wanted to get some feedback before I make it against the git tree.
But I'd like to hear about:
- if the approach is ok (adding the entries in one more list)?
- if the new/modified variables, structures and function names are ok?
- if I should port these against net-2.6 or net-2.6.25 git tree?
- if I should split this to more than one commit? (maybe xfrm core, xfrm user and af_key parts?)
Cheers,
Timo
Index: linux-2.6.23/include/net/xfrm.h
===================================================================
--- linux-2.6.23.orig/include/net/xfrm.h 2008-01-13 14:13:21.000000000 +0200
+++ linux-2.6.23/include/net/xfrm.h 2008-01-13 14:13:34.000000000 +0200
@@ -104,6 +104,7 @@
struct xfrm_state
{
/* Note: bydst is re-used during gc */
+ struct list_head all;
struct hlist_node bydst;
struct hlist_node bysrc;
struct hlist_node byspi;
@@ -346,6 +347,7 @@
struct xfrm_policy
{
struct xfrm_policy *next;
+ struct list_head bytype;
struct hlist_node bydst;
struct hlist_node byidx;
@@ -912,6 +914,17 @@
int priority;
};
+struct xfrm_state_walker {
+ struct xfrm_state *state;
+ int count;
+};
+
+struct xfrm_policy_walker {
+ struct xfrm_policy *policy;
+ int count;
+ int type;
+};
+
extern void xfrm_init(void);
extern void xfrm4_init(void);
extern void xfrm6_init(void);
@@ -921,7 +934,15 @@
extern void xfrm6_state_init(void);
extern void xfrm6_state_fini(void);
-extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *);
+static inline void xfrm_state_walk_start(struct xfrm_state_walker *walk)
+{
+ walk->state = NULL;
+ walk->count = 0;
+}
+
+extern int xfrm_state_walk(struct xfrm_state_walker *walk, u8 proto,
+ int (*func)(struct xfrm_state *, int, void*), void *);
+extern void xfrm_state_walk_end(struct xfrm_state_walker *walk);
extern struct xfrm_state *xfrm_state_alloc(void);
extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
struct flowi *fl, struct xfrm_tmpl *tmpl,
@@ -1025,7 +1046,17 @@
#endif
struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp);
-extern int xfrm_policy_walk(u8 type, int (*func)(struct xfrm_policy *, int, int, void*), void *);
+
+static inline void xfrm_policy_walk_start(struct xfrm_policy_walker *walk)
+{
+ walk->policy = NULL;
+ walk->count = 0;
+ walk->type = XFRM_POLICY_TYPE_MAIN;
+}
+
+extern int xfrm_policy_walk(struct xfrm_policy_walker *walk, u8 type,
+ int (*func)(struct xfrm_policy *, int, int, void*), void *);
+extern void xfrm_policy_walk_end(struct xfrm_policy_walker *walk);
int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
struct xfrm_selector *sel,
Index: linux-2.6.23/net/key/af_key.c
===================================================================
--- linux-2.6.23.orig/net/key/af_key.c 2008-01-13 14:13:21.000000000 +0200
+++ linux-2.6.23/net/key/af_key.c 2008-01-13 14:13:34.000000000 +0200
@@ -48,6 +48,16 @@
struct sock sk;
int registered;
int promisc;
+
+ u8 dump_type;
+ uint8_t dump_msg_version;
+ uint32_t dump_msg_pid;
+ int (*dump)(struct pfkey_sock *sk);
+ void (*dump_done)(struct pfkey_sock *sk);
+ union {
+ struct xfrm_policy_walker policy;
+ struct xfrm_state_walker state;
+ } u;
};
static inline struct pfkey_sock *pfkey_sk(struct sock *sk)
@@ -55,6 +65,30 @@
return (struct pfkey_sock *)sk;
}
+static int pfkey_can_dump(struct sock *sk)
+{
+ if (3 * atomic_read(&sk->sk_rmem_alloc) <= 2 * sk->sk_rcvbuf)
+ return 1;
+ return 0;
+}
+
+static int pfkey_do_dump(struct pfkey_sock *pfk)
+{
+ int rc;
+
+ rc = pfk->dump(pfk);
+ if (rc != 0) {
+ if (rc == -ENOBUFS)
+ return 0;
+ return rc;
+ }
+
+ pfk->dump_done(pfk);
+ pfk->dump = NULL;
+ pfk->dump_done = NULL;
+ return 0;
+}
+
static void pfkey_sock_destruct(struct sock *sk)
{
skb_queue_purge(&sk->sk_receive_queue);
@@ -1705,45 +1739,62 @@
return 0;
}
-struct pfkey_dump_data
-{
- struct sk_buff *skb;
- struct sadb_msg *hdr;
- struct sock *sk;
-};
-
static int dump_sa(struct xfrm_state *x, int count, void *ptr)
{
- struct pfkey_dump_data *data = ptr;
+ struct pfkey_sock *pfk = ptr;
struct sk_buff *out_skb;
struct sadb_msg *out_hdr;
+ if (!pfkey_can_dump(&pfk->sk))
+ return -ENOBUFS;
+
out_skb = pfkey_xfrm_state2msg(x, 1, 3);
if (IS_ERR(out_skb))
return PTR_ERR(out_skb);
out_hdr = (struct sadb_msg *) out_skb->data;
- out_hdr->sadb_msg_version = data->hdr->sadb_msg_version;
+ out_hdr->sadb_msg_version = pfk->dump_msg_version;
out_hdr->sadb_msg_type = SADB_DUMP;
out_hdr->sadb_msg_satype = pfkey_proto2satype(x->id.proto);
out_hdr->sadb_msg_errno = 0;
out_hdr->sadb_msg_reserved = 0;
out_hdr->sadb_msg_seq = count;
- out_hdr->sadb_msg_pid = data->hdr->sadb_msg_pid;
- pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ONE, data->sk);
+ out_hdr->sadb_msg_pid = pfk->dump_msg_pid;
+ pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ONE, &pfk->sk);
return 0;
}
+static int pfkey_dump_sa(struct pfkey_sock *pfk)
+{
+ return xfrm_state_walk(&pfk->u.state, pfk->dump_type,
+ dump_sa, (void *) pfk);
+}
+
+static void pfkey_dump_sa_done(struct pfkey_sock *pfk)
+{
+ xfrm_state_walk_end(&pfk->u.state);
+}
+
static int pfkey_dump(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs)
{
+ struct pfkey_sock *pfk = pfkey_sk(sk);
u8 proto;
- struct pfkey_dump_data data = { .skb = skb, .hdr = hdr, .sk = sk };
+
+ if (pfk->dump != NULL)
+ return -EBUSY;
proto = pfkey_satype2proto(hdr->sadb_msg_satype);
if (proto == 0)
return -EINVAL;
- return xfrm_state_walk(proto, dump_sa, &data);
+ pfk->dump_type = proto;
+ pfk->dump_msg_version = hdr->sadb_msg_version;
+ pfk->dump_msg_pid = hdr->sadb_msg_pid;
+ pfk->dump = pfkey_dump_sa;
+ pfk->dump_done = pfkey_dump_sa_done;
+ xfrm_state_walk_start(&pfk->u.state);
+
+ return pfkey_do_dump(pfk);
}
static int pfkey_promisc(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs)
@@ -1776,6 +1827,7 @@
static u32 gen_reqid(void)
{
+ struct xfrm_policy_walker walker;
u32 start;
static u32 reqid = IPSEC_MANUAL_REQID_MAX;
@@ -1784,9 +1836,11 @@
++reqid;
if (reqid == 0)
reqid = IPSEC_MANUAL_REQID_MAX+1;
- if (xfrm_policy_walk(XFRM_POLICY_TYPE_MAIN, check_reqid,
+ xfrm_policy_walk_start(&walker);
+ if (xfrm_policy_walk(&walker, XFRM_POLICY_TYPE_MAIN, check_reqid,
(void*)&reqid) != -EEXIST)
return reqid;
+ xfrm_policy_walk_end(&walker);
} while (reqid != start);
return 0;
}
@@ -2634,11 +2688,14 @@
static int dump_sp(struct xfrm_policy *xp, int dir, int count, void *ptr)
{
- struct pfkey_dump_data *data = ptr;
+ struct pfkey_sock *pfk = ptr;
struct sk_buff *out_skb;
struct sadb_msg *out_hdr;
int err;
+ if (!pfkey_can_dump(&pfk->sk))
+ return -ENOBUFS;
+
out_skb = pfkey_xfrm_policy2msg_prep(xp);
if (IS_ERR(out_skb))
return PTR_ERR(out_skb);
@@ -2648,21 +2705,42 @@
return err;
out_hdr = (struct sadb_msg *) out_skb->data;
- out_hdr->sadb_msg_version = data->hdr->sadb_msg_version;
+ out_hdr->sadb_msg_version = pfk->dump_msg_version;
out_hdr->sadb_msg_type = SADB_X_SPDDUMP;
out_hdr->sadb_msg_satype = SADB_SATYPE_UNSPEC;
out_hdr->sadb_msg_errno = 0;
out_hdr->sadb_msg_seq = count;
- out_hdr->sadb_msg_pid = data->hdr->sadb_msg_pid;
- pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ONE, data->sk);
+ out_hdr->sadb_msg_pid = pfk->dump_msg_pid;
+ pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ONE, &pfk->sk);
return 0;
}
+static int pfkey_dump_sp(struct pfkey_sock *pfk)
+{
+ return xfrm_policy_walk(&pfk->u.policy, pfk->dump_type,
+ dump_sp, (void *) pfk);
+}
+
+static void pfkey_dump_sp_done(struct pfkey_sock *pfk)
+{
+ xfrm_policy_walk_end(&pfk->u.policy);
+}
+
static int pfkey_spddump(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs)
{
- struct pfkey_dump_data data = { .skb = skb, .hdr = hdr, .sk = sk };
+ struct pfkey_sock *pfk = pfkey_sk(sk);
+
+ if (pfk->dump != NULL)
+ return -EBUSY;
+
+ pfk->dump_type = XFRM_POLICY_TYPE_MAIN;
+ pfk->dump_msg_version = hdr->sadb_msg_version;
+ pfk->dump_msg_pid = hdr->sadb_msg_pid;
+ pfk->dump = pfkey_dump_sp;
+ pfk->dump_done = pfkey_dump_sp_done;
+ xfrm_policy_walk_start(&pfk->u.policy);
- return xfrm_policy_walk(XFRM_POLICY_TYPE_MAIN, dump_sp, &data);
+ return pfkey_do_dump(pfk);
}
static int key_notify_policy_flush(struct km_event *c)
@@ -3656,6 +3734,7 @@
int flags)
{
struct sock *sk = sock->sk;
+ struct pfkey_sock *pfk = pfkey_sk(sk);
struct sk_buff *skb;
int copied, err;
@@ -3681,6 +3760,10 @@
sock_recv_timestamp(msg, sk, skb);
+ if (pfk->dump != NULL &&
+ 3 * atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf)
+ pfkey_do_dump(pfk);
+
err = (flags & MSG_TRUNC) ? skb->len : copied;
out_free:
Index: linux-2.6.23/net/xfrm/xfrm_policy.c
===================================================================
--- linux-2.6.23.orig/net/xfrm/xfrm_policy.c 2008-01-13 14:13:21.000000000 +0200
+++ linux-2.6.23/net/xfrm/xfrm_policy.c 2008-01-13 14:13:34.000000000 +0200
@@ -36,6 +36,7 @@
static DEFINE_RWLOCK(xfrm_policy_lock);
+static struct list_head xfrm_policy_bytype[XFRM_POLICY_TYPE_MAX];
unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2];
EXPORT_SYMBOL(xfrm_policy_count);
@@ -349,6 +350,7 @@
policy = kzalloc(sizeof(struct xfrm_policy), gfp);
if (policy) {
+ INIT_LIST_HEAD(&policy->bytype);
INIT_HLIST_NODE(&policy->bydst);
INIT_HLIST_NODE(&policy->byidx);
rwlock_init(&policy->lock);
@@ -372,6 +374,10 @@
if (del_timer(&policy->timer))
BUG();
+ write_lock_bh(&xfrm_policy_lock);
+ list_del(&policy->bytype);
+ write_unlock_bh(&xfrm_policy_lock);
+
security_xfrm_policy_free(policy);
kfree(policy);
}
@@ -710,6 +716,7 @@
policy->curlft.use_time = 0;
if (!mod_timer(&policy->timer, jiffies + HZ))
xfrm_pol_hold(policy);
+ list_add_tail(&policy->bytype, &xfrm_policy_bytype[policy->type]);
write_unlock_bh(&xfrm_policy_lock);
if (delpol)
@@ -952,61 +959,71 @@
}
EXPORT_SYMBOL(xfrm_policy_flush);
-int xfrm_policy_walk(u8 type, int (*func)(struct xfrm_policy *, int, int, void*),
+int xfrm_policy_walk(struct xfrm_policy_walker *walk, u8 type,
+ int (*func)(struct xfrm_policy *, int, int, void*),
void *data)
{
- struct xfrm_policy *pol, *last = NULL;
- struct hlist_node *entry;
- int dir, last_dir = 0, count, error;
+ struct xfrm_policy *old, *pol, *last = NULL;
+ int error = 0;
+
+ if (type >= XFRM_POLICY_TYPE_MAX && type != XFRM_POLICY_TYPE_ANY)
+ return -EINVAL;
+
+ if (walk->policy == NULL && walk->count != 0)
+ return 0;
+ old = pol = walk->policy;
+ walk->policy = NULL;
read_lock_bh(&xfrm_policy_lock);
- count = 0;
- for (dir = 0; dir < 2*XFRM_POLICY_MAX; dir++) {
- struct hlist_head *table = xfrm_policy_bydst[dir].table;
- int i;
+ for (; walk->type < XFRM_POLICY_TYPE_MAX; walk->type++) {
+ if (type != walk->type && type != XFRM_POLICY_TYPE_ANY)
+ continue;
- hlist_for_each_entry(pol, entry,
- &xfrm_policy_inexact[dir], bydst) {
- if (pol->type != type)
+ if (pol == NULL) {
+ pol = list_first_entry(&xfrm_policy_bytype[walk->type],
+ struct xfrm_policy, bytype);
+ }
+ list_for_each_entry_from(pol, &xfrm_policy_bytype[walk->type], bytype) {
+ if (pol->dead)
continue;
if (last) {
- error = func(last, last_dir % XFRM_POLICY_MAX,
- count, data);
- if (error)
+ error = func(last, xfrm_policy_id2dir(last->index),
+ walk->count, data);
+ if (error) {
+ xfrm_pol_hold(last);
+ walk->policy = last;
goto out;
- }
- last = pol;
- last_dir = dir;
- count++;
- }
- for (i = xfrm_policy_bydst[dir].hmask; i >= 0; i--) {
- hlist_for_each_entry(pol, entry, table + i, bydst) {
- if (pol->type != type)
- continue;
- if (last) {
- error = func(last, last_dir % XFRM_POLICY_MAX,
- count, data);
- if (error)
- goto out;
}
- last = pol;
- last_dir = dir;
- count++;
}
+ last = pol;
+ walk->count++;
}
+ pol = NULL;
}
- if (count == 0) {
+ if (walk->count == 0) {
error = -ENOENT;
goto out;
}
- error = func(last, last_dir % XFRM_POLICY_MAX, 0, data);
+ if (last)
+ error = func(last, xfrm_policy_id2dir(last->index), 0, data);
out:
read_unlock_bh(&xfrm_policy_lock);
+ if (old != NULL)
+ xfrm_pol_put(old);
return error;
}
EXPORT_SYMBOL(xfrm_policy_walk);
+void xfrm_policy_walk_end(struct xfrm_policy_walker *walker)
+{
+ if (walker->policy != NULL) {
+ xfrm_pol_put(walker->policy);
+ walker->policy = NULL;
+ }
+}
+EXPORT_SYMBOL(xfrm_policy_walk_end);
+
/*
* Find policy to apply to this flow.
*
@@ -2401,6 +2418,9 @@
panic("XFRM: failed to allocate bydst hash\n");
}
+ for (dir = 0; dir < XFRM_POLICY_TYPE_MAX; dir++)
+ INIT_LIST_HEAD(&xfrm_policy_bytype[dir]);
+
INIT_WORK(&xfrm_policy_gc_work, xfrm_policy_gc_task);
register_netdevice_notifier(&xfrm_dev_notifier);
}
Index: linux-2.6.23/net/xfrm/xfrm_state.c
===================================================================
--- linux-2.6.23.orig/net/xfrm/xfrm_state.c 2008-01-13 14:13:21.000000000 +0200
+++ linux-2.6.23/net/xfrm/xfrm_state.c 2008-01-13 14:13:34.000000000 +0200
@@ -50,6 +50,7 @@
* Main use is finding SA after policy selected tunnel or transport mode.
* Also, it can be used by ah/esp icmp error handler to find offending SA.
*/
+static LIST_HEAD(xfrm_state_all);
static struct hlist_head *xfrm_state_bydst __read_mostly;
static struct hlist_head *xfrm_state_bysrc __read_mostly;
static struct hlist_head *xfrm_state_byspi __read_mostly;
@@ -319,6 +320,7 @@
if (x) {
atomic_set(&x->refcnt, 1);
atomic_set(&x->tunnel_users, 0);
+ INIT_LIST_HEAD(&x->all);
INIT_HLIST_NODE(&x->bydst);
INIT_HLIST_NODE(&x->bysrc);
INIT_HLIST_NODE(&x->byspi);
@@ -345,6 +347,10 @@
{
BUG_TRAP(x->km.state == XFRM_STATE_DEAD);
+ spin_lock_bh(&xfrm_state_lock);
+ list_del(&x->all);
+ spin_unlock_bh(&xfrm_state_lock);
+
spin_lock_bh(&xfrm_state_gc_lock);
hlist_add_head(&x->bydst, &xfrm_state_gc_list);
spin_unlock_bh(&xfrm_state_gc_lock);
@@ -722,6 +728,8 @@
x->genid = ++xfrm_state_genid;
+ list_add_tail(&x->all, &xfrm_state_all);
+
h = xfrm_dst_hash(&x->id.daddr, &x->props.saddr,
x->props.reqid, x->props.family);
hlist_add_head(&x->bydst, xfrm_state_bydst+h);
@@ -1343,40 +1351,59 @@
}
EXPORT_SYMBOL(xfrm_alloc_spi);
-int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*),
+int xfrm_state_walk(struct xfrm_state_walker *walk, u8 proto,
+ int (*func)(struct xfrm_state *, int, void*),
void *data)
{
- int i;
- struct xfrm_state *x, *last = NULL;
- struct hlist_node *entry;
- int count = 0;
+ struct xfrm_state *old, *x, *last = NULL;
int err = 0;
+ if (walk->state == NULL && walk->count != 0)
+ return 0;
+
+ old = x = walk->state;
+ walk->state = NULL;
spin_lock_bh(&xfrm_state_lock);
- for (i = 0; i <= xfrm_state_hmask; i++) {
- hlist_for_each_entry(x, entry, xfrm_state_bydst+i, bydst) {
- if (!xfrm_id_proto_match(x->id.proto, proto))
- continue;
- if (last) {
- err = func(last, count, data);
- if (err)
- goto out;
+ if (x == NULL)
+ x = list_first_entry(&xfrm_state_all, struct xfrm_state, all);
+ list_for_each_entry_from(x, &xfrm_state_all, all) {
+ if (x->km.state == XFRM_STATE_DEAD)
+ continue;
+ if (!xfrm_id_proto_match(x->id.proto, proto))
+ continue;
+ if (last) {
+ err = func(last, walk->count, data);
+ if (err) {
+ xfrm_state_hold(last);
+ walk->state = last;
+ goto out;
}
- last = x;
- count++;
}
+ last = x;
+ walk->count++;
}
- if (count == 0) {
+ if (walk->count == 0) {
err = -ENOENT;
goto out;
}
- err = func(last, 0, data);
+ if (last)
+ err = func(last, 0, data);
out:
spin_unlock_bh(&xfrm_state_lock);
+ if (old != NULL)
+ xfrm_state_put(old);
return err;
}
EXPORT_SYMBOL(xfrm_state_walk);
+void xfrm_state_walk_end(struct xfrm_state_walker *walk)
+{
+ if (walk->state != NULL) {
+ xfrm_state_put(walk->state);
+ walk->state = NULL;
+ }
+}
+EXPORT_SYMBOL(xfrm_state_walk_end);
void xfrm_replay_notify(struct xfrm_state *x, int event)
{
Index: linux-2.6.23/net/xfrm/xfrm_user.c
===================================================================
--- linux-2.6.23.orig/net/xfrm/xfrm_user.c 2008-01-13 14:13:21.000000000 +0200
+++ linux-2.6.23/net/xfrm/xfrm_user.c 2008-01-13 14:13:34.000000000 +0200
@@ -572,8 +572,6 @@
struct sk_buff *out_skb;
u32 nlmsg_seq;
u16 nlmsg_flags;
- int start_idx;
- int this_idx;
};
static int dump_one_state(struct xfrm_state *x, int count, void *ptr)
@@ -585,9 +583,6 @@
struct nlmsghdr *nlh;
unsigned char *b = skb_tail_pointer(skb);
- if (sp->this_idx < sp->start_idx)
- goto out;
-
nlh = NLMSG_PUT(skb, NETLINK_CB(in_skb).pid,
sp->nlmsg_seq,
XFRM_MSG_NEWSA, sizeof(*p));
@@ -629,8 +624,6 @@
RTA_PUT(skb, XFRMA_LASTUSED, sizeof(x->lastused), &x->lastused);
nlh->nlmsg_len = skb_tail_pointer(skb) - b;
-out:
- sp->this_idx++;
return 0;
nlmsg_failure:
@@ -639,18 +632,23 @@
return -1;
}
+static int xfrm_dump_sa_done(struct netlink_callback *cb)
+{
+ struct xfrm_state_walker *walker = (struct xfrm_state_walker *) cb->args;
+ xfrm_state_walk_end(walker);
+ return 0;
+}
+
static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb)
{
+ struct xfrm_state_walker *walker = (struct xfrm_state_walker *) cb->args;
struct xfrm_dump_info info;
info.in_skb = cb->skb;
info.out_skb = skb;
info.nlmsg_seq = cb->nlh->nlmsg_seq;
info.nlmsg_flags = NLM_F_MULTI;
- info.this_idx = 0;
- info.start_idx = cb->args[0];
- (void) xfrm_state_walk(0, dump_one_state, &info);
- cb->args[0] = info.this_idx;
+ (void) xfrm_state_walk(walker, 0, dump_one_state, &info);
return skb->len;
}
@@ -669,7 +667,6 @@
info.out_skb = skb;
info.nlmsg_seq = seq;
info.nlmsg_flags = 0;
- info.this_idx = info.start_idx = 0;
if (dump_one_state(x, 0, &info)) {
kfree_skb(skb);
@@ -1273,9 +1270,6 @@
struct nlmsghdr *nlh;
unsigned char *b = skb_tail_pointer(skb);
- if (sp->this_idx < sp->start_idx)
- goto out;
-
nlh = NLMSG_PUT(skb, NETLINK_CB(in_skb).pid,
sp->nlmsg_seq,
XFRM_MSG_NEWPOLICY, sizeof(*p));
@@ -1291,8 +1285,6 @@
goto nlmsg_failure;
nlh->nlmsg_len = skb_tail_pointer(skb) - b;
-out:
- sp->this_idx++;
return 0;
nlmsg_failure:
@@ -1300,21 +1292,26 @@
return -1;
}
+static int xfrm_dump_policy_done(struct netlink_callback *cb)
+{
+ struct xfrm_policy_walker *walker = (struct xfrm_policy_walker *) cb->args;
+
+ xfrm_policy_walk_end(walker);
+ return 0;
+}
+
static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb)
{
+ struct xfrm_policy_walker *walker = (struct xfrm_policy_walker *) cb->args;
struct xfrm_dump_info info;
info.in_skb = cb->skb;
info.out_skb = skb;
info.nlmsg_seq = cb->nlh->nlmsg_seq;
info.nlmsg_flags = NLM_F_MULTI;
- info.this_idx = 0;
- info.start_idx = cb->args[0];
- (void) xfrm_policy_walk(XFRM_POLICY_TYPE_MAIN, dump_one_policy, &info);
-#ifdef CONFIG_XFRM_SUB_POLICY
- (void) xfrm_policy_walk(XFRM_POLICY_TYPE_SUB, dump_one_policy, &info);
-#endif
- cb->args[0] = info.this_idx;
+
+ (void) xfrm_policy_walk(walker, XFRM_POLICY_TYPE_ANY,
+ dump_one_policy, &info);
return skb->len;
}
@@ -1334,7 +1331,6 @@
info.out_skb = skb;
info.nlmsg_seq = seq;
info.nlmsg_flags = 0;
- info.this_idx = info.start_idx = 0;
if (dump_one_policy(xp, dir, 0, &info) < 0) {
kfree_skb(skb);
@@ -1951,15 +1947,18 @@
static struct xfrm_link {
int (*doit)(struct sk_buff *, struct nlmsghdr *, struct rtattr **);
int (*dump)(struct sk_buff *, struct netlink_callback *);
+ int (*done)(struct netlink_callback *);
} xfrm_dispatch[XFRM_NR_MSGTYPES] = {
[XFRM_MSG_NEWSA - XFRM_MSG_BASE] = { .doit = xfrm_add_sa },
[XFRM_MSG_DELSA - XFRM_MSG_BASE] = { .doit = xfrm_del_sa },
[XFRM_MSG_GETSA - XFRM_MSG_BASE] = { .doit = xfrm_get_sa,
- .dump = xfrm_dump_sa },
+ .dump = xfrm_dump_sa,
+ .done = xfrm_dump_sa_done },
[XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_add_policy },
[XFRM_MSG_DELPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy },
[XFRM_MSG_GETPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy,
- .dump = xfrm_dump_policy },
+ .dump = xfrm_dump_policy,
+ .done = xfrm_dump_policy_done },
[XFRM_MSG_ALLOCSPI - XFRM_MSG_BASE] = { .doit = xfrm_alloc_userspi },
[XFRM_MSG_ACQUIRE - XFRM_MSG_BASE] = { .doit = xfrm_add_acquire },
[XFRM_MSG_EXPIRE - XFRM_MSG_BASE] = { .doit = xfrm_add_sa_expire },
@@ -1998,7 +1997,7 @@
if (link->dump == NULL)
return -EINVAL;
- return netlink_dump_start(xfrm_nl, skb, nlh, link->dump, NULL);
+ return netlink_dump_start(xfrm_nl, skb, nlh, link->dump, link->done);
}
memset(xfrma, 0, sizeof(xfrma));
Index: linux-2.6.23/include/linux/xfrm.h
===================================================================
--- linux-2.6.23.orig/include/linux/xfrm.h 2007-10-09 23:31:38.000000000 +0300
+++ linux-2.6.23/include/linux/xfrm.h 2008-01-13 14:13:35.000000000 +0200
@@ -106,7 +106,8 @@
{
XFRM_POLICY_TYPE_MAIN = 0,
XFRM_POLICY_TYPE_SUB = 1,
- XFRM_POLICY_TYPE_MAX = 2
+ XFRM_POLICY_TYPE_MAX = 2,
+ XFRM_POLICY_TYPE_ANY = 255
};
enum
^ permalink raw reply
* [AX25]: sparse cleanups
From: Eric Dumazet @ 2008-01-13 11:01 UTC (permalink / raw)
To: David S. Miller; +Cc: Linux Netdev List
[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]
net/ax25/ax25_route.c:251:13: warning: context imbalance in
'ax25_rt_seq_start' - wrong count at exit
net/ax25/ax25_route.c:276:13: warning: context imbalance in 'ax25_rt_seq_stop'
- unexpected unlock
net/ax25/ax25_std_timer.c:65:25: warning: expensive signed divide
net/ax25/ax25_uid.c:46:1: warning: symbol 'ax25_uid_list' was not declared.
Should it be static?
net/ax25/ax25_uid.c:146:13: warning: context imbalance in 'ax25_uid_seq_start'
- wrong count at exit
net/ax25/ax25_uid.c:169:13: warning: context imbalance in 'ax25_uid_seq_stop'
- unexpected unlock
net/ax25/af_ax25.c:573:28: warning: expensive signed divide
net/ax25/af_ax25.c:1865:13: warning: context imbalance in 'ax25_info_start' -
wrong count at exit
net/ax25/af_ax25.c:1888:13: warning: context imbalance in 'ax25_info_stop' -
unexpected unlock
net/ax25/ax25_ds_timer.c:133:25: warning: expensive signed divide
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
net/ax25/af_ax25.c | 4 +++-
net/ax25/ax25_ds_timer.c | 2 +-
net/ax25/ax25_route.c | 2 ++
net/ax25/ax25_std_timer.c | 4 ++--
net/ax25/ax25_uid.c | 6 ++++--
5 files changed, 12 insertions(+), 6 deletions(-)
[-- Attachment #2: ax25.patch --]
[-- Type: text/plain, Size: 3574 bytes --]
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index a028d37..1bc0e85 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -570,7 +570,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,
res = -EINVAL;
break;
}
- ax25->rtt = (opt * HZ) / 2;
+ ax25->rtt = (opt * HZ) >> 1;
ax25->t1 = opt * HZ;
break;
@@ -1863,6 +1863,7 @@ static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
#ifdef CONFIG_PROC_FS
static void *ax25_info_start(struct seq_file *seq, loff_t *pos)
+ __acquires(ax25_list_lock)
{
struct ax25_cb *ax25;
struct hlist_node *node;
@@ -1886,6 +1887,7 @@ static void *ax25_info_next(struct seq_file *seq, void *v, loff_t *pos)
}
static void ax25_info_stop(struct seq_file *seq, void *v)
+ __releases(ax25_list_lock)
{
spin_unlock_bh(&ax25_list_lock);
}
diff --git a/net/ax25/ax25_ds_timer.c b/net/ax25/ax25_ds_timer.c
index 4f44185..c4e3b02 100644
--- a/net/ax25/ax25_ds_timer.c
+++ b/net/ax25/ax25_ds_timer.c
@@ -130,7 +130,7 @@ void ax25_ds_heartbeat_expiry(ax25_cb *ax25)
*/
if (sk != NULL) {
if (atomic_read(&sk->sk_rmem_alloc) <
- (sk->sk_rcvbuf / 2) &&
+ (sk->sk_rcvbuf >> 1) &&
(ax25->condition & AX25_COND_OWN_RX_BUSY)) {
ax25->condition &= ~AX25_COND_OWN_RX_BUSY;
ax25->condition &= ~AX25_COND_ACK_PENDING;
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index 9ecf6f1..38c7f30 100644
--- a/net/ax25/ax25_route.c
+++ b/net/ax25/ax25_route.c
@@ -249,6 +249,7 @@ int ax25_rt_ioctl(unsigned int cmd, void __user *arg)
#ifdef CONFIG_PROC_FS
static void *ax25_rt_seq_start(struct seq_file *seq, loff_t *pos)
+ __acquires(ax25_route_lock)
{
struct ax25_route *ax25_rt;
int i = 1;
@@ -274,6 +275,7 @@ static void *ax25_rt_seq_next(struct seq_file *seq, void *v, loff_t *pos)
}
static void ax25_rt_seq_stop(struct seq_file *seq, void *v)
+ __releases(ax25_route_lock)
{
read_unlock(&ax25_route_lock);
}
diff --git a/net/ax25/ax25_std_timer.c b/net/ax25/ax25_std_timer.c
index f2f6918..96e4b92 100644
--- a/net/ax25/ax25_std_timer.c
+++ b/net/ax25/ax25_std_timer.c
@@ -32,7 +32,7 @@
void ax25_std_heartbeat_expiry(ax25_cb *ax25)
{
- struct sock *sk=ax25->sk;
+ struct sock *sk = ax25->sk;
if (sk)
bh_lock_sock(sk);
@@ -62,7 +62,7 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25)
*/
if (sk != NULL) {
if (atomic_read(&sk->sk_rmem_alloc) <
- (sk->sk_rcvbuf / 2) &&
+ (sk->sk_rcvbuf >> 1) &&
(ax25->condition & AX25_COND_OWN_RX_BUSY)) {
ax25->condition &= ~AX25_COND_OWN_RX_BUSY;
ax25->condition &= ~AX25_COND_ACK_PENDING;
diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c
index ce0b13d..5f4eb73 100644
--- a/net/ax25/ax25_uid.c
+++ b/net/ax25/ax25_uid.c
@@ -43,10 +43,10 @@
* Callsign/UID mapper. This is in kernel space for security on multi-amateur machines.
*/
-HLIST_HEAD(ax25_uid_list);
+static HLIST_HEAD(ax25_uid_list);
static DEFINE_RWLOCK(ax25_uid_lock);
-int ax25_uid_policy = 0;
+int ax25_uid_policy;
EXPORT_SYMBOL(ax25_uid_policy);
@@ -144,6 +144,7 @@ int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax)
#ifdef CONFIG_PROC_FS
static void *ax25_uid_seq_start(struct seq_file *seq, loff_t *pos)
+ __acquires(ax25_uid_lock)
{
struct ax25_uid_assoc *pt;
struct hlist_node *node;
@@ -167,6 +168,7 @@ static void *ax25_uid_seq_next(struct seq_file *seq, void *v, loff_t *pos)
}
static void ax25_uid_seq_stop(struct seq_file *seq, void *v)
+ __releases(ax25_uid_lock)
{
read_unlock(&ax25_uid_lock);
}
^ permalink raw reply related
* [X25]: Avoid divides and sparse warnings
From: Eric Dumazet @ 2008-01-13 10:33 UTC (permalink / raw)
To: David S. Miller; +Cc: Linux Netdev List
[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]
CHECK net/x25/af_x25.c
net/x25/af_x25.c:117:46: warning: expensive signed divide
CHECK net/x25/x25_facilities.c
net/x25/x25_facilities.c:209:30: warning: expensive signed divide
CHECK net/x25/x25_in.c
net/x25/x25_in.c:250:26: warning: expensive signed divide
CHECK net/x25/x25_proc.c
net/x25/x25_proc.c:48:11: warning: context imbalance in 'x25_seq_route_start'
- wrong count at exit
net/x25/x25_proc.c:72:13: warning: context imbalance in 'x25_seq_route_stop' -
unexpected unlock
net/x25/x25_proc.c:112:11: warning: context imbalance in
'x25_seq_socket_start' - wrong count at exit
net/x25/x25_proc.c:129:13: warning: context imbalance in 'x25_seq_socket_stop'
- unexpected unlock
net/x25/x25_proc.c:190:11: warning: context imbalance in
'x25_seq_forward_start' - wrong count at exit
net/x25/x25_proc.c:215:13: warning: context imbalance in
'x25_seq_forward_stop' - unexpected unlock
CHECK net/x25/x25_subr.c
net/x25/x25_subr.c:362:57: warning: expensive signed divide
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
net/x25/af_x25.c | 4 ++--
net/x25/x25_facilities.c | 4 +---
net/x25/x25_in.c | 2 +-
net/x25/x25_proc.c | 6 ++++++
net/x25/x25_subr.c | 2 +-
5 files changed, 11 insertions(+), 7 deletions(-)
[-- Attachment #2: x25.patch --]
[-- Type: text/plain, Size: 3081 bytes --]
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 92cfe8e..07fad7c 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -83,9 +83,9 @@ struct compat_x25_subscrip_struct {
int x25_addr_ntoa(unsigned char *p, struct x25_address *called_addr,
struct x25_address *calling_addr)
{
- int called_len, calling_len;
+ unsigned int called_len, calling_len;
char *called, *calling;
- int i;
+ unsigned int i;
called_len = (*p >> 0) & 0x0F;
calling_len = (*p >> 4) & 0x0F;
diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c
index dec404a..a21f664 100644
--- a/net/x25/x25_facilities.c
+++ b/net/x25/x25_facilities.c
@@ -205,9 +205,7 @@ int x25_create_facilities(unsigned char *buffer,
}
if (dte_facs->calling_len && (facil_mask & X25_MASK_CALLING_AE)) {
- unsigned bytecount = (dte_facs->calling_len % 2) ?
- dte_facs->calling_len / 2 + 1 :
- dte_facs->calling_len / 2;
+ unsigned bytecount = (dte_facs->calling_len + 1) >> 1;
*p++ = X25_FAC_CALLING_AE;
*p++ = 1 + bytecount;
*p++ = dte_facs->calling_len;
diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c
index 1c88762..7d7c3ab 100644
--- a/net/x25/x25_in.c
+++ b/net/x25/x25_in.c
@@ -247,7 +247,7 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametyp
break;
}
if (atomic_read(&sk->sk_rmem_alloc) >
- (sk->sk_rcvbuf / 2))
+ (sk->sk_rcvbuf >> 1))
x25->condition |= X25_COND_OWN_RX_BUSY;
}
/*
diff --git a/net/x25/x25_proc.c b/net/x25/x25_proc.c
index 7d55e50..78b0534 100644
--- a/net/x25/x25_proc.c
+++ b/net/x25/x25_proc.c
@@ -41,6 +41,7 @@ found:
}
static void *x25_seq_route_start(struct seq_file *seq, loff_t *pos)
+ __acquires(x25_route_list_lock)
{
loff_t l = *pos;
@@ -70,6 +71,7 @@ out:
}
static void x25_seq_route_stop(struct seq_file *seq, void *v)
+ __releases(x25_route_list_lock)
{
read_unlock_bh(&x25_route_list_lock);
}
@@ -105,6 +107,7 @@ found:
}
static void *x25_seq_socket_start(struct seq_file *seq, loff_t *pos)
+ __acquires(x25_list_lock)
{
loff_t l = *pos;
@@ -127,6 +130,7 @@ out:
}
static void x25_seq_socket_stop(struct seq_file *seq, void *v)
+ __releases(x25_list_lock)
{
read_unlock_bh(&x25_list_lock);
}
@@ -183,6 +187,7 @@ found:
}
static void *x25_seq_forward_start(struct seq_file *seq, loff_t *pos)
+ __acquires(x25_forward_list_lock)
{
loff_t l = *pos;
@@ -213,6 +218,7 @@ out:
}
static void x25_seq_forward_stop(struct seq_file *seq, void *v)
+ __releases(x25_forward_list_lock)
{
read_unlock_bh(&x25_forward_list_lock);
}
diff --git a/net/x25/x25_subr.c b/net/x25/x25_subr.c
index 8d6220a..511a598 100644
--- a/net/x25/x25_subr.c
+++ b/net/x25/x25_subr.c
@@ -359,7 +359,7 @@ void x25_check_rbuf(struct sock *sk)
{
struct x25_sock *x25 = x25_sk(sk);
- if (atomic_read(&sk->sk_rmem_alloc) < (sk->sk_rcvbuf / 2) &&
+ if (atomic_read(&sk->sk_rmem_alloc) < (sk->sk_rcvbuf >> 1) &&
(x25->condition & X25_COND_OWN_RX_BUSY)) {
x25->condition &= ~X25_COND_OWN_RX_BUSY;
x25->condition &= ~X25_COND_ACK_PENDING;
^ permalink raw reply related
* Re: [PATCH] Add me as maintainer of the RDC r6040 driver
From: Florian Fainelli @ 2008-01-13 10:28 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev, Francois Romieu
In-Reply-To: <47893DB6.3080201@garzik.org>
Hi Jeff,
Le samedi 12 janvier 2008, Jeff Garzik a écrit :
> applied
Thank you. I think you will get this change twice when you pull Francoi's
netdev-2.6 repository which has the r6040 patches I sent already.
--
Cordialement, Florian Fainelli
------------------------------
^ permalink raw reply
* Re: sky2 driver stopped working after upgrading from 2.6.18-4
From: Andrew Paprocki @ 2008-01-13 10:26 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger
In-Reply-To: <76366b180801130024j78225c66j17974245e86a183f@mail.gmail.com>
It appears this problem might be caused by the system HPET timer not
functioning properly. I was noticing strange behavior in my rc0.d
shutdown scripts where the script would freeze in a 'sleep 1'. Sure
enough, even running a 'sleep 1' form a normal prompt just made the
system hang indefinitely (until I hit ctrl-C). If I unload sky2 and
then install a different clock source (jiffies, tsc, etc) and reload
the module, it all appears to work properly. This is very, very
strange. I'll bring this up on the kernel mailing list in a different
post focusing on the HPET config.
Thanks,
-Andrew
On Jan 13, 2008 3:24 AM, Andrew Paprocki <andrew@ishiboo.com> wrote:
> I have never been able to get my Yukon-EC Ultra (0xb4) rev 2 working
> on anything past 2.6.18-4 that I've tried. (All ~.20+)
^ permalink raw reply
* Re: [FIB]: removes a memset() call in tnode_new()
From: David Miller @ 2008-01-13 8:43 UTC (permalink / raw)
To: dada1; +Cc: netdev
In-Reply-To: <4789BF2B.3040103@cosmosbay.com>
From: Eric Dumazet <dada1@cosmosbay.com>
Date: Sun, 13 Jan 2008 08:35:07 +0100
> tnode_alloc() already clears allocated memory, using kcalloc()
> or alloc_pages(GFP_KERNEL|__GFP_ZERO, ...)
>
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Applied, thanks Eric.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox