summaryrefslogtreecommitdiffstats
path: root/src/dpdk/lib/librte_eal/bsdapp/contigmem/contigmem.c
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2017-02-05 15:21:19 +0200
committerIdo Barnea <ibarnea@cisco.com>2017-02-13 12:32:01 +0200
commit9ca4a157305e4e23a892ba9bafc9eee0f66954ce (patch)
tree1a8afcf815fd33e7623e3c16246abe86c01bc8fd /src/dpdk/lib/librte_eal/bsdapp/contigmem/contigmem.c
parent2dab8f65015e9fa90df395be6ee1a07e9ac71044 (diff)
dpdk1702-rc2 upstream files unchanged + mlx5 driver rc3
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
Diffstat (limited to 'src/dpdk/lib/librte_eal/bsdapp/contigmem/contigmem.c')
-rw-r--r--src/dpdk/lib/librte_eal/bsdapp/contigmem/contigmem.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dpdk/lib/librte_eal/bsdapp/contigmem/contigmem.c b/src/dpdk/lib/librte_eal/bsdapp/contigmem/contigmem.c
index c6ca3b9c..da971deb 100644
--- a/src/dpdk/lib/librte_eal/bsdapp/contigmem/contigmem.c
+++ b/src/dpdk/lib/librte_eal/bsdapp/contigmem/contigmem.c
@@ -216,15 +216,19 @@ static int
contigmem_mmap_single(struct cdev *cdev, vm_ooffset_t *offset, vm_size_t size,
struct vm_object **obj, int nprot)
{
+ uint64_t buffer_index;
+
/*
* The buffer index is encoded in the offset. Divide the offset by
* PAGE_SIZE to get the index of the buffer requested by the user
* app.
*/
- if ((*offset/PAGE_SIZE) >= contigmem_num_buffers)
+ buffer_index = *offset / PAGE_SIZE;
+ if (buffer_index >= contigmem_num_buffers)
return EINVAL;
- *offset = (vm_ooffset_t)vtophys(contigmem_buffers[*offset/PAGE_SIZE]);
+ memset(contigmem_buffers[buffer_index], 0, contigmem_buffer_size);
+ *offset = (vm_ooffset_t)vtophys(contigmem_buffers[buffer_index]);
*obj = vm_pager_allocate(OBJT_DEVICE, cdev, size, nprot, *offset,
curthread->td_ucred);