Subject: Re: [PATCH iwl-net 07/10] idpf: add Tx timestamp capabilities negotiation

From: Simon Horman <[email-masked]>
Date: Fri, 15 Nov 2024 13:45:02 +0000

On Wed, Nov 13, 2024 at 04:46:19PM +0100, Milena Olech wrote:
> Tx timestamp capabilities are negotiated for the uplink Vport.
> Driver receives information about the number of available Tx timestamp
> latches, the size of Tx timestamp value and the set of indexes used
> for Tx timestamping.
> 
> Add function to get the Tx timestamp capabilities and parse the uplink
> vport flag.
> 
> Co-developed-by: Emil Tantilov <[email-masked]>
> Signed-off-by: Emil Tantilov <[email-masked]>
> Co-developed-by: Pavan Kumar Linga <[email-masked]>
> Signed-off-by: Pavan Kumar Linga <[email-masked]>
> Reviewed-by: Alexander Lobakin <[email-masked]>
> Signed-off-by: Milena Olech <[email-masked]>

...

> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c

...

> +/**
> + * idpf_ptp_get_vport_tstamps_caps - Send virtchnl to get tstamps caps for vport
> + * @vport: Virtual port structure
> + *
> + * Send virtchnl get vport tstamps caps message to receive the set of tstamp
> + * capabilities per vport.
> + *
> + * Return: 0 on success, -errno otherwise.
> + */
> +int idpf_ptp_get_vport_tstamps_caps(struct idpf_vport *vport)

...

> +	for (u16 i = 0; i < tstamp_caps->num_entries; i++) {
> +		u32 offset_l, offset_h;

It looks like the type of offset_l and offset_h should be __le32
to match the values that are stored in them.

Flagged by Sparse.

> +
> +		ptp_tx_tstamp = ptp_tx_tstamps + i;
> +		tx_tstamp_latch_caps = rcv_tx_tstamp_caps->tstamp_latches[i];
> +
> +		if (tstamp_access != IDPF_PTP_DIRECT)
> +			goto skip_offsets;
> +
> +		offset_l = tx_tstamp_latch_caps.tx_latch_reg_offset_l;
> +		offset_h = tx_tstamp_latch_caps.tx_latch_reg_offset_h;
> +		ptp_tx_tstamp->tx_latch_reg_offset_l = le32_to_cpu(offset_l);
> +		ptp_tx_tstamp->tx_latch_reg_offset_h = le32_to_cpu(offset_h);
> +
> +skip_offsets:
> +		ptp_tx_tstamp->idx = tx_tstamp_latch_caps.index;
> +
> +		list_add(&ptp_tx_tstamp->list_member,
> +			 &tstamp_caps->latches_free);
> +
> +		tstamp_caps->tx_tstamp_status[i].state = IDPF_PTP_FREE;
> +	}

...