Skip to content

Commit

Permalink
Drivers: hv: Add state to manage batched reading
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Jan 17, 2013
1 parent 6fdf3b2 commit 132368b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/hv/channel_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
return;
}

/*
* By default we setup state to enable batched
* reading. A specific service can choose to
* disable this prior to opening the channel.
*/
newchannel->batched_reading = true;

memcpy(&newchannel->offermsg, offer,
sizeof(struct vmbus_channel_offer_channel));
newchannel->monitor_grp = (u8)offer->monitorid / 32;
Expand Down
20 changes: 20 additions & 0 deletions include/linux/hyperv.h
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,28 @@ struct vmbus_channel {

void (*onchannel_callback)(void *context);
void *channel_callback_context;

/*
* A channel can be marked for efficient (batched)
* reading:
* If batched_reading is set to "true", we read until the
* channel is empty and hold off interrupts from the host
* during the entire read process.
* If batched_reading is set to "false", the client is not
* going to perform batched reading.
*
* By default we will enable batched reading; specific
* drivers that don't want this behavior can turn it off.
*/

bool batched_reading;
};

static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
{
c->batched_reading = state;
}

void vmbus_onmessage(void *context);

int vmbus_request_offers(void);
Expand Down

0 comments on commit 132368b

Please sign in to comment.