aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/buffer_funcs.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-10-22 13:07:02 +0200
committerDamjan Marion <dmarion@me.com>2018-10-22 13:01:19 +0000
commit8f49936b20508d57968f01dcb18f8d31b1a58f3f (patch)
treeedb3ee5da2457b345274f69eab70d05123ada08e /src/vlib/buffer_funcs.h
parent6f3f1cbf7760efb17c5754c3dbccdefd433675cb (diff)
vlib: introduce vlib_buffer_get_{pa,va,current_va,current_pa} inlines
Change-Id: I0b42ac6b05bc9910904a97924ea4bebc84507d4d Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/buffer_funcs.h')
-rw-r--r--src/vlib/buffer_funcs.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h
index 438bf7e5ee4..1110c206e52 100644
--- a/src/vlib/buffer_funcs.h
+++ b/src/vlib/buffer_funcs.h
@@ -314,18 +314,21 @@ vlib_buffer_contents (vlib_main_t * vm, u32 buffer_index, u8 * contents)
return content_len;
}
-/* Return physical address of buffer->data start. */
-always_inline u64
-vlib_get_buffer_data_physical_address (vlib_main_t * vm, u32 buffer_index)
+always_inline uword
+vlib_buffer_get_pa (vlib_main_t * vm, vlib_buffer_t * b)
{
vlib_buffer_main_t *bm = &buffer_main;
- vlib_buffer_t *b = vlib_get_buffer (vm, buffer_index);
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);
}
+always_inline uword
+vlib_buffer_get_current_pa (vlib_main_t * vm, vlib_buffer_t * b)
+{
+ return vlib_buffer_get_pa (vm, b) + b->current_data;
+}
+
/** \brief Prefetch buffer metadata by buffer index
The first 64 bytes of buffer contains most header information