Index: head/sys/dev/hyperv/vmbus/vmbus_chan.c =================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c @@ -51,7 +51,6 @@ #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_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 @@ 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); Index: head/sys/dev/hyperv/vmbus/vmbus_chanvar.h =================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chanvar.h +++ head/sys/dev/hyperv/vmbus/vmbus_chanvar.h @@ -77,13 +77,20 @@ 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;