aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-03-16 08:48:31 -0700
committerDave Barach <openvpp@barachs.net>2018-03-23 14:30:06 +0000
commit81a13db67f6e3cca2a974e4c32d8e9db940645dc (patch)
tree5ef6438d2298ad1e5dec13f8d3f842b182c68068 /src/vnet/session
parent0bee9ce4af04322c56f7511f24bda4874e78a4b4 (diff)
tcp/session: sprinkle prefetches
Change-Id: Idef3c665580c13d72e99f43d16b8b13cc6ab746f Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session')
-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)
{