hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/net/core/timestamping.c
....@@ -1,21 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * PTP 1588 clock support - support for timestamping in PHY devices
34 *
45 * Copyright (C) 2010 OMICRON electronics GmbH
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
196 */
207 #include <linux/errqueue.h>
218 #include <linux/phy.h>
....@@ -26,7 +13,7 @@
2613 static unsigned int classify(const struct sk_buff *skb)
2714 {
2815 if (likely(skb->dev && skb->dev->phydev &&
29
- skb->dev->phydev->drv))
16
+ skb->dev->phydev->mii_ts))
3017 return ptp_classify_raw(skb);
3118 else
3219 return PTP_CLASS_NONE;
....@@ -34,7 +21,7 @@
3421
3522 void skb_clone_tx_timestamp(struct sk_buff *skb)
3623 {
37
- struct phy_device *phydev;
24
+ struct mii_timestamper *mii_ts;
3825 struct sk_buff *clone;
3926 unsigned int type;
4027
....@@ -45,22 +32,22 @@
4532 if (type == PTP_CLASS_NONE)
4633 return;
4734
48
- phydev = skb->dev->phydev;
49
- if (likely(phydev->drv->txtstamp)) {
35
+ mii_ts = skb->dev->phydev->mii_ts;
36
+ if (likely(mii_ts->txtstamp)) {
5037 clone = skb_clone_sk(skb);
5138 if (!clone)
5239 return;
53
- phydev->drv->txtstamp(phydev, clone, type);
40
+ mii_ts->txtstamp(mii_ts, clone, type);
5441 }
5542 }
5643 EXPORT_SYMBOL_GPL(skb_clone_tx_timestamp);
5744
5845 bool skb_defer_rx_timestamp(struct sk_buff *skb)
5946 {
60
- struct phy_device *phydev;
47
+ struct mii_timestamper *mii_ts;
6148 unsigned int type;
6249
63
- if (!skb->dev || !skb->dev->phydev || !skb->dev->phydev->drv)
50
+ if (!skb->dev || !skb->dev->phydev || !skb->dev->phydev->mii_ts)
6451 return false;
6552
6653 if (skb_headroom(skb) < ETH_HLEN)
....@@ -75,9 +62,9 @@
7562 if (type == PTP_CLASS_NONE)
7663 return false;
7764
78
- phydev = skb->dev->phydev;
79
- if (likely(phydev->drv->rxtstamp))
80
- return phydev->drv->rxtstamp(phydev, skb, type);
65
+ mii_ts = skb->dev->phydev->mii_ts;
66
+ if (likely(mii_ts->rxtstamp))
67
+ return mii_ts->rxtstamp(mii_ts, skb, type);
8168
8269 return false;
8370 }