1
0
Fork 0
remarkable-linux/net/sched
Neil Horman 5305392b44 netem: Segment GSO packets on enqueue
[ Upstream commit 6071bd1aa1 ]

This was recently reported to me, and reproduced on the latest net kernel,
when attempting to run netperf from a host that had a netem qdisc attached
to the egress interface:

[  788.073771] ---------------------[ cut here ]---------------------------
[  788.096716] WARNING: at net/core/dev.c:2253 skb_warn_bad_offload+0xcd/0xda()
[  788.129521] bnx2: caps=(0x00000001801949b3, 0x0000000000000000) len=2962
data_len=0 gso_size=1448 gso_type=1 ip_summed=3
[  788.182150] Modules linked in: sch_netem kvm_amd kvm crc32_pclmul ipmi_ssif
ghash_clmulni_intel sp5100_tco amd64_edac_mod aesni_intel lrw gf128mul
glue_helper ablk_helper edac_mce_amd cryptd pcspkr sg edac_core hpilo ipmi_si
i2c_piix4 k10temp fam15h_power hpwdt ipmi_msghandler shpchp acpi_power_meter
pcc_cpufreq nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c
sd_mod crc_t10dif crct10dif_generic mgag200 syscopyarea sysfillrect sysimgblt
i2c_algo_bit drm_kms_helper ahci ata_generic pata_acpi ttm libahci
crct10dif_pclmul pata_atiixp tg3 libata crct10dif_common drm crc32c_intel ptp
serio_raw bnx2 r8169 hpsa pps_core i2c_core mii dm_mirror dm_region_hash dm_log
dm_mod
[  788.465294] CPU: 16 PID: 0 Comm: swapper/16 Tainted: G        W
------------   3.10.0-327.el7.x86_64 #1
[  788.511521] Hardware name: HP ProLiant DL385p Gen8, BIOS A28 12/17/2012
[  788.542260]  ffff880437c036b8 f7afc56532a53db9 ffff880437c03670
ffffffff816351f1
[  788.576332]  ffff880437c036a8 ffffffff8107b200 ffff880633e74200
ffff880231674000
[  788.611943]  0000000000000001 0000000000000003 0000000000000000
ffff880437c03710
[  788.647241] Call Trace:
[  788.658817]  <IRQ>  [<ffffffff816351f1>] dump_stack+0x19/0x1b
[  788.686193]  [<ffffffff8107b200>] warn_slowpath_common+0x70/0xb0
[  788.713803]  [<ffffffff8107b29c>] warn_slowpath_fmt+0x5c/0x80
[  788.741314]  [<ffffffff812f92f3>] ? ___ratelimit+0x93/0x100
[  788.767018]  [<ffffffff81637f49>] skb_warn_bad_offload+0xcd/0xda
[  788.796117]  [<ffffffff8152950c>] skb_checksum_help+0x17c/0x190
[  788.823392]  [<ffffffffa01463a1>] netem_enqueue+0x741/0x7c0 [sch_netem]
[  788.854487]  [<ffffffff8152cb58>] dev_queue_xmit+0x2a8/0x570
[  788.880870]  [<ffffffff8156ae1d>] ip_finish_output+0x53d/0x7d0
...

The problem occurs because netem is not prepared to handle GSO packets (as it
uses skb_checksum_help in its enqueue path, which cannot manipulate these
frames).

The solution I think is to simply segment the skb in a simmilar fashion to the
way we do in __dev_queue_xmit (via validate_xmit_skb), with some minor changes.
When we decide to corrupt an skb, if the frame is GSO, we segment it, corrupt
the first segment, and enqueue the remaining ones.

tested successfully by myself on the latest net kernel, to which this applies

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Jamal Hadi Salim <jhs@mojatatu.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: netem@lists.linux-foundation.org
CC: eric.dumazet@gmail.com
CC: stephen@networkplumber.org
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
2016-07-10 23:07:23 -04:00
..
Kconfig Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:36:45 -08:00
Makefile net: sched: Introduce connmark action 2015-01-19 16:02:06 -05:00
act_api.c net: sched: fix refcount imbalance in actions 2015-09-29 19:26:24 +02:00
act_bpf.c act_bpf: fix memory leaks when replacing bpf programs 2015-09-29 19:26:24 +02:00
act_connmark.c net: sched: act_connmark: don't zap skb->nfct 2015-04-29 14:56:40 -04:00
act_csum.c net: sched: fix skb->protocol use in case of accelerated vlan path 2015-01-13 17:51:08 -05:00
act_gact.c sched: fix act file names in header comment 2014-11-06 15:04:41 -05:00
act_ipt.c sched: fix act file names in header comment 2014-11-06 15:04:41 -05:00
act_mirred.c act_mirred: clear sender cpu before sending to tx 2015-10-27 09:51:51 +09:00
act_nat.c net_sched: act: move tcf_hashinfo_init() into tcf_register_action() 2014-02-12 19:23:32 -05:00
act_pedit.c sched: fix act file names in header comment 2014-11-06 15:04:41 -05:00
act_police.c sched: fix act file names in header comment 2014-11-06 15:04:41 -05:00
act_simple.c sched: fix act file names in header comment 2014-11-06 15:04:41 -05:00
act_skbedit.c net_sched: act: move tcf_hashinfo_init() into tcf_register_action() 2014-02-12 19:23:32 -05:00
act_vlan.c sched: introduce vlan action 2014-11-21 14:20:18 -05:00
cls_api.c net: sched: fix call_rcu() race on classifier module unloads 2015-05-21 18:48:18 -04:00
cls_basic.c net_sched: destroy proto tp when all filters are gone 2015-03-09 15:35:55 -04:00
cls_bpf.c sched: cls_bpf: fix panic on filter replace 2015-09-29 19:26:23 +02:00
cls_cgroup.c net_sched: destroy proto tp when all filters are gone 2015-03-09 15:35:55 -04:00
cls_flow.c sched: cls_flow: fix panic on filter replace 2015-09-29 19:26:23 +02:00
cls_fw.c net: revert "net_sched: move tp->root allocation into fw_init()" 2015-10-03 13:49:17 +02:00
cls_route.c net_sched: destroy proto tp when all filters are gone 2015-03-09 15:35:55 -04:00
cls_rsvp.c
cls_rsvp.h net_sched: destroy proto tp when all filters are gone 2015-03-09 15:35:55 -04:00
cls_rsvp6.c
cls_tcindex.c net_sched: destroy proto tp when all filters are gone 2015-03-09 15:35:55 -04:00
cls_u32.c cls_u32: complete the check for non-forced case in u32_destroy() 2015-10-03 13:49:12 +02:00
em_canid.c net: sched: remove tcf_proto from ematch calls 2014-10-06 18:02:32 -04:00
em_cmp.c net_sched: cleanups 2011-01-19 23:31:12 -08:00
em_ipset.c net: sched: fix skb->protocol use in case of accelerated vlan path 2015-01-13 17:51:08 -05:00
em_meta.c net: rename vlan_tx_* helpers since "tx" is misleading there 2015-01-13 17:51:08 -05:00
em_nbyte.c net: sched: remove tcf_proto from ematch calls 2014-10-06 18:02:32 -04:00
em_text.c net: Remove state argument from skb_find_text() 2015-02-22 15:59:54 -05:00
em_u32.c net_sched: cleanups 2011-01-19 23:31:12 -08:00
ematch.c ematch: Fix auto-loading of ematch modules. 2015-02-20 15:30:56 -05:00
sch_api.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_atm.c net: sched: enable per cpu qstats 2014-09-30 01:02:26 -04:00
sch_blackhole.c pkt_sched: Add qdisc->ops->peek() implementation. 2008-10-31 00:45:55 -07:00
sch_cbq.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_choke.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_codel.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_drr.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_dsmark.c sch_dsmark: update backlog as well 2016-07-10 23:07:23 -04:00
sch_fifo.c net: sched: implement qstat helper routines 2014-09-30 01:02:26 -04:00
sch_fq.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_fq_codel.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_generic.c net: sched: do not requeue a NULL skb 2016-07-10 23:07:21 -04:00
sch_gred.c net_sched: gred: use correct backlog value in WRED mode 2015-05-11 13:26:26 -04:00
sch_hfsc.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_hhf.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_htb.c sch_htb: update backlog as well 2016-07-10 23:07:23 -04:00
sch_ingress.c net: use jump label patching for ingress qdisc in __netif_receive_skb_core 2015-04-13 13:34:40 -04:00
sch_mq.c net_sched: fix qdisc_tree_decrease_qlen() races 2015-12-14 21:24:33 -08:00
sch_mqprio.c net_sched: fix qdisc_tree_decrease_qlen() races 2015-12-14 21:24:33 -08:00
sch_multiq.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_netem.c netem: Segment GSO packets on enqueue 2016-07-10 23:07:23 -04:00
sch_pie.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_plug.c net_sched: sch_plug: plug_qdisc_ops is static 2012-02-13 16:04:40 -05:00
sch_prio.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_qfq.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_red.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_sfb.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_sfq.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_tbf.c net_sched: update hierarchical backlog too 2016-07-10 23:07:23 -04:00
sch_teql.c net: sched: fix skb->protocol use in case of accelerated vlan path 2015-01-13 17:51:08 -05:00