aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv/ring_buffer.c
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2014-02-01 22:02:20 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-07 18:22:40 -0500
commit011a7c3cc3aa60c7ea6bb49d847e80a299ba7b36 (patch)
tree97dc47f7d4d372b76ccefc50582e2abcf9489d21 /drivers/hv/ring_buffer.c
parent90f3453585479d5beb75058da46eb573ced0e6ac (diff)
Drivers: hv: vmbus: Cleanup the packet send path
The current channel code is using scatterlist abstraction to pass data to the ringbuffer API on the send path. This causes unnecessary translations between virtual and physical addresses. Fix this. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv/ring_buffer.c')
-rw-r--r--drivers/hv/ring_buffer.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 26c93cf9f6be..15db66b74141 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -26,6 +26,7 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/mm.h> 27#include <linux/mm.h>
28#include <linux/hyperv.h> 28#include <linux/hyperv.h>
29#include <linux/uio.h>
29 30
30#include "hyperv_vmbus.h" 31#include "hyperv_vmbus.h"
31 32
@@ -387,23 +388,20 @@ void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
387 * 388 *
388 */ 389 */
389int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info, 390int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
390 struct scatterlist *sglist, u32 sgcount, bool *signal) 391 struct kvec *kv_list, u32 kv_count, bool *signal)
391{ 392{
392 int i = 0; 393 int i = 0;
393 u32 bytes_avail_towrite; 394 u32 bytes_avail_towrite;
394 u32 bytes_avail_toread; 395 u32 bytes_avail_toread;
395 u32 totalbytes_towrite = 0; 396 u32 totalbytes_towrite = 0;
396 397
397 struct scatterlist *sg;
398 u32 next_write_location; 398 u32 next_write_location;
399 u32 old_write; 399 u32 old_write;
400 u64 prev_indices = 0; 400 u64 prev_indices = 0;
401 unsigned long flags; 401 unsigned long flags;
402 402
403 for_each_sg(sglist, sg, sgcount, i) 403 for (i = 0; i < kv_count; i++)
404 { 404 totalbytes_towrite += kv_list[i].iov_len;
405 totalbytes_towrite += sg->length;
406 }
407 405
408 totalbytes_towrite += sizeof(u64); 406 totalbytes_towrite += sizeof(u64);
409 407
@@ -427,12 +425,11 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
427 425
428 old_write = next_write_location; 426 old_write = next_write_location;
429 427
430 for_each_sg(sglist, sg, sgcount, i) 428 for (i = 0; i < kv_count; i++) {
431 {
432 next_write_location = hv_copyto_ringbuffer(outring_info, 429 next_write_location = hv_copyto_ringbuffer(outring_info,
433 next_write_location, 430 next_write_location,
434 sg_virt(sg), 431 kv_list[i].iov_base,
435 sg->length); 432 kv_list[i].iov_len);
436 } 433 }
437 434
438 /* Set previous packet start */ 435 /* Set previous packet start */