The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6af3d59962449c66688361598163dd174cc5fb2a

commit 6af3d59962449c66688361598163dd174cc5fb2a
Author:     Mark Johnston <[email protected]>
AuthorDate: 2024-05-21 19:18:32 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2024-07-15 15:26:59 +0000

    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
---
 sys/dev/cxgbe/t4_netmap.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c
index 0377f65acc3e..e53fb5054316 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. */

Reply via email to