RTE_ETH_QUEUE_STATE_STARTED;
}
+ if (dev->data->dev_conf.rxmode.offloads &
+ RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
+ if (iavf_get_phc_time(rxq)) {
+ PMD_DRV_LOG(ERR, "get physical time failed");
+ return err;
+ }
+ rxq->hw_time_update = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
+ }
+
return err;
}
uint64_t dma_addr;
uint64_t pkt_flags;
const uint32_t *ptype_tbl;
+ uint64_t ts_ns;
nb_rx = 0;
nb_hold = 0;
rx_ring = rxq->rx_ring;
ptype_tbl = rxq->vsi->adapter->ptype_tbl;
- struct iavf_adapter *ad = rxq->vsi->adapter;
- uint64_t ts_ns;
-
if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
uint64_t sw_cur_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
- if (sw_cur_time - ad->hw_time_update > 4) {
- if (iavf_get_phc_time(ad))
+
+ if (sw_cur_time - rxq->hw_time_update > 4) {
+ if (iavf_get_phc_time(rxq))
PMD_DRV_LOG(ERR, "get physical time failed");
- ad->hw_time_update = sw_cur_time;
+ rxq->hw_time_update = sw_cur_time;
}
}
pkt_flags = iavf_flex_rxd_error_to_pkt_flags(rx_stat_err0);
if (iavf_timestamp_dynflag > 0) {
- ts_ns = iavf_tstamp_convert_32b_64b(ad->phc_time,
+ ts_ns = iavf_tstamp_convert_32b_64b(rxq->phc_time,
rte_le_to_cpu_32(rxd.wb.flex_ts.ts_high));
- ad->phc_time = ts_ns;
- ad->hw_time_update = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
+ rxq->phc_time = ts_ns;
+ rxq->hw_time_update = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
*RTE_MBUF_DYNFIELD(rxm,
iavf_timestamp_dynfield_offset,
uint16_t rx_stat_err0;
uint64_t dma_addr;
uint64_t pkt_flags;
- struct iavf_adapter *ad = rxq->vsi->adapter;
uint64_t ts_ns;
volatile union iavf_rx_desc *rx_ring = rxq->rx_ring;
if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
uint64_t sw_cur_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
- if (sw_cur_time - ad->hw_time_update > 4) {
- if (iavf_get_phc_time(ad))
+
+ if (sw_cur_time - rxq->hw_time_update > 4) {
+ if (iavf_get_phc_time(rxq))
PMD_DRV_LOG(ERR, "get physical time failed");
- ad->hw_time_update = sw_cur_time;
+ rxq->hw_time_update = sw_cur_time;
}
}
pkt_flags = iavf_flex_rxd_error_to_pkt_flags(rx_stat_err0);
if (iavf_timestamp_dynflag > 0) {
- ts_ns = iavf_tstamp_convert_32b_64b(ad->phc_time,
+ ts_ns = iavf_tstamp_convert_32b_64b(rxq->phc_time,
rte_le_to_cpu_32(rxd.wb.flex_ts.ts_high));
- ad->phc_time = ts_ns;
- ad->hw_time_update = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
+ rxq->phc_time = ts_ns;
+ rxq->hw_time_update = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
*RTE_MBUF_DYNFIELD(first_seg,
iavf_timestamp_dynfield_offset,
int32_t nb_staged = 0;
uint64_t pkt_flags;
const uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl;
- struct iavf_adapter *ad = rxq->vsi->adapter;
uint64_t ts_ns;
rxdp = (volatile union iavf_rx_flex_desc *)&rxq->rx_ring[rxq->rx_tail];
if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) {
uint64_t sw_cur_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
- if (sw_cur_time - ad->hw_time_update > 4) {
- if (iavf_get_phc_time(ad))
+
+ if (sw_cur_time - rxq->hw_time_update > 4) {
+ if (iavf_get_phc_time(rxq))
PMD_DRV_LOG(ERR, "get physical time failed");
- ad->hw_time_update = sw_cur_time;
+ rxq->hw_time_update = sw_cur_time;
}
}
pkt_flags = iavf_flex_rxd_error_to_pkt_flags(stat_err0);
if (iavf_timestamp_dynflag > 0) {
- ts_ns = iavf_tstamp_convert_32b_64b(ad->phc_time,
+ ts_ns = iavf_tstamp_convert_32b_64b(rxq->phc_time,
rte_le_to_cpu_32(rxdp[j].wb.flex_ts.ts_high));
- ad->phc_time = ts_ns;
- ad->hw_time_update = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000);
+ rxq->phc_time = ts_ns;
+ rxq->hw_time_update = rte_get_timer_cycles() /
+ (rte_get_timer_hz() / 1000);
*RTE_MBUF_DYNFIELD(mb,
iavf_timestamp_dynfield_offset,
}
int
-iavf_get_phc_time(struct iavf_adapter *adapter)
+iavf_get_phc_time(struct iavf_rx_queue *rxq)
{
+ struct iavf_adapter *adapter = rxq->vsi->adapter;
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
struct virtchnl_phc_time phc_time;
struct iavf_cmd_info args;
- int err;
+ int err = 0;
args.ops = VIRTCHNL_OP_1588_PTP_GET_TIME;
args.in_args = (uint8_t *)&phc_time;
args.out_buffer = vf->aq_resp;
args.out_size = IAVF_AQ_BUF_SZ;
+ rte_spinlock_lock(&vf->phc_time_aq_lock);
err = iavf_execute_vf_cmd(adapter, &args, 0);
if (err) {
PMD_DRV_LOG(ERR,
"Failed to execute command of VIRTCHNL_OP_1588_PTP_GET_TIME");
- return err;
+ goto out;
}
+ rxq->phc_time = ((struct virtchnl_phc_time *)args.out_buffer)->time;
- adapter->phc_time = ((struct virtchnl_phc_time *)args.out_buffer)->time;
-
- return 0;
+out:
+ rte_spinlock_unlock(&vf->phc_time_aq_lock);
+ return err;
}