summaryrefslogtreecommitdiff
path: root/drivers/net/dsa/ocelot/felix.c
diff options
context:
space:
mode:
authorYangbo Lu <yangbo.lu@nxp.com>2021-04-27 12:21:59 +0800
committerDavid S. Miller <davem@davemloft.net>2021-04-27 14:10:15 -0700
commit5c5416f5d4c75fe6aba56f6c2c45a070b5e7cc78 (patch)
tree4695af6b67ad7e9e1fce5e93e93dd19be221ba01 /drivers/net/dsa/ocelot/felix.c
parentcf536ea3c7eefb26082836eb7f930b293dd38345 (diff)
net: dsa: no longer clone skb in core driver
It was a waste to clone skb directly in dsa_skb_tx_timestamp(). For one-step timestamping, a clone was not needed. For any failure of port_txtstamp (this may usually happen), the skb clone had to be freed. So this patch moves skb cloning for tx timestamp out of dsa core, and let drivers clone skb in port_txtstamp if they really need. Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> Tested-by: Kurt Kanzenbach <kurt@linutronix.de> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/ocelot/felix.c')
-rw-r--r--drivers/net/dsa/ocelot/felix.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index d679f023dc001..fe7e8bad90dfe 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -1395,18 +1395,21 @@ static bool felix_rxtstamp(struct dsa_switch *ds, int port,
return false;
}
-static bool felix_txtstamp(struct dsa_switch *ds, int port,
- struct sk_buff *clone)
+static void felix_txtstamp(struct dsa_switch *ds, int port,
+ struct sk_buff *skb)
{
struct ocelot *ocelot = ds->priv;
struct ocelot_port *ocelot_port = ocelot->ports[port];
+ struct sk_buff *clone;
if (ocelot->ptp && ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
+ clone = skb_clone_sk(skb);
+ if (!clone)
+ return;
+
ocelot_port_add_txtstamp_skb(ocelot, port, clone);
- return true;
+ DSA_SKB_CB(skb)->clone = clone;
}
-
- return false;
}
static int felix_change_mtu(struct dsa_switch *ds, int port, int new_mtu)