Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jul 2016 06:08:48 +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: r302874 - in head/sys/dev/hyperv: include vmbus
Message-ID:  <201607150608.u6F68mTZ090856@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Fri Jul 15 06:08:48 2016
New Revision: 302874
URL: https://svnweb.freebsd.org/changeset/base/302874

Log:
  hyperv/vmbus: Field rename
  
  MFC after:	1 week
  Sponsored by:	Microsoft OSTC
  Differential Revision:	https://reviews.freebsd.org/D7146

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==============================================================================
--- head/sys/dev/hyperv/include/hyperv.h	Fri Jul 15 05:59:27 2016	(r302873)
+++ head/sys/dev/hyperv/include/hyperv.h	Fri Jul 15 06:08:48 2016	(r302874)
@@ -242,7 +242,7 @@ typedef struct {
 	uint32_t		ring_data_size;	/* ring_size */
 } hv_vmbus_ring_buffer_info;
 
-typedef void (*hv_vmbus_pfn_channel_callback)(void *context);
+typedef void	(*vmbus_chan_callback_t)(void *);
 
 typedef struct hv_vmbus_channel {
 	device_t			ch_dev;
@@ -266,10 +266,10 @@ typedef struct hv_vmbus_channel {
 	 */
 	hv_vmbus_ring_buffer_info	inbound;
 
-	struct taskqueue *		rxq;
-	struct task			channel_task;
-	hv_vmbus_pfn_channel_callback	on_channel_callback;
-	void*				channel_callback_context;
+	struct taskqueue		*ch_tq;
+	struct task			ch_task;
+	vmbus_chan_callback_t		ch_cb;
+	void				*ch_cbarg;
 
 	struct hyperv_mon_param		*ch_monprm;
 	struct hyperv_dma		ch_monprm_dma;
@@ -362,9 +362,8 @@ int		hv_vmbus_channel_open(
 				uint32_t		recv_ring_buffer_size,
 				void*			user_data,
 				uint32_t		user_data_len,
-				hv_vmbus_pfn_channel_callback
-							pfn_on_channel_callback,
-				void*			context);
+				vmbus_chan_callback_t	cb,
+				void			*cbarg);
 
 void		hv_vmbus_channel_close(hv_vmbus_channel *channel);
 

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel.c	Fri Jul 15 05:59:27 2016	(r302873)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c	Fri Jul 15 06:08:48 2016	(r302874)
@@ -193,8 +193,8 @@ hv_vmbus_channel_open(
 	uint32_t			recv_ring_buffer_size,
 	void*				user_data,
 	uint32_t			user_data_len,
-	hv_vmbus_pfn_channel_callback	pfn_on_channel_callback,
-	void* 				context)
+	vmbus_chan_callback_t		cb,
+	void				*cbarg)
 {
 	struct vmbus_softc *sc = new_channel->vmbus_sc;
 	const struct vmbus_chanmsg_chopen_resp *resp;
@@ -220,19 +220,19 @@ hv_vmbus_channel_open(
 	    VMBUS_CHAN_ST_OPENED_SHIFT))
 		panic("double-open chan%u", new_channel->ch_id);
 
-	new_channel->on_channel_callback = pfn_on_channel_callback;
-	new_channel->channel_callback_context = context;
+	new_channel->ch_cb = cb;
+	new_channel->ch_cbarg = cbarg;
 
 	vmbus_chan_update_evtflagcnt(sc, new_channel);
 
-	new_channel->rxq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq,
+	new_channel->ch_tq = VMBUS_PCPU_GET(new_channel->vmbus_sc, event_tq,
 	    new_channel->ch_cpuid);
 	if (new_channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD) {
-		TASK_INIT(&new_channel->channel_task, 0,
-		    vmbus_chan_task, new_channel);
+		TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task,
+		    new_channel);
 	} else {
-		TASK_INIT(&new_channel->channel_task, 0,
-		    vmbus_chan_task_nobatch, new_channel);
+		TASK_INIT(&new_channel->ch_task, 0, vmbus_chan_task_nobatch,
+		    new_channel);
 	}
 
 	/*
@@ -521,7 +521,7 @@ hv_vmbus_channel_close_internal(hv_vmbus
 	struct vmbus_softc *sc = channel->vmbus_sc;
 	struct vmbus_msghc *mh;
 	struct vmbus_chanmsg_chclose *req;
-	struct taskqueue *rxq = channel->rxq;
+	struct taskqueue *tq = channel->ch_tq;
 	int error;
 
 	/* TODO: stringent check */
@@ -530,11 +530,11 @@ hv_vmbus_channel_close_internal(hv_vmbus
 	sysctl_ctx_free(&channel->ch_sysctl_ctx);
 
 	/*
-	 * set rxq to NULL to avoid more requests be scheduled
+	 * Set ch_tq to NULL to avoid more requests be scheduled
 	 */
-	channel->rxq = NULL;
-	taskqueue_drain(rxq, &channel->channel_task);
-	channel->on_channel_callback = NULL;
+	channel->ch_tq = NULL;
+	taskqueue_drain(tq, &channel->ch_task);
+	channel->ch_cb = NULL;
 
 	/**
 	 * Send a closing message
@@ -895,11 +895,8 @@ static void
 vmbus_chan_task(void *xchan, int pending __unused)
 {
 	struct hv_vmbus_channel *chan = xchan;
-	void (*callback)(void *);
-	void *arg;
-
-	arg = chan->channel_callback_context;
-	callback = chan->on_channel_callback;
+	vmbus_chan_callback_t cb = chan->ch_cb;
+	void *cbarg = chan->ch_cbarg;
 
 	/*
 	 * Optimize host to guest signaling by ensuring:
@@ -916,7 +913,7 @@ vmbus_chan_task(void *xchan, int pending
 	for (;;) {
 		uint32_t left;
 
-		callback(arg);
+		cb(cbarg);
 
 		left = hv_ring_buffer_read_end(&chan->inbound);
 		if (left == 0) {
@@ -932,7 +929,7 @@ vmbus_chan_task_nobatch(void *xchan, int
 {
 	struct hv_vmbus_channel *chan = xchan;
 
-	chan->on_channel_callback(chan->channel_callback_context);
+	chan->ch_cb(chan->ch_cbarg);
 }
 
 static __inline void
@@ -961,12 +958,12 @@ vmbus_event_flags_proc(struct vmbus_soft
 			channel = sc->vmbus_chmap[chid_base + chid_ofs];
 
 			/* if channel is closed or closing */
-			if (channel == NULL || channel->rxq == NULL)
+			if (channel == NULL || channel->ch_tq == NULL)
 				continue;
 
 			if (channel->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD)
 				hv_ring_buffer_read_begin(&channel->inbound);
-			taskqueue_enqueue(channel->rxq, &channel->channel_task);
+			taskqueue_enqueue(channel->ch_tq, &channel->ch_task);
 		}
 	}
 }



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