Due to only support timestamp at port level, registering
timestamp mbuf should be at dev start stage.

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

Signed-off-by: Wenjing Qiao <wenjing.q...@intel.com>
Suggested-by: Jingjing Wu <jingjing...@intel.com>
---
 drivers/net/cpfl/cpfl_ethdev.c | 7 +++++++
 drivers/net/cpfl/cpfl_ethdev.h | 3 +++
 drivers/net/cpfl/cpfl_rxtx.c   | 2 ++
 3 files changed, 12 insertions(+)

diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index 82d8147494..416273f567 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -771,6 +771,13 @@ cpfl_dev_start(struct rte_eth_dev *dev)
                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) {
+                       PMD_DRV_LOG(ERR, "Cannot register mbuf field/flag for 
timestamp");
+                       return -EINVAL;
+               }
        }
 
        ret = idpf_vc_vectors_alloc(vport, req_vecs_num);
diff --git a/drivers/net/cpfl/cpfl_ethdev.h b/drivers/net/cpfl/cpfl_ethdev.h
index 200dfcac02..eec253bc77 100644
--- a/drivers/net/cpfl/cpfl_ethdev.h
+++ b/drivers/net/cpfl/cpfl_ethdev.h
@@ -57,6 +57,9 @@
 /* Device IDs */
 #define IDPF_DEV_ID_CPF                        0x1453
 
+extern int idpf_timestamp_dynfield_offset;
+extern uint64_t idpf_timestamp_dynflag;
+
 struct cpfl_vport_param {
        struct cpfl_adapter_ext *adapter;
        uint16_t devarg_id; /* arg id from user */
diff --git a/drivers/net/cpfl/cpfl_rxtx.c b/drivers/net/cpfl/cpfl_rxtx.c
index de59b31b3d..cdb5b37da0 100644
--- a/drivers/net/cpfl/cpfl_rxtx.c
+++ b/drivers/net/cpfl/cpfl_rxtx.c
@@ -529,6 +529,8 @@ cpfl_rx_queue_init(struct rte_eth_dev *dev, uint16_t 
rx_queue_id)
            frame_size > rxq->rx_buf_len)
                dev->data->scattered_rx = 1;
 
+       if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP)
+               rxq->ts_enable = TRUE;
        err = idpf_qc_ts_mbuf_register(rxq);
        if (err != 0) {
                PMD_DRV_LOG(ERR, "fail to register timestamp mbuf %u",
-- 
2.25.1

Reply via email to