aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2024-05-21 19:18:32 +0000
committerMark Johnston <markj@FreeBSD.org>2024-08-08 15:58:12 +0000
commit59a9c20d7736d41be22791ec9a797cc535734ace (patch)
tree33cb82567d46629cb00203c634fceb450e7d9eed
parent053500aa93017f8d8096a9625491ae1e335a356e (diff)
downloadsrc-59a9c20d7736d41be22791ec9a797cc535734ace.tar.gz
src-59a9c20d7736d41be22791ec9a797cc535734ace.zip
cxgbe: Flush transmitted packets more regularly in netmap mode
Previously, when transmitting short runs of packets via cxgbe_nm_tx(), we would wait until a large number of packets were buffered before scheduling a task to clean transmit buffers. Obtained from: np (cherry picked from commit 6af3d59962449c66688361598163dd174cc5fb2a)
-rw-r--r--sys/dev/cxgbe/t4_netmap.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c
index 581094735c36..b60c1a88168c 100644
--- a/sys/dev/cxgbe/t4_netmap.c
+++ b/sys/dev/cxgbe/t4_netmap.c
@@ -1025,29 +1025,28 @@ cxgbe_nm_tx(struct adapter *sc, struct sge_nm_txq *nm_txq,
nm_txq->pidx = 0;
}
- if (npkt == 0 && npkt_remaining == 0) {
+ if (npkt + npkt_remaining == 0) {
/* All done. */
- if (lazy_tx_credit_flush == 0) {
+ if (lazy_tx_credit_flush == 0 ||
+ NMIDXDIFF(nm_txq, equiqidx) >= nm_txq->sidx / 2) {
wr->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ |
F_FW_WR_EQUIQ);
nm_txq->equeqidx = nm_txq->pidx;
nm_txq->equiqidx = nm_txq->pidx;
+ } else if (NMIDXDIFF(nm_txq, equeqidx) >= 64) {
+ wr->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ);
+ nm_txq->equeqidx = nm_txq->pidx;
}
ring_nm_txq_db(sc, nm_txq);
return;
}
-
- if (NMIDXDIFF(nm_txq, equiqidx) >= nm_txq->sidx / 2) {
- wr->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ |
- F_FW_WR_EQUIQ);
- nm_txq->equeqidx = nm_txq->pidx;
- nm_txq->equiqidx = nm_txq->pidx;
- } else if (NMIDXDIFF(nm_txq, equeqidx) >= 64) {
- wr->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ);
- nm_txq->equeqidx = nm_txq->pidx;
- }
- if (NMIDXDIFF(nm_txq, dbidx) >= 2 * SGE_MAX_WR_NDESC)
+ if (NMIDXDIFF(nm_txq, dbidx) >= 2 * SGE_MAX_WR_NDESC) {
+ if (NMIDXDIFF(nm_txq, equeqidx) >= 64) {
+ wr->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ);
+ nm_txq->equeqidx = nm_txq->pidx;
+ }
ring_nm_txq_db(sc, nm_txq);
+ }
}
/* Will get called again. */