Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
[cascardo/linux.git] / include / linux / hyperv.h
index 5df444b..6824556 100644 (file)
@@ -674,6 +674,11 @@ enum hv_signal_policy {
        HV_SIGNAL_POLICY_EXPLICIT,
 };
 
+enum hv_numa_policy {
+       HV_BALANCED = 0,
+       HV_LOCALIZED,
+};
+
 enum vmbus_device_type {
        HV_IDE = 0,
        HV_SCSI,
@@ -701,9 +706,6 @@ struct vmbus_device {
 };
 
 struct vmbus_channel {
-       /* Unique channel id */
-       int id;
-
        struct list_head listentry;
 
        struct hv_device *device_obj;
@@ -850,6 +852,43 @@ struct vmbus_channel {
         * ring lock to preserve the current behavior.
         */
        bool acquire_ring_lock;
+       /*
+        * For performance critical channels (storage, networking
+        * etc,), Hyper-V has a mechanism to enhance the throughput
+        * at the expense of latency:
+        * When the host is to be signaled, we just set a bit in a shared page
+        * and this bit will be inspected by the hypervisor within a certain
+        * window and if the bit is set, the host will be signaled. The window
+        * of time is the monitor latency - currently around 100 usecs. This
+        * mechanism improves throughput by:
+        *
+        * A) Making the host more efficient - each time it wakes up,
+        *    potentially it will process morev number of packets. The
+        *    monitor latency allows a batch to build up.
+        * B) By deferring the hypercall to signal, we will also minimize
+        *    the interrupts.
+        *
+        * Clearly, these optimizations improve throughput at the expense of
+        * latency. Furthermore, since the channel is shared for both
+        * control and data messages, control messages currently suffer
+        * unnecessary latency adversley impacting performance and boot
+        * time. To fix this issue, permit tagging the channel as being
+        * in "low latency" mode. In this mode, we will bypass the monitor
+        * mechanism.
+        */
+       bool low_latency;
+
+       /*
+        * NUMA distribution policy:
+        * We support teo policies:
+        * 1) Balanced: Here all performance critical channels are
+        *    distributed evenly amongst all the NUMA nodes.
+        *    This policy will be the default policy.
+        * 2) Localized: All channels of a given instance of a
+        *    performance critical service will be assigned CPUs
+        *    within a selected NUMA node.
+        */
+       enum hv_numa_policy affinity_policy;
 
 };
 
@@ -870,6 +909,12 @@ static inline void set_channel_signal_state(struct vmbus_channel *c,
        c->signal_policy = policy;
 }
 
+static inline void set_channel_affinity_state(struct vmbus_channel *c,
+                                             enum hv_numa_policy policy)
+{
+       c->affinity_policy = policy;
+}
+
 static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
 {
        c->batched_reading = state;
@@ -891,6 +936,16 @@ static inline void set_channel_pending_send_size(struct vmbus_channel *c,
        c->outbound.ring_buffer->pending_send_sz = size;
 }
 
+static inline void set_low_latency_mode(struct vmbus_channel *c)
+{
+       c->low_latency = true;
+}
+
+static inline void clear_low_latency_mode(struct vmbus_channel *c)
+{
+       c->low_latency = false;
+}
+
 void vmbus_onmessage(void *context);
 
 int vmbus_request_offers(void);
@@ -1263,6 +1318,27 @@ u64 hv_do_hypercall(u64 control, void *input, void *output);
        .guid = UUID_LE(0x44c4f61d, 0x4444, 0x4400, 0x9d, 0x52, \
                        0x80, 0x2e, 0x27, 0xed, 0xe1, 0x9f)
 
+/*
+ * Linux doesn't support the 3 devices: the first two are for
+ * Automatic Virtual Machine Activation, and the third is for
+ * Remote Desktop Virtualization.
+ * {f8e65716-3cb3-4a06-9a60-1889c5cccab5}
+ * {3375baf4-9e15-4b30-b765-67acb10d607b}
+ * {276aacf4-ac15-426c-98dd-7521ad3f01fe}
+ */
+
+#define HV_AVMA1_GUID \
+       .guid = UUID_LE(0xf8e65716, 0x3cb3, 0x4a06, 0x9a, 0x60, \
+                       0x18, 0x89, 0xc5, 0xcc, 0xca, 0xb5)
+
+#define HV_AVMA2_GUID \
+       .guid = UUID_LE(0x3375baf4, 0x9e15, 0x4b30, 0xb7, 0x65, \
+                       0x67, 0xac, 0xb1, 0x0d, 0x60, 0x7b)
+
+#define HV_RDV_GUID \
+       .guid = UUID_LE(0x276aacf4, 0xac15, 0x426c, 0x98, 0xdd, \
+                       0x75, 0x21, 0xad, 0x3f, 0x01, 0xfe)
+
 /*
  * Common header for Hyper-V ICs
  */
@@ -1351,6 +1427,15 @@ struct ictimesync_data {
        u8 flags;
 } __packed;
 
+struct ictimesync_ref_data {
+       u64 parenttime;
+       u64 vmreferencetime;
+       u8 flags;
+       char leapflags;
+       char stratum;
+       u8 reserved[3];
+} __packed;
+
 struct hyperv_service_callback {
        u8 msg_type;
        char *log_msg;
@@ -1364,6 +1449,9 @@ extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *,
                                        struct icmsg_negotiate *, u8 *, int,
                                        int);
 
+void hv_event_tasklet_disable(struct vmbus_channel *channel);
+void hv_event_tasklet_enable(struct vmbus_channel *channel);
+
 void hv_process_channel_removal(struct vmbus_channel *channel, u32 relid);
 
 /*