[PATCH net-next v5 10/10] net: ti: icssg-prueth: Add ICSSG Ethernet driver for AM65x SR1.0 platforms

Simon Horman horms at kernel.org
Wed Mar 27 08:03:10 PDT 2024


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 at siemens.com>
> Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
> Signed-off-by: Diogo Ivo <diogo.ivo at siemens.com>
> Reviewed-by: MD Danish Anwar <danishanwar at ti.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);
> +}

...



More information about the linux-arm-kernel mailing list