vlib: introduce vlib_buffer_get_{pa,va,current_va,current_pa} inlines
Change-Id: I0b42ac6b05bc9910904a97924ea4bebc84507d4d
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vlib/buffer.h b/src/vlib/buffer.h
index 651e7f0..0d24779 100644
--- a/src/vlib/buffer.h
+++ b/src/vlib/buffer.h
@@ -187,6 +187,12 @@
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 @@
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