Author: np
Date: Tue Sep 29 07:51:06 2020
New Revision: 366245
URL: https://svnweb.freebsd.org/changeset/base/366245

Log:
  cxgbe(4): adjust the doorbell threshold for netmap freelists to match the
  maximum burst size used when fetching descriptors from the list.
  
  MFC after:    1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/t4_netmap.c

Modified: head/sys/dev/cxgbe/adapter.h
==============================================================================
--- head/sys/dev/cxgbe/adapter.h        Tue Sep 29 07:36:21 2020        
(r366244)
+++ head/sys/dev/cxgbe/adapter.h        Tue Sep 29 07:51:06 2020        
(r366245)
@@ -730,6 +730,7 @@ struct sge_nm_rxq {
        uint32_t fl_sidx2;      /* copy of fl_sidx */
        uint32_t fl_db_val;
        u_int fl_db_saved;
+       u_int fl_db_threshold;  /* in descriptors */
        u_int fl_hwidx:4;
 
        /*

Modified: head/sys/dev/cxgbe/t4_netmap.c
==============================================================================
--- head/sys/dev/cxgbe/t4_netmap.c      Tue Sep 29 07:36:21 2020        
(r366244)
+++ head/sys/dev/cxgbe/t4_netmap.c      Tue Sep 29 07:51:06 2020        
(r366245)
@@ -196,6 +196,9 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq
 
        nm_rxq->fl_cntxt_id = be16toh(c.fl0id);
        nm_rxq->fl_pidx = nm_rxq->fl_cidx = 0;
+       nm_rxq->fl_db_saved = 0;
+       /* matches the X_FETCHBURSTMAX_512B or X_FETCHBURSTMAX_256B above. */
+       nm_rxq->fl_db_threshold = chip_id(sc) <= CHELSIO_T5 ? 8 : 4;
        MPASS(nm_rxq->fl_sidx == na->num_rx_desc);
        cntxt_id = nm_rxq->fl_cntxt_id - sc->sge.eq_start;
        if (cntxt_id >= sc->sge.neq) {
@@ -1063,7 +1066,7 @@ cxgbe_netmap_rxsync(struct netmap_kring *kring, int fl
                                fl_pidx = 0;
                                slot = &ring->slot[0];
                        }
-                       if (++dbinc == 8 && n >= 32) {
+                       if (++dbinc == nm_rxq->fl_db_threshold) {
                                wmb();
                                if (starve_fl)
                                        nm_rxq->fl_db_saved += dbinc;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to