summaryrefslogtreecommitdiff
path: root/include/linux/hyperv.h
diff options
context:
space:
mode:
authorDexuan Cui <decui@microsoft.com>2019-09-06 02:01:16 +0300
committerSasha Levin <sashal@kernel.org>2019-09-06 21:52:44 +0300
commited56ef675ae6ef0e6f7d42b9c42dae61172f0960 (patch)
treef295bd2ac3a5177561c9c847c89dac15e2ef48d0 /include/linux/hyperv.h
parent63ecc6d22ce46643165c391a9c90ba67e22e1c0f (diff)
downloadlinux-ed56ef675ae6ef0e6f7d42b9c42dae61172f0960.tar.xz
Drivers: hv: vmbus: Add a helper function is_sub_channel()
The existing method of telling if a channel is sub-channel in vmbus_process_offer() is cumbersome. This new simple helper function is preferred in future. Signed-off-by: Dexuan Cui <decui@microsoft.com> Reviewed-by: Michael Kelley <mikelley@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux/hyperv.h')
-rw-r--r--include/linux/hyperv.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 6256cc34c4a6..2d39248cff96 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -245,7 +245,10 @@ struct vmbus_channel_offer {
} pipe;
} u;
/*
- * The sub_channel_index is defined in win8.
+ * The sub_channel_index is defined in Win8: a value of zero means a
+ * primary channel and a value of non-zero means a sub-channel.
+ *
+ * Before Win8, the field is reserved, meaning it's always zero.
*/
u16 sub_channel_index;
u16 reserved3;
@@ -934,6 +937,11 @@ static inline bool is_hvsock_channel(const struct vmbus_channel *c)
VMBUS_CHANNEL_TLNPI_PROVIDER_OFFER);
}
+static inline bool is_sub_channel(const struct vmbus_channel *c)
+{
+ return c->offermsg.offer.sub_channel_index != 0;
+}
+
static inline void set_channel_affinity_state(struct vmbus_channel *c,
enum hv_numa_policy policy)
{