Author: np
Date: Sat Jun  4 23:31:33 2011
New Revision: 222701
URL: http://svn.freebsd.org/changeset/base/222701

Log:
  Allow lazy fill up of freelists.
  
  MFC after:    3 days

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

Modified: head/sys/dev/cxgbe/adapter.h
==============================================================================
--- head/sys/dev/cxgbe/adapter.h        Sat Jun  4 22:51:06 2011        
(r222700)
+++ head/sys/dev/cxgbe/adapter.h        Sat Jun  4 23:31:33 2011        
(r222701)
@@ -396,6 +396,7 @@ struct sge_ctrlq {
 struct sge {
        uint16_t timer_val[SGE_NTIMERS];
        uint8_t  counter_val[SGE_NCOUNTERS];
+       int fl_starve_threshold;
 
        int nrxq;       /* total rx queues (all ports and the rest) */
        int ntxq;       /* total tx queues (all ports and the rest) */

Modified: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c Sat Jun  4 22:51:06 2011        (r222700)
+++ head/sys/dev/cxgbe/t4_sge.c Sat Jun  4 23:31:33 2011        (r222701)
@@ -203,6 +203,9 @@ t4_sge_init(struct adapter *sc)
                    FL_BUF_SIZE(i));
        }
 
+       i = t4_read_reg(sc, A_SGE_CONM_CTRL);
+       s->fl_starve_threshold = G_EGRTHRESHOLD(i) * 2 + 1;
+
        t4_write_reg(sc, A_SGE_INGRESS_RX_THRESHOLD,
                     V_THRESHOLD_0(s->counter_val[0]) |
                     V_THRESHOLD_1(s->counter_val[1]) |
@@ -1233,7 +1236,8 @@ alloc_iq_fl(struct port_info *pi, struct
                sc->sge.eqmap[cntxt_id] = (void *)fl;
 
                FL_LOCK(fl);
-               refill_fl(sc, fl, -1, 8);
+               /* Just enough to make sure it doesn't starve right away. */
+               refill_fl(sc, fl, roundup(sc->sge.fl_starve_threshold, 8), 8);
                FL_UNLOCK(fl);
        }
 
@@ -1389,6 +1393,10 @@ alloc_rxq(struct port_info *pi, struct s
        if (rc != 0)
                return (rc);
 
+       FL_LOCK(&rxq->fl);
+       refill_fl(pi->adapter, &rxq->fl, rxq->fl.needed / 8, 8);
+       FL_UNLOCK(&rxq->fl);
+
 #ifdef INET
        rc = tcp_lro_init(&rxq->lro);
        if (rc != 0)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to