From owner-svn-src-head@freebsd.org Wed Jul 13 03:35:24 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1DF7DB97D74; Wed, 13 Jul 2016 03:35:24 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA599159D; Wed, 13 Jul 2016 03:35:23 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6D3ZNgl056092; Wed, 13 Jul 2016 03:35:23 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6D3ZMqE056088; Wed, 13 Jul 2016 03:35:22 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607130335.u6D3ZMqE056088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 13 Jul 2016 03:35:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302694 - in head/sys/dev/hyperv: include netvsc vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2016 03:35:24 -0000 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