Skip to content

Commit add641e

Browse files
dcarattidavem330
authored andcommitted
sched: act_csum: don't mangle TCP and UDP GSO packets
after act_csum computes the checksum on skbs carrying GSO TCP/UDP packets, subsequent segmentation fails because skb_needs_check(skb, true) returns true. Because of that, skb_warn_bad_offload() is invoked and the following message is displayed: WARNING: CPU: 3 PID: 28 at net/core/dev.c:2553 skb_warn_bad_offload+0xf0/0xfd <...> [<ffffffff8171f486>] skb_warn_bad_offload+0xf0/0xfd [<ffffffff8161304c>] __skb_gso_segment+0xec/0x110 [<ffffffff8161340d>] validate_xmit_skb+0x12d/0x2b0 [<ffffffff816135d2>] validate_xmit_skb_list+0x42/0x70 [<ffffffff8163c560>] sch_direct_xmit+0xd0/0x1b0 [<ffffffff8163c760>] __qdisc_run+0x120/0x270 [<ffffffff81613b3d>] __dev_queue_xmit+0x23d/0x690 [<ffffffff81613fa0>] dev_queue_xmit+0x10/0x20 Since GSO is able to compute checksum on individual segments of such skbs, we can simply skip mangling the packet. Signed-off-by: Davide Caratti <dcaratti@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 67ff2c7 commit add641e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

net/sched/act_csum.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ static int tcf_csum_ipv4_tcp(struct sk_buff *skb, unsigned int ihl,
181181
struct tcphdr *tcph;
182182
const struct iphdr *iph;
183183

184+
if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)
185+
return 1;
186+
184187
tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph));
185188
if (tcph == NULL)
186189
return 0;
@@ -202,6 +205,9 @@ static int tcf_csum_ipv6_tcp(struct sk_buff *skb, unsigned int ihl,
202205
struct tcphdr *tcph;
203206
const struct ipv6hdr *ip6h;
204207

208+
if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)
209+
return 1;
210+
205211
tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph));
206212
if (tcph == NULL)
207213
return 0;
@@ -225,6 +231,9 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb, unsigned int ihl,
225231
const struct iphdr *iph;
226232
u16 ul;
227233

234+
if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_UDP)
235+
return 1;
236+
228237
/*
229238
* Support both UDP and UDPLITE checksum algorithms, Don't use
230239
* udph->len to get the real length without any protocol check,
@@ -278,6 +287,9 @@ static int tcf_csum_ipv6_udp(struct sk_buff *skb, unsigned int ihl,
278287
const struct ipv6hdr *ip6h;
279288
u16 ul;
280289

290+
if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_UDP)
291+
return 1;
292+
281293
/*
282294
* Support both UDP and UDPLITE checksum algorithms, Don't use
283295
* udph->len to get the real length without any protocol check,

0 commit comments

Comments
 (0)