diff mbox

[net-next] net: skb_defer_rx_timestamp should check for phydev before setting up classify

Message ID 20150709180252.1686.56670.stgit@ahduyck-vm-fedora22
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Alexander Duyck July 9, 2015, 6:02 p.m. UTC
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>
---
 net/core/timestamping.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller July 9, 2015, 9:17 p.m. UTC | #1
From: Alexander Duyck <alexander.h.duyck@redhat.com>
Date: Thu, 09 Jul 2015 11:02:52 -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>

This looks fine, applied, thanks Alex.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/core/timestamping.c b/net/core/timestamping.c
index 43d3dd62fcc8..42689d5c468c 100644
--- a/net/core/timestamping.c
+++ b/net/core/timestamping.c
@@ -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);