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
This commit is contained in:
parent
93ec89c358
commit
3882782295
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user