diff options
Diffstat (limited to 'net/core/timestamping.c')
-rw-r--r-- | net/core/timestamping.c | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/net/core/timestamping.c b/net/core/timestamping.c index a8770391ea5b..43d3dd62fcc8 100644 --- a/net/core/timestamping.c +++ b/net/core/timestamping.c | |||
@@ -36,10 +36,9 @@ void skb_clone_tx_timestamp(struct sk_buff *skb) | |||
36 | { | 36 | { |
37 | struct phy_device *phydev; | 37 | struct phy_device *phydev; |
38 | struct sk_buff *clone; | 38 | struct sk_buff *clone; |
39 | struct sock *sk = skb->sk; | ||
40 | unsigned int type; | 39 | unsigned int type; |
41 | 40 | ||
42 | if (!sk) | 41 | if (!skb->sk) |
43 | return; | 42 | return; |
44 | 43 | ||
45 | type = classify(skb); | 44 | type = classify(skb); |
@@ -48,50 +47,14 @@ void skb_clone_tx_timestamp(struct sk_buff *skb) | |||
48 | 47 | ||
49 | phydev = skb->dev->phydev; | 48 | phydev = skb->dev->phydev; |
50 | if (likely(phydev->drv->txtstamp)) { | 49 | if (likely(phydev->drv->txtstamp)) { |
51 | if (!atomic_inc_not_zero(&sk->sk_refcnt)) | 50 | clone = skb_clone_sk(skb); |
51 | if (!clone) | ||
52 | return; | 52 | return; |
53 | |||
54 | clone = skb_clone(skb, GFP_ATOMIC); | ||
55 | if (!clone) { | ||
56 | sock_put(sk); | ||
57 | return; | ||
58 | } | ||
59 | |||
60 | clone->sk = sk; | ||
61 | phydev->drv->txtstamp(phydev, clone, type); | 53 | phydev->drv->txtstamp(phydev, clone, type); |
62 | } | 54 | } |
63 | } | 55 | } |
64 | EXPORT_SYMBOL_GPL(skb_clone_tx_timestamp); | 56 | EXPORT_SYMBOL_GPL(skb_clone_tx_timestamp); |
65 | 57 | ||
66 | void skb_complete_tx_timestamp(struct sk_buff *skb, | ||
67 | struct skb_shared_hwtstamps *hwtstamps) | ||
68 | { | ||
69 | struct sock *sk = skb->sk; | ||
70 | struct sock_exterr_skb *serr; | ||
71 | int err; | ||
72 | |||
73 | if (!hwtstamps) { | ||
74 | sock_put(sk); | ||
75 | kfree_skb(skb); | ||
76 | return; | ||
77 | } | ||
78 | |||
79 | *skb_hwtstamps(skb) = *hwtstamps; | ||
80 | |||
81 | serr = SKB_EXT_ERR(skb); | ||
82 | memset(serr, 0, sizeof(*serr)); | ||
83 | serr->ee.ee_errno = ENOMSG; | ||
84 | serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING; | ||
85 | skb->sk = NULL; | ||
86 | |||
87 | err = sock_queue_err_skb(sk, skb); | ||
88 | |||
89 | sock_put(sk); | ||
90 | if (err) | ||
91 | kfree_skb(skb); | ||
92 | } | ||
93 | EXPORT_SYMBOL_GPL(skb_complete_tx_timestamp); | ||
94 | |||
95 | bool skb_defer_rx_timestamp(struct sk_buff *skb) | 58 | bool skb_defer_rx_timestamp(struct sk_buff *skb) |
96 | { | 59 | { |
97 | struct phy_device *phydev; | 60 | struct phy_device *phydev; |