Skip to content

Commit

Permalink
net: skb_defer_rx_timestamp should check for phydev before setting up…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Alexander Duyck authored and David S. Miller committed Jul 9, 2015
1 parent 2251ae4 commit 1007f59
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/core/timestamping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 1007f59

Please sign in to comment.