Skip to contentSkip to conversation

ice: fix Tx queue iteration for Tx timestamp enablement

PATCH New Jacob Keller 1 participant 1 message Jun 29, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice: fix Tx queue iteration for Tx timestamp enablement

The driver accidentally copied the ice_for_each_rxq iterator when implementing enablement of the ptp_tx bit for the Tx rings. We still load the Tx rings and set the ptp_tx field, but we iterate over the count of the num_rxq.

If the number of Tx and Rx queues differ, this could either cause a buffer overrun when accessing the tx_rings list if num_txq is greater than num_rxq, or it could cause us to fail to enable Tx timestamps for some rings.

This was not noticed originally as we generally have the same number of Tx and Rx queues.

---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_ptp.c +1 -1
index 5d5207b56ca9..e176c7484484 100644
@@ -22,7 +22,7 @@ static void ice_set_tx_tstamp(struct ice_pf *pf, bool on)
 		return;
 
 	/* Set the timestamp enable flag for all the Tx rings */
-	ice_for_each_rxq(vsi, i) {
+	ice_for_each_txq(vsi, i) {
 		if (!vsi->tx_rings[i])
 			continue;
 		vsi->tx_rings[i]->ptp_tx = on;

base-commit: fff3ea006287fec848383b6144935cba5ded41a6

Signature · 3 lines
This is a bug fix for the PTP patches that recently merged into net-next.

2.31.1.331.gb0c09ab8796f