From owner-svn-src-head@freebsd.org Wed Dec 28 04:47:18 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 69F95C9136A; Wed, 28 Dec 2016 04:47:18 +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 147FD1BCB; Wed, 28 Dec 2016 04:47:18 +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 uBS4lHqQ093641; Wed, 28 Dec 2016 04:47:17 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBS4lHok093639; Wed, 28 Dec 2016 04:47:17 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201612280447.uBS4lHok093639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 28 Dec 2016 04:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310658 - 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.23 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: Wed, 28 Dec 2016 04:47:18 -0000 Author: sephe Date: Wed Dec 28 04:47:17 2016 New Revision: 310658 URL: https://svnweb.freebsd.org/changeset/base/310658 Log: hyperv/hn: Factor out function to set rxfilter. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8928 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 04:35:52 2016 (r310657) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Dec 28 04:47:17 2016 (r310658) @@ -333,6 +333,7 @@ static void hn_link_status(struct hn_s static int hn_create_rx_data(struct hn_softc *, int); static void hn_destroy_rx_data(struct hn_softc *); static int hn_check_iplen(const struct mbuf *, int); +static int hn_set_rxfilter(struct hn_softc *, uint32_t); static int hn_rxfilter_config(struct hn_softc *); #ifndef RSS static int hn_rss_reconfig(struct hn_softc *); @@ -684,11 +685,25 @@ do { \ #endif /* INET6 || INET */ static int +hn_set_rxfilter(struct hn_softc *sc, uint32_t filter) +{ + int error = 0; + + HN_LOCK_ASSERT(sc); + + if (sc->hn_rx_filter != filter) { + error = hn_rndis_set_rxfilter(sc, filter); + if (!error) + sc->hn_rx_filter = filter; + } + return (error); +} + +static int hn_rxfilter_config(struct hn_softc *sc) { struct ifnet *ifp = sc->hn_ifp; uint32_t filter; - int error = 0; HN_LOCK_ASSERT(sc); @@ -703,13 +718,7 @@ hn_rxfilter_config(struct hn_softc *sc) !TAILQ_EMPTY(&ifp->if_multiaddrs)) filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; } - - if (sc->hn_rx_filter != filter) { - error = hn_rndis_set_rxfilter(sc, filter); - if (!error) - sc->hn_rx_filter = filter; - } - return (error); + return (hn_set_rxfilter(sc, filter)); } static void @@ -4817,8 +4826,7 @@ hn_suspend_data(struct hn_softc *sc) /* * Disable RX by clearing RX filter. */ - sc->hn_rx_filter = NDIS_PACKET_TYPE_NONE; - hn_rndis_set_rxfilter(sc, sc->hn_rx_filter); + hn_set_rxfilter(sc, NDIS_PACKET_TYPE_NONE); /* * Give RNDIS enough time to flush all pending data packets.