aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-11-08 13:54:11 -0500
committerDavid S. Miller <davem@davemloft.net>2015-11-08 20:56:39 -0500
commit02a56c81cf33dea892da1f8a5231b0f7d7e714fe (patch)
treee85caa689941ca3b1eed3db4f44bec3cdebeb588 /net/sched
parent743b2a66744635b6d91e3d9da1fff29ad5ceb456 (diff)
net_sched: em_meta: use skb_to_full_sk() helper
SYNACK packets might be attached to request sockets. Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/em_meta.c138
1 files changed, 92 insertions, 46 deletions
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index b5294ce20cd4..f2aabc0089da 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -343,119 +343,145 @@ META_COLLECTOR(int_sk_refcnt)
343 343
344META_COLLECTOR(int_sk_rcvbuf) 344META_COLLECTOR(int_sk_rcvbuf)
345{ 345{
346 if (skip_nonlocal(skb)) { 346 const struct sock *sk = skb_to_full_sk(skb);
347
348 if (!sk) {
347 *err = -1; 349 *err = -1;
348 return; 350 return;
349 } 351 }
350 dst->value = skb->sk->sk_rcvbuf; 352 dst->value = sk->sk_rcvbuf;
351} 353}
352 354
353META_COLLECTOR(int_sk_shutdown) 355META_COLLECTOR(int_sk_shutdown)
354{ 356{
355 if (skip_nonlocal(skb)) { 357 const struct sock *sk = skb_to_full_sk(skb);
358
359 if (!sk) {
356 *err = -1; 360 *err = -1;
357 return; 361 return;
358 } 362 }
359 dst->value = skb->sk->sk_shutdown; 363 dst->value = sk->sk_shutdown;
360} 364}
361 365
362META_COLLECTOR(int_sk_proto) 366META_COLLECTOR(int_sk_proto)
363{ 367{
364 if (skip_nonlocal(skb)) { 368 const struct sock *sk = skb_to_full_sk(skb);
369
370 if (!sk) {
365 *err = -1; 371 *err = -1;
366 return; 372 return;
367 } 373 }
368 dst->value = skb->sk->sk_protocol; 374 dst->value = sk->sk_protocol;
369} 375}
370 376
371META_COLLECTOR(int_sk_type) 377META_COLLECTOR(int_sk_type)
372{ 378{
373 if (skip_nonlocal(skb)) { 379 const struct sock *sk = skb_to_full_sk(skb);
380
381 if (!sk) {
374 *err = -1; 382 *err = -1;
375 return; 383 return;
376 } 384 }
377 dst->value = skb->sk->sk_type; 385 dst->value = sk->sk_type;
378} 386}
379 387
380META_COLLECTOR(int_sk_rmem_alloc) 388META_COLLECTOR(int_sk_rmem_alloc)
381{ 389{
382 if (skip_nonlocal(skb)) { 390 const struct sock *sk = skb_to_full_sk(skb);
391
392 if (!sk) {
383 *err = -1; 393 *err = -1;
384 return; 394 return;
385 } 395 }
386 dst->value = sk_rmem_alloc_get(skb->sk); 396 dst->value = sk_rmem_alloc_get(sk);
387} 397}
388 398
389META_COLLECTOR(int_sk_wmem_alloc) 399META_COLLECTOR(int_sk_wmem_alloc)
390{ 400{
391 if (skip_nonlocal(skb)) { 401 const struct sock *sk = skb_to_full_sk(skb);
402
403 if (!sk) {
392 *err = -1; 404 *err = -1;
393 return; 405 return;
394 } 406 }
395 dst->value = sk_wmem_alloc_get(skb->sk); 407 dst->value = sk_wmem_alloc_get(sk);
396} 408}
397 409
398META_COLLECTOR(int_sk_omem_alloc) 410META_COLLECTOR(int_sk_omem_alloc)
399{ 411{
400 if (skip_nonlocal(skb)) { 412 const struct sock *sk = skb_to_full_sk(skb);
413
414 if (!sk) {
401 *err = -1; 415 *err = -1;
402 return; 416 return;
403 } 417 }
404 dst->value = atomic_read(&skb->sk->sk_omem_alloc); 418 dst->value = atomic_read(&sk->sk_omem_alloc);
405} 419}
406 420
407META_COLLECTOR(int_sk_rcv_qlen) 421META_COLLECTOR(int_sk_rcv_qlen)
408{ 422{
409 if (skip_nonlocal(skb)) { 423 const struct sock *sk = skb_to_full_sk(skb);
424
425 if (!sk) {
410 *err = -1; 426 *err = -1;
411 return; 427 return;
412 } 428 }
413 dst->value = skb->sk->sk_receive_queue.qlen; 429 dst->value = sk->sk_receive_queue.qlen;
414} 430}
415 431
416META_COLLECTOR(int_sk_snd_qlen) 432META_COLLECTOR(int_sk_snd_qlen)
417{ 433{
418 if (skip_nonlocal(skb)) { 434 const struct sock *sk = skb_to_full_sk(skb);
435
436 if (!sk) {
419 *err = -1; 437 *err = -1;
420 return; 438 return;
421 } 439 }
422 dst->value = skb->sk->sk_write_queue.qlen; 440 dst->value = sk->sk_write_queue.qlen;
423} 441}
424 442
425META_COLLECTOR(int_sk_wmem_queued) 443META_COLLECTOR(int_sk_wmem_queued)
426{ 444{
427 if (skip_nonlocal(skb)) { 445 const struct sock *sk = skb_to_full_sk(skb);
446
447 if (!sk) {
428 *err = -1; 448 *err = -1;
429 return; 449 return;
430 } 450 }
431 dst->value = skb->sk->sk_wmem_queued; 451 dst->value = sk->sk_wmem_queued;
432} 452}
433 453
434META_COLLECTOR(int_sk_fwd_alloc) 454META_COLLECTOR(int_sk_fwd_alloc)
435{ 455{
436 if (skip_nonlocal(skb)) { 456 const struct sock *sk = skb_to_full_sk(skb);
457
458 if (!sk) {
437 *err = -1; 459 *err = -1;
438 return; 460 return;
439 } 461 }
440 dst->value = skb->sk->sk_forward_alloc; 462 dst->value = sk->sk_forward_alloc;
441} 463}
442 464
443META_COLLECTOR(int_sk_sndbuf) 465META_COLLECTOR(int_sk_sndbuf)
444{ 466{
445 if (skip_nonlocal(skb)) { 467 const struct sock *sk = skb_to_full_sk(skb);
468
469 if (!sk) {
446 *err = -1; 470 *err = -1;
447 return; 471 return;
448 } 472 }
449 dst->value = skb->sk->sk_sndbuf; 473 dst->value = sk->sk_sndbuf;
450} 474}
451 475
452META_COLLECTOR(int_sk_alloc) 476META_COLLECTOR(int_sk_alloc)
453{ 477{
454 if (skip_nonlocal(skb)) { 478 const struct sock *sk = skb_to_full_sk(skb);
479
480 if (!sk) {
455 *err = -1; 481 *err = -1;
456 return; 482 return;
457 } 483 }
458 dst->value = (__force int) skb->sk->sk_allocation; 484 dst->value = (__force int) sk->sk_allocation;
459} 485}
460 486
461META_COLLECTOR(int_sk_hash) 487META_COLLECTOR(int_sk_hash)
@@ -469,92 +495,112 @@ META_COLLECTOR(int_sk_hash)
469 495
470META_COLLECTOR(int_sk_lingertime) 496META_COLLECTOR(int_sk_lingertime)
471{ 497{
472 if (skip_nonlocal(skb)) { 498 const struct sock *sk = skb_to_full_sk(skb);
499
500 if (!sk) {
473 *err = -1; 501 *err = -1;
474 return; 502 return;
475 } 503 }
476 dst->value = skb->sk->sk_lingertime / HZ; 504 dst->value = sk->sk_lingertime / HZ;
477} 505}
478 506
479META_COLLECTOR(int_sk_err_qlen) 507META_COLLECTOR(int_sk_err_qlen)
480{ 508{
481 if (skip_nonlocal(skb)) { 509 const struct sock *sk = skb_to_full_sk(skb);
510
511 if (!sk) {
482 *err = -1; 512 *err = -1;
483 return; 513 return;
484 } 514 }
485 dst->value = skb->sk->sk_error_queue.qlen; 515 dst->value = sk->sk_error_queue.qlen;
486} 516}
487 517
488META_COLLECTOR(int_sk_ack_bl) 518META_COLLECTOR(int_sk_ack_bl)
489{ 519{
490 if (skip_nonlocal(skb)) { 520 const struct sock *sk = skb_to_full_sk(skb);
521
522 if (!sk) {
491 *err = -1; 523 *err = -1;
492 return; 524 return;
493 } 525 }
494 dst->value = skb->sk->sk_ack_backlog; 526 dst->value = sk->sk_ack_backlog;
495} 527}
496 528
497META_COLLECTOR(int_sk_max_ack_bl) 529META_COLLECTOR(int_sk_max_ack_bl)
498{ 530{
499 if (skip_nonlocal(skb)) { 531 const struct sock *sk = skb_to_full_sk(skb);
532
533 if (!sk) {
500 *err = -1; 534 *err = -1;
501 return; 535 return;
502 } 536 }
503 dst->value = skb->sk->sk_max_ack_backlog; 537 dst->value = sk->sk_max_ack_backlog;
504} 538}
505 539
506META_COLLECTOR(int_sk_prio) 540META_COLLECTOR(int_sk_prio)
507{ 541{
508 if (skip_nonlocal(skb)) { 542 const struct sock *sk = skb_to_full_sk(skb);
543
544 if (!sk) {
509 *err = -1; 545 *err = -1;
510 return; 546 return;
511 } 547 }
512 dst->value = skb->sk->sk_priority; 548 dst->value = sk->sk_priority;
513} 549}
514 550
515META_COLLECTOR(int_sk_rcvlowat) 551META_COLLECTOR(int_sk_rcvlowat)
516{ 552{
517 if (skip_nonlocal(skb)) { 553 const struct sock *sk = skb_to_full_sk(skb);
554
555 if (!sk) {
518 *err = -1; 556 *err = -1;
519 return; 557 return;
520 } 558 }
521 dst->value = skb->sk->sk_rcvlowat; 559 dst->value = sk->sk_rcvlowat;
522} 560}
523 561
524META_COLLECTOR(int_sk_rcvtimeo) 562META_COLLECTOR(int_sk_rcvtimeo)
525{ 563{
526 if (skip_nonlocal(skb)) { 564 const struct sock *sk = skb_to_full_sk(skb);
565
566 if (!sk) {
527 *err = -1; 567 *err = -1;
528 return; 568 return;
529 } 569 }
530 dst->value = skb->sk->sk_rcvtimeo / HZ; 570 dst->value = sk->sk_rcvtimeo / HZ;
531} 571}
532 572
533META_COLLECTOR(int_sk_sndtimeo) 573META_COLLECTOR(int_sk_sndtimeo)
534{ 574{
535 if (skip_nonlocal(skb)) { 575 const struct sock *sk = skb_to_full_sk(skb);
576
577 if (!sk) {
536 *err = -1; 578 *err = -1;
537 return; 579 return;
538 } 580 }
539 dst->value = skb->sk->sk_sndtimeo / HZ; 581 dst->value = sk->sk_sndtimeo / HZ;
540} 582}
541 583
542META_COLLECTOR(int_sk_sendmsg_off) 584META_COLLECTOR(int_sk_sendmsg_off)
543{ 585{
544 if (skip_nonlocal(skb)) { 586 const struct sock *sk = skb_to_full_sk(skb);
587
588 if (!sk) {
545 *err = -1; 589 *err = -1;
546 return; 590 return;
547 } 591 }
548 dst->value = skb->sk->sk_frag.offset; 592 dst->value = sk->sk_frag.offset;
549} 593}
550 594
551META_COLLECTOR(int_sk_write_pend) 595META_COLLECTOR(int_sk_write_pend)
552{ 596{
553 if (skip_nonlocal(skb)) { 597 const struct sock *sk = skb_to_full_sk(skb);
598
599 if (!sk) {
554 *err = -1; 600 *err = -1;
555 return; 601 return;
556 } 602 }
557 dst->value = skb->sk->sk_write_pending; 603 dst->value = sk->sk_write_pending;
558} 604}
559 605
560/************************************************************************** 606/**************************************************************************