quic_fifo_egress_emit (quicly_stream_t * stream, size_t off, void *dst,
size_t * len, int *wrote_all)
{
- u32 deq_max, first_deq, max_rd_chunk, rem_offset;
quic_stream_data_t *stream_data;
session_t *stream_session;
svm_fifo_t *f;
+ u32 deq_max;
stream_data = (quic_stream_data_t *) stream->data;
stream_session = get_stream_session_from_stream (stream);
if (off + *len > stream_data->app_tx_data_len)
stream_data->app_tx_data_len = off + *len;
- /* TODO, use something like : return svm_fifo_peek (f, off, *len, dst); */
- max_rd_chunk = svm_fifo_max_read_chunk (f);
-
- first_deq = 0;
- if (off < max_rd_chunk)
- {
- first_deq = clib_min (*len, max_rd_chunk - off);
- clib_memcpy_fast (dst, svm_fifo_head (f) + off, first_deq);
- }
-
- if (max_rd_chunk < off + *len)
- {
- rem_offset = max_rd_chunk < off ? off - max_rd_chunk : 0;
- clib_memcpy_fast (dst + first_deq, f->head_chunk->data + rem_offset,
- *len - first_deq);
- }
+ svm_fifo_peek (f, off, *len, dst);
return 0;
}
if (rv == QUIC_PACKET_TYPE_RECEIVE)
{
pctx->ptype = QUIC_PACKET_TYPE_RECEIVE;
- quic_ctx_t *qctx = quic_ctx_get (pctx->ctx_index, thread_index);
- quic_crypto_decrypt_packet (qctx, pctx);
+ if (quic_main.vnet_crypto_enabled)
+ {
+ quic_ctx_t *qctx = quic_ctx_get (pctx->ctx_index, thread_index);
+ quic_crypto_decrypt_packet (qctx, pctx);
+ }
return 0;
}
else if (rv == QUIC_PACKET_TYPE_MIGRATE)
.get_transport_endpoint = quic_get_transport_endpoint,
.get_transport_listener_endpoint = quic_get_transport_listener_endpoint,
.transport_options = {
+ .name = "quic",
+ .short_name = "Q",
.tx_type = TRANSPORT_TX_INTERNAL,
.service_type = TRANSPORT_SERVICE_APP,
},
qm->default_crypto_engine = CRYPTO_ENGINE_VPP;
qm->max_packets_per_key = DEFAULT_MAX_PACKETS_PER_KEY;
clib_rwlock_init (&qm->crypto_keys_quic_rw_lock);
+
+ vnet_crypto_main_t *cm = &crypto_main;
+ if (vec_len (cm->engines) == 0)
+ qm->vnet_crypto_enabled = 0;
+ else
+ qm->vnet_crypto_enabled = 1;
+
vec_free (a->name);
return 0;
}