Lines Matching refs:po
207 static inline unsigned long packet_lookup_frame(struct packet_opt *po, unsigned int position) in packet_lookup_frame() argument
212 pg_vec_pos = position / po->frames_per_block; in packet_lookup_frame()
213 frame_offset = position % po->frames_per_block; in packet_lookup_frame()
215 frame = (unsigned long) (po->pg_vec[pg_vec_pos] + (frame_offset * po->frame_size)); in packet_lookup_frame()
426 struct packet_opt *po; in packet_rcv() local
437 po = sk->protinfo.af_packet; in packet_rcv()
511 po->stats.tp_packets++; in packet_rcv()
519 po->stats.tp_drops++; in packet_rcv()
538 struct packet_opt *po; in tpacket_rcv() local
552 po = sk->protinfo.af_packet; in tpacket_rcv()
592 if (macoff + snaplen > po->frame_size) { in tpacket_rcv()
593 if (po->copy_thresh && in tpacket_rcv()
604 snaplen = po->frame_size - macoff; in tpacket_rcv()
612 h = (struct tpacket_hdr *)packet_lookup_frame(po, po->head); in tpacket_rcv()
616 po->head = po->head != po->frame_max ? po->head+1 : 0; in tpacket_rcv()
617 po->stats.tp_packets++; in tpacket_rcv()
622 if (!po->stats.tp_drops) in tpacket_rcv()
672 po->stats.tp_drops++; in tpacket_rcv()
1392 struct packet_opt *po; in packet_notifier() local
1397 po = sk->protinfo.af_packet; in packet_notifier()
1402 if (po->mclist) in packet_notifier()
1403 packet_dev_mclist(dev, po->mclist, -1); in packet_notifier()
1407 if (dev->ifindex == po->ifindex) { in packet_notifier()
1408 spin_lock(&po->bind_lock); in packet_notifier()
1409 if (po->running) { in packet_notifier()
1410 dev_remove_pack(&po->prot_hook); in packet_notifier()
1412 po->running = 0; in packet_notifier()
1418 po->ifindex = -1; in packet_notifier()
1419 po->prot_hook.dev = NULL; in packet_notifier()
1421 spin_unlock(&po->bind_lock); in packet_notifier()
1425 spin_lock(&po->bind_lock); in packet_notifier()
1426 if (dev->ifindex == po->ifindex && sk->num && po->running==0) { in packet_notifier()
1427 dev_add_pack(&po->prot_hook); in packet_notifier()
1429 po->running = 1; in packet_notifier()
1431 spin_unlock(&po->bind_lock); in packet_notifier()
1573 struct packet_opt *po = sk->protinfo.af_packet; in packet_poll() local
1577 if (po->pg_vec) { in packet_poll()
1578 unsigned last = po->head ? po->head-1 : po->frame_max; in packet_poll()
1581 h = (struct tpacket_hdr *)packet_lookup_frame(po, last); in packet_poll()
1643 struct packet_opt *po = sk->protinfo.af_packet; in packet_set_ring() local
1652 if (po->pg_vec) in packet_set_ring()
1664 po->frames_per_block = req->tp_block_size/req->tp_frame_size; in packet_set_ring()
1665 if (po->frames_per_block <= 0) in packet_set_ring()
1667 if (po->frames_per_block*req->tp_block_nr != req->tp_frame_nr) in packet_set_ring()
1700 for (k=0; k<po->frames_per_block; k++) { in packet_set_ring()
1716 spin_lock(&po->bind_lock); in packet_set_ring()
1717 if (po->running) in packet_set_ring()
1718 dev_remove_pack(&po->prot_hook); in packet_set_ring()
1719 spin_unlock(&po->bind_lock); in packet_set_ring()
1722 if (closing || atomic_read(&po->mapped) == 0) { in packet_set_ring()
1727 pg_vec = XC(po->pg_vec, pg_vec); in packet_set_ring()
1728 po->frame_max = req->tp_frame_nr-1; in packet_set_ring()
1729 po->head = 0; in packet_set_ring()
1730 po->frame_size = req->tp_frame_size; in packet_set_ring()
1733 order = XC(po->pg_vec_order, order); in packet_set_ring()
1734 req->tp_block_nr = XC(po->pg_vec_len, req->tp_block_nr); in packet_set_ring()
1736 po->pg_vec_pages = req->tp_block_size/PAGE_SIZE; in packet_set_ring()
1737 po->prot_hook.func = po->pg_vec ? tpacket_rcv : packet_rcv; in packet_set_ring()
1740 if (atomic_read(&po->mapped)) in packet_set_ring()
1741 printk(KERN_DEBUG "packet_mmap: vma is busy: %d\n", atomic_read(&po->mapped)); in packet_set_ring()
1744 spin_lock(&po->bind_lock); in packet_set_ring()
1745 if (po->running) in packet_set_ring()
1746 dev_add_pack(&po->prot_hook); in packet_set_ring()
1747 spin_unlock(&po->bind_lock); in packet_set_ring()
1761 struct packet_opt *po = sk->protinfo.af_packet; in packet_mmap() local
1773 if (po->pg_vec == NULL) in packet_mmap()
1775 if (size != po->pg_vec_len*po->pg_vec_pages*PAGE_SIZE) in packet_mmap()
1778 atomic_inc(&po->mapped); in packet_mmap()
1782 for (i=0; i<po->pg_vec_len; i++) { in packet_mmap()
1783 if (remap_page_range(start, __pa(po->pg_vec[i]), in packet_mmap()
1784 po->pg_vec_pages*PAGE_SIZE, in packet_mmap()
1787 start += po->pg_vec_pages*PAGE_SIZE; in packet_mmap()