hyperv/vmbus: Get rid of rel{_id,id}, use channel id consistently.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7100
This commit is contained in:
Sepherosa Ziehau 2016-07-14 06:10:00 +00:00
parent 5ef8204d4b
commit d805de567f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=302806
2 changed files with 9 additions and 13 deletions

View file

@ -897,25 +897,23 @@ vmbus_event_flags_proc(struct vmbus_softc *sc, volatile u_long *event_flags,
int f; int f;
for (f = 0; f < flag_cnt; ++f) { for (f = 0; f < flag_cnt; ++f) {
uint32_t rel_id_base; uint32_t chid_base;
u_long flags; u_long flags;
int bit; int chid_ofs;
if (event_flags[f] == 0) if (event_flags[f] == 0)
continue; continue;
flags = atomic_swap_long(&event_flags[f], 0); 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; struct hv_vmbus_channel *channel;
uint32_t rel_id;
--bit; /* NOTE: ffsl is 1-based */ --chid_ofs; /* NOTE: ffsl is 1-based */
flags &= ~(1UL << bit); flags &= ~(1UL << chid_ofs);
rel_id = rel_id_base + bit; channel = sc->vmbus_chmap[chid_base + chid_ofs];
channel = sc->vmbus_chmap[rel_id];
/* if channel is closed or closing */ /* if channel is closed or closing */
if (channel == NULL || channel->rxq == NULL) if (channel == NULL || channel->rxq == NULL)

View file

@ -113,20 +113,18 @@ vmbus_channel_process_offer(hv_vmbus_channel *new_channel)
{ {
struct vmbus_softc *sc = new_channel->vmbus_sc; struct vmbus_softc *sc = new_channel->vmbus_sc;
hv_vmbus_channel* channel; hv_vmbus_channel* channel;
uint32_t relid;
relid = new_channel->ch_id;
/* /*
* Make sure this is a new offer * Make sure this is a new offer
*/ */
mtx_lock(&sc->vmbus_chlist_lock); mtx_lock(&sc->vmbus_chlist_lock);
if (relid == 0) { if (new_channel->ch_id == 0) {
/* /*
* XXX channel0 will not be processed; skip it. * XXX channel0 will not be processed; skip it.
*/ */
printf("VMBUS: got channel0 offer\n"); printf("VMBUS: got channel0 offer\n");
} else { } else {
sc->vmbus_chmap[relid] = new_channel; sc->vmbus_chmap[new_channel->ch_id] = new_channel;
} }
TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) { TAILQ_FOREACH(channel, &sc->vmbus_chlist, ch_link) {