summaryrefslogtreecommitdiffstats
path: root/vlib
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-06-17 14:09:56 -0400
committerKeith Burns <alagalah@gmail.com>2016-06-18 01:01:36 +0000
commitb5adaeab2fe89844db678a7a2d61d45b5d4cc4c8 (patch)
tree0a892bdfe428756dde66fad98cc1b85fb516d020 /vlib
parentf289ca6bc6be76216a23320dab8aa4ce4b284c05 (diff)
Move pkt replication counter to the opaque2 cache line
Change-Id: I5e6edfd03ab41949be2c768dfe68aa824bbc1f38 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vlib')
-rw-r--r--vlib/vlib/buffer.c6
-rw-r--r--vlib/vlib/buffer.h18
-rw-r--r--vlib/vlib/dpdk_buffer.c6
3 files changed, 16 insertions, 14 deletions
diff --git a/vlib/vlib/buffer.c b/vlib/vlib/buffer.c
index b7ae0a6fa34..f727e67a55a 100644
--- a/vlib/vlib/buffer.c
+++ b/vlib/vlib/buffer.c
@@ -901,8 +901,8 @@ vlib_buffer_free_inline (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
b1 = vlib_get_buffer (vm, bi1);
- free0 = b0->clone_count == 0;
- free1 = b1->clone_count == 0;
+ free0 = (b0->flags & VLIB_BUFFER_RECYCLE) == 0;
+ free1 = (b1->flags & VLIB_BUFFER_RECYCLE) == 0;
/* Must be before init which will over-write buffer flags. */
if (follow_buffer_next)
@@ -986,7 +986,7 @@ vlib_buffer_free_inline (vlib_main_t * vm,
b0 = vlib_get_buffer (vm, bi0);
- free0 = b0->clone_count == 0;
+ free0 = (b0->flags & VLIB_BUFFER_RECYCLE) == 0;
/* Must be before init which will over-write buffer flags. */
if (follow_buffer_next)
diff --git a/vlib/vlib/buffer.h b/vlib/vlib/buffer.h
index 52749572509..bc799bc6223 100644
--- a/vlib/vlib/buffer.h
+++ b/vlib/vlib/buffer.h
@@ -86,6 +86,7 @@ typedef struct {
<br> VLIB_BUFFER_NEXT_PRESENT: this is a multi-chunk buffer.
<br> VLIB_BUFFER_TOTAL_LENGTH_VALID: as it says
<br> VLIB_BUFFER_REPL_FAIL: packet replication failure
+ <br> VLIB_BUFFER_RECYCLE: as it says
<br> VLIB_BUFFER_FLAG_USER(n): user-defined bit N
*/
#define VLIB_BUFFER_IS_TRACED (1 << 0)
@@ -94,6 +95,7 @@ typedef struct {
#define VLIB_BUFFER_IS_RECYCLED (1 << 2)
#define VLIB_BUFFER_TOTAL_LENGTH_VALID (1 << 3)
#define VLIB_BUFFER_REPL_FAIL (1 << 4)
+#define VLIB_BUFFER_RECYCLE (1 << 5)
/* User defined buffer flags. */
#define LOG2_VLIB_BUFFER_FLAG_USER(n) (32 - (n))
@@ -112,14 +114,6 @@ typedef struct {
Only valid if VLIB_BUFFER_NEXT_PRESENT flag is set.
*/
- u32 clone_count; /**< Specifies whether this buffer should be
- reinitialized when freed. It will be reinitialized
- if the value is 0. This field can be used
- as a counter or for other state during packet
- replication. The buffer free function does not
- modify this value.
- */
-
vlib_error_t error; /**< Error code for buffers to be enqueued
to error handler.
*/
@@ -127,6 +121,11 @@ typedef struct {
visit enabled feature nodes
*/
+ u32 dont_waste_me; /**< Available space in the (precious)
+ first 32 octets of buffer metadata
+ Before allocating any of it, discussion required!
+ */
+
u32 opaque[8]; /**< Opaque data used by sub-graphs for their own purposes.
See .../vnet/vnet/buffer.h
*/
@@ -135,7 +134,8 @@ typedef struct {
u32 trace_index; /**< Specifies index into trace buffer
if VLIB_PACKET_IS_TRACED flag is set.
*/
- u32 opaque2[15]; /**< More opaque data, currently unused */
+ u32 recycle_count; /**< Used by L2 path recycle code */
+ u32 opaque2[14]; /**< More opaque data, currently unused */
/***** end of second cache line */
CLIB_CACHE_LINE_ALIGN_MARK(cacheline2);
diff --git a/vlib/vlib/dpdk_buffer.c b/vlib/vlib/dpdk_buffer.c
index ce0f32649aa..c0094938479 100644
--- a/vlib/vlib/dpdk_buffer.c
+++ b/vlib/vlib/dpdk_buffer.c
@@ -708,7 +708,9 @@ vlib_buffer_free_inline (vlib_main_t * vm,
{
int j;
- add_buffer_to_free_list (vm, fl, buffers[i], b->clone_count == 0);
+ add_buffer_to_free_list
+ (vm, fl, buffers[i],
+ (b->flags & VLIB_BUFFER_RECYCLE) == 0);
for (j = 0; j < vec_len (bm->announce_list); j++)
{
@@ -721,7 +723,7 @@ vlib_buffer_free_inline (vlib_main_t * vm,
}
else
{
- if (PREDICT_TRUE (b->clone_count == 0))
+ if (PREDICT_TRUE ((b->flags & VLIB_BUFFER_RECYCLE) == 0))
{
mb = rte_mbuf_from_vlib_buffer(b);
ASSERT(rte_mbuf_refcnt_read(mb) == 1);