skbuff.h (2fe5de9ce7d57498abc14b375cad2fcf8c3ee6cc) | skbuff.h (60ff746739bf805a912484643c720b6124826140) |
---|---|
1/* 2 * Definitions for the 'struct sk_buff' memory handlers. 3 * 4 * Authors: 5 * Alan Cox, <gw4pts@gw4pts.ampr.org> 6 * Florian La Roche, <rzsfl@rz.uni-sb.de> 7 * 8 * This program is free software; you can redistribute it and/or --- 412 unchanged lines hidden (view full) --- 421 * @len: Length of actual data 422 * @data_len: Data length 423 * @mac_len: Length of link layer header 424 * @hdr_len: writable header length of cloned skb 425 * @csum: Checksum (must include start/offset pair) 426 * @csum_start: Offset from skb->head where checksumming should start 427 * @csum_offset: Offset from csum_start where checksum should be stored 428 * @priority: Packet queueing priority | 1/* 2 * Definitions for the 'struct sk_buff' memory handlers. 3 * 4 * Authors: 5 * Alan Cox, <gw4pts@gw4pts.ampr.org> 6 * Florian La Roche, <rzsfl@rz.uni-sb.de> 7 * 8 * This program is free software; you can redistribute it and/or --- 412 unchanged lines hidden (view full) --- 421 * @len: Length of actual data 422 * @data_len: Data length 423 * @mac_len: Length of link layer header 424 * @hdr_len: writable header length of cloned skb 425 * @csum: Checksum (must include start/offset pair) 426 * @csum_start: Offset from skb->head where checksumming should start 427 * @csum_offset: Offset from csum_start where checksum should be stored 428 * @priority: Packet queueing priority |
429 * @local_df: allow local fragmentation | 429 * @ignore_df: allow local fragmentation |
430 * @cloned: Head may be cloned (check refcnt to be sure) 431 * @ip_summed: Driver fed us an IP checksum 432 * @nohdr: Payload reference only, must not modify header 433 * @nfctinfo: Relationship of this skb to the connection 434 * @pkt_type: Packet class 435 * @fclone: skbuff clone status 436 * @ipvs_property: skbuff is owned by ipvs 437 * @peeked: this packet has been seen already, so stats have been --- 71 unchanged lines hidden (view full) --- 509 __wsum csum; 510 struct { 511 __u16 csum_start; 512 __u16 csum_offset; 513 }; 514 }; 515 __u32 priority; 516 kmemcheck_bitfield_begin(flags1); | 430 * @cloned: Head may be cloned (check refcnt to be sure) 431 * @ip_summed: Driver fed us an IP checksum 432 * @nohdr: Payload reference only, must not modify header 433 * @nfctinfo: Relationship of this skb to the connection 434 * @pkt_type: Packet class 435 * @fclone: skbuff clone status 436 * @ipvs_property: skbuff is owned by ipvs 437 * @peeked: this packet has been seen already, so stats have been --- 71 unchanged lines hidden (view full) --- 509 __wsum csum; 510 struct { 511 __u16 csum_start; 512 __u16 csum_offset; 513 }; 514 }; 515 __u32 priority; 516 kmemcheck_bitfield_begin(flags1); |
517 __u8 local_df:1, | 517 __u8 ignore_df:1, |
518 cloned:1, 519 ip_summed:2, 520 nohdr:1, 521 nfctinfo:3; 522 __u8 pkt_type:3, 523 fclone:2, 524 ipvs_property:1, 525 peeked:1, --- 2210 unchanged lines hidden (view full) --- 2736 * hardware has already verified the correctness of the checksum. 2737 */ 2738static inline __sum16 skb_checksum_complete(struct sk_buff *skb) 2739{ 2740 return skb_csum_unnecessary(skb) ? 2741 0 : __skb_checksum_complete(skb); 2742} 2743 | 518 cloned:1, 519 ip_summed:2, 520 nohdr:1, 521 nfctinfo:3; 522 __u8 pkt_type:3, 523 fclone:2, 524 ipvs_property:1, 525 peeked:1, --- 2210 unchanged lines hidden (view full) --- 2736 * hardware has already verified the correctness of the checksum. 2737 */ 2738static inline __sum16 skb_checksum_complete(struct sk_buff *skb) 2739{ 2740 return skb_csum_unnecessary(skb) ? 2741 0 : __skb_checksum_complete(skb); 2742} 2743 |
2744/* Check if we need to perform checksum complete validation. 2745 * 2746 * Returns true if checksum complete is needed, false otherwise 2747 * (either checksum is unnecessary or zero checksum is allowed). 2748 */ 2749static inline bool __skb_checksum_validate_needed(struct sk_buff *skb, 2750 bool zero_okay, 2751 __sum16 check) 2752{ 2753 if (skb_csum_unnecessary(skb)) { 2754 return false; 2755 } else if (zero_okay && !check) { 2756 skb->ip_summed = CHECKSUM_UNNECESSARY; 2757 return false; 2758 } 2759 2760 return true; 2761} 2762 2763/* For small packets <= CHECKSUM_BREAK peform checksum complete directly 2764 * in checksum_init. 2765 */ 2766#define CHECKSUM_BREAK 76 2767 2768/* Validate (init) checksum based on checksum complete. 2769 * 2770 * Return values: 2771 * 0: checksum is validated or try to in skb_checksum_complete. In the latter 2772 * case the ip_summed will not be CHECKSUM_UNNECESSARY and the pseudo 2773 * checksum is stored in skb->csum for use in __skb_checksum_complete 2774 * non-zero: value of invalid checksum 2775 * 2776 */ 2777static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb, 2778 bool complete, 2779 __wsum psum) 2780{ 2781 if (skb->ip_summed == CHECKSUM_COMPLETE) { 2782 if (!csum_fold(csum_add(psum, skb->csum))) { 2783 skb->ip_summed = CHECKSUM_UNNECESSARY; 2784 return 0; 2785 } 2786 } 2787 2788 skb->csum = psum; 2789 2790 if (complete || skb->len <= CHECKSUM_BREAK) 2791 return __skb_checksum_complete(skb); 2792 2793 return 0; 2794} 2795 2796static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto) 2797{ 2798 return 0; 2799} 2800 2801/* Perform checksum validate (init). Note that this is a macro since we only 2802 * want to calculate the pseudo header which is an input function if necessary. 2803 * First we try to validate without any computation (checksum unnecessary) and 2804 * then calculate based on checksum complete calling the function to compute 2805 * pseudo header. 2806 * 2807 * Return values: 2808 * 0: checksum is validated or try to in skb_checksum_complete 2809 * non-zero: value of invalid checksum 2810 */ 2811#define __skb_checksum_validate(skb, proto, complete, \ 2812 zero_okay, check, compute_pseudo) \ 2813({ \ 2814 __sum16 __ret = 0; \ 2815 if (__skb_checksum_validate_needed(skb, zero_okay, check)) \ 2816 __ret = __skb_checksum_validate_complete(skb, \ 2817 complete, compute_pseudo(skb, proto)); \ 2818 __ret; \ 2819}) 2820 2821#define skb_checksum_init(skb, proto, compute_pseudo) \ 2822 __skb_checksum_validate(skb, proto, false, false, 0, compute_pseudo) 2823 2824#define skb_checksum_init_zero_check(skb, proto, check, compute_pseudo) \ 2825 __skb_checksum_validate(skb, proto, false, true, check, compute_pseudo) 2826 2827#define skb_checksum_validate(skb, proto, compute_pseudo) \ 2828 __skb_checksum_validate(skb, proto, true, false, 0, compute_pseudo) 2829 2830#define skb_checksum_validate_zero_check(skb, proto, check, \ 2831 compute_pseudo) \ 2832 __skb_checksum_validate_(skb, proto, true, true, check, compute_pseudo) 2833 2834#define skb_checksum_simple_validate(skb) \ 2835 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo) 2836 |
|
2744#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2745void nf_conntrack_destroy(struct nf_conntrack *nfct); 2746static inline void nf_conntrack_put(struct nf_conntrack *nfct) 2747{ 2748 if (nfct && atomic_dec_and_test(&nfct->use)) 2749 nf_conntrack_destroy(nfct); 2750} 2751static inline void nf_conntrack_get(struct nf_conntrack *nfct) --- 257 unchanged lines hidden --- | 2837#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2838void nf_conntrack_destroy(struct nf_conntrack *nfct); 2839static inline void nf_conntrack_put(struct nf_conntrack *nfct) 2840{ 2841 if (nfct && atomic_dec_and_test(&nfct->use)) 2842 nf_conntrack_destroy(nfct); 2843} 2844static inline void nf_conntrack_get(struct nf_conntrack *nfct) --- 257 unchanged lines hidden --- |