Date: Mon, 20 Aug 2007 07:07:16 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 125393 for review Message-ID: <200708200707.l7K77GNQ069360@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=125393 Change 125393 by kmacy@kmacy_home:ethng on 2007/08/20 07:06:25 - make KASSERT for cpuid == curcpu only compile in for STRICT_AFFINITY - add sysctl information for txq ring stats - split sysctl into 2 parts attach time and post-initialization - fix tx cleaning bug whereby in_use would go negative causing the queue to stall permanently Affected files ... .. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_adapter.h#9 edit .. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_main.c#12 edit .. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_multiq.c#9 edit .. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_sge.c#11 edit Differences ... ==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_adapter.h#9 (text+ko) ==== @@ -127,10 +127,12 @@ struct task timer_reclaim_task; struct cdev *port_cdev; +#define PORT_LOCK_NAME_LEN 32 +#define TASKQ_NAME_LEN 32 #define PORT_NAME_LEN 32 -#define TASKQ_NAME_LEN 32 - char lockbuf[PORT_NAME_LEN]; + char lockbuf[PORT_LOCK_NAME_LEN]; char taskqbuf[TASKQ_NAME_LEN]; + char namebuf[PORT_NAME_LEN]; }; enum { /* adapter flags */ @@ -304,6 +306,8 @@ int idx; /* qset # */ int qs_cpuid; int qs_flags; +#define QS_NAME_LEN 32 + char namebuf[QS_NAME_LEN]; }; struct sge { @@ -529,7 +533,8 @@ void t3_rx_eth(struct port_info *p, struct sge_rspq *rq, struct mbuf *m, int ethpad); void t3_lro_flush(adapter_t *adap, struct sge_qset *qs, struct lro_state *state); -void t3_add_sysctls(adapter_t *sc); +void t3_add_attach_sysctls(adapter_t *sc); +void t3_add_configured_sysctls(adapter_t *sc); int t3_get_desc(const struct sge_qset *qs, unsigned int qnum, unsigned int idx, unsigned char *data); void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p); ==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_main.c#12 (text+ko) ==== @@ -600,7 +600,7 @@ G_FW_VERSION_MAJOR(vers), G_FW_VERSION_MINOR(vers), G_FW_VERSION_MICRO(vers)); - t3_add_sysctls(sc); + t3_add_attach_sysctls(sc); out: if (error) cxgb_free(sc); @@ -1565,6 +1565,7 @@ alloc_filters(sc); setup_rss(sc); + t3_add_configured_sysctls(sc); sc->flags |= FULL_INIT_DONE; } ==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_multiq.c#9 (text+ko) ==== @@ -410,8 +410,8 @@ m_freem_vec(m_vec[i]); j++; - txq->cleaned += reclaimed; - txq->in_use -= reclaimed; + txq->cleaned += reclaimable; + txq->in_use -= reclaimable; if (isset(&qs->txq_stopped, TXQ_ETH)) clrbit(&qs->txq_stopped, TXQ_ETH); reclaimable = desc_reclaimable(txq); @@ -582,6 +582,7 @@ struct sge_qset *qs = arg; struct thread *td; struct adapter *sc = qs->port->adapter; + struct sge_txq *txq = &qs->txq[TXQ_ETH]; int err = 0; td = curthread; @@ -599,9 +600,9 @@ if (qs->qs_flags & QS_EXITING) break; - if (mtx_trylock(&qs->txq[TXQ_ETH].lock)) { + if (mtx_trylock(&txq->lock)) { err = cxgb_pcpu_start_(qs, NULL, TRUE); - mtx_unlock(&qs->txq[TXQ_ETH].lock); + mtx_unlock(&txq->lock); } else err = EINPROGRESS; @@ -615,13 +616,13 @@ mtx_unlock(&qs->rspq.lock); } - if ((!mbufq_empty(&qs->txq[TXQ_ETH].sendq) || - (qs->txq[TXQ_ETH].txq_mr.mr_cons != qs->txq[TXQ_ETH].txq_mr.mr_prod)) && + if ((!mbufq_empty(&txq->sendq) || + (txq->txq_mr.mr_cons != txq->txq_mr.mr_prod)) && err == 0) { if (cxgb_debug) printf("head=%p cons=%d prod=%d\n", - qs->txq[TXQ_ETH].sendq.head, qs->txq[TXQ_ETH].txq_mr.mr_cons, - qs->txq[TXQ_ETH].txq_mr.mr_prod); + txq->sendq.head, txq->txq_mr.mr_cons, + txq->txq_mr.mr_prod); continue; } tsleep(qs, 1, "cxgbidle", sleep_ticks); ==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_sge.c#11 (text+ko) ==== @@ -1197,7 +1197,7 @@ struct tx_desc *txd; struct cpl_tx_pkt *cpl; -#ifdef IFNET_MULTIQUEUE +#if defined(IFNET_MULTIQUEUE) && defined(STRICT_AFFINITY) KASSERT(qs->qs_cpuid == curcpu, ("cpu qset mismatch cpuid=%d curcpu=%d", qs->qs_cpuid, curcpu)); #endif DPRINTF("t3_encap cpu=%d ", curcpu); @@ -2720,11 +2720,11 @@ void -t3_add_sysctls(adapter_t *sc) +t3_add_attach_sysctls(adapter_t *sc) { struct sysctl_ctx_list *ctx; struct sysctl_oid_list *children; - + ctx = device_get_sysctl_ctx(sc->dev); children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)); @@ -2740,11 +2740,6 @@ 0, t3_lro_enable, "I", "enable large receive offload"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, - "intr_coal", - CTLTYPE_INT|CTLFLAG_RW, sc, - 0, t3_set_coalesce_nsecs, - "I", "interrupt coalescing timer (ns)"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "enable_debug", CTLFLAG_RW, &cxgb_debug, @@ -2770,8 +2765,76 @@ "bogus_imm", CTLFLAG_RD, &bogus_imm, 0, "#times a bogus immediate response was seen"); + } +void +t3_add_configured_sysctls(adapter_t *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *children; + int i, j; + + ctx = device_get_sysctl_ctx(sc->dev); + children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, + "intr_coal", + CTLTYPE_INT|CTLFLAG_RW, sc, + 0, t3_set_coalesce_nsecs, + "I", "interrupt coalescing timer (ns)"); + + for (i = 0; i < sc->params.nports; i++) { + struct port_info *pi = &sc->port[i]; + struct sysctl_oid *poid; + struct sysctl_oid_list *poidlist; + + snprintf(pi->namebuf, PORT_NAME_LEN, "port%d", i); + poid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, + pi->namebuf, CTLFLAG_RD, NULL, "port statistics"); + poidlist = SYSCTL_CHILDREN(poid); + SYSCTL_ADD_INT(ctx, poidlist, OID_AUTO, + "nqsets", CTLFLAG_RD, &pi->nqsets, + 0, "#queue sets"); + + for (j = 0; j < pi->nqsets; j++) { + struct sge_qset *qs = &sc->sge.qs[pi->first_qset + j]; + struct sysctl_oid *qspoid; + struct sysctl_oid_list *qspoidlist; + struct sge_txq *txq = &qs->txq[TXQ_ETH]; + + snprintf(qs->namebuf, QS_NAME_LEN, "qs%d", j); + + qspoid = SYSCTL_ADD_NODE(ctx, poidlist, OID_AUTO, + qs->namebuf, CTLFLAG_RD, NULL, "qset statistics"); + qspoidlist = SYSCTL_CHILDREN(qspoid); + + SYSCTL_ADD_INT(ctx, qspoidlist, OID_AUTO, "dropped", + CTLFLAG_RD, &qs->txq[TXQ_ETH].txq_drops, + 0, "#tunneled packets dropped"); + SYSCTL_ADD_INT(ctx, qspoidlist, OID_AUTO, "sendqlen", + CTLFLAG_RD, &qs->txq[TXQ_ETH].sendq.qlen, + 0, "#tunneled packets waiting to be sent"); + SYSCTL_ADD_UINT(ctx, qspoidlist, OID_AUTO, "queue_pidx", + CTLFLAG_RD, (uint32_t *)(uintptr_t)&qs->txq[TXQ_ETH].txq_mr.mr_prod, + 0, "#tunneled packets queue producer index"); + SYSCTL_ADD_UINT(ctx, qspoidlist, OID_AUTO, "queue_cidx", + CTLFLAG_RD, (uint32_t *)(uintptr_t)&qs->txq[TXQ_ETH].txq_mr.mr_cons, + 0, "#tunneled packets queue consumer index"); + SYSCTL_ADD_INT(ctx, qspoidlist, OID_AUTO, "processed", + CTLFLAG_RD, &qs->txq[TXQ_ETH].processed, + 0, "#tunneled packets processed by the card"); + SYSCTL_ADD_UINT(ctx, qspoidlist, OID_AUTO, "cleaned", + CTLFLAG_RD, &txq->cleaned, + 0, "#tunneled packets cleaned"); + SYSCTL_ADD_UINT(ctx, qspoidlist, OID_AUTO, "in_use", + CTLFLAG_RD, &txq->in_use, + 0, "#tunneled packet slots in use"); + + } + } +} + /** * t3_get_desc - dump an SGE descriptor for debugging purposes * @qs: the queue set
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708200707.l7K77GNQ069360>