quic: fix quicly fifo size mismatch 12/23112/2
authorDave Wallace <dwallacelf@gmail.com>
Wed, 30 Oct 2019 18:30:53 +0000 (18:30 +0000)
committerFlorin Coras <florin.coras@gmail.com>
Wed, 30 Oct 2019 22:44:58 +0000 (22:44 +0000)
- This fixes an intermittent failure of the
  test_quic_ext_transfer test due to quicly
  being configured with the wrong fifo size
  which was taken from the cli or startup.conf
  file. The fifo size from the application
  context is now used when creating the
  quicly context.
- Emit an error message if the entire chunk
  of a stream is not enqueued in the svm fifo.

Type: fix

Change-Id: I03847ea7d4cd7a617b577697dfe3afa969850937
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
src/plugins/quic/quic.c

index dcab5e3..076fd5e 100644 (file)
@@ -509,7 +509,12 @@ quic_on_receive (quicly_stream_t * stream, size_t off, const void *src,
       /* Streams live on the same thread so (f, stream_data) should stay consistent */
       rlen = svm_fifo_enqueue (f, len, (u8 *) src);
       stream_data->app_rx_data_len += rlen;
-      ASSERT (rlen >= len);
+      if (PREDICT_FALSE (rlen != len))
+       {
+         clib_warning ("ERROR: Could not enqueue all data (rlen %u, len %u)",
+                       rlen, len);
+         ASSERT (rlen == len);
+       }
       app_wrk = app_worker_get_if_valid (stream_session->app_wrk_index);
       if (PREDICT_TRUE (app_wrk != 0))
        app_worker_lock_and_send_event (app_wrk, stream_session,
@@ -861,6 +866,7 @@ quic_store_quicly_ctx (application_t * app, u32 cert_key_index)
   quicly_context_t *quicly_ctx;
   ptls_iovec_t key_vec;
   app_cert_key_pair_t *ckpair;
+  u64 max_enq;
   if (app->quicly_ctx)
     return;
 
@@ -899,8 +905,12 @@ quic_store_quicly_ctx (application_t * app, u32 cert_key_index)
   quicly_ctx->transport_params.max_data = QUIC_INT_MAX;
   quicly_ctx->transport_params.max_streams_uni = (uint64_t) 1 << 60;
   quicly_ctx->transport_params.max_streams_bidi = (uint64_t) 1 << 60;
-  quicly_ctx->transport_params.max_stream_data.bidi_local = (qm->udp_fifo_size - 1);   /* max_enq is SIZE - 1 */
-  quicly_ctx->transport_params.max_stream_data.bidi_remote = (qm->udp_fifo_size - 1);  /* max_enq is SIZE - 1 */
+
+  /* max_enq is FIFO_SIZE - 1 */
+  max_enq = app->sm_properties.rx_fifo_size - 1;
+  quicly_ctx->transport_params.max_stream_data.bidi_local = max_enq;
+  max_enq = app->sm_properties.tx_fifo_size - 1;
+  quicly_ctx->transport_params.max_stream_data.bidi_remote = max_enq;
   quicly_ctx->transport_params.max_stream_data.uni = QUIC_INT_MAX;
 
   quicly_ctx->tls->random_bytes (quicly_ctx_data->cid_key, 16);