alistair23-linux/net/sched
Cong Wang 7801db8aec net_sched: avoid generating same handle for u32 filters
When kernel generates a handle for a u32 filter, it tries to start
from the max in the bucket. So when we have a filter with the max (fff)
handle, it will cause kernel always generates the same handle for new
filters. This can be shown by the following command:

	tc qdisc add dev eth0 ingress
	tc filter add dev eth0 parent ffff: protocol ip pref 770 handle 800::fff u32 match ip protocol 1 0xff
	tc filter add dev eth0 parent ffff: protocol ip pref 770 u32 match ip protocol 1 0xff
	...

we will get some u32 filters with same handle:

 # tc filter show dev eth0 parent ffff:
filter protocol ip pref 770 u32
filter protocol ip pref 770 u32 fh 800: ht divisor 1
filter protocol ip pref 770 u32 fh 800::fff order 4095 key ht 800 bkt 0
  match 00010000/00ff0000 at 8
filter protocol ip pref 770 u32 fh 800::fff order 4095 key ht 800 bkt 0
  match 00010000/00ff0000 at 8
filter protocol ip pref 770 u32 fh 800::fff order 4095 key ht 800 bkt 0
  match 00010000/00ff0000 at 8
filter protocol ip pref 770 u32 fh 800::fff order 4095 key ht 800 bkt 0
  match 00010000/00ff0000 at 8

handles should be unique. This patch fixes it by looking up a bitmap,
so that can guarantee the handle is as unique as possible. For compatibility,
we still start from 0x800.

Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-07-20 20:49:17 -07:00
..
act_api.c net: Use netlink_ns_capable to verify the permisions of netlink messages 2014-04-24 13:44:54 -04:00
act_csum.c
act_gact.c
act_ipt.c
act_mirred.c
act_nat.c
act_pedit.c
act_police.c
act_simple.c
act_skbedit.c
cls_api.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-05-12 13:19:14 -04:00
cls_basic.c sched, cls: check if we could overwrite actions when changing a filter 2014-04-27 23:42:39 -04:00
cls_bpf.c net: filter: let unattached filters use sock_fprog_kern 2014-05-23 16:48:05 -04:00
cls_cgroup.c sched, cls: check if we could overwrite actions when changing a filter 2014-04-27 23:42:39 -04:00
cls_flow.c sched, cls: check if we could overwrite actions when changing a filter 2014-04-27 23:42:39 -04:00
cls_fw.c sched, cls: check if we could overwrite actions when changing a filter 2014-04-27 23:42:39 -04:00
cls_route.c sched, cls: check if we could overwrite actions when changing a filter 2014-04-27 23:42:39 -04:00
cls_rsvp.c
cls_rsvp.h sched, cls: check if we could overwrite actions when changing a filter 2014-04-27 23:42:39 -04:00
cls_rsvp6.c
cls_tcindex.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2014-05-24 00:32:30 -04:00
cls_u32.c net_sched: avoid generating same handle for u32 filters 2014-07-20 20:49:17 -07:00
em_canid.c
em_cmp.c
em_ipset.c
em_meta.c
em_nbyte.c
em_text.c
em_u32.c
ematch.c
Kconfig
Makefile
sch_api.c net_sched: drr: warn when qdisc is not work conserving 2014-06-11 15:50:59 -07:00
sch_atm.c net_sched: return nla_nest_end() instead of skb->len 2014-03-13 15:39:20 -04:00
sch_blackhole.c
sch_cbq.c net_sched: return nla_nest_end() instead of skb->len 2014-03-13 15:39:20 -04:00
sch_choke.c net: use the new API kvfree() 2014-06-05 00:49:51 -07:00
sch_codel.c
sch_drr.c net_sched: drr: warn when qdisc is not work conserving 2014-06-11 15:50:59 -07:00
sch_dsmark.c
sch_fifo.c
sch_fq.c net: use the new API kvfree() 2014-06-05 00:49:51 -07:00
sch_fq_codel.c net: use the new API kvfree() 2014-06-05 00:49:51 -07:00
sch_generic.c net-sysfs: expose number of carrier on/off changes 2014-03-31 16:24:52 -04:00
sch_gred.c
sch_hfsc.c net_sched: return nla_nest_end() instead of skb->len 2014-03-13 15:39:20 -04:00
sch_hhf.c net: use the new API kvfree() 2014-06-05 00:49:51 -07:00
sch_htb.c net_sched: htb: do not acquire qdisc lock in dump operations 2014-03-06 17:24:54 -05:00
sch_ingress.c net_sched: return nla_nest_end() instead of skb->len 2014-03-13 15:39:20 -04:00
sch_mq.c
sch_mqprio.c
sch_multiq.c
sch_netem.c net: use the new API kvfree() 2014-06-05 00:49:51 -07:00
sch_pie.c
sch_plug.c
sch_prio.c
sch_qfq.c
sch_red.c
sch_sfb.c
sch_sfq.c net: use the new API kvfree() 2014-06-05 00:49:51 -07:00
sch_tbf.c net_sched: return nla_nest_end() instead of skb->len 2014-03-13 15:39:20 -04:00
sch_teql.c