From owner-svn-src-all@freebsd.org Thu Sep 8 06:06:55 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 A1133BD032B; Thu, 8 Sep 2016 06:06:55 +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 5B22BB38; Thu, 8 Sep 2016 06:06:55 +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 u8866sjK079637; Thu, 8 Sep 2016 06:06:54 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8866sGQ079636; Thu, 8 Sep 2016 06:06:54 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201609080606.u8866sGQ079636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 8 Sep 2016 06:06:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305579 - 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.23 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: Thu, 08 Sep 2016 06:06:55 -0000 Author: sephe Date: Thu Sep 8 06:06:54 2016 New Revision: 305579 URL: https://svnweb.freebsd.org/changeset/base/305579 Log: hyperv/hn: Push RXBUF size adjustment down. It is not used in other places. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7806 Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 05:27:43 2016 (r305578) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Thu Sep 8 06:06:54 2016 (r305579) @@ -58,7 +58,7 @@ MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper * Forward declarations */ static int hv_nv_init_send_buffer_with_net_vsp(struct hn_softc *sc); -static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *, int); +static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *); static int hv_nv_destroy_send_buffer(struct hn_softc *sc); static int hv_nv_destroy_rx_buffer(struct hn_softc *sc); static int hv_nv_connect_to_vsp(struct hn_softc *sc); @@ -154,17 +154,22 @@ hn_nvs_req_send(struct hn_softc *sc, voi * Hyper-V extensible switch and the synthetic data path. */ static int -hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc, int rxbuf_size) +hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *sc) { struct vmbus_xact *xact = NULL; struct hn_nvs_rxbuf_conn *conn; const struct hn_nvs_rxbuf_connresp *resp; size_t resp_len; uint32_t status; - int error; + int error, rxbuf_size; - KASSERT(rxbuf_size <= NETVSC_RECEIVE_BUFFER_SIZE, - ("invalid rxbuf size %d", rxbuf_size)); + /* + * Limit RXBUF size for old NVS. + */ + if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_2) + rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; + else + rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE; /* * Connect the RXBUF GPADL to the primary channel. @@ -496,7 +501,6 @@ hv_nv_connect_to_vsp(struct hn_softc *sc device_t dev = sc->hn_dev; struct ifnet *ifp = sc->hn_ifp; struct hn_nvs_ndis_init ndis; - int rxbuf_size; /* * Negotiate the NVSP version. Try the latest NVSP first. @@ -548,13 +552,7 @@ hv_nv_connect_to_vsp(struct hn_softc *sc goto cleanup; } - /* Post the big receive buffer to NetVSP */ - if (sc->hn_nvs_ver <= NVSP_PROTOCOL_VERSION_2) - rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY; - else - rxbuf_size = NETVSC_RECEIVE_BUFFER_SIZE; - - ret = hv_nv_init_rx_buffer_with_net_vsp(sc, rxbuf_size); + ret = hv_nv_init_rx_buffer_with_net_vsp(sc); if (ret == 0) ret = hv_nv_init_send_buffer_with_net_vsp(sc);