Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jul 2016 07:24:03 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302814 - in head/sys/dev/hyperv: include netvsc vmbus
Message-ID:  <201607140724.u6E7O3k6082920@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Thu Jul 14 07:24:03 2016
New Revision: 302814
URL: https://svnweb.freebsd.org/changeset/base/302814

Log:
  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

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_mgmt.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==============================================================================
--- head/sys/dev/hyperv/include/hyperv.h	Thu Jul 14 07:08:59 2016	(r302813)
+++ head/sys/dev/hyperv/include/hyperv.h	Thu Jul 14 07:24:03 2016	(r302814)
@@ -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
 /*

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Thu Jul 14 07:08:59 2016	(r302813)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Thu Jul 14 07:24:03 2016	(r302814)
@@ -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",

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c	Thu Jul 14 07:08:59 2016	(r302813)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c	Thu Jul 14 07:24:03 2016	(r302814)
@@ -285,7 +285,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_
 		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 
 {
 	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(str
 	    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);
 	    }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607140724.u6E7O3k6082920>