Date: Thu, 18 Aug 2016 10:43:23 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r304387 - stable/10/sys/dev/ntb Message-ID: <201608181043.u7IAhNEv026150@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Aug 18 10:43:23 2016 New Revision: 304387 URL: https://svnweb.freebsd.org/changeset/base/304387 Log: MFC r302492: 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. Modified: stable/10/sys/dev/ntb/ntb_transport.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/ntb/ntb_transport.c ============================================================================== --- stable/10/sys/dev/ntb/ntb_transport.c Thu Aug 18 10:42:48 2016 (r304386) +++ stable/10/sys/dev/ntb/ntb_transport.c Thu Aug 18 10:43:23 2016 (r304387) @@ -512,8 +512,6 @@ ntb_transport_init_queue(struct ntb_tran 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 @@ -602,7 +600,6 @@ ntb_transport_create_queue(void *data, d } NTB_DB_CLEAR(ntb, 1ull << qp->qp_num); - NTB_DB_CLEAR_MASK(ntb, 1ull << qp->qp_num); return (qp); } @@ -971,7 +968,8 @@ ntb_transport_doorbell_callback(void *da 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); @@ -1220,6 +1218,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, @@ -1276,6 +1275,7 @@ ntb_qp_link_down_reset(struct ntb_transp { 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; @@ -1291,17 +1291,12 @@ ntb_qp_link_down_reset(struct ntb_transp 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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608181043.u7IAhNEv026150>