]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/linux/skbuff.h
net: simplify flags for tx timestamping
[net-next-2.6.git] / include / linux / skbuff.h
index d8050382b1899d49043837ea3d362acb9327f468..f067c95cf18af630bb6ea2cd7ce676e3708090ec 100644 (file)
@@ -163,26 +163,19 @@ struct skb_shared_hwtstamps {
        ktime_t syststamp;
 };
 
-/**
- * struct skb_shared_tx - instructions for time stamping of outgoing packets
- * @hardware:          generate hardware time stamp
- * @software:          generate software time stamp
- * @in_progress:       device driver is going to provide
- *                     hardware time stamp
- * @prevent_sk_orphan: make sk reference available on driver level
- * @flags:             all shared_tx flags
- *
- * These flags are attached to packets as part of the
- * &skb_shared_info. Use skb_tx() to get a pointer.
- */
-union skb_shared_tx {
-       struct {
-               __u8    hardware:1,
-                       software:1,
-                       in_progress:1,
-                       prevent_sk_orphan:1;
-       };
-       __u8 flags;
+/* Definitions for tx_flags in struct skb_shared_info */
+enum {
+       /* generate hardware time stamp */
+       SKBTX_HW_TSTAMP = 1 << 0,
+
+       /* generate software time stamp */
+       SKBTX_SW_TSTAMP = 1 << 1,
+
+       /* device driver is going to provide hardware time stamp */
+       SKBTX_IN_PROGRESS = 1 << 2,
+
+       /* ensure the originating sk reference is available on driver level */
+       SKBTX_DRV_NEEDS_SK_REF = 1 << 3,
 };
 
 /* This data is invariant across clones and lives at
@@ -195,7 +188,7 @@ struct skb_shared_info {
        unsigned short  gso_segs;
        unsigned short  gso_type;
        __be32          ip6_frag_id;
-       union skb_shared_tx tx_flags;
+       __u8            tx_flags;
        struct sk_buff  *frag_list;
        struct skb_shared_hwtstamps hwtstamps;
 
@@ -587,11 +580,6 @@ static inline struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb)
        return &skb_shinfo(skb)->hwtstamps;
 }
 
-static inline union skb_shared_tx *skb_tx(struct sk_buff *skb)
-{
-       return &skb_shinfo(skb)->tx_flags;
-}
-
 /**
  *     skb_queue_empty - check if a queue is empty
  *     @list: queue head
@@ -1996,8 +1984,8 @@ extern void skb_tstamp_tx(struct sk_buff *orig_skb,
 
 static inline void sw_tx_timestamp(struct sk_buff *skb)
 {
-       union skb_shared_tx *shtx = skb_tx(skb);
-       if (shtx->software && !shtx->in_progress)
+       if (skb_shinfo(skb)->tx_flags & SKBTX_SW_TSTAMP &&
+           !(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS))
                skb_tstamp_tx(skb, NULL);
 }