Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "af_packet: add interframe drop cmsg (v6)"

This reverts commit 977750076d98c7ff6cbda51858bb5a5894a9d9ab.

Neil is reimplementing this generically, outside of AF_PACKET.

Signed-off-by: David S. Miller <davem@davemloft.net>

-35
-2
include/linux/if_packet.h
··· 48 48 #define PACKET_RESERVE 12 49 49 #define PACKET_TX_RING 13 50 50 #define PACKET_LOSS 14 51 - #define PACKET_GAPDATA 15 52 51 53 52 struct tpacket_stats 54 53 { 55 54 unsigned int tp_packets; 56 55 unsigned int tp_drops; 57 - unsigned int tp_gap; 58 56 }; 59 57 60 58 struct tpacket_auxdata
-33
net/packet/af_packet.c
··· 525 525 } 526 526 527 527 /* 528 - * If we've lost frames since the last time we queued one to the 529 - * sk_receive_queue, we need to record it here. 530 - * This must be called under the protection of the socket lock 531 - * to prevent racing with other softirqs and user space 532 - */ 533 - static inline void record_packet_gap(struct sk_buff *skb, 534 - struct packet_sock *po) 535 - { 536 - /* 537 - * We overload the mark field here, since we're about 538 - * to enqueue to a receive queue and no body else will 539 - * use this field at this point 540 - */ 541 - skb->mark = po->stats.tp_gap; 542 - po->stats.tp_gap = 0; 543 - return; 544 - 545 - } 546 - 547 - static inline __u32 check_packet_gap(struct sk_buff *skb) 548 - { 549 - return skb->mark; 550 - } 551 - 552 - /* 553 528 This function makes lazy skb cloning in hope that most of packets 554 529 are discarded by BPF. 555 530 ··· 627 652 628 653 spin_lock(&sk->sk_receive_queue.lock); 629 654 po->stats.tp_packets++; 630 - record_packet_gap(skb, po); 631 655 __skb_queue_tail(&sk->sk_receive_queue, skb); 632 656 spin_unlock(&sk->sk_receive_queue.lock); 633 657 sk->sk_data_ready(sk, skb->len); ··· 635 661 drop_n_acct: 636 662 spin_lock(&sk->sk_receive_queue.lock); 637 663 po->stats.tp_drops++; 638 - po->stats.tp_gap++; 639 664 spin_unlock(&sk->sk_receive_queue.lock); 640 665 641 666 drop_n_restore: ··· 812 839 813 840 ring_is_full: 814 841 po->stats.tp_drops++; 815 - po->stats.tp_gap++; 816 842 spin_unlock(&sk->sk_receive_queue.lock); 817 843 818 844 sk->sk_data_ready(sk, 0); ··· 1421 1449 struct sk_buff *skb; 1422 1450 int copied, err; 1423 1451 struct sockaddr_ll *sll; 1424 - __u32 gap; 1425 1452 1426 1453 err = -EINVAL; 1427 1454 if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT)) ··· 1498 1527 1499 1528 put_cmsg(msg, SOL_PACKET, PACKET_AUXDATA, sizeof(aux), &aux); 1500 1529 } 1501 - 1502 - gap = check_packet_gap(skb); 1503 - if (gap) 1504 - put_cmsg(msg, SOL_PACKET, PACKET_GAPDATA, sizeof(__u32), &gap); 1505 1530 1506 1531 /* 1507 1532 * Free or return the buffer as appropriate. Again this