aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ntb/ntb_transport.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2016-07-09 11:48:57 +0000
committerAlexander Motin <mav@FreeBSD.org>2016-07-09 11:48:57 +0000
commitf31eea5c49016579335b1a660771f9c3c767cc21 (patch)
treefee039fd87d0bc37855903c02cbd5a71f96dc2fb /sys/dev/ntb/ntb_transport.c
parentef48f663495c2fe1cc911cbec80e4043def9b855 (diff)
downloadsrc-f31eea5c49016579335b1a660771f9c3c767cc21.tar.gz
src-f31eea5c49016579335b1a660771f9c3c767cc21.zip
Bring some more order into link and qp state handling.
Do not touch scratchpad registers until link is reported up. Mask and do not handle doorbell events until respective qp is up.
Notes
Notes: svn path=/head/; revision=302492
Diffstat (limited to 'sys/dev/ntb/ntb_transport.c')
-rw-r--r--sys/dev/ntb/ntb_transport.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sys/dev/ntb/ntb_transport.c b/sys/dev/ntb/ntb_transport.c
index 17d2cb796c8a..318f73a46bd2 100644
--- a/sys/dev/ntb/ntb_transport.c
+++ b/sys/dev/ntb/ntb_transport.c
@@ -508,8 +508,6 @@ ntb_transport_init_queue(struct ntb_transport_ctx *nt, unsigned int qp_num)
STAILQ_INIT(&qp->rx_post_q);
STAILQ_INIT(&qp->rx_pend_q);
STAILQ_INIT(&qp->tx_free_q);
-
- callout_reset(&qp->link_work, 0, ntb_qp_link_work, qp);
}
void
@@ -598,7 +596,6 @@ ntb_transport_create_queue(void *data, device_t dev,
}
NTB_DB_CLEAR(ntb, 1ull << qp->qp_num);
- NTB_DB_CLEAR_MASK(ntb, 1ull << qp->qp_num);
return (qp);
}
@@ -967,7 +964,8 @@ ntb_transport_doorbell_callback(void *data, uint32_t vector)
if (test_bit(qp_num, &db_bits)) {
qp = &nt->qp_vec[qp_num];
- taskqueue_enqueue(qp->rxc_tq, &qp->rxc_db_work);
+ if (qp->link_is_up)
+ taskqueue_enqueue(qp->rxc_tq, &qp->rxc_db_work);
}
vec_mask &= ~(1ull << qp_num);
@@ -1216,6 +1214,7 @@ ntb_qp_link_work(void *arg)
if (qp->event_handler != NULL)
qp->event_handler(qp->cb_data, NTB_LINK_UP);
+ NTB_DB_CLEAR_MASK(ntb, 1ull << qp->qp_num);
taskqueue_enqueue(qp->rxc_tq, &qp->rxc_db_work);
} else if (nt->link_is_up)
callout_reset(&qp->link_work,
@@ -1272,6 +1271,7 @@ ntb_qp_link_down_reset(struct ntb_transport_qp *qp)
{
qp->link_is_up = false;
+ NTB_DB_SET_MASK(qp->ntb, 1ull << qp->qp_num);
qp->tx_index = qp->rx_index = 0;
qp->tx_bytes = qp->rx_bytes = 0;
@@ -1287,17 +1287,12 @@ ntb_qp_link_down_reset(struct ntb_transport_qp *qp)
static void
ntb_qp_link_cleanup(struct ntb_transport_qp *qp)
{
- struct ntb_transport_ctx *nt = qp->transport;
callout_drain(&qp->link_work);
ntb_qp_link_down_reset(qp);
if (qp->event_handler != NULL)
qp->event_handler(qp->cb_data, NTB_LINK_DOWN);
-
- if (nt->link_is_up)
- callout_reset(&qp->link_work,
- NTB_LINK_DOWN_TIMEOUT * hz / 1000, ntb_qp_link_work, qp);
}
/* Link commanded down */