[v4,2/7] net/idpf: save main time by alarm

Message ID 20230519083110.809913-3-wenjing.qiao@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Qi Zhang
Headers
Series fix idpf and cpfl timestamp |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Wenjing Qiao May 19, 2023, 8:31 a.m. UTC
  Using alarm to save main time from registers every 1 second.

Fixes: 8c6098afa075 ("common/idpf: add Rx/Tx data path")
Cc: stable@dpdk.org

Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
---
 drivers/net/idpf/idpf_ethdev.c | 7 +++++++
 1 file changed, 7 insertions(+)
  

Patch

diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 7a33b9eb6a..21f3d0f76a 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -761,6 +761,9 @@  idpf_dev_start(struct rte_eth_dev *dev)
 		goto err_vec;
 	}
 
+	if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP)
+		idpf_rx_timestamp_start(base);
+
 	ret = idpf_vc_vectors_alloc(vport, req_vecs_num);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to allocate interrupt vectors");
@@ -808,6 +811,7 @@  static int
 idpf_dev_stop(struct rte_eth_dev *dev)
 {
 	struct idpf_vport *vport = dev->data->dev_private;
+	struct idpf_adapter *base = vport->adapter;
 
 	if (dev->data->dev_started == 0)
 		return 0;
@@ -820,6 +824,9 @@  idpf_dev_stop(struct rte_eth_dev *dev)
 
 	idpf_vc_vectors_dealloc(vport);
 
+	if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP)
+		idpf_rx_timestamp_stop(base);
+
 	return 0;
 }