From owner-svn-src-all@freebsd.org Tue Aug 16 07:45:36 2016 Return-Path: Delivered-To: svn-src-all@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 A1CE0BBBEDA; Tue, 16 Aug 2016 07:45:36 +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 598F31D60; Tue, 16 Aug 2016 07:45:36 +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 u7G7jZA9072851; Tue, 16 Aug 2016 07:45:35 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7G7jZuC072849; Tue, 16 Aug 2016 07:45:35 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201608160745.u7G7jZuC072849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 16 Aug 2016 07:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r304206 - 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-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 07:45:36 -0000 Author: sephe Date: Tue Aug 16 07:45:35 2016 New Revision: 304206 URL: https://svnweb.freebsd.org/changeset/base/304206 Log: hyperv/hn: Simplify RNDIS message checks on RX path. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7502 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 Tue Aug 16 07:37:02 2016 (r304205) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Aug 16 07:45:35 2016 (r304206) @@ -847,19 +847,18 @@ hv_nv_on_receive(netvsc_dev *net_dev, st struct vmbus_channel *chan, const struct vmbus_chanpkt_hdr *pkthdr) { const struct vmbus_chanpkt_rxbuf *pkt; - const nvsp_msg *nvsp_msg_pkt; + const struct hn_nvs_hdr *nvs_hdr; netvsc_packet vsc_pkt; netvsc_packet *net_vsc_pkt = &vsc_pkt; int count = 0; int i = 0; int status = nvsp_status_success; - nvsp_msg_pkt = VMBUS_CHANPKT_CONST_DATA(pkthdr); - - /* Make sure this is a valid nvsp packet */ - if (nvsp_msg_pkt->hdr.msg_type != nvsp_msg_1_type_send_rndis_pkt) { - if_printf(rxr->hn_ifp, "packet hdr type %u is invalid!\n", - nvsp_msg_pkt->hdr.msg_type); + /* Make sure that this is a RNDIS message. */ + nvs_hdr = VMBUS_CHANPKT_CONST_DATA(pkthdr); + if (__predict_false(nvs_hdr->nvs_type != HN_NVS_TYPE_RNDIS)) { + if_printf(rxr->hn_ifp, "nvs type %u, not RNDIS\n", + nvs_hdr->nvs_type); return; } Modified: head/sys/dev/hyperv/netvsc/if_hnreg.h ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hnreg.h Tue Aug 16 07:37:02 2016 (r304205) +++ head/sys/dev/hyperv/netvsc/if_hnreg.h Tue Aug 16 07:45:35 2016 (r304206) @@ -69,6 +69,11 @@ */ #define HN_NVS_REQSIZE_MIN 32 +/* NVS message common header */ +struct hn_nvs_hdr { + uint32_t nvs_type; +} __packed; + struct hn_nvs_init { uint32_t nvs_type; /* HN_NVS_TYPE_INIT */ uint32_t nvs_ver_min;