summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/dpdk/buffer.c3
-rw-r--r--src/vlib/buffer.c21
-rw-r--r--src/vlib/buffer.h16
-rw-r--r--src/vlib/buffer_funcs.h51
-rw-r--r--src/vlib/main.c1
-rw-r--r--src/vnet/dhcp/dhcp6_proxy_node.c5
-rw-r--r--src/vnet/dns/dns.c1
-rwxr-xr-xsrc/vnet/ip/ping.c3
-rw-r--r--src/vnet/sctp/sctp_output.c1
-rw-r--r--src/vnet/tcp/tcp_output.c1
10 files changed, 23 insertions, 80 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index 7093b01162c..768d66153e5 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -290,8 +290,7 @@ vlib_buffer_free_inline (vlib_main_t * vm,
vlib_buffer_t *bufp[n_buffers], **b = bufp;
u32 thread_index = vlib_get_thread_index ();
int i = 0;
- u32 simple_mask = (VLIB_BUFFER_NON_DEFAULT_FREELIST |
- VLIB_BUFFER_NEXT_PRESENT);
+ u32 simple_mask = VLIB_BUFFER_NEXT_PRESENT;
u32 n_left, *bi;
u32 (*cb) (vlib_main_t * vm, u32 * buffers, u32 n_buffers,
u32 follow_buffer_next);
diff --git a/src/vlib/buffer.c b/src/vlib/buffer.c
index 07f91c39a0e..0251f52bd87 100644
--- a/src/vlib/buffer.c
+++ b/src/vlib/buffer.c
@@ -87,9 +87,9 @@ format_vlib_buffer (u8 * s, va_list * args)
a = format (a, "%s ", v);
foreach_vlib_buffer_flag
#undef _
- s = format (s, "current data %d, length %d, free-list %d, clone-count %u",
- b->current_data, b->current_length,
- vlib_buffer_get_free_list_index (b), b->n_add_refs);
+ s = format (s, "current data %d, length %d, buffer-pool %d, "
+ "clone-count %u", b->current_data, b->current_length,
+ b->buffer_pool_index, b->n_add_refs);
if (b->flags & VLIB_BUFFER_TOTAL_LENGTH_VALID)
s = format (s, ", totlen-nifb %d",
@@ -182,14 +182,8 @@ vlib_validate_buffer_helper (vlib_main_t * vm,
vlib_buffer_t *b = vlib_get_buffer (vm, bi);
vlib_buffer_free_list_t *fl;
- if (pool_is_free_index
- (vm->buffer_free_list_pool, vlib_buffer_get_free_list_index (b)))
- return format (0, "unknown free list 0x%x",
- vlib_buffer_get_free_list_index (b));
-
- fl =
- pool_elt_at_index (vm->buffer_free_list_pool,
- vlib_buffer_get_free_list_index (b));
+ fl = pool_elt_at_index (vm->buffer_free_list_pool,
+ VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
if ((signed) b->current_data < (signed) -VLIB_BUFFER_PRE_DATA_SIZE)
return format (0, "current data %d before pre-data", b->current_data);
@@ -394,7 +388,6 @@ vlib_buffer_create_free_list_helper (vlib_main_t * vm,
f->name = clib_mem_is_vec (name) ? name : format (0, "%s", name);
/* Setup free buffer template. */
- vlib_buffer_set_free_list_index (&f->buffer_init_template, f->index);
f->buffer_init_template.n_add_refs = 0;
if (is_public)
@@ -567,10 +560,10 @@ recycle_or_free (vlib_main_t * vm, vlib_buffer_main_t * bm, u32 bi,
vlib_buffer_t * b, u32 follow_buffer_next)
{
vlib_buffer_free_list_t *fl;
- vlib_buffer_free_list_index_t fi;
u32 flags, next;
- fl = vlib_buffer_get_buffer_free_list (vm, b, &fi);
+ fl = pool_elt_at_index (vm->buffer_free_list_pool,
+ VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
do
{
diff --git a/src/vlib/buffer.h b/src/vlib/buffer.h
index 68d6c5eb32b..56d855101d5 100644
--- a/src/vlib/buffer.h
+++ b/src/vlib/buffer.h
@@ -72,11 +72,10 @@ typedef u8 vlib_buffer_free_list_index_t;
* Buffer Flags
*/
#define foreach_vlib_buffer_flag \
- _( 0, NON_DEFAULT_FREELIST, "non-default-fl") \
- _( 1, IS_TRACED, 0) \
- _( 2, NEXT_PRESENT, 0) \
- _( 3, TOTAL_LENGTH_VALID, 0) \
- _( 4, EXT_HDR_VALID, "ext-hdr-valid")
+ _( 0, IS_TRACED, 0) \
+ _( 1, NEXT_PRESENT, 0) \
+ _( 2, TOTAL_LENGTH_VALID, 0) \
+ _( 3, EXT_HDR_VALID, "ext-hdr-valid")
/* NOTE: only buffer generic flags should be defined here, please consider
using user flags. i.e. src/vnet/buffer.h */
@@ -98,7 +97,7 @@ enum
/* User defined buffer flags. */
#define LOG2_VLIB_BUFFER_FLAG_USER(n) (32 - (n))
#define VLIB_BUFFER_FLAG_USER(n) (1 << LOG2_VLIB_BUFFER_FLAG_USER(n))
-#define VLIB_BUFFER_FLAGS_ALL (0x1f)
+#define VLIB_BUFFER_FLAGS_ALL (0x0f)
/* VLIB buffer representation. */
typedef struct
@@ -161,10 +160,7 @@ typedef struct
/**< Only valid for first buffer in chain. Current length plus
total length given here give total number of bytes in buffer chain.
*/
- vlib_buffer_free_list_index_t free_list_index; /** < only used if
- VLIB_BUFFER_NON_DEFAULT_FREELIST
- flag is set */
- u8 align_pad[3]; /**< available */
+ u8 align_pad[4]; /**< available */
u32 opaque2[12]; /**< More opaque data, see ../vnet/vnet/buffer.h */
/***** end of second cache line */
diff --git a/src/vlib/buffer_funcs.h b/src/vlib/buffer_funcs.h
index cc72c57d5e8..41b5164e0d8 100644
--- a/src/vlib/buffer_funcs.h
+++ b/src/vlib/buffer_funcs.h
@@ -400,28 +400,6 @@ vlib_buffer_round_size (u32 size)
return round_pow2 (size, sizeof (vlib_buffer_t));
}
-always_inline vlib_buffer_free_list_index_t
-vlib_buffer_get_free_list_index (vlib_buffer_t * b)
-{
- if (PREDICT_FALSE (b->flags & VLIB_BUFFER_NON_DEFAULT_FREELIST))
- return b->free_list_index;
-
- return 0;
-}
-
-always_inline void
-vlib_buffer_set_free_list_index (vlib_buffer_t * b,
- vlib_buffer_free_list_index_t index)
-{
- if (PREDICT_FALSE (index))
- {
- b->flags |= VLIB_BUFFER_NON_DEFAULT_FREELIST;
- b->free_list_index = index;
- }
- else
- b->flags &= ~VLIB_BUFFER_NON_DEFAULT_FREELIST;
-}
-
/** \brief Allocate buffers from specific freelist into supplied array
@param vm - (vlib_main_t *) vlib main data structure pointer
@@ -652,16 +630,6 @@ void vlib_buffer_free_list_fill_unaligned (vlib_main_t * vm,
uword n_unaligned_buffers);
always_inline vlib_buffer_free_list_t *
-vlib_buffer_get_buffer_free_list (vlib_main_t * vm, vlib_buffer_t * b,
- vlib_buffer_free_list_index_t * index)
-{
- vlib_buffer_free_list_index_t i;
-
- *index = i = vlib_buffer_get_free_list_index (b);
- return pool_elt_at_index (vm->buffer_free_list_pool, i);
-}
-
-always_inline vlib_buffer_free_list_t *
vlib_buffer_get_free_list (vlib_main_t * vm,
vlib_buffer_free_list_index_t free_list_index)
{
@@ -789,18 +757,13 @@ vlib_buffer_clone_256 (vlib_main_t * vm, u32 src_buffer, u32 * buffers,
return 1;
}
- n_buffers = vlib_buffer_alloc_from_free_list (vm, buffers, n_buffers,
- vlib_buffer_get_free_list_index
- (s));
+ n_buffers = vlib_buffer_alloc (vm, buffers, n_buffers);
for (i = 0; i < n_buffers; i++)
{
vlib_buffer_t *d = vlib_get_buffer (vm, buffers[i]);
d->current_data = s->current_data;
d->current_length = head_end_offset;
- vlib_buffer_set_free_list_index (d,
- vlib_buffer_get_free_list_index (s));
-
d->total_length_not_including_first_buffer = s->current_length -
head_end_offset;
if (PREDICT_FALSE (s->flags & VLIB_BUFFER_NEXT_PRESENT))
@@ -875,8 +838,6 @@ vlib_buffer_attach_clone (vlib_main_t * vm, vlib_buffer_t * head,
vlib_buffer_t * tail)
{
ASSERT ((head->flags & VLIB_BUFFER_NEXT_PRESENT) == 0);
- ASSERT (vlib_buffer_get_free_list_index (head) ==
- vlib_buffer_get_free_list_index (tail));
head->flags |= VLIB_BUFFER_NEXT_PRESENT;
head->flags &= ~VLIB_BUFFER_TOTAL_LENGTH_VALID;
@@ -1026,7 +987,6 @@ vlib_buffer_init_for_free_list (vlib_buffer_t * dst,
/* Not in the first 16 octets. */
dst->n_add_refs = src->n_add_refs;
- vlib_buffer_set_free_list_index (dst, fl->index);
/* Make sure it really worked. */
#define _(f) ASSERT (dst->f == src->f);
@@ -1159,9 +1119,10 @@ vlib_buffer_chain_compress (vlib_main_t * vm,
return;
}
/* probe free list to find allocated buffer size to avoid overfill */
- vlib_buffer_free_list_index_t index;
- vlib_buffer_free_list_t *free_list =
- vlib_buffer_get_buffer_free_list (vm, first, &index);
+ vlib_buffer_free_list_t *free_list;
+
+ free_list = pool_elt_at_index (vm->buffer_free_list_pool,
+ VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
u32 want_first_size = clib_min (VLIB_BUFFER_CHAIN_MIN_FIRST_DATA_SIZE,
free_list->n_data_bytes -
@@ -1212,7 +1173,7 @@ vlib_buffer_chain_linearize (vlib_main_t * vm, vlib_buffer_t * first)
{
vlib_buffer_t *b = first;
vlib_buffer_free_list_t *fl =
- vlib_buffer_get_free_list (vm, vlib_buffer_get_free_list_index (b));
+ vlib_buffer_get_free_list (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
u32 buf_len = fl->n_data_bytes;
// free buffer chain starting from the second buffer
int free_count = (b->flags & VLIB_BUFFER_NEXT_PRESENT) != 0;
diff --git a/src/vlib/main.c b/src/vlib/main.c
index ae78c430134..650fa281746 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -987,7 +987,6 @@ format_buffer_metadata (u8 * s, va_list * args)
"trace_index: %d, recycle_count: %d, len_not_first_buf: %d\n",
b->trace_index, b->recycle_count,
b->total_length_not_including_first_buffer);
- s = format (s, "free_list_index: %d\n", (u32) (b->free_list_index));
return s;
}
diff --git a/src/vnet/dhcp/dhcp6_proxy_node.c b/src/vnet/dhcp/dhcp6_proxy_node.c
index 432bc8dbe68..ea06c18cb10 100644
--- a/src/vnet/dhcp/dhcp6_proxy_node.c
+++ b/src/vnet/dhcp/dhcp6_proxy_node.c
@@ -315,9 +315,8 @@ dhcpv6_proxy_to_server_input (vlib_main_t * vm,
copy_ip6_address (&r1->link_addr, ia0);
link_address_set:
- fl =
- vlib_buffer_get_free_list (vm,
- vlib_buffer_get_free_list_index (b0));
+ fl = vlib_buffer_get_free_list
+ (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX);
if ((b0->current_length + sizeof (*id1) + sizeof (*vss1) +
sizeof (*cmac)) > fl->n_data_bytes)
diff --git a/src/vnet/dns/dns.c b/src/vnet/dns/dns.c
index 93b7fb8b9f4..15d40beb710 100644
--- a/src/vnet/dns/dns.c
+++ b/src/vnet/dns/dns.c
@@ -2810,7 +2810,6 @@ vnet_send_dns4_reply (dns_main_t * dm, dns_pending_request_t * pr,
* In the resolution-required / deferred case, resetting a freshly-allocated
* buffer won't hurt. We hope.
*/
- b0->flags &= VLIB_BUFFER_NON_DEFAULT_FREELIST;
b0->flags |= (VNET_BUFFER_F_LOCALLY_ORIGINATED
| VLIB_BUFFER_TOTAL_LENGTH_VALID);
b0->current_data = 0;
diff --git a/src/vnet/ip/ping.c b/src/vnet/ip/ping.c
index f147e47f1c2..92a92e50201 100755
--- a/src/vnet/ip/ping.c
+++ b/src/vnet/ip/ping.c
@@ -404,8 +404,7 @@ init_icmp46_echo_request (vlib_main_t * vm, vlib_buffer_t * b0,
int this_buf_data_len =
remaining_data_len <
VLIB_BUFFER_DATA_SIZE ? remaining_data_len : VLIB_BUFFER_DATA_SIZE;
- int n_alloc = vlib_buffer_alloc_from_free_list (vm, &b0->next_buffer, 1,
- hb->free_list_index);
+ int n_alloc = vlib_buffer_alloc (vm, &b0->next_buffer, 1);
if (n_alloc < 1)
{
/* That is how much we have so far - return it... */
diff --git a/src/vnet/sctp/sctp_output.c b/src/vnet/sctp/sctp_output.c
index c0e1a6eb339..17b28a86492 100644
--- a/src/vnet/sctp/sctp_output.c
+++ b/src/vnet/sctp/sctp_output.c
@@ -271,7 +271,6 @@ always_inline void *
sctp_init_buffer (vlib_main_t * vm, vlib_buffer_t * b)
{
ASSERT ((b->flags & VLIB_BUFFER_NEXT_PRESENT) == 0);
- b->flags &= VLIB_BUFFER_NON_DEFAULT_FREELIST;
b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
b->total_length_not_including_first_buffer = 0;
vnet_buffer (b)->sctp.flags = 0;
diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c
index 97f5b81f9e8..8d06ea35295 100644
--- a/src/vnet/tcp/tcp_output.c
+++ b/src/vnet/tcp/tcp_output.c
@@ -519,7 +519,6 @@ static void *
tcp_init_buffer (vlib_main_t * vm, vlib_buffer_t * b)
{
ASSERT ((b->flags & VLIB_BUFFER_NEXT_PRESENT) == 0);
- b->flags &= VLIB_BUFFER_NON_DEFAULT_FREELIST;
b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
b->total_length_not_including_first_buffer = 0;
b->current_data = 0;