• Home
  • Raw
  • Download

Lines Matching refs:skb

436 	void			(*destructor)(struct sk_buff *skb);
517 static inline struct dst_entry *skb_dst(const struct sk_buff *skb) in skb_dst() argument
522 WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) && in skb_dst()
525 return (struct dst_entry *)(skb->_skb_refdst & SKB_DST_PTRMASK); in skb_dst()
536 static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) in skb_dst_set() argument
538 skb->_skb_refdst = (unsigned long)dst; in skb_dst_set()
541 extern void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst);
547 static inline bool skb_dst_is_noref(const struct sk_buff *skb) in skb_dst_is_noref() argument
549 return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb); in skb_dst_is_noref()
552 static inline struct rtable *skb_rtable(const struct sk_buff *skb) in skb_rtable() argument
554 return (struct rtable *)skb_dst(skb); in skb_rtable()
557 extern void kfree_skb(struct sk_buff *skb);
558 extern void consume_skb(struct sk_buff *skb);
559 extern void __kfree_skb(struct sk_buff *skb);
575 extern void skb_recycle(struct sk_buff *skb);
576 extern bool skb_recycle_check(struct sk_buff *skb, int skb_size);
579 extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
580 extern struct sk_buff *skb_clone(struct sk_buff *skb,
582 extern struct sk_buff *skb_copy(const struct sk_buff *skb,
584 extern struct sk_buff *__pskb_copy(struct sk_buff *skb,
587 extern int pskb_expand_head(struct sk_buff *skb,
590 extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
592 extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
595 extern int skb_to_sgvec(struct sk_buff *skb,
598 extern int skb_cow_data(struct sk_buff *skb, int tailbits,
600 extern int skb_pad(struct sk_buff *skb, int pad);
603 extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
605 int len,int odd, struct sk_buff *skb),
618 extern void skb_prepare_seq_read(struct sk_buff *skb,
625 extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
629 extern void __skb_get_rxhash(struct sk_buff *skb);
630 static inline __u32 skb_get_rxhash(struct sk_buff *skb) in skb_get_rxhash() argument
632 if (!skb->rxhash) in skb_get_rxhash()
633 __skb_get_rxhash(skb); in skb_get_rxhash()
635 return skb->rxhash; in skb_get_rxhash()
639 static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) in skb_end_pointer() argument
641 return skb->head + skb->end; in skb_end_pointer()
644 static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) in skb_end_pointer() argument
646 return skb->end; in skb_end_pointer()
653 static inline struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb) in skb_hwtstamps() argument
655 return &skb_shinfo(skb)->hwtstamps; in skb_hwtstamps()
677 const struct sk_buff *skb) in skb_queue_is_last() argument
679 return skb->next == (struct sk_buff *)list; in skb_queue_is_last()
690 const struct sk_buff *skb) in skb_queue_is_first() argument
692 return skb->prev == (struct sk_buff *)list; in skb_queue_is_first()
704 const struct sk_buff *skb) in skb_queue_next() argument
709 BUG_ON(skb_queue_is_last(list, skb)); in skb_queue_next()
710 return skb->next; in skb_queue_next()
722 const struct sk_buff *skb) in skb_queue_prev() argument
727 BUG_ON(skb_queue_is_first(list, skb)); in skb_queue_prev()
728 return skb->prev; in skb_queue_prev()
738 static inline struct sk_buff *skb_get(struct sk_buff *skb) in skb_get() argument
740 atomic_inc(&skb->users); in skb_get()
741 return skb; in skb_get()
757 static inline int skb_cloned(const struct sk_buff *skb) in skb_cloned() argument
759 return skb->cloned && in skb_cloned()
760 (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1; in skb_cloned()
770 static inline int skb_header_cloned(const struct sk_buff *skb) in skb_header_cloned() argument
774 if (!skb->cloned) in skb_header_cloned()
777 dataref = atomic_read(&skb_shinfo(skb)->dataref); in skb_header_cloned()
790 static inline void skb_header_release(struct sk_buff *skb) in skb_header_release() argument
792 BUG_ON(skb->nohdr); in skb_header_release()
793 skb->nohdr = 1; in skb_header_release()
794 atomic_add(1 << SKB_DATAREF_SHIFT, &skb_shinfo(skb)->dataref); in skb_header_release()
804 static inline int skb_shared(const struct sk_buff *skb) in skb_shared() argument
806 return atomic_read(&skb->users) != 1; in skb_shared()
822 static inline struct sk_buff *skb_share_check(struct sk_buff *skb, in skb_share_check() argument
826 if (skb_shared(skb)) { in skb_share_check()
827 struct sk_buff *nskb = skb_clone(skb, pri); in skb_share_check()
828 kfree_skb(skb); in skb_share_check()
829 skb = nskb; in skb_share_check()
831 return skb; in skb_share_check()
854 static inline struct sk_buff *skb_unshare(struct sk_buff *skb, in skb_unshare() argument
858 if (skb_cloned(skb)) { in skb_unshare()
859 struct sk_buff *nskb = skb_copy(skb, pri); in skb_unshare()
860 kfree_skb(skb); /* Free our shared copy */ in skb_unshare()
861 skb = nskb; in skb_unshare()
863 return skb; in skb_unshare()
896 static inline struct sk_buff *skb_peek_next(struct sk_buff *skb, in skb_peek_next() argument
899 struct sk_buff *next = skb->next; in skb_peek_next()
1134 extern void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list);
1135 static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) in __skb_unlink() argument
1140 next = skb->next; in __skb_unlink()
1141 prev = skb->prev; in __skb_unlink()
1142 skb->next = skb->prev = NULL; in __skb_unlink()
1158 struct sk_buff *skb = skb_peek(list); in __skb_dequeue() local
1159 if (skb) in __skb_dequeue()
1160 __skb_unlink(skb, list); in __skb_dequeue()
1161 return skb; in __skb_dequeue()
1175 struct sk_buff *skb = skb_peek_tail(list); in __skb_dequeue_tail() local
1176 if (skb) in __skb_dequeue_tail()
1177 __skb_unlink(skb, list); in __skb_dequeue_tail()
1178 return skb; in __skb_dequeue_tail()
1182 static inline bool skb_is_nonlinear(const struct sk_buff *skb) in skb_is_nonlinear() argument
1184 return skb->data_len; in skb_is_nonlinear()
1187 static inline unsigned int skb_headlen(const struct sk_buff *skb) in skb_headlen() argument
1189 return skb->len - skb->data_len; in skb_headlen()
1192 static inline int skb_pagelen(const struct sk_buff *skb) in skb_pagelen() argument
1196 for (i = (int)skb_shinfo(skb)->nr_frags - 1; i >= 0; i--) in skb_pagelen()
1197 len += skb_frag_size(&skb_shinfo(skb)->frags[i]); in skb_pagelen()
1198 return len + skb_headlen(skb); in skb_pagelen()
1214 static inline void __skb_fill_page_desc(struct sk_buff *skb, int i, in __skb_fill_page_desc() argument
1217 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; in __skb_fill_page_desc()
1238 static inline void skb_fill_page_desc(struct sk_buff *skb, int i, in skb_fill_page_desc() argument
1241 __skb_fill_page_desc(skb, i, page, off, size); in skb_fill_page_desc()
1242 skb_shinfo(skb)->nr_frags = i + 1; in skb_fill_page_desc()
1245 extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
1248 #define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) argument
1249 #define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frag_list(skb)) argument
1250 #define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) argument
1253 static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) in skb_tail_pointer() argument
1255 return skb->head + skb->tail; in skb_tail_pointer()
1258 static inline void skb_reset_tail_pointer(struct sk_buff *skb) in skb_reset_tail_pointer() argument
1260 skb->tail = skb->data - skb->head; in skb_reset_tail_pointer()
1263 static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) in skb_set_tail_pointer() argument
1265 skb_reset_tail_pointer(skb); in skb_set_tail_pointer()
1266 skb->tail += offset; in skb_set_tail_pointer()
1269 static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) in skb_tail_pointer() argument
1271 return skb->tail; in skb_tail_pointer()
1274 static inline void skb_reset_tail_pointer(struct sk_buff *skb) in skb_reset_tail_pointer() argument
1276 skb->tail = skb->data; in skb_reset_tail_pointer()
1279 static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) in skb_set_tail_pointer() argument
1281 skb->tail = skb->data + offset; in skb_set_tail_pointer()
1289 extern unsigned char *skb_put(struct sk_buff *skb, unsigned int len);
1290 static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) in __skb_put() argument
1292 unsigned char *tmp = skb_tail_pointer(skb); in __skb_put()
1293 SKB_LINEAR_ASSERT(skb); in __skb_put()
1294 skb->tail += len; in __skb_put()
1295 skb->len += len; in __skb_put()
1299 extern unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
1300 static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) in __skb_push() argument
1302 skb->data -= len; in __skb_push()
1303 skb->len += len; in __skb_push()
1304 return skb->data; in __skb_push()
1307 extern unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
1308 static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) in __skb_pull() argument
1310 skb->len -= len; in __skb_pull()
1311 BUG_ON(skb->len < skb->data_len); in __skb_pull()
1312 return skb->data += len; in __skb_pull()
1315 static inline unsigned char *skb_pull_inline(struct sk_buff *skb, unsigned int len) in skb_pull_inline() argument
1317 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len); in skb_pull_inline()
1320 extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
1322 static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) in __pskb_pull() argument
1324 if (len > skb_headlen(skb) && in __pskb_pull()
1325 !__pskb_pull_tail(skb, len - skb_headlen(skb))) in __pskb_pull()
1327 skb->len -= len; in __pskb_pull()
1328 return skb->data += len; in __pskb_pull()
1331 static inline unsigned char *pskb_pull(struct sk_buff *skb, unsigned int len) in pskb_pull() argument
1333 return unlikely(len > skb->len) ? NULL : __pskb_pull(skb, len); in pskb_pull()
1336 static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len) in pskb_may_pull() argument
1338 if (likely(len <= skb_headlen(skb))) in pskb_may_pull()
1340 if (unlikely(len > skb->len)) in pskb_may_pull()
1342 return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL; in pskb_may_pull()
1351 static inline unsigned int skb_headroom(const struct sk_buff *skb) in skb_headroom() argument
1353 return skb->data - skb->head; in skb_headroom()
1362 static inline int skb_tailroom(const struct sk_buff *skb) in skb_tailroom() argument
1364 return skb_is_nonlinear(skb) ? 0 : skb->end - skb->tail; in skb_tailroom()
1374 static inline int skb_availroom(const struct sk_buff *skb) in skb_availroom() argument
1376 if (skb_is_nonlinear(skb)) in skb_availroom()
1379 return skb->end - skb->tail - skb->reserved_tailroom; in skb_availroom()
1390 static inline void skb_reserve(struct sk_buff *skb, int len) in skb_reserve() argument
1392 skb->data += len; in skb_reserve()
1393 skb->tail += len; in skb_reserve()
1396 static inline void skb_reset_mac_len(struct sk_buff *skb) in skb_reset_mac_len() argument
1398 skb->mac_len = skb->network_header - skb->mac_header; in skb_reset_mac_len()
1402 static inline unsigned char *skb_transport_header(const struct sk_buff *skb) in skb_transport_header() argument
1404 return skb->head + skb->transport_header; in skb_transport_header()
1407 static inline void skb_reset_transport_header(struct sk_buff *skb) in skb_reset_transport_header() argument
1409 skb->transport_header = skb->data - skb->head; in skb_reset_transport_header()
1412 static inline void skb_set_transport_header(struct sk_buff *skb, in skb_set_transport_header() argument
1415 skb_reset_transport_header(skb); in skb_set_transport_header()
1416 skb->transport_header += offset; in skb_set_transport_header()
1419 static inline unsigned char *skb_network_header(const struct sk_buff *skb) in skb_network_header() argument
1421 return skb->head + skb->network_header; in skb_network_header()
1424 static inline void skb_reset_network_header(struct sk_buff *skb) in skb_reset_network_header() argument
1426 skb->network_header = skb->data - skb->head; in skb_reset_network_header()
1429 static inline void skb_set_network_header(struct sk_buff *skb, const int offset) in skb_set_network_header() argument
1431 skb_reset_network_header(skb); in skb_set_network_header()
1432 skb->network_header += offset; in skb_set_network_header()
1435 static inline unsigned char *skb_mac_header(const struct sk_buff *skb) in skb_mac_header() argument
1437 return skb->head + skb->mac_header; in skb_mac_header()
1440 static inline int skb_mac_header_was_set(const struct sk_buff *skb) in skb_mac_header_was_set() argument
1442 return skb->mac_header != ~0U; in skb_mac_header_was_set()
1445 static inline void skb_reset_mac_header(struct sk_buff *skb) in skb_reset_mac_header() argument
1447 skb->mac_header = skb->data - skb->head; in skb_reset_mac_header()
1450 static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) in skb_set_mac_header() argument
1452 skb_reset_mac_header(skb); in skb_set_mac_header()
1453 skb->mac_header += offset; in skb_set_mac_header()
1458 static inline unsigned char *skb_transport_header(const struct sk_buff *skb) in skb_transport_header() argument
1460 return skb->transport_header; in skb_transport_header()
1463 static inline void skb_reset_transport_header(struct sk_buff *skb) in skb_reset_transport_header() argument
1465 skb->transport_header = skb->data; in skb_reset_transport_header()
1468 static inline void skb_set_transport_header(struct sk_buff *skb, in skb_set_transport_header() argument
1471 skb->transport_header = skb->data + offset; in skb_set_transport_header()
1474 static inline unsigned char *skb_network_header(const struct sk_buff *skb) in skb_network_header() argument
1476 return skb->network_header; in skb_network_header()
1479 static inline void skb_reset_network_header(struct sk_buff *skb) in skb_reset_network_header() argument
1481 skb->network_header = skb->data; in skb_reset_network_header()
1484 static inline void skb_set_network_header(struct sk_buff *skb, const int offset) in skb_set_network_header() argument
1486 skb->network_header = skb->data + offset; in skb_set_network_header()
1489 static inline unsigned char *skb_mac_header(const struct sk_buff *skb) in skb_mac_header() argument
1491 return skb->mac_header; in skb_mac_header()
1494 static inline int skb_mac_header_was_set(const struct sk_buff *skb) in skb_mac_header_was_set() argument
1496 return skb->mac_header != NULL; in skb_mac_header_was_set()
1499 static inline void skb_reset_mac_header(struct sk_buff *skb) in skb_reset_mac_header() argument
1501 skb->mac_header = skb->data; in skb_reset_mac_header()
1504 static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) in skb_set_mac_header() argument
1506 skb->mac_header = skb->data + offset; in skb_set_mac_header()
1510 static inline void skb_mac_header_rebuild(struct sk_buff *skb) in skb_mac_header_rebuild() argument
1512 if (skb_mac_header_was_set(skb)) { in skb_mac_header_rebuild()
1513 const unsigned char *old_mac = skb_mac_header(skb); in skb_mac_header_rebuild()
1515 skb_set_mac_header(skb, -skb->mac_len); in skb_mac_header_rebuild()
1516 memmove(skb_mac_header(skb), old_mac, skb->mac_len); in skb_mac_header_rebuild()
1520 static inline int skb_checksum_start_offset(const struct sk_buff *skb) in skb_checksum_start_offset() argument
1522 return skb->csum_start - skb_headroom(skb); in skb_checksum_start_offset()
1525 static inline int skb_transport_offset(const struct sk_buff *skb) in skb_transport_offset() argument
1527 return skb_transport_header(skb) - skb->data; in skb_transport_offset()
1530 static inline u32 skb_network_header_len(const struct sk_buff *skb) in skb_network_header_len() argument
1532 return skb->transport_header - skb->network_header; in skb_network_header_len()
1535 static inline int skb_network_offset(const struct sk_buff *skb) in skb_network_offset() argument
1537 return skb_network_header(skb) - skb->data; in skb_network_offset()
1540 static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len) in pskb_network_may_pull() argument
1542 return pskb_may_pull(skb, skb_network_offset(skb) + len); in pskb_network_may_pull()
1593 extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
1595 static inline void __skb_trim(struct sk_buff *skb, unsigned int len) in __skb_trim() argument
1597 if (unlikely(skb_is_nonlinear(skb))) { in __skb_trim()
1601 skb->len = len; in __skb_trim()
1602 skb_set_tail_pointer(skb, len); in __skb_trim()
1605 extern void skb_trim(struct sk_buff *skb, unsigned int len);
1607 static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) in __pskb_trim() argument
1609 if (skb->data_len) in __pskb_trim()
1610 return ___pskb_trim(skb, len); in __pskb_trim()
1611 __skb_trim(skb, len); in __pskb_trim()
1615 static inline int pskb_trim(struct sk_buff *skb, unsigned int len) in pskb_trim() argument
1617 return (len < skb->len) ? __pskb_trim(skb, len) : 0; in pskb_trim()
1629 static inline void pskb_trim_unique(struct sk_buff *skb, unsigned int len) in pskb_trim_unique() argument
1631 int err = pskb_trim(skb, len); in pskb_trim_unique()
1643 static inline void skb_orphan(struct sk_buff *skb) in skb_orphan() argument
1645 if (skb->destructor) in skb_orphan()
1646 skb->destructor(skb); in skb_orphan()
1647 skb->destructor = NULL; in skb_orphan()
1648 skb->sk = NULL; in skb_orphan()
1662 struct sk_buff *skb; in __skb_queue_purge() local
1663 while ((skb = __skb_dequeue(list)) != NULL) in __skb_queue_purge()
1664 kfree_skb(skb); in __skb_queue_purge()
1682 struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask); in __dev_alloc_skb() local
1683 if (likely(skb)) in __dev_alloc_skb()
1684 skb_reserve(skb, NET_SKB_PAD); in __dev_alloc_skb()
1685 return skb; in __dev_alloc_skb()
1715 struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); in __netdev_alloc_skb_ip_align() local
1717 if (NET_IP_ALIGN && skb) in __netdev_alloc_skb_ip_align()
1718 skb_reserve(skb, NET_IP_ALIGN); in __netdev_alloc_skb_ip_align()
1719 return skb; in __netdev_alloc_skb_ip_align()
1757 static inline void skb_frag_ref(struct sk_buff *skb, int f) in skb_frag_ref() argument
1759 __skb_frag_ref(&skb_shinfo(skb)->frags[f]); in skb_frag_ref()
1780 static inline void skb_frag_unref(struct sk_buff *skb, int f) in skb_frag_unref() argument
1782 __skb_frag_unref(&skb_shinfo(skb)->frags[f]); in skb_frag_unref()
1833 static inline void skb_frag_set_page(struct sk_buff *skb, int f, in skb_frag_set_page() argument
1836 __skb_frag_set_page(&skb_shinfo(skb)->frags[f], page); in skb_frag_set_page()
1859 static inline struct sk_buff *pskb_copy(struct sk_buff *skb, in pskb_copy() argument
1862 return __pskb_copy(skb, skb_headroom(skb), gfp_mask); in pskb_copy()
1873 static inline int skb_clone_writable(const struct sk_buff *skb, unsigned int len) in skb_clone_writable() argument
1875 return !skb_header_cloned(skb) && in skb_clone_writable()
1876 skb_headroom(skb) + len <= skb->hdr_len; in skb_clone_writable()
1879 static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom, in __skb_cow() argument
1884 if (headroom > skb_headroom(skb)) in __skb_cow()
1885 delta = headroom - skb_headroom(skb); in __skb_cow()
1888 return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0, in __skb_cow()
1905 static inline int skb_cow(struct sk_buff *skb, unsigned int headroom) in skb_cow() argument
1907 return __skb_cow(skb, headroom, skb_cloned(skb)); in skb_cow()
1920 static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom) in skb_cow_head() argument
1922 return __skb_cow(skb, headroom, skb_header_cloned(skb)); in skb_cow_head()
1936 static inline int skb_padto(struct sk_buff *skb, unsigned int len) in skb_padto() argument
1938 unsigned int size = skb->len; in skb_padto()
1941 return skb_pad(skb, len - size); in skb_padto()
1944 static inline int skb_add_data(struct sk_buff *skb, in skb_add_data() argument
1947 const int off = skb->len; in skb_add_data()
1949 if (skb->ip_summed == CHECKSUM_NONE) { in skb_add_data()
1951 __wsum csum = csum_and_copy_from_user(from, skb_put(skb, copy), in skb_add_data()
1954 skb->csum = csum_block_add(skb->csum, csum, off); in skb_add_data()
1957 } else if (!copy_from_user(skb_put(skb, copy), from, copy)) in skb_add_data()
1960 __skb_trim(skb, off); in skb_add_data()
1964 static inline int skb_can_coalesce(struct sk_buff *skb, int i, in skb_can_coalesce() argument
1968 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1]; in skb_can_coalesce()
1976 static inline int __skb_linearize(struct sk_buff *skb) in __skb_linearize() argument
1978 return __pskb_pull_tail(skb, skb->data_len) ? 0 : -ENOMEM; in __skb_linearize()
1988 static inline int skb_linearize(struct sk_buff *skb) in skb_linearize() argument
1990 return skb_is_nonlinear(skb) ? __skb_linearize(skb) : 0; in skb_linearize()
2000 static inline int skb_linearize_cow(struct sk_buff *skb) in skb_linearize_cow() argument
2002 return skb_is_nonlinear(skb) || skb_cloned(skb) ? in skb_linearize_cow()
2003 __skb_linearize(skb) : 0; in skb_linearize_cow()
2017 static inline void skb_postpull_rcsum(struct sk_buff *skb, in skb_postpull_rcsum() argument
2020 if (skb->ip_summed == CHECKSUM_COMPLETE) in skb_postpull_rcsum()
2021 skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); in skb_postpull_rcsum()
2024 unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
2035 static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) in pskb_trim_rcsum() argument
2037 if (likely(len >= skb->len)) in pskb_trim_rcsum()
2039 if (skb->ip_summed == CHECKSUM_COMPLETE) in pskb_trim_rcsum()
2040 skb->ip_summed = CHECKSUM_NONE; in pskb_trim_rcsum()
2041 return __pskb_trim(skb, len); in pskb_trim_rcsum()
2044 #define skb_queue_walk(queue, skb) \ argument
2045 for (skb = (queue)->next; \
2046 skb != (struct sk_buff *)(queue); \
2047 skb = skb->next)
2049 #define skb_queue_walk_safe(queue, skb, tmp) \ argument
2050 for (skb = (queue)->next, tmp = skb->next; \
2051 skb != (struct sk_buff *)(queue); \
2052 skb = tmp, tmp = skb->next)
2054 #define skb_queue_walk_from(queue, skb) \ argument
2055 for (; skb != (struct sk_buff *)(queue); \
2056 skb = skb->next)
2058 #define skb_queue_walk_from_safe(queue, skb, tmp) \ argument
2059 for (tmp = skb->next; \
2060 skb != (struct sk_buff *)(queue); \
2061 skb = tmp, tmp = skb->next)
2063 #define skb_queue_reverse_walk(queue, skb) \ argument
2064 for (skb = (queue)->prev; \
2065 skb != (struct sk_buff *)(queue); \
2066 skb = skb->prev)
2068 #define skb_queue_reverse_walk_safe(queue, skb, tmp) \ argument
2069 for (skb = (queue)->prev, tmp = skb->prev; \
2070 skb != (struct sk_buff *)(queue); \
2071 skb = tmp, tmp = skb->prev)
2073 #define skb_queue_reverse_walk_from_safe(queue, skb, tmp) \ argument
2074 for (tmp = skb->prev; \
2075 skb != (struct sk_buff *)(queue); \
2076 skb = tmp, tmp = skb->prev)
2078 static inline bool skb_has_frag_list(const struct sk_buff *skb) in skb_has_frag_list() argument
2080 return skb_shinfo(skb)->frag_list != NULL; in skb_has_frag_list()
2083 static inline void skb_frag_list_init(struct sk_buff *skb) in skb_frag_list_init() argument
2085 skb_shinfo(skb)->frag_list = NULL; in skb_frag_list_init()
2088 static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag) in skb_frag_add_head() argument
2090 frag->next = skb_shinfo(skb)->frag_list; in skb_frag_add_head()
2091 skb_shinfo(skb)->frag_list = frag; in skb_frag_add_head()
2094 #define skb_walk_frags(skb, iter) \ argument
2095 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
2106 extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
2109 extern int skb_copy_datagram_from_iovec(struct sk_buff *skb,
2119 extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
2121 struct sk_buff *skb);
2122 extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
2124 extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
2126 extern int skb_copy_bits(const struct sk_buff *skb, int offset,
2128 extern int skb_store_bits(struct sk_buff *skb, int offset,
2130 extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb,
2133 extern int skb_splice_bits(struct sk_buff *skb,
2138 extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
2139 extern void skb_split(struct sk_buff *skb,
2141 extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
2144 extern struct sk_buff *skb_segment(struct sk_buff *skb,
2147 static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, in skb_header_pointer() argument
2150 int hlen = skb_headlen(skb); in skb_header_pointer()
2153 return skb->data + offset; in skb_header_pointer()
2155 if (skb_copy_bits(skb, offset, buffer, len) < 0) in skb_header_pointer()
2161 static inline void skb_copy_from_linear_data(const struct sk_buff *skb, in skb_copy_from_linear_data() argument
2165 memcpy(to, skb->data, len); in skb_copy_from_linear_data()
2168 static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb, in skb_copy_from_linear_data_offset() argument
2172 memcpy(to, skb->data + offset, len); in skb_copy_from_linear_data_offset()
2175 static inline void skb_copy_to_linear_data(struct sk_buff *skb, in skb_copy_to_linear_data() argument
2179 memcpy(skb->data, from, len); in skb_copy_to_linear_data()
2182 static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb, in skb_copy_to_linear_data_offset() argument
2187 memcpy(skb->data + offset, from, len); in skb_copy_to_linear_data_offset()
2192 static inline ktime_t skb_get_ktime(const struct sk_buff *skb) in skb_get_ktime() argument
2194 return skb->tstamp; in skb_get_ktime()
2206 static inline void skb_get_timestamp(const struct sk_buff *skb, in skb_get_timestamp() argument
2209 *stamp = ktime_to_timeval(skb->tstamp); in skb_get_timestamp()
2212 static inline void skb_get_timestampns(const struct sk_buff *skb, in skb_get_timestampns() argument
2215 *stamp = ktime_to_timespec(skb->tstamp); in skb_get_timestampns()
2218 static inline void __net_timestamp(struct sk_buff *skb) in __net_timestamp() argument
2220 skb->tstamp = ktime_get_real(); in __net_timestamp()
2237 extern void skb_clone_tx_timestamp(struct sk_buff *skb);
2238 extern bool skb_defer_rx_timestamp(struct sk_buff *skb);
2242 static inline void skb_clone_tx_timestamp(struct sk_buff *skb) in skb_clone_tx_timestamp() argument
2246 static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) in skb_defer_rx_timestamp() argument
2265 void skb_complete_tx_timestamp(struct sk_buff *skb,
2282 static inline void sw_tx_timestamp(struct sk_buff *skb) in sw_tx_timestamp() argument
2284 if (skb_shinfo(skb)->tx_flags & SKBTX_SW_TSTAMP && in sw_tx_timestamp()
2285 !(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) in sw_tx_timestamp()
2286 skb_tstamp_tx(skb, NULL); in sw_tx_timestamp()
2297 static inline void skb_tx_timestamp(struct sk_buff *skb) in skb_tx_timestamp() argument
2299 skb_clone_tx_timestamp(skb); in skb_tx_timestamp()
2300 sw_tx_timestamp(skb); in skb_tx_timestamp()
2310 void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);
2312 extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
2313 extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
2315 static inline int skb_csum_unnecessary(const struct sk_buff *skb) in skb_csum_unnecessary() argument
2317 return skb->ip_summed & CHECKSUM_UNNECESSARY; in skb_csum_unnecessary()
2336 static inline __sum16 skb_checksum_complete(struct sk_buff *skb) in skb_checksum_complete() argument
2338 return skb_csum_unnecessary(skb) ? in skb_checksum_complete()
2339 0 : __skb_checksum_complete(skb); in skb_checksum_complete()
2356 static inline void nf_conntrack_get_reasm(struct sk_buff *skb) in nf_conntrack_get_reasm() argument
2358 if (skb) in nf_conntrack_get_reasm()
2359 atomic_inc(&skb->users); in nf_conntrack_get_reasm()
2361 static inline void nf_conntrack_put_reasm(struct sk_buff *skb) in nf_conntrack_put_reasm() argument
2363 if (skb) in nf_conntrack_put_reasm()
2364 kfree_skb(skb); in nf_conntrack_put_reasm()
2379 static inline void nf_reset(struct sk_buff *skb) in nf_reset() argument
2382 nf_conntrack_put(skb->nfct); in nf_reset()
2383 skb->nfct = NULL; in nf_reset()
2386 nf_conntrack_put_reasm(skb->nfct_reasm); in nf_reset()
2387 skb->nfct_reasm = NULL; in nf_reset()
2390 nf_bridge_put(skb->nf_bridge); in nf_reset()
2391 skb->nf_bridge = NULL; in nf_reset()
2395 static inline void nf_reset_trace(struct sk_buff *skb) in nf_reset_trace() argument
2398 skb->nf_trace = 0; in nf_reset_trace()
2440 static inline void skb_init_secmark(struct sk_buff *skb) in skb_init_secmark() argument
2442 skb->secmark = 0; in skb_init_secmark()
2448 static inline void skb_init_secmark(struct sk_buff *skb) in skb_init_secmark() argument
2452 static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) in skb_set_queue_mapping() argument
2454 skb->queue_mapping = queue_mapping; in skb_set_queue_mapping()
2457 static inline u16 skb_get_queue_mapping(const struct sk_buff *skb) in skb_get_queue_mapping() argument
2459 return skb->queue_mapping; in skb_get_queue_mapping()
2467 static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue) in skb_record_rx_queue() argument
2469 skb->queue_mapping = rx_queue + 1; in skb_record_rx_queue()
2472 static inline u16 skb_get_rx_queue(const struct sk_buff *skb) in skb_get_rx_queue() argument
2474 return skb->queue_mapping - 1; in skb_get_rx_queue()
2477 static inline bool skb_rx_queue_recorded(const struct sk_buff *skb) in skb_rx_queue_recorded() argument
2479 return skb->queue_mapping != 0; in skb_rx_queue_recorded()
2483 const struct sk_buff *skb,
2487 static inline struct sec_path *skb_sec_path(struct sk_buff *skb) in skb_sec_path() argument
2489 return skb->sp; in skb_sec_path()
2492 static inline struct sec_path *skb_sec_path(struct sk_buff *skb) in skb_sec_path() argument
2498 static inline bool skb_is_gso(const struct sk_buff *skb) in skb_is_gso() argument
2500 return skb_shinfo(skb)->gso_size; in skb_is_gso()
2503 static inline bool skb_is_gso_v6(const struct sk_buff *skb) in skb_is_gso_v6() argument
2505 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6; in skb_is_gso_v6()
2508 extern void __skb_warn_lro_forwarding(const struct sk_buff *skb);
2510 static inline bool skb_warn_if_lro(const struct sk_buff *skb) in skb_warn_if_lro() argument
2514 const struct skb_shared_info *shinfo = skb_shinfo(skb); in skb_warn_if_lro()
2516 if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 && in skb_warn_if_lro()
2518 __skb_warn_lro_forwarding(skb); in skb_warn_if_lro()
2524 static inline void skb_forward_csum(struct sk_buff *skb) in skb_forward_csum() argument
2527 if (skb->ip_summed == CHECKSUM_COMPLETE) in skb_forward_csum()
2528 skb->ip_summed = CHECKSUM_NONE; in skb_forward_csum()
2539 static inline void skb_checksum_none_assert(const struct sk_buff *skb) in skb_checksum_none_assert() argument
2542 BUG_ON(skb->ip_summed != CHECKSUM_NONE); in skb_checksum_none_assert()
2546 bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
2548 static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size) in skb_is_recycleable() argument
2553 if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) in skb_is_recycleable()
2556 if (skb_is_nonlinear(skb) || skb->fclone != SKB_FCLONE_UNAVAILABLE) in skb_is_recycleable()
2560 if (skb_end_pointer(skb) - skb->head < skb_size) in skb_is_recycleable()
2563 if (skb_shared(skb) || skb_cloned(skb)) in skb_is_recycleable()