Index: head/sys/dev/hyperv/vmbus/hv_channel.c =================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c +++ head/sys/dev/hyperv/vmbus/hv_channel.c @@ -897,25 +897,23 @@ int f; for (f = 0; f < flag_cnt; ++f) { - uint32_t rel_id_base; + uint32_t chid_base; u_long flags; - int bit; + int chid_ofs; if (event_flags[f] == 0) continue; flags = atomic_swap_long(&event_flags[f], 0); - rel_id_base = f << VMBUS_EVTFLAG_SHIFT; + chid_base = f << VMBUS_EVTFLAG_SHIFT; - while ((bit = ffsl(flags)) != 0) { + while ((chid_ofs = ffsl(flags)) != 0) { struct hv_vmbus_channel *channel; - uint32_t rel_id; - --bit; /* NOTE: ffsl is 1-based */ - flags &= ~(1UL << bit); + --chid_ofs; /* NOTE: ffsl is 1-based */ + flags &= ~(1UL << chid_ofs); - rel_id = rel_id_base + bit; - channel = sc->vmbus_chmap[rel_id]; + channel = sc->vmbus_chmap[chid_base + chid_ofs]; /* if channel is closed or closing */ if (channel == NULL || channel->rxq == NULL) Index: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c =================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c @@ -113,20 +113,18 @@ { struct vmbus_softc *sc = new_channel->vmbus_sc; hv_vmbus_channel* channel; - uint32_t relid; - relid = new_channel->ch_id; /* * Make sure this is a new offer */ mtx_lock(&sc->vmbus_chlist_lock); - if (relid == 0) { + if (new_channel->ch_id == 0) { /* * XXX channel0 will not be processed; skip it. */ printf("VMBUS: got channel0 offer\n"); } else { - sc->vmbus_chmap[relid] = new_channel; + sc->vmbus_chmap[new_channel->ch_id] = new_channel; } TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) {