aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorHariprasad Shenai <hariprasad@chelsio.com>2015-04-14 16:32:31 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-14 15:08:51 -0400
commitc098b026f075ea34f70d669a84c71cc55fdeb37c (patch)
treef7182bba0ae7c3a5e28fb667c1f7252fc4a31840 /drivers/net
parent21dcfad6401b008e7352eb95104c7f199f025ac9 (diff)
cxgb4: Freelist starving threshold varies from adapter to adapter
fl_starv_thres could be different from adapter to adapter, don't use hardcoded values Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/sge.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index 900c642136a7..e0cfce88890f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -121,12 +121,6 @@
121#define NOMEM_TMR_IDX (SGE_NTIMERS - 1) 121#define NOMEM_TMR_IDX (SGE_NTIMERS - 1)
122 122
123/* 123/*
124 * An FL with <= FL_STARVE_THRES buffers is starving and a periodic timer will
125 * attempt to refill it.
126 */
127#define FL_STARVE_THRES 4
128
129/*
130 * Suspend an Ethernet Tx queue with fewer available descriptors than this. 124 * Suspend an Ethernet Tx queue with fewer available descriptors than this.
131 * This is the same as calc_tx_descs() for a TSO packet with 125 * This is the same as calc_tx_descs() for a TSO packet with
132 * nr_frags == MAX_SKB_FRAGS. 126 * nr_frags == MAX_SKB_FRAGS.
@@ -248,9 +242,21 @@ static inline unsigned int fl_cap(const struct sge_fl *fl)
248 return fl->size - 8; /* 1 descriptor = 8 buffers */ 242 return fl->size - 8; /* 1 descriptor = 8 buffers */
249} 243}
250 244
251static inline bool fl_starving(const struct sge_fl *fl) 245/**
246 * fl_starving - return whether a Free List is starving.
247 * @adapter: pointer to the adapter
248 * @fl: the Free List
249 *
250 * Tests specified Free List to see whether the number of buffers
251 * available to the hardware has falled below our "starvation"
252 * threshold.
253 */
254static inline bool fl_starving(const struct adapter *adapter,
255 const struct sge_fl *fl)
252{ 256{
253 return fl->avail - fl->pend_cred <= FL_STARVE_THRES; 257 const struct sge *s = &adapter->sge;
258
259 return fl->avail - fl->pend_cred <= s->fl_starve_thres;
254} 260}
255 261
256static int map_skb(struct device *dev, const struct sk_buff *skb, 262static int map_skb(struct device *dev, const struct sk_buff *skb,
@@ -655,7 +661,7 @@ out: cred = q->avail - cred;
655 q->pend_cred += cred; 661 q->pend_cred += cred;
656 ring_fl_db(adap, q); 662 ring_fl_db(adap, q);
657 663
658 if (unlikely(fl_starving(q))) { 664 if (unlikely(fl_starving(adap, q))) {
659 smp_wmb(); 665 smp_wmb();
660 set_bit(q->cntxt_id - adap->sge.egr_start, 666 set_bit(q->cntxt_id - adap->sge.egr_start,
661 adap->sge.starving_fl); 667 adap->sge.starving_fl);
@@ -2248,7 +2254,7 @@ static void sge_rx_timer_cb(unsigned long data)
2248 clear_bit(id, s->starving_fl); 2254 clear_bit(id, s->starving_fl);
2249 smp_mb__after_atomic(); 2255 smp_mb__after_atomic();
2250 2256
2251 if (fl_starving(fl)) { 2257 if (fl_starving(adap, fl)) {
2252 rxq = container_of(fl, struct sge_eth_rxq, fl); 2258 rxq = container_of(fl, struct sge_eth_rxq, fl);
2253 if (napi_reschedule(&rxq->rspq.napi)) 2259 if (napi_reschedule(&rxq->rspq.napi))
2254 fl->starving++; 2260 fl->starving++;