]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/skbuff.h
[UDP]: Only increment counter on first peek/recv
[linux-2.6-omap-h63xx.git] / include / linux / skbuff.h
index f93f22b3d2ffabf991c0f4f44c4d3f6076f4f4f3..c618fbf7d173c4974da2adf399edf51a2c5034cc 100644 (file)
@@ -41,8 +41,7 @@
 #define SKB_DATA_ALIGN(X)      (((X) + (SMP_CACHE_BYTES - 1)) & \
                                 ~(SMP_CACHE_BYTES - 1))
 #define SKB_WITH_OVERHEAD(X)   \
-       (((X) - sizeof(struct skb_shared_info)) & \
-        ~(SMP_CACHE_BYTES - 1))
+       ((X) - SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
 #define SKB_MAX_ORDER(X, ORDER) \
        SKB_WITH_OVERHEAD((PAGE_SIZE << (ORDER)) - (X))
 #define SKB_MAX_HEAD(X)                (SKB_MAX_ORDER((X), 0))
@@ -96,6 +95,7 @@
 
 struct net_device;
 struct scatterlist;
+struct pipe_inode_info;
 
 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
 struct nf_conntrack {
@@ -288,6 +288,7 @@ struct sk_buff {
        __u8                    pkt_type:3,
                                fclone:2,
                                ipvs_property:1,
+                               peeked:1,
                                nf_trace:1;
        __be16                  protocol;
 
@@ -301,8 +302,9 @@ struct sk_buff {
 #endif
 
        int                     iif;
+#ifdef CONFIG_NETDEVICES_MULTIQUEUE
        __u16                   queue_mapping;
-
+#endif
 #ifdef CONFIG_NET_SCHED
        __u16                   tc_index;       /* traffic control index */
 #ifdef CONFIG_NET_CLS_ACT
@@ -356,7 +358,6 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
        return __alloc_skb(size, priority, 1, -1);
 }
 
-extern void           kfree_skbmem(struct sk_buff *skb);
 extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
 extern struct sk_buff *skb_clone(struct sk_buff *skb,
                                 gfp_t priority);
@@ -387,7 +388,9 @@ extern void       skb_truesize_bug(struct sk_buff *skb);
 
 static inline void skb_truesize_check(struct sk_buff *skb)
 {
-       if (unlikely((int)skb->truesize < sizeof(struct sk_buff) + skb->len))
+       int len = sizeof(struct sk_buff) + skb->len;
+
+       if (unlikely((int)skb->truesize < len))
                skb_truesize_bug(skb);
 }
 
@@ -994,7 +997,7 @@ static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
  *
  *     Return the number of bytes of free space at the head of an &sk_buff.
  */
-static inline int skb_headroom(const struct sk_buff *skb)
+static inline unsigned int skb_headroom(const struct sk_buff *skb)
 {
        return skb->data - skb->head;
 }
@@ -1347,7 +1350,7 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
  *     Returns true if modifying the header part of the cloned buffer
  *     does not requires the data to be copied.
  */
-static inline int skb_clone_writable(struct sk_buff *skb, int len)
+static inline int skb_clone_writable(struct sk_buff *skb, unsigned int len)
 {
        return !skb_header_cloned(skb) &&
               skb_headroom(skb) + len <= skb->hdr_len;
@@ -1536,6 +1539,8 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
                     skb = skb->prev)
 
 
+extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
+                                          int *peeked, int *err);
 extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
                                         int noblock, int *err);
 extern unsigned int    datagram_poll(struct file *file, struct socket *sock,
@@ -1547,7 +1552,7 @@ extern int               skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
                                                        int hlen,
                                                        struct iovec *iov);
 extern void           skb_free_datagram(struct sock *sk, struct sk_buff *skb);
-extern void           skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
+extern int            skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
                                         unsigned int flags);
 extern __wsum         skb_checksum(const struct sk_buff *skb, int offset,
                                    int len, __wsum csum);
@@ -1558,6 +1563,11 @@ extern int              skb_store_bits(struct sk_buff *skb, int offset,
 extern __wsum         skb_copy_and_csum_bits(const struct sk_buff *skb,
                                              int offset, u8 *to, int len,
                                              __wsum csum);
+extern int             skb_splice_bits(struct sk_buff *skb,
+                                               unsigned int offset,
+                                               struct pipe_inode_info *pipe,
+                                               unsigned int len,
+                                               unsigned int flags);
 extern void           skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
 extern void           skb_split(struct sk_buff *skb,
                                 struct sk_buff *skb1, const u32 len);
@@ -1770,6 +1780,15 @@ static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping)
 #endif
 }
 
+static inline u16 skb_get_queue_mapping(struct sk_buff *skb)
+{
+#ifdef CONFIG_NETDEVICES_MULTIQUEUE
+       return skb->queue_mapping;
+#else
+       return 0;
+#endif
+}
+
 static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_buff *from)
 {
 #ifdef CONFIG_NETDEVICES_MULTIQUEUE