summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_node.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session/session_node.c')
-rw-r--r--src/vnet/session/session_node.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 9cd0ef18415..b8f429eb1d7 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -144,7 +144,7 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
u8 *data0;
int i, n_bytes_read;
u32 n_bytes_per_buf, deq_per_buf, deq_per_first_buf;
- u32 buffers_allocated, buffers_allocated_this_call;
+ u32 bufs_alloc, bufs_now;
next_index = next0 = smm->session_type_to_next[s0->session_type];
@@ -218,23 +218,19 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
{
vec_validate (smm->tx_buffers[thread_index],
n_bufs + n_bufs_per_frame - 1);
- buffers_allocated = 0;
+ bufs_alloc = 0;
do
{
- buffers_allocated_this_call = vlib_buffer_alloc (vm,
- &smm->tx_buffers
- [thread_index]
- [n_bufs +
- buffers_allocated],
- n_bufs_per_frame
- -
- buffers_allocated);
- buffers_allocated += buffers_allocated_this_call;
+ bufs_now =
+ vlib_buffer_alloc (vm,
+ &smm->tx_buffers[thread_index][n_bufs +
+ bufs_alloc],
+ n_bufs_per_frame - bufs_alloc);
+ bufs_alloc += bufs_now;
}
- while (buffers_allocated_this_call > 0
- && ((buffers_allocated + n_bufs < n_bufs_per_frame)));
+ while (bufs_now > 0 && ((bufs_alloc + n_bufs < n_bufs_per_frame)));
- n_bufs += buffers_allocated;
+ n_bufs += bufs_alloc;
_vec_len (smm->tx_buffers[thread_index]) = n_bufs;
if (PREDICT_FALSE (n_bufs < n_bufs_per_frame))
@@ -252,6 +248,15 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
* Handle first buffer in chain separately
*/
+ len_to_deq0 = clib_min (left_to_snd0, deq_per_first_buf);
+ if (left_to_snd0 > len_to_deq0 && n_left_to_next > 1)
+ {
+ vlib_buffer_t *pb;
+ u32 pbi = smm->tx_buffers[thread_index][n_bufs - 2];
+ pb = vlib_get_buffer (vm, pbi);
+ vlib_prefetch_buffer_header (pb, LOAD);
+ }
+
/* Get free buffer */
ASSERT (n_bufs >= 1);
bi0 = smm->tx_buffers[thread_index][--n_bufs];
@@ -264,11 +269,10 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
b0 = vlib_get_buffer (vm, bi0);
b0->error = 0;
- b0->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
+ b0->flags = VNET_BUFFER_F_LOCALLY_ORIGINATED;
b0->current_data = 0;
b0->total_length_not_including_first_buffer = 0;
- len_to_deq0 = clib_min (left_to_snd0, deq_per_first_buf);
data0 = vlib_buffer_make_headroom (b0, MAX_HDRS_LEN);
if (peek_data)
{