mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 14:41:27 +00:00
net-timestamp: Make the clone operation stand-alone from phy timestamping
The phy timestamping takes a different path than the regular timestamping does in that it will create a clone first so that the packets needing to be timestamped can be placed in a queue, or the context block could be used. In order to support these use cases I am pulling the core of the code out so it can be used in other drivers beyond just phy devices. In addition I have added a destructor named sock_efree which is meant to provide a simple way for dropping the reference to skb exceptions that aren't part of either the receive or send windows for the socket, and I have removed some duplication in spots where this destructor could be used in place of sock_edemux. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
37846ef018
commit
62bccb8cdb
6 changed files with 40 additions and 21 deletions
|
@ -36,10 +36,9 @@ void skb_clone_tx_timestamp(struct sk_buff *skb)
|
|||
{
|
||||
struct phy_device *phydev;
|
||||
struct sk_buff *clone;
|
||||
struct sock *sk = skb->sk;
|
||||
unsigned int type;
|
||||
|
||||
if (!sk)
|
||||
if (!skb->sk)
|
||||
return;
|
||||
|
||||
type = classify(skb);
|
||||
|
@ -48,16 +47,9 @@ void skb_clone_tx_timestamp(struct sk_buff *skb)
|
|||
|
||||
phydev = skb->dev->phydev;
|
||||
if (likely(phydev->drv->txtstamp)) {
|
||||
if (!atomic_inc_not_zero(&sk->sk_refcnt))
|
||||
clone = skb_clone_sk(skb);
|
||||
if (!clone)
|
||||
return;
|
||||
|
||||
clone = skb_clone(skb, GFP_ATOMIC);
|
||||
if (!clone) {
|
||||
sock_put(sk);
|
||||
return;
|
||||
}
|
||||
|
||||
clone->sk = sk;
|
||||
phydev->drv->txtstamp(phydev, clone, type);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue