aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/skbuff.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r--include/linux/skbuff.h84
1 files changed, 74 insertions, 10 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4286d832166f..0a8ea8b35816 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -274,6 +274,9 @@ struct sk_buff {
274#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE) 274#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
275 __u8 ipvs_property:1; 275 __u8 ipvs_property:1;
276#endif 276#endif
277#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
278 struct sk_buff *nfct_reasm;
279#endif
277#ifdef CONFIG_BRIDGE_NETFILTER 280#ifdef CONFIG_BRIDGE_NETFILTER
278 struct nf_bridge_info *nf_bridge; 281 struct nf_bridge_info *nf_bridge;
279#endif 282#endif
@@ -603,23 +606,23 @@ static inline void skb_queue_head_init(struct sk_buff_head *list)
603 */ 606 */
604 607
605/** 608/**
606 * __skb_queue_head - queue a buffer at the list head 609 * __skb_queue_after - queue a buffer at the list head
607 * @list: list to use 610 * @list: list to use
611 * @prev: place after this buffer
608 * @newsk: buffer to queue 612 * @newsk: buffer to queue
609 * 613 *
610 * Queue a buffer at the start of a list. This function takes no locks 614 * Queue a buffer int the middle of a list. This function takes no locks
611 * and you must therefore hold required locks before calling it. 615 * and you must therefore hold required locks before calling it.
612 * 616 *
613 * A buffer cannot be placed on two lists at the same time. 617 * A buffer cannot be placed on two lists at the same time.
614 */ 618 */
615extern void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk); 619static inline void __skb_queue_after(struct sk_buff_head *list,
616static inline void __skb_queue_head(struct sk_buff_head *list, 620 struct sk_buff *prev,
617 struct sk_buff *newsk) 621 struct sk_buff *newsk)
618{ 622{
619 struct sk_buff *prev, *next; 623 struct sk_buff *next;
620
621 list->qlen++; 624 list->qlen++;
622 prev = (struct sk_buff *)list; 625
623 next = prev->next; 626 next = prev->next;
624 newsk->next = next; 627 newsk->next = next;
625 newsk->prev = prev; 628 newsk->prev = prev;
@@ -627,6 +630,23 @@ static inline void __skb_queue_head(struct sk_buff_head *list,
627} 630}
628 631
629/** 632/**
633 * __skb_queue_head - queue a buffer at the list head
634 * @list: list to use
635 * @newsk: buffer to queue
636 *
637 * Queue a buffer at the start of a list. This function takes no locks
638 * and you must therefore hold required locks before calling it.
639 *
640 * A buffer cannot be placed on two lists at the same time.
641 */
642extern void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk);
643static inline void __skb_queue_head(struct sk_buff_head *list,
644 struct sk_buff *newsk)
645{
646 __skb_queue_after(list, (struct sk_buff *)list, newsk);
647}
648
649/**
630 * __skb_queue_tail - queue a buffer at the list tail 650 * __skb_queue_tail - queue a buffer at the list tail
631 * @list: list to use 651 * @list: list to use
632 * @newsk: buffer to queue 652 * @newsk: buffer to queue
@@ -1203,6 +1223,11 @@ static inline void kunmap_skb_frag(void *vaddr)
1203 prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \ 1223 prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \
1204 skb = skb->next) 1224 skb = skb->next)
1205 1225
1226#define skb_queue_reverse_walk(queue, skb) \
1227 for (skb = (queue)->prev; \
1228 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \
1229 skb = skb->prev)
1230
1206 1231
1207extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 1232extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
1208 int noblock, int *err); 1233 int noblock, int *err);
@@ -1211,8 +1236,7 @@ extern unsigned int datagram_poll(struct file *file, struct socket *sock,
1211extern int skb_copy_datagram_iovec(const struct sk_buff *from, 1236extern int skb_copy_datagram_iovec(const struct sk_buff *from,
1212 int offset, struct iovec *to, 1237 int offset, struct iovec *to,
1213 int size); 1238 int size);
1214extern int skb_copy_and_csum_datagram_iovec(const 1239extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1215 struct sk_buff *skb,
1216 int hlen, 1240 int hlen,
1217 struct iovec *iov); 1241 struct iovec *iov);
1218extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1242extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
@@ -1280,6 +1304,30 @@ static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *
1280 1304
1281extern void __net_timestamp(struct sk_buff *skb); 1305extern void __net_timestamp(struct sk_buff *skb);
1282 1306
1307extern unsigned int __skb_checksum_complete(struct sk_buff *skb);
1308
1309/**
1310 * skb_checksum_complete - Calculate checksum of an entire packet
1311 * @skb: packet to process
1312 *
1313 * This function calculates the checksum over the entire packet plus
1314 * the value of skb->csum. The latter can be used to supply the
1315 * checksum of a pseudo header as used by TCP/UDP. It returns the
1316 * checksum.
1317 *
1318 * For protocols that contain complete checksums such as ICMP/TCP/UDP,
1319 * this function can be used to verify that checksum on received
1320 * packets. In that case the function should return zero if the
1321 * checksum is correct. In particular, this function will return zero
1322 * if skb->ip_summed is CHECKSUM_UNNECESSARY which indicates that the
1323 * hardware has already verified the correctness of the checksum.
1324 */
1325static inline unsigned int skb_checksum_complete(struct sk_buff *skb)
1326{
1327 return skb->ip_summed != CHECKSUM_UNNECESSARY &&
1328 __skb_checksum_complete(skb);
1329}
1330
1283#ifdef CONFIG_NETFILTER 1331#ifdef CONFIG_NETFILTER
1284static inline void nf_conntrack_put(struct nf_conntrack *nfct) 1332static inline void nf_conntrack_put(struct nf_conntrack *nfct)
1285{ 1333{
@@ -1291,10 +1339,26 @@ static inline void nf_conntrack_get(struct nf_conntrack *nfct)
1291 if (nfct) 1339 if (nfct)
1292 atomic_inc(&nfct->use); 1340 atomic_inc(&nfct->use);
1293} 1341}
1342#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1343static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
1344{
1345 if (skb)
1346 atomic_inc(&skb->users);
1347}
1348static inline void nf_conntrack_put_reasm(struct sk_buff *skb)
1349{
1350 if (skb)
1351 kfree_skb(skb);
1352}
1353#endif
1294static inline void nf_reset(struct sk_buff *skb) 1354static inline void nf_reset(struct sk_buff *skb)
1295{ 1355{
1296 nf_conntrack_put(skb->nfct); 1356 nf_conntrack_put(skb->nfct);
1297 skb->nfct = NULL; 1357 skb->nfct = NULL;
1358#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1359 nf_conntrack_put_reasm(skb->nfct_reasm);
1360 skb->nfct_reasm = NULL;
1361#endif
1298} 1362}
1299 1363
1300#ifdef CONFIG_BRIDGE_NETFILTER 1364#ifdef CONFIG_BRIDGE_NETFILTER