summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application_local.c2
-rw-r--r--src/vnet/session/session_node.c21
-rw-r--r--src/vnet/session/transport.h25
3 files changed, 31 insertions, 17 deletions
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index d54d1119ce6..0e1f6db19fb 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -470,7 +470,7 @@ format_ct_connection_id (u8 * s, va_list * args)
}
static int
-ct_custom_tx (void *session, u32 max_burst_size)
+ct_custom_tx (void *session, transport_send_params_t * sp)
{
session_t *s = (session_t *) session;
if (session_has_transport (s))
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 30eca1e6577..f023a95c98c 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -872,7 +872,8 @@ session_tx_fifo_read_and_snd_i (session_worker_t * wrk,
{
u32 n_custom_tx;
ctx->s->flags &= ~SESSION_F_CUSTOM_TX;
- n_custom_tx = ctx->transport_vft->custom_tx (ctx->tc, max_burst);
+ ctx->sp.max_burst_size = max_burst;
+ n_custom_tx = ctx->transport_vft->custom_tx (ctx->tc, &ctx->sp);
*n_tx_packets += n_custom_tx;
if (PREDICT_FALSE
(ctx->s->session_state >= SESSION_STATE_TRANSPORT_CLOSED))
@@ -1068,8 +1069,9 @@ session_tx_fifo_dequeue_internal (session_worker_t * wrk,
vlib_node_runtime_t * node,
session_evt_elt_t * elt, int *n_tx_packets)
{
+ transport_send_params_t *sp = &wrk->ctx.sp;
session_t *s = wrk->ctx.s;
- u32 n_packets, max_pkts;
+ u32 n_packets;
if (PREDICT_FALSE (s->session_state >= SESSION_STATE_TRANSPORT_CLOSED))
return 0;
@@ -1077,18 +1079,17 @@ session_tx_fifo_dequeue_internal (session_worker_t * wrk,
/* Clear custom-tx flag used to request reschedule for tx */
s->flags &= ~SESSION_F_CUSTOM_TX;
- max_pkts = clib_min (VLIB_FRAME_SIZE - *n_tx_packets,
- TRANSPORT_PACER_MAX_BURST_PKTS);
- n_packets = transport_custom_tx (session_get_transport_proto (s), s,
- max_pkts);
- *n_tx_packets -= n_packets;
+ sp->max_burst_size = clib_min (VLIB_FRAME_SIZE - *n_tx_packets,
+ TRANSPORT_PACER_MAX_BURST_PKTS);
- if (svm_fifo_max_dequeue_cons (s->tx_fifo)
- || (s->flags & SESSION_F_CUSTOM_TX))
+ n_packets = transport_custom_tx (session_get_transport_proto (s), s, sp);
+ *n_tx_packets += n_packets;
+
+ if (s->flags & SESSION_F_CUSTOM_TX)
{
session_evt_add_old (wrk, elt);
}
- else
+ else if (!(sp->flags & TRANSPORT_SND_F_DESCHED))
{
svm_fifo_unset_event (s->tx_fifo);
if (svm_fifo_max_dequeue_cons (s->tx_fifo))
diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h
index 6dc6984cdf4..eb98032b1e4 100644
--- a/src/vnet/session/transport.h
+++ b/src/vnet/session/transport.h
@@ -44,9 +44,21 @@ typedef enum transport_snd_flags_
typedef struct transport_send_params_
{
- u32 snd_space;
- u32 tx_offset;
- u16 snd_mss;
+ union
+ {
+ /* Used to retrieve snd params from transports */
+ struct
+ {
+ u32 snd_space;
+ u32 tx_offset;
+ u16 snd_mss;
+ };
+ /* Used by custom tx functions */
+ struct
+ {
+ u32 max_burst_size;
+ };
+ };
transport_snd_flags_t flags;
} transport_send_params_t;
@@ -76,7 +88,7 @@ typedef struct _transport_proto_vft
transport_send_params_t *sp);
void (*update_time) (f64 time_now, u8 thread_index);
void (*flush_data) (transport_connection_t *tconn);
- int (*custom_tx) (void *session, u32 max_burst_size);
+ int (*custom_tx) (void *session, transport_send_params_t *sp);
int (*app_rx_evt) (transport_connection_t *tconn);
/*
@@ -152,9 +164,10 @@ transport_get_half_open (transport_proto_t tp, u32 conn_index)
}
static inline int
-transport_custom_tx (transport_proto_t tp, void *s, u32 max_burst_size)
+transport_custom_tx (transport_proto_t tp, void *s,
+ transport_send_params_t * sp)
{
- return tp_vfts[tp].custom_tx (s, max_burst_size);
+ return tp_vfts[tp].custom_tx (s, sp);
}
static inline int