aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv/channel.c
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2012-12-01 09:46:36 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-17 13:46:39 -0500
commit98fa8cf4bcc79cb14de8fd815bbcd00dcbd7b20e (patch)
tree0d48abd179e49709cdac7e28eb853a653df7fbe2 /drivers/hv/channel.c
parentf878f3d59ed26f489add852ed6d5c8e5f3bbb1aa (diff)
Drivers: hv: Optimize the signaling on the write path
The host has already implemented the "read" side optimizations. Leverage that to optimize "write" side signaling. 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>
Diffstat (limited to 'drivers/hv/channel.c')
-rw-r--r--drivers/hv/channel.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 773a2f25a8f0..727c5f1d6acf 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -564,6 +564,7 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
564 struct scatterlist bufferlist[3]; 564 struct scatterlist bufferlist[3];
565 u64 aligned_data = 0; 565 u64 aligned_data = 0;
566 int ret; 566 int ret;
567 bool signal = false;
567 568
568 569
569 /* Setup the descriptor */ 570 /* Setup the descriptor */
@@ -580,9 +581,9 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer,
580 sg_set_buf(&bufferlist[2], &aligned_data, 581 sg_set_buf(&bufferlist[2], &aligned_data,
581 packetlen_aligned - packetlen); 582 packetlen_aligned - packetlen);
582 583
583 ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3); 584 ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3, &signal);
584 585
585 if (ret == 0 && !hv_get_ringbuffer_interrupt_mask(&channel->outbound)) 586 if (ret == 0 && signal)
586 vmbus_setevent(channel); 587 vmbus_setevent(channel);
587 588
588 return ret; 589 return ret;
@@ -606,6 +607,7 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
606 u32 packetlen_aligned; 607 u32 packetlen_aligned;
607 struct scatterlist bufferlist[3]; 608 struct scatterlist bufferlist[3];
608 u64 aligned_data = 0; 609 u64 aligned_data = 0;
610 bool signal = false;
609 611
610 if (pagecount > MAX_PAGE_BUFFER_COUNT) 612 if (pagecount > MAX_PAGE_BUFFER_COUNT)
611 return -EINVAL; 613 return -EINVAL;
@@ -641,9 +643,9 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel,
641 sg_set_buf(&bufferlist[2], &aligned_data, 643 sg_set_buf(&bufferlist[2], &aligned_data,
642 packetlen_aligned - packetlen); 644 packetlen_aligned - packetlen);
643 645
644 ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3); 646 ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3, &signal);
645 647
646 if (ret == 0 && !hv_get_ringbuffer_interrupt_mask(&channel->outbound)) 648 if (ret == 0 && signal)
647 vmbus_setevent(channel); 649 vmbus_setevent(channel);
648 650
649 return ret; 651 return ret;
@@ -665,6 +667,7 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
665 u32 packetlen_aligned; 667 u32 packetlen_aligned;
666 struct scatterlist bufferlist[3]; 668 struct scatterlist bufferlist[3];
667 u64 aligned_data = 0; 669 u64 aligned_data = 0;
670 bool signal = false;
668 u32 pfncount = NUM_PAGES_SPANNED(multi_pagebuffer->offset, 671 u32 pfncount = NUM_PAGES_SPANNED(multi_pagebuffer->offset,
669 multi_pagebuffer->len); 672 multi_pagebuffer->len);
670 673
@@ -703,9 +706,9 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel,
703 sg_set_buf(&bufferlist[2], &aligned_data, 706 sg_set_buf(&bufferlist[2], &aligned_data,
704 packetlen_aligned - packetlen); 707 packetlen_aligned - packetlen);
705 708
706 ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3); 709 ret = hv_ringbuffer_write(&channel->outbound, bufferlist, 3, &signal);
707 710
708 if (ret == 0 && !hv_get_ringbuffer_interrupt_mask(&channel->outbound)) 711 if (ret == 0 && signal)
709 vmbus_setevent(channel); 712 vmbus_setevent(channel);
710 713
711 return ret; 714 return ret;