svn commit: r307504 - stable/11/sys/dev/hyperv/netvsc
Sepherosa Ziehau
sephe at FreeBSD.org
Mon Oct 17 08:25:48 UTC 2016
Author: sephe
Date: Mon Oct 17 08:25:47 2016
New Revision: 307504
URL: https://svnweb.freebsd.org/changeset/base/307504
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/11/sys/dev/hyperv/netvsc/hv_net_vsc.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c
==============================================================================
--- stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:23:30 2016 (r307503)
+++ stable/11/sys/dev/hyperv/netvsc/hv_net_vsc.c Mon Oct 17 08:25:47 2016 (r307504)
@@ -470,12 +470,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;
@@ -493,6 +491,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;
@@ -522,47 +538,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);
}
More information about the svn-src-stable-11
mailing list