aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ntb/ntb_transport.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2017-08-31 10:53:10 +0000
committerAlexander Motin <mav@FreeBSD.org>2017-08-31 10:53:10 +0000
commitba4b25cbba5f8809c25fa95873129a630bdda117 (patch)
tree40b401a3ee78f48cf00ec3c1b9c5b087f63d93f1 /sys/dev/ntb/ntb_transport.c
parentd4c2de2e0bad44d204797c5adfc300bb1b26f6db (diff)
downloadsrc-ba4b25cbba5f8809c25fa95873129a630bdda117.tar.gz
src-ba4b25cbba5f8809c25fa95873129a630bdda117.zip
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
Notes
Notes: svn path=/head/; revision=323046
Diffstat (limited to 'sys/dev/ntb/ntb_transport.c')
-rw-r--r--sys/dev/ntb/ntb_transport.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/ntb/ntb_transport.c b/sys/dev/ntb/ntb_transport.c
index 3394adf5a87e..521fd058c320 100644
--- a/sys/dev/ntb/ntb_transport.c
+++ b/sys/dev/ntb/ntb_transport.c
@@ -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 *nt)
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) {
@@ -1288,9 +1291,6 @@ ntb_transport_link_cleanup(struct ntb_transport_ctx *nt)
}
}
- if (!nt->link_is_up)
- callout_drain(&nt->link_work);
-
/*
* The scratchpad registers keep the values if the remote side
* goes down, blast them now to give them a sane value the next