[v4,5/7] common/idpf: add timestamp enable flag for rxq
Checks
Commit Message
A rxq can be configured with timestamp offload.
So, add timestamp enable flag for rxq.
Fixes: 8c6098afa075 ("common/idpf: add Rx/Tx data path")
Cc: stable@dpdk.org
Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
Suggested-by: Jingjing Wu <jingjing.wu@intel.com>
---
drivers/common/idpf/idpf_common_rxtx.c | 11 ++++++++++-
drivers/common/idpf/idpf_common_rxtx.h | 2 ++
2 files changed, 12 insertions(+), 1 deletion(-)
@@ -416,7 +416,7 @@ int
idpf_qc_ts_mbuf_register(struct idpf_rx_queue *rxq)
{
int err;
- if ((rxq->offloads & IDPF_RX_OFFLOAD_TIMESTAMP) != 0) {
+ if (!rxq->ts_enable && (rxq->offloads & IDPF_RX_OFFLOAD_TIMESTAMP)) {
/* Register mbuf field and flag for Rx timestamp */
err = rte_mbuf_dyn_rx_timestamp_register(&idpf_timestamp_dynfield_offset,
&idpf_timestamp_dynflag);
@@ -425,6 +425,7 @@ idpf_qc_ts_mbuf_register(struct idpf_rx_queue *rxq)
"Cannot register mbuf field/flag for timestamp");
return -EINVAL;
}
+ rxq->ts_enable = TRUE;
}
return 0;
}
@@ -433,9 +434,17 @@ idpf_qc_ts_mbuf_register(struct idpf_rx_queue *rxq)
int
idpf_rx_timestamp_start(struct idpf_adapter *base)
{
+ int ret;
rte_eal_alarm_set(1000 * 1000,
&idpf_dev_read_time_hw,
(void *)base);
+ /* Register mbuf field and flag for Rx timestamp */
+ ret = rte_mbuf_dyn_rx_timestamp_register(&idpf_timestamp_dynfield_offset,
+ &idpf_timestamp_dynflag);
+ if (ret != 0) {
+ DRV_LOG(ERR, "Cannot register mbuf field/flag for timestamp");
+ return -EINVAL;
+ }
return 0;
}
@@ -145,6 +145,8 @@ struct idpf_rx_queue {
struct idpf_rx_queue *bufq2;
uint64_t offloads;
+
+ bool ts_enable; /* if timestamp is enabled */
};
struct idpf_tx_entry {