Disabling a Tx time queue while packets are still waiting for their
launch time leaves the device Tx time engine stuck. Tx time
transmission then stays broken in later runs, even after a PF reset;
only a core reset recovers it. This is hit by stopping the port right
after transmitting, e.g. quitting testpmd during txonly forwarding.
Wait for the hardware to send the pending packets before disabling
the Tx time queue, bounded by the maximum Tx time horizon. In Tx time
mode the queue head stops on the last sent descriptor, so the queue
is drained once the head is at most one descriptor behind the tail.
Fixes: 0b6ff09a1f19 ("net/intel: support Tx packet pacing for E830")
Cc: [email protected]
Signed-off-by: Soumyadeep Hore <[email protected]>
---
drivers/net/intel/ice/ice_rxtx.c | 17 +++++++++++++++++
drivers/net/intel/ice/ice_rxtx.h | 3 +++
2 files changed, 20 insertions(+)
diff --git a/drivers/net/intel/ice/ice_rxtx.c b/drivers/net/intel/ice/ice_rxtx.c
index 4016e5f8d4..cacfdbadd5 100644
--- a/drivers/net/intel/ice/ice_rxtx.c
+++ b/drivers/net/intel/ice/ice_rxtx.c
@@ -1189,6 +1189,23 @@ ice_tx_queue_stop(struct rte_eth_dev *dev, uint16_t
tx_queue_id)
if (txq->tsq != NULL && txq->tsq->ts_flag > 0) {
struct ice_aqc_ena_dis_txtime_qgrp txtime_pg;
+ uint16_t head = 0, pending = 0;
+ uint32_t wait_us;
+
+ /* Disabling with launch times still pending wedges the Tx time
engine */
+ for (wait_us = 0; wait_us < ICE_TXTIME_DRAIN_TIMEOUT_US;
+ wait_us += ICE_TXTIME_DRAIN_POLL_US) {
+ head = (ICE_READ_REG(hw, QTX_COMM_HEAD(txq->reg_idx)) &
+ QTX_COMM_HEAD_HEAD_M) % txq->nb_tx_desc;
+ pending = (txq->tx_tail + txq->nb_tx_desc - head) %
txq->nb_tx_desc;
+ /* In Tx time mode the head stops on the last sent
descriptor */
+ if (pending <= 1)
+ break;
+ rte_delay_us(ICE_TXTIME_DRAIN_POLL_US);
+ }
+ if (wait_us >= ICE_TXTIME_DRAIN_TIMEOUT_US)
+ PMD_DRV_LOG(WARNING, "Tx queue %u: Tx time queue drain
timed out, %u descriptors pending",
+ tx_queue_id, pending);
status = ice_aq_ena_dis_txtimeq(hw, q_ids[0], 1, 0, &txtime_pg,
NULL);
if (status != ICE_SUCCESS) {
diff --git a/drivers/net/intel/ice/ice_rxtx.h b/drivers/net/intel/ice/ice_rxtx.h
index abbcee9fe0..150e147df5 100644
--- a/drivers/net/intel/ice/ice_rxtx.h
+++ b/drivers/net/intel/ice/ice_rxtx.h
@@ -37,6 +37,9 @@
#define ICE_TXTIME_TX_DESC_IDX_M RTE_GENMASK32(12, 0)
#define ICE_TXTIME_STAMP_M RTE_GENMASK32(31, 13)
+/* Longer than the 19-bit, 128 ns Tx time horizon (~67 ms) */
+#define ICE_TXTIME_DRAIN_TIMEOUT_US 100000
+#define ICE_TXTIME_DRAIN_POLL_US 100
#define ICE_REQ_DESC_MULTIPLE 32
#define ICE_RX_MAX_BURST CI_RX_MAX_BURST
--
2.43.0