aboutsummaryrefslogtreecommitdiffstats
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
parent582caa3bb67a1380c12790ba6f98450b92835761 (diff)
A bit of buffer metadata reshuffling to accommodate flow_id
Change-Id: I2794384557c6272fe217269b14a9db09eda19220 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/plugins/dpdk/device/node.c2
-rw-r--r--src/vlib/buffer.h17
-rw-r--r--src/vlib/error.h14
-rw-r--r--src/vnet/buffer.h3
-rw-r--r--src/vnet/feature/feature.h18
-rw-r--r--src/vnet/interface_output.c10
-rw-r--r--src/vnet/ip/ip4_input.h6
-rw-r--r--src/vnet/ip/ip4_reassembly.c4
-rw-r--r--src/vnet/ip/ip6_reassembly.c5
-rw-r--r--src/vnet/pg/input.c2
10 files changed, 37 insertions, 44 deletions
diff --git a/src/plugins/dpdk/device/node.c b/src/plugins/dpdk/device/node.c
index c2d66ae6f82..b8fe834755c 100644
--- a/src/plugins/dpdk/device/node.c
+++ b/src/plugins/dpdk/device/node.c
@@ -518,7 +518,7 @@ dpdk_device_input (vlib_main_t * vm, dpdk_main_t * dm, dpdk_device_t * xd,
for (n = 0; n < n_rx_packets; n++)
ptd->next[n] = next_index;
- bt->feature_arc_index = 0;
+ vnet_buffer (bt)->feature_arc_index = 0;
bt->current_config_index = 0;
}
else
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;
}
diff --git a/src/vnet/buffer.h b/src/vnet/buffer.h
index 86f75389d70..dfb05ac0b17 100644
--- a/src/vnet/buffer.h
+++ b/src/vnet/buffer.h
@@ -116,7 +116,8 @@ typedef struct
i16 l2_hdr_offset;
i16 l3_hdr_offset;
i16 l4_hdr_offset;
- u16 dont_waste_me;
+ u8 feature_arc_index;
+ u8 dont_waste_me;
union
{
diff --git a/src/vnet/feature/feature.h b/src/vnet/feature/feature.h
index f6b1d12b055..ce9e2ca3570 100644
--- a/src/vnet/feature/feature.h
+++ b/src/vnet/feature/feature.h
@@ -204,7 +204,7 @@ vnet_feature_arc_start_with_data (u8 arc, u32 sw_if_index, u32 * next,
if (PREDICT_FALSE (vnet_have_features (arc, sw_if_index)))
{
- b->feature_arc_index = arc;
+ vnet_buffer (b)->feature_arc_index = arc;
b->current_config_index =
vec_elt (cm->config_index_by_sw_if_index, sw_if_index);
return vnet_get_config_data (&cm->config_main, &b->current_config_index,
@@ -225,7 +225,7 @@ vnet_feature_next_with_data (u32 sw_if_index, u32 * next0,
vlib_buffer_t * b0, u32 n_data_bytes)
{
vnet_feature_main_t *fm = &feature_main;
- u8 arc = b0->feature_arc_index;
+ u8 arc = vnet_buffer (b0)->feature_arc_index;
vnet_feature_config_main_t *cm = &fm->feature_config_mains[arc];
return vnet_get_config_data (&cm->config_main,
@@ -270,7 +270,7 @@ vnet_feature_start_device_input_x1 (u32 sw_if_index, u32 * next0,
vnet_buffer (b0)->device_input_feat.buffer_advance = adv;
vlib_buffer_advance (b0, -adv);
- b0->feature_arc_index = feature_arc_index;
+ vnet_buffer (b0)->feature_arc_index = feature_arc_index;
b0->current_config_index =
vec_elt (cm->config_index_by_sw_if_index, sw_if_index);
vnet_get_config_data (&cm->config_main, &b0->current_config_index,
@@ -309,8 +309,8 @@ vnet_feature_start_device_input_x2 (u32 sw_if_index,
vnet_buffer (b1)->device_input_feat.buffer_advance = adv;
vlib_buffer_advance (b1, -adv);
- b0->feature_arc_index = feature_arc_index;
- b1->feature_arc_index = feature_arc_index;
+ vnet_buffer (b0)->feature_arc_index = feature_arc_index;
+ vnet_buffer (b1)->feature_arc_index = feature_arc_index;
b0->current_config_index =
vec_elt (cm->config_index_by_sw_if_index, sw_if_index);
b1->current_config_index = b0->current_config_index;
@@ -366,10 +366,10 @@ vnet_feature_start_device_input_x4 (u32 sw_if_index,
vnet_buffer (b3)->device_input_feat.buffer_advance = adv;
vlib_buffer_advance (b3, -adv);
- b0->feature_arc_index = feature_arc_index;
- b1->feature_arc_index = feature_arc_index;
- b2->feature_arc_index = feature_arc_index;
- b3->feature_arc_index = feature_arc_index;
+ vnet_buffer (b0)->feature_arc_index = feature_arc_index;
+ vnet_buffer (b1)->feature_arc_index = feature_arc_index;
+ vnet_buffer (b2)->feature_arc_index = feature_arc_index;
+ vnet_buffer (b3)->feature_arc_index = feature_arc_index;
b0->current_config_index =
vec_elt (cm->config_index_by_sw_if_index, sw_if_index);
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c
index fe029b865fa..7631a32092f 100644
--- a/src/vnet/interface_output.c
+++ b/src/vnet/interface_output.c
@@ -328,10 +328,10 @@ vnet_interface_output_node_inline (vlib_main_t * vm,
if (PREDICT_FALSE (current_config_index != ~0))
{
- b0->feature_arc_index = arc;
- b1->feature_arc_index = arc;
- b2->feature_arc_index = arc;
- b3->feature_arc_index = arc;
+ vnet_buffer (b0)->feature_arc_index = arc;
+ vnet_buffer (b1)->feature_arc_index = arc;
+ vnet_buffer (b2)->feature_arc_index = arc;
+ vnet_buffer (b3)->feature_arc_index = arc;
b0->current_config_index = current_config_index;
b1->current_config_index = current_config_index;
b2->current_config_index = current_config_index;
@@ -415,7 +415,7 @@ vnet_interface_output_node_inline (vlib_main_t * vm,
if (PREDICT_FALSE (current_config_index != ~0))
{
- b0->feature_arc_index = arc;
+ vnet_buffer (b0)->feature_arc_index = arc;
b0->current_config_index = current_config_index;
}
diff --git a/src/vnet/ip/ip4_input.h b/src/vnet/ip/ip4_input.h
index 2692848f8ad..600d6937dd8 100644
--- a/src/vnet/ip/ip4_input.h
+++ b/src/vnet/ip/ip4_input.h
@@ -133,6 +133,7 @@ ip4_input_check_x2 (vlib_main_t * vm,
else
*next0 = error0 != IP4_ERROR_OPTIONS ?
IP4_INPUT_NEXT_DROP : IP4_INPUT_NEXT_PUNT;
+ p0->error = error_node->errors[error0];
}
if (PREDICT_FALSE (error1 != IP4_ERROR_NONE))
{
@@ -146,10 +147,9 @@ ip4_input_check_x2 (vlib_main_t * vm,
else
*next1 = error1 != IP4_ERROR_OPTIONS ?
IP4_INPUT_NEXT_DROP : IP4_INPUT_NEXT_PUNT;
+ p1->error = error_node->errors[error1];
}
- p0->error = error_node->errors[error0];
- p1->error = error_node->errors[error1];
}
always_inline void
@@ -208,9 +208,9 @@ ip4_input_check_x1 (vlib_main_t * vm,
else
*next0 = error0 != IP4_ERROR_OPTIONS ?
IP4_INPUT_NEXT_DROP : IP4_INPUT_NEXT_PUNT;
+ p0->error = error_node->errors[error0];
}
- p0->error = error_node->errors[error0];
}
/*
diff --git a/src/vnet/ip/ip4_reassembly.c b/src/vnet/ip/ip4_reassembly.c
index 33cdbd5e04d..d924f37a47b 100644
--- a/src/vnet/ip/ip4_reassembly.c
+++ b/src/vnet/ip/ip4_reassembly.c
@@ -402,7 +402,7 @@ always_inline void
ip4_reass_finalize (vlib_main_t * vm, vlib_node_runtime_t * node,
ip4_reass_main_t * rm, ip4_reass_per_thread_t * rt,
ip4_reass_t * reass, u32 * bi0, u32 * next0,
- vlib_error_t * error0, u32 ** vec_drop_compress,
+ u32 * error0, u32 ** vec_drop_compress,
u32 ** vec_drop_overlap, bool is_feature)
{
ASSERT (~0 != reass->first_bi);
@@ -651,7 +651,7 @@ always_inline void
ip4_reass_update (vlib_main_t * vm, vlib_node_runtime_t * node,
ip4_reass_main_t * rm, ip4_reass_per_thread_t * rt,
ip4_reass_t * reass, u32 * bi0, u32 * next0,
- vlib_error_t * error0, u32 ** vec_drop_overlap,
+ u32 * error0, u32 ** vec_drop_overlap,
u32 ** vec_drop_compress, bool is_feature)
{
int consumed = 0;
diff --git a/src/vnet/ip/ip6_reassembly.c b/src/vnet/ip/ip6_reassembly.c
index 8b199f39ced..ce30d952acc 100644
--- a/src/vnet/ip/ip6_reassembly.c
+++ b/src/vnet/ip/ip6_reassembly.c
@@ -437,8 +437,7 @@ always_inline void
ip6_reass_finalize (vlib_main_t * vm, vlib_node_runtime_t * node,
ip6_reass_main_t * rm, ip6_reass_per_thread_t * rt,
ip6_reass_t * reass, u32 * bi0, u32 * next0,
- vlib_error_t * error0, u32 ** vec_drop_compress,
- bool is_feature)
+ u32 * error0, u32 ** vec_drop_compress, bool is_feature)
{
ASSERT (~0 != reass->first_bi);
*bi0 = reass->first_bi;
@@ -660,7 +659,7 @@ always_inline void
ip6_reass_update (vlib_main_t * vm, vlib_node_runtime_t * node,
ip6_reass_main_t * rm, ip6_reass_per_thread_t * rt,
ip6_reass_t * reass, u32 * bi0, u32 * next0,
- vlib_error_t * error0, ip6_frag_hdr_t * frag_hdr,
+ u32 * error0, ip6_frag_hdr_t * frag_hdr,
u32 ** vec_drop_overlap, u32 ** vec_drop_compress,
bool is_feature)
{
diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c
index 1cbffedd480..a7430822c9b 100644
--- a/src/vnet/pg/input.c
+++ b/src/vnet/pg/input.c
@@ -1523,7 +1523,7 @@ pg_generate_packets (vlib_node_runtime_t * node,
s->next_index;
vnet_buffer (b)->device_input_feat.buffer_advance = 0;
b->current_config_index = current_config_index;
- b->feature_arc_index = feature_arc_index;
+ vnet_buffer (b)->feature_arc_index = feature_arc_index;
}
n_trace = vlib_get_trace_count (vm, node);