Subject: Re: [PATCH v5 iwl-next 1/6] ice: introduce PTP state machine

From: Simon Horman <[email-masked]>
Date: Mon, 15 Jan 2024 10:32:40 +0000

On Mon, Jan 08, 2024 at 01:47:12PM +0100, Karol Kolacinski wrote:

Should there be a "From: Jacob" line here to
match the Signed-off-by below?

> Add PTP state machine so that the driver can correctly identify PTP
> state around resets.
> When the driver got information about ungraceful reset, PTP was not
> prepared for reset and it returned error. When this situation occurs,
> prepare PTP before rebuilding its structures.
> 
> Signed-off-by: Jacob Keller <[email-masked]>
> Signed-off-by: Karol Kolacinski <[email-masked]>
> Reviewed-by: Jacob Keller <[email-masked]>

Hi Karol and Jacob,

FWIIW, The combination of both a Signed-off-by and Reviewed-by tag from
Jacob seems a little odd to me. If he authored the patch then I would have
gone with the following (along with the From line mentioned above):

Signed-off-by: Jacob Keller <[email-masked]>
Signed-off-by: Karol Kolacinski <[email-masked]>

Otherwise, if he reviewed the patch I would have gone with:

Reviewed-by: Jacob Keller <[email-masked]>
Signed-off-by: Karol Kolacinski <[email-masked]>

...

> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c

...

> @@ -2640,6 +2676,16 @@ void ice_ptp_reset(struct ice_pf *pf)
>  	int err, itr = 1;
>  	u64 time_diff;
>  
> +	if (ptp->state != ICE_PTP_RESETTING) {
> +		if (ptp->state == ICE_PTP_READY) {
> +			ice_ptp_prepare_for_reset(pf);
> +		} else {
> +			err = -EINVAL;
> +			dev_err(ice_pf_to_dev(pf), "PTP was not initialized\n");
> +			goto err;
> +		}
> +	}

nit: perhaps this following is slightly nicer?
     (completely untested!)

	if (ptp->state == ICE_PTP_READY) {
		ice_ptp_prepare_for_reset(pf);
	} else if (ptp->state != ICE_PTP_RESETTING) {
		err = -EINVAL;
		dev_err(ice_pf_to_dev(pf), "PTP was not initialized\n");
		goto err;
	}

> +
>  	if (test_bit(ICE_PFR_REQ, pf->state) ||
>  	    !ice_pf_src_tmr_owned(pf))
>  		goto pfr;

...