DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/iavf: check PTP capabilities during init
@ 2025-11-21 23:39 Jacob Keller
  2025-11-24 12:09 ` Bruce Richardson
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jacob Keller @ 2025-11-21 23:39 UTC (permalink / raw)
  To: dev
  Cc: Paul Greenwalt, Vladimir Medvedkin, Kevin Traynor, songx.jiale,
	Jacob Keller

Commit d21c2fe6e5a1 ("net/iavf: fix check for PF Rx timestamp support")
added a check against whether the PF has actually enabled Rx
timestamping in iavf_dev_info_get(). Unfortunately, this function may be
called prior to the PTP capabilities being exchanged, which results in
Rx timestamping not being supported.

Fix this by checking the PF PTP capabilities near the end of
iavf_dev_init(). This ensures the VF knows the capabilities at the point
where the iavf_dev_info_get() function can be called. Doing the check at
init is better than inside the info callback, as the info callback is
called many times.

The capability exchange in iavf_dev_start() is kept to ensure that
capabilities are updated after resets.

Fixes: d21c2fe6e5a1 ("net/iavf: fix check for PF Rx timestamp support")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
My recent fix to prevent enabling Rx timestamping on PFs which do support
PTP capability but do not report Rx timestamping accidentally broke PFs
which *do* support Rx timestamping. This is because the driver did not
exchange capability before reporting its device info. Fix this by checking
PF capabilities during iavf_dev_init().
---
 drivers/net/intel/iavf/iavf_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index 3ef766de4704..9b07b11a6b51 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -2887,6 +2887,14 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 		}
 	}
 
+	/* Get PTP caps early to verify device capabilities */
+	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_PTP) {
+		if (iavf_get_ptp_cap(adapter)) {
+			PMD_INIT_LOG(ERR, "Failed to get ptp capability");
+			goto security_init_err;
+		}
+	}
+
 	iavf_default_rss_disable(adapter);
 
 	iavf_dev_stats_reset(eth_dev);

---
base-commit: ef98b88455bf4a7c8b7aa3106a761c9e9270d6a3
change-id: 20251121-jk-dpdk-iavf-rx-timestamping-fix-abdcb42f0197

Best regards,
--  
Jacob Keller <jacob.e.keller@intel.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net/iavf: check PTP capabilities during init
  2025-11-21 23:39 [PATCH] net/iavf: check PTP capabilities during init Jacob Keller
@ 2025-11-24 12:09 ` Bruce Richardson
  2025-11-24 21:34   ` Jacob Keller
  2025-11-24 15:45 ` Patrick Robb
  2025-11-25 10:30 ` Hore, Soumyadeep
  2 siblings, 1 reply; 6+ messages in thread
From: Bruce Richardson @ 2025-11-24 12:09 UTC (permalink / raw)
  To: Jacob Keller
  Cc: dev, Paul Greenwalt, Vladimir Medvedkin, Kevin Traynor, songx.jiale

On Fri, Nov 21, 2025 at 03:39:37PM -0800, Jacob Keller wrote:
> Commit d21c2fe6e5a1 ("net/iavf: fix check for PF Rx timestamp support")
> added a check against whether the PF has actually enabled Rx
> timestamping in iavf_dev_info_get(). Unfortunately, this function may be
> called prior to the PTP capabilities being exchanged, which results in
> Rx timestamping not being supported.
> 
> Fix this by checking the PF PTP capabilities near the end of
> iavf_dev_init(). This ensures the VF knows the capabilities at the point
> where the iavf_dev_info_get() function can be called. Doing the check at
> init is better than inside the info callback, as the info callback is
> called many times.
> 
> The capability exchange in iavf_dev_start() is kept to ensure that
> capabilities are updated after resets.
> 
> Fixes: d21c2fe6e5a1 ("net/iavf: fix check for PF Rx timestamp support")
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> My recent fix to prevent enabling Rx timestamping on PFs which do support
> PTP capability but do not report Rx timestamping accidentally broke PFs
> which *do* support Rx timestamping. This is because the driver did not
> exchange capability before reporting its device info. Fix this by checking
> PF capabilities during iavf_dev_init().
> ---
>  drivers/net/intel/iavf/iavf_ethdev.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
> index 3ef766de4704..9b07b11a6b51 100644
> --- a/drivers/net/intel/iavf/iavf_ethdev.c
> +++ b/drivers/net/intel/iavf/iavf_ethdev.c
> @@ -2887,6 +2887,14 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
>  		}
>  	}
>  
> +	/* Get PTP caps early to verify device capabilities */
> +	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_PTP) {
> +		if (iavf_get_ptp_cap(adapter)) {
> +			PMD_INIT_LOG(ERR, "Failed to get ptp capability");
> +			goto security_init_err;
> +		}
> +	}
> +

With this code added here, do we still need to keep - or should we keep -
the existing call in iavf_dev_start()? I would have expected the call to
iavf_get_ptp_cap to be moved rather than duplicated. Is there a reason
to keep the existing call?

/Bruce

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net/iavf: check PTP capabilities during init
  2025-11-21 23:39 [PATCH] net/iavf: check PTP capabilities during init Jacob Keller
  2025-11-24 12:09 ` Bruce Richardson
@ 2025-11-24 15:45 ` Patrick Robb
  2025-11-25 10:30 ` Hore, Soumyadeep
  2 siblings, 0 replies; 6+ messages in thread
From: Patrick Robb @ 2025-11-24 15:45 UTC (permalink / raw)
  To: Jacob Keller; +Cc: dev

[-- Attachment #1: Type: text/plain, Size: 2621 bytes --]

Hi. There are some DTS failures on this testbed due to misconfiguration
applied by us at UNH last week. I'm fixing it and rerunning testing which
will update the CI checks for your patchseries.

On Fri, Nov 21, 2025 at 6:39 PM Jacob Keller <jacob.e.keller@intel.com>
wrote:

> Commit d21c2fe6e5a1 ("net/iavf: fix check for PF Rx timestamp support")
> added a check against whether the PF has actually enabled Rx
> timestamping in iavf_dev_info_get(). Unfortunately, this function may be
> called prior to the PTP capabilities being exchanged, which results in
> Rx timestamping not being supported.
>
> Fix this by checking the PF PTP capabilities near the end of
> iavf_dev_init(). This ensures the VF knows the capabilities at the point
> where the iavf_dev_info_get() function can be called. Doing the check at
> init is better than inside the info callback, as the info callback is
> called many times.
>
> The capability exchange in iavf_dev_start() is kept to ensure that
> capabilities are updated after resets.
>
> Fixes: d21c2fe6e5a1 ("net/iavf: fix check for PF Rx timestamp support")
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> My recent fix to prevent enabling Rx timestamping on PFs which do support
> PTP capability but do not report Rx timestamping accidentally broke PFs
> which *do* support Rx timestamping. This is because the driver did not
> exchange capability before reporting its device info. Fix this by checking
> PF capabilities during iavf_dev_init().
> ---
>  drivers/net/intel/iavf/iavf_ethdev.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/net/intel/iavf/iavf_ethdev.c
> b/drivers/net/intel/iavf/iavf_ethdev.c
> index 3ef766de4704..9b07b11a6b51 100644
> --- a/drivers/net/intel/iavf/iavf_ethdev.c
> +++ b/drivers/net/intel/iavf/iavf_ethdev.c
> @@ -2887,6 +2887,14 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
>                 }
>         }
>
> +       /* Get PTP caps early to verify device capabilities */
> +       if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_PTP) {
> +               if (iavf_get_ptp_cap(adapter)) {
> +                       PMD_INIT_LOG(ERR, "Failed to get ptp capability");
> +                       goto security_init_err;
> +               }
> +       }
> +
>         iavf_default_rss_disable(adapter);
>
>         iavf_dev_stats_reset(eth_dev);
>
> ---
> base-commit: ef98b88455bf4a7c8b7aa3106a761c9e9270d6a3
> change-id: 20251121-jk-dpdk-iavf-rx-timestamping-fix-abdcb42f0197
>
> Best regards,
> --
> Jacob Keller <jacob.e.keller@intel.com>
>
>

[-- Attachment #2: Type: text/html, Size: 3303 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net/iavf: check PTP capabilities during init
  2025-11-24 12:09 ` Bruce Richardson
@ 2025-11-24 21:34   ` Jacob Keller
  0 siblings, 0 replies; 6+ messages in thread
From: Jacob Keller @ 2025-11-24 21:34 UTC (permalink / raw)
  To: Bruce Richardson
  Cc: dev, Paul Greenwalt, Vladimir Medvedkin, Kevin Traynor, songx.jiale


[-- Attachment #1.1: Type: text/plain, Size: 2551 bytes --]



On 11/24/2025 4:09 AM, Bruce Richardson wrote:
> On Fri, Nov 21, 2025 at 03:39:37PM -0800, Jacob Keller wrote:
>> diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
>> index 3ef766de4704..9b07b11a6b51 100644
>> --- a/drivers/net/intel/iavf/iavf_ethdev.c
>> +++ b/drivers/net/intel/iavf/iavf_ethdev.c
>> @@ -2887,6 +2887,14 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
>>  		}
>>  	}
>>  
>> +	/* Get PTP caps early to verify device capabilities */
>> +	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_PTP) {
>> +		if (iavf_get_ptp_cap(adapter)) {
>> +			PMD_INIT_LOG(ERR, "Failed to get ptp capability");
>> +			goto security_init_err;
>> +		}
>> +	}
>> +
> 
> With this code added here, do we still need to keep - or should we keep -
> the existing call in iavf_dev_start()? I would have expected the call to
> iavf_get_ptp_cap to be moved rather than duplicated. Is there a reason
> to keep the existing call?
> 
> /Bruce

So, I considered this, but I am not sure. In principle, we need to make
sure that we re-check capabilities after a reset. It is unlikely but it
is possible that a device reset could cause the PF to change its
decision on capabilities. I didn't see logic to call this during the
reset handler. If my understanding is right, thats because the start
function would get called after a reset, at which point we'd recheck
during the device start function.

I think its harmless to re-check the values as they should either be the
same or if they did somehow change we should get the updated value. The
intent of checking earlier is really just to make sure we try not to
report that we support timestamps when we definitely don't.

In particular, I wanted to get the current case with the upstream ice
driver and the DPDK code to fail closed instead of attempting to enable
timestamps but doing so incorrectly. (As outlined in my earlier cover
letter, we have a compatibility issue with the in-tree Linux kernel
drivers and the out-of-tree drivers regarding the capability struct layout).

That setup was trying to turn on timestamps but the PF did not actually
enable timestamps due to the capability layout issue, and thus the
timestamps were bogus. Instead, the new situation should be that DPDK
reports it can't enable timestamps, until we figure out the solution for
compatibility across these different variants of virtchnl. I'm working
on that but don't have an ETA or known time where we'll have a good
solution.

Thanks,
Jake

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] net/iavf: check PTP capabilities during init
  2025-11-21 23:39 [PATCH] net/iavf: check PTP capabilities during init Jacob Keller
  2025-11-24 12:09 ` Bruce Richardson
  2025-11-24 15:45 ` Patrick Robb
@ 2025-11-25 10:30 ` Hore, Soumyadeep
  2025-11-25 13:12   ` Bruce Richardson
  2 siblings, 1 reply; 6+ messages in thread
From: Hore, Soumyadeep @ 2025-11-25 10:30 UTC (permalink / raw)
  To: Keller, Jacob E, dev
  Cc: Greenwalt, Paul, Medvedkin, Vladimir, Jiale, SongX, Keller, Jacob E

Commit d21c2fe6e5a1 ("net/iavf: fix check for PF Rx timestamp support") added a check against whether the PF has actually enabled Rx timestamping in iavf_dev_info_get(). Unfortunately, this function may be called prior to the PTP capabilities being exchanged, which results in Rx timestamping not being supported.

Fix this by checking the PF PTP capabilities near the end of iavf_dev_init(). This ensures the VF knows the capabilities at the point where the iavf_dev_info_get() function can be called. Doing the check at init is better than inside the info callback, as the info callback is called many times.

The capability exchange in iavf_dev_start() is kept to ensure that capabilities are updated after resets.

Fixes: d21c2fe6e5a1 ("net/iavf: fix check for PF Rx timestamp support")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---
My recent fix to prevent enabling Rx timestamping on PFs which do support PTP capability but do not report Rx timestamping accidentally broke PFs which *do* support Rx timestamping. This is because the driver did not exchange capability before reporting its device info. Fix this by checking PF capabilities during iavf_dev_init().
---
 drivers/net/intel/iavf/iavf_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
index 3ef766de4704..9b07b11a6b51 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -2887,6 +2887,14 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
 		}
 	}
 
+	/* Get PTP caps early to verify device capabilities */
+	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_PTP) {
+		if (iavf_get_ptp_cap(adapter)) {
+			PMD_INIT_LOG(ERR, "Failed to get ptp capability");
+			goto security_init_err;
+		}
+	}
+
 	iavf_default_rss_disable(adapter);
 
 	iavf_dev_stats_reset(eth_dev);

---
base-commit: ef98b88455bf4a7c8b7aa3106a761c9e9270d6a3
change-id: 20251121-jk-dpdk-iavf-rx-timestamping-fix-abdcb42f0197

Best regards,
--
Jacob Keller <jacob.e.keller@intel.com>

Hi Jacob,

Currently PTP features are not enabled in DPDK. We only have the Rx timestamp API in place. Typically the change that you want needs to be implemented in ethdev_ops.timesync_enable(), which is not implemented.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] net/iavf: check PTP capabilities during init
  2025-11-25 10:30 ` Hore, Soumyadeep
@ 2025-11-25 13:12   ` Bruce Richardson
  0 siblings, 0 replies; 6+ messages in thread
From: Bruce Richardson @ 2025-11-25 13:12 UTC (permalink / raw)
  To: Hore, Soumyadeep
  Cc: Keller, Jacob E, dev, Greenwalt, Paul, Medvedkin, Vladimir, Jiale, SongX

On Tue, Nov 25, 2025 at 10:30:37AM +0000, Hore, Soumyadeep wrote:
> Commit d21c2fe6e5a1 ("net/iavf: fix check for PF Rx timestamp support") added a check against whether the PF has actually enabled Rx timestamping in iavf_dev_info_get(). Unfortunately, this function may be called prior to the PTP capabilities being exchanged, which results in Rx timestamping not being supported.
> 
> Fix this by checking the PF PTP capabilities near the end of iavf_dev_init(). This ensures the VF knows the capabilities at the point where the iavf_dev_info_get() function can be called. Doing the check at init is better than inside the info callback, as the info callback is called many times.
> 
> The capability exchange in iavf_dev_start() is kept to ensure that capabilities are updated after resets.
> 
> Fixes: d21c2fe6e5a1 ("net/iavf: fix check for PF Rx timestamp support")
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> My recent fix to prevent enabling Rx timestamping on PFs which do support PTP capability but do not report Rx timestamping accidentally broke PFs which *do* support Rx timestamping. This is because the driver did not exchange capability before reporting its device info. Fix this by checking PF capabilities during iavf_dev_init().
> ---
>  drivers/net/intel/iavf/iavf_ethdev.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/intel/iavf/iavf_ethdev.c b/drivers/net/intel/iavf/iavf_ethdev.c
> index 3ef766de4704..9b07b11a6b51 100644
> --- a/drivers/net/intel/iavf/iavf_ethdev.c
> +++ b/drivers/net/intel/iavf/iavf_ethdev.c
> @@ -2887,6 +2887,14 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
>  		}
>  	}
>  
> +	/* Get PTP caps early to verify device capabilities */
> +	if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_PTP) {
> +		if (iavf_get_ptp_cap(adapter)) {
> +			PMD_INIT_LOG(ERR, "Failed to get ptp capability");
> +			goto security_init_err;
> +		}
> +	}
> +
>  	iavf_default_rss_disable(adapter);
>  
>  	iavf_dev_stats_reset(eth_dev);
> 
> ---
> base-commit: ef98b88455bf4a7c8b7aa3106a761c9e9270d6a3
> change-id: 20251121-jk-dpdk-iavf-rx-timestamping-fix-abdcb42f0197
> 
> Best regards,
> --
> Jacob Keller <jacob.e.keller@intel.com>
> 
> Hi Jacob,
> 
> Currently PTP features are not enabled in DPDK. We only have the Rx timestamp API in place. Typically the change that you want needs to be implemented in ethdev_ops.timesync_enable(), which is not implemented.
> 
At this stage we are post final RC for 25.11, so taking this patch would be
risky anyway. Let's target 26.03 for this, and then look to  backport to
25.11.1

Thanks,
/Bruce

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-25 13:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-21 23:39 [PATCH] net/iavf: check PTP capabilities during init Jacob Keller
2025-11-24 12:09 ` Bruce Richardson
2025-11-24 21:34   ` Jacob Keller
2025-11-24 15:45 ` Patrick Robb
2025-11-25 10:30 ` Hore, Soumyadeep
2025-11-25 13:12   ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).