<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/include/net/sch_generic.h, branch v4.7</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.7</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.7'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-06-07T23:59:53Z</updated>
<entry>
<title>net: sched: fix tc_should_offload for specific clsact classes</title>
<updated>2016-06-07T23:59:53Z</updated>
<author>
<name>Daniel Borkmann</name>
<email>daniel@iogearbox.net</email>
</author>
<published>2016-06-06T20:50:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=92c075dbdeed02bdf293cb0f513bad70aa714b8d'/>
<id>urn:sha1:92c075dbdeed02bdf293cb0f513bad70aa714b8d</id>
<content type='text'>
When offloading classifiers such as u32 or flower to hardware, and the
qdisc is clsact (TC_H_CLSACT), then we need to differentiate its classes,
since not all of them handle ingress, therefore we must leave those in
software path. Add a .tcf_cl_offload() callback, so we can generically
handle them, tested on ixgbe.

Fixes: 10cbc6843446 ("net/sched: cls_flower: Hardware offloaded filters statistics support")
Fixes: 5b33f48842fa ("net/flower: Introduce hardware offload support")
Fixes: a1b7c5fd7fe9 ("net: sched: add cls_u32 offload hooks for netdevs")
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: John Fastabend &lt;john.r.fastabend@intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net_sched: keep backlog updated with qlen</title>
<updated>2016-06-07T01:14:29Z</updated>
<author>
<name>WANG Cong</name>
<email>xiyou.wangcong@gmail.com</email>
</author>
<published>2016-06-03T22:05:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a27758ffaf96f89002129eedb2cc172d254099f8'/>
<id>urn:sha1:a27758ffaf96f89002129eedb2cc172d254099f8</id>
<content type='text'>
For gso_skb we only update qlen, backlog should be updated too.

Note, it is correct to just update these stats at one layer,
because the gso_skb is cached there.

Reported-by: Stas Nichiporovich &lt;stasn77@gmail.com&gt;
Fixes: 2ccccf5fb43f ("net_sched: update hierarchical backlog too")
Cc: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net/sched: Enable netdev drivers to update statistics of offloaded actions</title>
<updated>2016-05-16T17:43:50Z</updated>
<author>
<name>Amir Vadai</name>
<email>amirva@mellanox.com</email>
</author>
<published>2016-05-13T12:55:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3804070235264ea883c3fdccd9ed16fef20b5ccb'/>
<id>urn:sha1:3804070235264ea883c3fdccd9ed16fef20b5ccb</id>
<content type='text'>
Introduce stats_update callback. netdev driver could call it for offloaded
actions to update the basic statistics (packets, bytes and last use).
Since bstats_update() and bstats_cpu_update() use skb as an argument to
get the counters, _bstats_update() and _bstats_cpu_update(), that get
bytes and packets as arguments, were added.

Signed-off-by: Amir Vadai &lt;amirva@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: sched: use pfifo_fast for non real queues</title>
<updated>2016-03-03T22:38:46Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2016-03-02T16:21:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1f27cde313d72d6b44a73ba89c8b2c6a99c628cf'/>
<id>urn:sha1:1f27cde313d72d6b44a73ba89c8b2c6a99c628cf</id>
<content type='text'>
Some devices declare a high number of TX queues, then set a much
lower real_num_tx_queues

This cause setups using fq_codel, sfq or fq as the default qdisc to consume
more memory than really needed.

Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net_sched: update hierarchical backlog too</title>
<updated>2016-02-29T22:02:33Z</updated>
<author>
<name>WANG Cong</name>
<email>xiyou.wangcong@gmail.com</email>
</author>
<published>2016-02-25T22:55:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2ccccf5fb43ff62b2b96cc58d95fc0b3596516e4'/>
<id>urn:sha1:2ccccf5fb43ff62b2b96cc58d95fc0b3596516e4</id>
<content type='text'>
When the bottom qdisc decides to, for example, drop some packet,
it calls qdisc_tree_decrease_qlen() to update the queue length
for all its ancestors, we need to update the backlog too to
keep the stats on root qdisc accurate.

Cc: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Acked-by: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net_sched: introduce qdisc_replace() helper</title>
<updated>2016-02-29T22:02:33Z</updated>
<author>
<name>WANG Cong</name>
<email>xiyou.wangcong@gmail.com</email>
</author>
<published>2016-02-25T22:55:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=86a7996cc8a078793670d82ed97d5a99bb4e8496'/>
<id>urn:sha1:86a7996cc8a078793670d82ed97d5a99bb4e8496</id>
<content type='text'>
Remove nearly duplicated code and prepare for the following patch.

Cc: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Acked-by: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: Cong Wang &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net, sched: add skb_at_tc_ingress helper</title>
<updated>2016-01-10T22:54:28Z</updated>
<author>
<name>Daniel Borkmann</name>
<email>daniel@iogearbox.net</email>
</author>
<published>2016-01-07T14:50:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fdc5432a7b44ab7de17141beec19d946b9344e91'/>
<id>urn:sha1:fdc5432a7b44ab7de17141beec19d946b9344e91</id>
<content type='text'>
Add a skb_at_tc_ingress() as this will be needed elsewhere as well and
can hide the ugly ifdef.

Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net_sched: fix qdisc_tree_decrease_qlen() races</title>
<updated>2015-12-03T19:59:05Z</updated>
<author>
<name>Eric Dumazet</name>
<email>edumazet@google.com</email>
</author>
<published>2015-12-02T04:08:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4eaf3b84f2881c9c028f1d5e76c52ab575fe3a66'/>
<id>urn:sha1:4eaf3b84f2881c9c028f1d5e76c52ab575fe3a66</id>
<content type='text'>
qdisc_tree_decrease_qlen() suffers from two problems on multiqueue
devices.

One problem is that it updates sch-&gt;q.qlen and sch-&gt;qstats.drops
on the mq/mqprio root qdisc, while it should not : Daniele
reported underflows errors :
[  681.774821] PAX: sch-&gt;q.qlen: 0 n: 1
[  681.774825] PAX: size overflow detected in function qdisc_tree_decrease_qlen net/sched/sch_api.c:769 cicus.693_49 min, count: 72, decl: qlen; num: 0; context: sk_buff_head;
[  681.774954] CPU: 2 PID: 19 Comm: ksoftirqd/2 Tainted: G           O    4.2.6.201511282239-1-grsec #1
[  681.774955] Hardware name: ASUSTeK COMPUTER INC. X302LJ/X302LJ, BIOS X302LJ.202 03/05/2015
[  681.774956]  ffffffffa9a04863 0000000000000000 0000000000000000 ffffffffa990ff7c
[  681.774959]  ffffc90000d3bc38 ffffffffa95d2810 0000000000000007 ffffffffa991002b
[  681.774960]  ffffc90000d3bc68 ffffffffa91a44f4 0000000000000001 0000000000000001
[  681.774962] Call Trace:
[  681.774967]  [&lt;ffffffffa95d2810&gt;] dump_stack+0x4c/0x7f
[  681.774970]  [&lt;ffffffffa91a44f4&gt;] report_size_overflow+0x34/0x50
[  681.774972]  [&lt;ffffffffa94d17e2&gt;] qdisc_tree_decrease_qlen+0x152/0x160
[  681.774976]  [&lt;ffffffffc02694b1&gt;] fq_codel_dequeue+0x7b1/0x820 [sch_fq_codel]
[  681.774978]  [&lt;ffffffffc02680a0&gt;] ? qdisc_peek_dequeued+0xa0/0xa0 [sch_fq_codel]
[  681.774980]  [&lt;ffffffffa94cd92d&gt;] __qdisc_run+0x4d/0x1d0
[  681.774983]  [&lt;ffffffffa949b2b2&gt;] net_tx_action+0xc2/0x160
[  681.774985]  [&lt;ffffffffa90664c1&gt;] __do_softirq+0xf1/0x200
[  681.774987]  [&lt;ffffffffa90665ee&gt;] run_ksoftirqd+0x1e/0x30
[  681.774989]  [&lt;ffffffffa90896b0&gt;] smpboot_thread_fn+0x150/0x260
[  681.774991]  [&lt;ffffffffa9089560&gt;] ? sort_range+0x40/0x40
[  681.774992]  [&lt;ffffffffa9085fe4&gt;] kthread+0xe4/0x100
[  681.774994]  [&lt;ffffffffa9085f00&gt;] ? kthread_worker_fn+0x170/0x170
[  681.774995]  [&lt;ffffffffa95d8d1e&gt;] ret_from_fork+0x3e/0x70

mq/mqprio have their own ways to report qlen/drops by folding stats on
all their queues, with appropriate locking.

A second problem is that qdisc_tree_decrease_qlen() calls qdisc_lookup()
without proper locking : concurrent qdisc updates could corrupt the list
that qdisc_match_from_root() parses to find a qdisc given its handle.

Fix first problem adding a TCQ_F_NOPARENT qdisc flag that
qdisc_tree_decrease_qlen() can use to abort its tree traversal,
as soon as it meets a mq/mqprio qdisc children.

Second problem can be fixed by RCU protection.
Qdisc are already freed after RCU grace period, so qdisc_list_add() and
qdisc_list_del() simply have to use appropriate rcu list variants.

A future patch will add a per struct netdev_queue list anchor, so that
qdisc_tree_decrease_qlen() can have more efficient lookups.

Reported-by: Daniele Fucini &lt;dfucini@gmail.com&gt;
Signed-off-by: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Cong Wang &lt;cwang@twopensource.com&gt;
Cc: Jamal Hadi Salim &lt;jhs@mojatatu.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>bpf: add bpf_redirect() helper</title>
<updated>2015-09-18T04:09:07Z</updated>
<author>
<name>Alexei Starovoitov</name>
<email>ast@plumgrid.com</email>
</author>
<published>2015-09-16T06:05:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=27b29f63058d26c6c1742f1993338280d5a41dc6'/>
<id>urn:sha1:27b29f63058d26c6c1742f1993338280d5a41dc6</id>
<content type='text'>
Existing bpf_clone_redirect() helper clones skb before redirecting
it to RX or TX of destination netdev.
Introduce bpf_redirect() helper that does that without cloning.

Benchmarked with two hosts using 10G ixgbe NICs.
One host is doing line rate pktgen.
Another host is configured as:
$ tc qdisc add dev $dev ingress
$ tc filter add dev $dev root pref 10 u32 match u32 0 0 flowid 1:2 \
   action bpf run object-file tcbpf1_kern.o section clone_redirect_xmit drop
so it receives the packet on $dev and immediately xmits it on $dev + 1
The section 'clone_redirect_xmit' in tcbpf1_kern.o file has the program
that does bpf_clone_redirect() and performance is 2.0 Mpps

$ tc filter add dev $dev root pref 10 u32 match u32 0 0 flowid 1:2 \
   action bpf run object-file tcbpf1_kern.o section redirect_xmit drop
which is using bpf_redirect() - 2.4 Mpps

and using cls_bpf with integrated actions as:
$ tc filter add dev $dev root pref 10 \
  bpf run object-file tcbpf1_kern.o section redirect_xmit integ_act classid 1
performance is 2.5 Mpps

To summarize:
u32+act_bpf using clone_redirect - 2.0 Mpps
u32+act_bpf using redirect - 2.4 Mpps
cls_bpf using redirect - 2.5 Mpps

For comparison linux bridge in this setup is doing 2.1 Mpps
and ixgbe rx + drop in ip_rcv - 7.8 Mpps

Signed-off-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Acked-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: John Fastabend &lt;john.r.fastabend@intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>cls_bpf: introduce integrated actions</title>
<updated>2015-09-18T04:09:06Z</updated>
<author>
<name>Daniel Borkmann</name>
<email>daniel@iogearbox.net</email>
</author>
<published>2015-09-16T06:05:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=045efa82ff563cd4e656ca1c2e354fa5bf6bbda4'/>
<id>urn:sha1:045efa82ff563cd4e656ca1c2e354fa5bf6bbda4</id>
<content type='text'>
Often cls_bpf classifier is used with single action drop attached.
Optimize this use case and let cls_bpf return both classid and action.
For backwards compatibility reasons enable this feature under
TCA_BPF_FLAG_ACT_DIRECT flag.

Then more interesting programs like the following are easier to write:
int cls_bpf_prog(struct __sk_buff *skb)
{
  /* classify arp, ip, ipv6 into different traffic classes
   * and drop all other packets
   */
  switch (skb-&gt;protocol) {
  case htons(ETH_P_ARP):
    skb-&gt;tc_classid = 1;
    break;
  case htons(ETH_P_IP):
    skb-&gt;tc_classid = 2;
    break;
  case htons(ETH_P_IPV6):
    skb-&gt;tc_classid = 3;
    break;
  default:
    return TC_ACT_SHOT;
  }

  return TC_ACT_OK;
}

Joint work with Daniel Borkmann.

Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@plumgrid.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
