Author: sephe
Date: Tue Sep 20 05:45:18 2016
New Revision: 306014
URL: https://svnweb.freebsd.org/changeset/base/306014

Log:
  hyperv/hn: Let the caller of hn_nvs_doinit() do the error logging.
  
  So that NVS version probing failure does not look too scary.
  
  MFC after:    1 week
  Sponsored by: Microsoft
  Differential Revision:        https://reviews.freebsd.org/D7950

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c     Tue Sep 20 05:26:40 2016        
(r306013)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c     Tue Sep 20 05:45:18 2016        
(r306014)
@@ -444,8 +444,15 @@ hn_nvs_doinit(struct hn_softc *sc, uint3
        vmbus_xact_put(xact);
 
        if (status != HN_NVS_STATUS_OK) {
-               if_printf(sc->hn_ifp, "nvs init failed for ver 0x%x\n",
-                   nvs_ver);
+               if (bootverbose) {
+                       /*
+                        * Caller may try another NVS version, and will log
+                        * error if there are no more NVS versions to try,
+                        * so don't bark out loud here.
+                        */
+                       if_printf(sc->hn_ifp, "nvs init failed for ver 0x%x\n",
+                           nvs_ver);
+               }
                return (EINVAL);
        }
        return (0);
@@ -499,7 +506,7 @@ hn_nvs_init_ndis(struct hn_softc *sc)
 static int
 hn_nvs_init(struct hn_softc *sc)
 {
-       int i;
+       int i, error;
 
        if (device_is_attached(sc->hn_dev)) {
                /*
@@ -511,15 +518,19 @@ hn_nvs_init(struct hn_softc *sc)
                            HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver),
                            HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver));
                }
-               return (hn_nvs_doinit(sc, sc->hn_nvs_ver));
+
+               error = hn_nvs_doinit(sc, sc->hn_nvs_ver);
+               if (error) {
+                       if_printf(sc->hn_ifp, "reinit NVS version 0x%x "
+                           "failed: %d\n", sc->hn_nvs_ver, error);
+               }
+               return (error);
        }
 
        /*
         * Find the supported NVS version and set NDIS version accordingly.
         */
        for (i = 0; i < nitems(hn_nvs_version); ++i) {
-               int error;
-
                error = hn_nvs_doinit(sc, hn_nvs_version[i]);
                if (!error) {
                        sc->hn_nvs_ver = hn_nvs_version[i];
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to