From owner-svn-src-head@freebsd.org Fri Aug 12 07:14:42 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B0E5BB62BB; Fri, 12 Aug 2016 07:14:42 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FAF31A66; Fri, 12 Aug 2016 07:14:41 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7C7EfdB011024; Fri, 12 Aug 2016 07:14:41 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7C7Efuo011022; Fri, 12 Aug 2016 07:14:41 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608120714.u7C7Efuo011022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Fri, 12 Aug 2016 07:14:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303989 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Aug 2016 07:14:42 -0000 Author: sephe Date: Fri Aug 12 07:14:40 2016 New Revision: 303989 URL: https://svnweb.freebsd.org/changeset/base/303989 Log: hyperv/hn: Simplify NDIS configuration. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7466 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/netvsc/if_hnreg.h Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Aug 12 07:03:58 2016 (r303988) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Fri Aug 12 07:14:40 2016 (r303989) @@ -536,33 +536,19 @@ hv_nv_negotiate_nvsp_protocol(struct hn_ static int hv_nv_send_ndis_config(struct hn_softc *sc, uint32_t mtu) { - netvsc_dev *net_dev; - nvsp_msg *init_pkt; - int ret; - - net_dev = hv_nv_get_outbound_net_device(sc); - if (!net_dev) - return (-ENODEV); - - /* - * Set up configuration packet, write MTU - * Indicate we are capable of handling VLAN tags - */ - init_pkt = &net_dev->channel_init_packet; - memset(init_pkt, 0, sizeof(nvsp_msg)); - init_pkt->hdr.msg_type = nvsp_msg_2_type_send_ndis_config; - init_pkt->msgs.vers_2_msgs.send_ndis_config.mtu = mtu; - init_pkt-> - msgs.vers_2_msgs.send_ndis_config.capabilities.u1.u2.ieee8021q - = 1; - - /* Send the configuration packet */ - ret = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, - init_pkt, sizeof(nvsp_msg), (uint64_t)(uintptr_t)&hn_send_ctx_none); - if (ret != 0) - return (-EINVAL); + struct hn_nvs_ndis_conf conf; + int error; - return (0); + memset(&conf, 0, sizeof(conf)); + conf.nvs_type = HN_NVS_TYPE_NDIS_CONF; + conf.nvs_mtu = mtu; + conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; + + error = vmbus_chan_send(sc->hn_prichan, VMBUS_CHANPKT_TYPE_INBAND, 0, + &conf, sizeof(conf), (uint64_t)(uintptr_t)&hn_send_ctx_none); + if (error) + if_printf(sc->hn_ifp, "send nvs ndis conf failed: %d\n", error); + return (error); } /* Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnreg.h Fri Aug 12 07:03:58 2016 (r303988) +++ head/sys/dev/hyperv/netvsc/if_hnreg.h Fri Aug 12 07:14:40 2016 (r303989) @@ -36,6 +36,7 @@ #define HN_NVS_TYPE_INIT 1 #define HN_NVS_TYPE_INIT_RESP 2 +#define HN_NVS_TYPE_NDIS_CONF 125 /* * Any size less than this one will _not_ work, e.g. hn_nvs_init @@ -59,4 +60,17 @@ struct hn_nvs_init_resp { uint32_t nvs_status; /* HN_NVS_STATUS_ */ } __packed; +/* No reponse */ +struct hn_nvs_ndis_conf { + uint32_t nvs_type; /* HN_NVS_TYPE_NDIS_CONF */ + uint32_t nvs_mtu; + uint32_t nvs_rsvd; + uint64_t nvs_caps; /* HN_NVS_NDIS_CONF_ */ + uint8_t nvs_rsvd1[12]; +} __packed; +CTASSERT(sizeof(struct hn_nvs_ndis_conf) >= HN_NVS_REQSIZE_MIN); + +#define HN_NVS_NDIS_CONF_SRIOV 0x0004 +#define HN_NVS_NDIS_CONF_VLAN 0x0008 + #endif /* !_IF_HNREG_H_ */