Commit cfd12c06 authored by Yangbo Lu's avatar Yangbo Lu Committed by David S. Miller

net: dsa: check tx timestamp request in core driver

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: default avatarYangbo Lu <yangbo.lu@nxp.com>
Tested-by: Kurt Kanzenbach's avatarKurt Kanzenbach <kurt@linutronix.de>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 23c9c2b3
...@@ -382,10 +382,6 @@ bool hellcreek_port_txtstamp(struct dsa_switch *ds, int port, ...@@ -382,10 +382,6 @@ bool hellcreek_port_txtstamp(struct dsa_switch *ds, int port,
ps = &hellcreek->ports[port].port_hwtstamp; 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 /* 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 * and the interaction with the HW timestamping is enabled. If not, stop
* here * here
......
...@@ -475,9 +475,6 @@ bool mv88e6xxx_port_txtstamp(struct dsa_switch *ds, int port, ...@@ -475,9 +475,6 @@ bool mv88e6xxx_port_txtstamp(struct dsa_switch *ds, int port,
struct mv88e6xxx_port_hwtstamp *ps = &chip->port_hwtstamp[port]; struct mv88e6xxx_port_hwtstamp *ps = &chip->port_hwtstamp[port];
struct ptp_header *hdr; struct ptp_header *hdr;
if (!(skb_shinfo(clone)->tx_flags & SKBTX_HW_TSTAMP))
return false;
hdr = mv88e6xxx_should_tstamp(chip, port, clone, type); hdr = mv88e6xxx_should_tstamp(chip, port, clone, type);
if (!hdr) if (!hdr)
return false; return false;
......
...@@ -1401,8 +1401,7 @@ static bool felix_txtstamp(struct dsa_switch *ds, int port, ...@@ -1401,8 +1401,7 @@ static bool felix_txtstamp(struct dsa_switch *ds, int port,
struct ocelot *ocelot = ds->priv; struct ocelot *ocelot = ds->priv;
struct ocelot_port *ocelot_port = ocelot->ports[port]; struct ocelot_port *ocelot_port = ocelot->ports[port];
if (ocelot->ptp && (skb_shinfo(clone)->tx_flags & SKBTX_HW_TSTAMP) && if (ocelot->ptp && ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
ocelot_port_add_txtstamp_skb(ocelot, port, clone); ocelot_port_add_txtstamp_skb(ocelot, port, clone);
return true; return true;
} }
......
...@@ -559,6 +559,9 @@ static void dsa_skb_tx_timestamp(struct dsa_slave_priv *p, ...@@ -559,6 +559,9 @@ static void dsa_skb_tx_timestamp(struct dsa_slave_priv *p,
struct sk_buff *clone; struct sk_buff *clone;
unsigned int type; unsigned int type;
if (!(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))
return;
type = ptp_classify_raw(skb); type = ptp_classify_raw(skb);
if (type == PTP_CLASS_NONE) if (type == PTP_CLASS_NONE)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment