net: simplify flags for tx timestamping
This patch removes the abstraction introduced by the union skb_shared_tx in
the shared skb data.
The access of the different union elements at several places led to some
confusion about accessing the shared tx_flags e.g. in skb_orphan_try().
http://marc.info/?l=linux-netdev&m=128084897415886&w=2
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
4d5870ec10
commit
2244d07bfa
+16
-28
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user