svn commit: r302694 - in head/sys/dev/hyperv: include netvsc vmbus
Sepherosa Ziehau
sephe at FreeBSD.org
Wed Jul 13 03:35:24 UTC 2016
Author: sephe
Date: Wed Jul 13 03:35:22 2016
New Revision: 302694
URL: https://svnweb.freebsd.org/changeset/base/302694
Log:
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
Modified:
head/sys/dev/hyperv/include/hyperv.h
head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
head/sys/dev/hyperv/vmbus/hv_channel.c
head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
Modified: head/sys/dev/hyperv/include/hyperv.h
==============================================================================
--- head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 03:24:29 2016 (r302693)
+++ head/sys/dev/hyperv/include/hyperv.h Wed Jul 13 03:35:22 2016 (r302694)
@@ -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;
Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 13 03:24:29 2016 (r302693)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Wed Jul 13 03:35:22 2016 (r302694)
@@ -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
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, s
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, s
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);
}
Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 03:24:29 2016 (r302693)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c Wed Jul 13 03:35:22 2016 (r302694)
@@ -111,7 +111,7 @@ vmbus_channel_sysctl_create(hv_vmbus_cha
} 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);
Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 03:24:29 2016 (r302693)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Wed Jul 13 03:35:22 2016 (r302694)
@@ -152,14 +152,14 @@ vmbus_channel_process_offer(hv_vmbus_cha
}
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 v
/* 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
More information about the svn-src-all
mailing list