Author: sephe
Date: Fri Aug 19 03:32:04 2016
New Revision: 304441
URL: https://svnweb.freebsd.org/changeset/base/304441

Log:
  hyperv/hn: Move NVS version to softc
  
  MFC after:    1 week
  Sponsored by: Microsoft
  Differential Revision:        https://reviews.freebsd.org/D7553

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c     Fri Aug 19 01:27:24 2016        
(r304440)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c     Fri Aug 19 03:32:04 2016        
(r304441)
@@ -593,10 +593,11 @@ hv_nv_connect_to_vsp(struct hn_softc *sc
        for (i = protocol_number - 1; i >= 0; i--) {
                if (hv_nv_negotiate_nvsp_protocol(sc, net_dev,
                    protocol_list[i]) == 0) {
-                       net_dev->nvsp_version = protocol_list[i];
-                       if (bootverbose)
-                               device_printf(dev, "Netvsc: got version 0x%x\n",
-                                   net_dev->nvsp_version);
+                       sc->hn_nvs_ver = protocol_list[i];
+                       if (bootverbose) {
+                               device_printf(dev, "NVS version 0x%x\n",
+                                   sc->hn_nvs_ver);
+                       }
                        break;
                }
        }
@@ -612,7 +613,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc
         * Set the MTU if supported by this NVSP protocol version
         * This needs to be right after the NVSP init message per Haiyang
         */
-       if (net_dev->nvsp_version >= NVSP_PROTOCOL_VERSION_2)
+       if (sc->hn_nvs_ver >= NVSP_PROTOCOL_VERSION_2)
                ret = hv_nv_send_ndis_config(sc, ifp->if_mtu);
 
        /*
@@ -622,7 +623,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc
        memset(&ndis, 0, sizeof(ndis));
        ndis.nvs_type = HN_NVS_TYPE_NDIS_INIT;
        ndis.nvs_ndis_major = NDIS_VERSION_MAJOR_6;
-       if (net_dev->nvsp_version <= NVSP_PROTOCOL_VERSION_4)
+       if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4)
                ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_1;
        else
                ndis.nvs_ndis_minor = NDIS_VERSION_MINOR_30;
@@ -636,7 +637,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc
        }
 
        /* Post the big receive buffer to NetVSP */
-       if (net_dev->nvsp_version <= NVSP_PROTOCOL_VERSION_2)
+       if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_2)
                net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY;
        else
                net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE;

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h     Fri Aug 19 01:27:24 2016        
(r304440)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h     Fri Aug 19 03:32:04 2016        
(r304441)
@@ -237,8 +237,6 @@ typedef struct netvsc_dev_ {
        void                                    *extension;
 
        uint8_t                                 destroy;
-       /* Negotiated NVSP version */
-       uint32_t                                nvsp_version;
 
        uint32_t                                num_channel;
 
@@ -400,6 +398,7 @@ typedef struct hn_softc {
        struct sysctl_oid *hn_tx_sysctl_tree;
        struct sysctl_oid *hn_rx_sysctl_tree;
        struct vmbus_xact_ctx *hn_xact;
+       uint32_t        hn_nvs_ver;
 } hn_softc_t;
 
 /*

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Aug 19 01:27:24 
2016        (r304440)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Aug 19 03:32:04 
2016        (r304441)
@@ -611,6 +611,10 @@ netvsc_attach(device_t dev)
            hn_tx_chimney_size < sc->hn_tx_chimney_max)
                hn_set_tx_chimney_size(sc, hn_tx_chimney_size);
 
+       SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
+           SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+           "nvs_version", CTLFLAG_RD, &sc->hn_nvs_ver, 0, "NVS version");
+
        return (0);
 failed:
        hn_destroy_tx_data(sc);

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c        Fri Aug 19 01:27:24 
2016        (r304440)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c        Fri Aug 19 03:32:04 
2016        (r304441)
@@ -349,11 +349,10 @@ hv_rf_send_offload_request(struct hn_sof
        rndis_device *rndis_dev;
        device_t dev = sc->hn_dev;
        netvsc_dev *net_dev = sc->net_dev;
-       uint32_t vsp_version = net_dev->nvsp_version;
        uint32_t extlen = sizeof(rndis_offload_params);
        int ret;
 
-       if (vsp_version <= NVSP_PROTOCOL_VERSION_4) {
+       if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_4) {
                extlen = VERSION_4_OFFLOAD_SIZE;
                /* On NVSP_PROTOCOL_VERSION_4 and below, we do not support
                 * UDP checksum offload.
@@ -1116,7 +1115,7 @@ hv_rf_on_device_add(struct hn_softc *sc,
        dev_info->link_state = rndis_dev->link_status;
 
        net_dev->num_channel = 1;
-       if (net_dev->nvsp_version < NVSP_PROTOCOL_VERSION_5 || nchan == 1)
+       if (sc->hn_nvs_ver < NVSP_PROTOCOL_VERSION_5 || nchan == 1)
                return (0);
 
        memset(&rsscaps, 0, rsscaps_size);
_______________________________________________
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