Author: mav
Date: Thu Sep  7 12:50:21 2017
New Revision: 323264
URL: https://svnweb.freebsd.org/changeset/base/323264

Log:
  MFC r323047: Make ntb_set_ctx() always generate fake link event.
  
  It allows application driver get initial link state without racing with
  hardware interrupts, thanks to the context rmlock held here.

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

Modified: stable/11/sys/dev/ntb/ntb.c
==============================================================================
--- stable/11/sys/dev/ntb/ntb.c Thu Sep  7 10:56:50 2017        (r323263)
+++ stable/11/sys/dev/ntb/ntb.c Thu Sep  7 12:50:21 2017        (r323264)
@@ -264,6 +264,13 @@ ntb_set_ctx(device_t ntb, void *ctx, const struct ntb_
        }
        nc->ctx = ctx;
        nc->ctx_ops = ctx_ops;
+
+       /*
+        * If applicaiton driver asks for link events, generate fake one now
+        * to let it update link state without races while we hold the lock.
+        */
+       if (ctx_ops->link_event != NULL)
+               ctx_ops->link_event(ctx);
        rm_wunlock(&nc->ctx_lock);
 
        return (0);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to