PERFORCE change 126499 for review
Kip Macy
kmacy at FreeBSD.org
Sun Sep 16 20:33:12 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=126499
Change 126499 by kmacy at kmacy_home:ethng on 2007/09/17 03:32:38
add refill_fl_lt to refill if the free list has gone below a certain count
convert p -> pi for port_info pointers
Affected files ...
.. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_sge.c#21 edit
Differences ...
==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_sge.c#21 (text+ko) ====
@@ -135,6 +135,7 @@
struct tx_sw_desc { /* SW state per Tx descriptor */
struct mbuf *m[TX_WR_COUNT_MAX];
+
int count;
bus_dmamap_t map;
int flags;
@@ -640,11 +641,17 @@
refill_fl(adap, fl, min(16U, fl->size - fl->credits));
}
+static __inline void
+__refill_fl_lt(adapter_t *adap, struct sge_fl *fl, int max)
+{
+ if ((fl->size - fl->credits) < max)
+ refill_fl(adap, fl, min(max, fl->size - fl->credits));
+}
+
void
refill_fl_service(adapter_t *adap, struct sge_fl *fl)
{
- return; /* XXX no-op for now */
- __refill_fl(adap, fl);
+ __refill_fl_lt(adap, fl, 512);
}
#ifndef DISABLE_MBUF_IOVEC
@@ -778,7 +785,7 @@
{
adapter_t *sc = arg;
#ifndef IFNET_MULTIQUEUE
- struct port_info *p;
+ struct port_info *pi;
struct sge_qset *qs;
struct sge_txq *txq;
int i, j;
@@ -794,7 +801,7 @@
(qs->fl[1].credits < qs->fl[1].size));
if (reclaim_eth || reclaim_ofl || refill_rx) {
p = &sc->port[i];
- taskqueue_enqueue(p->tq, &p->timer_reclaim_task);
+ taskqueue_enqueue(pi->tq, &pi->timer_reclaim_task);
break;
}
}
@@ -829,9 +836,9 @@
}
int
-t3_sge_init_port(struct port_info *p)
+t3_sge_init_port(struct port_info *pi)
{
- TASK_INIT(&p->timer_reclaim_task, 0, sge_timer_reclaim, p);
+ TASK_INIT(&pi->timer_reclaim_task, 0, sge_timer_reclaim, pi);
return (0);
}
@@ -871,9 +878,9 @@
{
int reclaimable, i, n;
struct mbuf *m_vec[TX_CLEAN_MAX_DESC];
- struct port_info *p;
+ struct port_info *pi;
- p = txq->port;
+ pi = txq->port;
reclaim_more:
n = 0;
reclaimable = desc_reclaimable(txq);
@@ -887,11 +894,11 @@
for (i = 0; i < n; i++) {
m_freem_vec(m_vec[i]);
}
- if (p && p->ifp->if_drv_flags & IFF_DRV_OACTIVE &&
+ if (pi && pi->ifp->if_drv_flags & IFF_DRV_OACTIVE &&
txq->size - txq->in_use >= TX_START_MAX_DESC) {
txq_fills++;
- p->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
- taskqueue_enqueue(p->tq, &p->start_task);
+ pi->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+ taskqueue_enqueue(pi->tq, &pi->start_task);
}
if (n)
@@ -909,9 +916,9 @@
static void
sge_timer_reclaim(void *arg, int ncount)
{
- struct port_info *p = arg;
- int i, nqsets = p->nqsets;
- adapter_t *sc = p->adapter;
+ struct port_info *pi = arg;
+ int i, nqsets = pi->nqsets;
+ adapter_t *sc = pi->adapter;
struct sge_qset *qs;
struct sge_txq *txq;
struct mtx *lock;
@@ -1250,7 +1257,6 @@
#define GET_VTAG(cntrl, m)
#endif
-
int
t3_encap(struct sge_qset *qs, struct mbuf **m, int count, int *free)
{
@@ -1258,7 +1264,7 @@
struct mbuf *m0;
struct sge_txq *txq;
struct txq_state txqs;
- struct port_info *p;
+ struct port_info *pi;
unsigned int ndesc, flits, cntrl, mlen;
int err, nsegs, tso_info = 0;
@@ -1276,19 +1282,19 @@
#endif
DPRINTF("t3_encap cpu=%d ", curcpu);
- p = qs->port;
- sc = p->adapter;
+ pi = qs->port;
+ sc = pi->adapter;
txq = &qs->txq[TXQ_ETH];
txsd = &txq->sdesc[txq->pidx];
txd = &txq->desc[txq->pidx];
- DPRINTF("t3_encap port_id=%d qsidx=%d ", p->port_id, p->first_qset);
- DPRINTF("mlen=%d txpkt_intf=%d tx_chan=%d\n", m[0]->m_pkthdr.len, p->txpkt_intf, p->tx_chan);
+ DPRINTF("t3_encap port_id=%d qsidx=%d ", pi->port_id, pi->first_qset);
+ DPRINTF("mlen=%d txpkt_intf=%d tx_chan=%d\n", m[0]->m_pkthdr.len, pi->txpkt_intf, pi->tx_chan);
/*
* XXX handle checksum, TSO, and VLAN here
*
*/
- cntrl = V_TXPKT_INTF(p->txpkt_intf);
+ cntrl = V_TXPKT_INTF(pi->txpkt_intf);
/*
* XXX need to add VLAN support for 6.x
@@ -1311,7 +1317,7 @@
for (i = 0; i < count; i++) {
struct cpl_tx_pkt_batch_entry *cbe = &cpl_batch->pkt_entry[i];
- cntrl = V_TXPKT_INTF(p->port_id);
+ cntrl = V_TXPKT_INTF(pi->port_id);
GET_VTAG(cntrl, m[i]);
cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT) | (1 << 24);
cbe->cntrl = htonl(cntrl);
@@ -1390,7 +1396,6 @@
memcpy(&txd->flit[2], mtod(m0, uint8_t *), mlen);
else
m_copydata(m0, 0, mlen, (caddr_t)&txd->flit[2]);
-
*free = 1;
flits = (mlen + 7) / 8 + 2;
cpl->wr.wr_hi = htonl(V_WR_BCNTLFLT(mlen & 7) |
@@ -1429,7 +1434,7 @@
m_set_priority(m0, txqs.pidx);
write_wr_hdr_sgl(ndesc, txd, &txqs, txq, sgl, flits, sgl_flits, wr_hi, wr_lo);
- check_ring_tx_db(p->adapter, txq);
+ check_ring_tx_db(pi->adapter, txq);
return (0);
}
@@ -2778,10 +2783,10 @@
ngathered = rx_offload(&adap->tdev, rspq,
rspq->rspq_mh.mh_head, offload_mbufs, ngathered);
}
- __refill_fl(adap, &qs->fl[0]);
- __refill_fl(adap, &qs->fl[1]);
}
+ __refill_fl_lt(adap, &qs->fl[0], 32);
+ __refill_fl_lt(adap, &qs->fl[1], 32);
--budget_left;
}
@@ -2795,6 +2800,8 @@
if (__predict_false(qs->txq_stopped != 0))
restart_tx(qs);
+ __refill_fl_lt(adap, &qs->fl[0], 512);
+ __refill_fl_lt(adap, &qs->fl[1], 512);
budget -= budget_left;
return (budget);
}
More information about the p4-projects
mailing list