svn commit: r323265 - stable/11/sys/dev/ntb

Alexander Motin mav at FreeBSD.org
Thu Sep 7 12:51:40 UTC 2017


Author: mav
Date: Thu Sep  7 12:51:39 2017
New Revision: 323265
URL: https://svnweb.freebsd.org/changeset/base/323265

Log:
  MFC r323046: 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.

Modified:
  stable/11/sys/dev/ntb/ntb_transport.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ntb/ntb_transport.c
==============================================================================
--- stable/11/sys/dev/ntb/ntb_transport.c	Thu Sep  7 12:50:21 2017	(r323264)
+++ stable/11/sys/dev/ntb/ntb_transport.c	Thu Sep  7 12:51:39 2017	(r323265)
@@ -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)
@@ -1274,6 +1274,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) {
@@ -1282,9 +1285,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


More information about the svn-src-all mailing list