Eliminate ext_intr_task. The "slow" interrupt handler is already

running on the adapter's task queue.  Just do what the task does
instead of enqueueing it.

MFC after:	3 days
This commit is contained in:
Navdeep Parhar 2010-07-09 00:36:35 +00:00
parent 29c54b85f9
commit 2c32b50248
5 changed files with 14 additions and 58 deletions

View File

@ -701,7 +701,6 @@ void t3_port_intr_enable(adapter_t *adapter, int idx);
void t3_port_intr_disable(adapter_t *adapter, int idx); void t3_port_intr_disable(adapter_t *adapter, int idx);
void t3_port_intr_clear(adapter_t *adapter, int idx); void t3_port_intr_clear(adapter_t *adapter, int idx);
int t3_slow_intr_handler(adapter_t *adapter); int t3_slow_intr_handler(adapter_t *adapter);
int t3_phy_intr_handler(adapter_t *adapter);
void t3_link_changed(adapter_t *adapter, int port_id); void t3_link_changed(adapter_t *adapter, int port_id);
int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); int t3_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc);

View File

@ -2180,7 +2180,7 @@ static int mac_intr_handler(adapter_t *adap, unsigned int idx)
/* /*
* Interrupt handler for PHY events. * Interrupt handler for PHY events.
*/ */
int t3_phy_intr_handler(adapter_t *adapter) static int phy_intr_handler(adapter_t *adapter)
{ {
u32 i, cause = t3_read_reg(adapter, A_T3DBG_INT_CAUSE); u32 i, cause = t3_read_reg(adapter, A_T3DBG_INT_CAUSE);
@ -2262,7 +2262,7 @@ int t3_slow_intr_handler(adapter_t *adapter)
if (cause & F_XGMAC0_1) if (cause & F_XGMAC0_1)
mac_intr_handler(adapter, 1); mac_intr_handler(adapter, 1);
if (cause & F_T3DBG) if (cause & F_T3DBG)
t3_os_ext_intr_handler(adapter); phy_intr_handler(adapter);
/* Clear the interrupts just processed. */ /* Clear the interrupts just processed. */
t3_write_reg(adapter, A_PL_INT_CAUSE0, cause); t3_write_reg(adapter, A_PL_INT_CAUSE0, cause);

View File

@ -350,7 +350,6 @@ struct adapter {
struct filter_info *filters; struct filter_info *filters;
/* Tasks */ /* Tasks */
struct task ext_intr_task;
struct task slow_intr_task; struct task slow_intr_task;
struct task tick_task; struct task tick_task;
struct taskqueue *tq; struct taskqueue *tq;
@ -500,7 +499,6 @@ void t3_os_link_changed(adapter_t *adapter, int port_id, int link_status,
void t3_os_phymod_changed(struct adapter *adap, int port_id); void t3_os_phymod_changed(struct adapter *adap, int port_id);
void t3_sge_err_intr_handler(adapter_t *adapter); void t3_sge_err_intr_handler(adapter_t *adapter);
int t3_offload_tx(struct t3cdev *, struct mbuf *); int t3_offload_tx(struct t3cdev *, struct mbuf *);
void t3_os_ext_intr_handler(adapter_t *adapter);
void t3_os_set_hw_addr(adapter_t *adapter, int port_idx, u8 hw_addr[]); void t3_os_set_hw_addr(adapter_t *adapter, int port_idx, u8 hw_addr[]);
int t3_mgmt_tx(adapter_t *adap, struct mbuf *m); int t3_mgmt_tx(adapter_t *adap, struct mbuf *m);

View File

@ -95,7 +95,6 @@ static void cxgb_build_medialist(struct port_info *);
static void cxgb_media_status(struct ifnet *, struct ifmediareq *); static void cxgb_media_status(struct ifnet *, struct ifmediareq *);
static int setup_sge_qsets(adapter_t *); static int setup_sge_qsets(adapter_t *);
static void cxgb_async_intr(void *); static void cxgb_async_intr(void *);
static void cxgb_ext_intr_handler(void *, int);
static void cxgb_tick_handler(void *, int); static void cxgb_tick_handler(void *, int);
static void cxgb_tick(void *); static void cxgb_tick(void *);
static void setup_rss(adapter_t *sc); static void setup_rss(adapter_t *sc);
@ -588,7 +587,6 @@ cxgb_controller_attach(device_t dev)
taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq", taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s taskq",
device_get_nameunit(dev)); device_get_nameunit(dev));
TASK_INIT(&sc->ext_intr_task, 0, cxgb_ext_intr_handler, sc);
TASK_INIT(&sc->tick_task, 0, cxgb_tick_handler, sc); TASK_INIT(&sc->tick_task, 0, cxgb_tick_handler, sc);
@ -1265,29 +1263,6 @@ void t3_os_phymod_changed(struct adapter *adap, int port_id)
} }
} }
/*
* Interrupt-context handler for external (PHY) interrupts.
*/
void
t3_os_ext_intr_handler(adapter_t *sc)
{
if (cxgb_debug)
printf("t3_os_ext_intr_handler\n");
/*
* Schedule a task to handle external interrupts as they may be slow
* and we use a mutex to protect MDIO registers. We disable PHY
* interrupts in the meantime and let the task reenable them when
* it's done.
*/
if (sc->slow_intr_mask) {
ADAPTER_LOCK(sc);
sc->slow_intr_mask &= ~F_T3DBG;
t3_write_reg(sc, A_PL_INT_ENABLE0, sc->slow_intr_mask);
taskqueue_enqueue(sc->tq, &sc->ext_intr_task);
ADAPTER_UNLOCK(sc);
}
}
void void
t3_os_set_hw_addr(adapter_t *adapter, int port_idx, u8 hw_addr[]) t3_os_set_hw_addr(adapter_t *adapter, int port_idx, u8 hw_addr[])
{ {
@ -1937,7 +1912,6 @@ cxgb_uninit_synchronized(struct port_info *pi)
clrbit(&sc->open_device_map, pi->port_id); clrbit(&sc->open_device_map, pi->port_id);
t3_port_intr_disable(sc, pi->port_id); t3_port_intr_disable(sc, pi->port_id);
taskqueue_drain(sc->tq, &sc->slow_intr_task); taskqueue_drain(sc->tq, &sc->slow_intr_task);
taskqueue_drain(sc->tq, &sc->ext_intr_task);
taskqueue_drain(sc->tq, &sc->tick_task); taskqueue_drain(sc->tq, &sc->tick_task);
PORT_LOCK(pi); PORT_LOCK(pi);
@ -2295,34 +2269,11 @@ cxgb_async_intr(void *data)
{ {
adapter_t *sc = data; adapter_t *sc = data;
if (cxgb_debug) t3_write_reg(sc, A_PL_INT_ENABLE0, 0);
device_printf(sc->dev, "cxgb_async_intr\n"); (void) t3_read_reg(sc, A_PL_INT_ENABLE0);
/*
* May need to sleep - defer to taskqueue
*/
taskqueue_enqueue(sc->tq, &sc->slow_intr_task); taskqueue_enqueue(sc->tq, &sc->slow_intr_task);
} }
static void
cxgb_ext_intr_handler(void *arg, int count)
{
adapter_t *sc = (adapter_t *)arg;
if (cxgb_debug)
printf("cxgb_ext_intr_handler\n");
t3_phy_intr_handler(sc);
/* Now reenable external interrupts */
ADAPTER_LOCK(sc);
if (sc->slow_intr_mask) {
sc->slow_intr_mask |= F_T3DBG;
t3_write_reg(sc, A_PL_INT_CAUSE0, F_T3DBG);
t3_write_reg(sc, A_PL_INT_ENABLE0, sc->slow_intr_mask);
}
ADAPTER_UNLOCK(sc);
}
static inline int static inline int
link_poll_needed(struct port_info *p) link_poll_needed(struct port_info *p)
{ {

View File

@ -910,6 +910,8 @@ sge_slow_intr_handler(void *arg, int ncount)
adapter_t *sc = arg; adapter_t *sc = arg;
t3_slow_intr_handler(sc); t3_slow_intr_handler(sc);
t3_write_reg(sc, A_PL_INT_ENABLE0, sc->slow_intr_mask);
(void) t3_read_reg(sc, A_PL_INT_ENABLE0);
} }
/** /**
@ -3168,8 +3170,11 @@ t3b_intr(void *data)
if (!map) if (!map)
return; return;
if (__predict_false(map & F_ERRINTR)) if (__predict_false(map & F_ERRINTR)) {
t3_write_reg(adap, A_PL_INT_ENABLE0, 0);
(void) t3_read_reg(adap, A_PL_INT_ENABLE0);
taskqueue_enqueue(adap->tq, &adap->slow_intr_task); taskqueue_enqueue(adap->tq, &adap->slow_intr_task);
}
mtx_lock(&q0->lock); mtx_lock(&q0->lock);
for_each_port(adap, i) for_each_port(adap, i)
@ -3197,8 +3202,11 @@ t3_intr_msi(void *data)
if (process_responses_gts(adap, &adap->sge.qs[i].rspq)) if (process_responses_gts(adap, &adap->sge.qs[i].rspq))
new_packets = 1; new_packets = 1;
mtx_unlock(&q0->lock); mtx_unlock(&q0->lock);
if (new_packets == 0) if (new_packets == 0) {
t3_write_reg(adap, A_PL_INT_ENABLE0, 0);
(void) t3_read_reg(adap, A_PL_INT_ENABLE0);
taskqueue_enqueue(adap->tq, &adap->slow_intr_task); taskqueue_enqueue(adap->tq, &adap->slow_intr_task);
}
} }
void void