aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2018-11-06 12:36:44 +0100
committerTibor Frank <tifrank@cisco.com>2018-11-06 13:10:40 +0000
commit32bbad707629a44d17a7e9958b6ec462ba77fe49 (patch)
treee87d92faebd397a74e7b3a0428152944843aa6f5 /resources
parentc225c222e1554d7d3406f92a40c74269620cc885 (diff)
CSIT-1350: Add new data to 1810 report
Change-Id: I833df1c69ee86870ac19a747ea790dcffb749bca Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources')
-rw-r--r--resources/tools/presentation/generator_plots.py24
-rw-r--r--resources/tools/presentation/specification.yaml342
2 files changed, 224 insertions, 142 deletions
diff --git a/resources/tools/presentation/generator_plots.py b/resources/tools/presentation/generator_plots.py
index 0889d2461e..f406539eae 100644
--- a/resources/tools/presentation/generator_plots.py
+++ b/resources/tools/presentation/generator_plots.py
@@ -245,15 +245,23 @@ def plot_latency_error_bars(plot, input_data):
y_sorted = OrderedDict()
y_tags_l = {s: [t.lower() for t in ts] for s, ts in y_tags.items()}
for tag in order:
+ logging.info(tag)
for suite, tags in y_tags_l.items():
- if tag.lower() in tags:
- try:
- y_sorted[suite] = y_tmp_vals.pop(suite)
- y_tags_l.pop(suite)
- except KeyError as err:
- logging.error("Not found: {0}".format(err))
- finally:
- break
+ if "not " in tag:
+ tag = tag.split(" ")[-1]
+ if tag.lower() in tags:
+ continue
+ else:
+ if tag.lower() not in tags:
+ continue
+ try:
+ y_sorted[suite] = y_tmp_vals.pop(suite)
+ y_tags_l.pop(suite)
+ logging.info(suite)
+ except KeyError as err:
+ logging.error("Not found: {0}".format(err))
+ finally:
+ break
else:
y_sorted = y_tmp_vals
diff --git a/resources/tools/presentation/specification.yaml b/resources/tools/presentation/specification.yaml
index 43170fb569..6b162f1338 100644
--- a/resources/tools/presentation/specification.yaml
+++ b/resources/tools/presentation/specification.yaml
@@ -320,17 +320,15 @@
- 27 # NDRPDR sel
plot-vpp-http-server-performance:
- # TODO: Replace with 1810 data:
- csit-vpp-perf-verify-1807-3n-hsw:
- - 24 # WRK
- - 25 # WRK
- - 23 # WRK
- - 26 # WRK
- - 27 # WRK
+ # TODO: Add data:
+ csit-vpp-perf-verify-1810-3n-hsw:
- 28 # WRK
- 29 # WRK
- 30 # WRK
+ - 31 # WRK
- 32 # WRK
+ - 33 # WRK
+ - 34 # WRK
- 35 # WRK
# VPP Functional
@@ -367,7 +365,6 @@
# DPDK Performance
dpdk-performance-changes:
- # TODO: Replace with 1810 data:
csit-dpdk-perf-1804-all:
- 4
- 5
@@ -390,62 +387,74 @@
- 21
- 22
- 23
+ csit-dpdk-perf-verify-1810-3n-hsw:
+ - 1 # NDRPDR sel
+ - 2 # NDRPDR sel
+ - 3 # NDRPDR sel
+ - 4 # NDRPDR sel
dpdk-compare-testbeds:
# TODO: Add data
csit-dpdk-perf-verify-1810-3n-skx:
- 3 # NDRPDR sel
- # TODO: Replace with 1810 data:
- csit-dpdk-perf-verify-1807-3n-hsw:
- - 11
- - 12 # full
- - 14
- - 15
- - 16
- - 17
- - 20
- - 21
- - 22
- - 23
+ - 4 # NDRPDR sel
+ - 6 # NDRPDR sel
+ - 7 # NDRPDR sel
+ - 8 # NDRPDR sel
+ - 9 # NDRPDR sel
+ - 10 # NDRPDR sel
+ - 11 # NDRPDR sel
+ csit-dpdk-perf-verify-1810-3n-hsw:
+ - 1 # NDRPDR sel
+ - 2 # NDRPDR sel
+ - 3 # NDRPDR sel
+ - 4 # NDRPDR sel
dpdk-perf-results-3n-hsw:
- # TODO: Replace with 1810 data:
- csit-dpdk-perf-verify-1807-3n-hsw:
- - 12
+ csit-dpdk-perf-verify-1810-3n-hsw:
+ - 1
dpdk-perf-results-3n-skx:
csit-dpdk-perf-verify-1810-3n-skx:
- 3 # NDRPDR sel
dpdk-perf-results-2n-skx:
- # TODO: Replace with full data:
csit-dpdk-perf-verify-1810-2n-skx:
- 3
plot-dpdk-throughput-latency-3n-hsw:
- # TODO: Replace with 1810 data:
- csit-dpdk-perf-verify-1807-3n-hsw:
- - 11
- - 12 # full
- - 14
- - 15
- - 16
- - 17
- - 20
- - 21
- - 22
- - 23
+ # TODO: Add data:
+ csit-dpdk-perf-verify-1810-3n-hsw:
+ - 1 # NDRPDR sel
+ - 2 # NDRPDR sel
+ - 3 # NDRPDR sel
+ - 4 # NDRPDR sel
plot-dpdk-throughput-latency-3n-skx:
# TODO: Add data:
csit-dpdk-perf-verify-1810-3n-skx:
- 3 # NDRPDR sel
+ - 4 # NDRPDR sel
+ - 6 # NDRPDR sel
+ - 7 # NDRPDR sel
+ - 8 # NDRPDR sel
+ - 9 # NDRPDR sel
+ - 10 # NDRPDR sel
+ - 11 # NDRPDR sel
plot-dpdk-throughput-latency-2n-skx:
# TODO: Add data:
csit-dpdk-perf-verify-1810-2n-skx:
- 3 # NDRPDR sel
- 4 # NDRPDR sel
+ - 5 # NDRPDR sel
+ - 7 # NDRPDR sel
+ - 8 # NDRPDR sel
+ - 9 # NDRPDR sel
+ - 10 # NDRPDR sel
+ - 11 # NDRPDR sel
+ - 12 # NDRPDR sel
+ - 13 # NDRPDR sel
# HoneyComb Functional
hc-func-results:
@@ -843,6 +852,14 @@
- 18 # NDRPDR sel
- 23 # NDRPDR sel
- 25 # NDRPDR sel
+ - 28 # WRK
+ - 29 # WRK
+ - 30 # WRK
+ - 31 # WRK
+ - 32 # WRK
+ - 33 # WRK
+ - 34 # WRK
+ - 35 # WRK
csit-vpp-perf-verify-1807-3n-skx:
- 31 # MRR full
- 28 # MRR sel
@@ -976,8 +993,11 @@
- 22
- 23
# TODO: Add data:
-# csit-dpdk-perf-verify-1810-3n-hsw:
-# -
+ csit-dpdk-perf-verify-1810-3n-hsw:
+ - 1 # NDRPDR sel
+ - 2 # NDRPDR sel
+ - 3 # NDRPDR sel
+ - 4 # NDRPDR sel
csit-dpdk-perf-verify-1807-3n-skx:
- 1
- 2
@@ -992,10 +1012,26 @@
# TODO: Add data:
csit-dpdk-perf-verify-1810-3n-skx:
- 3 # NDRPDR sel
+ - 4 # NDRPDR sel
+ - 6 # NDRPDR sel
+ - 7 # NDRPDR sel
+ - 8 # NDRPDR sel
+ - 9 # NDRPDR sel
+ - 10 # NDRPDR sel
+ - 11 # NDRPDR sel
# TODO: Add data:
csit-dpdk-perf-verify-1810-2n-skx:
- 3 # NDRPDR sel
- 4 # NDRPDR sel
+ - 5 # NDRPDR sel
+ - 7 # NDRPDR sel
+ - 8 # NDRPDR sel
+ - 9 # NDRPDR sel
+ - 10 # NDRPDR sel
+ - 11 # NDRPDR sel
+ - 12 # NDRPDR sel
+ - 13 # NDRPDR sel
+
csit-vpp-functional-1810-ubuntu1604-virl:
- 44
csit-vpp-functional-1810-centos7-virl:
@@ -1998,24 +2034,24 @@
title: "DPDK Performance Changes 1t1c pdr"
algorithm: "table_performance_comparison"
output-file: "{DIR[STATIC,DPDK]}/performance-changes-1t1c-pdr"
+ history:
+ -
+ title: "rls1804"
+ data:
+ csit-dpdk-perf-1804-all:
+ - 4
+ - 5
+ - 6
+ - 7
+ - 8
+ - 9
+ - 10
+ - 11
+ - 12
+ - 13
reference:
- title: "rls1804"
- data:
- csit-dpdk-perf-1804-all:
- - 4
- - 5
- - 6
- - 7
- - 8
- - 9
- - 10
- - 11
- - 12
- - 13
- compare:
title: "rls1807"
data:
- # TODO: Replace with 1810 data
csit-dpdk-perf-verify-1807-3n-hsw:
- 11
- 12 # full
@@ -2027,6 +2063,15 @@
- 21
- 22
- 23
+ compare:
+ title: "rls1810"
+ data:
+ # TODO: Add data
+ csit-dpdk-perf-verify-1810-3n-hsw:
+ - 1 # NDRPDR sel
+ - 2 # NDRPDR sel
+ - 3 # NDRPDR sel
+ - 4 # NDRPDR sel
data: "dpdk-performance-changes"
include-tests: "PDR" # "PDR" | "NDR" | "MRR"
filter: "'1T1C' and ('NDRPDR' or 'NDRPDRDISC')" # "('NDRPDR' or 'NDRPDRDISC')" | "'MRR'"
@@ -2041,24 +2086,24 @@
title: "DPDK Performance Changes 2t2c pdr"
algorithm: "table_performance_comparison"
output-file: "{DIR[STATIC,DPDK]}/performance-changes-2t2c-pdr"
+ history:
+ -
+ title: "rls1804"
+ data:
+ csit-dpdk-perf-1804-all:
+ - 4
+ - 5
+ - 6
+ - 7
+ - 8
+ - 9
+ - 10
+ - 11
+ - 12
+ - 13
reference:
- title: "rls1804"
- data:
- csit-dpdk-perf-1804-all:
- - 4
- - 5
- - 6
- - 7
- - 8
- - 9
- - 10
- - 11
- - 12
- - 13
- compare:
title: "rls1807"
data:
- # TODO: Replace with 1810 data
csit-dpdk-perf-verify-1807-3n-hsw:
- 11
- 12 # full
@@ -2070,6 +2115,15 @@
- 21
- 22
- 23
+ compare:
+ title: "rls1810"
+ data:
+ # TODO: Add data
+ csit-dpdk-perf-verify-1810-3n-hsw:
+ - 1 # NDRPDR sel
+ - 2 # NDRPDR sel
+ - 3 # NDRPDR sel
+ - 4 # NDRPDR sel
data: "dpdk-performance-changes"
include-tests: "PDR" # "PDR" | "NDR" | "MRR"
filter: "'2T2C' and ('NDRPDR' or 'NDRPDRDISC')" # "('NDRPDR' or 'NDRPDRDISC')" | "'MRR'"
@@ -2084,24 +2138,24 @@
title: "DPDK Performance Changes 1t1c ndr"
algorithm: "table_performance_comparison"
output-file: "{DIR[STATIC,DPDK]}/performance-changes-1t1c-ndr"
+ history:
+ -
+ title: "rls1804"
+ data:
+ csit-dpdk-perf-1804-all:
+ - 4
+ - 5
+ - 6
+ - 7
+ - 8
+ - 9
+ - 10
+ - 11
+ - 12
+ - 13
reference:
- title: "rls1804"
- data:
- csit-dpdk-perf-1804-all:
- - 4
- - 5
- - 6
- - 7
- - 8
- - 9
- - 10
- - 11
- - 12
- - 13
- compare:
title: "rls1807"
data:
- # TODO: Replace with 1810 data
csit-dpdk-perf-verify-1807-3n-hsw:
- 11
- 12 # full
@@ -2113,6 +2167,15 @@
- 21
- 22
- 23
+ compare:
+ title: "rls1810"
+ data:
+ # TODO: Add data
+ csit-dpdk-perf-verify-1810-3n-hsw:
+ - 1 # NDRPDR sel
+ - 2 # NDRPDR sel
+ - 3 # NDRPDR sel
+ - 4 # NDRPDR sel
data: "dpdk-performance-changes"
include-tests: "NDR" # "PDR" | "NDR" | "MRR"
filter: "'1T1C' and ('NDRPDR' or 'NDRPDRDISC')" # "('NDRPDR' or 'NDRPDRDISC')" | "'MRR'"
@@ -2127,24 +2190,24 @@
title: "DPDK Performance Changes 2t2c ndr"
algorithm: "table_performance_comparison"
output-file: "{DIR[STATIC,DPDK]}/performance-changes-2t2c-ndr"
+ history:
+ -
+ title: "rls1804"
+ data:
+ csit-dpdk-perf-1804-all:
+ - 4
+ - 5
+ - 6
+ - 7
+ - 8
+ - 9
+ - 10
+ - 11
+ - 12
+ - 13
reference:
- title: "rls1804"
- data:
- csit-dpdk-perf-1804-all:
- - 4
- - 5
- - 6
- - 7
- - 8
- - 9
- - 10
- - 11
- - 12
- - 13
- compare:
title: "rls1807"
data:
- # TODO: Replace with 1810 data
csit-dpdk-perf-verify-1807-3n-hsw:
- 11
- 12 # full
@@ -2156,6 +2219,15 @@
- 21
- 22
- 23
+ compare:
+ title: "rls1810"
+ data:
+ # TODO: Add data
+ csit-dpdk-perf-verify-1810-3n-hsw:
+ - 1 # NDRPDR sel
+ - 2 # NDRPDR sel
+ - 3 # NDRPDR sel
+ - 4 # NDRPDR sel
data: "dpdk-performance-changes"
include-tests: "NDR" # "PDR" | "NDR" | "MRR"
filter: "'2T2C' and ('NDRPDR' or 'NDRPDRDISC')" # "('NDRPDR' or 'NDRPDRDISC')" | "'MRR'"
@@ -2173,24 +2245,25 @@
reference:
title: "3-Node Hsw"
data:
- # TODO: Replace with 1810 data
- csit-dpdk-perf-verify-1807-3n-hsw:
- - 11
- - 12 # full
- - 14
- - 15
- - 16
- - 17
- - 20
- - 21
- - 22
- - 23
+ # TODO: Add data
+ csit-dpdk-perf-verify-1810-3n-hsw:
+ - 1 # NDRPDR sel
+ - 2 # NDRPDR sel
+ - 3 # NDRPDR sel
+ - 4 # NDRPDR sel
compare:
title: "3-Node Skx"
data:
# TODO: Add data
csit-dpdk-perf-verify-1810-3n-skx:
- 3 # NDRPDR sel
+ - 4 # NDRPDR sel
+ - 6 # NDRPDR sel
+ - 7 # NDRPDR sel
+ - 8 # NDRPDR sel
+ - 9 # NDRPDR sel
+ - 10 # NDRPDR sel
+ - 11 # NDRPDR sel
data: "dpdk-compare-testbeds"
include-tests: "NDR" # "PDR" | "NDR" | "MRR"
filter: "'NIC_Intel-X710' and ('NDRPDR' or 'NDRPDRDISC')" # "('NDRPDR' or 'NDRPDRDISC')" | "'MRR'"
@@ -2208,24 +2281,25 @@
reference:
title: "3-Node Hsw"
data:
- # TODO: Replace with 1810 data
- csit-dpdk-perf-verify-1807-3n-hsw:
- - 11
- - 12 # full
- - 14
- - 15
- - 16
- - 17
- - 20
- - 21
- - 22
- - 23
+ # TODO: Add data
+ csit-dpdk-perf-verify-1810-3n-hsw:
+ - 1 # NDRPDR sel
+ - 2 # NDRPDR sel
+ - 3 # NDRPDR sel
+ - 4 # NDRPDR sel
compare:
title: "3-Node Skx"
data:
# TODO: Add data
csit-dpdk-perf-verify-1810-3n-skx:
- 3 # NDRPDR sel
+ - 4 # NDRPDR sel
+ - 6 # NDRPDR sel
+ - 7 # NDRPDR sel
+ - 8 # NDRPDR sel
+ - 9 # NDRPDR sel
+ - 10 # NDRPDR sel
+ - 11 # NDRPDR sel
data: "dpdk-compare-testbeds"
include-tests: "PDR" # "PDR" | "NDR" | "MRR"
filter: "'NIC_Intel-X710' and ('NDRPDR' or 'NDRPDRDISC')" # "('NDRPDR' or 'NDRPDRDISC')" | "'MRR'"
@@ -4372,10 +4446,10 @@
# Packet Throughput - VPP Container Memif 3n-hsw-x520
-
type: "plot"
- title: "VPP Throughput: memif-3n-hsw-x520-64b-1t1c-base_and_scale-l2xc-ndr"
+ title: "VPP Throughput: memif-3n-hsw-x520-64b-1t1c-base_and_scale-ndr"
algorithm: "plot_performance_box"
output-file-type: ".html"
- output-file: "{DIR[STATIC,VPP]}/memif-3n-hsw-x520-64b-1t1c-base_and_scale-l2xc-ndr"
+ output-file: "{DIR[STATIC,VPP]}/memif-3n-hsw-x520-64b-1t1c-base_and_scale-ndr"
data: "plot-vpp-throughput-latency-3n-hsw"
filter: "'NIC_Intel-X520-DA2' and
'64B' and
@@ -4401,7 +4475,7 @@
boxpoints: "outliers"
whiskerwidth: 0
layout:
- title: "memif-3n-hsw-x520-64b-1t1c-base_and_scale-l2xc-ndr"
+ title: "memif-3n-hsw-x520-64b-1t1c-base_and_scale-ndr"
layout: "plot-throughput"
-
@@ -17030,7 +17104,7 @@
title: "VPP Latency: ip4-3n-hsw-x520-64b-2t2c-features-nat44-ndr-lat"
algorithm: "plot_latency_error_bars"
output-file-type: ".html"
- output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x520-64b-2t2c-features-ndr-nat44-lat"
+ output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x520-64b-2t2c-features-nat44-ndr-lat"
data: "plot-vpp-throughput-latency-3n-hsw"
filter: "'NIC_Intel-X520-DA2' and
'64B' and
@@ -17090,7 +17164,7 @@
title: "VPP Latency: ip4-3n-hsw-x520-64b-2t2c-features-iacl-ndr-lat"
algorithm: "plot_latency_error_bars"
output-file-type: ".html"
- output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x520-64b-2t2c-features-ndr-iacl-lat"
+ output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x520-64b-2t2c-features-iacl-ndr-lat"
data: "plot-vpp-throughput-latency-3n-hsw"
filter: "'NIC_Intel-X520-DA2' and
'64B' and
@@ -17149,7 +17223,7 @@
title: "VPP Latency: ip4-3n-hsw-x520-64b-2t2c-features-oacl-ndr-lat"
algorithm: "plot_latency_error_bars"
output-file-type: ".html"
- output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x520-64b-2t2c-features-ndr-oacl-lat"
+ output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x520-64b-2t2c-features-oacl-ndr-lat"
data: "plot-vpp-throughput-latency-3n-hsw"
filter: "'NIC_Intel-X520-DA2' and
'64B' and
@@ -17335,7 +17409,7 @@
title: "VPP Latency: ip4-3n-hsw-x710-64b-2t2c-features-nat44-ndr-lat"
algorithm: "plot_latency_error_bars"
output-file-type: ".html"
- output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x710-64b-2t2c-features-ndr-nat44-lat"
+ output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x710-64b-2t2c-features-nat44-ndr-lat"
data: "plot-vpp-throughput-latency-3n-hsw"
filter: "'NIC_Intel-X710' and
'64B' and
@@ -17395,7 +17469,7 @@
title: "VPP Latency: ip4-3n-hsw-x710-64b-2t2c-features-iacl-ndr-lat"
algorithm: "plot_latency_error_bars"
output-file-type: ".html"
- output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x710-64b-2t2c-features-ndr-iacl-lat"
+ output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x710-64b-2t2c-features-iacl-ndr-lat"
data: "plot-vpp-throughput-latency-3n-hsw"
filter: "'NIC_Intel-X710' and
'64B' and
@@ -17454,7 +17528,7 @@
title: "VPP Latency: ip4-3n-hsw-x710-64b-2t2c-features-oacl-ndr-lat"
algorithm: "plot_latency_error_bars"
output-file-type: ".html"
- output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x710-64b-2t2c-features-ndr-oacl-lat"
+ output-file: "{DIR[STATIC,VPP]}/ip4-3n-hsw-x710-64b-2t2c-features-oacl-ndr-lat"
data: "plot-vpp-throughput-latency-3n-hsw"
filter: "'NIC_Intel-X710' and
'64B' and
@@ -17697,7 +17771,7 @@
title: "VPP Latency: ip4-3n-skx-x710-64b-4t2c-features-nat44-ndr-lat"
algorithm: "plot_latency_error_bars"
output-file-type: ".html"
- output-file: "{DIR[STATIC,VPP]}/ip4-3n-skx-x710-64b-4t2c-features-ndr-nat44-lat"
+ output-file: "{DIR[STATIC,VPP]}/ip4-3n-skx-x710-64b-4t2c-features-nat44-ndr-lat"
data: "plot-vpp-throughput-latency-3n-skx"
filter: "'NIC_Intel-X710' and
'64B' and
@@ -17757,7 +17831,7 @@
title: "VPP Latency: ip4-3n-skx-x710-64b-4t2c-features-iacl-ndr-lat"
algorithm: "plot_latency_error_bars"
output-file-type: ".html"
- output-file: "{DIR[STATIC,VPP]}/ip4-3n-skx-x710-64b-4t2c-features-ndr-iacl-lat"
+ output-file: "{DIR[STATIC,VPP]}/ip4-3n-skx-x710-64b-4t2c-features-iacl-ndr-lat"
data: "plot-vpp-throughput-latency-3n-skx"
filter: "'NIC_Intel-X710' and
'64B' and
@@ -18234,7 +18308,7 @@
'64B' and
'ENCAP' and
'NDRPDR' and
- '4t2c' and
+ '4T2C' and
'VXLAN' and
'L2BDMACLRN' and
not 'VHOST' and
>vlib_main_t *vm = vlib_get_main (); if (batch_ctx->nb_rx_packets <= 0) return; clib_rwlock_reader_lock (&quic_main.crypto_keys_quic_rw_lock); vnet_crypto_process_ops (vm, batch_ctx->aead_crypto_rx_packets_ops, batch_ctx->nb_rx_packets); clib_rwlock_reader_unlock (&quic_main.crypto_keys_quic_rw_lock); for (int i = 0; i < batch_ctx->nb_rx_packets; i++) clib_mem_free (batch_ctx->aead_crypto_rx_packets_ops[i].iv); batch_ctx->nb_rx_packets = 0; } void build_iv (ptls_aead_context_t * ctx, uint8_t * iv, uint64_t seq) { size_t iv_size = ctx->algo->iv_size, i; const uint8_t *s = ctx->static_iv; uint8_t *d = iv; /* build iv */ for (i = iv_size - 8; i != 0; --i) *d++ = *s++; i = 64; do { i -= 8; *d++ = *s++ ^ (uint8_t) (seq >> i); } while (i != 0); } static void do_finalize_send_packet (ptls_cipher_context_t * hp, quicly_datagram_t * packet, size_t first_byte_at, size_t payload_from) { uint8_t hpmask[1 + QUICLY_SEND_PN_SIZE] = { 0 }; size_t i; ptls_cipher_init (hp, packet->data.base + payload_from - QUICLY_SEND_PN_SIZE + QUICLY_MAX_PN_SIZE); ptls_cipher_encrypt (hp, hpmask, hpmask, sizeof (hpmask)); packet->data.base[first_byte_at] ^= hpmask[0] & (QUICLY_PACKET_IS_LONG_HEADER (packet->data.base[first_byte_at]) ? 0xf : 0x1f); for (i = 0; i != QUICLY_SEND_PN_SIZE; ++i) packet->data.base[payload_from + i - QUICLY_SEND_PN_SIZE] ^= hpmask[i + 1]; } void quic_crypto_finalize_send_packet (quicly_datagram_t * packet) { quic_encrypt_cb_ctx *encrypt_cb_ctx = (quic_encrypt_cb_ctx *) ((uint8_t *) packet + sizeof (*packet)); for (int i = 0; i < encrypt_cb_ctx->snd_ctx_count; i++) { do_finalize_send_packet (encrypt_cb_ctx->snd_ctx[i].hp, packet, encrypt_cb_ctx->snd_ctx[i].first_byte_at, encrypt_cb_ctx->snd_ctx[i].payload_from); } encrypt_cb_ctx->snd_ctx_count = 0; } static int quic_crypto_setup_cipher (quicly_crypto_engine_t * engine, quicly_conn_t * conn, size_t epoch, int is_enc, ptls_cipher_context_t ** hp_ctx, ptls_aead_context_t ** aead_ctx, ptls_aead_algorithm_t * aead, ptls_hash_algorithm_t * hash, const void *secret) { uint8_t hpkey[PTLS_MAX_SECRET_SIZE]; int ret; *aead_ctx = NULL; /* generate new header protection key */ if (hp_ctx != NULL) { *hp_ctx = NULL; if ((ret = ptls_hkdf_expand_label (hash, hpkey, aead->ctr_cipher->key_size, ptls_iovec_init (secret, hash->digest_size), "quic hp", ptls_iovec_init (NULL, 0), NULL)) != 0) goto Exit; if ((*hp_ctx = ptls_cipher_new (aead->ctr_cipher, is_enc, hpkey)) == NULL) { ret = PTLS_ERROR_NO_MEMORY; goto Exit; } } /* generate new AEAD context */ if ((*aead_ctx = ptls_aead_new (aead, hash, is_enc, secret, QUICLY_AEAD_BASE_LABEL)) == NULL) { ret = PTLS_ERROR_NO_MEMORY; goto Exit; } if (epoch == QUICLY_EPOCH_1RTT && !is_enc) { quic_ctx_t *qctx = quic_get_conn_ctx (conn); if (qctx->ingress_keys.aead_ctx != NULL) { qctx->key_phase_ingress++; } qctx->ingress_keys.aead_ctx = *aead_ctx; if (hp_ctx != NULL) qctx->ingress_keys.hp_ctx = *hp_ctx; } ret = 0; Exit: if (ret != 0) { if (aead_ctx && *aead_ctx != NULL) { ptls_aead_free (*aead_ctx); *aead_ctx = NULL; } if (hp_ctx && *hp_ctx != NULL) { ptls_cipher_free (*hp_ctx); *hp_ctx = NULL; } } ptls_clear_memory (hpkey, sizeof (hpkey)); return ret; } void quic_crypto_finalize_send_packet_cb (struct st_quicly_crypto_engine_t *engine, quicly_conn_t * conn, ptls_cipher_context_t * hp, ptls_aead_context_t * aead, quicly_datagram_t * packet, size_t first_byte_at, size_t payload_from, int coalesced) { quic_encrypt_cb_ctx *encrypt_cb_ctx = (quic_encrypt_cb_ctx *) ((uint8_t *) packet + sizeof (*packet)); encrypt_cb_ctx->snd_ctx[encrypt_cb_ctx->snd_ctx_count].hp = hp; encrypt_cb_ctx->snd_ctx[encrypt_cb_ctx->snd_ctx_count].first_byte_at = first_byte_at; encrypt_cb_ctx->snd_ctx[encrypt_cb_ctx->snd_ctx_count].payload_from = payload_from; encrypt_cb_ctx->snd_ctx_count++; } void quic_crypto_decrypt_packet (quic_ctx_t * qctx, quic_rx_packet_ctx_t * pctx) { ptls_cipher_context_t *header_protection = NULL; ptls_aead_context_t *aead = NULL; int pn; /* Long Header packets are not decrypted by vpp */ if (QUICLY_PACKET_IS_LONG_HEADER (pctx->packet.octets.base[0])) return; uint64_t next_expected_packet_number = quicly_get_next_expected_packet_number (qctx->conn); if (next_expected_packet_number == UINT64_MAX) return; aead = qctx->ingress_keys.aead_ctx; header_protection = qctx->ingress_keys.hp_ctx; if (!aead || !header_protection) return; size_t encrypted_len = pctx->packet.octets.len - pctx->packet.encrypted_off; uint8_t hpmask[5] = { 0 }; uint32_t pnbits = 0; size_t pnlen, ptlen, i; /* decipher the header protection, as well as obtaining pnbits, pnlen */ if (encrypted_len < header_protection->algo->iv_size + QUICLY_MAX_PN_SIZE) return; ptls_cipher_init (header_protection, pctx->packet.octets.base + pctx->packet.encrypted_off + QUICLY_MAX_PN_SIZE); ptls_cipher_encrypt (header_protection, hpmask, hpmask, sizeof (hpmask)); pctx->packet.octets.base[0] ^= hpmask[0] & (QUICLY_PACKET_IS_LONG_HEADER (pctx->packet.octets.base[0]) ? 0xf : 0x1f); pnlen = (pctx->packet.octets.base[0] & 0x3) + 1; for (i = 0; i != pnlen; ++i) { pctx->packet.octets.base[pctx->packet.encrypted_off + i] ^= hpmask[i + 1]; pnbits = (pnbits << 8) | pctx->packet.octets.base[pctx->packet.encrypted_off + i]; } size_t aead_off = pctx->packet.encrypted_off + pnlen; pn = quicly_determine_packet_number (pnbits, pnlen * 8, next_expected_packet_number); int key_phase_bit = (pctx->packet.octets.base[0] & QUICLY_KEY_PHASE_BIT) != 0; if (key_phase_bit != (qctx->key_phase_ingress & 1)) { pctx->packet.octets.base[0] ^= hpmask[0] & (QUICLY_PACKET_IS_LONG_HEADER (pctx->packet.octets.base[0]) ? 0xf : 0x1f); for (i = 0; i != pnlen; ++i) { pctx->packet.octets.base[pctx->packet.encrypted_off + i] ^= hpmask[i + 1]; } return; } if ((ptlen = quic_crypto_offload_aead_decrypt (qctx, aead, pctx->packet.octets.base + aead_off, pctx->packet.octets.base + aead_off, pctx->packet.octets.len - aead_off, pn, pctx->packet.octets.base, aead_off)) == SIZE_MAX) { fprintf (stderr, "%s: aead decryption failure (pn: %d)\n", __FUNCTION__, pn); return; } pctx->packet.encrypted_off = aead_off; pctx->packet.octets.len = ptlen + aead_off; pctx->packet.decrypted.pn = pn; pctx->packet.decrypted.key_phase = qctx->key_phase_ingress; } #ifdef QUIC_HP_CRYPTO static void quic_crypto_cipher_do_init (ptls_cipher_context_t * _ctx, const void *iv) { struct cipher_context_t *ctx = (struct cipher_context_t *) _ctx; vnet_crypto_op_id_t id; if (!strcmp (ctx->super.algo->name, "AES128-CTR")) { id = VNET_CRYPTO_OP_AES_128_CTR_ENC; } else if (!strcmp (ctx->super.algo->name, "AES256-CTR")) { id = VNET_CRYPTO_OP_AES_256_CTR_ENC; } else { QUIC_DBG (1, "%s, Invalid crypto cipher : ", __FUNCTION__, _ctx->algo->name); assert (0); } vnet_crypto_op_init (&ctx->op, id); ctx->op.iv = (u8 *) iv; ctx->op.key_index = ctx->key_index; } static void quic_crypto_cipher_dispose (ptls_cipher_context_t * _ctx) { /* Do nothing */ } static void quic_crypto_cipher_encrypt (ptls_cipher_context_t * _ctx, void *output, const void *input, size_t _len) { vlib_main_t *vm = vlib_get_main (); struct cipher_context_t *ctx = (struct cipher_context_t *) _ctx; ctx->op.src = (u8 *) input; ctx->op.dst = output; ctx->op.len = _len; vnet_crypto_process_ops (vm, &ctx->op, 1); } static int quic_crypto_cipher_setup_crypto (ptls_cipher_context_t * _ctx, int is_enc, const void *key, const EVP_CIPHER * cipher, quicly_do_transform_fn do_transform) { struct cipher_context_t *ctx = (struct cipher_context_t *) _ctx; ctx->super.do_dispose = quic_crypto_cipher_dispose; ctx->super.do_init = quic_crypto_cipher_do_init; ctx->super.do_transform = do_transform; vlib_main_t *vm = vlib_get_main (); vnet_crypto_alg_t algo; if (!strcmp (ctx->super.algo->name, "AES128-CTR")) { algo = VNET_CRYPTO_ALG_AES_128_CTR; } else if (!strcmp (ctx->super.algo->name, "AES256-CTR")) { algo = VNET_CRYPTO_ALG_AES_256_CTR; } else { QUIC_DBG (1, "%s, Invalid crypto cipher : ", __FUNCTION__, _ctx->algo->name); assert (0); } ctx->key_index = vnet_crypto_key_add (vm, algo, (u8 *) key, _ctx->algo->key_size); return 0; } static int quic_crypto_aes128ctr_setup_crypto (ptls_cipher_context_t * ctx, int is_enc, const void *key) { return quic_crypto_cipher_setup_crypto (ctx, 1, key, EVP_aes_128_ctr (), quic_crypto_cipher_encrypt); } static int quic_crypto_aes256ctr_setup_crypto (ptls_cipher_context_t * ctx, int is_enc, const void *key) { return quic_crypto_cipher_setup_crypto (ctx, 1, key, EVP_aes_256_ctr (), quic_crypto_cipher_encrypt); } #endif // QUIC_HP_CRYPTO void quic_crypto_aead_encrypt_init (ptls_aead_context_t * _ctx, const void *iv, const void *aad, size_t aadlen) { quic_main_t *qm = &quic_main; u32 thread_index = vlib_get_thread_index (); struct aead_crypto_context_t *ctx = (struct aead_crypto_context_t *) _ctx; vnet_crypto_op_id_t id; if (!strcmp (ctx->super.algo->name, "AES128-GCM")) { id = VNET_CRYPTO_OP_AES_128_GCM_ENC; } else if (!strcmp (ctx->super.algo->name, "AES256-GCM")) { id = VNET_CRYPTO_OP_AES_256_GCM_ENC; } else { assert (0); } quic_crypto_batch_ctx_t *quic_crypto_batch_ctx = &qm->wrk_ctx[thread_index].crypto_context_batch; vnet_crypto_op_t *vnet_op = &quic_crypto_batch_ctx->aead_crypto_tx_packets_ops [quic_crypto_batch_ctx->nb_tx_packets]; vnet_crypto_op_init (vnet_op, id); vnet_op->aad = (u8 *) aad; vnet_op->aad_len = aadlen; vnet_op->iv = clib_mem_alloc (PTLS_MAX_IV_SIZE); clib_memcpy (vnet_op->iv, iv, PTLS_MAX_IV_SIZE); vnet_op->key_index = ctx->key_index; } size_t quic_crypto_aead_encrypt_update (ptls_aead_context_t * _ctx, void *output, const void *input, size_t inlen) { struct aead_crypto_context_t *ctx = (struct aead_crypto_context_t *) _ctx; quic_main_t *qm = &quic_main; u32 thread_index = vlib_get_thread_index (); quic_crypto_batch_ctx_t *quic_crypto_batch_ctx = &qm->wrk_ctx[thread_index].crypto_context_batch; vnet_crypto_op_t *vnet_op = &quic_crypto_batch_ctx->aead_crypto_tx_packets_ops [quic_crypto_batch_ctx->nb_tx_packets]; vnet_op->src = (u8 *) input; vnet_op->dst = output; vnet_op->len = inlen; vnet_op->tag_len = ctx->super.algo->tag_size; vnet_op->tag = vnet_op->src + inlen; return 0; } size_t quic_crypto_aead_encrypt_final (ptls_aead_context_t * _ctx, void *output) { quic_main_t *qm = &quic_main; u32 thread_index = vlib_get_thread_index (); quic_crypto_batch_ctx_t *quic_crypto_batch_ctx = &qm->wrk_ctx[thread_index].crypto_context_batch; vnet_crypto_op_t *vnet_op = &quic_crypto_batch_ctx-> aead_crypto_tx_packets_ops[quic_crypto_batch_ctx->nb_tx_packets]; quic_crypto_batch_ctx->nb_tx_packets++; return vnet_op->len + vnet_op->tag_len; } size_t quic_crypto_aead_decrypt (ptls_aead_context_t * _ctx, void *_output, const void *input, size_t inlen, const void *iv, const void *aad, size_t aadlen) { vlib_main_t *vm = vlib_get_main (); struct aead_crypto_context_t *ctx = (struct aead_crypto_context_t *) _ctx; vnet_crypto_op_id_t id; if (!strcmp (ctx->super.algo->name, "AES128-GCM")) { id = VNET_CRYPTO_OP_AES_128_GCM_DEC; } else if (!strcmp (ctx->super.algo->name, "AES256-GCM")) { id = VNET_CRYPTO_OP_AES_256_GCM_DEC; } else { assert (0); } vnet_crypto_op_init (&ctx->op, id); ctx->op.aad = (u8 *) aad; ctx->op.aad_len = aadlen; ctx->op.iv = (u8 *) iv; ctx->op.src = (u8 *) input; ctx->op.dst = _output; ctx->op.key_index = ctx->key_index; ctx->op.len = inlen - ctx->super.algo->tag_size; ctx->op.tag_len = ctx->super.algo->tag_size; ctx->op.tag = ctx->op.src + ctx->op.len; vnet_crypto_process_ops (vm, &ctx->op, 1); if (ctx->op.status != VNET_CRYPTO_OP_STATUS_COMPLETED) return SIZE_MAX; return ctx->op.len; } static size_t quic_crypto_offload_aead_decrypt (quic_ctx_t * qctx, ptls_aead_context_t * _ctx, void *_output, const void *input, size_t inlen, uint64_t decrypted_pn, const void *aad, size_t aadlen) { struct aead_crypto_context_t *ctx = (struct aead_crypto_context_t *) _ctx; vnet_crypto_op_id_t id; if (!strcmp (ctx->super.algo->name, "AES128-GCM")) { id = VNET_CRYPTO_OP_AES_128_GCM_DEC; } else if (!strcmp (ctx->super.algo->name, "AES256-GCM")) { id = VNET_CRYPTO_OP_AES_256_GCM_DEC; } else { return SIZE_MAX; } quic_main_t *qm = &quic_main; quic_crypto_batch_ctx_t *quic_crypto_batch_ctx = &qm->wrk_ctx[qctx->c_thread_index].crypto_context_batch; vnet_crypto_op_t *vnet_op = &quic_crypto_batch_ctx->aead_crypto_rx_packets_ops [quic_crypto_batch_ctx->nb_rx_packets]; vnet_crypto_op_init (vnet_op, id); vnet_op->aad = (u8 *) aad; vnet_op->aad_len = aadlen; vnet_op->iv = clib_mem_alloc (PTLS_MAX_IV_SIZE); build_iv (_ctx, vnet_op->iv, decrypted_pn); vnet_op->src = (u8 *) input; vnet_op->dst = _output; vnet_op->key_index = ctx->key_index; vnet_op->len = inlen - ctx->super.algo->tag_size; vnet_op->tag_len = ctx->super.algo->tag_size; vnet_op->tag = vnet_op->src + vnet_op->len; quic_crypto_batch_ctx->nb_rx_packets++; return vnet_op->len; } static void quic_crypto_aead_dispose_crypto (ptls_aead_context_t * _ctx) { } static int quic_crypto_aead_setup_crypto (ptls_aead_context_t * _ctx, int is_enc, const void *key, const EVP_CIPHER * cipher) { vlib_main_t *vm = vlib_get_main (); struct aead_crypto_context_t *ctx = (struct aead_crypto_context_t *) _ctx; vnet_crypto_alg_t algo; if (!strcmp (ctx->super.algo->name, "AES128-GCM")) { algo = VNET_CRYPTO_ALG_AES_128_GCM; } else if (!strcmp (ctx->super.algo->name, "AES256-GCM")) { algo = VNET_CRYPTO_ALG_AES_256_GCM; } else { QUIC_DBG (1, "%s, invalied aead cipher %s", __FUNCTION__, _ctx->algo->name); assert (0); } if (quic_main.vnet_crypto_enabled) { ctx->super.do_decrypt = quic_crypto_aead_decrypt; ctx->super.do_encrypt_init = quic_crypto_aead_encrypt_init; ctx->super.do_encrypt_update = quic_crypto_aead_encrypt_update; ctx->super.do_encrypt_final = quic_crypto_aead_encrypt_final; ctx->super.dispose_crypto = quic_crypto_aead_dispose_crypto; clib_rwlock_writer_lock (&quic_main.crypto_keys_quic_rw_lock); ctx->key_index = vnet_crypto_key_add (vm, algo, (u8 *) key, _ctx->algo->key_size); clib_rwlock_writer_unlock (&quic_main.crypto_keys_quic_rw_lock); } else { if (!strcmp (ctx->super.algo->name, "AES128-GCM")) ptls_openssl_aes128gcm.setup_crypto (_ctx, is_enc, key); else if (!strcmp (ctx->super.algo->name, "AES256-GCM")) ptls_openssl_aes256gcm.setup_crypto (_ctx, is_enc, key); } return 0; } static int quic_crypto_aead_aes128gcm_setup_crypto (ptls_aead_context_t * ctx, int is_enc, const void *key) { return quic_crypto_aead_setup_crypto (ctx, is_enc, key, EVP_aes_128_gcm ()); } static int quic_crypto_aead_aes256gcm_setup_crypto (ptls_aead_context_t * ctx, int is_enc, const void *key) { return quic_crypto_aead_setup_crypto (ctx, is_enc, key, EVP_aes_256_gcm ()); } #ifdef QUIC_HP_CRYPTO ptls_cipher_algorithm_t quic_crypto_aes128ctr = { "AES128-CTR", PTLS_AES128_KEY_SIZE, 1, PTLS_AES_IV_SIZE, sizeof (struct cipher_context_t), aes128ctr_setup_crypto }; ptls_cipher_algorithm_t quic_crypto_aes256ctr = { "AES256-CTR", PTLS_AES256_KEY_SIZE, 1 /* block size */ , PTLS_AES_IV_SIZE, sizeof (struct cipher_context_t), aes256ctr_setup_crypto }; #endif ptls_aead_algorithm_t quic_crypto_aes128gcm = { "AES128-GCM", #ifdef QUIC_HP_CRYPTO &quic_crypto_aes128ctr, #else &ptls_openssl_aes128ctr, #endif &ptls_openssl_aes128ecb, PTLS_AES128_KEY_SIZE, PTLS_AESGCM_IV_SIZE, PTLS_AESGCM_TAG_SIZE, sizeof (struct aead_crypto_context_t), quic_crypto_aead_aes128gcm_setup_crypto }; ptls_aead_algorithm_t quic_crypto_aes256gcm = { "AES256-GCM", #ifdef QUIC_HP_CRYPTO &quic_crypto_aes256ctr, #else &ptls_openssl_aes256ctr, #endif &ptls_openssl_aes256ecb, PTLS_AES256_KEY_SIZE, PTLS_AESGCM_IV_SIZE, PTLS_AESGCM_TAG_SIZE, sizeof (struct aead_crypto_context_t), quic_crypto_aead_aes256gcm_setup_crypto }; ptls_cipher_suite_t quic_crypto_aes128gcmsha256 = { PTLS_CIPHER_SUITE_AES_128_GCM_SHA256, &quic_crypto_aes128gcm, &ptls_openssl_sha256 }; ptls_cipher_suite_t quic_crypto_aes256gcmsha384 = { PTLS_CIPHER_SUITE_AES_256_GCM_SHA384, &quic_crypto_aes256gcm, &ptls_openssl_sha384 }; ptls_cipher_suite_t *quic_crypto_cipher_suites[] = { &quic_crypto_aes256gcmsha384, &quic_crypto_aes128gcmsha256, NULL }; quicly_crypto_engine_t quic_crypto_engine = { quic_crypto_setup_cipher, quic_crypto_finalize_send_packet_cb }; int quic_encrypt_ticket_cb (ptls_encrypt_ticket_t * _self, ptls_t * tls, int is_encrypt, ptls_buffer_t * dst, ptls_iovec_t src) { quic_session_cache_t *self = (void *) _self; int ret; if (is_encrypt) { /* replace the cached entry along with a newly generated session id */ clib_mem_free (self->data.base); if ((self->data.base = clib_mem_alloc (src.len)) == NULL) return PTLS_ERROR_NO_MEMORY; ptls_get_context (tls)->random_bytes (self->id, sizeof (self->id)); clib_memcpy (self->data.base, src.base, src.len); self->data.len = src.len; /* store the session id in buffer */ if ((ret = ptls_buffer_reserve (dst, sizeof (self->id))) != 0) return ret; clib_memcpy (dst->base + dst->off, self->id, sizeof (self->id)); dst->off += sizeof (self->id); } else { /* check if session id is the one stored in cache */ if (src.len != sizeof (self->id)) return PTLS_ERROR_SESSION_NOT_FOUND; if (clib_memcmp (self->id, src.base, sizeof (self->id)) != 0) return PTLS_ERROR_SESSION_NOT_FOUND; /* return the cached value */ if ((ret = ptls_buffer_reserve (dst, self->data.len)) != 0) return ret; clib_memcpy (dst->base + dst->off, self->data.base, self->data.len); dst->off += self->data.len; } return 0; } /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */