diff options
Diffstat (limited to 'src/vlib')
-rw-r--r-- | src/vlib/buffer.h | 12 | ||||
-rw-r--r-- | src/vlib/buffer_funcs.h | 13 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/vlib/buffer.h b/src/vlib/buffer.h index 651e7f0dc8f..0d24779e52b 100644 --- a/src/vlib/buffer.h +++ b/src/vlib/buffer.h @@ -187,6 +187,12 @@ vlib_buffer_struct_is_sane (vlib_buffer_t * b) ASSERT (b->pre_data + VLIB_BUFFER_PRE_DATA_SIZE == b->data); } +always_inline uword +vlib_buffer_get_va (vlib_buffer_t * b) +{ + return pointer_to_uword (b->data); +} + /** \brief Get pointer to current data to process @param b - (vlib_buffer_t *) pointer to the buffer @@ -201,6 +207,12 @@ vlib_buffer_get_current (vlib_buffer_t * b) return b->data + b->current_data; } +always_inline uword +vlib_buffer_get_current_va (vlib_buffer_t * b) +{ + return vlib_buffer_get_va (b) + b->current_data; +} + /** \brief Advance current data pointer by the supplied (signed!) amount @param b - (vlib_buffer_t *) pointer to the buffer 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 |