Re: [net-next 2/3] net: mscc: ocelot: convert to ocelot_port_txtstamp_request()

From: Vladimir Oltean
Date: Sun Apr 18 2021 - 05:28:04 EST


On Fri, Apr 16, 2021 at 08:36:54PM +0800, Yangbo Lu wrote:
> Convert to a common ocelot_port_txtstamp_request() for TX timestamp
> request handling.
>
> Signed-off-by: Yangbo Lu <yangbo.lu@xxxxxxx>
> ---
> drivers/net/dsa/ocelot/felix.c | 14 +++++---------
> drivers/net/ethernet/mscc/ocelot.c | 24 +++++++++++++++++++++---
> drivers/net/ethernet/mscc/ocelot_net.c | 18 +++++++-----------
> include/soc/mscc/ocelot.h | 5 +++--
> 4 files changed, 36 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
> index cdec2f5e271c..5f2cf0f31253 100644
> --- a/drivers/net/dsa/ocelot/felix.c
> +++ b/drivers/net/dsa/ocelot/felix.c
> @@ -1399,18 +1399,14 @@ static bool felix_txtstamp(struct dsa_switch *ds, int port,
> struct sk_buff *skb, struct sk_buff **clone)
> {
> struct ocelot *ocelot = ds->priv;
> - struct ocelot_port *ocelot_port = ocelot->ports[port];
>
> - if (ocelot->ptp && ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
> - *clone = skb_clone_sk(skb);
> - if (!(*clone))
> - return false;
> + if (!ocelot->ptp)
> + return false;
>
> - ocelot_port_add_txtstamp_skb(ocelot, port, *clone);
> - return true;
> - }
> + if (ocelot_port_txtstamp_request(ocelot, port, skb, clone))
> + return false;
>
> - return false;
> + return true;

Considering the changes you'll have to make to patch 1 (changing the
return value and populating DSA_SKB_CB(skb)->clone at the end of this
function:

Reviewed-by: Vladimir Oltean <vladimir.oltean@xxxxxxx>