Lines Matching refs:skb
506 int skb_zerocopy_iter_dgram(struct sk_buff *skb, struct msghdr *msg, int len);
507 int skb_zerocopy_iter_stream(struct sock *sk, struct sk_buff *skb,
758 void (*destructor)(struct sk_buff *skb);
960 static inline bool skb_pfmemalloc(const struct sk_buff *skb) in skb_pfmemalloc() argument
962 return unlikely(skb->pfmemalloc); in skb_pfmemalloc()
978 static inline struct dst_entry *skb_dst(const struct sk_buff *skb) in skb_dst() argument
983 WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) && in skb_dst()
986 return (struct dst_entry *)(skb->_skb_refdst & SKB_DST_PTRMASK); in skb_dst()
997 static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) in skb_dst_set() argument
999 skb->_skb_refdst = (unsigned long)dst; in skb_dst_set()
1012 static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst) in skb_dst_set_noref() argument
1015 skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF; in skb_dst_set_noref()
1022 static inline bool skb_dst_is_noref(const struct sk_buff *skb) in skb_dst_is_noref() argument
1024 return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb); in skb_dst_is_noref()
1031 static inline struct rtable *skb_rtable(const struct sk_buff *skb) in skb_rtable() argument
1033 return (struct rtable *)skb_dst(skb); in skb_rtable()
1049 static inline unsigned int skb_napi_id(const struct sk_buff *skb) in skb_napi_id() argument
1052 return skb->napi_id; in skb_napi_id()
1064 static inline bool skb_unref(struct sk_buff *skb) in skb_unref() argument
1066 if (unlikely(!skb)) in skb_unref()
1068 if (likely(refcount_read(&skb->users) == 1)) in skb_unref()
1070 else if (likely(!refcount_dec_and_test(&skb->users))) in skb_unref()
1076 void skb_release_head_state(struct sk_buff *skb);
1077 void kfree_skb(struct sk_buff *skb);
1079 void skb_dump(const char *level, const struct sk_buff *skb, bool full_pkt);
1080 void skb_tx_error(struct sk_buff *skb);
1083 void consume_skb(struct sk_buff *skb);
1085 static inline void consume_skb(struct sk_buff *skb) in consume_skb() argument
1087 return kfree_skb(skb); in consume_skb()
1091 void __consume_stateless_skb(struct sk_buff *skb);
1092 void __kfree_skb(struct sk_buff *skb);
1095 void kfree_skb_partial(struct sk_buff *skb, bool head_stolen);
1103 struct sk_buff *build_skb_around(struct sk_buff *skb,
1145 const struct sk_buff *skb) in skb_fclone_busy() argument
1149 fclones = container_of(skb, struct sk_buff_fclones, skb1); in skb_fclone_busy()
1151 return skb->fclone == SKB_FCLONE_ORIG && in skb_fclone_busy()
1170 void skb_headers_offset_update(struct sk_buff *skb, int off);
1171 int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
1172 struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority);
1174 struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority);
1175 struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom,
1177 static inline struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, in __pskb_copy() argument
1180 return __pskb_copy_fclone(skb, headroom, gfp_mask, false); in __pskb_copy()
1183 int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask);
1184 struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
1186 struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom,
1188 int __must_check skb_to_sgvec_nomark(struct sk_buff *skb, struct scatterlist *sg,
1190 int __must_check skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg,
1192 int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
1193 int __skb_pad(struct sk_buff *skb, int pad, bool free_on_error);
1206 static inline int skb_pad(struct sk_buff *skb, int pad) in skb_pad() argument
1208 return __skb_pad(skb, pad, true); in skb_pad()
1212 int skb_append_pagefrags(struct sk_buff *skb, struct page *page,
1225 void skb_prepare_seq_read(struct sk_buff *skb, unsigned int from,
1231 unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
1267 static inline void skb_clear_hash(struct sk_buff *skb) in skb_clear_hash() argument
1269 skb->hash = 0; in skb_clear_hash()
1270 skb->sw_hash = 0; in skb_clear_hash()
1271 skb->l4_hash = 0; in skb_clear_hash()
1274 static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb) in skb_clear_hash_if_not_l4() argument
1276 if (!skb->l4_hash) in skb_clear_hash_if_not_l4()
1277 skb_clear_hash(skb); in skb_clear_hash_if_not_l4()
1281 __skb_set_hash(struct sk_buff *skb, __u32 hash, bool is_sw, bool is_l4) in __skb_set_hash() argument
1283 skb->l4_hash = is_l4; in __skb_set_hash()
1284 skb->sw_hash = is_sw; in __skb_set_hash()
1285 skb->hash = hash; in __skb_set_hash()
1289 skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) in skb_set_hash() argument
1292 __skb_set_hash(skb, hash, false, type == PKT_HASH_TYPE_L4); in skb_set_hash()
1296 __skb_set_sw_hash(struct sk_buff *skb, __u32 hash, bool is_l4) in __skb_set_sw_hash() argument
1298 __skb_set_hash(skb, hash, true, is_l4); in __skb_set_sw_hash()
1301 void __skb_get_hash(struct sk_buff *skb);
1302 u32 __skb_get_hash_symmetric(const struct sk_buff *skb);
1303 u32 skb_get_poff(const struct sk_buff *skb);
1304 u32 __skb_get_poff(const struct sk_buff *skb, void *data,
1306 __be32 __skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto,
1309 static inline __be32 skb_flow_get_ports(const struct sk_buff *skb, in skb_flow_get_ports() argument
1312 return __skb_flow_get_ports(skb, thoff, ip_proto, NULL, 0); in skb_flow_get_ports()
1324 const struct sk_buff *skb,
1330 static inline bool skb_flow_dissect(const struct sk_buff *skb, in skb_flow_dissect() argument
1334 return __skb_flow_dissect(NULL, skb, flow_dissector, in skb_flow_dissect()
1338 static inline bool skb_flow_dissect_flow_keys(const struct sk_buff *skb, in skb_flow_dissect_flow_keys() argument
1343 return __skb_flow_dissect(NULL, skb, &flow_keys_dissector, in skb_flow_dissect_flow_keys()
1349 const struct sk_buff *skb, in skb_flow_dissect_flow_keys_basic() argument
1355 return __skb_flow_dissect(net, skb, &flow_keys_basic_dissector, flow, in skb_flow_dissect_flow_keys_basic()
1359 void skb_flow_dissect_meta(const struct sk_buff *skb,
1368 skb_flow_dissect_ct(const struct sk_buff *skb,
1374 skb_flow_dissect_tunnel_info(const struct sk_buff *skb,
1378 void skb_flow_dissect_hash(const struct sk_buff *skb,
1382 static inline __u32 skb_get_hash(struct sk_buff *skb) in skb_get_hash() argument
1384 if (!skb->l4_hash && !skb->sw_hash) in skb_get_hash()
1385 __skb_get_hash(skb); in skb_get_hash()
1387 return skb->hash; in skb_get_hash()
1390 static inline __u32 skb_get_hash_flowi6(struct sk_buff *skb, const struct flowi6 *fl6) in skb_get_hash_flowi6() argument
1392 if (!skb->l4_hash && !skb->sw_hash) { in skb_get_hash_flowi6()
1396 __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys)); in skb_get_hash_flowi6()
1399 return skb->hash; in skb_get_hash_flowi6()
1402 __u32 skb_get_hash_perturb(const struct sk_buff *skb,
1405 static inline __u32 skb_get_hash_raw(const struct sk_buff *skb) in skb_get_hash_raw() argument
1407 return skb->hash; in skb_get_hash_raw()
1426 static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) in skb_end_pointer() argument
1428 return skb->head + skb->end; in skb_end_pointer()
1431 static inline unsigned int skb_end_offset(const struct sk_buff *skb) in skb_end_offset() argument
1433 return skb->end; in skb_end_offset()
1436 static inline void skb_set_end_offset(struct sk_buff *skb, unsigned int offset) in skb_set_end_offset() argument
1438 skb->end = offset; in skb_set_end_offset()
1441 static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) in skb_end_pointer() argument
1443 return skb->end; in skb_end_pointer()
1446 static inline unsigned int skb_end_offset(const struct sk_buff *skb) in skb_end_offset() argument
1448 return skb->end - skb->head; in skb_end_offset()
1451 static inline void skb_set_end_offset(struct sk_buff *skb, unsigned int offset) in skb_set_end_offset() argument
1453 skb->end = skb->head + offset; in skb_set_end_offset()
1460 static inline struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb) in skb_hwtstamps() argument
1462 return &skb_shinfo(skb)->hwtstamps; in skb_hwtstamps()
1465 static inline struct ubuf_info *skb_zcopy(struct sk_buff *skb) in skb_zcopy() argument
1467 bool is_zcopy = skb && skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY; in skb_zcopy()
1469 return is_zcopy ? skb_uarg(skb) : NULL; in skb_zcopy()
1472 static inline void skb_zcopy_set(struct sk_buff *skb, struct ubuf_info *uarg, in skb_zcopy_set() argument
1475 if (skb && uarg && !skb_zcopy(skb)) { in skb_zcopy_set()
1480 skb_shinfo(skb)->destructor_arg = uarg; in skb_zcopy_set()
1481 skb_shinfo(skb)->tx_flags |= SKBTX_ZEROCOPY_FRAG; in skb_zcopy_set()
1485 static inline void skb_zcopy_set_nouarg(struct sk_buff *skb, void *val) in skb_zcopy_set_nouarg() argument
1487 skb_shinfo(skb)->destructor_arg = (void *)((uintptr_t) val | 0x1UL); in skb_zcopy_set_nouarg()
1488 skb_shinfo(skb)->tx_flags |= SKBTX_ZEROCOPY_FRAG; in skb_zcopy_set_nouarg()
1491 static inline bool skb_zcopy_is_nouarg(struct sk_buff *skb) in skb_zcopy_is_nouarg() argument
1493 return (uintptr_t) skb_shinfo(skb)->destructor_arg & 0x1UL; in skb_zcopy_is_nouarg()
1496 static inline void *skb_zcopy_get_nouarg(struct sk_buff *skb) in skb_zcopy_get_nouarg() argument
1498 return (void *)((uintptr_t) skb_shinfo(skb)->destructor_arg & ~0x1UL); in skb_zcopy_get_nouarg()
1502 static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) in skb_zcopy_clear() argument
1504 struct ubuf_info *uarg = skb_zcopy(skb); in skb_zcopy_clear()
1507 if (skb_zcopy_is_nouarg(skb)) { in skb_zcopy_clear()
1516 skb_shinfo(skb)->tx_flags &= ~SKBTX_ZEROCOPY_FRAG; in skb_zcopy_clear()
1521 static inline void skb_zcopy_abort(struct sk_buff *skb) in skb_zcopy_abort() argument
1523 struct ubuf_info *uarg = skb_zcopy(skb); in skb_zcopy_abort()
1527 skb_shinfo(skb)->tx_flags &= ~SKBTX_ZEROCOPY_FRAG; in skb_zcopy_abort()
1531 static inline void skb_mark_not_on_list(struct sk_buff *skb) in skb_mark_not_on_list() argument
1533 skb->next = NULL; in skb_mark_not_on_list()
1537 #define skb_list_walk_safe(first, skb, next_skb) \ argument
1538 for ((skb) = (first), (next_skb) = (skb) ? (skb)->next : NULL; (skb); \
1539 (skb) = (next_skb), (next_skb) = (skb) ? (skb)->next : NULL)
1541 static inline void skb_list_del_init(struct sk_buff *skb) in skb_list_del_init() argument
1543 __list_del_entry(&skb->list); in skb_list_del_init()
1544 skb_mark_not_on_list(skb); in skb_list_del_init()
1579 const struct sk_buff *skb) in skb_queue_is_last() argument
1581 return skb->next == (const struct sk_buff *) list; in skb_queue_is_last()
1592 const struct sk_buff *skb) in skb_queue_is_first() argument
1594 return skb->prev == (const struct sk_buff *) list; in skb_queue_is_first()
1606 const struct sk_buff *skb) in skb_queue_next() argument
1611 BUG_ON(skb_queue_is_last(list, skb)); in skb_queue_next()
1612 return skb->next; in skb_queue_next()
1624 const struct sk_buff *skb) in skb_queue_prev() argument
1629 BUG_ON(skb_queue_is_first(list, skb)); in skb_queue_prev()
1630 return skb->prev; in skb_queue_prev()
1640 static inline struct sk_buff *skb_get(struct sk_buff *skb) in skb_get() argument
1642 refcount_inc(&skb->users); in skb_get()
1643 return skb; in skb_get()
1658 static inline int skb_cloned(const struct sk_buff *skb) in skb_cloned() argument
1660 return skb->cloned && in skb_cloned()
1661 (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1; in skb_cloned()
1664 static inline int skb_unclone(struct sk_buff *skb, gfp_t pri) in skb_unclone() argument
1668 if (skb_cloned(skb)) in skb_unclone()
1669 return pskb_expand_head(skb, 0, 0, pri); in skb_unclone()
1680 int __skb_unclone_keeptruesize(struct sk_buff *skb, gfp_t pri);
1681 static inline int skb_unclone_keeptruesize(struct sk_buff *skb, gfp_t pri) in skb_unclone_keeptruesize() argument
1685 if (skb_cloned(skb)) in skb_unclone_keeptruesize()
1686 return __skb_unclone_keeptruesize(skb, pri); in skb_unclone_keeptruesize()
1697 static inline int skb_header_cloned(const struct sk_buff *skb) in skb_header_cloned() argument
1701 if (!skb->cloned) in skb_header_cloned()
1704 dataref = atomic_read(&skb_shinfo(skb)->dataref); in skb_header_cloned()
1709 static inline int skb_header_unclone(struct sk_buff *skb, gfp_t pri) in skb_header_unclone() argument
1713 if (skb_header_cloned(skb)) in skb_header_unclone()
1714 return pskb_expand_head(skb, 0, 0, pri); in skb_header_unclone()
1723 static inline void __skb_header_release(struct sk_buff *skb) in __skb_header_release() argument
1725 skb->nohdr = 1; in __skb_header_release()
1726 atomic_set(&skb_shinfo(skb)->dataref, 1 + (1 << SKB_DATAREF_SHIFT)); in __skb_header_release()
1737 static inline int skb_shared(const struct sk_buff *skb) in skb_shared() argument
1739 return refcount_read(&skb->users) != 1; in skb_shared()
1755 static inline struct sk_buff *skb_share_check(struct sk_buff *skb, gfp_t pri) in skb_share_check() argument
1758 if (skb_shared(skb)) { in skb_share_check()
1759 struct sk_buff *nskb = skb_clone(skb, pri); in skb_share_check()
1762 consume_skb(skb); in skb_share_check()
1764 kfree_skb(skb); in skb_share_check()
1765 skb = nskb; in skb_share_check()
1767 return skb; in skb_share_check()
1790 static inline struct sk_buff *skb_unshare(struct sk_buff *skb, in skb_unshare() argument
1794 if (skb_cloned(skb)) { in skb_unshare()
1795 struct sk_buff *nskb = skb_copy(skb, pri); in skb_unshare()
1799 consume_skb(skb); in skb_unshare()
1801 kfree_skb(skb); in skb_unshare()
1802 skb = nskb; in skb_unshare()
1804 return skb; in skb_unshare()
1822 struct sk_buff *skb = list_->next; in skb_peek() local
1824 if (skb == (struct sk_buff *)list_) in skb_peek()
1825 skb = NULL; in skb_peek()
1826 return skb; in skb_peek()
1849 static inline struct sk_buff *skb_peek_next(struct sk_buff *skb, in skb_peek_next() argument
1852 struct sk_buff *next = skb->next; in skb_peek_next()
1874 struct sk_buff *skb = READ_ONCE(list_->prev); in skb_peek_tail() local
1876 if (skb == (struct sk_buff *)list_) in skb_peek_tail()
1877 skb = NULL; in skb_peek_tail()
1878 return skb; in skb_peek_tail()
2105 void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list);
2106 static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) in __skb_unlink() argument
2111 next = skb->next; in __skb_unlink()
2112 prev = skb->prev; in __skb_unlink()
2113 skb->next = skb->prev = NULL; in __skb_unlink()
2128 struct sk_buff *skb = skb_peek(list); in __skb_dequeue() local
2129 if (skb) in __skb_dequeue()
2130 __skb_unlink(skb, list); in __skb_dequeue()
2131 return skb; in __skb_dequeue()
2145 struct sk_buff *skb = skb_peek_tail(list); in __skb_dequeue_tail() local
2146 if (skb) in __skb_dequeue_tail()
2147 __skb_unlink(skb, list); in __skb_dequeue_tail()
2148 return skb; in __skb_dequeue_tail()
2153 static inline bool skb_is_nonlinear(const struct sk_buff *skb) in skb_is_nonlinear() argument
2155 return skb->data_len; in skb_is_nonlinear()
2158 static inline unsigned int skb_headlen(const struct sk_buff *skb) in skb_headlen() argument
2160 return skb->len - skb->data_len; in skb_headlen()
2163 static inline unsigned int __skb_pagelen(const struct sk_buff *skb) in __skb_pagelen() argument
2167 for (i = skb_shinfo(skb)->nr_frags - 1; (int)i >= 0; i--) in __skb_pagelen()
2168 len += skb_frag_size(&skb_shinfo(skb)->frags[i]); in __skb_pagelen()
2172 static inline unsigned int skb_pagelen(const struct sk_buff *skb) in skb_pagelen() argument
2174 return skb_headlen(skb) + __skb_pagelen(skb); in skb_pagelen()
2190 static inline void __skb_fill_page_desc(struct sk_buff *skb, int i, in __skb_fill_page_desc() argument
2193 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; in __skb_fill_page_desc()
2206 skb->pfmemalloc = true; in __skb_fill_page_desc()
2223 static inline void skb_fill_page_desc(struct sk_buff *skb, int i, in skb_fill_page_desc() argument
2226 __skb_fill_page_desc(skb, i, page, off, size); in skb_fill_page_desc()
2227 skb_shinfo(skb)->nr_frags = i + 1; in skb_fill_page_desc()
2230 void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,
2233 void skb_coalesce_rx_frag(struct sk_buff *skb, int i, int size,
2236 #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) argument
2239 static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) in skb_tail_pointer() argument
2241 return skb->head + skb->tail; in skb_tail_pointer()
2244 static inline void skb_reset_tail_pointer(struct sk_buff *skb) in skb_reset_tail_pointer() argument
2246 skb->tail = skb->data - skb->head; in skb_reset_tail_pointer()
2249 static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) in skb_set_tail_pointer() argument
2251 skb_reset_tail_pointer(skb); in skb_set_tail_pointer()
2252 skb->tail += offset; in skb_set_tail_pointer()
2256 static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) in skb_tail_pointer() argument
2258 return skb->tail; in skb_tail_pointer()
2261 static inline void skb_reset_tail_pointer(struct sk_buff *skb) in skb_reset_tail_pointer() argument
2263 skb->tail = skb->data; in skb_reset_tail_pointer()
2266 static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) in skb_set_tail_pointer() argument
2268 skb->tail = skb->data + offset; in skb_set_tail_pointer()
2273 static inline void skb_assert_len(struct sk_buff *skb) in skb_assert_len() argument
2276 if (WARN_ONCE(!skb->len, "%s\n", __func__)) in skb_assert_len()
2277 DO_ONCE_LITE(skb_dump, KERN_ERR, skb, false); in skb_assert_len()
2284 void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
2285 void *skb_put(struct sk_buff *skb, unsigned int len);
2286 static inline void *__skb_put(struct sk_buff *skb, unsigned int len) in __skb_put() argument
2288 void *tmp = skb_tail_pointer(skb); in __skb_put()
2289 SKB_LINEAR_ASSERT(skb); in __skb_put()
2290 skb->tail += len; in __skb_put()
2291 skb->len += len; in __skb_put()
2295 static inline void *__skb_put_zero(struct sk_buff *skb, unsigned int len) in __skb_put_zero() argument
2297 void *tmp = __skb_put(skb, len); in __skb_put_zero()
2303 static inline void *__skb_put_data(struct sk_buff *skb, const void *data, in __skb_put_data() argument
2306 void *tmp = __skb_put(skb, len); in __skb_put_data()
2312 static inline void __skb_put_u8(struct sk_buff *skb, u8 val) in __skb_put_u8() argument
2314 *(u8 *)__skb_put(skb, 1) = val; in __skb_put_u8()
2317 static inline void *skb_put_zero(struct sk_buff *skb, unsigned int len) in skb_put_zero() argument
2319 void *tmp = skb_put(skb, len); in skb_put_zero()
2326 static inline void *skb_put_data(struct sk_buff *skb, const void *data, in skb_put_data() argument
2329 void *tmp = skb_put(skb, len); in skb_put_data()
2336 static inline void skb_put_u8(struct sk_buff *skb, u8 val) in skb_put_u8() argument
2338 *(u8 *)skb_put(skb, 1) = val; in skb_put_u8()
2341 void *skb_push(struct sk_buff *skb, unsigned int len);
2342 static inline void *__skb_push(struct sk_buff *skb, unsigned int len) in __skb_push() argument
2344 skb->data -= len; in __skb_push()
2345 skb->len += len; in __skb_push()
2346 return skb->data; in __skb_push()
2349 void *skb_pull(struct sk_buff *skb, unsigned int len);
2350 static inline void *__skb_pull(struct sk_buff *skb, unsigned int len) in __skb_pull() argument
2352 skb->len -= len; in __skb_pull()
2353 BUG_ON(skb->len < skb->data_len); in __skb_pull()
2354 return skb->data += len; in __skb_pull()
2357 static inline void *skb_pull_inline(struct sk_buff *skb, unsigned int len) in skb_pull_inline() argument
2359 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len); in skb_pull_inline()
2362 void *__pskb_pull_tail(struct sk_buff *skb, int delta);
2364 static inline void *__pskb_pull(struct sk_buff *skb, unsigned int len) in __pskb_pull() argument
2366 if (len > skb_headlen(skb) && in __pskb_pull()
2367 !__pskb_pull_tail(skb, len - skb_headlen(skb))) in __pskb_pull()
2369 skb->len -= len; in __pskb_pull()
2370 return skb->data += len; in __pskb_pull()
2373 static inline void *pskb_pull(struct sk_buff *skb, unsigned int len) in pskb_pull() argument
2375 return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len); in pskb_pull()
2378 static inline bool pskb_may_pull(struct sk_buff *skb, unsigned int len) in pskb_may_pull() argument
2380 if (likely(len <= skb_headlen(skb))) in pskb_may_pull()
2382 if (unlikely(len > skb->len)) in pskb_may_pull()
2384 return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL; in pskb_may_pull()
2387 void skb_condense(struct sk_buff *skb);
2395 static inline unsigned int skb_headroom(const struct sk_buff *skb) in skb_headroom() argument
2397 return skb->data - skb->head; in skb_headroom()
2406 static inline int skb_tailroom(const struct sk_buff *skb) in skb_tailroom() argument
2408 return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail; in skb_tailroom()
2418 static inline int skb_availroom(const struct sk_buff *skb) in skb_availroom() argument
2420 if (skb_is_nonlinear(skb)) in skb_availroom()
2423 return skb->end - skb->tail - skb->reserved_tailroom; in skb_availroom()
2434 static inline void skb_reserve(struct sk_buff *skb, int len) in skb_reserve() argument
2436 skb->data += len; in skb_reserve()
2437 skb->tail += len; in skb_reserve()
2452 static inline void skb_tailroom_reserve(struct sk_buff *skb, unsigned int mtu, in skb_tailroom_reserve() argument
2455 SKB_LINEAR_ASSERT(skb); in skb_tailroom_reserve()
2456 if (mtu < skb_tailroom(skb) - needed_tailroom) in skb_tailroom_reserve()
2458 skb->reserved_tailroom = skb_tailroom(skb) - mtu; in skb_tailroom_reserve()
2461 skb->reserved_tailroom = needed_tailroom; in skb_tailroom_reserve()
2467 static inline void skb_set_inner_protocol(struct sk_buff *skb, in skb_set_inner_protocol() argument
2470 skb->inner_protocol = protocol; in skb_set_inner_protocol()
2471 skb->inner_protocol_type = ENCAP_TYPE_ETHER; in skb_set_inner_protocol()
2474 static inline void skb_set_inner_ipproto(struct sk_buff *skb, in skb_set_inner_ipproto() argument
2477 skb->inner_ipproto = ipproto; in skb_set_inner_ipproto()
2478 skb->inner_protocol_type = ENCAP_TYPE_IPPROTO; in skb_set_inner_ipproto()
2481 static inline void skb_reset_inner_headers(struct sk_buff *skb) in skb_reset_inner_headers() argument
2483 skb->inner_mac_header = skb->mac_header; in skb_reset_inner_headers()
2484 skb->inner_network_header = skb->network_header; in skb_reset_inner_headers()
2485 skb->inner_transport_header = skb->transport_header; in skb_reset_inner_headers()
2488 static inline void skb_reset_mac_len(struct sk_buff *skb) in skb_reset_mac_len() argument
2490 skb->mac_len = skb->network_header - skb->mac_header; in skb_reset_mac_len()
2494 *skb) in skb_inner_transport_header()
2496 return skb->head + skb->inner_transport_header; in skb_inner_transport_header()
2499 static inline int skb_inner_transport_offset(const struct sk_buff *skb) in skb_inner_transport_offset() argument
2501 return skb_inner_transport_header(skb) - skb->data; in skb_inner_transport_offset()
2504 static inline void skb_reset_inner_transport_header(struct sk_buff *skb) in skb_reset_inner_transport_header() argument
2506 skb->inner_transport_header = skb->data - skb->head; in skb_reset_inner_transport_header()
2509 static inline void skb_set_inner_transport_header(struct sk_buff *skb, in skb_set_inner_transport_header() argument
2512 skb_reset_inner_transport_header(skb); in skb_set_inner_transport_header()
2513 skb->inner_transport_header += offset; in skb_set_inner_transport_header()
2516 static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb) in skb_inner_network_header() argument
2518 return skb->head + skb->inner_network_header; in skb_inner_network_header()
2521 static inline void skb_reset_inner_network_header(struct sk_buff *skb) in skb_reset_inner_network_header() argument
2523 skb->inner_network_header = skb->data - skb->head; in skb_reset_inner_network_header()
2526 static inline void skb_set_inner_network_header(struct sk_buff *skb, in skb_set_inner_network_header() argument
2529 skb_reset_inner_network_header(skb); in skb_set_inner_network_header()
2530 skb->inner_network_header += offset; in skb_set_inner_network_header()
2533 static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) in skb_inner_mac_header() argument
2535 return skb->head + skb->inner_mac_header; in skb_inner_mac_header()
2538 static inline void skb_reset_inner_mac_header(struct sk_buff *skb) in skb_reset_inner_mac_header() argument
2540 skb->inner_mac_header = skb->data - skb->head; in skb_reset_inner_mac_header()
2543 static inline void skb_set_inner_mac_header(struct sk_buff *skb, in skb_set_inner_mac_header() argument
2546 skb_reset_inner_mac_header(skb); in skb_set_inner_mac_header()
2547 skb->inner_mac_header += offset; in skb_set_inner_mac_header()
2549 static inline bool skb_transport_header_was_set(const struct sk_buff *skb) in skb_transport_header_was_set() argument
2551 return skb->transport_header != (typeof(skb->transport_header))~0U; in skb_transport_header_was_set()
2554 static inline unsigned char *skb_transport_header(const struct sk_buff *skb) in skb_transport_header() argument
2556 return skb->head + skb->transport_header; in skb_transport_header()
2559 static inline void skb_reset_transport_header(struct sk_buff *skb) in skb_reset_transport_header() argument
2561 skb->transport_header = skb->data - skb->head; in skb_reset_transport_header()
2564 static inline void skb_set_transport_header(struct sk_buff *skb, in skb_set_transport_header() argument
2567 skb_reset_transport_header(skb); in skb_set_transport_header()
2568 skb->transport_header += offset; in skb_set_transport_header()
2571 static inline unsigned char *skb_network_header(const struct sk_buff *skb) in skb_network_header() argument
2573 return skb->head + skb->network_header; in skb_network_header()
2576 static inline void skb_reset_network_header(struct sk_buff *skb) in skb_reset_network_header() argument
2578 skb->network_header = skb->data - skb->head; in skb_reset_network_header()
2581 static inline void skb_set_network_header(struct sk_buff *skb, const int offset) in skb_set_network_header() argument
2583 skb_reset_network_header(skb); in skb_set_network_header()
2584 skb->network_header += offset; in skb_set_network_header()
2587 static inline unsigned char *skb_mac_header(const struct sk_buff *skb) in skb_mac_header() argument
2589 return skb->head + skb->mac_header; in skb_mac_header()
2592 static inline int skb_mac_offset(const struct sk_buff *skb) in skb_mac_offset() argument
2594 return skb_mac_header(skb) - skb->data; in skb_mac_offset()
2597 static inline u32 skb_mac_header_len(const struct sk_buff *skb) in skb_mac_header_len() argument
2599 return skb->network_header - skb->mac_header; in skb_mac_header_len()
2602 static inline int skb_mac_header_was_set(const struct sk_buff *skb) in skb_mac_header_was_set() argument
2604 return skb->mac_header != (typeof(skb->mac_header))~0U; in skb_mac_header_was_set()
2607 static inline void skb_unset_mac_header(struct sk_buff *skb) in skb_unset_mac_header() argument
2609 skb->mac_header = (typeof(skb->mac_header))~0U; in skb_unset_mac_header()
2612 static inline void skb_reset_mac_header(struct sk_buff *skb) in skb_reset_mac_header() argument
2614 skb->mac_header = skb->data - skb->head; in skb_reset_mac_header()
2617 static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) in skb_set_mac_header() argument
2619 skb_reset_mac_header(skb); in skb_set_mac_header()
2620 skb->mac_header += offset; in skb_set_mac_header()
2623 static inline void skb_pop_mac_header(struct sk_buff *skb) in skb_pop_mac_header() argument
2625 skb->mac_header = skb->network_header; in skb_pop_mac_header()
2628 static inline void skb_probe_transport_header(struct sk_buff *skb) in skb_probe_transport_header() argument
2632 if (skb_transport_header_was_set(skb)) in skb_probe_transport_header()
2635 if (skb_flow_dissect_flow_keys_basic(NULL, skb, &keys, in skb_probe_transport_header()
2637 skb_set_transport_header(skb, keys.control.thoff); in skb_probe_transport_header()
2640 static inline void skb_mac_header_rebuild(struct sk_buff *skb) in skb_mac_header_rebuild() argument
2642 if (skb_mac_header_was_set(skb)) { in skb_mac_header_rebuild()
2643 const unsigned char *old_mac = skb_mac_header(skb); in skb_mac_header_rebuild()
2645 skb_set_mac_header(skb, -skb->mac_len); in skb_mac_header_rebuild()
2646 memmove(skb_mac_header(skb), old_mac, skb->mac_len); in skb_mac_header_rebuild()
2650 static inline int skb_checksum_start_offset(const struct sk_buff *skb) in skb_checksum_start_offset() argument
2652 return skb->csum_start - skb_headroom(skb); in skb_checksum_start_offset()
2655 static inline unsigned char *skb_checksum_start(const struct sk_buff *skb) in skb_checksum_start() argument
2657 return skb->head + skb->csum_start; in skb_checksum_start()
2660 static inline int skb_transport_offset(const struct sk_buff *skb) in skb_transport_offset() argument
2662 return skb_transport_header(skb) - skb->data; in skb_transport_offset()
2665 static inline u32 skb_network_header_len(const struct sk_buff *skb) in skb_network_header_len() argument
2667 return skb->transport_header - skb->network_header; in skb_network_header_len()
2670 static inline u32 skb_inner_network_header_len(const struct sk_buff *skb) in skb_inner_network_header_len() argument
2672 return skb->inner_transport_header - skb->inner_network_header; in skb_inner_network_header_len()
2675 static inline int skb_network_offset(const struct sk_buff *skb) in skb_network_offset() argument
2677 return skb_network_header(skb) - skb->data; in skb_network_offset()
2680 static inline int skb_inner_network_offset(const struct sk_buff *skb) in skb_inner_network_offset() argument
2682 return skb_inner_network_header(skb) - skb->data; in skb_inner_network_offset()
2685 static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len) in pskb_network_may_pull() argument
2687 return pskb_may_pull(skb, skb_network_offset(skb) + len); in pskb_network_may_pull()
2738 int ___pskb_trim(struct sk_buff *skb, unsigned int len);
2740 static inline void __skb_set_length(struct sk_buff *skb, unsigned int len) in __skb_set_length() argument
2742 if (WARN_ON(skb_is_nonlinear(skb))) in __skb_set_length()
2744 skb->len = len; in __skb_set_length()
2745 skb_set_tail_pointer(skb, len); in __skb_set_length()
2748 static inline void __skb_trim(struct sk_buff *skb, unsigned int len) in __skb_trim() argument
2750 __skb_set_length(skb, len); in __skb_trim()
2753 void skb_trim(struct sk_buff *skb, unsigned int len);
2755 static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) in __pskb_trim() argument
2757 if (skb->data_len) in __pskb_trim()
2758 return ___pskb_trim(skb, len); in __pskb_trim()
2759 __skb_trim(skb, len); in __pskb_trim()
2763 static inline int pskb_trim(struct sk_buff *skb, unsigned int len) in pskb_trim() argument
2765 return (len < skb->len) ? __pskb_trim(skb, len) : 0; in pskb_trim()
2777 static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len) in pskb_trim_unique() argument
2779 int err = pskb_trim(skb, len); in pskb_trim_unique()
2783 static inline int __skb_grow(struct sk_buff *skb, unsigned int len) in __skb_grow() argument
2785 unsigned int diff = len - skb->len; in __skb_grow()
2787 if (skb_tailroom(skb) < diff) { in __skb_grow()
2788 int ret = pskb_expand_head(skb, 0, diff - skb_tailroom(skb), in __skb_grow()
2793 __skb_set_length(skb, len); in __skb_grow()
2805 static inline void skb_orphan(struct sk_buff *skb) in skb_orphan() argument
2807 if (skb->destructor) { in skb_orphan()
2808 skb->destructor(skb); in skb_orphan()
2809 skb->destructor = NULL; in skb_orphan()
2810 skb->sk = NULL; in skb_orphan()
2812 BUG_ON(skb->sk); in skb_orphan()
2825 static inline int skb_orphan_frags(struct sk_buff *skb, gfp_t gfp_mask) in skb_orphan_frags() argument
2827 if (likely(!skb_zcopy(skb))) in skb_orphan_frags()
2829 if (!skb_zcopy_is_nouarg(skb) && in skb_orphan_frags()
2830 skb_uarg(skb)->callback == sock_zerocopy_callback) in skb_orphan_frags()
2832 return skb_copy_ubufs(skb, gfp_mask); in skb_orphan_frags()
2836 static inline int skb_orphan_frags_rx(struct sk_buff *skb, gfp_t gfp_mask) in skb_orphan_frags_rx() argument
2838 if (likely(!skb_zcopy(skb))) in skb_orphan_frags_rx()
2840 return skb_copy_ubufs(skb, gfp_mask); in skb_orphan_frags_rx()
2853 struct sk_buff *skb; in __skb_queue_purge() local
2854 while ((skb = __skb_dequeue(list)) != NULL) in __skb_queue_purge()
2855 kfree_skb(skb); in __skb_queue_purge()
2902 struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); in __netdev_alloc_skb_ip_align() local
2904 if (NET_IP_ALIGN && skb) in __netdev_alloc_skb_ip_align()
2905 skb_reserve(skb, NET_IP_ALIGN); in __netdev_alloc_skb_ip_align()
2906 return skb; in __netdev_alloc_skb_ip_align()
2928 void napi_consume_skb(struct sk_buff *skb, int budget);
2931 void __kfree_skb_defer(struct sk_buff *skb);
2987 struct sk_buff *skb) in skb_propagate_pfmemalloc() argument
2990 skb->pfmemalloc = true; in skb_propagate_pfmemalloc()
3062 static inline void skb_frag_ref(struct sk_buff *skb, int f) in skb_frag_ref() argument
3064 __skb_frag_ref(&skb_shinfo(skb)->frags[f]); in skb_frag_ref()
3085 static inline void skb_frag_unref(struct sk_buff *skb, int f) in skb_frag_unref() argument
3087 __skb_frag_unref(&skb_shinfo(skb)->frags[f]); in skb_frag_unref()
3149 static inline void skb_frag_set_page(struct sk_buff *skb, int f, in skb_frag_set_page() argument
3152 __skb_frag_set_page(&skb_shinfo(skb)->frags[f], page); in skb_frag_set_page()
3177 static inline struct sk_buff *pskb_copy(struct sk_buff *skb, in pskb_copy() argument
3180 return __pskb_copy(skb, skb_headroom(skb), gfp_mask); in pskb_copy()
3184 static inline struct sk_buff *pskb_copy_for_clone(struct sk_buff *skb, in pskb_copy_for_clone() argument
3187 return __pskb_copy_fclone(skb, skb_headroom(skb), gfp_mask, true); in pskb_copy_for_clone()
3199 static inline int skb_clone_writable(const struct sk_buff *skb, unsigned int len) in skb_clone_writable() argument
3201 return !skb_header_cloned(skb) && in skb_clone_writable()
3202 skb_headroom(skb) + len <= skb->hdr_len; in skb_clone_writable()
3205 static inline int skb_try_make_writable(struct sk_buff *skb, in skb_try_make_writable() argument
3208 return skb_cloned(skb) && !skb_clone_writable(skb, write_len) && in skb_try_make_writable()
3209 pskb_expand_head(skb, 0, 0, GFP_ATOMIC); in skb_try_make_writable()
3212 static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom, in __skb_cow() argument
3217 if (headroom > skb_headroom(skb)) in __skb_cow()
3218 delta = headroom - skb_headroom(skb); in __skb_cow()
3221 return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0, in __skb_cow()
3238 static inline int skb_cow(struct sk_buff *skb, unsigned int headroom) in skb_cow() argument
3240 return __skb_cow(skb, headroom, skb_cloned(skb)); in skb_cow()
3253 static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom) in skb_cow_head() argument
3255 return __skb_cow(skb, headroom, skb_header_cloned(skb)); in skb_cow_head()
3268 static inline int skb_padto(struct sk_buff *skb, unsigned int len) in skb_padto() argument
3270 unsigned int size = skb->len; in skb_padto()
3273 return skb_pad(skb, len - size); in skb_padto()
3287 static inline int __must_check __skb_put_padto(struct sk_buff *skb, in __skb_put_padto() argument
3291 unsigned int size = skb->len; in __skb_put_padto()
3295 if (__skb_pad(skb, len, free_on_error)) in __skb_put_padto()
3297 __skb_put(skb, len); in __skb_put_padto()
3312 static inline int __must_check skb_put_padto(struct sk_buff *skb, unsigned int len) in skb_put_padto() argument
3314 return __skb_put_padto(skb, len, true); in skb_put_padto()
3317 static inline int skb_add_data(struct sk_buff *skb, in skb_add_data() argument
3320 const int off = skb->len; in skb_add_data()
3322 if (skb->ip_summed == CHECKSUM_NONE) { in skb_add_data()
3324 if (csum_and_copy_from_iter_full(skb_put(skb, copy), copy, in skb_add_data()
3326 skb->csum = csum_block_add(skb->csum, csum, off); in skb_add_data()
3329 } else if (copy_from_iter_full(skb_put(skb, copy), copy, from)) in skb_add_data()
3332 __skb_trim(skb, off); in skb_add_data()
3336 static inline bool skb_can_coalesce(struct sk_buff *skb, int i, in skb_can_coalesce() argument
3339 if (skb_zcopy(skb)) in skb_can_coalesce()
3342 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i - 1]; in skb_can_coalesce()
3350 static inline int __skb_linearize(struct sk_buff *skb) in __skb_linearize() argument
3352 return __pskb_pull_tail(skb, skb->data_len) ? 0 : -ENOMEM; in __skb_linearize()
3362 static inline int skb_linearize(struct sk_buff *skb) in skb_linearize() argument
3364 return skb_is_nonlinear(skb) ? __skb_linearize(skb) : 0; in skb_linearize()
3374 static inline bool skb_has_shared_frag(const struct sk_buff *skb) in skb_has_shared_frag() argument
3376 return skb_is_nonlinear(skb) && in skb_has_shared_frag()
3377 skb_shinfo(skb)->tx_flags & SKBTX_SHARED_FRAG; in skb_has_shared_frag()
3387 static inline int skb_linearize_cow(struct sk_buff *skb) in skb_linearize_cow() argument
3389 return skb_is_nonlinear(skb) || skb_cloned(skb) ? in skb_linearize_cow()
3390 __skb_linearize(skb) : 0; in skb_linearize_cow()
3394 __skb_postpull_rcsum(struct sk_buff *skb, const void *start, unsigned int len, in __skb_postpull_rcsum() argument
3397 if (skb->ip_summed == CHECKSUM_COMPLETE) in __skb_postpull_rcsum()
3398 skb->csum = csum_block_sub(skb->csum, in __skb_postpull_rcsum()
3400 else if (skb->ip_summed == CHECKSUM_PARTIAL && in __skb_postpull_rcsum()
3401 skb_checksum_start_offset(skb) < 0) in __skb_postpull_rcsum()
3402 skb->ip_summed = CHECKSUM_NONE; in __skb_postpull_rcsum()
3415 static inline void skb_postpull_rcsum(struct sk_buff *skb, in skb_postpull_rcsum() argument
3418 __skb_postpull_rcsum(skb, start, len, 0); in skb_postpull_rcsum()
3422 __skb_postpush_rcsum(struct sk_buff *skb, const void *start, unsigned int len, in __skb_postpush_rcsum() argument
3425 if (skb->ip_summed == CHECKSUM_COMPLETE) in __skb_postpush_rcsum()
3426 skb->csum = csum_block_add(skb->csum, in __skb_postpush_rcsum()
3439 static inline void skb_postpush_rcsum(struct sk_buff *skb, in skb_postpush_rcsum() argument
3442 __skb_postpush_rcsum(skb, start, len, 0); in skb_postpush_rcsum()
3445 void *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
3458 static inline void *skb_push_rcsum(struct sk_buff *skb, unsigned int len) in skb_push_rcsum() argument
3460 skb_push(skb, len); in skb_push_rcsum()
3461 skb_postpush_rcsum(skb, skb->data, len); in skb_push_rcsum()
3462 return skb->data; in skb_push_rcsum()
3465 int pskb_trim_rcsum_slow(struct sk_buff *skb, unsigned int len);
3476 static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) in pskb_trim_rcsum() argument
3478 if (likely(len >= skb->len)) in pskb_trim_rcsum()
3480 return pskb_trim_rcsum_slow(skb, len); in pskb_trim_rcsum()
3483 static inline int __skb_trim_rcsum(struct sk_buff *skb, unsigned int len) in __skb_trim_rcsum() argument
3485 if (skb->ip_summed == CHECKSUM_COMPLETE) in __skb_trim_rcsum()
3486 skb->ip_summed = CHECKSUM_NONE; in __skb_trim_rcsum()
3487 __skb_trim(skb, len); in __skb_trim_rcsum()
3491 static inline int __skb_grow_rcsum(struct sk_buff *skb, unsigned int len) in __skb_grow_rcsum() argument
3493 if (skb->ip_summed == CHECKSUM_COMPLETE) in __skb_grow_rcsum()
3494 skb->ip_summed = CHECKSUM_NONE; in __skb_grow_rcsum()
3495 return __skb_grow(skb, len); in __skb_grow_rcsum()
3501 #define skb_rb_next(skb) rb_to_skb(rb_next(&(skb)->rbnode)) argument
3502 #define skb_rb_prev(skb) rb_to_skb(rb_prev(&(skb)->rbnode)) argument
3504 #define skb_queue_walk(queue, skb) \ argument
3505 for (skb = (queue)->next; \
3506 skb != (struct sk_buff *)(queue); \
3507 skb = skb->next)
3509 #define skb_queue_walk_safe(queue, skb, tmp) \ argument
3510 for (skb = (queue)->next, tmp = skb->next; \
3511 skb != (struct sk_buff *)(queue); \
3512 skb = tmp, tmp = skb->next)
3514 #define skb_queue_walk_from(queue, skb) \ argument
3515 for (; skb != (struct sk_buff *)(queue); \
3516 skb = skb->next)
3518 #define skb_rbtree_walk(skb, root) \ argument
3519 for (skb = skb_rb_first(root); skb != NULL; \
3520 skb = skb_rb_next(skb))
3522 #define skb_rbtree_walk_from(skb) \ argument
3523 for (; skb != NULL; \
3524 skb = skb_rb_next(skb))
3526 #define skb_rbtree_walk_from_safe(skb, tmp) \ argument
3527 for (; tmp = skb ? skb_rb_next(skb) : NULL, (skb != NULL); \
3528 skb = tmp)
3530 #define skb_queue_walk_from_safe(queue, skb, tmp) \ argument
3531 for (tmp = skb->next; \
3532 skb != (struct sk_buff *)(queue); \
3533 skb = tmp, tmp = skb->next)
3535 #define skb_queue_reverse_walk(queue, skb) \ argument
3536 for (skb = (queue)->prev; \
3537 skb != (struct sk_buff *)(queue); \
3538 skb = skb->prev)
3540 #define skb_queue_reverse_walk_safe(queue, skb, tmp) \ argument
3541 for (skb = (queue)->prev, tmp = skb->prev; \
3542 skb != (struct sk_buff *)(queue); \
3543 skb = tmp, tmp = skb->prev)
3545 #define skb_queue_reverse_walk_from_safe(queue, skb, tmp) \ argument
3546 for (tmp = skb->prev; \
3547 skb != (struct sk_buff *)(queue); \
3548 skb = tmp, tmp = skb->prev)
3550 static inline bool skb_has_frag_list(const struct sk_buff *skb) in skb_has_frag_list() argument
3552 return skb_shinfo(skb)->frag_list != NULL; in skb_has_frag_list()
3555 static inline void skb_frag_list_init(struct sk_buff *skb) in skb_frag_list_init() argument
3557 skb_shinfo(skb)->frag_list = NULL; in skb_frag_list_init()
3560 #define skb_walk_frags(skb, iter) \ argument
3561 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
3566 const struct sk_buff *skb);
3590 int skb_copy_and_csum_datagram_msg(struct sk_buff *skb, int hlen,
3592 int skb_copy_and_hash_datagram_iter(const struct sk_buff *skb, int offset,
3595 int skb_copy_datagram_from_iter(struct sk_buff *skb, int offset,
3597 int zerocopy_sg_from_iter(struct sk_buff *skb, struct iov_iter *frm);
3598 void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
3599 void __skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb, int len);
3601 struct sk_buff *skb) in skb_free_datagram_locked() argument
3603 __skb_free_datagram_locked(sk, skb, 0); in skb_free_datagram_locked()
3605 int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags);
3606 int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len);
3607 int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len);
3608 __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, u8 *to,
3610 int skb_splice_bits(struct sk_buff *skb, struct sock *sk, unsigned int offset,
3613 int skb_send_sock_locked(struct sock *sk, struct sk_buff *skb, int offset,
3615 void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
3619 void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len);
3620 int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, int shiftlen);
3621 void skb_scrub_packet(struct sk_buff *skb, bool xnet);
3622 bool skb_gso_validate_network_len(const struct sk_buff *skb, unsigned int mtu);
3623 bool skb_gso_validate_mac_len(const struct sk_buff *skb, unsigned int len);
3624 struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features);
3625 struct sk_buff *skb_segment_list(struct sk_buff *skb, netdev_features_t features,
3627 struct sk_buff *skb_vlan_untag(struct sk_buff *skb);
3628 int skb_ensure_writable(struct sk_buff *skb, int write_len);
3629 int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci);
3630 int skb_vlan_pop(struct sk_buff *skb);
3631 int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
3632 int skb_eth_pop(struct sk_buff *skb);
3633 int skb_eth_push(struct sk_buff *skb, const unsigned char *dst,
3635 int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto,
3637 int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len,
3639 int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse);
3640 int skb_mpls_dec_ttl(struct sk_buff *skb);
3641 struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy,
3661 __wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
3663 __wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
3667 __skb_header_pointer(const struct sk_buff *skb, int offset, in __skb_header_pointer() argument
3673 if (!skb || in __skb_header_pointer()
3674 skb_copy_bits(skb, offset, buffer, len) < 0) in __skb_header_pointer()
3681 skb_header_pointer(const struct sk_buff *skb, int offset, int len, void *buffer) in skb_header_pointer() argument
3683 return __skb_header_pointer(skb, offset, len, skb->data, in skb_header_pointer()
3684 skb_headlen(skb), buffer); in skb_header_pointer()
3697 static inline bool skb_needs_linearize(struct sk_buff *skb, in skb_needs_linearize() argument
3700 return skb_is_nonlinear(skb) && in skb_needs_linearize()
3701 ((skb_has_frag_list(skb) && !(features & NETIF_F_FRAGLIST)) || in skb_needs_linearize()
3702 (skb_shinfo(skb)->nr_frags && !(features & NETIF_F_SG))); in skb_needs_linearize()
3705 static inline void skb_copy_from_linear_data(const struct sk_buff *skb, in skb_copy_from_linear_data() argument
3709 memcpy(to, skb->data, len); in skb_copy_from_linear_data()
3712 static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb, in skb_copy_from_linear_data_offset() argument
3716 memcpy(to, skb->data + offset, len); in skb_copy_from_linear_data_offset()
3719 static inline void skb_copy_to_linear_data(struct sk_buff *skb, in skb_copy_to_linear_data() argument
3723 memcpy(skb->data, from, len); in skb_copy_to_linear_data()
3726 static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb, in skb_copy_to_linear_data_offset() argument
3731 memcpy(skb->data + offset, from, len); in skb_copy_to_linear_data_offset()
3736 static inline ktime_t skb_get_ktime(const struct sk_buff *skb) in skb_get_ktime() argument
3738 return skb->tstamp; in skb_get_ktime()
3750 static inline void skb_get_timestamp(const struct sk_buff *skb, in skb_get_timestamp() argument
3753 *stamp = ns_to_kernel_old_timeval(skb->tstamp); in skb_get_timestamp()
3756 static inline void skb_get_new_timestamp(const struct sk_buff *skb, in skb_get_new_timestamp() argument
3759 struct timespec64 ts = ktime_to_timespec64(skb->tstamp); in skb_get_new_timestamp()
3765 static inline void skb_get_timestampns(const struct sk_buff *skb, in skb_get_timestampns() argument
3768 struct timespec64 ts = ktime_to_timespec64(skb->tstamp); in skb_get_timestampns()
3774 static inline void skb_get_new_timestampns(const struct sk_buff *skb, in skb_get_new_timestampns() argument
3777 struct timespec64 ts = ktime_to_timespec64(skb->tstamp); in skb_get_new_timestampns()
3783 static inline void __net_timestamp(struct sk_buff *skb) in __net_timestamp() argument
3785 skb->tstamp = ktime_get_real(); in __net_timestamp()
3798 static inline u8 skb_metadata_len(const struct sk_buff *skb) in skb_metadata_len() argument
3800 return skb_shinfo(skb)->meta_len; in skb_metadata_len()
3803 static inline void *skb_metadata_end(const struct sk_buff *skb) in skb_metadata_end() argument
3805 return skb_mac_header(skb); in skb_metadata_end()
3857 static inline void skb_metadata_set(struct sk_buff *skb, u8 meta_len) in skb_metadata_set() argument
3859 skb_shinfo(skb)->meta_len = meta_len; in skb_metadata_set()
3862 static inline void skb_metadata_clear(struct sk_buff *skb) in skb_metadata_clear() argument
3864 skb_metadata_set(skb, 0); in skb_metadata_clear()
3867 struct sk_buff *skb_clone_sk(struct sk_buff *skb);
3871 void skb_clone_tx_timestamp(struct sk_buff *skb);
3872 bool skb_defer_rx_timestamp(struct sk_buff *skb);
3876 static inline void skb_clone_tx_timestamp(struct sk_buff *skb) in skb_clone_tx_timestamp() argument
3880 static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) in skb_defer_rx_timestamp() argument
3899 void skb_complete_tx_timestamp(struct sk_buff *skb,
3932 static inline void skb_tx_timestamp(struct sk_buff *skb) in skb_tx_timestamp() argument
3934 skb_clone_tx_timestamp(skb); in skb_tx_timestamp()
3935 if (skb_shinfo(skb)->tx_flags & SKBTX_SW_TSTAMP) in skb_tx_timestamp()
3936 skb_tstamp_tx(skb, NULL); in skb_tx_timestamp()
3946 void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
3948 __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
3949 __sum16 __skb_checksum_complete(struct sk_buff *skb);
3951 static inline int skb_csum_unnecessary(const struct sk_buff *skb) in skb_csum_unnecessary() argument
3953 return ((skb->ip_summed == CHECKSUM_UNNECESSARY) || in skb_csum_unnecessary()
3954 skb->csum_valid || in skb_csum_unnecessary()
3955 (skb->ip_summed == CHECKSUM_PARTIAL && in skb_csum_unnecessary()
3956 skb_checksum_start_offset(skb) >= 0)); in skb_csum_unnecessary()
3975 static inline __sum16 skb_checksum_complete(struct sk_buff *skb) in skb_checksum_complete() argument
3977 return skb_csum_unnecessary(skb) ? in skb_checksum_complete()
3978 0 : __skb_checksum_complete(skb); in skb_checksum_complete()
3981 static inline void __skb_decr_checksum_unnecessary(struct sk_buff *skb) in __skb_decr_checksum_unnecessary() argument
3983 if (skb->ip_summed == CHECKSUM_UNNECESSARY) { in __skb_decr_checksum_unnecessary()
3984 if (skb->csum_level == 0) in __skb_decr_checksum_unnecessary()
3985 skb->ip_summed = CHECKSUM_NONE; in __skb_decr_checksum_unnecessary()
3987 skb->csum_level--; in __skb_decr_checksum_unnecessary()
3991 static inline void __skb_incr_checksum_unnecessary(struct sk_buff *skb) in __skb_incr_checksum_unnecessary() argument
3993 if (skb->ip_summed == CHECKSUM_UNNECESSARY) { in __skb_incr_checksum_unnecessary()
3994 if (skb->csum_level < SKB_MAX_CSUM_LEVEL) in __skb_incr_checksum_unnecessary()
3995 skb->csum_level++; in __skb_incr_checksum_unnecessary()
3996 } else if (skb->ip_summed == CHECKSUM_NONE) { in __skb_incr_checksum_unnecessary()
3997 skb->ip_summed = CHECKSUM_UNNECESSARY; in __skb_incr_checksum_unnecessary()
3998 skb->csum_level = 0; in __skb_incr_checksum_unnecessary()
4002 static inline void __skb_reset_checksum_unnecessary(struct sk_buff *skb) in __skb_reset_checksum_unnecessary() argument
4004 if (skb->ip_summed == CHECKSUM_UNNECESSARY) { in __skb_reset_checksum_unnecessary()
4005 skb->ip_summed = CHECKSUM_NONE; in __skb_reset_checksum_unnecessary()
4006 skb->csum_level = 0; in __skb_reset_checksum_unnecessary()
4015 static inline bool __skb_checksum_validate_needed(struct sk_buff *skb, in __skb_checksum_validate_needed() argument
4019 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) { in __skb_checksum_validate_needed()
4020 skb->csum_valid = 1; in __skb_checksum_validate_needed()
4021 __skb_decr_checksum_unnecessary(skb); in __skb_checksum_validate_needed()
4039 static inline void skb_checksum_complete_unset(struct sk_buff *skb) in skb_checksum_complete_unset() argument
4041 if (skb->ip_summed == CHECKSUM_COMPLETE) in skb_checksum_complete_unset()
4042 skb->ip_summed = CHECKSUM_NONE; in skb_checksum_complete_unset()
4054 static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb, in __skb_checksum_validate_complete() argument
4058 if (skb->ip_summed == CHECKSUM_COMPLETE) { in __skb_checksum_validate_complete()
4059 if (!csum_fold(csum_add(psum, skb->csum))) { in __skb_checksum_validate_complete()
4060 skb->csum_valid = 1; in __skb_checksum_validate_complete()
4065 skb->csum = psum; in __skb_checksum_validate_complete()
4067 if (complete || skb->len <= CHECKSUM_BREAK) { in __skb_checksum_validate_complete()
4070 csum = __skb_checksum_complete(skb); in __skb_checksum_validate_complete()
4071 skb->csum_valid = !csum; in __skb_checksum_validate_complete()
4078 static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto) in null_compute_pseudo() argument
4093 #define __skb_checksum_validate(skb, proto, complete, \ argument
4097 skb->csum_valid = 0; \
4098 if (__skb_checksum_validate_needed(skb, zero_okay, check)) \
4099 __ret = __skb_checksum_validate_complete(skb, \
4100 complete, compute_pseudo(skb, proto)); \
4104 #define skb_checksum_init(skb, proto, compute_pseudo) \ argument
4105 __skb_checksum_validate(skb, proto, false, false, 0, compute_pseudo)
4107 #define skb_checksum_init_zero_check(skb, proto, check, compute_pseudo) \ argument
4108 __skb_checksum_validate(skb, proto, false, true, check, compute_pseudo)
4110 #define skb_checksum_validate(skb, proto, compute_pseudo) \ argument
4111 __skb_checksum_validate(skb, proto, true, false, 0, compute_pseudo)
4113 #define skb_checksum_validate_zero_check(skb, proto, check, \ argument
4115 __skb_checksum_validate(skb, proto, true, true, check, compute_pseudo)
4117 #define skb_checksum_simple_validate(skb) \ argument
4118 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo)
4120 static inline bool __skb_checksum_convert_check(struct sk_buff *skb) in __skb_checksum_convert_check() argument
4122 return (skb->ip_summed == CHECKSUM_NONE && skb->csum_valid); in __skb_checksum_convert_check()
4125 static inline void __skb_checksum_convert(struct sk_buff *skb, __wsum pseudo) in __skb_checksum_convert() argument
4127 skb->csum = ~pseudo; in __skb_checksum_convert()
4128 skb->ip_summed = CHECKSUM_COMPLETE; in __skb_checksum_convert()
4131 #define skb_checksum_try_convert(skb, proto, compute_pseudo) \ argument
4133 if (__skb_checksum_convert_check(skb)) \
4134 __skb_checksum_convert(skb, compute_pseudo(skb, proto)); \
4137 static inline void skb_remcsum_adjust_partial(struct sk_buff *skb, void *ptr, in skb_remcsum_adjust_partial() argument
4140 skb->ip_summed = CHECKSUM_PARTIAL; in skb_remcsum_adjust_partial()
4141 skb->csum_start = ((unsigned char *)ptr + start) - skb->head; in skb_remcsum_adjust_partial()
4142 skb->csum_offset = offset - start; in skb_remcsum_adjust_partial()
4150 static inline void skb_remcsum_process(struct sk_buff *skb, void *ptr, in skb_remcsum_process() argument
4156 skb_remcsum_adjust_partial(skb, ptr, start, offset); in skb_remcsum_process()
4160 if (unlikely(skb->ip_summed != CHECKSUM_COMPLETE)) { in skb_remcsum_process()
4161 __skb_checksum_complete(skb); in skb_remcsum_process()
4162 skb_postpull_rcsum(skb, skb->data, ptr - (void *)skb->data); in skb_remcsum_process()
4165 delta = remcsum_adjust(ptr, skb->csum, start, offset); in skb_remcsum_process()
4168 skb->csum = csum_add(skb->csum, delta); in skb_remcsum_process()
4171 static inline struct nf_conntrack *skb_nfct(const struct sk_buff *skb) in skb_nfct() argument
4174 return (void *)(skb->_nfct & NFCT_PTRMASK); in skb_nfct()
4180 static inline unsigned long skb_get_nfct(const struct sk_buff *skb) in skb_get_nfct() argument
4183 return skb->_nfct; in skb_get_nfct()
4189 static inline void skb_set_nfct(struct sk_buff *skb, unsigned long nfct) in skb_set_nfct() argument
4192 skb->_nfct = nfct; in skb_set_nfct()
4234 void *__skb_ext_set(struct sk_buff *skb, enum skb_ext_id id,
4236 void *skb_ext_add(struct sk_buff *skb, enum skb_ext_id id);
4237 void __skb_ext_del(struct sk_buff *skb, enum skb_ext_id id);
4240 static inline void skb_ext_put(struct sk_buff *skb) in skb_ext_put() argument
4242 if (skb->active_extensions) in skb_ext_put()
4243 __skb_ext_put(skb->extensions); in skb_ext_put()
4270 static inline bool skb_ext_exist(const struct sk_buff *skb, enum skb_ext_id id) in skb_ext_exist() argument
4272 return skb->active_extensions & (1 << id); in skb_ext_exist()
4275 static inline void skb_ext_del(struct sk_buff *skb, enum skb_ext_id id) in skb_ext_del() argument
4277 if (skb_ext_exist(skb, id)) in skb_ext_del()
4278 __skb_ext_del(skb, id); in skb_ext_del()
4281 static inline void *skb_ext_find(const struct sk_buff *skb, enum skb_ext_id id) in skb_ext_find() argument
4283 if (skb_ext_exist(skb, id)) { in skb_ext_find()
4284 struct skb_ext *ext = skb->extensions; in skb_ext_find()
4292 static inline void skb_ext_reset(struct sk_buff *skb) in skb_ext_reset() argument
4294 if (unlikely(skb->active_extensions)) { in skb_ext_reset()
4295 __skb_ext_put(skb->extensions); in skb_ext_reset()
4296 skb->active_extensions = 0; in skb_ext_reset()
4300 static inline bool skb_has_extensions(struct sk_buff *skb) in skb_has_extensions() argument
4302 return unlikely(skb->active_extensions); in skb_has_extensions()
4305 static inline void skb_ext_put(struct sk_buff *skb) {} in skb_ext_put() argument
4306 static inline void skb_ext_reset(struct sk_buff *skb) {} in skb_ext_reset() argument
4307 static inline void skb_ext_del(struct sk_buff *skb, int unused) {} in skb_ext_del() argument
4310 static inline bool skb_has_extensions(struct sk_buff *skb) { return false; } in skb_has_extensions() argument
4313 static inline void nf_reset_ct(struct sk_buff *skb) in nf_reset_ct() argument
4316 nf_conntrack_put(skb_nfct(skb)); in nf_reset_ct()
4317 skb->_nfct = 0; in nf_reset_ct()
4321 static inline void nf_reset_trace(struct sk_buff *skb) in nf_reset_trace() argument
4324 skb->nf_trace = 0; in nf_reset_trace()
4328 static inline void ipvs_reset(struct sk_buff *skb) in ipvs_reset() argument
4331 skb->ipvs_property = 0; in ipvs_reset()
4363 static inline void skb_init_secmark(struct sk_buff *skb) in skb_init_secmark() argument
4365 skb->secmark = 0; in skb_init_secmark()
4371 static inline void skb_init_secmark(struct sk_buff *skb) in skb_init_secmark() argument
4375 static inline int secpath_exists(const struct sk_buff *skb) in secpath_exists() argument
4378 return skb_ext_exist(skb, SKB_EXT_SEC_PATH); in secpath_exists()
4384 static inline bool skb_irq_freeable(const struct sk_buff *skb) in skb_irq_freeable() argument
4386 return !skb->destructor && in skb_irq_freeable()
4387 !secpath_exists(skb) && in skb_irq_freeable()
4388 !skb_nfct(skb) && in skb_irq_freeable()
4389 !skb->_skb_refdst && in skb_irq_freeable()
4390 !skb_has_frag_list(skb); in skb_irq_freeable()
4393 static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) in skb_set_queue_mapping() argument
4395 skb->queue_mapping = queue_mapping; in skb_set_queue_mapping()
4398 static inline u16 skb_get_queue_mapping(const struct sk_buff *skb) in skb_get_queue_mapping() argument
4400 return skb->queue_mapping; in skb_get_queue_mapping()
4408 static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue) in skb_record_rx_queue() argument
4410 skb->queue_mapping = rx_queue + 1; in skb_record_rx_queue()
4413 static inline u16 skb_get_rx_queue(const struct sk_buff *skb) in skb_get_rx_queue() argument
4415 return skb->queue_mapping - 1; in skb_get_rx_queue()
4418 static inline bool skb_rx_queue_recorded(const struct sk_buff *skb) in skb_rx_queue_recorded() argument
4420 return skb->queue_mapping != 0; in skb_rx_queue_recorded()
4423 static inline void skb_set_dst_pending_confirm(struct sk_buff *skb, u32 val) in skb_set_dst_pending_confirm() argument
4425 skb->dst_pending_confirm = val; in skb_set_dst_pending_confirm()
4428 static inline bool skb_get_dst_pending_confirm(const struct sk_buff *skb) in skb_get_dst_pending_confirm() argument
4430 return skb->dst_pending_confirm != 0; in skb_get_dst_pending_confirm()
4433 static inline struct sec_path *skb_sec_path(const struct sk_buff *skb) in skb_sec_path() argument
4436 return skb_ext_find(skb, SKB_EXT_SEC_PATH); in skb_sec_path()
4458 #define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_GSO_CB_OFFSET)) argument
4466 static inline int gso_pskb_expand_head(struct sk_buff *skb, int extra) in gso_pskb_expand_head() argument
4471 headroom = skb_headroom(skb); in gso_pskb_expand_head()
4472 ret = pskb_expand_head(skb, extra, 0, GFP_ATOMIC); in gso_pskb_expand_head()
4476 new_headroom = skb_headroom(skb); in gso_pskb_expand_head()
4477 SKB_GSO_CB(skb)->mac_offset += (new_headroom - headroom); in gso_pskb_expand_head()
4481 static inline void gso_reset_checksum(struct sk_buff *skb, __wsum res) in gso_reset_checksum() argument
4484 if (skb->remcsum_offload) in gso_reset_checksum()
4487 SKB_GSO_CB(skb)->csum = res; in gso_reset_checksum()
4488 SKB_GSO_CB(skb)->csum_start = skb_checksum_start(skb) - skb->head; in gso_reset_checksum()
4499 static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res) in gso_make_checksum() argument
4501 unsigned char *csum_start = skb_transport_header(skb); in gso_make_checksum()
4502 int plen = (skb->head + SKB_GSO_CB(skb)->csum_start) - csum_start; in gso_make_checksum()
4503 __wsum partial = SKB_GSO_CB(skb)->csum; in gso_make_checksum()
4505 SKB_GSO_CB(skb)->csum = res; in gso_make_checksum()
4506 SKB_GSO_CB(skb)->csum_start = csum_start - skb->head; in gso_make_checksum()
4511 static inline bool skb_is_gso(const struct sk_buff *skb) in skb_is_gso() argument
4513 return skb_shinfo(skb)->gso_size; in skb_is_gso()
4517 static inline bool skb_is_gso_v6(const struct sk_buff *skb) in skb_is_gso_v6() argument
4519 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; in skb_is_gso_v6()
4523 static inline bool skb_is_gso_sctp(const struct sk_buff *skb) in skb_is_gso_sctp() argument
4525 return skb_shinfo(skb)->gso_type & SKB_GSO_SCTP; in skb_is_gso_sctp()
4529 static inline bool skb_is_gso_tcp(const struct sk_buff *skb) in skb_is_gso_tcp() argument
4531 return skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6); in skb_is_gso_tcp()
4534 static inline void skb_gso_reset(struct sk_buff *skb) in skb_gso_reset() argument
4536 skb_shinfo(skb)->gso_size = 0; in skb_gso_reset()
4537 skb_shinfo(skb)->gso_segs = 0; in skb_gso_reset()
4538 skb_shinfo(skb)->gso_type = 0; in skb_gso_reset()
4557 void __skb_warn_lro_forwarding(const struct sk_buff *skb);
4559 static inline bool skb_warn_if_lro(const struct sk_buff *skb) in skb_warn_if_lro() argument
4563 const struct skb_shared_info *shinfo = skb_shinfo(skb); in skb_warn_if_lro()
4565 if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 && in skb_warn_if_lro()
4567 __skb_warn_lro_forwarding(skb); in skb_warn_if_lro()
4573 static inline void skb_forward_csum(struct sk_buff *skb) in skb_forward_csum() argument
4576 if (skb->ip_summed == CHECKSUM_COMPLETE) in skb_forward_csum()
4577 skb->ip_summed = CHECKSUM_NONE; in skb_forward_csum()
4588 static inline void skb_checksum_none_assert(const struct sk_buff *skb) in skb_checksum_none_assert() argument
4591 BUG_ON(skb->ip_summed != CHECKSUM_NONE); in skb_checksum_none_assert()
4595 bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
4597 int skb_checksum_setup(struct sk_buff *skb, bool recalculate);
4598 struct sk_buff *skb_checksum_trimmed(struct sk_buff *skb,
4600 __sum16(*skb_chkf)(struct sk_buff *skb));
4611 static inline bool skb_head_is_locked(const struct sk_buff *skb) in skb_head_is_locked() argument
4613 return !skb->head_frag || skb_cloned(skb); in skb_head_is_locked()
4625 static inline __wsum lco_csum(struct sk_buff *skb) in lco_csum() argument
4627 unsigned char *csum_start = skb_checksum_start(skb); in lco_csum()
4628 unsigned char *l4_hdr = skb_transport_header(skb); in lco_csum()
4633 skb->csum_offset)); in lco_csum()
4641 static inline bool skb_is_redirected(const struct sk_buff *skb) in skb_is_redirected() argument
4644 return skb->redirected; in skb_is_redirected()
4650 static inline void skb_set_redirected(struct sk_buff *skb, bool from_ingress) in skb_set_redirected() argument
4653 skb->redirected = 1; in skb_set_redirected()
4654 skb->from_ingress = from_ingress; in skb_set_redirected()
4655 if (skb->from_ingress) in skb_set_redirected()
4656 skb->tstamp = 0; in skb_set_redirected()
4660 static inline void skb_reset_redirect(struct sk_buff *skb) in skb_reset_redirect() argument
4663 skb->redirected = 0; in skb_reset_redirect()
4668 static inline void skb_set_kcov_handle(struct sk_buff *skb, in skb_set_kcov_handle() argument
4677 if (skb_has_extensions(skb) || kcov_handle) { in skb_set_kcov_handle()
4678 u64 *kcov_handle_ptr = skb_ext_add(skb, SKB_EXT_KCOV_HANDLE); in skb_set_kcov_handle()
4685 static inline u64 skb_get_kcov_handle(struct sk_buff *skb) in skb_get_kcov_handle() argument
4687 u64 *kcov_handle = skb_ext_find(skb, SKB_EXT_KCOV_HANDLE); in skb_get_kcov_handle()
4692 static inline void skb_set_kcov_handle(struct sk_buff *skb, in skb_set_kcov_handle() argument
4694 static inline u64 skb_get_kcov_handle(struct sk_buff *skb) { return 0; } in skb_get_kcov_handle() argument