Lines Matching refs:skb
572 void (*destructor)(struct sk_buff *skb);
725 static inline bool skb_pfmemalloc(const struct sk_buff *skb) in skb_pfmemalloc() argument
727 return unlikely(skb->pfmemalloc); in skb_pfmemalloc()
743 static inline struct dst_entry *skb_dst(const struct sk_buff *skb) in skb_dst() argument
748 WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) && in skb_dst()
751 return (struct dst_entry *)(skb->_skb_refdst & SKB_DST_PTRMASK); in skb_dst()
762 static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) in skb_dst_set() argument
764 skb->_skb_refdst = (unsigned long)dst; in skb_dst_set()
777 static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst) in skb_dst_set_noref() argument
780 skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF; in skb_dst_set_noref()
787 static inline bool skb_dst_is_noref(const struct sk_buff *skb) in skb_dst_is_noref() argument
789 return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb); in skb_dst_is_noref()
792 static inline struct rtable *skb_rtable(const struct sk_buff *skb) in skb_rtable() argument
794 return (struct rtable *)skb_dst(skb); in skb_rtable()
797 void kfree_skb(struct sk_buff *skb);
799 void skb_tx_error(struct sk_buff *skb);
800 void consume_skb(struct sk_buff *skb);
801 void __kfree_skb(struct sk_buff *skb);
804 void kfree_skb_partial(struct sk_buff *skb, bool head_stolen);
842 const struct sk_buff *skb) in skb_fclone_busy() argument
846 fclones = container_of(skb, struct sk_buff_fclones, skb1); in skb_fclone_busy()
848 return skb->fclone == SKB_FCLONE_ORIG && in skb_fclone_busy()
866 int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
867 struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority);
868 struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority);
869 struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom,
871 static inline struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, in __pskb_copy() argument
874 return __pskb_copy_fclone(skb, headroom, gfp_mask, false); in __pskb_copy()
877 int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask);
878 struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
880 struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom,
882 int skb_to_sgvec_nomark(struct sk_buff *skb, struct scatterlist *sg,
884 int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset,
886 int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
887 int skb_pad(struct sk_buff *skb, int pad);
890 int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
892 int len, int odd, struct sk_buff *skb),
895 int skb_append_pagefrags(struct sk_buff *skb, struct page *page,
908 void skb_prepare_seq_read(struct sk_buff *skb, unsigned int from,
914 unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
950 static inline void skb_clear_hash(struct sk_buff *skb) in skb_clear_hash() argument
952 skb->hash = 0; in skb_clear_hash()
953 skb->sw_hash = 0; in skb_clear_hash()
954 skb->l4_hash = 0; in skb_clear_hash()
957 static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb) in skb_clear_hash_if_not_l4() argument
959 if (!skb->l4_hash) in skb_clear_hash_if_not_l4()
960 skb_clear_hash(skb); in skb_clear_hash_if_not_l4()
964 __skb_set_hash(struct sk_buff *skb, __u32 hash, bool is_sw, bool is_l4) in __skb_set_hash() argument
966 skb->l4_hash = is_l4; in __skb_set_hash()
967 skb->sw_hash = is_sw; in __skb_set_hash()
968 skb->hash = hash; in __skb_set_hash()
972 skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) in skb_set_hash() argument
975 __skb_set_hash(skb, hash, false, type == PKT_HASH_TYPE_L4); in skb_set_hash()
979 __skb_set_sw_hash(struct sk_buff *skb, __u32 hash, bool is_l4) in __skb_set_sw_hash() argument
981 __skb_set_hash(skb, hash, true, is_l4); in __skb_set_sw_hash()
984 void __skb_get_hash(struct sk_buff *skb);
985 u32 skb_get_poff(const struct sk_buff *skb);
986 u32 __skb_get_poff(const struct sk_buff *skb, void *data,
988 __be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto,
991 static inline __be32 skb_flow_get_ports(const struct sk_buff *skb, in skb_flow_get_ports() argument
994 return __skb_flow_get_ports(skb, thoff, ip_proto, NULL, 0); in skb_flow_get_ports()
1001 bool __skb_flow_dissect(const struct sk_buff *skb,
1007 static inline bool skb_flow_dissect(const struct sk_buff *skb, in skb_flow_dissect() argument
1011 return __skb_flow_dissect(skb, flow_dissector, target_container, in skb_flow_dissect()
1015 static inline bool skb_flow_dissect_flow_keys(const struct sk_buff *skb, in skb_flow_dissect_flow_keys() argument
1020 return __skb_flow_dissect(skb, &flow_keys_dissector, flow, in skb_flow_dissect_flow_keys()
1034 static inline __u32 skb_get_hash(struct sk_buff *skb) in skb_get_hash() argument
1036 if (!skb->l4_hash && !skb->sw_hash) in skb_get_hash()
1037 __skb_get_hash(skb); in skb_get_hash()
1039 return skb->hash; in skb_get_hash()
1042 __u32 __skb_get_hash_flowi6(struct sk_buff *skb, const struct flowi6 *fl6);
1044 static inline __u32 skb_get_hash_flowi6(struct sk_buff *skb, const struct flowi6 *fl6) in skb_get_hash_flowi6() argument
1046 if (!skb->l4_hash && !skb->sw_hash) { in skb_get_hash_flowi6()
1050 __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys)); in skb_get_hash_flowi6()
1053 return skb->hash; in skb_get_hash_flowi6()
1056 __u32 __skb_get_hash_flowi4(struct sk_buff *skb, const struct flowi4 *fl);
1058 static inline __u32 skb_get_hash_flowi4(struct sk_buff *skb, const struct flowi4 *fl4) in skb_get_hash_flowi4() argument
1060 if (!skb->l4_hash && !skb->sw_hash) { in skb_get_hash_flowi4()
1064 __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys)); in skb_get_hash_flowi4()
1067 return skb->hash; in skb_get_hash_flowi4()
1070 __u32 skb_get_hash_perturb(const struct sk_buff *skb, u32 perturb);
1072 static inline __u32 skb_get_hash_raw(const struct sk_buff *skb) in skb_get_hash_raw() argument
1074 return skb->hash; in skb_get_hash_raw()
1084 static inline void skb_sender_cpu_clear(struct sk_buff *skb) in skb_sender_cpu_clear() argument
1087 skb->sender_cpu = 0; in skb_sender_cpu_clear()
1092 static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) in skb_end_pointer() argument
1094 return skb->head + skb->end; in skb_end_pointer()
1097 static inline unsigned int skb_end_offset(const struct sk_buff *skb) in skb_end_offset() argument
1099 return skb->end; in skb_end_offset()
1102 static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) in skb_end_pointer() argument
1104 return skb->end; in skb_end_pointer()
1107 static inline unsigned int skb_end_offset(const struct sk_buff *skb) in skb_end_offset() argument
1109 return skb->end - skb->head; in skb_end_offset()
1116 static inline struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb) in skb_hwtstamps() argument
1118 return &skb_shinfo(skb)->hwtstamps; in skb_hwtstamps()
1140 const struct sk_buff *skb) in skb_queue_is_last() argument
1142 return skb->next == (const struct sk_buff *) list; in skb_queue_is_last()
1153 const struct sk_buff *skb) in skb_queue_is_first() argument
1155 return skb->prev == (const struct sk_buff *) list; in skb_queue_is_first()
1167 const struct sk_buff *skb) in skb_queue_next() argument
1172 BUG_ON(skb_queue_is_last(list, skb)); in skb_queue_next()
1173 return skb->next; in skb_queue_next()
1185 const struct sk_buff *skb) in skb_queue_prev() argument
1190 BUG_ON(skb_queue_is_first(list, skb)); in skb_queue_prev()
1191 return skb->prev; in skb_queue_prev()
1201 static inline struct sk_buff *skb_get(struct sk_buff *skb) in skb_get() argument
1203 atomic_inc(&skb->users); in skb_get()
1204 return skb; in skb_get()
1220 static inline int skb_cloned(const struct sk_buff *skb) in skb_cloned() argument
1222 return skb->cloned && in skb_cloned()
1223 (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1; in skb_cloned()
1226 static inline int skb_unclone(struct sk_buff *skb, gfp_t pri) in skb_unclone() argument
1230 if (skb_cloned(skb)) in skb_unclone()
1231 return pskb_expand_head(skb, 0, 0, pri); in skb_unclone()
1243 static inline int skb_header_cloned(const struct sk_buff *skb) in skb_header_cloned() argument
1247 if (!skb->cloned) in skb_header_cloned()
1250 dataref = atomic_read(&skb_shinfo(skb)->dataref); in skb_header_cloned()
1264 static inline void skb_header_release(struct sk_buff *skb) in skb_header_release() argument
1266 BUG_ON(skb->nohdr); in skb_header_release()
1267 skb->nohdr = 1; in skb_header_release()
1268 atomic_add(1 << SKB_DATAREF_SHIFT, &skb_shinfo(skb)->dataref); in skb_header_release()
1278 static inline void __skb_header_release(struct sk_buff *skb) in __skb_header_release() argument
1280 skb->nohdr = 1; in __skb_header_release()
1281 atomic_set(&skb_shinfo(skb)->dataref, 1 + (1 << SKB_DATAREF_SHIFT)); in __skb_header_release()
1292 static inline int skb_shared(const struct sk_buff *skb) in skb_shared() argument
1294 return atomic_read(&skb->users) != 1; in skb_shared()
1310 static inline struct sk_buff *skb_share_check(struct sk_buff *skb, gfp_t pri) in skb_share_check() argument
1313 if (skb_shared(skb)) { in skb_share_check()
1314 struct sk_buff *nskb = skb_clone(skb, pri); in skb_share_check()
1317 consume_skb(skb); in skb_share_check()
1319 kfree_skb(skb); in skb_share_check()
1320 skb = nskb; in skb_share_check()
1322 return skb; in skb_share_check()
1345 static inline struct sk_buff *skb_unshare(struct sk_buff *skb, in skb_unshare() argument
1349 if (skb_cloned(skb)) { in skb_unshare()
1350 struct sk_buff *nskb = skb_copy(skb, pri); in skb_unshare()
1354 consume_skb(skb); in skb_unshare()
1356 kfree_skb(skb); in skb_unshare()
1357 skb = nskb; in skb_unshare()
1359 return skb; in skb_unshare()
1377 struct sk_buff *skb = list_->next; in skb_peek() local
1379 if (skb == (struct sk_buff *)list_) in skb_peek()
1380 skb = NULL; in skb_peek()
1381 return skb; in skb_peek()
1393 static inline struct sk_buff *skb_peek_next(struct sk_buff *skb, in skb_peek_next() argument
1396 struct sk_buff *next = skb->next; in skb_peek_next()
1418 struct sk_buff *skb = list_->prev; in skb_peek_tail() local
1420 if (skb == (struct sk_buff *)list_) in skb_peek_tail()
1421 skb = NULL; in skb_peek_tail()
1422 return skb; in skb_peek_tail()
1635 void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list);
1636 static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) in __skb_unlink() argument
1641 next = skb->next; in __skb_unlink()
1642 prev = skb->prev; in __skb_unlink()
1643 skb->next = skb->prev = NULL; in __skb_unlink()
1659 struct sk_buff *skb = skb_peek(list); in __skb_dequeue() local
1660 if (skb) in __skb_dequeue()
1661 __skb_unlink(skb, list); in __skb_dequeue()
1662 return skb; in __skb_dequeue()
1676 struct sk_buff *skb = skb_peek_tail(list); in __skb_dequeue_tail() local
1677 if (skb) in __skb_dequeue_tail()
1678 __skb_unlink(skb, list); in __skb_dequeue_tail()
1679 return skb; in __skb_dequeue_tail()
1683 static inline bool skb_is_nonlinear(const struct sk_buff *skb) in skb_is_nonlinear() argument
1685 return skb->data_len; in skb_is_nonlinear()
1688 static inline unsigned int skb_headlen(const struct sk_buff *skb) in skb_headlen() argument
1690 return skb->len - skb->data_len; in skb_headlen()
1693 static inline int skb_pagelen(const struct sk_buff *skb) in skb_pagelen() argument
1697 for (i = (int)skb_shinfo(skb)->nr_frags - 1; i >= 0; i--) in skb_pagelen()
1698 len += skb_frag_size(&skb_shinfo(skb)->frags[i]); in skb_pagelen()
1699 return len + skb_headlen(skb); in skb_pagelen()
1715 static inline void __skb_fill_page_desc(struct sk_buff *skb, int i, in __skb_fill_page_desc() argument
1718 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; in __skb_fill_page_desc()
1731 skb->pfmemalloc = true; in __skb_fill_page_desc()
1748 static inline void skb_fill_page_desc(struct sk_buff *skb, int i, in skb_fill_page_desc() argument
1751 __skb_fill_page_desc(skb, i, page, off, size); in skb_fill_page_desc()
1752 skb_shinfo(skb)->nr_frags = i + 1; in skb_fill_page_desc()
1755 void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,
1758 void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size,
1761 #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) argument
1762 #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) argument
1763 #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) argument
1766 static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) in skb_tail_pointer() argument
1768 return skb->head + skb->tail; in skb_tail_pointer()
1771 static inline void skb_reset_tail_pointer(struct sk_buff *skb) in skb_reset_tail_pointer() argument
1773 skb->tail = skb->data - skb->head; in skb_reset_tail_pointer()
1776 static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) in skb_set_tail_pointer() argument
1778 skb_reset_tail_pointer(skb); in skb_set_tail_pointer()
1779 skb->tail += offset; in skb_set_tail_pointer()
1783 static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) in skb_tail_pointer() argument
1785 return skb->tail; in skb_tail_pointer()
1788 static inline void skb_reset_tail_pointer(struct sk_buff *skb) in skb_reset_tail_pointer() argument
1790 skb->tail = skb->data; in skb_reset_tail_pointer()
1793 static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) in skb_set_tail_pointer() argument
1795 skb->tail = skb->data + offset; in skb_set_tail_pointer()
1803 unsigned char *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
1804 unsigned char *skb_put(struct sk_buff *skb, unsigned int len);
1805 static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) in __skb_put() argument
1807 unsigned char *tmp = skb_tail_pointer(skb); in __skb_put()
1808 SKB_LINEAR_ASSERT(skb); in __skb_put()
1809 skb->tail += len; in __skb_put()
1810 skb->len += len; in __skb_put()
1814 unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
1815 static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) in __skb_push() argument
1817 skb->data -= len; in __skb_push()
1818 skb->len += len; in __skb_push()
1819 return skb->data; in __skb_push()
1822 unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
1823 static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) in __skb_pull() argument
1825 skb->len -= len; in __skb_pull()
1826 BUG_ON(skb->len < skb->data_len); in __skb_pull()
1827 return skb->data += len; in __skb_pull()
1830 static inline unsigned char *skb_pull_inline(struct sk_buff *skb, unsigned int len) in skb_pull_inline() argument
1832 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len); in skb_pull_inline()
1835 unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
1837 static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) in __pskb_pull() argument
1839 if (len > skb_headlen(skb) && in __pskb_pull()
1840 !__pskb_pull_tail(skb, len - skb_headlen(skb))) in __pskb_pull()
1842 skb->len -= len; in __pskb_pull()
1843 return skb->data += len; in __pskb_pull()
1846 static inline unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len) in pskb_pull() argument
1848 return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len); in pskb_pull()
1851 static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len) in pskb_may_pull() argument
1853 if (likely(len <= skb_headlen(skb))) in pskb_may_pull()
1855 if (unlikely(len > skb->len)) in pskb_may_pull()
1857 return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL; in pskb_may_pull()
1866 static inline unsigned int skb_headroom(const struct sk_buff *skb) in skb_headroom() argument
1868 return skb->data - skb->head; in skb_headroom()
1877 static inline int skb_tailroom(const struct sk_buff *skb) in skb_tailroom() argument
1879 return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail; in skb_tailroom()
1889 static inline int skb_availroom(const struct sk_buff *skb) in skb_availroom() argument
1891 if (skb_is_nonlinear(skb)) in skb_availroom()
1894 return skb->end - skb->tail - skb->reserved_tailroom; in skb_availroom()
1905 static inline void skb_reserve(struct sk_buff *skb, int len) in skb_reserve() argument
1907 skb->data += len; in skb_reserve()
1908 skb->tail += len; in skb_reserve()
1923 static inline void skb_tailroom_reserve(struct sk_buff *skb, unsigned int mtu, in skb_tailroom_reserve() argument
1926 SKB_LINEAR_ASSERT(skb); in skb_tailroom_reserve()
1927 if (mtu < skb_tailroom(skb) - needed_tailroom) in skb_tailroom_reserve()
1929 skb->reserved_tailroom = skb_tailroom(skb) - mtu; in skb_tailroom_reserve()
1932 skb->reserved_tailroom = needed_tailroom; in skb_tailroom_reserve()
1938 static inline void skb_set_inner_protocol(struct sk_buff *skb, in skb_set_inner_protocol() argument
1941 skb->inner_protocol = protocol; in skb_set_inner_protocol()
1942 skb->inner_protocol_type = ENCAP_TYPE_ETHER; in skb_set_inner_protocol()
1945 static inline void skb_set_inner_ipproto(struct sk_buff *skb, in skb_set_inner_ipproto() argument
1948 skb->inner_ipproto = ipproto; in skb_set_inner_ipproto()
1949 skb->inner_protocol_type = ENCAP_TYPE_IPPROTO; in skb_set_inner_ipproto()
1952 static inline void skb_reset_inner_headers(struct sk_buff *skb) in skb_reset_inner_headers() argument
1954 skb->inner_mac_header = skb->mac_header; in skb_reset_inner_headers()
1955 skb->inner_network_header = skb->network_header; in skb_reset_inner_headers()
1956 skb->inner_transport_header = skb->transport_header; in skb_reset_inner_headers()
1959 static inline void skb_reset_mac_len(struct sk_buff *skb) in skb_reset_mac_len() argument
1961 skb->mac_len = skb->network_header - skb->mac_header; in skb_reset_mac_len()
1965 *skb) in skb_inner_transport_header()
1967 return skb->head + skb->inner_transport_header; in skb_inner_transport_header()
1970 static inline void skb_reset_inner_transport_header(struct sk_buff *skb) in skb_reset_inner_transport_header() argument
1972 skb->inner_transport_header = skb->data - skb->head; in skb_reset_inner_transport_header()
1975 static inline void skb_set_inner_transport_header(struct sk_buff *skb, in skb_set_inner_transport_header() argument
1978 skb_reset_inner_transport_header(skb); in skb_set_inner_transport_header()
1979 skb->inner_transport_header += offset; in skb_set_inner_transport_header()
1982 static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb) in skb_inner_network_header() argument
1984 return skb->head + skb->inner_network_header; in skb_inner_network_header()
1987 static inline void skb_reset_inner_network_header(struct sk_buff *skb) in skb_reset_inner_network_header() argument
1989 skb->inner_network_header = skb->data - skb->head; in skb_reset_inner_network_header()
1992 static inline void skb_set_inner_network_header(struct sk_buff *skb, in skb_set_inner_network_header() argument
1995 skb_reset_inner_network_header(skb); in skb_set_inner_network_header()
1996 skb->inner_network_header += offset; in skb_set_inner_network_header()
1999 static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) in skb_inner_mac_header() argument
2001 return skb->head + skb->inner_mac_header; in skb_inner_mac_header()
2004 static inline void skb_reset_inner_mac_header(struct sk_buff *skb) in skb_reset_inner_mac_header() argument
2006 skb->inner_mac_header = skb->data - skb->head; in skb_reset_inner_mac_header()
2009 static inline void skb_set_inner_mac_header(struct sk_buff *skb, in skb_set_inner_mac_header() argument
2012 skb_reset_inner_mac_header(skb); in skb_set_inner_mac_header()
2013 skb->inner_mac_header += offset; in skb_set_inner_mac_header()
2015 static inline bool skb_transport_header_was_set(const struct sk_buff *skb) in skb_transport_header_was_set() argument
2017 return skb->transport_header != (typeof(skb->transport_header))~0U; in skb_transport_header_was_set()
2020 static inline unsigned char *skb_transport_header(const struct sk_buff *skb) in skb_transport_header() argument
2022 return skb->head + skb->transport_header; in skb_transport_header()
2025 static inline void skb_reset_transport_header(struct sk_buff *skb) in skb_reset_transport_header() argument
2027 skb->transport_header = skb->data - skb->head; in skb_reset_transport_header()
2030 static inline void skb_set_transport_header(struct sk_buff *skb, in skb_set_transport_header() argument
2033 skb_reset_transport_header(skb); in skb_set_transport_header()
2034 skb->transport_header += offset; in skb_set_transport_header()
2037 static inline unsigned char *skb_network_header(const struct sk_buff *skb) in skb_network_header() argument
2039 return skb->head + skb->network_header; in skb_network_header()
2042 static inline void skb_reset_network_header(struct sk_buff *skb) in skb_reset_network_header() argument
2044 skb->network_header = skb->data - skb->head; in skb_reset_network_header()
2047 static inline void skb_set_network_header(struct sk_buff *skb, const int offset) in skb_set_network_header() argument
2049 skb_reset_network_header(skb); in skb_set_network_header()
2050 skb->network_header += offset; in skb_set_network_header()
2053 static inline unsigned char *skb_mac_header(const struct sk_buff *skb) in skb_mac_header() argument
2055 return skb->head + skb->mac_header; in skb_mac_header()
2058 static inline int skb_mac_header_was_set(const struct sk_buff *skb) in skb_mac_header_was_set() argument
2060 return skb->mac_header != (typeof(skb->mac_header))~0U; in skb_mac_header_was_set()
2063 static inline void skb_reset_mac_header(struct sk_buff *skb) in skb_reset_mac_header() argument
2065 skb->mac_header = skb->data - skb->head; in skb_reset_mac_header()
2068 static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) in skb_set_mac_header() argument
2070 skb_reset_mac_header(skb); in skb_set_mac_header()
2071 skb->mac_header += offset; in skb_set_mac_header()
2074 static inline void skb_pop_mac_header(struct sk_buff *skb) in skb_pop_mac_header() argument
2076 skb->mac_header = skb->network_header; in skb_pop_mac_header()
2079 static inline void skb_probe_transport_header(struct sk_buff *skb, in skb_probe_transport_header() argument
2084 if (skb_transport_header_was_set(skb)) in skb_probe_transport_header()
2086 else if (skb_flow_dissect_flow_keys(skb, &keys, 0)) in skb_probe_transport_header()
2087 skb_set_transport_header(skb, keys.control.thoff); in skb_probe_transport_header()
2089 skb_set_transport_header(skb, offset_hint); in skb_probe_transport_header()
2092 static inline void skb_mac_header_rebuild(struct sk_buff *skb) in skb_mac_header_rebuild() argument
2094 if (skb_mac_header_was_set(skb)) { in skb_mac_header_rebuild()
2095 const unsigned char *old_mac = skb_mac_header(skb); in skb_mac_header_rebuild()
2097 skb_set_mac_header(skb, -skb->mac_len); in skb_mac_header_rebuild()
2098 memmove(skb_mac_header(skb), old_mac, skb->mac_len); in skb_mac_header_rebuild()
2102 static inline int skb_checksum_start_offset(const struct sk_buff *skb) in skb_checksum_start_offset() argument
2104 return skb->csum_start - skb_headroom(skb); in skb_checksum_start_offset()
2107 static inline int skb_transport_offset(const struct sk_buff *skb) in skb_transport_offset() argument
2109 return skb_transport_header(skb) - skb->data; in skb_transport_offset()
2112 static inline u32 skb_network_header_len(const struct sk_buff *skb) in skb_network_header_len() argument
2114 return skb->transport_header - skb->network_header; in skb_network_header_len()
2117 static inline u32 skb_inner_network_header_len(const struct sk_buff *skb) in skb_inner_network_header_len() argument
2119 return skb->inner_transport_header - skb->inner_network_header; in skb_inner_network_header_len()
2122 static inline int skb_network_offset(const struct sk_buff *skb) in skb_network_offset() argument
2124 return skb_network_header(skb) - skb->data; in skb_network_offset()
2127 static inline int skb_inner_network_offset(const struct sk_buff *skb) in skb_inner_network_offset() argument
2129 return skb_inner_network_header(skb) - skb->data; in skb_inner_network_offset()
2132 static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len) in pskb_network_may_pull() argument
2134 return pskb_may_pull(skb, skb_network_offset(skb) + len); in pskb_network_may_pull()
2185 int ___pskb_trim(struct sk_buff *skb, unsigned int len);
2187 static inline void __skb_trim(struct sk_buff *skb, unsigned int len) in __skb_trim() argument
2189 if (unlikely(skb_is_nonlinear(skb))) { in __skb_trim()
2193 skb->len = len; in __skb_trim()
2194 skb_set_tail_pointer(skb, len); in __skb_trim()
2197 void skb_trim(struct sk_buff *skb, unsigned int len);
2199 static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) in __pskb_trim() argument
2201 if (skb->data_len) in __pskb_trim()
2202 return ___pskb_trim(skb, len); in __pskb_trim()
2203 __skb_trim(skb, len); in __pskb_trim()
2207 static inline int pskb_trim(struct sk_buff *skb, unsigned int len) in pskb_trim() argument
2209 return (len < skb->len) ? __pskb_trim(skb, len) : 0; in pskb_trim()
2221 static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len) in pskb_trim_unique() argument
2223 int err = pskb_trim(skb, len); in pskb_trim_unique()
2235 static inline void skb_orphan(struct sk_buff *skb) in skb_orphan() argument
2237 if (skb->destructor) { in skb_orphan()
2238 skb->destructor(skb); in skb_orphan()
2239 skb->destructor = NULL; in skb_orphan()
2240 skb->sk = NULL; in skb_orphan()
2242 BUG_ON(skb->sk); in skb_orphan()
2255 static inline int skb_orphan_frags(struct sk_buff *skb, gfp_t gfp_mask) in skb_orphan_frags() argument
2257 if (likely(!(skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY))) in skb_orphan_frags()
2259 return skb_copy_ubufs(skb, gfp_mask); in skb_orphan_frags()
2273 struct sk_buff *skb; in __skb_queue_purge() local
2274 while ((skb = __skb_dequeue(list)) != NULL) in __skb_queue_purge()
2275 kfree_skb(skb); in __skb_queue_purge()
2319 struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); in __netdev_alloc_skb_ip_align() local
2321 if (NET_IP_ALIGN && skb) in __netdev_alloc_skb_ip_align()
2322 skb_reserve(skb, NET_IP_ALIGN); in __netdev_alloc_skb_ip_align()
2323 return skb; in __netdev_alloc_skb_ip_align()
2400 struct sk_buff *skb) in skb_propagate_pfmemalloc() argument
2403 skb->pfmemalloc = true; in skb_propagate_pfmemalloc()
2435 static inline void skb_frag_ref(struct sk_buff *skb, int f) in skb_frag_ref() argument
2437 __skb_frag_ref(&skb_shinfo(skb)->frags[f]); in skb_frag_ref()
2458 static inline void skb_frag_unref(struct sk_buff *skb, int f) in skb_frag_unref() argument
2460 __skb_frag_unref(&skb_shinfo(skb)->frags[f]); in skb_frag_unref()
2511 static inline void skb_frag_set_page(struct sk_buff *skb, int f, in skb_frag_set_page() argument
2514 __skb_frag_set_page(&skb_shinfo(skb)->frags[f], page); in skb_frag_set_page()
2539 static inline struct sk_buff *pskb_copy(struct sk_buff *skb, in pskb_copy() argument
2542 return __pskb_copy(skb, skb_headroom(skb), gfp_mask); in pskb_copy()
2546 static inline struct sk_buff *pskb_copy_for_clone(struct sk_buff *skb, in pskb_copy_for_clone() argument
2549 return __pskb_copy_fclone(skb, skb_headroom(skb), gfp_mask, true); in pskb_copy_for_clone()
2561 static inline int skb_clone_writable(const struct sk_buff *skb, unsigned int len) in skb_clone_writable() argument
2563 return !skb_header_cloned(skb) && in skb_clone_writable()
2564 skb_headroom(skb) + len <= skb->hdr_len; in skb_clone_writable()
2567 static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom, in __skb_cow() argument
2572 if (headroom > skb_headroom(skb)) in __skb_cow()
2573 delta = headroom - skb_headroom(skb); in __skb_cow()
2576 return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0, in __skb_cow()
2593 static inline int skb_cow(struct sk_buff *skb, unsigned int headroom) in skb_cow() argument
2595 return __skb_cow(skb, headroom, skb_cloned(skb)); in skb_cow()
2608 static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom) in skb_cow_head() argument
2610 return __skb_cow(skb, headroom, skb_header_cloned(skb)); in skb_cow_head()
2623 static inline int skb_padto(struct sk_buff *skb, unsigned int len) in skb_padto() argument
2625 unsigned int size = skb->len; in skb_padto()
2628 return skb_pad(skb, len - size); in skb_padto()
2641 static inline int skb_put_padto(struct sk_buff *skb, unsigned int len) in skb_put_padto() argument
2643 unsigned int size = skb->len; in skb_put_padto()
2647 if (skb_pad(skb, len)) in skb_put_padto()
2649 __skb_put(skb, len); in skb_put_padto()
2654 static inline int skb_add_data(struct sk_buff *skb, in skb_add_data() argument
2657 const int off = skb->len; in skb_add_data()
2659 if (skb->ip_summed == CHECKSUM_NONE) { in skb_add_data()
2661 if (csum_and_copy_from_iter(skb_put(skb, copy), copy, in skb_add_data()
2663 skb->csum = csum_block_add(skb->csum, csum, off); in skb_add_data()
2666 } else if (copy_from_iter(skb_put(skb, copy), copy, from) == copy) in skb_add_data()
2669 __skb_trim(skb, off); in skb_add_data()
2673 static inline bool skb_can_coalesce(struct sk_buff *skb, int i, in skb_can_coalesce() argument
2677 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1]; in skb_can_coalesce()
2685 static inline int __skb_linearize(struct sk_buff *skb) in __skb_linearize() argument
2687 return __pskb_pull_tail(skb, skb->data_len) ? 0 : -ENOMEM; in __skb_linearize()
2697 static inline int skb_linearize(struct sk_buff *skb) in skb_linearize() argument
2699 return skb_is_nonlinear(skb) ? __skb_linearize(skb) : 0; in skb_linearize()
2709 static inline bool skb_has_shared_frag(const struct sk_buff *skb) in skb_has_shared_frag() argument
2711 return skb_is_nonlinear(skb) && in skb_has_shared_frag()
2712 skb_shinfo(skb)->tx_flags & SKBTX_SHARED_FRAG; in skb_has_shared_frag()
2722 static inline int skb_linearize_cow(struct sk_buff *skb) in skb_linearize_cow() argument
2724 return skb_is_nonlinear(skb) || skb_cloned(skb) ? in skb_linearize_cow()
2725 __skb_linearize(skb) : 0; in skb_linearize_cow()
2739 static inline void skb_postpull_rcsum(struct sk_buff *skb, in skb_postpull_rcsum() argument
2742 if (skb->ip_summed == CHECKSUM_COMPLETE) in skb_postpull_rcsum()
2743 skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); in skb_postpull_rcsum()
2744 else if (skb->ip_summed == CHECKSUM_PARTIAL && in skb_postpull_rcsum()
2745 skb_checksum_start_offset(skb) < 0) in skb_postpull_rcsum()
2746 skb->ip_summed = CHECKSUM_NONE; in skb_postpull_rcsum()
2749 unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
2751 static inline void skb_postpush_rcsum(struct sk_buff *skb, in skb_postpush_rcsum() argument
2764 if (skb->ip_summed == CHECKSUM_COMPLETE) in skb_postpush_rcsum()
2765 skb->csum = csum_partial(start, len, skb->csum); in skb_postpush_rcsum()
2777 static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) in pskb_trim_rcsum() argument
2779 if (likely(len >= skb->len)) in pskb_trim_rcsum()
2781 if (skb->ip_summed == CHECKSUM_COMPLETE) in pskb_trim_rcsum()
2782 skb->ip_summed = CHECKSUM_NONE; in pskb_trim_rcsum()
2783 return __pskb_trim(skb, len); in pskb_trim_rcsum()
2786 #define skb_queue_walk(queue, skb) \ argument
2787 for (skb = (queue)->next; \
2788 skb != (struct sk_buff *)(queue); \
2789 skb = skb->next)
2791 #define skb_queue_walk_safe(queue, skb, tmp) \ argument
2792 for (skb = (queue)->next, tmp = skb->next; \
2793 skb != (struct sk_buff *)(queue); \
2794 skb = tmp, tmp = skb->next)
2796 #define skb_queue_walk_from(queue, skb) \ argument
2797 for (; skb != (struct sk_buff *)(queue); \
2798 skb = skb->next)
2800 #define skb_queue_walk_from_safe(queue, skb, tmp) \ argument
2801 for (tmp = skb->next; \
2802 skb != (struct sk_buff *)(queue); \
2803 skb = tmp, tmp = skb->next)
2805 #define skb_queue_reverse_walk(queue, skb) \ argument
2806 for (skb = (queue)->prev; \
2807 skb != (struct sk_buff *)(queue); \
2808 skb = skb->prev)
2810 #define skb_queue_reverse_walk_safe(queue, skb, tmp) \ argument
2811 for (skb = (queue)->prev, tmp = skb->prev; \
2812 skb != (struct sk_buff *)(queue); \
2813 skb = tmp, tmp = skb->prev)
2815 #define skb_queue_reverse_walk_from_safe(queue, skb, tmp) \ argument
2816 for (tmp = skb->prev; \
2817 skb != (struct sk_buff *)(queue); \
2818 skb = tmp, tmp = skb->prev)
2820 static inline bool skb_has_frag_list(const struct sk_buff *skb) in skb_has_frag_list() argument
2822 return skb_shinfo(skb)->frag_list != NULL; in skb_has_frag_list()
2825 static inline void skb_frag_list_init(struct sk_buff *skb) in skb_frag_list_init() argument
2827 skb_shinfo(skb)->frag_list = NULL; in skb_frag_list_init()
2830 #define skb_walk_frags(skb, iter) \ argument
2831 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
2846 int skb_copy_and_csum_datagram_msg(struct sk_buff *skb, int hlen,
2848 int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
2850 int zerocopy_sg_from_iter(struct sk_buff *skb, struct iov_iter *frm);
2851 void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
2852 void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb);
2853 int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags);
2854 int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);
2855 int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len);
2856 __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, u8 *to,
2861 int skb_splice_bits(struct sk_buff *skb, struct sock *sk, unsigned int offset,
2867 void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
2871 void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len);
2872 int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
2873 void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2874 unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
2875 struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
2876 struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
2877 int skb_ensure_writable(struct sk_buff *skb, int write_len);
2878 int skb_vlan_pop(struct sk_buff *skb);
2879 int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
2896 __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
2898 __wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
2902 __skb_header_pointer(const struct sk_buff *skb, int offset, in __skb_header_pointer() argument
2908 if (!skb || in __skb_header_pointer()
2909 skb_copy_bits(skb, offset, buffer, len) < 0) in __skb_header_pointer()
2916 skb_header_pointer(const struct sk_buff *skb, int offset, int len, void *buffer) in skb_header_pointer() argument
2918 return __skb_header_pointer(skb, offset, len, skb->data, in skb_header_pointer()
2919 skb_headlen(skb), buffer); in skb_header_pointer()
2932 static inline bool skb_needs_linearize(struct sk_buff *skb, in skb_needs_linearize() argument
2935 return skb_is_nonlinear(skb) && in skb_needs_linearize()
2936 ((skb_has_frag_list(skb) && !(features & NETIF_F_FRAGLIST)) || in skb_needs_linearize()
2937 (skb_shinfo(skb)->nr_frags && !(features & NETIF_F_SG))); in skb_needs_linearize()
2940 static inline void skb_copy_from_linear_data(const struct sk_buff *skb, in skb_copy_from_linear_data() argument
2944 memcpy(to, skb->data, len); in skb_copy_from_linear_data()
2947 static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb, in skb_copy_from_linear_data_offset() argument
2951 memcpy(to, skb->data + offset, len); in skb_copy_from_linear_data_offset()
2954 static inline void skb_copy_to_linear_data(struct sk_buff *skb, in skb_copy_to_linear_data() argument
2958 memcpy(skb->data, from, len); in skb_copy_to_linear_data()
2961 static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb, in skb_copy_to_linear_data_offset() argument
2966 memcpy(skb->data + offset, from, len); in skb_copy_to_linear_data_offset()
2971 static inline ktime_t skb_get_ktime(const struct sk_buff *skb) in skb_get_ktime() argument
2973 return skb->tstamp; in skb_get_ktime()
2985 static inline void skb_get_timestamp(const struct sk_buff *skb, in skb_get_timestamp() argument
2988 *stamp = ktime_to_timeval(skb->tstamp); in skb_get_timestamp()
2991 static inline void skb_get_timestampns(const struct sk_buff *skb, in skb_get_timestampns() argument
2994 *stamp = ktime_to_timespec(skb->tstamp); in skb_get_timestampns()
2997 static inline void __net_timestamp(struct sk_buff *skb) in __net_timestamp() argument
2999 skb->tstamp = ktime_get_real(); in __net_timestamp()
3012 struct sk_buff *skb_clone_sk(struct sk_buff *skb);
3016 void skb_clone_tx_timestamp(struct sk_buff *skb);
3017 bool skb_defer_rx_timestamp(struct sk_buff *skb);
3021 static inline void skb_clone_tx_timestamp(struct sk_buff *skb) in skb_clone_tx_timestamp() argument
3025 static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) in skb_defer_rx_timestamp() argument
3044 void skb_complete_tx_timestamp(struct sk_buff *skb,
3065 static inline void sw_tx_timestamp(struct sk_buff *skb) in sw_tx_timestamp() argument
3067 if (skb_shinfo(skb)->tx_flags & SKBTX_SW_TSTAMP && in sw_tx_timestamp()
3068 !(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) in sw_tx_timestamp()
3069 skb_tstamp_tx(skb, NULL); in sw_tx_timestamp()
3084 static inline void skb_tx_timestamp(struct sk_buff *skb) in skb_tx_timestamp() argument
3086 skb_clone_tx_timestamp(skb); in skb_tx_timestamp()
3087 sw_tx_timestamp(skb); in skb_tx_timestamp()
3097 void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
3099 __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
3100 __sum16 __skb_checksum_complete(struct sk_buff *skb);
3102 static inline int skb_csum_unnecessary(const struct sk_buff *skb) in skb_csum_unnecessary() argument
3104 return ((skb->ip_summed == CHECKSUM_UNNECESSARY) || in skb_csum_unnecessary()
3105 skb->csum_valid || in skb_csum_unnecessary()
3106 (skb->ip_summed == CHECKSUM_PARTIAL && in skb_csum_unnecessary()
3107 skb_checksum_start_offset(skb) >= 0)); in skb_csum_unnecessary()
3126 static inline __sum16 skb_checksum_complete(struct sk_buff *skb) in skb_checksum_complete() argument
3128 return skb_csum_unnecessary(skb) ? in skb_checksum_complete()
3129 0 : __skb_checksum_complete(skb); in skb_checksum_complete()
3132 static inline void __skb_decr_checksum_unnecessary(struct sk_buff *skb) in __skb_decr_checksum_unnecessary() argument
3134 if (skb->ip_summed == CHECKSUM_UNNECESSARY) { in __skb_decr_checksum_unnecessary()
3135 if (skb->csum_level == 0) in __skb_decr_checksum_unnecessary()
3136 skb->ip_summed = CHECKSUM_NONE; in __skb_decr_checksum_unnecessary()
3138 skb->csum_level--; in __skb_decr_checksum_unnecessary()
3142 static inline void __skb_incr_checksum_unnecessary(struct sk_buff *skb) in __skb_incr_checksum_unnecessary() argument
3144 if (skb->ip_summed == CHECKSUM_UNNECESSARY) { in __skb_incr_checksum_unnecessary()
3145 if (skb->csum_level < SKB_MAX_CSUM_LEVEL) in __skb_incr_checksum_unnecessary()
3146 skb->csum_level++; in __skb_incr_checksum_unnecessary()
3147 } else if (skb->ip_summed == CHECKSUM_NONE) { in __skb_incr_checksum_unnecessary()
3148 skb->ip_summed = CHECKSUM_UNNECESSARY; in __skb_incr_checksum_unnecessary()
3149 skb->csum_level = 0; in __skb_incr_checksum_unnecessary()
3153 static inline void __skb_mark_checksum_bad(struct sk_buff *skb) in __skb_mark_checksum_bad() argument
3163 if (skb->ip_summed == CHECKSUM_NONE || in __skb_mark_checksum_bad()
3164 skb->ip_summed == CHECKSUM_UNNECESSARY) in __skb_mark_checksum_bad()
3165 skb->csum_bad = 1; in __skb_mark_checksum_bad()
3173 static inline bool __skb_checksum_validate_needed(struct sk_buff *skb, in __skb_checksum_validate_needed() argument
3177 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) { in __skb_checksum_validate_needed()
3178 skb->csum_valid = 1; in __skb_checksum_validate_needed()
3179 __skb_decr_checksum_unnecessary(skb); in __skb_checksum_validate_needed()
3197 static inline void skb_checksum_complete_unset(struct sk_buff *skb) in skb_checksum_complete_unset() argument
3199 if (skb->ip_summed == CHECKSUM_COMPLETE) in skb_checksum_complete_unset()
3200 skb->ip_summed = CHECKSUM_NONE; in skb_checksum_complete_unset()
3212 static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb, in __skb_checksum_validate_complete() argument
3216 if (skb->ip_summed == CHECKSUM_COMPLETE) { in __skb_checksum_validate_complete()
3217 if (!csum_fold(csum_add(psum, skb->csum))) { in __skb_checksum_validate_complete()
3218 skb->csum_valid = 1; in __skb_checksum_validate_complete()
3221 } else if (skb->csum_bad) { in __skb_checksum_validate_complete()
3226 skb->csum = psum; in __skb_checksum_validate_complete()
3228 if (complete || skb->len <= CHECKSUM_BREAK) { in __skb_checksum_validate_complete()
3231 csum = __skb_checksum_complete(skb); in __skb_checksum_validate_complete()
3232 skb->csum_valid = !csum; in __skb_checksum_validate_complete()
3239 static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto) in null_compute_pseudo() argument
3254 #define __skb_checksum_validate(skb, proto, complete, \ argument
3258 skb->csum_valid = 0; \
3259 if (__skb_checksum_validate_needed(skb, zero_okay, check)) \
3260 __ret = __skb_checksum_validate_complete(skb, \
3261 complete, compute_pseudo(skb, proto)); \
3265 #define skb_checksum_init(skb, proto, compute_pseudo) \ argument
3266 __skb_checksum_validate(skb, proto, false, false, 0, compute_pseudo)
3268 #define skb_checksum_init_zero_check(skb, proto, check, compute_pseudo) \ argument
3269 __skb_checksum_validate(skb, proto, false, true, check, compute_pseudo)
3271 #define skb_checksum_validate(skb, proto, compute_pseudo) \ argument
3272 __skb_checksum_validate(skb, proto, true, false, 0, compute_pseudo)
3274 #define skb_checksum_validate_zero_check(skb, proto, check, \ argument
3276 __skb_checksum_validate(skb, proto, true, true, check, compute_pseudo)
3278 #define skb_checksum_simple_validate(skb) \ argument
3279 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo)
3281 static inline bool __skb_checksum_convert_check(struct sk_buff *skb) in __skb_checksum_convert_check() argument
3283 return (skb->ip_summed == CHECKSUM_NONE && in __skb_checksum_convert_check()
3284 skb->csum_valid && !skb->csum_bad); in __skb_checksum_convert_check()
3287 static inline void __skb_checksum_convert(struct sk_buff *skb, in __skb_checksum_convert() argument
3290 skb->csum = ~pseudo; in __skb_checksum_convert()
3291 skb->ip_summed = CHECKSUM_COMPLETE; in __skb_checksum_convert()
3294 #define skb_checksum_try_convert(skb, proto, check, compute_pseudo) \ argument
3296 if (__skb_checksum_convert_check(skb)) \
3297 __skb_checksum_convert(skb, check, \
3298 compute_pseudo(skb, proto)); \
3301 static inline void skb_remcsum_adjust_partial(struct sk_buff *skb, void *ptr, in skb_remcsum_adjust_partial() argument
3304 skb->ip_summed = CHECKSUM_PARTIAL; in skb_remcsum_adjust_partial()
3305 skb->csum_start = ((unsigned char *)ptr + start) - skb->head; in skb_remcsum_adjust_partial()
3306 skb->csum_offset = offset - start; in skb_remcsum_adjust_partial()
3314 static inline void skb_remcsum_process(struct sk_buff *skb, void *ptr, in skb_remcsum_process() argument
3320 skb_remcsum_adjust_partial(skb, ptr, start, offset); in skb_remcsum_process()
3324 if (unlikely(skb->ip_summed != CHECKSUM_COMPLETE)) { in skb_remcsum_process()
3325 __skb_checksum_complete(skb); in skb_remcsum_process()
3326 skb_postpull_rcsum(skb, skb->data, ptr - (void *)skb->data); in skb_remcsum_process()
3329 delta = remcsum_adjust(ptr, skb->csum, start, offset); in skb_remcsum_process()
3332 skb->csum = csum_add(skb->csum, delta); in skb_remcsum_process()
3360 static inline void nf_reset(struct sk_buff *skb) in nf_reset() argument
3363 nf_conntrack_put(skb->nfct); in nf_reset()
3364 skb->nfct = NULL; in nf_reset()
3367 nf_bridge_put(skb->nf_bridge); in nf_reset()
3368 skb->nf_bridge = NULL; in nf_reset()
3372 static inline void nf_reset_trace(struct sk_buff *skb) in nf_reset_trace() argument
3375 skb->nf_trace = 0; in nf_reset_trace()
3416 static inline void skb_init_secmark(struct sk_buff *skb) in skb_init_secmark() argument
3418 skb->secmark = 0; in skb_init_secmark()
3424 static inline void skb_init_secmark(struct sk_buff *skb) in skb_init_secmark() argument
3428 static inline bool skb_irq_freeable(const struct sk_buff *skb) in skb_irq_freeable() argument
3430 return !skb->destructor && in skb_irq_freeable()
3432 !skb->sp && in skb_irq_freeable()
3435 !skb->nfct && in skb_irq_freeable()
3437 !skb->_skb_refdst && in skb_irq_freeable()
3438 !skb_has_frag_list(skb); in skb_irq_freeable()
3441 static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) in skb_set_queue_mapping() argument
3443 skb->queue_mapping = queue_mapping; in skb_set_queue_mapping()
3446 static inline u16 skb_get_queue_mapping(const struct sk_buff *skb) in skb_get_queue_mapping() argument
3448 return skb->queue_mapping; in skb_get_queue_mapping()
3456 static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue) in skb_record_rx_queue() argument
3458 skb->queue_mapping = rx_queue + 1; in skb_record_rx_queue()
3461 static inline u16 skb_get_rx_queue(const struct sk_buff *skb) in skb_get_rx_queue() argument
3463 return skb->queue_mapping - 1; in skb_get_rx_queue()
3466 static inline bool skb_rx_queue_recorded(const struct sk_buff *skb) in skb_rx_queue_recorded() argument
3468 return skb->queue_mapping != 0; in skb_rx_queue_recorded()
3471 static inline struct sec_path *skb_sec_path(struct sk_buff *skb) in skb_sec_path() argument
3474 return skb->sp; in skb_sec_path()
3492 #define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_SGO_CB_OFFSET)) argument
3500 static inline int gso_pskb_expand_head(struct sk_buff *skb, int extra) in gso_pskb_expand_head() argument
3505 headroom = skb_headroom(skb); in gso_pskb_expand_head()
3506 ret = pskb_expand_head(skb, extra, 0, GFP_ATOMIC); in gso_pskb_expand_head()
3510 new_headroom = skb_headroom(skb); in gso_pskb_expand_head()
3511 SKB_GSO_CB(skb)->mac_offset += (new_headroom - headroom); in gso_pskb_expand_head()
3523 static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res) in gso_make_checksum() argument
3525 int plen = SKB_GSO_CB(skb)->csum_start - skb_headroom(skb) - in gso_make_checksum()
3526 skb_transport_offset(skb); in gso_make_checksum()
3529 partial = csum_partial(skb_transport_header(skb), plen, skb->csum); in gso_make_checksum()
3530 skb->csum = res; in gso_make_checksum()
3531 SKB_GSO_CB(skb)->csum_start -= plen; in gso_make_checksum()
3536 static inline bool skb_is_gso(const struct sk_buff *skb) in skb_is_gso() argument
3538 return skb_shinfo(skb)->gso_size; in skb_is_gso()
3542 static inline bool skb_is_gso_v6(const struct sk_buff *skb) in skb_is_gso_v6() argument
3544 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; in skb_is_gso_v6()
3547 void __skb_warn_lro_forwarding(const struct sk_buff *skb);
3549 static inline bool skb_warn_if_lro(const struct sk_buff *skb) in skb_warn_if_lro() argument
3553 const struct skb_shared_info *shinfo = skb_shinfo(skb); in skb_warn_if_lro()
3555 if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 && in skb_warn_if_lro()
3557 __skb_warn_lro_forwarding(skb); in skb_warn_if_lro()
3563 static inline void skb_forward_csum(struct sk_buff *skb) in skb_forward_csum() argument
3566 if (skb->ip_summed == CHECKSUM_COMPLETE) in skb_forward_csum()
3567 skb->ip_summed = CHECKSUM_NONE; in skb_forward_csum()
3578 static inline void skb_checksum_none_assert(const struct sk_buff *skb) in skb_checksum_none_assert() argument
3581 BUG_ON(skb->ip_summed != CHECKSUM_NONE); in skb_checksum_none_assert()
3585 bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
3587 int skb_checksum_setup(struct sk_buff *skb, bool recalculate);
3588 struct sk_buff *skb_checksum_trimmed(struct sk_buff *skb,
3590 __sum16(*skb_chkf)(struct sk_buff *skb));
3601 static inline bool skb_head_is_locked(const struct sk_buff *skb) in skb_head_is_locked() argument
3603 return !skb->head_frag || skb_cloned(skb); in skb_head_is_locked()
3616 static inline unsigned int skb_gso_network_seglen(const struct sk_buff *skb) in skb_gso_network_seglen() argument
3618 unsigned int hdr_len = skb_transport_header(skb) - in skb_gso_network_seglen()
3619 skb_network_header(skb); in skb_gso_network_seglen()
3620 return hdr_len + skb_gso_transport_seglen(skb); in skb_gso_network_seglen()