diff options
author | chetan loke <loke.chetan@gmail.com> | 2011-08-25 06:43:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-08-26 12:38:44 -0400 |
commit | bc59ba399113fcbcac56ba22edde4b816199d48c (patch) | |
tree | 16c9023b050de412a934008b99eb8c2cf3464be1 | |
parent | 165c68d5a291537eaf2d3821a19335c9ec100ba6 (diff) |
af_packet: Prefixed tpacket_v3 structs to avoid name space collision
structs introduced in tpacket_v3 implementation are prefixed with 'tpacket'
to avoid namespace collision.
Compile tested.
Signed-off-by: Chetan Loke <loke.chetan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/if_packet.h | 18 | ||||
-rw-r--r-- | net/packet/af_packet.c | 117 |
2 files changed, 71 insertions, 64 deletions
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h index 5926d59c4295..5e76988f8ffc 100644 --- a/include/linux/if_packet.h +++ b/include/linux/if_packet.h | |||
@@ -126,7 +126,7 @@ struct tpacket2_hdr { | |||
126 | __u16 tp_padding; | 126 | __u16 tp_padding; |
127 | }; | 127 | }; |
128 | 128 | ||
129 | struct hdr_variant1 { | 129 | struct tpacket_hdr_variant1 { |
130 | __u32 tp_rxhash; | 130 | __u32 tp_rxhash; |
131 | __u32 tp_vlan_tci; | 131 | __u32 tp_vlan_tci; |
132 | }; | 132 | }; |
@@ -142,11 +142,11 @@ struct tpacket3_hdr { | |||
142 | __u16 tp_net; | 142 | __u16 tp_net; |
143 | /* pkt_hdr variants */ | 143 | /* pkt_hdr variants */ |
144 | union { | 144 | union { |
145 | struct hdr_variant1 hv1; | 145 | struct tpacket_hdr_variant1 hv1; |
146 | }; | 146 | }; |
147 | }; | 147 | }; |
148 | 148 | ||
149 | struct bd_ts { | 149 | struct tpacket_bd_ts { |
150 | unsigned int ts_sec; | 150 | unsigned int ts_sec; |
151 | union { | 151 | union { |
152 | unsigned int ts_usec; | 152 | unsigned int ts_usec; |
@@ -154,7 +154,7 @@ struct bd_ts { | |||
154 | }; | 154 | }; |
155 | }; | 155 | }; |
156 | 156 | ||
157 | struct hdr_v1 { | 157 | struct tpacket_hdr_v1 { |
158 | __u32 block_status; | 158 | __u32 block_status; |
159 | __u32 num_pkts; | 159 | __u32 num_pkts; |
160 | __u32 offset_to_first_pkt; | 160 | __u32 offset_to_first_pkt; |
@@ -200,17 +200,17 @@ struct hdr_v1 { | |||
200 | * Use the ts of the first packet in the block. | 200 | * Use the ts of the first packet in the block. |
201 | * | 201 | * |
202 | */ | 202 | */ |
203 | struct bd_ts ts_first_pkt, ts_last_pkt; | 203 | struct tpacket_bd_ts ts_first_pkt, ts_last_pkt; |
204 | }; | 204 | }; |
205 | 205 | ||
206 | union bd_header_u { | 206 | union tpacket_bd_header_u { |
207 | struct hdr_v1 bh1; | 207 | struct tpacket_hdr_v1 bh1; |
208 | }; | 208 | }; |
209 | 209 | ||
210 | struct block_desc { | 210 | struct tpacket_block_desc { |
211 | __u32 version; | 211 | __u32 version; |
212 | __u32 offset_to_priv; | 212 | __u32 offset_to_priv; |
213 | union bd_header_u hdr; | 213 | union tpacket_bd_header_u hdr; |
214 | }; | 214 | }; |
215 | 215 | ||
216 | #define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) | 216 | #define TPACKET2_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll)) |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 4371e3a67789..2ea3d63e1d4c 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -171,13 +171,13 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, | |||
171 | 171 | ||
172 | #define V3_ALIGNMENT (8) | 172 | #define V3_ALIGNMENT (8) |
173 | 173 | ||
174 | #define BLK_HDR_LEN (ALIGN(sizeof(struct block_desc), V3_ALIGNMENT)) | 174 | #define BLK_HDR_LEN (ALIGN(sizeof(struct tpacket_block_desc), V3_ALIGNMENT)) |
175 | 175 | ||
176 | #define BLK_PLUS_PRIV(sz_of_priv) \ | 176 | #define BLK_PLUS_PRIV(sz_of_priv) \ |
177 | (BLK_HDR_LEN + ALIGN((sz_of_priv), V3_ALIGNMENT)) | 177 | (BLK_HDR_LEN + ALIGN((sz_of_priv), V3_ALIGNMENT)) |
178 | 178 | ||
179 | /* kbdq - kernel block descriptor queue */ | 179 | /* kbdq - kernel block descriptor queue */ |
180 | struct kbdq_core { | 180 | struct tpacket_kbdq_core { |
181 | struct pgv *pkbdq; | 181 | struct pgv *pkbdq; |
182 | unsigned int feature_req_word; | 182 | unsigned int feature_req_word; |
183 | unsigned int hdrlen; | 183 | unsigned int hdrlen; |
@@ -230,7 +230,7 @@ struct packet_ring_buffer { | |||
230 | unsigned int pg_vec_pages; | 230 | unsigned int pg_vec_pages; |
231 | unsigned int pg_vec_len; | 231 | unsigned int pg_vec_len; |
232 | 232 | ||
233 | struct kbdq_core prb_bdqc; | 233 | struct tpacket_kbdq_core prb_bdqc; |
234 | atomic_t pending; | 234 | atomic_t pending; |
235 | }; | 235 | }; |
236 | 236 | ||
@@ -249,21 +249,25 @@ static void *packet_previous_frame(struct packet_sock *po, | |||
249 | struct packet_ring_buffer *rb, | 249 | struct packet_ring_buffer *rb, |
250 | int status); | 250 | int status); |
251 | static void packet_increment_head(struct packet_ring_buffer *buff); | 251 | static void packet_increment_head(struct packet_ring_buffer *buff); |
252 | static int prb_curr_blk_in_use(struct kbdq_core *, | 252 | static int prb_curr_blk_in_use(struct tpacket_kbdq_core *, |
253 | struct block_desc *); | 253 | struct tpacket_block_desc *); |
254 | static void *prb_dispatch_next_block(struct kbdq_core *, | 254 | static void *prb_dispatch_next_block(struct tpacket_kbdq_core *, |
255 | struct packet_sock *); | 255 | struct packet_sock *); |
256 | static void prb_retire_current_block(struct kbdq_core *, | 256 | static void prb_retire_current_block(struct tpacket_kbdq_core *, |
257 | struct packet_sock *, unsigned int status); | 257 | struct packet_sock *, unsigned int status); |
258 | static int prb_queue_frozen(struct kbdq_core *); | 258 | static int prb_queue_frozen(struct tpacket_kbdq_core *); |
259 | static void prb_open_block(struct kbdq_core *, struct block_desc *); | 259 | static void prb_open_block(struct tpacket_kbdq_core *, |
260 | struct tpacket_block_desc *); | ||
260 | static void prb_retire_rx_blk_timer_expired(unsigned long); | 261 | static void prb_retire_rx_blk_timer_expired(unsigned long); |
261 | static void _prb_refresh_rx_retire_blk_timer(struct kbdq_core *); | 262 | static void _prb_refresh_rx_retire_blk_timer(struct tpacket_kbdq_core *); |
262 | static void prb_init_blk_timer(struct packet_sock *, struct kbdq_core *, | 263 | static void prb_init_blk_timer(struct packet_sock *, |
263 | void (*func) (unsigned long)); | 264 | struct tpacket_kbdq_core *, |
264 | static void prb_fill_rxhash(struct kbdq_core *, struct tpacket3_hdr *); | 265 | void (*func) (unsigned long)); |
265 | static void prb_clear_rxhash(struct kbdq_core *, struct tpacket3_hdr *); | 266 | static void prb_fill_rxhash(struct tpacket_kbdq_core *, struct tpacket3_hdr *); |
266 | static void prb_fill_vlan_info(struct kbdq_core *, struct tpacket3_hdr *); | 267 | static void prb_clear_rxhash(struct tpacket_kbdq_core *, |
268 | struct tpacket3_hdr *); | ||
269 | static void prb_fill_vlan_info(struct tpacket_kbdq_core *, | ||
270 | struct tpacket3_hdr *); | ||
267 | static void packet_flush_mclist(struct sock *sk); | 271 | static void packet_flush_mclist(struct sock *sk); |
268 | 272 | ||
269 | struct packet_fanout; | 273 | struct packet_fanout; |
@@ -322,11 +326,11 @@ struct packet_skb_cb { | |||
322 | 326 | ||
323 | #define PACKET_SKB_CB(__skb) ((struct packet_skb_cb *)((__skb)->cb)) | 327 | #define PACKET_SKB_CB(__skb) ((struct packet_skb_cb *)((__skb)->cb)) |
324 | 328 | ||
325 | #define GET_PBDQC_FROM_RB(x) ((struct kbdq_core *)(&(x)->prb_bdqc)) | 329 | #define GET_PBDQC_FROM_RB(x) ((struct tpacket_kbdq_core *)(&(x)->prb_bdqc)) |
326 | #define GET_PBLOCK_DESC(x, bid) \ | 330 | #define GET_PBLOCK_DESC(x, bid) \ |
327 | ((struct block_desc *)((x)->pkbdq[(bid)].buffer)) | 331 | ((struct tpacket_block_desc *)((x)->pkbdq[(bid)].buffer)) |
328 | #define GET_CURR_PBLOCK_DESC_FROM_CORE(x) \ | 332 | #define GET_CURR_PBLOCK_DESC_FROM_CORE(x) \ |
329 | ((struct block_desc *)((x)->pkbdq[(x)->kactive_blk_num].buffer)) | 333 | ((struct tpacket_block_desc *)((x)->pkbdq[(x)->kactive_blk_num].buffer)) |
330 | #define GET_NEXT_PRB_BLK_NUM(x) \ | 334 | #define GET_NEXT_PRB_BLK_NUM(x) \ |
331 | (((x)->kactive_blk_num < ((x)->knum_blocks-1)) ? \ | 335 | (((x)->kactive_blk_num < ((x)->knum_blocks-1)) ? \ |
332 | ((x)->kactive_blk_num+1) : 0) | 336 | ((x)->kactive_blk_num+1) : 0) |
@@ -480,7 +484,7 @@ static inline void *packet_current_frame(struct packet_sock *po, | |||
480 | return packet_lookup_frame(po, rb, rb->head, status); | 484 | return packet_lookup_frame(po, rb, rb->head, status); |
481 | } | 485 | } |
482 | 486 | ||
483 | static void prb_del_retire_blk_timer(struct kbdq_core *pkc) | 487 | static void prb_del_retire_blk_timer(struct tpacket_kbdq_core *pkc) |
484 | { | 488 | { |
485 | del_timer_sync(&pkc->retire_blk_timer); | 489 | del_timer_sync(&pkc->retire_blk_timer); |
486 | } | 490 | } |
@@ -489,7 +493,7 @@ static void prb_shutdown_retire_blk_timer(struct packet_sock *po, | |||
489 | int tx_ring, | 493 | int tx_ring, |
490 | struct sk_buff_head *rb_queue) | 494 | struct sk_buff_head *rb_queue) |
491 | { | 495 | { |
492 | struct kbdq_core *pkc; | 496 | struct tpacket_kbdq_core *pkc; |
493 | 497 | ||
494 | pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc; | 498 | pkc = tx_ring ? &po->tx_ring.prb_bdqc : &po->rx_ring.prb_bdqc; |
495 | 499 | ||
@@ -501,7 +505,7 @@ static void prb_shutdown_retire_blk_timer(struct packet_sock *po, | |||
501 | } | 505 | } |
502 | 506 | ||
503 | static void prb_init_blk_timer(struct packet_sock *po, | 507 | static void prb_init_blk_timer(struct packet_sock *po, |
504 | struct kbdq_core *pkc, | 508 | struct tpacket_kbdq_core *pkc, |
505 | void (*func) (unsigned long)) | 509 | void (*func) (unsigned long)) |
506 | { | 510 | { |
507 | init_timer(&pkc->retire_blk_timer); | 511 | init_timer(&pkc->retire_blk_timer); |
@@ -512,7 +516,7 @@ static void prb_init_blk_timer(struct packet_sock *po, | |||
512 | 516 | ||
513 | static void prb_setup_retire_blk_timer(struct packet_sock *po, int tx_ring) | 517 | static void prb_setup_retire_blk_timer(struct packet_sock *po, int tx_ring) |
514 | { | 518 | { |
515 | struct kbdq_core *pkc; | 519 | struct tpacket_kbdq_core *pkc; |
516 | 520 | ||
517 | if (tx_ring) | 521 | if (tx_ring) |
518 | BUG(); | 522 | BUG(); |
@@ -568,7 +572,7 @@ static int prb_calc_retire_blk_tmo(struct packet_sock *po, | |||
568 | return tmo; | 572 | return tmo; |
569 | } | 573 | } |
570 | 574 | ||
571 | static void prb_init_ft_ops(struct kbdq_core *p1, | 575 | static void prb_init_ft_ops(struct tpacket_kbdq_core *p1, |
572 | union tpacket_req_u *req_u) | 576 | union tpacket_req_u *req_u) |
573 | { | 577 | { |
574 | p1->feature_req_word = req_u->req3.tp_feature_req_word; | 578 | p1->feature_req_word = req_u->req3.tp_feature_req_word; |
@@ -579,14 +583,14 @@ static void init_prb_bdqc(struct packet_sock *po, | |||
579 | struct pgv *pg_vec, | 583 | struct pgv *pg_vec, |
580 | union tpacket_req_u *req_u, int tx_ring) | 584 | union tpacket_req_u *req_u, int tx_ring) |
581 | { | 585 | { |
582 | struct kbdq_core *p1 = &rb->prb_bdqc; | 586 | struct tpacket_kbdq_core *p1 = &rb->prb_bdqc; |
583 | struct block_desc *pbd; | 587 | struct tpacket_block_desc *pbd; |
584 | 588 | ||
585 | memset(p1, 0x0, sizeof(*p1)); | 589 | memset(p1, 0x0, sizeof(*p1)); |
586 | 590 | ||
587 | p1->knxt_seq_num = 1; | 591 | p1->knxt_seq_num = 1; |
588 | p1->pkbdq = pg_vec; | 592 | p1->pkbdq = pg_vec; |
589 | pbd = (struct block_desc *)pg_vec[0].buffer; | 593 | pbd = (struct tpacket_block_desc *)pg_vec[0].buffer; |
590 | p1->pkblk_start = (char *)pg_vec[0].buffer; | 594 | p1->pkblk_start = (char *)pg_vec[0].buffer; |
591 | p1->kblk_size = req_u->req3.tp_block_size; | 595 | p1->kblk_size = req_u->req3.tp_block_size; |
592 | p1->knum_blocks = req_u->req3.tp_block_nr; | 596 | p1->knum_blocks = req_u->req3.tp_block_nr; |
@@ -610,7 +614,7 @@ static void init_prb_bdqc(struct packet_sock *po, | |||
610 | /* Do NOT update the last_blk_num first. | 614 | /* Do NOT update the last_blk_num first. |
611 | * Assumes sk_buff_head lock is held. | 615 | * Assumes sk_buff_head lock is held. |
612 | */ | 616 | */ |
613 | static void _prb_refresh_rx_retire_blk_timer(struct kbdq_core *pkc) | 617 | static void _prb_refresh_rx_retire_blk_timer(struct tpacket_kbdq_core *pkc) |
614 | { | 618 | { |
615 | mod_timer(&pkc->retire_blk_timer, | 619 | mod_timer(&pkc->retire_blk_timer, |
616 | jiffies + pkc->tov_in_jiffies); | 620 | jiffies + pkc->tov_in_jiffies); |
@@ -643,9 +647,9 @@ static void _prb_refresh_rx_retire_blk_timer(struct kbdq_core *pkc) | |||
643 | static void prb_retire_rx_blk_timer_expired(unsigned long data) | 647 | static void prb_retire_rx_blk_timer_expired(unsigned long data) |
644 | { | 648 | { |
645 | struct packet_sock *po = (struct packet_sock *)data; | 649 | struct packet_sock *po = (struct packet_sock *)data; |
646 | struct kbdq_core *pkc = &po->rx_ring.prb_bdqc; | 650 | struct tpacket_kbdq_core *pkc = &po->rx_ring.prb_bdqc; |
647 | unsigned int frozen; | 651 | unsigned int frozen; |
648 | struct block_desc *pbd; | 652 | struct tpacket_block_desc *pbd; |
649 | 653 | ||
650 | spin_lock(&po->sk.sk_receive_queue.lock); | 654 | spin_lock(&po->sk.sk_receive_queue.lock); |
651 | 655 | ||
@@ -709,8 +713,8 @@ out: | |||
709 | spin_unlock(&po->sk.sk_receive_queue.lock); | 713 | spin_unlock(&po->sk.sk_receive_queue.lock); |
710 | } | 714 | } |
711 | 715 | ||
712 | static inline void prb_flush_block(struct kbdq_core *pkc1, | 716 | static inline void prb_flush_block(struct tpacket_kbdq_core *pkc1, |
713 | struct block_desc *pbd1, __u32 status) | 717 | struct tpacket_block_desc *pbd1, __u32 status) |
714 | { | 718 | { |
715 | /* Flush everything minus the block header */ | 719 | /* Flush everything minus the block header */ |
716 | 720 | ||
@@ -752,13 +756,14 @@ static inline void prb_flush_block(struct kbdq_core *pkc1, | |||
752 | * Note:We DONT refresh the timer on purpose. | 756 | * Note:We DONT refresh the timer on purpose. |
753 | * Because almost always the next block will be opened. | 757 | * Because almost always the next block will be opened. |
754 | */ | 758 | */ |
755 | static void prb_close_block(struct kbdq_core *pkc1, struct block_desc *pbd1, | 759 | static void prb_close_block(struct tpacket_kbdq_core *pkc1, |
760 | struct tpacket_block_desc *pbd1, | ||
756 | struct packet_sock *po, unsigned int stat) | 761 | struct packet_sock *po, unsigned int stat) |
757 | { | 762 | { |
758 | __u32 status = TP_STATUS_USER | stat; | 763 | __u32 status = TP_STATUS_USER | stat; |
759 | 764 | ||
760 | struct tpacket3_hdr *last_pkt; | 765 | struct tpacket3_hdr *last_pkt; |
761 | struct hdr_v1 *h1 = &pbd1->hdr.bh1; | 766 | struct tpacket_hdr_v1 *h1 = &pbd1->hdr.bh1; |
762 | 767 | ||
763 | if (po->stats.tp_drops) | 768 | if (po->stats.tp_drops) |
764 | status |= TP_STATUS_LOSING; | 769 | status |= TP_STATUS_LOSING; |
@@ -786,7 +791,7 @@ static void prb_close_block(struct kbdq_core *pkc1, struct block_desc *pbd1, | |||
786 | pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1); | 791 | pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1); |
787 | } | 792 | } |
788 | 793 | ||
789 | static inline void prb_thaw_queue(struct kbdq_core *pkc) | 794 | static inline void prb_thaw_queue(struct tpacket_kbdq_core *pkc) |
790 | { | 795 | { |
791 | pkc->reset_pending_on_curr_blk = 0; | 796 | pkc->reset_pending_on_curr_blk = 0; |
792 | } | 797 | } |
@@ -798,10 +803,11 @@ static inline void prb_thaw_queue(struct kbdq_core *pkc) | |||
798 | * 2) retire_blk_timer is refreshed. | 803 | * 2) retire_blk_timer is refreshed. |
799 | * | 804 | * |
800 | */ | 805 | */ |
801 | static void prb_open_block(struct kbdq_core *pkc1, struct block_desc *pbd1) | 806 | static void prb_open_block(struct tpacket_kbdq_core *pkc1, |
807 | struct tpacket_block_desc *pbd1) | ||
802 | { | 808 | { |
803 | struct timespec ts; | 809 | struct timespec ts; |
804 | struct hdr_v1 *h1 = &pbd1->hdr.bh1; | 810 | struct tpacket_hdr_v1 *h1 = &pbd1->hdr.bh1; |
805 | 811 | ||
806 | smp_rmb(); | 812 | smp_rmb(); |
807 | 813 | ||
@@ -861,7 +867,7 @@ static void prb_open_block(struct kbdq_core *pkc1, struct block_desc *pbd1) | |||
861 | * case and __packet_lookup_frame_in_block will check if block-0 | 867 | * case and __packet_lookup_frame_in_block will check if block-0 |
862 | * is free and can now be re-used. | 868 | * is free and can now be re-used. |
863 | */ | 869 | */ |
864 | static inline void prb_freeze_queue(struct kbdq_core *pkc, | 870 | static inline void prb_freeze_queue(struct tpacket_kbdq_core *pkc, |
865 | struct packet_sock *po) | 871 | struct packet_sock *po) |
866 | { | 872 | { |
867 | pkc->reset_pending_on_curr_blk = 1; | 873 | pkc->reset_pending_on_curr_blk = 1; |
@@ -876,10 +882,10 @@ static inline void prb_freeze_queue(struct kbdq_core *pkc, | |||
876 | * Else, we will freeze the queue. | 882 | * Else, we will freeze the queue. |
877 | * So, caller must check the return value. | 883 | * So, caller must check the return value. |
878 | */ | 884 | */ |
879 | static void *prb_dispatch_next_block(struct kbdq_core *pkc, | 885 | static void *prb_dispatch_next_block(struct tpacket_kbdq_core *pkc, |
880 | struct packet_sock *po) | 886 | struct packet_sock *po) |
881 | { | 887 | { |
882 | struct block_desc *pbd; | 888 | struct tpacket_block_desc *pbd; |
883 | 889 | ||
884 | smp_rmb(); | 890 | smp_rmb(); |
885 | 891 | ||
@@ -901,10 +907,10 @@ static void *prb_dispatch_next_block(struct kbdq_core *pkc, | |||
901 | return (void *)pkc->nxt_offset; | 907 | return (void *)pkc->nxt_offset; |
902 | } | 908 | } |
903 | 909 | ||
904 | static void prb_retire_current_block(struct kbdq_core *pkc, | 910 | static void prb_retire_current_block(struct tpacket_kbdq_core *pkc, |
905 | struct packet_sock *po, unsigned int status) | 911 | struct packet_sock *po, unsigned int status) |
906 | { | 912 | { |
907 | struct block_desc *pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc); | 913 | struct tpacket_block_desc *pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc); |
908 | 914 | ||
909 | /* retire/close the current block */ | 915 | /* retire/close the current block */ |
910 | if (likely(TP_STATUS_KERNEL == BLOCK_STATUS(pbd))) { | 916 | if (likely(TP_STATUS_KERNEL == BLOCK_STATUS(pbd))) { |
@@ -932,36 +938,36 @@ static void prb_retire_current_block(struct kbdq_core *pkc, | |||
932 | BUG(); | 938 | BUG(); |
933 | } | 939 | } |
934 | 940 | ||
935 | static inline int prb_curr_blk_in_use(struct kbdq_core *pkc, | 941 | static inline int prb_curr_blk_in_use(struct tpacket_kbdq_core *pkc, |
936 | struct block_desc *pbd) | 942 | struct tpacket_block_desc *pbd) |
937 | { | 943 | { |
938 | return TP_STATUS_USER & BLOCK_STATUS(pbd); | 944 | return TP_STATUS_USER & BLOCK_STATUS(pbd); |
939 | } | 945 | } |
940 | 946 | ||
941 | static inline int prb_queue_frozen(struct kbdq_core *pkc) | 947 | static inline int prb_queue_frozen(struct tpacket_kbdq_core *pkc) |
942 | { | 948 | { |
943 | return pkc->reset_pending_on_curr_blk; | 949 | return pkc->reset_pending_on_curr_blk; |
944 | } | 950 | } |
945 | 951 | ||
946 | static inline void prb_clear_blk_fill_status(struct packet_ring_buffer *rb) | 952 | static inline void prb_clear_blk_fill_status(struct packet_ring_buffer *rb) |
947 | { | 953 | { |
948 | struct kbdq_core *pkc = GET_PBDQC_FROM_RB(rb); | 954 | struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(rb); |
949 | atomic_dec(&pkc->blk_fill_in_prog); | 955 | atomic_dec(&pkc->blk_fill_in_prog); |
950 | } | 956 | } |
951 | 957 | ||
952 | static inline void prb_fill_rxhash(struct kbdq_core *pkc, | 958 | static inline void prb_fill_rxhash(struct tpacket_kbdq_core *pkc, |
953 | struct tpacket3_hdr *ppd) | 959 | struct tpacket3_hdr *ppd) |
954 | { | 960 | { |
955 | ppd->hv1.tp_rxhash = skb_get_rxhash(pkc->skb); | 961 | ppd->hv1.tp_rxhash = skb_get_rxhash(pkc->skb); |
956 | } | 962 | } |
957 | 963 | ||
958 | static inline void prb_clear_rxhash(struct kbdq_core *pkc, | 964 | static inline void prb_clear_rxhash(struct tpacket_kbdq_core *pkc, |
959 | struct tpacket3_hdr *ppd) | 965 | struct tpacket3_hdr *ppd) |
960 | { | 966 | { |
961 | ppd->hv1.tp_rxhash = 0; | 967 | ppd->hv1.tp_rxhash = 0; |
962 | } | 968 | } |
963 | 969 | ||
964 | static inline void prb_fill_vlan_info(struct kbdq_core *pkc, | 970 | static inline void prb_fill_vlan_info(struct tpacket_kbdq_core *pkc, |
965 | struct tpacket3_hdr *ppd) | 971 | struct tpacket3_hdr *ppd) |
966 | { | 972 | { |
967 | if (vlan_tx_tag_present(pkc->skb)) { | 973 | if (vlan_tx_tag_present(pkc->skb)) { |
@@ -972,7 +978,7 @@ static inline void prb_fill_vlan_info(struct kbdq_core *pkc, | |||
972 | } | 978 | } |
973 | } | 979 | } |
974 | 980 | ||
975 | static void prb_run_all_ft_ops(struct kbdq_core *pkc, | 981 | static void prb_run_all_ft_ops(struct tpacket_kbdq_core *pkc, |
976 | struct tpacket3_hdr *ppd) | 982 | struct tpacket3_hdr *ppd) |
977 | { | 983 | { |
978 | prb_fill_vlan_info(pkc, ppd); | 984 | prb_fill_vlan_info(pkc, ppd); |
@@ -983,8 +989,9 @@ static void prb_run_all_ft_ops(struct kbdq_core *pkc, | |||
983 | prb_clear_rxhash(pkc, ppd); | 989 | prb_clear_rxhash(pkc, ppd); |
984 | } | 990 | } |
985 | 991 | ||
986 | static inline void prb_fill_curr_block(char *curr, struct kbdq_core *pkc, | 992 | static inline void prb_fill_curr_block(char *curr, |
987 | struct block_desc *pbd, | 993 | struct tpacket_kbdq_core *pkc, |
994 | struct tpacket_block_desc *pbd, | ||
988 | unsigned int len) | 995 | unsigned int len) |
989 | { | 996 | { |
990 | struct tpacket3_hdr *ppd; | 997 | struct tpacket3_hdr *ppd; |
@@ -1006,8 +1013,8 @@ static void *__packet_lookup_frame_in_block(struct packet_sock *po, | |||
1006 | unsigned int len | 1013 | unsigned int len |
1007 | ) | 1014 | ) |
1008 | { | 1015 | { |
1009 | struct kbdq_core *pkc; | 1016 | struct tpacket_kbdq_core *pkc; |
1010 | struct block_desc *pbd; | 1017 | struct tpacket_block_desc *pbd; |
1011 | char *curr, *end; | 1018 | char *curr, *end; |
1012 | 1019 | ||
1013 | pkc = GET_PBDQC_FROM_RB(((struct packet_ring_buffer *)&po->rx_ring)); | 1020 | pkc = GET_PBDQC_FROM_RB(((struct packet_ring_buffer *)&po->rx_ring)); |
@@ -1087,8 +1094,8 @@ static inline void *prb_lookup_block(struct packet_sock *po, | |||
1087 | unsigned int previous, | 1094 | unsigned int previous, |
1088 | int status) | 1095 | int status) |
1089 | { | 1096 | { |
1090 | struct kbdq_core *pkc = GET_PBDQC_FROM_RB(rb); | 1097 | struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(rb); |
1091 | struct block_desc *pbd = GET_PBLOCK_DESC(pkc, previous); | 1098 | struct tpacket_block_desc *pbd = GET_PBLOCK_DESC(pkc, previous); |
1092 | 1099 | ||
1093 | if (status != BLOCK_STATUS(pbd)) | 1100 | if (status != BLOCK_STATUS(pbd)) |
1094 | return NULL; | 1101 | return NULL; |