@@ -266,40 +266,46 @@ struct sk_buff *tcp_gro_lookup(struct list_head *head, struct tcphdr *th)
266
266
return NULL ;
267
267
}
268
268
269
- struct sk_buff * tcp_gro_receive ( struct list_head * head , struct sk_buff * skb )
269
+ struct tcphdr * tcp_gro_pull_header ( struct sk_buff * skb )
270
270
{
271
- struct sk_buff * pp = NULL ;
272
- struct sk_buff * p ;
271
+ unsigned int thlen , hlen , off ;
273
272
struct tcphdr * th ;
274
- struct tcphdr * th2 ;
275
- unsigned int len ;
276
- unsigned int thlen ;
277
- __be32 flags ;
278
- unsigned int mss = 1 ;
279
- unsigned int hlen ;
280
- unsigned int off ;
281
- int flush = 1 ;
282
- int i ;
283
273
284
274
off = skb_gro_offset (skb );
285
275
hlen = off + sizeof (* th );
286
276
th = skb_gro_header (skb , hlen , off );
287
277
if (unlikely (!th ))
288
- goto out ;
278
+ return NULL ;
289
279
290
280
thlen = th -> doff * 4 ;
291
281
if (thlen < sizeof (* th ))
292
- goto out ;
282
+ return NULL ;
293
283
294
284
hlen = off + thlen ;
295
285
if (!skb_gro_may_pull (skb , hlen )) {
296
286
th = skb_gro_header_slow (skb , hlen , off );
297
287
if (unlikely (!th ))
298
- goto out ;
288
+ return NULL ;
299
289
}
300
290
301
291
skb_gro_pull (skb , thlen );
302
292
293
+ return th ;
294
+ }
295
+
296
+ struct sk_buff * tcp_gro_receive (struct list_head * head , struct sk_buff * skb ,
297
+ struct tcphdr * th )
298
+ {
299
+ unsigned int thlen = th -> doff * 4 ;
300
+ struct sk_buff * pp = NULL ;
301
+ struct sk_buff * p ;
302
+ struct tcphdr * th2 ;
303
+ unsigned int len ;
304
+ __be32 flags ;
305
+ unsigned int mss = 1 ;
306
+ int flush = 1 ;
307
+ int i ;
308
+
303
309
len = skb_gro_len (skb );
304
310
flags = tcp_flag_word (th );
305
311
@@ -376,7 +382,6 @@ struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb)
376
382
if (p && (!NAPI_GRO_CB (skb )-> same_flow || flush ))
377
383
pp = p ;
378
384
379
- out :
380
385
NAPI_GRO_CB (skb )-> flush |= (flush != 0 );
381
386
382
387
return pp ;
@@ -405,15 +410,23 @@ EXPORT_SYMBOL(tcp_gro_complete);
405
410
INDIRECT_CALLABLE_SCOPE
406
411
struct sk_buff * tcp4_gro_receive (struct list_head * head , struct sk_buff * skb )
407
412
{
413
+ struct tcphdr * th ;
414
+
408
415
/* Don't bother verifying checksum if we're going to flush anyway. */
409
416
if (!NAPI_GRO_CB (skb )-> flush &&
410
417
skb_gro_checksum_validate (skb , IPPROTO_TCP ,
411
- inet_gro_compute_pseudo )) {
412
- NAPI_GRO_CB (skb )-> flush = 1 ;
413
- return NULL ;
414
- }
418
+ inet_gro_compute_pseudo ))
419
+ goto flush ;
420
+
421
+ th = tcp_gro_pull_header (skb );
422
+ if (!th )
423
+ goto flush ;
415
424
416
- return tcp_gro_receive (head , skb );
425
+ return tcp_gro_receive (head , skb , th );
426
+
427
+ flush :
428
+ NAPI_GRO_CB (skb )-> flush = 1 ;
429
+ return NULL ;
417
430
}
418
431
419
432
INDIRECT_CALLABLE_SCOPE int tcp4_gro_complete (struct sk_buff * skb , int thoff )
0 commit comments