Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/vmbus/hv_connection.c
Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/** | /** | ||||
* Send an event notification to the parent | * Send an event notification to the parent | ||||
*/ | */ | ||||
int | int | ||||
hv_vmbus_set_event(hv_vmbus_channel *channel) | hv_vmbus_set_event(hv_vmbus_channel *channel) | ||||
{ | { | ||||
struct vmbus_softc *sc = vmbus_get_softc(); | struct vmbus_softc *sc = channel->vmbus_sc; | ||||
int ret = 0; | int ret = 0; | ||||
uint32_t chanid = channel->offer_msg.child_rel_id; | uint32_t chanid = channel->offer_msg.child_rel_id; | ||||
atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], | atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT], | ||||
1UL << (chanid & VMBUS_EVTFLAG_MASK)); | 1UL << (chanid & VMBUS_EVTFLAG_MASK)); | ||||
ret = hv_vmbus_signal_event(channel->signal_event_param); | ret = hv_vmbus_signal_event(channel->signal_event_param); | ||||
return (ret); | return (ret); | ||||
} | } | ||||
void | void | ||||
vmbus_on_channel_open(const struct hv_vmbus_channel *chan) | vmbus_on_channel_open(const struct hv_vmbus_channel *chan) | ||||
{ | { | ||||
volatile int *flag_cnt_ptr; | volatile int *flag_cnt_ptr; | ||||
int flag_cnt; | int flag_cnt; | ||||
flag_cnt = (chan->offer_msg.child_rel_id / VMBUS_EVTFLAG_LEN) + 1; | flag_cnt = (chan->offer_msg.child_rel_id / VMBUS_EVTFLAG_LEN) + 1; | ||||
flag_cnt_ptr = VMBUS_PCPU_PTR(vmbus_get_softc(), event_flags_cnt, | flag_cnt_ptr = VMBUS_PCPU_PTR(chan->vmbus_sc, event_flags_cnt, | ||||
chan->target_cpu); | chan->target_cpu); | ||||
for (;;) { | for (;;) { | ||||
int old_flag_cnt; | int old_flag_cnt; | ||||
old_flag_cnt = *flag_cnt_ptr; | old_flag_cnt = *flag_cnt_ptr; | ||||
if (old_flag_cnt >= flag_cnt) | if (old_flag_cnt >= flag_cnt) | ||||
break; | break; | ||||
Show All 11 Lines |