Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jul 2016 06:40:42 +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: r302810 - head/sys/dev/hyperv/vmbus
Message-ID:  <201607140640.u6E6egMa064608@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Thu Jul 14 06:40:42 2016
New Revision: 302810
URL: https://svnweb.freebsd.org/changeset/base/302810

Log:
  hyperv/vmbus: Move new channel scan notification to device register
  
  And nuke now unnecessary function indirection.
  
  MFC after:	1 week
  Sponsored by:	Microsoft OSTC
  Differential Revision:	https://reviews.freebsd.org/D7103

Modified:
  head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
  head/sys/dev/hyperv/vmbus/vmbus.c

Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c	Thu Jul 14 06:29:12 2016	(r302809)
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c	Thu Jul 14 06:40:42 2016	(r302810)
@@ -40,14 +40,12 @@
 typedef void	(*vmbus_chanmsg_proc_t)
 		(struct vmbus_softc *, const struct vmbus_message *);
 
-static void	vmbus_channel_on_offer_internal(struct vmbus_softc *,
-		    const struct vmbus_chanmsg_choffer *);
 static void	vmbus_chan_detach_task(void *, int);
 
-static void	vmbus_channel_on_offer(struct vmbus_softc *,
-		    const struct vmbus_message *);
 static void	vmbus_channel_on_offers_delivered(struct vmbus_softc *,
 		    const struct vmbus_message *);
+static void	vmbus_chan_msgproc_choffer(struct vmbus_softc *,
+		    const struct vmbus_message *);
 static void	vmbus_chan_msgproc_chrescind(struct vmbus_softc *,
 		    const struct vmbus_message *);
 
@@ -62,7 +60,7 @@ static void	vmbus_chan_msgproc_chrescind
 
 static const vmbus_chanmsg_proc_t
 vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE_MAX] = {
-	VMBUS_CHANMSG_PROC(CHOFFER,	vmbus_channel_on_offer),
+	VMBUS_CHANMSG_PROC(CHOFFER,	vmbus_chan_msgproc_choffer),
 	VMBUS_CHANMSG_PROC(CHRESCIND,	vmbus_chan_msgproc_chrescind),
 	VMBUS_CHANMSG_PROC(CHOFFER_DONE,vmbus_channel_on_offers_delivered),
 
@@ -259,28 +257,16 @@ vmbus_channel_select_defcpu(struct hv_vm
 	vmbus_channel_cpu_set(chan, 0);
 }
 
-/**
- * @brief Handler for channel offers from Hyper-V/Azure
- *
- * Handler for channel offers from vmbus in parent partition.
- */
-static void
-vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg)
-{
-	/* New channel is offered by vmbus */
-	vmbus_scan_newchan(sc);
-
-	vmbus_channel_on_offer_internal(sc,
-	    (const struct vmbus_chanmsg_choffer *)msg->msg_data);
-}
-
 static void
-vmbus_channel_on_offer_internal(struct vmbus_softc *sc,
-    const struct vmbus_chanmsg_choffer *offer)
+vmbus_chan_msgproc_choffer(struct vmbus_softc *sc,
+    const struct vmbus_message *msg)
 {
+	const struct vmbus_chanmsg_choffer *offer;
 	hv_vmbus_channel* new_channel;
 	int error;
 
+	offer = (const struct vmbus_chanmsg_choffer *)msg->msg_data;
+
 	/*
 	 * Allocate the channel object and save this offer
 	 */

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus.c	Thu Jul 14 06:29:12 2016	(r302809)
+++ head/sys/dev/hyperv/vmbus/vmbus.c	Thu Jul 14 06:40:42 2016	(r302810)
@@ -994,6 +994,9 @@ hv_vmbus_child_device_register(struct hv
 	device_t parent = sc->vmbus_dev;
 	int error = 0;
 
+	/* New channel has been offered */
+	vmbus_scan_newchan(sc);
+
 	chan->ch_dev = device_add_child(parent, NULL, -1);
 	if (chan->ch_dev == NULL) {
 		device_printf(parent, "device_add_child for chan%u failed\n",



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