Author: sephe
Date: Thu Oct 13 08:06:49 2016
New Revision: 307202
URL: https://svnweb.freebsd.org/changeset/base/307202

Log:
  MFC 305586,305587
  
  305586
      hyperv/hn: Function renaming.
  
      While I'm here, remove obvious comment.
  
      Sponsored by:   Microsoft
      Differential Revision:  https://reviews.freebsd.org/D7810
  
  305587
      hyperv/hn: Factor out NVS NDIS initialization
  
      Sponsored by:   Microsoft
      Differential Revision:  https://reviews.freebsd.org/D7811

Modified:
  stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c
==============================================================================
--- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c        Thu Oct 13 08:03:48 
2016        (r307201)
+++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.c        Thu Oct 13 08:06:49 
2016        (r307202)
@@ -469,12 +469,10 @@ hn_nvs_doinit(struct hn_softc *sc, uint3
 }
 
 /*
- * Send NDIS version 2 config packet containing MTU.
- *
- * Not valid for NDIS version 1.
+ * Configure MTU and enable VLAN.
  */
 static int
-hv_nv_send_ndis_config(struct hn_softc *sc, uint32_t mtu)
+hn_nvs_conf_ndis(struct hn_softc *sc, int mtu)
 {
        struct hn_nvs_ndis_conf conf;
        int error;
@@ -492,6 +490,24 @@ hv_nv_send_ndis_config(struct hn_softc *
 }
 
 static int
+hn_nvs_init_ndis(struct hn_softc *sc)
+{
+       struct hn_nvs_ndis_init ndis;
+       int error;
+
+       memset(&ndis, 0, sizeof(ndis));
+       ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT;
+       ndis.nvs_ndis_major = HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver);
+       ndis.nvs_ndis_minor = HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver);
+
+       /* NOTE: No response. */
+       error = hn_nvs_req_send(sc, &ndis, sizeof(ndis));
+       if (error)
+               if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", error);
+       return (error);
+}
+
+static int
 hn_nvs_init(struct hn_softc *sc)
 {
        int i;
@@ -521,47 +537,37 @@ hn_nvs_init(struct hn_softc *sc)
        return (ENXIO);
 }
 
-/*
- * Net VSC connect to VSP
- */
 static int
 hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu)
 {
-       int ret = 0;
-       struct hn_nvs_ndis_init ndis;
+       int ret;
 
+       /*
+        * Initialize NVS.
+        */
        ret = hn_nvs_init(sc);
        if (ret != 0)
                return (ret);
 
-       /*
-        * Set the MTU if supported by this NVSP protocol version
-        * This needs to be right after the NVSP init message per Haiyang
-        */
-       if (sc->hn_nvs_ver >= HN_NVS_VERSION_2)
-               ret = hv_nv_send_ndis_config(sc, mtu);
+       if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) {
+               /*
+                * Configure NDIS before initializing it.
+                */
+               ret = hn_nvs_conf_ndis(sc, mtu);
+               if (ret != 0)
+                       return (ret);
+       }
 
        /*
         * Initialize NDIS.
         */
-
-       memset(&ndis, 0, sizeof(ndis));
-       ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT;
-       ndis.nvs_ndis_major = HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver);
-       ndis.nvs_ndis_minor = HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver);
-
-       /* NOTE: No response. */
-       ret = hn_nvs_req_send(sc, &ndis, sizeof(ndis));
-       if (ret != 0) {
-               if_printf(sc->hn_ifp, "send nvs ndis init failed: %d\n", ret);
-               goto cleanup;
-       }
+       ret = hn_nvs_init_ndis(sc);
+       if (ret != 0)
+               return (ret);
 
        ret = hv_nv_init_rx_buffer_with_net_vsp(sc);
        if (ret == 0)
                ret = hv_nv_init_send_buffer_with_net_vsp(sc);
-
-cleanup:
        return (ret);
 }
 
_______________________________________________
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