diff options
| author | K. Y. Srinivasan <kys@microsoft.com> | 2012-12-01 09:46:33 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-17 13:46:39 -0500 |
| commit | 132368bd0b286457f83f56d0bbdecd85999562dc (patch) | |
| tree | e16a4f6130d475d1f44270c088e446306b3e8355 | |
| parent | 6fdf3b21433e901dcba0ac186f00d604ce944f56 (diff) | |
Drivers: hv: Add state to manage batched reading
For the "read" side signaling optimization, the reader has to completely
drain the queue before exiting. Add state to manage this "batched"
reading.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/hv/channel_mgmt.c | 7 | ||||
| -rw-r--r-- | include/linux/hyperv.h | 20 |
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 2f84c5cff8d4..7bf59177aaf8 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c | |||
| @@ -275,6 +275,13 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) | |||
| 275 | return; | 275 | return; |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | /* | ||
| 279 | * By default we setup state to enable batched | ||
| 280 | * reading. A specific service can choose to | ||
| 281 | * disable this prior to opening the channel. | ||
| 282 | */ | ||
| 283 | newchannel->batched_reading = true; | ||
| 284 | |||
| 278 | memcpy(&newchannel->offermsg, offer, | 285 | memcpy(&newchannel->offermsg, offer, |
| 279 | sizeof(struct vmbus_channel_offer_channel)); | 286 | sizeof(struct vmbus_channel_offer_channel)); |
| 280 | newchannel->monitor_grp = (u8)offer->monitorid / 32; | 287 | newchannel->monitor_grp = (u8)offer->monitorid / 32; |
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index e73b852156b1..1ffe84de6c55 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h | |||
| @@ -882,8 +882,28 @@ struct vmbus_channel { | |||
| 882 | 882 | ||
| 883 | void (*onchannel_callback)(void *context); | 883 | void (*onchannel_callback)(void *context); |
| 884 | void *channel_callback_context; | 884 | void *channel_callback_context; |
| 885 | |||
| 886 | /* | ||
| 887 | * A channel can be marked for efficient (batched) | ||
| 888 | * reading: | ||
| 889 | * If batched_reading is set to "true", we read until the | ||
| 890 | * channel is empty and hold off interrupts from the host | ||
| 891 | * during the entire read process. | ||
| 892 | * If batched_reading is set to "false", the client is not | ||
| 893 | * going to perform batched reading. | ||
| 894 | * | ||
| 895 | * By default we will enable batched reading; specific | ||
| 896 | * drivers that don't want this behavior can turn it off. | ||
| 897 | */ | ||
| 898 | |||
| 899 | bool batched_reading; | ||
| 885 | }; | 900 | }; |
| 886 | 901 | ||
| 902 | static inline void set_channel_read_state(struct vmbus_channel *c, bool state) | ||
| 903 | { | ||
| 904 | c->batched_reading = state; | ||
| 905 | } | ||
| 906 | |||
| 887 | void vmbus_onmessage(void *context); | 907 | void vmbus_onmessage(void *context); |
| 888 | 908 | ||
| 889 | int vmbus_request_offers(void); | 909 | int vmbus_request_offers(void); |
