]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net: skb_defer_rx_timestamp should check for phydev before setting up classify
authorAlexander Duyck <alexander.h.duyck@redhat.com>
Thu, 9 Jul 2015 18:02:52 +0000 (11:02 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Jul 2015 21:17:15 +0000 (14:17 -0700)
This change makes it so that the call skb_defer_rx_timestamp will first
check for a phydev before going in and manipulating the skb->data and
skb->len values.  By doing this we can avoid unnecessary work on network
devices that don't support phydev.  As a result we reduce the total
instruction count needed to process this on most devices.

Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/timestamping.c

index 43d3dd62fcc8eccd95a4618f68b0553cf7309c01..42689d5c468cb4f53baa058c74cdee58099137c7 100644 (file)
@@ -60,11 +60,15 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb)
        struct phy_device *phydev;
        unsigned int type;
 
+       if (!skb->dev || !skb->dev->phydev || !skb->dev->phydev->drv)
+               return false;
+
        if (skb_headroom(skb) < ETH_HLEN)
                return false;
+
        __skb_push(skb, ETH_HLEN);
 
-       type = classify(skb);
+       type = ptp_classify_raw(skb);
 
        __skb_pull(skb, ETH_HLEN);