From owner-svn-src-head@freebsd.org Tue Jul 19 05:57:21 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 9CD3CB9D966; Tue, 19 Jul 2016 05:57:21 +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 4A3EA153A; Tue, 19 Jul 2016 05:57:21 +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 u6J5vK0I022757; Tue, 19 Jul 2016 05:57:20 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6J5vJJN022750; Tue, 19 Jul 2016 05:57:19 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607190557.u6J5vJJN022750@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 19 Jul 2016 05:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303021 - in head/sys/dev/hyperv: include netvsc storvsc utilities vmbus 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: Tue, 19 Jul 2016 05:57:21 -0000 Author: sephe Date: Tue Jul 19 05:57:19 2016 New Revision: 303021 URL: https://svnweb.freebsd.org/changeset/base/303021 Log: hyperv/vmbus: Function rename MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7230 Modified: head/sys/dev/hyperv/include/hyperv.h head/sys/dev/hyperv/include/vmbus.h head/sys/dev/hyperv/netvsc/hv_net_vsc.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/utilities/hv_util.c head/sys/dev/hyperv/vmbus/hv_channel.c Modified: head/sys/dev/hyperv/include/hyperv.h ============================================================================== --- head/sys/dev/hyperv/include/hyperv.h Tue Jul 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/include/hyperv.h Tue Jul 19 05:57:19 2016 (r303021) @@ -267,20 +267,6 @@ typedef struct hv_vmbus_channel { #define VMBUS_CHAN_ST_OPENED_SHIFT 0 #define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) -static inline void -hv_set_channel_read_state(hv_vmbus_channel* channel, boolean_t on) -{ - if (!on) - channel->ch_flags &= ~VMBUS_CHAN_FLAG_BATCHREAD; - else - channel->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; -} - -int hv_vmbus_channel_open(struct hv_vmbus_channel *chan, - int txbr_size, int rxbr_size, const void *udata, int udlen, - vmbus_chan_callback_t cb, void *cbarg); -void hv_vmbus_channel_close(hv_vmbus_channel *channel); - /** * @brief Get physical address from virtual */ Modified: head/sys/dev/hyperv/include/vmbus.h ============================================================================== --- head/sys/dev/hyperv/include/vmbus.h Tue Jul 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/include/vmbus.h Tue Jul 19 05:57:19 2016 (r303021) @@ -89,6 +89,11 @@ struct vmbus_chanpkt_rxbuf { struct hv_vmbus_channel; +int vmbus_chan_open(struct hv_vmbus_channel *chan, + int txbr_size, int rxbr_size, const void *udata, int udlen, + vmbus_chan_callback_t cb, void *cbarg); +void vmbus_chan_close(struct hv_vmbus_channel *chan); + int vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, bus_addr_t paddr, int size, uint32_t *gpadl); int vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, @@ -98,6 +103,7 @@ void vmbus_chan_cpu_set(struct hv_vmbus_ void vmbus_chan_cpu_rr(struct hv_vmbus_channel *chan); struct hv_vmbus_channel * vmbus_chan_cpu2chan(struct hv_vmbus_channel *chan, int cpu); +void vmbus_chan_set_readbatch(struct hv_vmbus_channel *chan, bool on); struct hv_vmbus_channel ** vmbus_subchan_get(struct hv_vmbus_channel *pri_chan, int subchan_cnt); Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Jul 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c Tue Jul 19 05:57:19 2016 (r303021) @@ -645,7 +645,7 @@ hv_nv_subchan_attach(struct hv_vmbus_cha { chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK); - hv_vmbus_channel_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, + vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hv_nv_on_channel_callback, chan); } @@ -675,7 +675,7 @@ hv_nv_on_device_add(struct hn_softc *sc, /* * Open the channel */ - ret = hv_vmbus_channel_open(chan, + ret = vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0, hv_nv_on_channel_callback, chan); if (ret != 0) { @@ -695,7 +695,7 @@ hv_nv_on_device_add(struct hn_softc *sc, close: /* Now, we can close the channel safely */ free(chan->hv_chan_rdbuf, M_NETVSC); - hv_vmbus_channel_close(chan); + vmbus_chan_close(chan); cleanup: /* @@ -726,7 +726,7 @@ hv_nv_on_device_remove(struct hn_softc * /* Now, we can close the channel safely */ free(sc->hn_prichan->hv_chan_rdbuf, M_NETVSC); - hv_vmbus_channel_close(sc->hn_prichan); + vmbus_chan_close(sc->hn_prichan); sema_destroy(&net_dev->channel_init_sema); free(net_dev, M_NETVSC); Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Jul 19 05:57:19 2016 (r303021) @@ -318,7 +318,7 @@ storvsc_subchan_attach(struct storvsc_so new_channel->hv_chan_priv1 = sc; vmbus_chan_cpu_rr(new_channel); - ret = hv_vmbus_channel_open(new_channel, + ret = vmbus_chan_open(new_channel, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, (void *)&props, @@ -577,7 +577,7 @@ hv_storvsc_connect_vsp(struct storvsc_so */ KASSERT(sc->hs_chan->hv_chan_priv1 == sc, ("invalid chan priv1")); vmbus_chan_cpu_rr(sc->hs_chan); - ret = hv_vmbus_channel_open( + ret = vmbus_chan_open( sc->hs_chan, sc->hs_drv_props->drv_ringbuffer_size, sc->hs_drv_props->drv_ringbuffer_size, @@ -1100,7 +1100,7 @@ storvsc_detach(device_t dev) * under the protection of the incoming channel lock. */ - hv_vmbus_channel_close(sc->hs_chan); + vmbus_chan_close(sc->hs_chan); mtx_lock(&sc->hs_lock); while (!LIST_EMPTY(&sc->hs_free_list)) { Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Tue Jul 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/utilities/hv_util.c Tue Jul 19 05:57:19 2016 (r303021) @@ -40,6 +40,7 @@ #include #include +#include #include "hv_util.h" void @@ -89,9 +90,9 @@ hv_util_attach(device_t dev) * Turn off batched reading for all util drivers before we open the * channel. */ - hv_set_channel_read_state(softc->channel, FALSE); + vmbus_chan_set_readbatch(softc->channel, false); - ret = hv_vmbus_channel_open(softc->channel, 4 * PAGE_SIZE, + ret = vmbus_chan_open(softc->channel, 4 * PAGE_SIZE, 4 * PAGE_SIZE, NULL, 0, softc->callback, softc); @@ -110,7 +111,7 @@ hv_util_detach(device_t dev) { struct hv_util_sc *sc = device_get_softc(dev); - hv_vmbus_channel_close(sc->channel); + vmbus_chan_close(sc->channel); free(sc->receive_buffer, M_DEVBUF); return (0); Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 19 05:46:15 2016 (r303020) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 19 05:57:19 2016 (r303021) @@ -202,9 +202,8 @@ vmbus_chan_sysctl_create(struct hv_vmbus } int -hv_vmbus_channel_open(struct hv_vmbus_channel *chan, - int txbr_size, int rxbr_size, const void *udata, int udlen, - vmbus_chan_callback_t cb, void *cbarg) +vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size, + const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg) { struct vmbus_softc *sc = chan->vmbus_sc; const struct vmbus_chanmsg_chopen_resp *resp; @@ -579,7 +578,7 @@ vmbus_chan_close_internal(struct hv_vmbu * are not being opened. */ void -hv_vmbus_channel_close(struct hv_vmbus_channel *chan) +vmbus_chan_close(struct hv_vmbus_channel *chan) { int subchan_cnt; @@ -1370,3 +1369,12 @@ vmbus_chan_msgproc(struct vmbus_softc *s if (msg_proc != NULL) msg_proc(sc, msg); } + +void +vmbus_chan_set_readbatch(struct hv_vmbus_channel *chan, bool on) +{ + if (!on) + chan->ch_flags &= ~VMBUS_CHAN_FLAG_BATCHREAD; + else + chan->ch_flags |= VMBUS_CHAN_FLAG_BATCHREAD; +}