aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/buffer_funcs.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-10-05 15:32:41 +0200
committerDave Barach <openvpp@barachs.net>2017-12-09 14:10:17 +0000
commitcef87f1a5eb4d69cf11ce1cd3c5506edcfba74c4 (patch)
treebc9ee3eb220f9c8a1fb416a45768a99b2f5be53b /src/vlib/buffer_funcs.h
parent34719e37bf820e8398ca9159725f7f4c42764aeb (diff)
vlib: PCI rework to support VFIO
Also fixes old ixge driver, so it works with recent physmem changes and vfio. Change-Id: Id4be74b34daed47cd281a77eec43d6692340d882 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/buffer_funcs.h')
-rw-r--r--src/vlib/buffer_funcs.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h
index 08f5b3e9010..1ea3c0829b8 100644
--- a/src/vlib/buffer_funcs.h
+++ b/src/vlib/buffer_funcs.h
@@ -162,14 +162,12 @@ vlib_buffer_contents (vlib_main_t * vm, u32 buffer_index, u8 * contents)
always_inline u64
vlib_get_buffer_data_physical_address (vlib_main_t * vm, u32 buffer_index)
{
- vlib_physmem_region_index_t pri;
+ vlib_buffer_main_t *bm = vm->buffer_main;
vlib_buffer_t *b = vlib_get_buffer (vm, buffer_index);
- pri = vm->buffer_main->buffer_pools[b->buffer_pool_index].physmem_region;
- return vlib_physmem_offset_to_physical (vm, pri,
- (((uword) buffer_index) <<
- CLIB_LOG2_CACHE_LINE_BYTES) +
- STRUCT_OFFSET_OF (vlib_buffer_t,
- data));
+ vlib_buffer_pool_t *pool = vec_elt_at_index (bm->buffer_pools,
+ b->buffer_pool_index);
+
+ return vlib_physmem_virtual_to_physical (vm, pool->physmem_region, b->data);
}
/** \brief Prefetch buffer metadata by buffer index