kthread: don't depend on work queues
[powerpc.git] / include / linux / skbuff.h
index 08c96bc..e7367c7 100644 (file)
 #define HAVE_ALLOC_SKB         /* For the drivers to know */
 #define HAVE_ALIGNABLE_SKB     /* Ditto 8)                */
 
+/* Don't change this without changing skb_csum_unnecessary! */
 #define CHECKSUM_NONE 0
-#define CHECKSUM_PARTIAL 1
-#define CHECKSUM_UNNECESSARY 2
-#define CHECKSUM_COMPLETE 3
+#define CHECKSUM_UNNECESSARY 1
+#define CHECKSUM_COMPLETE 2
+#define CHECKSUM_PARTIAL 3
 
 #define SKB_DATA_ALIGN(X)      (((X) + (SMP_CACHE_BYTES - 1)) & \
                                 ~(SMP_CACHE_BYTES - 1))
@@ -86,6 +87,7 @@
  */
 
 struct net_device;
+struct scatterlist;
 
 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
 struct nf_conntrack {
@@ -195,7 +197,7 @@ typedef unsigned char *sk_buff_data_t;
  *     @tstamp: Time we arrived
  *     @dev: Device we arrived on/are leaving by
  *     @iif: ifindex of device we arrived on
- *     @h: Transport layer header
+ *     @transport_header: Transport layer header
  *     @network_header: Network layer header
  *     @mac_header: Link layer header
  *     @dst: destination entry
@@ -204,7 +206,9 @@ typedef unsigned char *sk_buff_data_t;
  *     @len: Length of actual data
  *     @data_len: Data length
  *     @mac_len: Length of link layer header
- *     @csum: Checksum
+ *     @csum: Checksum (must include start/offset pair)
+ *     @csum_start: Offset from skb->head where checksumming should start
+ *     @csum_offset: Offset from csum_start where checksum should be stored
  *     @local_df: allow local fragmentation
  *     @cloned: Head may be cloned (check refcnt to be sure)
  *     @nohdr: Payload reference only, must not modify header
@@ -260,7 +264,10 @@ struct sk_buff {
                                mac_len;
        union {
                __wsum          csum;
-               __u32           csum_offset;
+               struct {
+                       __u16   csum_start;
+                       __u16   csum_offset;
+               };
        };
        __u32                   priority;
        __u8                    local_df:1,
@@ -347,6 +354,11 @@ extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
 extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
                                       int newheadroom, int newtailroom,
                                       gfp_t priority);
+extern int            skb_to_sgvec(struct sk_buff *skb,
+                                   struct scatterlist *sg, int offset,
+                                   int len);
+extern int            skb_cow_data(struct sk_buff *skb, int tailbits,
+                                   struct sk_buff **trailer);
 extern int            skb_pad(struct sk_buff *skb, int pad);
 #define dev_kfree_skb(a)       kfree_skb(a)
 extern void          skb_over_panic(struct sk_buff *skb, int len,
@@ -1459,6 +1471,11 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
                     prefetch(skb->next), (skb != (struct sk_buff *)(queue));   \
                     skb = skb->next)
 
+#define skb_queue_walk_safe(queue, skb, tmp)                                   \
+               for (skb = (queue)->next, tmp = skb->next;                      \
+                    skb != (struct sk_buff *)(queue);                          \
+                    skb = tmp, tmp = skb->next)
+
 #define skb_queue_reverse_walk(queue, skb) \
                for (skb = (queue)->prev;                                       \
                     prefetch(skb->prev), (skb != (struct sk_buff *)(queue));   \
@@ -1482,8 +1499,8 @@ extern __wsum            skb_checksum(const struct sk_buff *skb, int offset,
                                    int len, __wsum csum);
 extern int            skb_copy_bits(const struct sk_buff *skb, int offset,
                                     void *to, int len);
-extern int            skb_store_bits(const struct sk_buff *skb, int offset,
-                                     void *from, int len);
+extern int            skb_store_bits(struct sk_buff *skb, int offset,
+                                     const void *from, int len);
 extern __wsum         skb_copy_and_csum_bits(const struct sk_buff *skb,
                                              int offset, u8 *to, int len,
                                              __wsum csum);
@@ -1521,6 +1538,21 @@ static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
        memcpy(to, skb->data + offset, len);
 }
 
+static inline void skb_copy_to_linear_data(struct sk_buff *skb,
+                                          const void *from,
+                                          const unsigned int len)
+{
+       memcpy(skb->data, from, len);
+}
+
+static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
+                                                 const int offset,
+                                                 const void *from,
+                                                 const unsigned int len)
+{
+       memcpy(skb->data + offset, from, len);
+}
+
 extern void skb_init(void);
 
 /**
@@ -1542,10 +1574,20 @@ static inline void __net_timestamp(struct sk_buff *skb)
        skb->tstamp = ktime_get_real();
 }
 
+static inline ktime_t net_timedelta(ktime_t t)
+{
+       return ktime_sub(ktime_get_real(), t);
+}
+
 
 extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
 extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
 
+static inline int skb_csum_unnecessary(const struct sk_buff *skb)
+{
+       return skb->ip_summed & CHECKSUM_UNNECESSARY;
+}
+
 /**
  *     skb_checksum_complete - Calculate checksum of an entire packet
  *     @skb: packet to process
@@ -1564,8 +1606,8 @@ extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
  */
 static inline unsigned int skb_checksum_complete(struct sk_buff *skb)
 {
-       return skb->ip_summed != CHECKSUM_UNNECESSARY &&
-               __skb_checksum_complete(skb);
+       return skb_csum_unnecessary(skb) ?
+              0 : __skb_checksum_complete(skb);
 }
 
 #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)