From: Yangbo Lu <yangbo.lu@nxp.com>
To: netdev@vger.kernel.org
Cc: Yangbo Lu <yangbo.lu@nxp.com>,
Richard Cochran <richardcochran@gmail.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Kurt Kanzenbach <kurt@linutronix.de>,
Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
UNGLinuxDriver@microchip.com, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [net-next, v2, 1/7] net: dsa: check tx timestamp request in core driver
Date: Mon, 26 Apr 2021 17:37:56 +0800 [thread overview]
Message-ID: <20210426093802.38652-2-yangbo.lu@nxp.com> (raw)
In-Reply-To: <20210426093802.38652-1-yangbo.lu@nxp.com>
Check tx timestamp request in core driver at very beginning of
dsa_skb_tx_timestamp(), so that most skbs not requiring tx
timestamp just return. And drop such checking in device drivers.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Tested-by: Kurt Kanzenbach <kurt@linutronix.de>
---
Changes for v2:
- Split from tx timestamp optimization big patch.
---
drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c | 4 ----
drivers/net/dsa/mv88e6xxx/hwtstamp.c | 3 ---
drivers/net/dsa/ocelot/felix.c | 3 +--
net/dsa/slave.c | 3 +++
4 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c b/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c
index 69dd9a2e8bb6..6ba5e2333066 100644
--- a/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c
+++ b/drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c
@@ -382,10 +382,6 @@ bool hellcreek_port_txtstamp(struct dsa_switch *ds, int port,
ps = &hellcreek->ports[port].port_hwtstamp;
- /* Check if the driver is expected to do HW timestamping */
- if (!(skb_shinfo(clone)->tx_flags & SKBTX_HW_TSTAMP))
- return false;
-
/* Make sure the message is a PTP message that needs to be timestamped
* and the interaction with the HW timestamping is enabled. If not, stop
* here
diff --git a/drivers/net/dsa/mv88e6xxx/hwtstamp.c b/drivers/net/dsa/mv88e6xxx/hwtstamp.c
index 094d17a1d037..05ca1d3c6498 100644
--- a/drivers/net/dsa/mv88e6xxx/hwtstamp.c
+++ b/drivers/net/dsa/mv88e6xxx/hwtstamp.c
@@ -475,9 +475,6 @@ bool mv88e6xxx_port_txtstamp(struct dsa_switch *ds, int port,
struct mv88e6xxx_port_hwtstamp *ps = &chip->port_hwtstamp[port];
struct ptp_header *hdr;
- if (!(skb_shinfo(clone)->tx_flags & SKBTX_HW_TSTAMP))
- return false;
-
hdr = mv88e6xxx_should_tstamp(chip, port, clone, type);
if (!hdr)
return false;
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 6b5442be0230..1379f86d71ec 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -1401,8 +1401,7 @@ static bool felix_txtstamp(struct dsa_switch *ds, int port,
struct ocelot *ocelot = ds->priv;
struct ocelot_port *ocelot_port = ocelot->ports[port];
- if (ocelot->ptp && (skb_shinfo(clone)->tx_flags & SKBTX_HW_TSTAMP) &&
- ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
+ if (ocelot->ptp && ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
ocelot_port_add_txtstamp_skb(ocelot, port, clone);
return true;
}
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 77b33bd161b8..b2a802e9330e 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -559,6 +559,9 @@ static void dsa_skb_tx_timestamp(struct dsa_slave_priv *p,
struct sk_buff *clone;
unsigned int type;
+ if (!(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))
+ return;
+
type = ptp_classify_raw(skb);
if (type == PTP_CLASS_NONE)
return;
--
2.25.1
next prev parent reply other threads:[~2021-04-26 9:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 9:37 [net-next, v2, 0/7] Support Ocelot PTP Sync one-step timestamping Yangbo Lu
2021-04-26 9:37 ` Yangbo Lu [this message]
2021-04-26 18:36 ` [net-next, v2, 1/7] net: dsa: check tx timestamp request in core driver Florian Fainelli
2021-04-26 9:37 ` [net-next, v2, 2/7] net: dsa: no longer identify PTP packet " Yangbo Lu
2021-04-26 18:39 ` Florian Fainelli
2021-04-26 9:37 ` [net-next, v2, 3/7] net: dsa: free skb->cb usage " Yangbo Lu
2021-04-26 13:38 ` Richard Cochran
2021-04-26 18:39 ` Vladimir Oltean
2021-04-27 4:25 ` Y.b. Lu
2021-04-27 15:56 ` Richard Cochran
2021-04-27 4:26 ` Y.b. Lu
2021-04-26 18:16 ` Vladimir Oltean
2021-04-27 4:13 ` Y.b. Lu
2021-04-28 20:29 ` Tobias Waldekranz
2021-05-07 11:26 ` Y.b. Lu
2021-05-07 11:48 ` Vladimir Oltean
2021-04-26 9:37 ` [net-next, v2, 4/7] net: dsa: no longer clone skb " Yangbo Lu
2021-04-26 9:38 ` [net-next, v2, 5/7] docs: networking: timestamping: update for DSA switches Yangbo Lu
2021-04-26 9:38 ` [net-next, v2, 6/7] net: mscc: ocelot: convert to ocelot_port_txtstamp_request() Yangbo Lu
2021-04-26 9:38 ` [net-next, v2, 7/7] net: mscc: ocelot: support PTP Sync one-step timestamping Yangbo Lu
2021-04-26 13:47 ` [net-next, v2, 0/7] Support Ocelot " Richard Cochran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210426093802.38652-2-yangbo.lu@nxp.com \
--to=yangbo.lu@nxp.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=kurt@linutronix.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).