Skip to contentSkip to conversation

net: time stamping fixes

PATCH New Richard Cochran 1 participant 3 messages Oct 24, 2011

Subsystems (4)
lore
Share & tools
lore

Richard Cochran

author maintainer
#0 lore raw

v3 cover net: time stamping fixes

[ Changes in v3: omit accepted patch and fixup the dp83640 patches. ]

These two patches depend on commit da92b194 and fix two bugs in a PTP Hardware Clock driver. This driver was first introduced in Linux version 3.0.

Richard Cochran (2):
dp83640: use proper function to free transmit time stamping packets
dp83640: free packet queues on remove

 drivers/net/phy/dp83640.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.2.5
author maintainer
#1 lore raw

PATCH v3 1/2 dp83640: use proper function to free transmit time stamping packets

Commit da92b194 introduced a new rule for handling the cloned packets for transmit time stamping. These packets must not be freed using any other function than skb_complete_tx_timestamp. This commit fixes the one and only driver using this API.

The driver first appeared in v3.0.

---
 drivers/net/phy/dp83640.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/phy/dp83640.c +1 -1
index edd7304..311f5cb 100644
@@ -1060,7 +1060,7 @@ static void dp83640_txtstamp(struct phy_device *phydev,
 	struct dp83640_private *dp83640 = phydev->priv;
 
 	if (!dp83640->hwts_tx_en) {
-		kfree_skb(skb);
+		skb_complete_tx_timestamp(skb, NULL);
 		return;
 	}
 	skb_queue_tail(&dp83640->tx_queue, skb);
Signature · 1 line
1.7.2.5
author maintainer
#2 lore raw

PATCH v3 2/2 dp83640: free packet queues on remove

In reply to Richard Cochran

If the PHY should disappear (for example, on an USB Ethernet MAC), then the driver would leak any undelivered time stamp packets. This commit fixes the issue by calling the appropriate functions to free any packets left in the transmit and receive queues.

The driver first appeared in v3.0.

---
 drivers/net/phy/dp83640.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/net/phy/dp83640.c +7 -0
index 311f5cb..dc44b73 100644
@@ -875,6 +875,7 @@ static void dp83640_remove(struct phy_device *phydev)
 	struct dp83640_clock *clock;
 	struct list_head *this, *next;
 	struct dp83640_private *tmp, *dp83640 = phydev->priv;
+	struct sk_buff *skb;
 
 	if (phydev->addr == BROADCAST_ADDR)
 		return;
@@ -882,6 +883,12 @@ static void dp83640_remove(struct phy_device *phydev)
 	enable_status_frames(phydev, false);
 	cancel_work_sync(&dp83640->ts_work);
 
+	while ((skb = skb_dequeue(&dp83640->rx_queue)) != NULL)
+		kfree_skb(skb);
+
+	while ((skb = skb_dequeue(&dp83640->tx_queue)) != NULL)
+		skb_complete_tx_timestamp(skb, NULL);
+
 	clock = dp83640_clock_get(dp83640->clock);
 
 	if (dp83640 == clock->chosen) {
Signature · 1 line
1.7.2.5