net/cnxk: support Rx/Tx timestamp read
Patch implements Rx/Tx timestamp read operations for cn9k and cn10k platforms. Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
This commit is contained in:
parent
5a6ce511b1
commit
77398b9e5c
@ -1260,6 +1260,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
|
||||
.tx_done_cleanup = cnxk_nix_tx_done_cleanup,
|
||||
.flow_ops_get = cnxk_nix_flow_ops_get,
|
||||
.get_reg = cnxk_nix_dev_get_reg,
|
||||
.timesync_read_rx_timestamp = cnxk_nix_timesync_read_rx_timestamp,
|
||||
.timesync_read_tx_timestamp = cnxk_nix_timesync_read_tx_timestamp,
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -312,6 +312,11 @@ int cnxk_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qid);
|
||||
int cnxk_nix_dev_start(struct rte_eth_dev *eth_dev);
|
||||
int cnxk_nix_timesync_enable(struct rte_eth_dev *eth_dev);
|
||||
int cnxk_nix_timesync_disable(struct rte_eth_dev *eth_dev);
|
||||
int cnxk_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
|
||||
struct timespec *timestamp,
|
||||
uint32_t flags);
|
||||
int cnxk_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
|
||||
struct timespec *timestamp);
|
||||
int cnxk_nix_tsc_convert(struct cnxk_eth_dev *dev);
|
||||
|
||||
uint64_t cnxk_nix_rxq_mbuf_setup(struct cnxk_eth_dev *dev);
|
||||
|
@ -55,6 +55,44 @@ cnxk_nix_tsc_convert(struct cnxk_eth_dev *dev)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
cnxk_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
|
||||
struct timespec *timestamp, uint32_t flags)
|
||||
{
|
||||
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
|
||||
struct cnxk_timesync_info *tstamp = &dev->tstamp;
|
||||
uint64_t ns;
|
||||
|
||||
PLT_SET_USED(flags);
|
||||
|
||||
if (!tstamp->rx_ready)
|
||||
return -EINVAL;
|
||||
|
||||
ns = rte_timecounter_update(&dev->rx_tstamp_tc, tstamp->rx_tstamp);
|
||||
*timestamp = rte_ns_to_timespec(ns);
|
||||
tstamp->rx_ready = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
cnxk_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
|
||||
struct timespec *timestamp)
|
||||
{
|
||||
struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
|
||||
struct cnxk_timesync_info *tstamp = &dev->tstamp;
|
||||
uint64_t ns;
|
||||
|
||||
if (*tstamp->tx_tstamp == 0)
|
||||
return -EINVAL;
|
||||
|
||||
ns = rte_timecounter_update(&dev->tx_tstamp_tc, *tstamp->tx_tstamp);
|
||||
*timestamp = rte_ns_to_timespec(ns);
|
||||
*tstamp->tx_tstamp = 0;
|
||||
rte_wmb();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
cnxk_nix_timesync_enable(struct rte_eth_dev *eth_dev)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user