Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] IPv4: Enable use of 240/4 address space
From: David Miller @ 2008-01-21 11:19 UTC (permalink / raw)
  To: yoshfuji; +Cc: jengelh, netdev, linux-kernel, ak, vaf
In-Reply-To: <20080120.003019.119068925.yoshfuji@linux-ipv6.org>

From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Date: Sun, 20 Jan 2008 00:30:19 +0900 (JST)

> In article <Pine.LNX.4.64.0801191443410.27831@fbirervta.pbzchgretzou.qr> (at Sat, 19 Jan 2008 14:44:13 +0100 (CET)), Jan Engelhardt <jengelh@computergmbh.de> says:
> 
> > From 84bccef295aa9754ee662191e32ba1d64edce2ba Mon Sep 17 00:00:00 2001
> > From: Jan Engelhardt <jengelh@computergmbh.de>
> > Date: Fri, 18 Jan 2008 02:10:44 +0100
> > Subject: [PATCH] IPv4: enable use of 240/4 address space
> > 
> > This short patch modifies the IPv4 networking to enable use of the
> > 240.0.0.0/4 (aka "class-E") address space as propsed in the internet
> > draft draft-fuller-240space-00.txt.
> > 
> > Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

I've applied this to net-2.6.25, thanks everyone.

I know I said we should deploy this as fast as possible,
but we are really coming down the wire as far as releasing
2.6.24 is concerned and I don't want to put anything into
my pushes to Linus that he might not like and thus cause
the entire set of bug fixes to be rejected.

Thanks again.

^ permalink raw reply

* Re: [PATCH] ICMP: ICMP_MIB_OUTMSGS increment duplicated
From: Wang Chen @ 2008-01-21 11:15 UTC (permalink / raw)
  To: David S. Miller, David L Stevens; +Cc: netdev, Herbert Xu
In-Reply-To: <478DD57B.6020503@cn.fujitsu.com>

Dave, how about this one.
It's like that one of IPV6.

Wang Chen said the following on 2008-1-16 17:59:
> In tree net-2.6.25, commit "96793b482540f3a26e2188eaf75cb56b7829d3e3"
> made a mistake.
> 
> In that patch, David L added a icmp_out_count() in ip_push_pending_frames(),
> remove icmp_out_count() from icmp_reply(). But he forgot to remove 
> icmp_out_count() from icmp_send() too.
> Since icmp_send and icmp_reply will call icmp_push_reply, which will call
> ip_push_pending_frames, a duplicated increment happened in icmp_send.
> 
> This patch remove the icmp_out_count from icmp_send too.
> 
> Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
> ---
> diff -Nurp linux-2.6.24.rc8.org/net/ipv4/icmp.c linux-2.6.24.rc8/net/ipv4/icmp.c
> --- linux-2.6.24.rc8.org/net/ipv4/icmp.c	2008-01-16 17:45:02.000000000 +0800
> +++ linux-2.6.24.rc8/net/ipv4/icmp.c	2008-01-16 17:52:13.000000000 +0800
> @@ -540,7 +540,6 @@ void icmp_send(struct sk_buff *skb_in, i
>  	icmp_param.data.icmph.checksum	 = 0;
>  	icmp_param.skb	  = skb_in;
>  	icmp_param.offset = skb_network_offset(skb_in);
> -	icmp_out_count(icmp_param.data.icmph.type);
>  	inet_sk(icmp_socket->sk)->tos = tos;
>  	ipc.addr = iph->saddr;
>  	ipc.opt = &icmp_param.replyopts;
> 


^ permalink raw reply

* Re: [WEXT 8/12]: Pull top-level ioctl dispatch logic into helper function.
From: Masakazu Mokuno @ 2008-01-21 11:16 UTC (permalink / raw)
  To: David Miller; +Cc: linux-wireless, netdev
In-Reply-To: <20071221.205623.141035851.davem@davemloft.net>

	Hi Dave,

On Fri, 21 Dec 2007 20:56:23 -0800 (PST)
David Miller <davem@davemloft.net> wrote:

> 
> [WEXT]: Pull top-level ioctl dispatch logic into helper function.
> 
> Signed-off-by: David S. Miller <davem@davemloft.net>

<snip>

> +int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
> +		      void __user *arg)
> +{
> +	int ret = wext_ioctl_dispatch(net, ifr, cmd,
> +				      ioctl_standard_call,
> +				      ioctl_private_call);
> +
> +	if (ret > 0 &&

As the return value 0 is legal, should we allow copybacking in the case
of 'ret == 0'?

Same issue exists in compat_wext_handle_ioctl() of the #9 patch.

> +	    IW_IS_GET(cmd) &&
> +	    copy_to_user(arg, ifr, sizeof(struct iwreq)))
>  		return -EFAULT;
> +
>  	return ret;
>  }


-- 
Masakazu MOKUNO


^ permalink raw reply

* Re: [PATCH 2/3][NET] gen_estimator: list_empty() check in est_timer() fixed
From: David Miller @ 2008-01-21 11:15 UTC (permalink / raw)
  To: jarkao2; +Cc: shemminger, slavon, kaber, hadi, netdev
In-Reply-To: <20080121111940.GF1789@ff.dom.local>

From: Jarek Poplawski <jarkao2@gmail.com>
Date: Mon, 21 Jan 2008 12:19:40 +0100

> On Mon, Jan 21, 2008 at 02:36:32AM -0800, David Miller wrote:
> ...
> > FWIW I agree that double-negatives are confusing and we should
> > avoid them.
> 
> Right! No more: CHECKSUM_NONE, SOCK_NOSPACE, IFF_NOARP or KERN_NOTICE!

Life is difficult sometimes, but that is no excuse to further
the pain :-)


^ permalink raw reply

* Re: [PATCH] bluetooth : move children of connection device to NULL before connection down
From: David Miller @ 2008-01-21 11:14 UTC (permalink / raw)
  To: hidave.darkstar
  Cc: marcel, netdev, linux-kernel, bluez-devel, cornelia.huck, gombasg,
	htejun, viro, kay.sievers, greg
In-Reply-To: <20080121045401.GB4162@darkstar.te-china.tietoenator.com>

From: Dave Young <hidave.darkstar@gmail.com>
Date: Mon, 21 Jan 2008 12:54:01 +0800

> Add people missed in cc-list.

Thanks Dave for your continued efforts on Bluetooth bugs like this.

Marcel, are you going to review/ACK/integrate/push-upstream/whatever
any of these Bluetooth patches?

It hasn't been getting much love from you as of late, you are one of
the listed maintainers, and I don't want to lose any of Dave's
valuable bug fixing work.

Or should I just handle it all directly?

Thanks.

^ permalink raw reply

* Re: [PATCH 1/2] IPV6: ICMP6_MIB_OUTMSGS increment duplicated
From: Wang Chen @ 2008-01-21 11:12 UTC (permalink / raw)
  To: David Miller; +Cc: dlstevens, netdev, herbert
In-Reply-To: <20080121.030637.148068457.davem@davemloft.net>

David Miller said the following on 2008-1-21 19:06:
> Does someone know how to setup GIT to update the HTTP
> fetch information as a post-push hook?
> 

Seems Herbert knows how to do it.
Maybe run git-update-server-info every time when you rebase
your tree.

>> Can you apply them to net-2.6 tree?
> 
> Done.
> 
Thanks.

--
WCN


^ permalink raw reply

* Re: [PATCH 2/3][NET] gen_estimator: list_empty() check in est_timer() fixed
From: Jarek Poplawski @ 2008-01-21 11:19 UTC (permalink / raw)
  To: David Miller; +Cc: shemminger, slavon, kaber, hadi, netdev
In-Reply-To: <20080121.023632.122420355.davem@davemloft.net>

On Mon, Jan 21, 2008 at 02:36:32AM -0800, David Miller wrote:
...
> FWIW I agree that double-negatives are confusing and we should
> avoid them.

Right! No more: CHECKSUM_NONE, SOCK_NOSPACE, IFF_NOARP or KERN_NOTICE!

Jarek P.

^ permalink raw reply

* Re: [PATCH 1/2] IPV6: ICMP6_MIB_OUTMSGS increment duplicated
From: David Miller @ 2008-01-21 11:06 UTC (permalink / raw)
  To: wangchen; +Cc: dlstevens, netdev, herbert
In-Reply-To: <47947B1F.7080709@cn.fujitsu.com>

From: Wang Chen <wangchen@cn.fujitsu.com>
Date: Mon, 21 Jan 2008 18:59:43 +0800

> Dave, because the network of my working place can't clone git
> tree, I used 2.6.24-rc8 to make the patches.

Does someone know how to setup GIT to update the HTTP
fetch information as a post-push hook?

> Can you apply them to net-2.6 tree?

Done.

^ permalink raw reply

* IPv6 problems (mtu is less than advmss?)
From: Jim Paris @ 2008-01-21 10:52 UTC (permalink / raw)
  To: netdev

Hi,

When the IPv6 default route is first autoconfigured, it seems the
advertised MSS doesn't get set properly.

I have computer A connected to an external interface with IPv4 and
tunneling IPv6 using 6to4.  It runs radvd on an internal interface to
provide connectivity to my LAN.  radvd.conf contains:

  interface brint {
	AdvLinkMTU 1420;    # advertise tiny MTU due to tunnel
	AdvSendAdvert on;
	prefix 0:0:0:1::/64
	{ Base6to4Interface brext; };
  };

Computer B is on the LAN and autoconfigures an IPv6 address.  However,
I have problems with some specific hosts [1].  They're probably doing
broken ICMP/PMTU filtering or something, but I've tracked down some
weirdness in the kernel:

  computerA# /etc/init.d/radvd start

  computerB# ifconfig eth0 down
  computerB# ifconfig eth0 up
  computerB# ip -6 route
  2002:125f:205:1::/64 dev eth0  proto kernel  metric 256  expires 2592312sec mtu 1420 advmss 1360 hoplimit 4294967295
  fe80::/64 dev eth0  metric 256  expires 21334361sec mtu 1420 advmss 1360 hoplimit 4294967295
  ff00::/8 dev eth0  metric 256  expires 21334361sec mtu 1420 advmss 1360 hoplimit 4294967295
  default via fe80::230:48ff:fe8b:5df4 dev eth0  proto kernel  metric 1024  expires 1788sec mtu 1420 advmss 1440 hoplimit 64

At this point, I see the network problems.  Note how the advmss in the
last line is not only larger than all the other lines, it's even
bigger than the MTU.  I won't be able to download [1] until I manually
fix advmss, _or_ just restart radvd on the other computer:

  computerA# /etc/init.d/radvd restart

  computerB# ip -6 route
  2002:125f:205:1::/64 dev eth0  proto kernel  metric 256  expires 2592160sec mtu 1420 advmss 1360 hoplimit 4294967295
  fe80::/64 dev eth0  metric 256  expires 21334355sec mtu 1420 advmss 1360 hoplimit 4294967295
  ff00::/8 dev eth0  metric 256  expires 21334355sec mtu 1420 advmss 1360 hoplimit 4294967295
  default via fe80::230:48ff:fe8b:5df4 dev eth0  proto kernel  metric 1024  expires 1798sec mtu 1420 advmss 1360 hoplimit 64

Now the advmss is better and everything works fine.  It seems that if
it's being created for the first time, the advmss is not correctly set
based on the MTU, but if there's already a route when it gets the RA,
it reconfigures it correctly.

Computer A is 2.6.23.1 and computer B is 2.6.24-rc8, both x86_64.

Any suggestions or other debugging I can do?

-jim

[1] wget -6 http://releases.mozilla.org/pub/mozilla.org/addons/12/all-in-one_gestures-0.18.0-fx.xpi

^ permalink raw reply

* Re: [PATCH 1/2] IPV6: ICMP6_MIB_OUTMSGS increment duplicated
From: Wang Chen @ 2008-01-21 10:59 UTC (permalink / raw)
  To: David Miller; +Cc: dlstevens, netdev, herbert
In-Reply-To: <20080121.025722.147904573.davem@davemloft.net>

David Miller said the following on 2008-1-21 18:57:
>> [IPV6]: ICMP6_MIB_OUTMSGS increment duplicated
>>
>> icmpv6_send() calls ip6_push_pending_frames() indirectly.
>> Both ip6_push_pending_frames() and icmpv6_send() increment
>> counter ICMP6_MIB_OUTMSGS.
>>
>> This patch remove the increment from icmpv6_send.
>>
>> Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
> 
> Which tree are these two changes targetted at?
> 
> 

Dave, because the network of my working place can't clone git
tree, I used 2.6.24-rc8 to make the patches.
Can you apply them to net-2.6 tree?


^ permalink raw reply

* Re: [PATCH 1/2] IPV6: ICMP6_MIB_OUTMSGS increment duplicated
From: David Miller @ 2008-01-21 10:57 UTC (permalink / raw)
  To: wangchen; +Cc: dlstevens, netdev, herbert
In-Reply-To: <479469F8.4010203@cn.fujitsu.com>

From: Wang Chen <wangchen@cn.fujitsu.com>
Date: Mon, 21 Jan 2008 17:46:32 +0800

> [IPV6]: ICMP6_MIB_OUTMSGS increment duplicated
> 
> icmpv6_send() calls ip6_push_pending_frames() indirectly.
> Both ip6_push_pending_frames() and icmpv6_send() increment
> counter ICMP6_MIB_OUTMSGS.
> 
> This patch remove the increment from icmpv6_send.
> 
> Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>

Which tree are these two changes targetted at?

^ permalink raw reply

* Re: [PATCH 1/3][NET] gen_estimator: faster gen_kill_estimator
From: Jarek Poplawski @ 2008-01-21 10:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, slavon, kaber, hadi
In-Reply-To: <20080121.023515.256390630.davem@davemloft.net>

On Mon, Jan 21, 2008 at 02:35:15AM -0800, David Miller wrote:
...
> Sorry, this structure is exported to userspace so we can't
> change it like that.
> 
> It is an attribute passed over netlink sockets.
> 

Thanks for finding this! I'll try to rethink this (especially why
my "tests" seemed to show something could be working there...).

Jarek P.

^ permalink raw reply

* Re: [PATCH] [IPV4] route: fix locking in rt_run_flush()
From: David Miller @ 2008-01-21 10:40 UTC (permalink / raw)
  To: joonwpark81; +Cc: netdev, dada1
In-Reply-To: <12009281372201-git-send-email-joonwpark81@gmail.com>

From: Joonwoo Park <joonwpark81@gmail.com>
Date: Tue, 22 Jan 2008 00:08:57 +0900

> The rt_run_flush() can be stucked if it was called while netdev is on the 
> high load.
> It's possible when pushing rtable to rt_hash is faster than pulling
> from it.
> 
> The commands 'ifconfig up or ifconfig mtu' and netif_carrier_on() can
> introduce soft lockup like this:
> 
> [  363.528001] BUG: soft lockup - CPU#0 stuck for 11s! [events/0:9]
> [  363.531492]
> [  363.535027] Pid: 9, comm: events/0 Not tainted (2.6.24-rc8 #14)
> [  363.538837] EIP: 0060:[<c4086a39>] EFLAGS: 00000286 CPU: 0
> [  363.542762] EIP is at kfree+0xa9/0xf0
> ...
> [  363.660815]  [<c42fb0fd>] skb_release_data+0x5d/0x90
> [  363.666989]  [<c42fb7dc>] skb_release_all+0x5c/0xd0
> [  363.673207]  [<c42faf8b>] __kfree_skb+0xb/0x90
> [  363.679474]  [<c42fb029>] kfree_skb+0x19/0x40
> [  363.685811]  [<c4322d87>] ip_rcv+0x27/0x290
> [  363.692223]  [<c4300ae5>] netif_receive_skb+0x255/0x320
> [  363.698759]  [<f88465aa>] e1000_clean_rx_irq+0x14a/0x4f0 [e1000]
> [  363.705456]  [<f88437c2>] e1000_clean+0x62/0x270 [e1000]
> [  363.712217]  [<c43031ee>] net_rx_action+0x16e/0x220
> [  363.719065]  [<c40346d7>] __do_softirq+0x87/0x100
> [  363.726001]  [<c40347a7>] do_softirq+0x57/0x60
> [  363.732979]  [<c4034b4e>] local_bh_enable_ip+0xae/0x100
> [  363.740094]  [<c43e73f5>] _spin_unlock_bh+0x25/0x30
> [  363.747283]  [<c431ec88>] rt_run_flush+0xc8/0xe0
> [  363.754566]  [<c4320c76>] rt_cache_flush+0xd6/0xe0
> [  363.761917]  [<c4350269>] fib_netdev_event+0x89/0xa0
> [  363.769361]  [<c4047d67>] notifier_call_chain+0x37/0x80
> ...
> 
> This patch makes rt_run_flush() to run with softirq is disabled.
> 
> Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>

I agree with the analysis of the problem, however not the solution.

This will absolutely kill software interrupt latency.

In fact, we have moved much of the flush work into a workqueue in
net-2.6.25 because of how important that is

We need to find some other way to solve this.

Eric, any ideas?

^ permalink raw reply

* Re: [PATCH 3/3][NET] gen_estimator: gen_replace_estimator() cosmetic changes
From: David Miller @ 2008-01-21 10:36 UTC (permalink / raw)
  To: jarkao2; +Cc: netdev, slavon, kaber, hadi
In-Reply-To: <20080120235115.GC2691@ami.dom.local>

From: Jarek Poplawski <jarkao2@gmail.com>
Date: Mon, 21 Jan 2008 00:51:15 +0100

> White spaces etc. are changed in gen_replace_estimator() to make it similar
> to others in a file.
> 
> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>

Applied to net-2.6.25, thanks.

^ permalink raw reply

* Re: [PATCH 2/3][NET] gen_estimator: list_empty() check in est_timer() fixed
From: David Miller @ 2008-01-21 10:36 UTC (permalink / raw)
  To: jarkao2; +Cc: shemminger, slavon, kaber, hadi, netdev
In-Reply-To: <20080121064240.GB981@ff.dom.local>

From: Jarek Poplawski <jarkao2@gmail.com>
Date: Mon, 21 Jan 2008 07:42:40 +0100

> On Mon, Jan 21, 2008 at 07:34:55AM +0100, Jarek Poplawski wrote:
> ...
> > BTW, I've forgotten to mention with patch 1/3 that this checking with
> > warning on gen_new_estimator() double call should be only temporary,
> > and after more testing gen_estimator structure could be probably
> > decreased after removing bstats and rate_est fields.
> 
> Hmm, let's forget about this again: it's too early in the morning...

:-)

FWIW I agree that double-negatives are confusing and we should
avoid them.

^ permalink raw reply

* Re: [PATCH 1/3][NET] gen_estimator: faster gen_kill_estimator
From: David Miller @ 2008-01-21 10:35 UTC (permalink / raw)
  To: jarkao2; +Cc: netdev, slavon, kaber, hadi
In-Reply-To: <20080120234659.GA2691@ami.dom.local>

From: Jarek Poplawski <jarkao2@gmail.com>
Date: Mon, 21 Jan 2008 00:46:59 +0100

I like the technique you used to fix this bug, but:

> diff -Nurp 2.6.24-rc8-mm1-/include/linux/gen_stats.h 2.6.24-rc8-mm1+/include/linux/gen_stats.h
> --- 2.6.24-rc8-mm1-/include/linux/gen_stats.h	2007-10-09 22:31:38.000000000 +0200
> +++ 2.6.24-rc8-mm1+/include/linux/gen_stats.h	2008-01-20 20:37:08.000000000 +0100
> @@ -28,11 +28,13 @@ struct gnet_stats_basic
>   * struct gnet_stats_rate_est - rate estimator
>   * @bps: current byte rate
>   * @pps: current packet rate
> + * @gen_estimator: internal data
>   */
>  struct gnet_stats_rate_est
>  {
>  	__u32	bps;
>  	__u32	pps;
> +	unsigned long	gen_estimator;
>  };
>  
>  /**

Sorry, this structure is exported to userspace so we can't
change it like that.

It is an attribute passed over netlink sockets.


^ permalink raw reply

* Re: [PATCH] net: add sparse annotation to ptype_seq_start/stop
From: David Miller @ 2008-01-21 10:28 UTC (permalink / raw)
  To: josh; +Cc: paulmck, shemminger, netdev
In-Reply-To: <479449DC.4020105@freedesktop.org>

From: Josh Triplett <josh@freedesktop.org>
Date: Sun, 20 Jan 2008 23:29:32 -0800

> At the moment, Sparse doesn't actually use the context expression.  In
> the ideal case when it does, all references to the same lock should
> use a context expression which resolves to that lock (whatever that
> may mean; hence why Sparse doesn't handle it yet).  For mechanisms
> like RCU without a lock variable, this will likely entail some sort of
> fake lock expression, which again needs to match between all users of
> the same mechanism.  Like any expression in C, case matters; thus,
> please match the existing references to "RCU" rather than "rcu".

Thus, I've checked in Stephen's patch with __acquires(RCU) and
__releases(RCU).

Thanks.


^ permalink raw reply

* Re: [PATCH] net classifier: style cleanup's
From: David Miller @ 2008-01-21 10:26 UTC (permalink / raw)
  To: shemminger; +Cc: kaber, netdev
In-Reply-To: <20080120140613.10a7d29b@deepthought>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Sun, 20 Jan 2008 14:06:13 -0800

> Classifier code cleanup. Get rid of printk wrapper, and fix whitespace
> and other style stuff reported by checkpatch

Applied, thanks.

^ permalink raw reply

* Re: [PATCH] sch_atm: style cleanup
From: David Miller @ 2008-01-21 10:25 UTC (permalink / raw)
  To: shemminger; +Cc: kaber, chas, netdev, linux-atm-general
In-Reply-To: <20080120140342.13139be7@deepthought>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Sun, 20 Jan 2008 14:03:42 -0800

> ATM scheduler clean house:
>   * get rid of printk and qdisc_priv() wrapper
>   * split some assignment in if() statements
>   * whitespace and line breaks.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied.

^ permalink raw reply

* Re: [PATCH 4/4] dsmark: checkpatch warning cleanup
From: David Miller @ 2008-01-21 10:24 UTC (permalink / raw)
  To: shemminger; +Cc: kaber, netdev
In-Reply-To: <20080120132536.6f29edda@deepthought>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Sun, 20 Jan 2008 13:25:36 -0800

> Get rid of all style things checkpatch warns about, indentation
> and whitespace.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH 3/4] dsmark: handle cloned and non-linear skb's
From: David Miller @ 2008-01-21 10:23 UTC (permalink / raw)
  To: shemminger; +Cc: kaber, netdev
In-Reply-To: <20080120132354.55de46ed@deepthought>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Sun, 20 Jan 2008 13:23:54 -0800

> Make dsmark work properly with non-linear and cloned skb's
> Before modifying the header, it needs to check that skb header is
> writeable.
> 
> Note: this makes the assumption, that if it queues a good skb
> then a good skb will come out of the embedded qdisc.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied.

^ permalink raw reply

* Re: [PATCH 2/4] dsmark: get rid of trivial function
From: David Miller @ 2008-01-21 10:22 UTC (permalink / raw)
  To: kaber; +Cc: shemminger, netdev
In-Reply-To: <4793E460.5020804@trash.net>

From: Patrick McHardy <kaber@trash.net>
Date: Mon, 21 Jan 2008 01:16:32 +0100

> Stephen Hemminger wrote:
> > Replace loop in dsmark_valid_indices with equivalent bit math.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> > 
> > --- a/net/sched/sch_dsmark.c	2008-01-20 13:07:58.000000000 -0800
> > +++ b/net/sched/sch_dsmark.c	2008-01-20 13:22:54.000000000 -0800
> > @@ -45,13 +45,8 @@ struct dsmark_qdisc_data {
> >  
> >  static inline int dsmark_valid_indices(u16 indices)
> >  {
> > -	while (indices != 1) {
> > -		if (indices & 1)
> > -			return 0;
> > -		indices >>= 1;
> > -	}
> > -
> > -	return 1;
> > +	/* Must have only one bit set */
> > +	return (indices & (indices - 1)) == 0;
> 
> hweight seems easier to understand, it took me a bit
> to realize that the comment matches the code :)

Sounds good.  Here is what I ended up checking in.

[PKT_SCHED] dsmark: Use hweight32() instead of convoluted loop.

Based upon a patch by Stephen Hemminger and suggestions
from Patrick McHardy.

Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index a9732ae..d96eaf0 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -10,6 +10,7 @@
 #include <linux/errno.h>
 #include <linux/skbuff.h>
 #include <linux/rtnetlink.h>
+#include <linux/bitops.h>
 #include <net/pkt_sched.h>
 #include <net/dsfield.h>
 #include <net/inet_ecn.h>
@@ -43,17 +44,6 @@ struct dsmark_qdisc_data {
 	int			set_tc_index;
 };
 
-static inline int dsmark_valid_indices(u16 indices)
-{
-	while (indices != 1) {
-		if (indices & 1)
-			return 0;
-		indices >>= 1;
-	}
-
-	return 1;
-}
-
 static inline int dsmark_valid_index(struct dsmark_qdisc_data *p, u16 index)
 {
 	return (index <= p->indices && index > 0);
@@ -348,7 +338,8 @@ static int dsmark_init(struct Qdisc *sch, struct rtattr *opt)
 		goto errout;
 
 	indices = RTA_GET_U16(tb[TCA_DSMARK_INDICES-1]);
-	if (!indices || !dsmark_valid_indices(indices))
+
+	if (hweight32(indices) != 1)
 		goto errout;
 
 	if (tb[TCA_DSMARK_DEFAULT_INDEX-1])

^ permalink raw reply related

* Re: [PATCH 1/2] IPV6: ICMP6_MIB_OUTMSGS increment duplicated
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2008-01-21  9:59 UTC (permalink / raw)
  To: wangchen; +Cc: davem, dlstevens, netdev, herbert
In-Reply-To: <479469F8.4010203@cn.fujitsu.com>

In article <479469F8.4010203@cn.fujitsu.com> (at Mon, 21 Jan 2008 17:46:32 +0800), Wang Chen <wangchen@cn.fujitsu.com> says:

> [IPV6]: ICMP6_MIB_OUTMSGS increment duplicated
> 
> icmpv6_send() calls ip6_push_pending_frames() indirectly.
> Both ip6_push_pending_frames() and icmpv6_send() increment
> counter ICMP6_MIB_OUTMSGS.
> 
> This patch remove the increment from icmpv6_send.
> 
> Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

--yoshfuji

^ permalink raw reply

* Re: [PATCH 2/2] IPV6: RFC 2011 compatibility broken
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2008-01-21  9:58 UTC (permalink / raw)
  To: wangchen; +Cc: davem, dlstevens, netdev, herbert
In-Reply-To: <47946A04.3080702@cn.fujitsu.com>

In article <47946A04.3080702@cn.fujitsu.com> (at Mon, 21 Jan 2008 17:46:44 +0800), Wang Chen <wangchen@cn.fujitsu.com> says:

> The snmp6 entry name was changed, and it broke compatibility
> to RFC 2011.
> 
> Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

--yoshfuji

^ permalink raw reply

* [PATCH 1/2] IPV6: ICMP6_MIB_OUTMSGS increment duplicated
From: Wang Chen @ 2008-01-21  9:46 UTC (permalink / raw)
  To: David S. Miller; +Cc: David L Stevens, netdev, Herbert Xu
In-Reply-To: <478DD57B.6020503@cn.fujitsu.com>

[IPV6]: ICMP6_MIB_OUTMSGS increment duplicated

icmpv6_send() calls ip6_push_pending_frames() indirectly.
Both ip6_push_pending_frames() and icmpv6_send() increment
counter ICMP6_MIB_OUTMSGS.

This patch remove the increment from icmpv6_send.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>

--- linux-2.6.24.rc8.org/net/ipv6/icmp.c	2008-01-16 17:45:03.000000000 +0800
+++ linux-2.6.24.rc8/net/ipv6/icmp.c	2008-01-21 15:56:06.000000000 +0800
@@ -458,8 +458,6 @@ void icmpv6_send(struct sk_buff *skb, in
 	}
 	err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr));
 
-	ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS);
-
 out_put:
 	if (likely(idev != NULL))
 		in6_dev_put(idev);



^ permalink raw reply


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