PERFORCE change 134938 for review
Kip Macy
kmacy at FreeBSD.org
Wed Feb 6 15:36:39 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=134938
Change 134938 by kmacy at kmacy:entropy:iwarp on 2008/02/06 23:36:20
fix issues caused by integration
Affected files ...
.. //depot/projects/iwarp/sys/amd64/conf/GENERIC#7 edit
.. //depot/projects/iwarp/sys/dev/cxgb/cxgb_l2t.c#7 edit
.. //depot/projects/iwarp/sys/dev/cxgb/cxgb_main.c#12 edit
.. //depot/projects/iwarp/sys/dev/cxgb/cxgb_multiq.c#6 edit
.. //depot/projects/iwarp/sys/dev/cxgb/cxgb_offload.c#13 edit
.. //depot/projects/iwarp/sys/dev/cxgb/cxgb_sge.c#10 edit
.. //depot/projects/iwarp/sys/modules/cxgb/cxgb/Makefile#5 edit
Differences ...
==== //depot/projects/iwarp/sys/amd64/conf/GENERIC#7 (text+ko) ====
@@ -213,5 +213,4 @@
device dcons_crom # Configuration ROM for dcons
options ALT_BREAK_TO_DEBUGGER
-options IFNET_MULTIQUEUE
#options BIND_ALL
==== //depot/projects/iwarp/sys/dev/cxgb/cxgb_l2t.c#7 (text+ko) ====
@@ -223,7 +223,7 @@
else
m_freem(m);
mtx_unlock(&e->lock);
- }
+ }
}
return 0;
}
@@ -541,6 +541,12 @@
void
t3_free_l2t(struct l2t_data *d)
{
+ int i;
+
+ rw_destroy(&d->lock);
+ for (i = 0; i < d->nentries; ++i)
+ mtx_destroy(&d->l2tab[i].lock);
+
cxgb_free_mem(d);
}
==== //depot/projects/iwarp/sys/dev/cxgb/cxgb_main.c#12 (text+ko) ====
@@ -119,6 +119,7 @@
static int offload_open(struct port_info *pi);
static void touch_bars(device_t dev);
static int offload_close(struct t3cdev *tdev);
+
static device_method_t cxgb_controller_methods[] = {
DEVMETHOD(device_probe, cxgb_controller_probe),
DEVMETHOD(device_attach, cxgb_controller_attach),
@@ -438,11 +439,11 @@
}
sc->udbs_rid = PCIR_BAR(2);
if ((sc->udbs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
- &sc->udbs_rid, RF_ACTIVE)) == NULL) {
+ &sc->udbs_rid, RF_ACTIVE)) == NULL) {
device_printf(dev, "Cannot allocate BAR region 1\n");
error = ENXIO;
goto out;
- }
+ }
snprintf(sc->lockbuf, ADAPTER_LOCK_NAME_LEN, "cxgb controller lock %d",
device_get_unit(dev));
@@ -614,6 +615,7 @@
snprintf(&sc->fw_version[0], sizeof(sc->fw_version), "%d.%d.%d",
G_FW_VERSION_MAJOR(vers), G_FW_VERSION_MINOR(vers),
G_FW_VERSION_MICRO(vers));
+
device_printf(sc->dev, "Firmware Version %s\n", &sc->fw_version[0]);
t3_add_attach_sysctls(sc);
@@ -661,11 +663,7 @@
bus_release_resource(sc->dev, SYS_RES_MEMORY, sc->msix_regs_rid,
sc->msix_regs_res);
}
-
- if (sc->tq != NULL) {
- taskqueue_drain(sc->tq, &sc->ext_intr_task);
- taskqueue_drain(sc->tq, &sc->tick_task);
- }
+
t3_sge_deinit_sw(sc);
/*
* Wait for last callout
@@ -679,22 +677,26 @@
}
bus_generic_detach(sc->dev);
- if (sc->tq != NULL)
+ if (sc->tq != NULL) {
taskqueue_free(sc->tq);
+ sc->tq = NULL;
+ }
+
if (is_offload(sc)) {
cxgb_adapter_unofld(sc);
if (isset(&sc->open_device_map, OFFLOAD_DEVMAP_BIT))
offload_close(&sc->tdev);
- }
+ else
+ printf("cxgb_free: DEVMAP_BIT not set\n");
+ } else
+ printf("not offloading set\n");
-#ifndef IFNET_MULTIQUEUE
- t3_free_sge_resources(sc);
-#endif
+ cxgb_offload_deactivate(sc);
free(sc->filters, M_DEVBUF);
t3_sge_free(sc);
cxgb_offload_exit();
-
+
if (sc->udbs_res != NULL)
bus_release_resource(sc->dev, SYS_RES_MEMORY, sc->udbs_rid,
sc->udbs_res);
@@ -909,11 +911,12 @@
ifp->if_ioctl = cxgb_ioctl;
ifp->if_start = cxgb_start;
+#if 0
#ifdef IFNET_MULTIQUEUE
ifp->if_flags |= IFF_MULTIQ;
ifp->if_mq_start = cxgb_pcpu_start;
#endif
-
+#endif
ifp->if_timer = 0; /* Disable ifnet watchdog */
ifp->if_watchdog = NULL;
@@ -1131,9 +1134,6 @@
struct port_info *pi = &adapter->port[port_id];
struct cmac *mac = &adapter->port[port_id].mac;
- if ((pi->ifp->if_flags & IFF_UP) == 0)
- return;
-
if (link_status) {
t3_mac_enable(mac, MAC_DIRECTION_RX);
if_link_state_change(pi->ifp, LINK_STATE_UP);
@@ -1541,7 +1541,6 @@
static void
cxgb_down_locked(struct adapter *sc)
{
- int i;
t3_sge_stop(sc);
t3_intr_disable(sc);
@@ -1558,20 +1557,24 @@
sc->irq_res = NULL;
}
- if (sc->flags & USING_MSIX)
+ if (sc->flags & USING_MSIX)
cxgb_teardown_msix(sc);
- ADAPTER_UNLOCK(sc);
-
+
callout_stop(&sc->cxgb_tick_ch);
callout_stop(&sc->sge_timer_ch);
callout_drain(&sc->cxgb_tick_ch);
callout_drain(&sc->sge_timer_ch);
if (sc->tq != NULL) {
+ printf("draining slow intr\n");
+
taskqueue_drain(sc->tq, &sc->slow_intr_task);
- for (i = 0; i < sc->params.nports; i++)
- taskqueue_drain(sc->tq, &sc->port[i].timer_reclaim_task);
+ printf("draining ext intr\n");
+ taskqueue_drain(sc->tq, &sc->ext_intr_task);
+ printf("draining tick task\n");
+ taskqueue_drain(sc->tq, &sc->tick_task);
}
+ ADAPTER_UNLOCK(sc);
}
static int
@@ -1650,7 +1653,6 @@
cxgb_down_locked(adapter);
else
ADAPTER_UNLOCK(adapter);
- cxgb_offload_deactivate(adapter);
return (0);
}
@@ -1818,6 +1820,12 @@
break;
case SIOCSIFMEDIA:
case SIOCGIFMEDIA:
+ /*
+ * This is a convenient place to check the link status when
+ * no interfaces are up and thus the callout is not running
+ */
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+ cxgb_tick_handler(p->adapter, 0);
error = ifmedia_ioctl(ifp, ifr, &p->media, command);
break;
case SIOCSIFCAP:
@@ -1992,20 +2000,21 @@
struct port_info *p = &sc->port[i];
struct ifnet *ifp = p->ifp;
- PORT_LOCK(p);
- if ((ifp->if_drv_flags & IFF_DRV_RUNNING))
+ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) &&
+ (ifp->if_flags & IFF_UP))
running = 1;
- PORT_UNLOCK(p);
}
if (running == 0)
return;
- taskqueue_enqueue(sc->tq, &sc->tick_task);
+
- if (sc->open_device_map != 0)
+ if (sc->open_device_map != 0) {
+ taskqueue_enqueue(sc->tq, &sc->tick_task);
callout_reset(&sc->cxgb_tick_ch, hz, cxgb_tick, sc);
+ }
}
static void
@@ -2514,7 +2523,7 @@
reg_block_dump(struct adapter *ap, uint8_t *buf, unsigned int start,
unsigned int end)
{
- uint32_t *p = (uint32_t *)(buf + start);
+ uint32_t *p = (uint32_t *)buf + start;
for ( ; start <= end; start += sizeof(uint32_t))
*p++ = t3_read_reg(ap, start);
==== //depot/projects/iwarp/sys/dev/cxgb/cxgb_multiq.c#6 (text+ko) ====
@@ -27,8 +27,10 @@
***************************************************************************/
+#define DEBUG_BUFRING
+
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/cxgb/cxgb_main.c,v 1.28 2007/07/17 06:50:33 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/cxgb/cxgb_multiq.c,v 1.6 2008/01/15 08:08:08 kmacy Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -55,7 +57,7 @@
#include <sys/queue.h>
#include <sys/taskqueue.h>
#include <sys/unistd.h>
-#include <sys/unistd.h>
+#include <sys/syslog.h>
#include <net/bpf.h>
#include <net/ethernet.h>
@@ -92,7 +94,7 @@
#endif
extern struct sysctl_oid_list sysctl__hw_cxgb_children;
-static int cxgb_pcpu_tx_coalesce = 1;
+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");
@@ -110,41 +112,35 @@
static inline int32_t cxgb_pcpu_calc_cookie(struct ifnet *ifp, struct mbuf *immpkt);
static void cxgb_pcpu_start_proc(void *arg);
+#ifdef IFNET_MULTIQUEUE
static int cxgb_pcpu_cookie_to_qidx(struct port_info *, uint32_t cookie);
+#endif
static int cxgb_tx(struct sge_qset *qs, uint32_t txmax);
+
static inline int
cxgb_pcpu_enqueue_packet_(struct sge_qset *qs, struct mbuf *m)
{
struct sge_txq *txq;
- struct buf_ring *mr;
- int prod, cons, mask;
int err = 0;
-
+
+#ifndef IFNET_MULTIQUEUE
+ panic("not expecting enqueue without multiqueue");
+#endif
+ KASSERT(m != NULL, ("null mbuf"));
+ KASSERT(m->m_type == MT_DATA, ("bad mbuf type %d", m->m_type));
if (qs->qs_flags & QS_EXITING) {
m_freem(m);
return (ENXIO);
}
txq = &qs->txq[TXQ_ETH];
-
- mr = &txq->txq_mr;
- mtx_lock(&mr->br_lock);
- cons = mr->br_cons;
- prod = mr->br_prod;
- mask = mr->br_size - 1;
- if (((prod + 1) & mask) != cons) {
- mr->br_ring[prod] = (caddr_t)m;
- mb();
- mr->br_prod = (prod + 1) & mask;
- } else {
+ err = buf_ring_enqueue(&txq->txq_mr, m);
+ if (err) {
txq->txq_drops++;
- err = ENOBUFS;
+ m_freem(m);
}
- mtx_unlock(&mr->br_lock);
if ((qs->txq[TXQ_ETH].flags & TXQ_TRANSMITTING) == 0)
wakeup(qs);
- if (err)
- m_freem(m);
return (err);
}
@@ -152,16 +148,17 @@
int
cxgb_pcpu_enqueue_packet(struct ifnet *ifp, struct mbuf *m)
{
- struct port_info *pi;
+ struct port_info *pi = ifp->if_softc;
struct sge_qset *qs;
- int err, qidx;
+ int err = 0, qidx;
+#ifdef IFNET_MULTIQUEUE
int32_t calc_cookie;
- pi = ifp->if_softc;
- err = 0;
-
calc_cookie = m->m_pkthdr.rss_hash;
qidx = cxgb_pcpu_cookie_to_qidx(pi, calc_cookie);
+#else
+ qidx = 0;
+#endif
qs = &pi->adapter->sge.qs[qidx];
err = cxgb_pcpu_enqueue_packet_(qs, m);
@@ -176,11 +173,22 @@
struct sge_qset *qs;
int count, size, coalesced;
struct adapter *sc;
- struct buf_ring *mr;
+#ifndef IFNET_MULTIQUEUE
+ struct port_info *pi = txq->port;
+
+ if (txq->immpkt != NULL)
+ panic("immediate packet set");
+ mtx_assert(&txq->lock, MA_OWNED);
+
+ IFQ_DRV_DEQUEUE(&pi->ifp->if_snd, m);
+ if (m == NULL)
+ return (0);
- mr = &txq->txq_mr;
+ m_vec[0] = m;
+ return (1);
+#endif
+
coalesced = count = size = 0;
-
qs = txq_to_qset(txq, TXQ_ETH);
if (qs->qs_flags & QS_EXITING)
return (0);
@@ -193,28 +201,33 @@
}
sc = qs->port->adapter;
- m = buf_ring_dequeue(mr);
- if (m == NULL)
+ m = buf_ring_dequeue(&txq->txq_mr);
+ if (m == NULL)
return (0);
+ count = 1;
+ KASSERT(m->m_type == MT_DATA,
+ ("m=%p is bad mbuf type %d from ring cons=%d prod=%d", m,
+ m->m_type, txq->txq_mr.br_cons, txq->txq_mr.br_prod));
m_vec[0] = m;
- if (m->m_pkthdr.tso_segsz > 0 || m->m_pkthdr.len > TX_WR_SIZE_MAX || m->m_next != NULL) {
- DPRINTF("returning 1 packet\n");
- return (1);
+ if (m->m_pkthdr.tso_segsz > 0 || m->m_pkthdr.len > TX_WR_SIZE_MAX ||
+ m->m_next != NULL || (cxgb_pcpu_tx_coalesce == 0)) {
+ return (count);
}
- count = 1;
+
size = m->m_pkthdr.len;
- for (m = buf_ring_peek(mr); m != NULL; m = buf_ring_peek(mr)) {
+ for (m = buf_ring_peek(&txq->txq_mr); m != NULL;
+ m = buf_ring_peek(&txq->txq_mr)) {
- if (m->m_pkthdr.tso_segsz > 0 || size + m->m_pkthdr.len > TX_WR_SIZE_MAX || m->m_next != NULL)
+ if (m->m_pkthdr.tso_segsz > 0 ||
+ size + m->m_pkthdr.len > TX_WR_SIZE_MAX || m->m_next != NULL)
break;
- buf_ring_dequeue(mr);
+ buf_ring_dequeue(&txq->txq_mr);
size += m->m_pkthdr.len;
m_vec[count++] = m;
-
- if (count == TX_WR_COUNT_MAX || (cxgb_pcpu_tx_coalesce == 0))
+ if (count == TX_WR_COUNT_MAX)
break;
coalesced++;
@@ -357,13 +370,15 @@
{
struct mbuf *m;
struct sge_txq *txq = &qs->txq[TXQ_ETH];
-
+
+ mtx_lock(&txq->lock);
while ((m = mbufq_dequeue(&txq->sendq)) != NULL)
m_freem(m);
while ((m = buf_ring_dequeue(&txq->txq_mr)) != NULL)
m_freem(m);
t3_free_tx_desc_all(txq);
+ mtx_unlock(&txq->lock);
}
static int
@@ -376,6 +391,7 @@
KASSERT(qs->qs_cpuid == curcpu, ("cpu qset mismatch cpuid=%d curcpu=%d",
qs->qs_cpuid, curcpu));
#endif
+ mtx_assert(&txq->lock, MA_OWNED);
reclaimable = desc_reclaimable(txq);
if (reclaimable == 0)
@@ -403,14 +419,20 @@
pi = qs->port;
initerr = err = i = reclaimed = 0;
sc = pi->adapter;
+ txq = &qs->txq[TXQ_ETH];
+
+ mtx_assert(&txq->lock, MA_OWNED);
retry:
if (!pi->link_config.link_ok)
initerr = ENXIO;
else if (qs->qs_flags & QS_EXITING)
initerr = ENXIO;
- else {
- txq = &qs->txq[TXQ_ETH];
+ else if ((pi->ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+ initerr = ENXIO;
+ else if ((pi->ifp->if_flags & IFF_UP) == 0)
+ initerr = ENXIO;
+ else if (immpkt) {
if (!buf_ring_empty(&txq->txq_mr))
initerr = cxgb_pcpu_enqueue_packet_(qs, immpkt);
@@ -421,13 +443,14 @@
}
if (initerr && initerr != ENOBUFS) {
if (cxgb_debug)
- printf("cxgb link down\n");
+ log(LOG_WARNING, "cxgb link down\n");
if (immpkt)
m_freem(immpkt);
return (initerr);
}
- if ((tx_flush && (desc_reclaimable(txq) > 0)) || (desc_reclaimable(txq) > (TX_ETH_Q_SIZE>>1))) {
+ if ((tx_flush && (desc_reclaimable(txq) > 0)) ||
+ (desc_reclaimable(txq) > (TX_ETH_Q_SIZE>>1))) {
int reclaimed = 0;
if (cxgb_debug) {
@@ -442,11 +465,19 @@
}
stopped = isset(&qs->txq_stopped, TXQ_ETH);
- flush = ((!buf_ring_empty(&txq->txq_mr) && !stopped) || txq->immpkt);
+ flush = (((!buf_ring_empty(&txq->txq_mr) || (!IFQ_DRV_IS_EMPTY(&pi->ifp->if_snd))) && !stopped) || txq->immpkt);
max_desc = tx_flush ? TX_ETH_Q_SIZE : TX_START_MAX_DESC;
+
+ if (cxgb_debug)
+ DPRINTF("stopped=%d flush=%d max_desc=%d\n",
+ stopped, flush, max_desc);
+
err = flush ? cxgb_tx(qs, max_desc) : ENOSPC;
-
- if ((tx_flush && flush && err == 0) && !buf_ring_empty(&txq->txq_mr)) {
+
+
+ if ((tx_flush && flush && err == 0) &&
+ (!buf_ring_empty(&txq->txq_mr) ||
+ !IFQ_DRV_IS_EMPTY(&pi->ifp->if_snd))) {
struct thread *td = curthread;
if (++i > 1) {
@@ -481,26 +512,37 @@
sc = pi->adapter;
qs = NULL;
qidx = resid = err = cookie = locked = 0;
-
+
+#ifdef IFNET_MULTIQUEUE
if (immpkt && (immpkt->m_pkthdr.rss_hash != 0)) {
cookie = immpkt->m_pkthdr.rss_hash;
qidx = cxgb_pcpu_cookie_to_qidx(pi, cookie);
DPRINTF("hash=0x%x qidx=%d cpu=%d\n", immpkt->m_pkthdr.rss_hash, qidx, curcpu);
qs = &pi->adapter->sge.qs[qidx];
- } else
+ } else
+#endif
qs = &pi->adapter->sge.qs[pi->first_qset];
-
+
txq = &qs->txq[TXQ_ETH];
- if (((sc->tunq_coalesce == 0) || (buf_ring_count(&txq->txq_mr) > TX_WR_COUNT_MAX)) && mtx_trylock(&txq->lock)) {
+ if (((sc->tunq_coalesce == 0) ||
+ (buf_ring_count(&txq->txq_mr) >= TX_WR_COUNT_MAX) ||
+ (cxgb_pcpu_tx_coalesce == 0)) && mtx_trylock(&txq->lock)) {
+ if (cxgb_debug)
+ printf("doing immediate transmit\n");
+
txq->flags |= TXQ_TRANSMITTING;
err = cxgb_pcpu_start_(qs, immpkt, FALSE);
txq->flags &= ~TXQ_TRANSMITTING;
resid = (buf_ring_count(&txq->txq_mr) > 64) || (desc_reclaimable(txq) > 64);
mtx_unlock(&txq->lock);
- } else if (immpkt)
+ } else if (immpkt) {
+ if (cxgb_debug)
+ printf("deferred coalesce=%jx ring_count=%d mtx_owned=%d\n",
+ sc->tunq_coalesce, buf_ring_count(&txq->txq_mr), mtx_owned(&txq->lock));
err = cxgb_pcpu_enqueue_packet_(qs, immpkt);
-
+ }
+
if (resid && (txq->flags & TXQ_TRANSMITTING) == 0)
wakeup(qs);
@@ -510,53 +552,15 @@
void
cxgb_start(struct ifnet *ifp)
{
- struct port_info *pi = ifp->if_softc;
- struct sge_qset *qs;
- struct mbuf *m, *head, *tail, *lhead, *ltail;
- int calc_cookie, qidx, i;
+ struct port_info *p = ifp->if_softc;
+
+ if (!p->link_config.link_ok)
+ return;
- IFQ_LOCK(&ifp->if_snd);
- IFQ_DEQUEUE_NOLOCK(&ifp->if_snd, m);
- head = tail = m;
- i = 0;
- while (m != NULL) {
- IFQ_DEQUEUE_NOLOCK(&ifp->if_snd, m);
- tail->m_nextpkt = m;
- tail = m;
- i++;
- }
- IFQ_UNLOCK(&ifp->if_snd);
- printf("dequeued %d packets\n", i);
- lhead = ltail = NULL;
- for (m = head; m != NULL; m = head->m_nextpkt) {
- calc_cookie = cxgb_pcpu_calc_cookie(ifp, m);
- qidx = cxgb_pcpu_cookie_to_qidx(pi, calc_cookie);
- qs = &pi->adapter->sge.qs[qidx];
- critical_enter();
- if (qs->qs_cpuid == curcpu) {
- if (lhead == NULL)
- lhead = m;
- else
- ltail->m_nextpkt = m;
- ltail = m;
- critical_exit();
- } else {
- critical_exit();
- cxgb_pcpu_enqueue_packet_(qs, m);
- }
- }
- if (curcpu < SGE_QSETS) {
- qs = &pi->adapter->sge.qs[curcpu];
- /*
- * Assume one-to-one mapping of qset to CPU for now XXX
- */
+ if (IFQ_DRV_IS_EMPTY(&ifp->if_snd))
+ return;
- (void)cxgb_pcpu_start_(qs, NULL, TRUE);
- /*
- * XXX multiple packets
- */
- cxgb_pcpu_enqueue_packet_(qs, lhead);
- }
+ cxgb_pcpu_start(ifp, NULL);
}
static void
@@ -566,11 +570,12 @@
struct thread *td;
struct sge_txq *txq = &qs->txq[TXQ_ETH];
int idleticks, err = 0;
+#ifdef notyet
struct adapter *sc = qs->port->adapter;
-
+#endif
td = curthread;
- sleep_ticks = hz/100;
+ sleep_ticks = max(hz/1000, 1);
qs->qs_flags |= QS_RUNNING;
thread_lock(td);
sched_bind(td, qs->qs_cpuid);
@@ -599,7 +604,7 @@
mtx_unlock(&txq->lock);
} else
err = EINPROGRESS;
-
+#ifdef notyet
if (mtx_trylock(&qs->rspq.lock)) {
process_responses(sc, qs, -1);
@@ -610,6 +615,7 @@
mtx_unlock(&qs->rspq.lock);
}
+#endif
if ((!buf_ring_empty(&txq->txq_mr)) && err == 0) {
if (cxgb_debug)
printf("head=%p cons=%d prod=%d\n",
@@ -632,36 +638,47 @@
kproc_exit(0);
}
+#ifdef IFNET_MULTIQUEUE
static int
cxgb_pcpu_cookie_to_qidx(struct port_info *pi, uint32_t cookie)
{
int qidx;
uint32_t tmp;
+ /*
+ * Will probably need to be changed for 4-port XXX
+ */
tmp = pi->tx_chan ? cookie : cookie & ((RSS_TABLE_SIZE>>1)-1);
DPRINTF(" tmp=%d ", tmp);
qidx = (tmp & (pi->nqsets -1)) + pi->first_qset;
return (qidx);
}
-
+#endif
void
cxgb_pcpu_startup_threads(struct adapter *sc)
{
- int i, j;
+ int i, j, nqsets;
struct proc *p;
-
+
+
for (i = 0; i < (sc)->params.nports; ++i) {
struct port_info *pi = adap2pinfo(sc, i);
-
- for (j = 0; j < pi->nqsets; ++j) {
+
+#ifdef IFNET_MULTIQUEUE
+ nqsets = pi->nqsets;
+#else
+ nqsets = 1;
+#endif
+ for (j = 0; j < nqsets; ++j) {
struct sge_qset *qs;
qs = &sc->sge.qs[pi->first_qset + j];
qs->port = pi;
qs->qs_cpuid = ((pi->first_qset + j) % mp_ncpus);
- device_printf(sc->dev, "starting thread for %d\n", qs->qs_cpuid);
+ device_printf(sc->dev, "starting thread for %d\n",
+ qs->qs_cpuid);
kproc_create(cxgb_pcpu_start_proc, qs, &p,
RFNOWAIT, 0, "cxgbsp");
@@ -674,12 +691,20 @@
cxgb_pcpu_shutdown_threads(struct adapter *sc)
{
int i, j;
+ int nqsets;
+
+
for (i = 0; i < sc->params.nports; i++) {
struct port_info *pi = &sc->port[i];
int first = pi->first_qset;
-
- for (j = 0; j < pi->nqsets; j++) {
+
+#ifdef IFNET_MULTIQUEUE
+ nqsets = pi->nqsets;
+#else
+ nqsets = 1;
+#endif
+ for (j = 0; j < nqsets; j++) {
struct sge_qset *qs = &sc->sge.qs[first + j];
qs->qs_flags |= QS_EXITING;
@@ -694,7 +719,6 @@
}
}
-
static __inline void
check_pkt_coalesce(struct sge_qset *qs)
{
@@ -774,3 +798,4 @@
#endif
return (err);
}
+
==== //depot/projects/iwarp/sys/dev/cxgb/cxgb_offload.c#13 (text+ko) ====
@@ -305,9 +305,7 @@
req->pbl_top = t3_read_reg(adapter, A_ULPTX_PBL_ULIMIT);
req->rqt_base = t3_read_reg(adapter, A_ULPRX_RQ_LLIMIT);
req->rqt_top = t3_read_reg(adapter, A_ULPRX_RQ_ULIMIT);
- req->kdb_addr = (void *)((unsigned long)rman_get_virtual(adapter->regs_res) + A_SG_KDOORBELL);
- req->pdev = adapter->dev;
- break;
+ req->kdb_addr = (void *)((unsigned long)rman_get_virtual(adapter->regs_res) + A_SG_KDOORBELL); break;
}
case RDMA_CQ_OP: {
struct rdma_cq_op *req = data;
@@ -926,7 +924,6 @@
cxgb_redirect_event(void *unused, int event, struct rtentry *rt0,
struct rtentry *rt1, struct sockaddr *sa)
{
-
/*
* ignore events on non-offloaded interfaces
*/
@@ -967,14 +964,15 @@
do_bad_cpl(struct t3cdev *dev, struct mbuf *m)
{
log(LOG_ERR, "%s: received bad CPL command 0x%x\n", dev->name,
- *mtod(m, uint32_t *));
+ 0xFF & *mtod(m, uint32_t *));
+ kdb_backtrace();
return (CPL_RET_BUF_DONE | CPL_RET_BAD_MSG);
}
/*
* Handlers for each CPL opcode
*/
-static cpl_handler_func cpl_handlers[NUM_CPL_CMDS];
+static cpl_handler_func cpl_handlers[256];
/*
* Add a new handler to the CPL dispatch table. A NULL handler may be supplied
@@ -1066,9 +1064,13 @@
void
cxgb_neigh_update(struct rtentry *rt, uint8_t *enaddr, struct sockaddr *sa)
{
- struct t3cdev *tdev = T3CDEV(rt->rt_ifp);
- PANIC_IF(!tdev);
- t3_l2t_update(tdev, rt, enaddr, sa);
+
+ if (is_offloading(rt->rt_ifp)) {
+ struct t3cdev *tdev = T3CDEV(rt->rt_ifp);
+
+ PANIC_IF(!tdev);
+ t3_l2t_update(tdev, rt, enaddr, sa);
+ }
}
static void
@@ -1110,6 +1112,13 @@
olddev = old->rt_ifp;
newdev = new->rt_ifp;
+ if (!is_offloading(olddev))
+ return;
+ if (!is_offloading(newdev)) {
+ log(LOG_WARNING, "%s: Redirect to non-offload"
+ "device ignored.\n", __FUNCTION__);
+ return;
+ }
tdev = T3CDEV(olddev);
PANIC_IF(!tdev);
if (tdev != T3CDEV(newdev)) {
@@ -1163,7 +1172,6 @@
free(addr, M_CXGB);
}
-
/*
* Allocate and initialize the TID tables. Returns 0 on success.
*/
@@ -1212,6 +1220,8 @@
static void
free_tid_maps(struct tid_info *t)
{
+ mtx_destroy(&t->stid_lock);
+ mtx_destroy(&t->atid_lock);
cxgb_free_mem(t->tid_tab);
}
@@ -1231,11 +1241,6 @@
rw_wunlock(&adapter_list_lock);
}
-/*
- * XXX
- */
-#define t3_free_l2t(...)
-
int
cxgb_offload_activate(struct adapter *adapter)
{
@@ -1269,8 +1274,6 @@
device_printf(adapter->dev, "%s: t3_init_l2t failed\n", __FUNCTION__);
goto out_free;
}
-
-
natids = min(tid_range.num / 2, MAX_ATIDS);
err = init_tid_tabs(&t->tid_maps, tid_range.num, natids,
stid_range.num, ATID_BASE, stid_range.base);
@@ -1334,6 +1337,7 @@
T3C_DATA(tdev) = NULL;
t3_free_l2t(L2DATA(tdev));
L2DATA(tdev) = NULL;
+ mtx_destroy(&t->tid_release_lock);
free(t, M_CXGB);
}
@@ -1402,7 +1406,7 @@
TAILQ_INIT(&ofld_dev_list);
TAILQ_INIT(&adapter_list);
- for (i = 0; i < NUM_CPL_CMDS; ++i)
+ for (i = 0; i < 0x100; ++i)
cpl_handlers[i] = do_bad_cpl;
t3_register_cpl_handler(CPL_SMT_WRITE_RPL, do_smt_write_rpl);
@@ -1429,7 +1433,9 @@
t3_register_cpl_handler(CPL_RX_DATA_DDP, do_hwtid_rpl);
t3_register_cpl_handler(CPL_RX_DDP_COMPLETE, do_hwtid_rpl);
t3_register_cpl_handler(CPL_ISCSI_HDR, do_hwtid_rpl);
-
+ t3_register_cpl_handler(CPL_GET_TCB_RPL, do_hwtid_rpl);
+ t3_register_cpl_handler(CPL_SET_TCB_RPL, do_hwtid_rpl);
+
EVENTHANDLER_REGISTER(route_arp_update_event, cxgb_arp_update_event,
NULL, EVENTHANDLER_PRI_ANY);
EVENTHANDLER_REGISTER(route_redirect_event, cxgb_redirect_event,
@@ -1456,4 +1462,3 @@
}
MODULE_VERSION(if_cxgb, 1);
-
==== //depot/projects/iwarp/sys/dev/cxgb/cxgb_sge.c#10 (text+ko) ====
@@ -2743,18 +2743,24 @@
rspq->async_notif++;
goto skip;
} else if (flags & F_RSPD_IMM_DATA_VALID) {
- if (cxgb_debug)
- printf("IMM DATA VALID opcode=0x%x rspq->cidx=%d\n", r->rss_hdr.opcode, rspq->cidx);
- if(get_imm_packet(adap, r, rspq->rspq_mh.mh_head) == 0) {
+ struct mbuf *m = NULL;
+
+ DPRINTF("IMM DATA VALID opcode=0x%x rspq->cidx=%d\n",
+ r->rss_hdr.opcode, rspq->cidx);
+ if (rspq->rspq_mh.mh_head == NULL)
+ rspq->rspq_mh.mh_head = m_gethdr(M_DONTWAIT, MT_DATA);
+ else
+ m = m_gethdr(M_DONTWAIT, MT_DATA);
+
+ if (rspq->rspq_mh.mh_head == NULL && m == NULL) {
no_mem:
rspq->next_holdoff = NOMEM_INTR_DELAY;
budget_left--;
break;
- } else {
- eop = 1;
}
- goto skip;
-
+ get_imm_packet(adap, r, rspq->rspq_mh.mh_head);
+ eop = 1;
+ rspq->imm_data++;
} else if (r->len_cq) {
int drop_thresh = eth ? SGE_RX_DROP_THRES : 0;
==== //depot/projects/iwarp/sys/modules/cxgb/cxgb/Makefile#5 (text+ko) ====
@@ -13,8 +13,7 @@
CFLAGS+= -DCONFIG_CHELSIO_T3_CORE -g -DCONFIG_DEFINED -DDEFAULT_JUMBO -I${CXGB} -DSMP
CFLAGS+= -DDISABLE_MBUF_IOVEC
-CFLAGS+= -DIFNET_MULTIQUEUE
-
+#CFLAGS+= -DIFNET_MULTIQUEUE
#CFLAGS+= -DDISABLE_MBUF_IOVEC
#CFLAGS+= -DDEBUG -DDEBUG_PRINT
#CFLAGS+= -DINVARIANT_SUPPORT -DINVARIANTS
More information about the p4-projects
mailing list