The iavf driver has support for hardware Rx timestamps since commit h
b5cd735132f6 ("net/iavf: enable Rx timestamp on flex descriptor").

To enable this, the VF must first negotiate PTP capabilities with the PF
by sending the VIRTCHNL_OP_1588_PTP_GET_CAPS command, with the requested
capabilities. The PF will respond with the actually supported subset of
capabilities.

The PF may not actually enable Rx timestamping, even if it reports the
overall PTP capability support. If this happens, the iavf driver logic
will incorrectly report that Rx timestamps can be enabled despite being
rejected by the PF.

This is unlikely in practice, as most PFs which support the
VIRTCHNL_VF_CAP_PTP will support Rx timestamping. However, there are
some cases where this may not be true.

Check that the PF actually reports the Rx timestamping capability
instead of assuming it is enabled. Doing so prevents the DPDK
application from attempting to enable Rx timestamps when they won't
actually be enabled.

Signed-off-by: Jacob Keller <[email protected]>
---
 drivers/net/intel/iavf/iavf_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/intel/iavf/iavf_ethdev.c 
b/drivers/net/intel/iavf/iavf_ethdev.c
index 15e49fe24814..3ef766de4704 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -1177,7 +1177,8 @@ iavf_dev_info_get(struct rte_eth_dev *dev, struct 
rte_eth_dev_info *dev_info)
        if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_CRC)
                dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_KEEP_CRC;
 
-       if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_PTP)
+       if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_CAP_PTP &&
+           vf->ptp_caps & VIRTCHNL_1588_PTP_CAP_RX_TSTAMP)
                dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP;
 
        if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN_V2 &&

-- 
2.51.0.rc1.197.g6d975e95c9d7

Reply via email to