Skip to content

Commit

Permalink
net/ice: adjust timestamp mbuf register
Browse files Browse the repository at this point in the history
[ upstream commit b16e1326048ea0c138cf794186985bb95eb7ff20 ]

Due to only support timestamp at port level, adjust
timestamp mbuf register to dev config.

Fixes: 953e74e ("net/ice: enable Rx timestamp on flex descriptor")

Signed-off-by: Wenjing Qiao <wenjing.qiao@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
  • Loading branch information
Qiao-Intel authored and kevintraynor committed Jul 11, 2023
1 parent f420162 commit 285bc0e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions drivers/net/ice/ice_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3561,6 +3561,16 @@ ice_dev_start(struct rte_eth_dev *dev)
}
}

if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
/* Register mbuf field and flag for Rx timestamp */
ret = rte_mbuf_dyn_rx_timestamp_register(&ice_timestamp_dynfield_offset,
&ice_timestamp_dynflag);
if (ret) {
PMD_DRV_LOG(ERR, "Cannot register mbuf field/flag for timestamp");
goto tx_err;
}
}

/* program Rx queues' context in hardware*/
for (nb_rxq = 0; nb_rxq < data->nb_rx_queues; nb_rxq++) {
ret = ice_rx_queue_start(dev, nb_rxq);
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/ice/ice_rxtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)
return -EINVAL;
}

if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
if (!rxq->ts_enable && (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP)) {
/* Register mbuf field and flag for Rx timestamp */
err = rte_mbuf_dyn_rx_timestamp_register(
&ice_timestamp_dynfield_offset,
Expand All @@ -308,6 +308,7 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)
"Cannot register mbuf field/flag for timestamp");
return -EINVAL;
}
rxq->ts_enable = true;
}

memset(&rx_ctx, 0, sizeof(rx_ctx));
Expand Down Expand Up @@ -593,6 +594,8 @@ ice_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
return -EINVAL;
}

if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP)
rxq->ts_enable = true;
err = ice_program_hw_rx_queue(rxq);
if (err) {
PMD_DRV_LOG(ERR, "fail to program RX queue %u",
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ice/ice_rxtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ struct ice_rx_queue {
uint32_t hw_time_high; /* high 32 bits of timestamp */
uint32_t hw_time_low; /* low 32 bits of timestamp */
uint64_t hw_time_update; /* SW time of HW record updating */
bool ts_enable; /* if rxq timestamp is enabled */
};

struct ice_tx_entry {
Expand Down

0 comments on commit 285bc0e

Please sign in to comment.