Skip to content

Commit

Permalink
net: dsa: check tx timestamp request in core driver
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Kurt Kanzenbach <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Acked-by: Richard Cochran <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
yangbolu1991 authored and davem330 committed Apr 27, 2021
1 parent 23c9c2b commit cfd12c0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
4 changes: 0 additions & 4 deletions drivers/net/dsa/hirschmann/hellcreek_hwtstamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions drivers/net/dsa/mv88e6xxx/hwtstamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/dsa/ocelot/felix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions net/dsa/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cfd12c0

Please sign in to comment.