hyperv/vmbus: Use sub-channel index to detect primary channel
In case that VMBUS_CHAN_ISPRIMARY is needed in the early place of channel setup. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7108
This commit is contained in:
parent
e09f507913
commit
089d55deb2
@ -336,7 +336,7 @@ typedef struct hv_vmbus_channel {
|
||||
struct sysctl_ctx_list ch_sysctl_ctx;
|
||||
} hv_vmbus_channel;
|
||||
|
||||
#define HV_VMBUS_CHAN_ISPRIMARY(chan) ((chan)->primary_channel == NULL)
|
||||
#define VMBUS_CHAN_ISPRIMARY(chan) ((chan)->ch_subidx == 0)
|
||||
|
||||
#define VMBUS_CHAN_FLAG_HASMNF 0x0001
|
||||
/*
|
||||
|
@ -2957,7 +2957,7 @@ static void
|
||||
hn_subchan_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan)
|
||||
{
|
||||
|
||||
KASSERT(!HV_VMBUS_CHAN_ISPRIMARY(chan),
|
||||
KASSERT(!VMBUS_CHAN_ISPRIMARY(chan),
|
||||
("subchannel callback on primary channel"));
|
||||
KASSERT(chan->ch_subidx > 0,
|
||||
("invalid channel subidx %u",
|
||||
|
@ -285,7 +285,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_softc *sc,
|
||||
return;
|
||||
}
|
||||
|
||||
if (HV_VMBUS_CHAN_ISPRIMARY(chan)) {
|
||||
if (VMBUS_CHAN_ISPRIMARY(chan)) {
|
||||
/*
|
||||
* Add device for this primary channel.
|
||||
*
|
||||
@ -332,7 +332,7 @@ vmbus_chan_detach_task(void *xchan, int pending __unused)
|
||||
{
|
||||
struct hv_vmbus_channel *chan = xchan;
|
||||
|
||||
if (HV_VMBUS_CHAN_ISPRIMARY(chan)) {
|
||||
if (VMBUS_CHAN_ISPRIMARY(chan)) {
|
||||
/* Only primary channel owns the device */
|
||||
hv_vmbus_child_device_unregister(chan);
|
||||
/* NOTE: DO NOT free primary channel for now */
|
||||
@ -413,7 +413,7 @@ hv_vmbus_release_unattached_channels(struct vmbus_softc *sc)
|
||||
channel = TAILQ_FIRST(&sc->vmbus_chlist);
|
||||
TAILQ_REMOVE(&sc->vmbus_chlist, channel, ch_link);
|
||||
|
||||
if (HV_VMBUS_CHAN_ISPRIMARY(channel)) {
|
||||
if (VMBUS_CHAN_ISPRIMARY(channel)) {
|
||||
/* Only primary channel owns the device */
|
||||
hv_vmbus_child_device_unregister(channel);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user