evt->event_type = SESSION_CTRL_EVT_WORKER_UPDATE_REPLY;
rmp = (session_worker_update_reply_msg_t *) evt->data;
rmp->handle = mp->handle;
- rmp->rx_fifo = pointer_to_uword (s->rx_fifo);
- rmp->tx_fifo = pointer_to_uword (s->tx_fifo);
+ if (s->rx_fifo)
+ rmp->rx_fifo = fifo_segment_fifo_offset (s->rx_fifo);
+ if (s->tx_fifo)
+ rmp->tx_fifo = fifo_segment_fifo_offset (s->tx_fifo);
rmp->segment_handle = session_segment_handle (s);
svm_msg_q_add_and_unlock (app_wrk->event_queue, msg);
u32 next_index, u32 * to_next, u16 n_segs,
session_t * s, u32 n_trace)
{
- session_queue_trace_t *t;
- vlib_buffer_t *b;
- int i;
-
- for (i = 0; i < clib_min (n_trace, n_segs); i++)
+ while (n_trace && n_segs)
{
- b = vlib_get_buffer (vm, to_next[i]);
- vlib_trace_buffer (vm, node, next_index, b, 1 /* follow_chain */ );
- t = vlib_add_trace (vm, node, b, sizeof (*t));
- t->session_index = s->session_index;
- t->server_thread_index = s->thread_index;
+ vlib_buffer_t *b = vlib_get_buffer (vm, to_next[0]);
+ if (PREDICT_TRUE
+ (vlib_trace_buffer
+ (vm, node, next_index, b, 1 /* follow_chain */ )))
+ {
+ session_queue_trace_t *t =
+ vlib_add_trace (vm, node, b, sizeof (*t));
+ t->session_index = s->session_index;
+ t->server_thread_index = s->thread_index;
+ n_trace--;
+ }
+ to_next++;
+ n_segs--;
}
- vlib_set_trace_count (vm, node, n_trace - i);
+ vlib_set_trace_count (vm, node, n_trace);
}
always_inline void
svm_fifo_t *f = ctx->s->tx_fifo;
session_dgram_hdr_t *hdr = &ctx->hdr;
u16 deq_now;
+ u32 offset;
+
deq_now = clib_min (hdr->data_length - hdr->data_offset,
len_to_deq);
- n_bytes_read = svm_fifo_peek (f, hdr->data_offset, deq_now,
- data);
+ offset = hdr->data_offset + SESSION_CONN_HDR_LEN;
+ n_bytes_read = svm_fifo_peek (f, offset, deq_now, data);
ASSERT (n_bytes_read > 0);
hdr->data_offset += n_bytes_read;
if (hdr->data_offset == hdr->data_length)
{
- u32 offset = hdr->data_length + SESSION_CONN_HDR_LEN;
+ offset = hdr->data_length + SESSION_CONN_HDR_LEN;
svm_fifo_dequeue_drop (f, offset);
if (ctx->left_to_snd > n_bytes_read)
svm_fifo_peek (ctx->s->tx_fifo, 0, sizeof (ctx->hdr),
return SESSION_TX_NO_BUFFERS;
}
- transport_connection_update_tx_bytes (ctx->tc, ctx->max_len_to_snd);
+ if (transport_connection_is_tx_paced (ctx->tc))
+ transport_connection_tx_pacer_update_bytes (ctx->tc, ctx->max_len_to_snd);
ctx->left_to_snd = ctx->max_len_to_snd;
n_left = ctx->n_segs_per_evt;
if (!peek_data)
{
- if (svm_fifo_needs_deq_ntf (ctx->s->tx_fifo, ctx->max_len_to_snd))
+ u32 n_dequeued = ctx->max_len_to_snd;
+ if (ctx->transport_vft->transport_options.tx_type == TRANSPORT_TX_DGRAM)
+ n_dequeued += ctx->n_segs_per_evt * SESSION_CONN_HDR_LEN;
+ if (svm_fifo_needs_deq_ntf (ctx->s->tx_fifo, n_dequeued))
session_dequeue_notify (ctx->s);
}
return SESSION_TX_OK;
session_evt_add_head_old (wrk, elt);
}
+ if (sp->max_burst_size &&
+ svm_fifo_needs_deq_ntf (s->tx_fifo, sp->max_burst_size))
+ session_dequeue_notify (s);
+
return n_packets;
}
* XXX: we may need priorities here */
mq = wrk->vpp_event_queue;
n_to_dequeue = svm_msg_q_size (mq);
- if (n_to_dequeue && svm_msg_q_try_lock (mq) == 0)
+ if (n_to_dequeue)
{
for (i = 0; i < n_to_dequeue; i++)
{
- svm_msg_q_sub_w_lock (mq, msg);
+ svm_msg_q_sub_raw (mq, msg);
evt = svm_msg_q_msg_data (mq, msg);
session_evt_add_to_list (wrk, evt);
svm_msg_q_free_msg (mq, msg);
}
- svm_msg_q_unlock (mq);
}
SESSION_EVT (SESSION_EVT_DSP_CNTRS, MQ_DEQ, wrk, n_to_dequeue, !i);
static clib_error_t *
session_queue_exit (vlib_main_t * vm)
{
- if (vec_len (vlib_mains) < 2)
+ if (vlib_get_n_threads () < 2)
return 0;
/*