Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: skb_defer_rx_timestamp should check for phydev before setting up classify

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>

authored by

Alexander Duyck and committed by
David S. Miller
1007f59d 2251ae46

+5 -1
+5 -1
net/core/timestamping.c
··· 60 60 struct phy_device *phydev; 61 61 unsigned int type; 62 62 63 + if (!skb->dev || !skb->dev->phydev || !skb->dev->phydev->drv) 64 + return false; 65 + 63 66 if (skb_headroom(skb) < ETH_HLEN) 64 67 return false; 68 + 65 69 __skb_push(skb, ETH_HLEN); 66 70 67 - type = classify(skb); 71 + type = ptp_classify_raw(skb); 68 72 69 73 __skb_pull(skb, ETH_HLEN); 70 74