Date: Thu, 31 Aug 2017 10:53:11 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323046 - head/sys/dev/ntb Message-ID: <201708311053.v7VArBTk071720@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Aug 31 10:53:10 2017 New Revision: 323046 URL: https://svnweb.freebsd.org/changeset/base/323046 Log: Make ntb_transport(4) ready receive early link events. Those events may be reported as soon as callback is registered, if the link is enabled by hardware or some other application. While there, clean link_is_up variable on link down event. MFC after: 1 week Modified: head/sys/dev/ntb/ntb_transport.c Modified: head/sys/dev/ntb/ntb_transport.c ============================================================================== --- head/sys/dev/ntb/ntb_transport.c Thu Aug 31 09:08:06 2017 (r323045) +++ head/sys/dev/ntb/ntb_transport.c Thu Aug 31 10:53:10 2017 (r323046) @@ -442,12 +442,12 @@ ntb_transport_attach(device_t dev) callout_init(&nt->link_work, 0); callout_init(&nt->link_watchdog, 0); TASK_INIT(&nt->link_cleanup, 0, ntb_transport_link_cleanup_work, nt); + nt->link_is_up = false; rc = ntb_set_ctx(dev, nt, &ntb_transport_ops); if (rc != 0) goto err; - nt->link_is_up = false; ntb_link_enable(dev, NTB_SPEED_AUTO, NTB_WIDTH_AUTO); if (enable_xeon_watchdog != 0) @@ -1279,6 +1279,9 @@ ntb_transport_link_cleanup(struct ntb_transport_ctx *n struct ntb_transport_qp *qp; int i; + callout_drain(&nt->link_work); + nt->link_is_up = 0; + /* Pass along the info to any clients */ for (i = 0; i < nt->qp_count; i++) { if ((nt->qp_bitmap & (1 << i)) != 0) { @@ -1287,9 +1290,6 @@ ntb_transport_link_cleanup(struct ntb_transport_ctx *n callout_drain(&qp->link_work); } } - - if (!nt->link_is_up) - callout_drain(&nt->link_work); /* * The scratchpad registers keep the values if the remote side
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708311053.v7VArBTk071720>