aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/buffer.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.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.h')
-rw-r--r--src/vlib/buffer.h12
1 files changed, 12 insertions, 0 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