hyperv/vmbus: Make subchan index a field of hv_vmbus_channel.
This prepares to remove the unnecessary offer message embedding in hv_vmbus_channel. MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7015
This commit is contained in:
parent
2c4888c75b
commit
4ac0a9bf1e
@ -629,6 +629,7 @@ typedef struct hv_vmbus_channel {
|
||||
|
||||
struct task ch_detach_task;
|
||||
TAILQ_ENTRY(hv_vmbus_channel) ch_link;
|
||||
uint32_t ch_subidx; /* subchan index */
|
||||
|
||||
struct sysctl_ctx_list ch_sysctl_ctx;
|
||||
} hv_vmbus_channel;
|
||||
|
@ -518,9 +518,9 @@ netvsc_attach(device_t dev)
|
||||
*/
|
||||
pri_chan = device_ctx->channel;
|
||||
KASSERT(HV_VMBUS_CHAN_ISPRIMARY(pri_chan), ("not primary channel"));
|
||||
KASSERT(pri_chan->offer_msg.offer.sub_channel_index == 0,
|
||||
KASSERT(pri_chan->ch_subidx == 0,
|
||||
("primary channel subidx %u",
|
||||
pri_chan->offer_msg.offer.sub_channel_index));
|
||||
pri_chan->ch_subidx));
|
||||
hn_channel_attach(sc, pri_chan);
|
||||
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
@ -809,8 +809,8 @@ hn_tx_done(struct hv_vmbus_channel *chan, void *xpkt)
|
||||
txr = txd->txr;
|
||||
KASSERT(txr->hn_chan == chan,
|
||||
("channel mismatch, on channel%u, should be channel%u",
|
||||
chan->offer_msg.offer.sub_channel_index,
|
||||
txr->hn_chan->offer_msg.offer.sub_channel_index));
|
||||
chan->ch_subidx,
|
||||
txr->hn_chan->ch_subidx));
|
||||
|
||||
txr->hn_has_txeof = 1;
|
||||
hn_txdesc_put(txr, txd);
|
||||
@ -2940,7 +2940,7 @@ hn_channel_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan)
|
||||
struct hn_rx_ring *rxr;
|
||||
int idx;
|
||||
|
||||
idx = chan->offer_msg.offer.sub_channel_index;
|
||||
idx = chan->ch_subidx;
|
||||
|
||||
KASSERT(idx >= 0 && idx < sc->hn_rx_ring_inuse,
|
||||
("invalid channel index %d, should > 0 && < %d",
|
||||
@ -2981,9 +2981,9 @@ hn_subchan_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan)
|
||||
|
||||
KASSERT(!HV_VMBUS_CHAN_ISPRIMARY(chan),
|
||||
("subchannel callback on primary channel"));
|
||||
KASSERT(chan->offer_msg.offer.sub_channel_index > 0,
|
||||
KASSERT(chan->ch_subidx > 0,
|
||||
("invalid channel subidx %u",
|
||||
chan->offer_msg.offer.sub_channel_index));
|
||||
chan->ch_subidx));
|
||||
hn_channel_attach(sc, chan);
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ vmbus_channel_sysctl_create(hv_vmbus_channel* channel)
|
||||
} else {
|
||||
dev = primary_ch->device->device;
|
||||
ch_id = primary_ch->ch_id;
|
||||
sub_ch_id = channel->offer_msg.offer.sub_channel_index;
|
||||
sub_ch_id = channel->ch_subidx;
|
||||
}
|
||||
ctx = &channel->ch_sysctl_ctx;
|
||||
sysctl_ctx_init(ctx);
|
||||
|
@ -152,14 +152,14 @@ vmbus_channel_process_offer(hv_vmbus_channel *new_channel)
|
||||
}
|
||||
device_printf(sc->vmbus_dev, "chan%u subchanid%u offer%s\n",
|
||||
new_channel->ch_id,
|
||||
new_channel->offer_msg.offer.sub_channel_index, logstr);
|
||||
new_channel->ch_subidx, logstr);
|
||||
}
|
||||
|
||||
if (channel != NULL) {
|
||||
/*
|
||||
* Check if this is a sub channel.
|
||||
*/
|
||||
if (new_channel->offer_msg.offer.sub_channel_index != 0) {
|
||||
if (new_channel->ch_subidx != 0) {
|
||||
/*
|
||||
* It is a sub channel offer, process it.
|
||||
*/
|
||||
@ -293,6 +293,7 @@ vmbus_channel_on_offer_internal(struct vmbus_softc *sc,
|
||||
/* Allocate the channel object and save this offer */
|
||||
new_channel = hv_vmbus_allocate_channel(sc);
|
||||
new_channel->ch_id = offer->child_rel_id;
|
||||
new_channel->ch_subidx = offer->offer.sub_channel_index;
|
||||
|
||||
/*
|
||||
* By default we setup state to enable batched
|
||||
|
Loading…
Reference in New Issue
Block a user