Lines Matching refs:skb
546 void (*destructor)(struct sk_buff *skb);
693 static inline bool skb_pfmemalloc(const struct sk_buff *skb) in skb_pfmemalloc() argument
695 return unlikely(skb->pfmemalloc); in skb_pfmemalloc()
711 static inline struct dst_entry *skb_dst(const struct sk_buff *skb) in skb_dst() argument
716 WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) && in skb_dst()
719 return (struct dst_entry *)(skb->_skb_refdst & SKB_DST_PTRMASK); in skb_dst()
730 static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) in skb_dst_set() argument
732 skb->_skb_refdst = (unsigned long)dst; in skb_dst_set()
745 static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst) in skb_dst_set_noref() argument
748 skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF; in skb_dst_set_noref()
755 static inline bool skb_dst_is_noref(const struct sk_buff *skb) in skb_dst_is_noref() argument
757 return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb); in skb_dst_is_noref()
760 static inline struct rtable *skb_rtable(const struct sk_buff *skb) in skb_rtable() argument
762 return (struct rtable *)skb_dst(skb); in skb_rtable()
765 void kfree_skb(struct sk_buff *skb);
767 void skb_tx_error(struct sk_buff *skb);
768 void consume_skb(struct sk_buff *skb);
769 void __kfree_skb(struct sk_buff *skb);
772 void kfree_skb_partial(struct sk_buff *skb, bool head_stolen);
810 const struct sk_buff *skb) in skb_fclone_busy() argument
814 fclones = container_of(skb, struct sk_buff_fclones, skb1); in skb_fclone_busy()
816 return skb->fclone == SKB_FCLONE_ORIG && in skb_fclone_busy()
834 int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
835 struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority);
836 struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority);
837 struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom,
839 static inline struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, in __pskb_copy() argument
842 return __pskb_copy_fclone(skb, headroom, gfp_mask, false); in __pskb_copy()
845 int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask);
846 struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
848 struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom,
850 int skb_to_sgvec_nomark(struct sk_buff *skb, struct scatterlist *sg,
852 int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset,
854 int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
855 int skb_pad(struct sk_buff *skb, int pad);
858 int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
860 int len, int odd, struct sk_buff *skb),
873 void skb_prepare_seq_read(struct sk_buff *skb, unsigned int from,
879 unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
916 skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) in skb_set_hash() argument
918 skb->l4_hash = (type == PKT_HASH_TYPE_L4); in skb_set_hash()
919 skb->sw_hash = 0; in skb_set_hash()
920 skb->hash = hash; in skb_set_hash()
923 void __skb_get_hash(struct sk_buff *skb);
924 static inline __u32 skb_get_hash(struct sk_buff *skb) in skb_get_hash() argument
926 if (!skb->l4_hash && !skb->sw_hash) in skb_get_hash()
927 __skb_get_hash(skb); in skb_get_hash()
929 return skb->hash; in skb_get_hash()
932 static inline __u32 skb_get_hash_raw(const struct sk_buff *skb) in skb_get_hash_raw() argument
934 return skb->hash; in skb_get_hash_raw()
937 static inline void skb_clear_hash(struct sk_buff *skb) in skb_clear_hash() argument
939 skb->hash = 0; in skb_clear_hash()
940 skb->sw_hash = 0; in skb_clear_hash()
941 skb->l4_hash = 0; in skb_clear_hash()
944 static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb) in skb_clear_hash_if_not_l4() argument
946 if (!skb->l4_hash) in skb_clear_hash_if_not_l4()
947 skb_clear_hash(skb); in skb_clear_hash_if_not_l4()
957 static inline void skb_sender_cpu_clear(struct sk_buff *skb) in skb_sender_cpu_clear() argument
960 skb->sender_cpu = 0; in skb_sender_cpu_clear()
965 static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) in skb_end_pointer() argument
967 return skb->head + skb->end; in skb_end_pointer()
970 static inline unsigned int skb_end_offset(const struct sk_buff *skb) in skb_end_offset() argument
972 return skb->end; in skb_end_offset()
975 static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) in skb_end_pointer() argument
977 return skb->end; in skb_end_pointer()
980 static inline unsigned int skb_end_offset(const struct sk_buff *skb) in skb_end_offset() argument
982 return skb->end - skb->head; in skb_end_offset()
989 static inline struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb) in skb_hwtstamps() argument
991 return &skb_shinfo(skb)->hwtstamps; in skb_hwtstamps()
1013 const struct sk_buff *skb) in skb_queue_is_last() argument
1015 return skb->next == (const struct sk_buff *) list; in skb_queue_is_last()
1026 const struct sk_buff *skb) in skb_queue_is_first() argument
1028 return skb->prev == (const struct sk_buff *) list; in skb_queue_is_first()
1040 const struct sk_buff *skb) in skb_queue_next() argument
1045 BUG_ON(skb_queue_is_last(list, skb)); in skb_queue_next()
1046 return skb->next; in skb_queue_next()
1058 const struct sk_buff *skb) in skb_queue_prev() argument
1063 BUG_ON(skb_queue_is_first(list, skb)); in skb_queue_prev()
1064 return skb->prev; in skb_queue_prev()
1074 static inline struct sk_buff *skb_get(struct sk_buff *skb) in skb_get() argument
1076 atomic_inc(&skb->users); in skb_get()
1077 return skb; in skb_get()
1093 static inline int skb_cloned(const struct sk_buff *skb) in skb_cloned() argument
1095 return skb->cloned && in skb_cloned()
1096 (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1; in skb_cloned()
1099 static inline int skb_unclone(struct sk_buff *skb, gfp_t pri) in skb_unclone() argument
1103 if (skb_cloned(skb)) in skb_unclone()
1104 return pskb_expand_head(skb, 0, 0, pri); in skb_unclone()
1116 static inline int skb_header_cloned(const struct sk_buff *skb) in skb_header_cloned() argument
1120 if (!skb->cloned) in skb_header_cloned()
1123 dataref = atomic_read(&skb_shinfo(skb)->dataref); in skb_header_cloned()
1137 static inline void skb_header_release(struct sk_buff *skb) in skb_header_release() argument
1139 BUG_ON(skb->nohdr); in skb_header_release()
1140 skb->nohdr = 1; in skb_header_release()
1141 atomic_add(1 << SKB_DATAREF_SHIFT, &skb_shinfo(skb)->dataref); in skb_header_release()
1151 static inline void __skb_header_release(struct sk_buff *skb) in __skb_header_release() argument
1153 skb->nohdr = 1; in __skb_header_release()
1154 atomic_set(&skb_shinfo(skb)->dataref, 1 + (1 << SKB_DATAREF_SHIFT)); in __skb_header_release()
1165 static inline int skb_shared(const struct sk_buff *skb) in skb_shared() argument
1167 return atomic_read(&skb->users) != 1; in skb_shared()
1183 static inline struct sk_buff *skb_share_check(struct sk_buff *skb, gfp_t pri) in skb_share_check() argument
1186 if (skb_shared(skb)) { in skb_share_check()
1187 struct sk_buff *nskb = skb_clone(skb, pri); in skb_share_check()
1190 consume_skb(skb); in skb_share_check()
1192 kfree_skb(skb); in skb_share_check()
1193 skb = nskb; in skb_share_check()
1195 return skb; in skb_share_check()
1218 static inline struct sk_buff *skb_unshare(struct sk_buff *skb, in skb_unshare() argument
1222 if (skb_cloned(skb)) { in skb_unshare()
1223 struct sk_buff *nskb = skb_copy(skb, pri); in skb_unshare()
1227 consume_skb(skb); in skb_unshare()
1229 kfree_skb(skb); in skb_unshare()
1230 skb = nskb; in skb_unshare()
1232 return skb; in skb_unshare()
1250 struct sk_buff *skb = list_->next; in skb_peek() local
1252 if (skb == (struct sk_buff *)list_) in skb_peek()
1253 skb = NULL; in skb_peek()
1254 return skb; in skb_peek()
1266 static inline struct sk_buff *skb_peek_next(struct sk_buff *skb, in skb_peek_next() argument
1269 struct sk_buff *next = skb->next; in skb_peek_next()
1291 struct sk_buff *skb = list_->prev; in skb_peek_tail() local
1293 if (skb == (struct sk_buff *)list_) in skb_peek_tail()
1294 skb = NULL; in skb_peek_tail()
1295 return skb; in skb_peek_tail()
1508 void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list);
1509 static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) in __skb_unlink() argument
1514 next = skb->next; in __skb_unlink()
1515 prev = skb->prev; in __skb_unlink()
1516 skb->next = skb->prev = NULL; in __skb_unlink()
1532 struct sk_buff *skb = skb_peek(list); in __skb_dequeue() local
1533 if (skb) in __skb_dequeue()
1534 __skb_unlink(skb, list); in __skb_dequeue()
1535 return skb; in __skb_dequeue()
1549 struct sk_buff *skb = skb_peek_tail(list); in __skb_dequeue_tail() local
1550 if (skb) in __skb_dequeue_tail()
1551 __skb_unlink(skb, list); in __skb_dequeue_tail()
1552 return skb; in __skb_dequeue_tail()
1556 static inline bool skb_is_nonlinear(const struct sk_buff *skb) in skb_is_nonlinear() argument
1558 return skb->data_len; in skb_is_nonlinear()
1561 static inline unsigned int skb_headlen(const struct sk_buff *skb) in skb_headlen() argument
1563 return skb->len - skb->data_len; in skb_headlen()
1566 static inline int skb_pagelen(const struct sk_buff *skb) in skb_pagelen() argument
1570 for (i = (int)skb_shinfo(skb)->nr_frags - 1; i >= 0; i--) in skb_pagelen()
1571 len += skb_frag_size(&skb_shinfo(skb)->frags[i]); in skb_pagelen()
1572 return len + skb_headlen(skb); in skb_pagelen()
1588 static inline void __skb_fill_page_desc(struct sk_buff *skb, int i, in __skb_fill_page_desc() argument
1591 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; in __skb_fill_page_desc()
1604 skb->pfmemalloc = true; in __skb_fill_page_desc()
1621 static inline void skb_fill_page_desc(struct sk_buff *skb, int i, in skb_fill_page_desc() argument
1624 __skb_fill_page_desc(skb, i, page, off, size); in skb_fill_page_desc()
1625 skb_shinfo(skb)->nr_frags = i + 1; in skb_fill_page_desc()
1628 void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,
1631 void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size,
1634 #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) argument
1635 #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) argument
1636 #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) argument
1639 static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) in skb_tail_pointer() argument
1641 return skb->head + skb->tail; in skb_tail_pointer()
1644 static inline void skb_reset_tail_pointer(struct sk_buff *skb) in skb_reset_tail_pointer() argument
1646 skb->tail = skb->data - skb->head; in skb_reset_tail_pointer()
1649 static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) in skb_set_tail_pointer() argument
1651 skb_reset_tail_pointer(skb); in skb_set_tail_pointer()
1652 skb->tail += offset; in skb_set_tail_pointer()
1656 static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) in skb_tail_pointer() argument
1658 return skb->tail; in skb_tail_pointer()
1661 static inline void skb_reset_tail_pointer(struct sk_buff *skb) in skb_reset_tail_pointer() argument
1663 skb->tail = skb->data; in skb_reset_tail_pointer()
1666 static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) in skb_set_tail_pointer() argument
1668 skb->tail = skb->data + offset; in skb_set_tail_pointer()
1676 unsigned char *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
1677 unsigned char *skb_put(struct sk_buff *skb, unsigned int len);
1678 static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) in __skb_put() argument
1680 unsigned char *tmp = skb_tail_pointer(skb); in __skb_put()
1681 SKB_LINEAR_ASSERT(skb); in __skb_put()
1682 skb->tail += len; in __skb_put()
1683 skb->len += len; in __skb_put()
1687 unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
1688 static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) in __skb_push() argument
1690 skb->data -= len; in __skb_push()
1691 skb->len += len; in __skb_push()
1692 return skb->data; in __skb_push()
1695 unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
1696 static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) in __skb_pull() argument
1698 skb->len -= len; in __skb_pull()
1699 BUG_ON(skb->len < skb->data_len); in __skb_pull()
1700 return skb->data += len; in __skb_pull()
1703 static inline unsigned char *skb_pull_inline(struct sk_buff *skb, unsigned int len) in skb_pull_inline() argument
1705 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len); in skb_pull_inline()
1708 unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
1710 static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) in __pskb_pull() argument
1712 if (len > skb_headlen(skb) && in __pskb_pull()
1713 !__pskb_pull_tail(skb, len - skb_headlen(skb))) in __pskb_pull()
1715 skb->len -= len; in __pskb_pull()
1716 return skb->data += len; in __pskb_pull()
1719 static inline unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len) in pskb_pull() argument
1721 return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len); in pskb_pull()
1724 static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len) in pskb_may_pull() argument
1726 if (likely(len <= skb_headlen(skb))) in pskb_may_pull()
1728 if (unlikely(len > skb->len)) in pskb_may_pull()
1730 return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL; in pskb_may_pull()
1739 static inline unsigned int skb_headroom(const struct sk_buff *skb) in skb_headroom() argument
1741 return skb->data - skb->head; in skb_headroom()
1750 static inline int skb_tailroom(const struct sk_buff *skb) in skb_tailroom() argument
1752 return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail; in skb_tailroom()
1762 static inline int skb_availroom(const struct sk_buff *skb) in skb_availroom() argument
1764 if (skb_is_nonlinear(skb)) in skb_availroom()
1767 return skb->end - skb->tail - skb->reserved_tailroom; in skb_availroom()
1778 static inline void skb_reserve(struct sk_buff *skb, int len) in skb_reserve() argument
1780 skb->data += len; in skb_reserve()
1781 skb->tail += len; in skb_reserve()
1787 static inline void skb_set_inner_protocol(struct sk_buff *skb, in skb_set_inner_protocol() argument
1790 skb->inner_protocol = protocol; in skb_set_inner_protocol()
1791 skb->inner_protocol_type = ENCAP_TYPE_ETHER; in skb_set_inner_protocol()
1794 static inline void skb_set_inner_ipproto(struct sk_buff *skb, in skb_set_inner_ipproto() argument
1797 skb->inner_ipproto = ipproto; in skb_set_inner_ipproto()
1798 skb->inner_protocol_type = ENCAP_TYPE_IPPROTO; in skb_set_inner_ipproto()
1801 static inline void skb_reset_inner_headers(struct sk_buff *skb) in skb_reset_inner_headers() argument
1803 skb->inner_mac_header = skb->mac_header; in skb_reset_inner_headers()
1804 skb->inner_network_header = skb->network_header; in skb_reset_inner_headers()
1805 skb->inner_transport_header = skb->transport_header; in skb_reset_inner_headers()
1808 static inline void skb_reset_mac_len(struct sk_buff *skb) in skb_reset_mac_len() argument
1810 skb->mac_len = skb->network_header - skb->mac_header; in skb_reset_mac_len()
1814 *skb) in skb_inner_transport_header()
1816 return skb->head + skb->inner_transport_header; in skb_inner_transport_header()
1819 static inline void skb_reset_inner_transport_header(struct sk_buff *skb) in skb_reset_inner_transport_header() argument
1821 skb->inner_transport_header = skb->data - skb->head; in skb_reset_inner_transport_header()
1824 static inline void skb_set_inner_transport_header(struct sk_buff *skb, in skb_set_inner_transport_header() argument
1827 skb_reset_inner_transport_header(skb); in skb_set_inner_transport_header()
1828 skb->inner_transport_header += offset; in skb_set_inner_transport_header()
1831 static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb) in skb_inner_network_header() argument
1833 return skb->head + skb->inner_network_header; in skb_inner_network_header()
1836 static inline void skb_reset_inner_network_header(struct sk_buff *skb) in skb_reset_inner_network_header() argument
1838 skb->inner_network_header = skb->data - skb->head; in skb_reset_inner_network_header()
1841 static inline void skb_set_inner_network_header(struct sk_buff *skb, in skb_set_inner_network_header() argument
1844 skb_reset_inner_network_header(skb); in skb_set_inner_network_header()
1845 skb->inner_network_header += offset; in skb_set_inner_network_header()
1848 static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) in skb_inner_mac_header() argument
1850 return skb->head + skb->inner_mac_header; in skb_inner_mac_header()
1853 static inline void skb_reset_inner_mac_header(struct sk_buff *skb) in skb_reset_inner_mac_header() argument
1855 skb->inner_mac_header = skb->data - skb->head; in skb_reset_inner_mac_header()
1858 static inline void skb_set_inner_mac_header(struct sk_buff *skb, in skb_set_inner_mac_header() argument
1861 skb_reset_inner_mac_header(skb); in skb_set_inner_mac_header()
1862 skb->inner_mac_header += offset; in skb_set_inner_mac_header()
1864 static inline bool skb_transport_header_was_set(const struct sk_buff *skb) in skb_transport_header_was_set() argument
1866 return skb->transport_header != (typeof(skb->transport_header))~0U; in skb_transport_header_was_set()
1869 static inline unsigned char *skb_transport_header(const struct sk_buff *skb) in skb_transport_header() argument
1871 return skb->head + skb->transport_header; in skb_transport_header()
1874 static inline void skb_reset_transport_header(struct sk_buff *skb) in skb_reset_transport_header() argument
1876 skb->transport_header = skb->data - skb->head; in skb_reset_transport_header()
1879 static inline void skb_set_transport_header(struct sk_buff *skb, in skb_set_transport_header() argument
1882 skb_reset_transport_header(skb); in skb_set_transport_header()
1883 skb->transport_header += offset; in skb_set_transport_header()
1886 static inline unsigned char *skb_network_header(const struct sk_buff *skb) in skb_network_header() argument
1888 return skb->head + skb->network_header; in skb_network_header()
1891 static inline void skb_reset_network_header(struct sk_buff *skb) in skb_reset_network_header() argument
1893 skb->network_header = skb->data - skb->head; in skb_reset_network_header()
1896 static inline void skb_set_network_header(struct sk_buff *skb, const int offset) in skb_set_network_header() argument
1898 skb_reset_network_header(skb); in skb_set_network_header()
1899 skb->network_header += offset; in skb_set_network_header()
1902 static inline unsigned char *skb_mac_header(const struct sk_buff *skb) in skb_mac_header() argument
1904 return skb->head + skb->mac_header; in skb_mac_header()
1907 static inline int skb_mac_header_was_set(const struct sk_buff *skb) in skb_mac_header_was_set() argument
1909 return skb->mac_header != (typeof(skb->mac_header))~0U; in skb_mac_header_was_set()
1912 static inline void skb_reset_mac_header(struct sk_buff *skb) in skb_reset_mac_header() argument
1914 skb->mac_header = skb->data - skb->head; in skb_reset_mac_header()
1917 static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) in skb_set_mac_header() argument
1919 skb_reset_mac_header(skb); in skb_set_mac_header()
1920 skb->mac_header += offset; in skb_set_mac_header()
1923 static inline void skb_pop_mac_header(struct sk_buff *skb) in skb_pop_mac_header() argument
1925 skb->mac_header = skb->network_header; in skb_pop_mac_header()
1928 static inline void skb_probe_transport_header(struct sk_buff *skb, in skb_probe_transport_header() argument
1933 if (skb_transport_header_was_set(skb)) in skb_probe_transport_header()
1935 else if (skb_flow_dissect(skb, &keys)) in skb_probe_transport_header()
1936 skb_set_transport_header(skb, keys.thoff); in skb_probe_transport_header()
1938 skb_set_transport_header(skb, offset_hint); in skb_probe_transport_header()
1941 static inline void skb_mac_header_rebuild(struct sk_buff *skb) in skb_mac_header_rebuild() argument
1943 if (skb_mac_header_was_set(skb)) { in skb_mac_header_rebuild()
1944 const unsigned char *old_mac = skb_mac_header(skb); in skb_mac_header_rebuild()
1946 skb_set_mac_header(skb, -skb->mac_len); in skb_mac_header_rebuild()
1947 memmove(skb_mac_header(skb), old_mac, skb->mac_len); in skb_mac_header_rebuild()
1951 static inline int skb_checksum_start_offset(const struct sk_buff *skb) in skb_checksum_start_offset() argument
1953 return skb->csum_start - skb_headroom(skb); in skb_checksum_start_offset()
1956 static inline int skb_transport_offset(const struct sk_buff *skb) in skb_transport_offset() argument
1958 return skb_transport_header(skb) - skb->data; in skb_transport_offset()
1961 static inline u32 skb_network_header_len(const struct sk_buff *skb) in skb_network_header_len() argument
1963 return skb->transport_header - skb->network_header; in skb_network_header_len()
1966 static inline u32 skb_inner_network_header_len(const struct sk_buff *skb) in skb_inner_network_header_len() argument
1968 return skb->inner_transport_header - skb->inner_network_header; in skb_inner_network_header_len()
1971 static inline int skb_network_offset(const struct sk_buff *skb) in skb_network_offset() argument
1973 return skb_network_header(skb) - skb->data; in skb_network_offset()
1976 static inline int skb_inner_network_offset(const struct sk_buff *skb) in skb_inner_network_offset() argument
1978 return skb_inner_network_header(skb) - skb->data; in skb_inner_network_offset()
1981 static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len) in pskb_network_may_pull() argument
1983 return pskb_may_pull(skb, skb_network_offset(skb) + len); in pskb_network_may_pull()
2034 int ___pskb_trim(struct sk_buff *skb, unsigned int len);
2036 static inline void __skb_trim(struct sk_buff *skb, unsigned int len) in __skb_trim() argument
2038 if (unlikely(skb_is_nonlinear(skb))) { in __skb_trim()
2042 skb->len = len; in __skb_trim()
2043 skb_set_tail_pointer(skb, len); in __skb_trim()
2046 void skb_trim(struct sk_buff *skb, unsigned int len);
2048 static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) in __pskb_trim() argument
2050 if (skb->data_len) in __pskb_trim()
2051 return ___pskb_trim(skb, len); in __pskb_trim()
2052 __skb_trim(skb, len); in __pskb_trim()
2056 static inline int pskb_trim(struct sk_buff *skb, unsigned int len) in pskb_trim() argument
2058 return (len < skb->len) ? __pskb_trim(skb, len) : 0; in pskb_trim()
2070 static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len) in pskb_trim_unique() argument
2072 int err = pskb_trim(skb, len); in pskb_trim_unique()
2084 static inline void skb_orphan(struct sk_buff *skb) in skb_orphan() argument
2086 if (skb->destructor) { in skb_orphan()
2087 skb->destructor(skb); in skb_orphan()
2088 skb->destructor = NULL; in skb_orphan()
2089 skb->sk = NULL; in skb_orphan()
2091 BUG_ON(skb->sk); in skb_orphan()
2104 static inline int skb_orphan_frags(struct sk_buff *skb, gfp_t gfp_mask) in skb_orphan_frags() argument
2106 if (likely(!(skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY))) in skb_orphan_frags()
2108 return skb_copy_ubufs(skb, gfp_mask); in skb_orphan_frags()
2122 struct sk_buff *skb; in __skb_queue_purge() local
2123 while ((skb = __skb_dequeue(list)) != NULL) in __skb_queue_purge()
2124 kfree_skb(skb); in __skb_queue_purge()
2172 struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); in __netdev_alloc_skb_ip_align() local
2174 if (NET_IP_ALIGN && skb) in __netdev_alloc_skb_ip_align()
2175 skb_reserve(skb, NET_IP_ALIGN); in __netdev_alloc_skb_ip_align()
2176 return skb; in __netdev_alloc_skb_ip_align()
2248 struct sk_buff *skb) in skb_propagate_pfmemalloc() argument
2251 skb->pfmemalloc = true; in skb_propagate_pfmemalloc()
2283 static inline void skb_frag_ref(struct sk_buff *skb, int f) in skb_frag_ref() argument
2285 __skb_frag_ref(&skb_shinfo(skb)->frags[f]); in skb_frag_ref()
2306 static inline void skb_frag_unref(struct sk_buff *skb, int f) in skb_frag_unref() argument
2308 __skb_frag_unref(&skb_shinfo(skb)->frags[f]); in skb_frag_unref()
2359 static inline void skb_frag_set_page(struct sk_buff *skb, int f, in skb_frag_set_page() argument
2362 __skb_frag_set_page(&skb_shinfo(skb)->frags[f], page); in skb_frag_set_page()
2387 static inline struct sk_buff *pskb_copy(struct sk_buff *skb, in pskb_copy() argument
2390 return __pskb_copy(skb, skb_headroom(skb), gfp_mask); in pskb_copy()
2394 static inline struct sk_buff *pskb_copy_for_clone(struct sk_buff *skb, in pskb_copy_for_clone() argument
2397 return __pskb_copy_fclone(skb, skb_headroom(skb), gfp_mask, true); in pskb_copy_for_clone()
2409 static inline int skb_clone_writable(const struct sk_buff *skb, unsigned int len) in skb_clone_writable() argument
2411 return !skb_header_cloned(skb) && in skb_clone_writable()
2412 skb_headroom(skb) + len <= skb->hdr_len; in skb_clone_writable()
2415 static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom, in __skb_cow() argument
2420 if (headroom > skb_headroom(skb)) in __skb_cow()
2421 delta = headroom - skb_headroom(skb); in __skb_cow()
2424 return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0, in __skb_cow()
2441 static inline int skb_cow(struct sk_buff *skb, unsigned int headroom) in skb_cow() argument
2443 return __skb_cow(skb, headroom, skb_cloned(skb)); in skb_cow()
2456 static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom) in skb_cow_head() argument
2458 return __skb_cow(skb, headroom, skb_header_cloned(skb)); in skb_cow_head()
2471 static inline int skb_padto(struct sk_buff *skb, unsigned int len) in skb_padto() argument
2473 unsigned int size = skb->len; in skb_padto()
2476 return skb_pad(skb, len - size); in skb_padto()
2489 static inline int skb_put_padto(struct sk_buff *skb, unsigned int len) in skb_put_padto() argument
2491 unsigned int size = skb->len; in skb_put_padto()
2495 if (skb_pad(skb, len)) in skb_put_padto()
2497 __skb_put(skb, len); in skb_put_padto()
2502 static inline int skb_add_data(struct sk_buff *skb, in skb_add_data() argument
2505 const int off = skb->len; in skb_add_data()
2507 if (skb->ip_summed == CHECKSUM_NONE) { in skb_add_data()
2509 if (csum_and_copy_from_iter(skb_put(skb, copy), copy, in skb_add_data()
2511 skb->csum = csum_block_add(skb->csum, csum, off); in skb_add_data()
2514 } else if (copy_from_iter(skb_put(skb, copy), copy, from) == copy) in skb_add_data()
2517 __skb_trim(skb, off); in skb_add_data()
2521 static inline bool skb_can_coalesce(struct sk_buff *skb, int i, in skb_can_coalesce() argument
2525 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1]; in skb_can_coalesce()
2533 static inline int __skb_linearize(struct sk_buff *skb) in __skb_linearize() argument
2535 return __pskb_pull_tail(skb, skb->data_len) ? 0 : -ENOMEM; in __skb_linearize()
2545 static inline int skb_linearize(struct sk_buff *skb) in skb_linearize() argument
2547 return skb_is_nonlinear(skb) ? __skb_linearize(skb) : 0; in skb_linearize()
2557 static inline bool skb_has_shared_frag(const struct sk_buff *skb) in skb_has_shared_frag() argument
2559 return skb_is_nonlinear(skb) && in skb_has_shared_frag()
2560 skb_shinfo(skb)->tx_flags & SKBTX_SHARED_FRAG; in skb_has_shared_frag()
2570 static inline int skb_linearize_cow(struct sk_buff *skb) in skb_linearize_cow() argument
2572 return skb_is_nonlinear(skb) || skb_cloned(skb) ? in skb_linearize_cow()
2573 __skb_linearize(skb) : 0; in skb_linearize_cow()
2587 static inline void skb_postpull_rcsum(struct sk_buff *skb, in skb_postpull_rcsum() argument
2590 if (skb->ip_summed == CHECKSUM_COMPLETE) in skb_postpull_rcsum()
2591 skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); in skb_postpull_rcsum()
2592 else if (skb->ip_summed == CHECKSUM_PARTIAL && in skb_postpull_rcsum()
2593 skb_checksum_start_offset(skb) < 0) in skb_postpull_rcsum()
2594 skb->ip_summed = CHECKSUM_NONE; in skb_postpull_rcsum()
2597 unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
2608 static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) in pskb_trim_rcsum() argument
2610 if (likely(len >= skb->len)) in pskb_trim_rcsum()
2612 if (skb->ip_summed == CHECKSUM_COMPLETE) in pskb_trim_rcsum()
2613 skb->ip_summed = CHECKSUM_NONE; in pskb_trim_rcsum()
2614 return __pskb_trim(skb, len); in pskb_trim_rcsum()
2617 #define skb_queue_walk(queue, skb) \ argument
2618 for (skb = (queue)->next; \
2619 skb != (struct sk_buff *)(queue); \
2620 skb = skb->next)
2622 #define skb_queue_walk_safe(queue, skb, tmp) \ argument
2623 for (skb = (queue)->next, tmp = skb->next; \
2624 skb != (struct sk_buff *)(queue); \
2625 skb = tmp, tmp = skb->next)
2627 #define skb_queue_walk_from(queue, skb) \ argument
2628 for (; skb != (struct sk_buff *)(queue); \
2629 skb = skb->next)
2631 #define skb_queue_walk_from_safe(queue, skb, tmp) \ argument
2632 for (tmp = skb->next; \
2633 skb != (struct sk_buff *)(queue); \
2634 skb = tmp, tmp = skb->next)
2636 #define skb_queue_reverse_walk(queue, skb) \ argument
2637 for (skb = (queue)->prev; \
2638 skb != (struct sk_buff *)(queue); \
2639 skb = skb->prev)
2641 #define skb_queue_reverse_walk_safe(queue, skb, tmp) \ argument
2642 for (skb = (queue)->prev, tmp = skb->prev; \
2643 skb != (struct sk_buff *)(queue); \
2644 skb = tmp, tmp = skb->prev)
2646 #define skb_queue_reverse_walk_from_safe(queue, skb, tmp) \ argument
2647 for (tmp = skb->prev; \
2648 skb != (struct sk_buff *)(queue); \
2649 skb = tmp, tmp = skb->prev)
2651 static inline bool skb_has_frag_list(const struct sk_buff *skb) in skb_has_frag_list() argument
2653 return skb_shinfo(skb)->frag_list != NULL; in skb_has_frag_list()
2656 static inline void skb_frag_list_init(struct sk_buff *skb) in skb_frag_list_init() argument
2658 skb_shinfo(skb)->frag_list = NULL; in skb_frag_list_init()
2661 static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag) in skb_frag_add_head() argument
2663 frag->next = skb_shinfo(skb)->frag_list; in skb_frag_add_head()
2664 skb_shinfo(skb)->frag_list = frag; in skb_frag_add_head()
2667 #define skb_walk_frags(skb, iter) \ argument
2668 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
2683 int skb_copy_and_csum_datagram_msg(struct sk_buff *skb, int hlen,
2685 int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
2687 int zerocopy_sg_from_iter(struct sk_buff *skb, struct iov_iter *frm);
2688 void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
2689 void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb);
2690 int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags);
2691 int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);
2692 int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len);
2693 __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, u8 *to,
2695 int skb_splice_bits(struct sk_buff *skb, unsigned int offset,
2698 void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
2702 void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len);
2703 int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
2704 void skb_scrub_packet(struct sk_buff *skb, bool xnet);
2705 unsigned int skb_gso_transport_seglen(const struct sk_buff *skb);
2706 struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
2707 struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
2708 int skb_ensure_writable(struct sk_buff *skb, int write_len);
2709 int skb_vlan_pop(struct sk_buff *skb);
2710 int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
2727 __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
2729 __wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
2732 static inline void *__skb_header_pointer(const struct sk_buff *skb, int offset, in __skb_header_pointer() argument
2738 if (!skb || in __skb_header_pointer()
2739 skb_copy_bits(skb, offset, buffer, len) < 0) in __skb_header_pointer()
2745 static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, in skb_header_pointer() argument
2748 return __skb_header_pointer(skb, offset, len, skb->data, in skb_header_pointer()
2749 skb_headlen(skb), buffer); in skb_header_pointer()
2762 static inline bool skb_needs_linearize(struct sk_buff *skb, in skb_needs_linearize() argument
2765 return skb_is_nonlinear(skb) && in skb_needs_linearize()
2766 ((skb_has_frag_list(skb) && !(features & NETIF_F_FRAGLIST)) || in skb_needs_linearize()
2767 (skb_shinfo(skb)->nr_frags && !(features & NETIF_F_SG))); in skb_needs_linearize()
2770 static inline void skb_copy_from_linear_data(const struct sk_buff *skb, in skb_copy_from_linear_data() argument
2774 memcpy(to, skb->data, len); in skb_copy_from_linear_data()
2777 static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb, in skb_copy_from_linear_data_offset() argument
2781 memcpy(to, skb->data + offset, len); in skb_copy_from_linear_data_offset()
2784 static inline void skb_copy_to_linear_data(struct sk_buff *skb, in skb_copy_to_linear_data() argument
2788 memcpy(skb->data, from, len); in skb_copy_to_linear_data()
2791 static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb, in skb_copy_to_linear_data_offset() argument
2796 memcpy(skb->data + offset, from, len); in skb_copy_to_linear_data_offset()
2801 static inline ktime_t skb_get_ktime(const struct sk_buff *skb) in skb_get_ktime() argument
2803 return skb->tstamp; in skb_get_ktime()
2815 static inline void skb_get_timestamp(const struct sk_buff *skb, in skb_get_timestamp() argument
2818 *stamp = ktime_to_timeval(skb->tstamp); in skb_get_timestamp()
2821 static inline void skb_get_timestampns(const struct sk_buff *skb, in skb_get_timestampns() argument
2824 *stamp = ktime_to_timespec(skb->tstamp); in skb_get_timestampns()
2827 static inline void __net_timestamp(struct sk_buff *skb) in __net_timestamp() argument
2829 skb->tstamp = ktime_get_real(); in __net_timestamp()
2842 struct sk_buff *skb_clone_sk(struct sk_buff *skb);
2846 void skb_clone_tx_timestamp(struct sk_buff *skb);
2847 bool skb_defer_rx_timestamp(struct sk_buff *skb);
2851 static inline void skb_clone_tx_timestamp(struct sk_buff *skb) in skb_clone_tx_timestamp() argument
2855 static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) in skb_defer_rx_timestamp() argument
2874 void skb_complete_tx_timestamp(struct sk_buff *skb,
2895 static inline void sw_tx_timestamp(struct sk_buff *skb) in sw_tx_timestamp() argument
2897 if (skb_shinfo(skb)->tx_flags & SKBTX_SW_TSTAMP && in sw_tx_timestamp()
2898 !(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) in sw_tx_timestamp()
2899 skb_tstamp_tx(skb, NULL); in sw_tx_timestamp()
2914 static inline void skb_tx_timestamp(struct sk_buff *skb) in skb_tx_timestamp() argument
2916 skb_clone_tx_timestamp(skb); in skb_tx_timestamp()
2917 sw_tx_timestamp(skb); in skb_tx_timestamp()
2927 void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
2929 __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
2930 __sum16 __skb_checksum_complete(struct sk_buff *skb);
2932 static inline int skb_csum_unnecessary(const struct sk_buff *skb) in skb_csum_unnecessary() argument
2934 return ((skb->ip_summed == CHECKSUM_UNNECESSARY) || in skb_csum_unnecessary()
2935 skb->csum_valid || in skb_csum_unnecessary()
2936 (skb->ip_summed == CHECKSUM_PARTIAL && in skb_csum_unnecessary()
2937 skb_checksum_start_offset(skb) >= 0)); in skb_csum_unnecessary()
2956 static inline __sum16 skb_checksum_complete(struct sk_buff *skb) in skb_checksum_complete() argument
2958 return skb_csum_unnecessary(skb) ? in skb_checksum_complete()
2959 0 : __skb_checksum_complete(skb); in skb_checksum_complete()
2962 static inline void __skb_decr_checksum_unnecessary(struct sk_buff *skb) in __skb_decr_checksum_unnecessary() argument
2964 if (skb->ip_summed == CHECKSUM_UNNECESSARY) { in __skb_decr_checksum_unnecessary()
2965 if (skb->csum_level == 0) in __skb_decr_checksum_unnecessary()
2966 skb->ip_summed = CHECKSUM_NONE; in __skb_decr_checksum_unnecessary()
2968 skb->csum_level--; in __skb_decr_checksum_unnecessary()
2972 static inline void __skb_incr_checksum_unnecessary(struct sk_buff *skb) in __skb_incr_checksum_unnecessary() argument
2974 if (skb->ip_summed == CHECKSUM_UNNECESSARY) { in __skb_incr_checksum_unnecessary()
2975 if (skb->csum_level < SKB_MAX_CSUM_LEVEL) in __skb_incr_checksum_unnecessary()
2976 skb->csum_level++; in __skb_incr_checksum_unnecessary()
2977 } else if (skb->ip_summed == CHECKSUM_NONE) { in __skb_incr_checksum_unnecessary()
2978 skb->ip_summed = CHECKSUM_UNNECESSARY; in __skb_incr_checksum_unnecessary()
2979 skb->csum_level = 0; in __skb_incr_checksum_unnecessary()
2983 static inline void __skb_mark_checksum_bad(struct sk_buff *skb) in __skb_mark_checksum_bad() argument
2993 if (skb->ip_summed == CHECKSUM_NONE || in __skb_mark_checksum_bad()
2994 skb->ip_summed == CHECKSUM_UNNECESSARY) in __skb_mark_checksum_bad()
2995 skb->csum_bad = 1; in __skb_mark_checksum_bad()
3003 static inline bool __skb_checksum_validate_needed(struct sk_buff *skb, in __skb_checksum_validate_needed() argument
3007 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) { in __skb_checksum_validate_needed()
3008 skb->csum_valid = 1; in __skb_checksum_validate_needed()
3009 __skb_decr_checksum_unnecessary(skb); in __skb_checksum_validate_needed()
3027 static inline void skb_checksum_complete_unset(struct sk_buff *skb) in skb_checksum_complete_unset() argument
3029 if (skb->ip_summed == CHECKSUM_COMPLETE) in skb_checksum_complete_unset()
3030 skb->ip_summed = CHECKSUM_NONE; in skb_checksum_complete_unset()
3042 static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb, in __skb_checksum_validate_complete() argument
3046 if (skb->ip_summed == CHECKSUM_COMPLETE) { in __skb_checksum_validate_complete()
3047 if (!csum_fold(csum_add(psum, skb->csum))) { in __skb_checksum_validate_complete()
3048 skb->csum_valid = 1; in __skb_checksum_validate_complete()
3051 } else if (skb->csum_bad) { in __skb_checksum_validate_complete()
3056 skb->csum = psum; in __skb_checksum_validate_complete()
3058 if (complete || skb->len <= CHECKSUM_BREAK) { in __skb_checksum_validate_complete()
3061 csum = __skb_checksum_complete(skb); in __skb_checksum_validate_complete()
3062 skb->csum_valid = !csum; in __skb_checksum_validate_complete()
3069 static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto) in null_compute_pseudo() argument
3084 #define __skb_checksum_validate(skb, proto, complete, \ argument
3088 skb->csum_valid = 0; \
3089 if (__skb_checksum_validate_needed(skb, zero_okay, check)) \
3090 __ret = __skb_checksum_validate_complete(skb, \
3091 complete, compute_pseudo(skb, proto)); \
3095 #define skb_checksum_init(skb, proto, compute_pseudo) \ argument
3096 __skb_checksum_validate(skb, proto, false, false, 0, compute_pseudo)
3098 #define skb_checksum_init_zero_check(skb, proto, check, compute_pseudo) \ argument
3099 __skb_checksum_validate(skb, proto, false, true, check, compute_pseudo)
3101 #define skb_checksum_validate(skb, proto, compute_pseudo) \ argument
3102 __skb_checksum_validate(skb, proto, true, false, 0, compute_pseudo)
3104 #define skb_checksum_validate_zero_check(skb, proto, check, \ argument
3106 __skb_checksum_validate(skb, proto, true, true, check, compute_pseudo)
3108 #define skb_checksum_simple_validate(skb) \ argument
3109 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo)
3111 static inline bool __skb_checksum_convert_check(struct sk_buff *skb) in __skb_checksum_convert_check() argument
3113 return (skb->ip_summed == CHECKSUM_NONE && in __skb_checksum_convert_check()
3114 skb->csum_valid && !skb->csum_bad); in __skb_checksum_convert_check()
3117 static inline void __skb_checksum_convert(struct sk_buff *skb, in __skb_checksum_convert() argument
3120 skb->csum = ~pseudo; in __skb_checksum_convert()
3121 skb->ip_summed = CHECKSUM_COMPLETE; in __skb_checksum_convert()
3124 #define skb_checksum_try_convert(skb, proto, check, compute_pseudo) \ argument
3126 if (__skb_checksum_convert_check(skb)) \
3127 __skb_checksum_convert(skb, check, \
3128 compute_pseudo(skb, proto)); \
3131 static inline void skb_remcsum_adjust_partial(struct sk_buff *skb, void *ptr, in skb_remcsum_adjust_partial() argument
3134 skb->ip_summed = CHECKSUM_PARTIAL; in skb_remcsum_adjust_partial()
3135 skb->csum_start = ((unsigned char *)ptr + start) - skb->head; in skb_remcsum_adjust_partial()
3136 skb->csum_offset = offset - start; in skb_remcsum_adjust_partial()
3144 static inline void skb_remcsum_process(struct sk_buff *skb, void *ptr, in skb_remcsum_process() argument
3150 skb_remcsum_adjust_partial(skb, ptr, start, offset); in skb_remcsum_process()
3154 if (unlikely(skb->ip_summed != CHECKSUM_COMPLETE)) { in skb_remcsum_process()
3155 __skb_checksum_complete(skb); in skb_remcsum_process()
3156 skb_postpull_rcsum(skb, skb->data, ptr - (void *)skb->data); in skb_remcsum_process()
3159 delta = remcsum_adjust(ptr, skb->csum, start, offset); in skb_remcsum_process()
3162 skb->csum = csum_add(skb->csum, delta); in skb_remcsum_process()
3190 static inline void nf_reset(struct sk_buff *skb) in nf_reset() argument
3193 nf_conntrack_put(skb->nfct); in nf_reset()
3194 skb->nfct = NULL; in nf_reset()
3197 nf_bridge_put(skb->nf_bridge); in nf_reset()
3198 skb->nf_bridge = NULL; in nf_reset()
3202 static inline void nf_reset_trace(struct sk_buff *skb) in nf_reset_trace() argument
3205 skb->nf_trace = 0; in nf_reset_trace()
3246 static inline void skb_init_secmark(struct sk_buff *skb) in skb_init_secmark() argument
3248 skb->secmark = 0; in skb_init_secmark()
3254 static inline void skb_init_secmark(struct sk_buff *skb) in skb_init_secmark() argument
3258 static inline bool skb_irq_freeable(const struct sk_buff *skb) in skb_irq_freeable() argument
3260 return !skb->destructor && in skb_irq_freeable()
3262 !skb->sp && in skb_irq_freeable()
3265 !skb->nfct && in skb_irq_freeable()
3267 !skb->_skb_refdst && in skb_irq_freeable()
3268 !skb_has_frag_list(skb); in skb_irq_freeable()
3271 static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) in skb_set_queue_mapping() argument
3273 skb->queue_mapping = queue_mapping; in skb_set_queue_mapping()
3276 static inline u16 skb_get_queue_mapping(const struct sk_buff *skb) in skb_get_queue_mapping() argument
3278 return skb->queue_mapping; in skb_get_queue_mapping()
3286 static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue) in skb_record_rx_queue() argument
3288 skb->queue_mapping = rx_queue + 1; in skb_record_rx_queue()
3291 static inline u16 skb_get_rx_queue(const struct sk_buff *skb) in skb_get_rx_queue() argument
3293 return skb->queue_mapping - 1; in skb_get_rx_queue()
3296 static inline bool skb_rx_queue_recorded(const struct sk_buff *skb) in skb_rx_queue_recorded() argument
3298 return skb->queue_mapping != 0; in skb_rx_queue_recorded()
3301 u16 __skb_tx_hash(const struct net_device *dev, struct sk_buff *skb,
3304 static inline struct sec_path *skb_sec_path(struct sk_buff *skb) in skb_sec_path() argument
3307 return skb->sp; in skb_sec_path()
3325 #define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_SGO_CB_OFFSET)) argument
3333 static inline int gso_pskb_expand_head(struct sk_buff *skb, int extra) in gso_pskb_expand_head() argument
3338 headroom = skb_headroom(skb); in gso_pskb_expand_head()
3339 ret = pskb_expand_head(skb, extra, 0, GFP_ATOMIC); in gso_pskb_expand_head()
3343 new_headroom = skb_headroom(skb); in gso_pskb_expand_head()
3344 SKB_GSO_CB(skb)->mac_offset += (new_headroom - headroom); in gso_pskb_expand_head()
3356 static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res) in gso_make_checksum() argument
3358 int plen = SKB_GSO_CB(skb)->csum_start - skb_headroom(skb) - in gso_make_checksum()
3359 skb_transport_offset(skb); in gso_make_checksum()
3362 csum = csum_fold(csum_partial(skb_transport_header(skb), in gso_make_checksum()
3363 plen, skb->csum)); in gso_make_checksum()
3364 skb->csum = res; in gso_make_checksum()
3365 SKB_GSO_CB(skb)->csum_start -= plen; in gso_make_checksum()
3370 static inline bool skb_is_gso(const struct sk_buff *skb) in skb_is_gso() argument
3372 return skb_shinfo(skb)->gso_size; in skb_is_gso()
3376 static inline bool skb_is_gso_v6(const struct sk_buff *skb) in skb_is_gso_v6() argument
3378 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; in skb_is_gso_v6()
3381 void __skb_warn_lro_forwarding(const struct sk_buff *skb);
3383 static inline bool skb_warn_if_lro(const struct sk_buff *skb) in skb_warn_if_lro() argument
3387 const struct skb_shared_info *shinfo = skb_shinfo(skb); in skb_warn_if_lro()
3389 if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 && in skb_warn_if_lro()
3391 __skb_warn_lro_forwarding(skb); in skb_warn_if_lro()
3397 static inline void skb_forward_csum(struct sk_buff *skb) in skb_forward_csum() argument
3400 if (skb->ip_summed == CHECKSUM_COMPLETE) in skb_forward_csum()
3401 skb->ip_summed = CHECKSUM_NONE; in skb_forward_csum()
3412 static inline void skb_checksum_none_assert(const struct sk_buff *skb) in skb_checksum_none_assert() argument
3415 BUG_ON(skb->ip_summed != CHECKSUM_NONE); in skb_checksum_none_assert()
3419 bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
3421 int skb_checksum_setup(struct sk_buff *skb, bool recalculate);
3423 u32 skb_get_poff(const struct sk_buff *skb);
3424 u32 __skb_get_poff(const struct sk_buff *skb, void *data,
3436 static inline bool skb_head_is_locked(const struct sk_buff *skb) in skb_head_is_locked() argument
3438 return !skb->head_frag || skb_cloned(skb); in skb_head_is_locked()
3451 static inline unsigned int skb_gso_network_seglen(const struct sk_buff *skb) in skb_gso_network_seglen() argument
3453 unsigned int hdr_len = skb_transport_header(skb) - in skb_gso_network_seglen()
3454 skb_network_header(skb); in skb_gso_network_seglen()
3455 return hdr_len + skb_gso_transport_seglen(skb); in skb_gso_network_seglen()