From owner-svn-src-head@freebsd.org Thu Jul 21 05:30:32 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 89584B9F523; Thu, 21 Jul 2016 05:30:32 +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 45CFC1E78; Thu, 21 Jul 2016 05:30:32 +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 u6L5UVRt090511; Thu, 21 Jul 2016 05:30:31 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6L5UV1l090509; Thu, 21 Jul 2016 05:30:31 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607210530.u6L5UV1l090509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 21 Jul 2016 05:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303127 - head/sys/dev/hyperv/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: Thu, 21 Jul 2016 05:30:32 -0000 Author: sephe Date: Thu Jul 21 05:30:31 2016 New Revision: 303127 URL: https://svnweb.freebsd.org/changeset/base/303127 Log: hyperv/vmbus: Save event flag location and evet flag mask. This avoids unnecessary access to the vmbus_softc struct on sending path. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7257 Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jul 21 03:11:39 2016 (r303126) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Thu Jul 21 05:30:31 2016 (r303127) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -static void vmbus_chan_signal_tx(struct hv_vmbus_channel *chan); static void vmbus_chan_update_evtflagcnt(struct vmbus_softc *, const struct hv_vmbus_channel *); @@ -77,18 +76,13 @@ vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_M VMBUS_CHANMSG_PROC_WAKEUP(GPADL_DISCONNRESP) }; -/** - * @brief Trigger an event notification on the specified channel +/* + * Notify host that there are data pending on our TX bufring. */ -static void -vmbus_chan_signal_tx(struct hv_vmbus_channel *chan) +static __inline void +vmbus_chan_signal_tx(const struct hv_vmbus_channel *chan) { - struct vmbus_softc *sc = chan->ch_vmbus; - uint32_t chanid = chan->ch_id; - - atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], - 1UL << (chanid & VMBUS_EVTFLAG_MASK)); - + atomic_set_long(chan->ch_evtflag, chan->ch_evtflag_mask); if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF) atomic_set_int(chan->ch_montrig, chan->ch_montrig_mask); else @@ -1120,6 +1114,13 @@ vmbus_chan_msgproc_choffer(struct vmbus_ 1 << (offer->chm_montrig % VMBUS_MONTRIG_LEN); } + /* + * Setup event flag. + */ + chan->ch_evtflag = + &sc->vmbus_tx_evtflags[chan->ch_id >> VMBUS_EVTFLAG_SHIFT]; + chan->ch_evtflag_mask = 1UL << (chan->ch_id & VMBUS_EVTFLAG_MASK); + /* Select default cpu for this channel. */ vmbus_chan_cpu_default(chan); Modified: head/sys/dev/hyperv/vmbus/vmbus_chanvar.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Thu Jul 21 03:11:39 2016 (r303126) +++ head/sys/dev/hyperv/vmbus/vmbus_chanvar.h Thu Jul 21 05:30:31 2016 (r303127) @@ -77,13 +77,20 @@ typedef struct hv_vmbus_channel { uint32_t ch_id; /* channel id */ /* - * These are based on the offer_msg.monitor_id. + * These are based on the vmbus_chanmsg_choffer.chm_montrig. * Save it here for easy access. */ - volatile uint32_t *ch_montrig; /* MNF trigger */ + volatile uint32_t *ch_montrig; /* MNF trigger loc. */ uint32_t ch_montrig_mask;/* MNF trig mask */ /* + * These are based on the vmbus_chanmsg_choffer.chm_chanid. + * Save it here for easy access. + */ + volatile u_long *ch_evtflag; /* event flag loc. */ + u_long ch_evtflag_mask;/* event flag */ + + /* * TX bufring; at the beginning of ch_bufring. */ hv_vmbus_ring_buffer_info ch_txbr;