Skip to contentSkip to conversation

net/intel: fix wrap-around check in simple Tx scalar path

PATCH In review Bruce Richardson 3 participants 4 messages Feb 26 – Mar 2 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/intel: fix wrap-around check in simple Tx scalar path

There was an error condition when the burst of packets being transmitted ended exactly on the last descriptor of the ring. In that instance alone, we ended up writing an invalid tx_tail value to the hardware, of ring_size rather than of zero. Add an explicit check for this case to the simple Tx path code.

Fixes 9bacf6a81b92 ("net/intel: align scalar simple Tx path with vector logic")
---
 drivers/net/intel/common/tx_scalar.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/intel/common/tx_scalar.h +2 -0
index 4475995180..9fcd2e4733 100644
@@ -145,6 +145,8 @@ ci_xmit_burst_simple(struct ci_tx_queue *txq,
 		if (txq->tx_next_rs >= txq->nb_tx_desc)
 			txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
 	}
+	if (tx_id == txq->nb_tx_desc)
+		tx_id = 0;
 
 	txq->tx_tail = tx_id;
 
Signature · 1 line
2.51.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Bruce Richardson

There was an error condition when the burst of packets being transmitted ended exactly on the last descriptor of the ring. In that instance alone, we ended up writing an invalid tx_tail value to the hardware, of ring_size rather than of zero. Add an explicit check for this case to the simple Tx path code.

Fixes 9bacf6a81b92 ("net/intel: align scalar simple Tx path with vector logic")

---

Signature · 2 lines
Thanks,
Anatoly
author Applied
#2 lore raw
Quoted 7 lines · Anatoly
Quoted 6 lines · Bruce Richardson

There was an error condition when the burst of packets being transmitted ended exactly on the last descriptor of the ring. In that instance alone, we ended up writing an invalid tx_tail value to the hardware, of ring_size rather than of zero. Add an explicit check for this case to the simple Tx path code.

Quoted 7 lines
Quoted 4 lines
Fixes 9bacf6a81b92 ("net/intel: align scalar simple Tx path with vector logic")

---

Applied to next-net-intel.

/Bruce

Acked-by on v1 1/1
#3 lore raw
In reply to Bruce Richardson
Quoted 26 lines · Bruce Richardson

There was an error condition when the burst of packets being transmitted ended exactly on the last descriptor of the ring. In that instance alone, we ended up writing an invalid tx_tail value to the hardware, of ring_size rather than of zero. Add an explicit check for this case to the simple Tx path code.

Fixes 9bacf6a81b92 ("net/intel: align scalar simple Tx path with vector logic")
---
  drivers/net/intel/common/tx_scalar.h | 2 ++
  1 file changed, 2 insertions(+)
drivers/net/intel/common/tx_scalar.h +2 -0
index 4475995180..9fcd2e4733 100644
@@ -145,6 +145,8 @@ ci_xmit_burst_simple(struct ci_tx_queue *txq,
  		if (txq->tx_next_rs >= txq->nb_tx_desc)
  			txq->tx_next_rs = (uint16_t)(txq->tx_rs_thresh - 1);
  	}
+	if (tx_id == txq->nb_tx_desc)
+		tx_id = 0;
 
  	txq->tx_tail = tx_id;
 
Signature · 2 lines
Regards,
Vladimir