aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-04-26 22:45:40 +0200
committerDave Barach <openvpp@barachs.net>2018-04-27 11:20:58 +0000
commitaa682a39b76ee043f65313f23e134bf18fe7a47e (patch)
tree5cd74943911f0a7a9a886e0c309cb18ca1841eb3 /src/vlib
parent582caa3bb67a1380c12790ba6f98450b92835761 (diff)
A bit of buffer metadata reshuffling to accommodate flow_id
Change-Id: I2794384557c6272fe217269b14a9db09eda19220 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/buffer.h17
-rw-r--r--src/vlib/error.h14
2 files changed, 12 insertions, 19 deletions
diff --git a/src/vlib/buffer.h b/src/vlib/buffer.h
index 6d352ce580f..9555cd7d224 100644
--- a/src/vlib/buffer.h
+++ b/src/vlib/buffer.h
@@ -120,31 +120,24 @@ typedef struct
<br> VLIB_BUFFER_FLAG_USER(n): user-defined bit N
*/
+ u32 flow_id; /**< Generic flow identifier */
- STRUCT_MARK (template_end);
u32 next_buffer; /**< Next buffer for this linked-list of buffers.
Only valid if VLIB_BUFFER_NEXT_PRESENT flag is set.
*/
- vlib_error_t error; /**< Error code for buffers to be enqueued
- to error handler.
- */
+ STRUCT_MARK (template_end);
+
u32 current_config_index; /**< Used by feature subgraph arcs to
visit enabled feature nodes
*/
-
- u8 feature_arc_index; /**< Used to identify feature arcs by intermediate
- feature node
+ vlib_error_t error; /**< Error code for buffers to be enqueued
+ to error handler.
*/
-
u8 n_add_refs; /**< Number of additional references to this buffer. */
u8 buffer_pool_index; /**< index of buffer pool this buffer belongs. */
- u8 dont_waste_me[1]; /**< Available space in the (precious)
- first 32 octets of buffer metadata
- Before allocating any of it, discussion required!
- */
u32 opaque[10]; /**< Opaque data used by sub-graphs for their own purposes.
See .../vnet/vnet/buffer.h
diff --git a/src/vlib/error.h b/src/vlib/error.h
index df2075c306d..58352519be2 100644
--- a/src/vlib/error.h
+++ b/src/vlib/error.h
@@ -41,33 +41,33 @@
#define included_vlib_error_h
/* Combined 16 bit node & 16 bit code as 32 bit number. */
-typedef u32 vlib_error_t;
+typedef u16 vlib_error_t;
always_inline u32
vlib_error_get_node (vlib_error_t e)
{
- return e >> 12;
+ return e >> 6;
}
always_inline u32
vlib_error_get_code (vlib_error_t e)
{
- return e & 0xfff;
+ return e & 0x3f;
}
always_inline vlib_error_t
vlib_error_set (u32 node_index, u32 code)
{
- ASSERT (node_index < (1 << 20));
- ASSERT (code < (1 << 12));
- return (node_index << 12) | code;
+ ASSERT (node_index < (1 << 10));
+ ASSERT (code < (1 << 6));
+ return (node_index << 6) | code;
}
always_inline vlib_error_t
vlib_error_set_code (vlib_error_t e, u32 code)
{
ASSERT (vlib_error_get_code (e) == 0);
- ASSERT (code < (1 << 12));
+ ASSERT (code < (1 << 6));
e |= code;
return e;
}