[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240327150310.GM403975@kernel.org>
Date: Wed, 27 Mar 2024 15:03:10 +0000
From: Simon Horman <horms@...nel.org>
To: Diogo Ivo <diogo.ivo@...mens.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, danishanwar@...com, rogerq@...nel.org,
vigneshr@...com, arnd@...db.de, wsa+renesas@...g-engineering.com,
vladimir.oltean@....com, andrew@...n.ch, dan.carpenter@...aro.org,
netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
jan.kiszka@...mens.com
Subject: Re: [PATCH net-next v5 10/10] net: ti: icssg-prueth: Add ICSSG
Ethernet driver for AM65x SR1.0 platforms
On Tue, Mar 26, 2024 at 11:07:00AM +0000, Diogo Ivo wrote:
> Add the PRUeth driver for the ICSSG subsystem found in AM65x SR1.0 devices.
> The main differences that set SR1.0 and SR2.0 apart are the missing TXPRU
> core in SR1.0, two extra DMA channels for management purposes and different
> firmware that needs to be configured accordingly.
>
> Based on the work of Roger Quadros, Vignesh Raghavendra and
> Grygorii Strashko in TI's 5.10 SDK [1].
>
> [1]: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/?h=ti-linux-5.10.y
>
> Co-developed-by: Jan Kiszka <jan.kiszka@...mens.com>
> Signed-off-by: Jan Kiszka <jan.kiszka@...mens.com>
> Signed-off-by: Diogo Ivo <diogo.ivo@...mens.com>
> Reviewed-by: MD Danish Anwar <danishanwar@...com>
...
> diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
...
> +static void prueth_tx_ts_sr1(struct prueth_emac *emac,
> + struct emac_tx_ts_response_sr1 *tsr)
> +{
> + struct skb_shared_hwtstamps ssh;
> + u32 hi_ts, lo_ts, cookie;
> + struct sk_buff *skb;
> + u64 ns;
> +
> + hi_ts = le32_to_cpu(tsr->hi_ts);
> + lo_ts = le32_to_cpu(tsr->lo_ts);
> +
> + ns = (u64)hi_ts << 32 | lo_ts;
> +
> + cookie = le32_to_cpu(tsr->cookie);
Hi,
le32_to_cpu() expects a __le32 argument.
But the type of tsr->hi_ts, tsr->lo_ts and tsr->cookie is u32.
This seems to indicate that host byte order values
are being used as little endian values, which does not seem correct.
Flagged by Sparse.
> + if (cookie >= PRUETH_MAX_TX_TS_REQUESTS) {
> + netdev_dbg(emac->ndev, "Invalid TX TS cookie 0x%x\n",
> + cookie);
> + return;
> + }
> +
> + skb = emac->tx_ts_skb[cookie];
> + emac->tx_ts_skb[cookie] = NULL; /* free slot */
> +
> + memset(&ssh, 0, sizeof(ssh));
> + ssh.hwtstamp = ns_to_ktime(ns);
> +
> + skb_tstamp_tx(skb, &ssh);
> + dev_consume_skb_any(skb);
> +}
...
Powered by blists - more mailing lists