Commit 183532b7 authored by Aya Levin's avatar Aya Levin Committed by Saeed Mahameed

net/mlx5: Add helper to set time-stamp translator on a queue

Translation method on the time-stamp is set by the capabilities. Avoid
code duplication by using a helper to set ptp_cyc2time callback on a
queue.
Signed-off-by: default avatarAya Levin <ayal@nvidia.com>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent ea886000
...@@ -183,9 +183,7 @@ static int mlx5e_ptp_alloc_txqsq(struct mlx5e_port_ptp *c, int txq_ix, ...@@ -183,9 +183,7 @@ static int mlx5e_ptp_alloc_txqsq(struct mlx5e_port_ptp *c, int txq_ix,
if (!MLX5_CAP_ETH(mdev, wqe_vlan_insert)) if (!MLX5_CAP_ETH(mdev, wqe_vlan_insert))
set_bit(MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE, &sq->state); set_bit(MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE, &sq->state);
sq->stop_room = param->stop_room; sq->stop_room = param->stop_room;
sq->ptp_cyc2time = mlx5_is_real_time_sq(mdev) ? sq->ptp_cyc2time = mlx5_sq_ts_translator(mdev);
mlx5_real_time_cyc2time :
mlx5_timecounter_cyc2time;
node = dev_to_node(mlx5_core_dma_dev(mdev)); node = dev_to_node(mlx5_core_dma_dev(mdev));
......
...@@ -404,9 +404,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, ...@@ -404,9 +404,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
rq->hw_mtu = MLX5E_SW2HW_MTU(params, params->sw_mtu); rq->hw_mtu = MLX5E_SW2HW_MTU(params, params->sw_mtu);
rq->xdpsq = &c->rq_xdpsq; rq->xdpsq = &c->rq_xdpsq;
rq->xsk_pool = xsk_pool; rq->xsk_pool = xsk_pool;
rq->ptp_cyc2time = mlx5_is_real_time_rq(mdev) ? rq->ptp_cyc2time = mlx5_rq_ts_translator(mdev);
mlx5_real_time_cyc2time :
mlx5_timecounter_cyc2time;
if (rq->xsk_pool) if (rq->xsk_pool)
rq->stats = &c->priv->channel_stats[c->ix].xskrq; rq->stats = &c->priv->channel_stats[c->ix].xskrq;
...@@ -1141,9 +1139,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c, ...@@ -1141,9 +1139,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c,
if (param->is_mpw) if (param->is_mpw)
set_bit(MLX5E_SQ_STATE_MPWQE, &sq->state); set_bit(MLX5E_SQ_STATE_MPWQE, &sq->state);
sq->stop_room = param->stop_room; sq->stop_room = param->stop_room;
sq->ptp_cyc2time = mlx5_is_real_time_sq(mdev) ? sq->ptp_cyc2time = mlx5_sq_ts_translator(mdev);
mlx5_real_time_cyc2time :
mlx5_timecounter_cyc2time;
param->wq.db_numa_node = cpu_to_node(c->cpu); param->wq.db_numa_node = cpu_to_node(c->cpu);
err = mlx5_wq_cyc_create(mdev, &param->wq, sqc_wq, wq, &sq->wq_ctrl); err = mlx5_wq_cyc_create(mdev, &param->wq, sqc_wq, wq, &sq->wq_ctrl);
......
...@@ -105,4 +105,15 @@ static inline ktime_t mlx5_real_time_cyc2time(struct mlx5_clock *clock, ...@@ -105,4 +105,15 @@ static inline ktime_t mlx5_real_time_cyc2time(struct mlx5_clock *clock,
} }
#endif #endif
static inline cqe_ts_to_ns mlx5_rq_ts_translator(struct mlx5_core_dev *mdev)
{
return mlx5_is_real_time_rq(mdev) ? mlx5_real_time_cyc2time :
mlx5_timecounter_cyc2time;
}
static inline cqe_ts_to_ns mlx5_sq_ts_translator(struct mlx5_core_dev *mdev)
{
return mlx5_is_real_time_sq(mdev) ? mlx5_real_time_cyc2time :
mlx5_timecounter_cyc2time;
}
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment