PERFORCE change 124882 for review
Kip Macy
kmacy at FreeBSD.org
Wed Aug 8 01:02:53 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=124882
Change 124882 by kmacy at kmacy_home:ethng on 2007/08/08 08:01:57
fix build errors for IFNET_MULTIQUEUE case
Affected files ...
.. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_adapter.h#4 edit
.. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_main.c#7 edit
.. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_multiq.c#3 edit
.. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_sge.c#6 edit
Differences ...
==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_adapter.h#4 (text+ko) ====
@@ -31,7 +31,6 @@
***************************************************************************/
-
#ifndef _CXGB_ADAPTER_H_
#define _CXGB_ADAPTER_H_
@@ -577,7 +576,13 @@
int cxgb_pcpu_start(struct ifnet *ifp, int32_t cpuid, struct mbuf *m);
int32_t cxgb_pcpu_get_cookie(struct ifnet *ifp, struct in6_addr *lip, uint16_t lport,
struct in6_addr *rip, uint16_t rport, int ipv6);
+void cxgb_pcpu_shutdown_threads(struct adapter *sc);
+void cxgb_pcpu_startup_threads(struct adapter *sc);
+void cxgb_start(struct ifnet *ifp);
+struct mbuf *cxgb_dequeue_packet(struct ifnet *ifp, struct sge_txq *unused);
+#endif
+void t3_free_qset(adapter_t *sc, struct sge_qset *q);
+int cxgb_tx_common(struct ifnet *ifp, struct sge_qset *qs, uint32_t txmax);
#endif
-#endif
==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_main.c#7 (text+ko) ====
@@ -91,7 +91,6 @@
static void cxgb_stop_locked(struct port_info *);
static void cxgb_set_rxmode(struct port_info *);
static int cxgb_ioctl(struct ifnet *, unsigned long, caddr_t);
-static void cxgb_start(struct ifnet *);
static void cxgb_start_proc(void *, int ncount);
static int cxgb_media_change(struct ifnet *);
static void cxgb_media_status(struct ifnet *, struct ifmediareq *);
@@ -219,22 +218,7 @@
SYSCTL_UINT(_hw_cxgb, OID_AUTO, singleq, CTLFLAG_RDTUN, &singleq, 0,
"use a single queue-set per port");
-#ifdef IFNET_MULTIQUEUE
-static int cxgb_pcpu_tx_coalesce = 0;
-TUNABLE_INT("hw.cxgb.tx_coalesce", &cxgb_pcpu_tx_coalesce);
-SYSCTL_UINT(_hw_cxgb, OID_AUTO, tx_coalesce, CTLFLAG_RDTUN, &cxgb_pcpu_tx_coalesce, 0,
- "coalesce small packets into a single work request");
-
-static int sleep_ticks = 1;
-TUNABLE_INT("hw.cxgb.sleep_ticks", &sleep_ticks);
-SYSCTL_UINT(_hw_cxgb, OID_AUTO, sleep_ticks, CTLFLAG_RDTUN, &sleep_ticks, 0,
- "ticks to sleep between checking pcpu queues");
-
-int cxgb_txq_mbuf_ring_size = 2048;
-TUNABLE_INT("hw.cxgb.txq_mr_size", &cxgb_txq_mbuf_ring_size);
-SYSCTL_UINT(_hw_cxgb, OID_AUTO, txq_mr_size, CTLFLAG_RDTUN, &cxgb_txq_mbuf_ring_size, 0,
- "size of per-queue mbuf ring");
-#else
+#ifndef IFNET_MULTIQUEUE
int cxgb_txq_mbuf_ring_size = 0;
#endif
@@ -295,7 +279,6 @@
{0, 0, 0, NULL}
};
-
static int set_eeprom(struct port_info *pi, const uint8_t *data, int len, int offset);
static inline char
@@ -705,8 +688,6 @@
return;
}
-
-
static int
alloc_filters(struct adapter *adap)
{
@@ -1935,34 +1916,18 @@
return (error);
}
-static int
-cxgb_start_tx(struct ifnet *ifp, uint32_t txmax)
+int
+cxgb_tx_common(struct ifnet *ifp, struct sge_qset *qs, uint32_t txmax)
{
- struct sge_qset *qs;
struct sge_txq *txq;
- struct port_info *p = ifp->if_softc;
struct mbuf *m0, *m = NULL;
int err, in_use_init;
- if (!p->link_config.link_ok)
- return (ENXIO);
-
- if (IFQ_DRV_IS_EMPTY(&ifp->if_snd))
- return (ENOBUFS);
-
- qs = &p->adapter->sge.qs[p->first_qset];
txq = &qs->txq[TXQ_ETH];
- err = 0;
-
- if (txq->flags & TXQ_TRANSMITTING)
- return (EINPROGRESS);
-
- mtx_lock(&txq->lock);
- txq->flags |= TXQ_TRANSMITTING;
in_use_init = txq->in_use;
while ((txq->in_use - in_use_init < txmax) &&
(txq->size > txq->in_use + TX_MAX_DESC)) {
- IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
+ m = cxgb_dequeue_packet(ifp, txq);
if (m == NULL)
break;
/*
@@ -1996,9 +1961,7 @@
break;
BPF_MTAP(ifp, m);
}
- txq->flags &= ~TXQ_TRANSMITTING;
- mtx_unlock(&txq->lock);
-
+#ifdef IFNET_MULTIQUEUE
if (__predict_false(err)) {
if (err == ENOMEM) {
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
@@ -2014,6 +1977,37 @@
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
err = ENOSPC;
}
+#endif
+ return (err);
+}
+
+static int
+cxgb_start_tx(struct ifnet *ifp, uint32_t txmax)
+{
+ struct sge_qset *qs;
+ struct sge_txq *txq;
+ struct port_info *p = ifp->if_softc;
+ int err;
+
+ if (!p->link_config.link_ok)
+ return (ENXIO);
+
+ if (IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+ return (ENOBUFS);
+
+ qs = &p->adapter->sge.qs[p->first_qset];
+ txq = &qs->txq[TXQ_ETH];
+ err = 0;
+
+ if (txq->flags & TXQ_TRANSMITTING)
+ return (EINPROGRESS);
+
+ mtx_lock(&txq->lock);
+ txq->flags |= TXQ_TRANSMITTING;
+ cxgb_tx_common(ifp, qs, txmax);
+ txq->flags &= ~TXQ_TRANSMITTING;
+ mtx_unlock(&txq->lock);
+
return (err);
}
==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_multiq.c#3 (text+ko) ====
@@ -88,6 +88,23 @@
#include <dev/cxgb/cxgb_include.h>
#endif
+extern struct sysctl_oid_list sysctl__hw_cxgb_children;
+static int cxgb_pcpu_tx_coalesce = 0;
+TUNABLE_INT("hw.cxgb.tx_coalesce", &cxgb_pcpu_tx_coalesce);
+SYSCTL_UINT(_hw_cxgb, OID_AUTO, tx_coalesce, CTLFLAG_RDTUN, &cxgb_pcpu_tx_coalesce, 0,
+ "coalesce small packets into a single work request");
+
+static int sleep_ticks = 1;
+TUNABLE_INT("hw.cxgb.sleep_ticks", &sleep_ticks);
+SYSCTL_UINT(_hw_cxgb, OID_AUTO, sleep_ticks, CTLFLAG_RDTUN, &sleep_ticks, 0,
+ "ticks to sleep between checking pcpu queues");
+
+int cxgb_txq_mbuf_ring_size = 2048;
+TUNABLE_INT("hw.cxgb.txq_mr_size", &cxgb_txq_mbuf_ring_size);
+SYSCTL_UINT(_hw_cxgb, OID_AUTO, txq_mr_size, CTLFLAG_RDTUN, &cxgb_txq_mbuf_ring_size, 0,
+ "size of per-queue mbuf ring");
+
+
static inline int32_t cxgb_pcpu_calc_cookie(struct ifnet *ifp, struct mbuf *immpkt);
static void cxgb_pcpu_start_proc(void *arg);
static int cxgb_pcpu_cookie_to_qidx(struct port_info *, int32_t cookie);
@@ -100,17 +117,17 @@
struct mbuf_head *mbq;
int dropped = 0;
- if (qs->flags & QS_EXITING) {
+ if (qs->qs_flags & QS_EXITING) {
m_freem(m);
return (0);
}
txq = &qs->txq[TXQ_ETH];
- DPRINTF("enqueueing packet to cpuid=%d\n", qs->cpuid);
+ DPRINTF("enqueueing packet to cpuid=%d\n", qs->qs_cpuid);
mbq = &txq->sendq;
- if (curcpu == qs->cpuid) {
+ if (curcpu == qs->qs_cpuid) {
critical_enter();
mbufq_tail(mbq, m);
critical_exit();
@@ -139,7 +156,7 @@
return (0);
}
-static int
+int
cxgb_pcpu_enqueue_packet(struct ifnet *ifp, int32_t cookie, struct mbuf *m)
{
struct port_info *pi;
@@ -159,7 +176,7 @@
return (err);
}
-static struct mbuf *
+struct mbuf *
cxgb_dequeue_packet(struct ifnet *unused, struct sge_txq *txq)
{
struct mbuf *m, *tail, *head;
@@ -172,7 +189,7 @@
tail = NULL;
qs = txq_to_qset(txq, TXQ_ETH);
- if (qs->flags & QS_EXITING)
+ if (qs->qs_flags & QS_EXITING)
return (NULL);
critical_enter();
@@ -196,7 +213,7 @@
return (head);
}
-static int32_t
+int32_t
cxgb_pcpu_get_cookie(struct ifnet *ifp, struct in6_addr *lip, uint16_t lport, struct in6_addr *rip, uint16_t rport, int ipv6)
{
uint32_t base;
@@ -408,7 +425,7 @@
immqs = &pi->adapter->sge.qs[qidx];
curqs = (curcpu < SGE_QSETS) ? &pi->adapter->sge.qs[curcpu] : NULL;
- if (immqs->flags & QS_EXITING) {
+ if (immqs->qs_flags & QS_EXITING) {
printf("exting\n");
if (immpkt)
m_freem(immpkt);
@@ -432,7 +449,7 @@
txq = &curqs->txq[TXQ_ETH];
- if (curqs->flags & QS_EXITING)
+ if (curqs->qs_flags & QS_EXITING)
return (0);
/*
@@ -459,7 +476,7 @@
flush = (!mbufq_empty(&txq->sendq)) && ((cxgb_pcpu_tx_coalesce == 0) || complete || tx_flush);
max_desc = tx_flush ? 0xffffff : TX_START_MAX_DESC;
- err = flush ? cxgb_tx_common(curqs->port->ifp, txq, max_desc) : 0;
+ err = flush ? cxgb_tx_common(curqs->port->ifp, curqs, max_desc) : 0;
if (desc_reclaimable(txq) > 0) {
if (cxgb_debug) {
@@ -484,7 +501,7 @@
return (err);
}
-static int
+int
cxgb_pcpu_start(struct ifnet *ifp, int32_t cookie, struct mbuf *immpkt)
{
int err;
@@ -498,7 +515,7 @@
return (err);
}
-static void
+void
cxgb_start(struct ifnet *ifp)
{
struct port_info *pi = ifp->if_softc;
@@ -525,7 +542,7 @@
qidx = cxgb_pcpu_cookie_to_qidx(pi, calc_cookie);
qs = &pi->adapter->sge.qs[qidx];
critical_enter();
- if (qs->cpuid == curcpu) {
+ if (qs->qs_cpuid == curcpu) {
if (lhead == NULL)
lhead = m;
else
@@ -559,17 +576,16 @@
td = curthread;
- qs->flags |= QS_RUNNING;
-
+ qs->qs_flags |= QS_RUNNING;
thread_lock(td);
- sched_bind(td, qs->cpuid);
+ sched_bind(td, qs->qs_cpuid);
thread_unlock(td);
for (;;) {
- if (qs->flags & QS_EXITING)
+ if (qs->qs_flags & QS_EXITING)
break;
- cxgb_pcpu_start_(qs->port, qs->cpuid, NULL, TRUE);
+ cxgb_pcpu_start_(qs->port, qs->qs_cpuid, NULL, TRUE);
refill_fl_service(qs->port->adapter, &qs->fl[0]);
refill_fl_service(qs->port->adapter, &qs->fl[1]);
@@ -580,10 +596,10 @@
thread_unlock(td);
if (bootverbose)
- device_printf(qs->port->adapter->dev, "exiting thread for cpu%d\n", qs->cpuid);
+ device_printf(qs->port->adapter->dev, "exiting thread for cpu%d\n", qs->qs_cpuid);
t3_free_qset(qs->port->adapter, qs);
- qs->flags &= ~QS_RUNNING;
+ qs->qs_flags &= ~QS_RUNNING;
kthread_exit(0);
}
@@ -616,8 +632,8 @@
qs = &sc->sge.qs[pi->first_qset + j];
qs->port = pi;
- qs->cpuid = ((pi->first_qset + j) % mp_ncpus);
- device_printf(sc->dev, "starting thread for %d\n", qs->cpuid);
+ qs->qs_cpuid = ((pi->first_qset + j) % mp_ncpus);
+ device_printf(sc->dev, "starting thread for %d\n", qs->qs_cpuid);
kthread_create(cxgb_pcpu_start_proc, qs, &p,
RFNOWAIT, 0, "cxgbsp");
@@ -637,11 +653,11 @@
for (j = 0; j < pi->nqsets; j++) {
struct sge_qset *qs = &sc->sge.qs[first + j];
- qs->flags |= QS_EXITING;
+ qs->qs_flags |= QS_EXITING;
wakeup(qs);
tsleep(&sc, 0, "cxgb unload 0", hz>>2);
- while (qs->flags & QS_RUNNING) {
- qs->flags |= QS_EXITING;
+ while (qs->qs_flags & QS_RUNNING) {
+ qs->qs_flags |= QS_EXITING;
device_printf(sc->dev, "qset thread %d still running - sleeping\n", first + j);
tsleep(&sc, 0, "cxgb unload 1", 2*hz);
}
==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_sge.c#6 (text+ko) ====
@@ -185,7 +185,6 @@
static int lro_default = 0;
int cxgb_debug = 0;
-static void t3_free_qset(adapter_t *sc, struct sge_qset *q);
static void sge_timer_cb(void *arg);
static void sge_timer_reclaim(void *arg, int ncount);
static void sge_txq_reclaim_handler(void *arg, int ncount);
@@ -1526,7 +1525,7 @@
* as HW contexts, packet buffers, and descriptor rings. Traffic to the
* queue set must be quiesced prior to calling this.
*/
-static void
+void
t3_free_qset(adapter_t *sc, struct sge_qset *q)
{
int i;
More information about the p4-projects
mailing list