From d22c6a4c9939026f053adbd8e2f076c954c1c6ef Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Tue, 16 Jun 2020 15:05:17 -0400 Subject: [PATCH 01/10] build gso batch writer Signed-off-by: Dan Zhang --- bazel/external/quiche.BUILD | 212 ++++++++++++++++++ .../quic_listeners/quiche/platform/BUILD | 10 + 2 files changed, 222 insertions(+) diff --git a/bazel/external/quiche.BUILD b/bazel/external/quiche.BUILD index f4718d39f6928..b290400dae00e 100644 --- a/bazel/external/quiche.BUILD +++ b/bazel/external/quiche.BUILD @@ -61,6 +61,9 @@ quiche_copts = select({ "-Wno-unused-function", "-Wno-unknown-warning-option", "-Wno-deprecated-copy", + "-Wno-ignored-qualifiers", + "-Wno-sign-compare", + "-Wno-inconsistent-missing-override", # quic_inlined_frame.h uses offsetof() to optimize memory usage in frames. "-Wno-invalid-offsetof", ], @@ -1146,6 +1149,17 @@ envoy_cc_test_library( deps = ["@envoy//test/extensions/quic_listeners/quiche/platform:quic_platform_port_utils_impl_lib"], ) +envoy_cc_library( + name = "quic_platform_udp_socket", + hdrs = select({ + "@envoy//bazel:linux": ["quiche/quic/platform/api/quic_udp_socket_platform_api.h"], + "//conditions:default": [], + }), + repository = "@envoy", + tags = ["nofips"], + deps = ["@envoy//source/extensions/quic_listeners/quiche/platform:quic_platform_udp_socket_impl_lib"], +) + envoy_cc_test_library( name = "quic_platform_sleep", hdrs = ["quiche/quic/platform/api/quic_sleep.h"], @@ -1350,6 +1364,125 @@ envoy_cc_library( ], ) +envoy_cc_library( + name = "quic_core_batch_writer_batch_writer_buffer_lib", + srcs = select({ + "@envoy//bazel:linux": [ + "quiche/quic/core/batch_writer/quic_batch_writer_buffer.cc", + ], + "//conditions:default": [], + }), + hdrs = select({ + "@envoy//bazel:linux": [ + "quiche/quic/core/batch_writer/quic_batch_writer_buffer.h", + ], + "//conditions:default": [], + }), + copts = quiche_copts, + repository = "@envoy", + tags = ["nofips"], + visibility = ["//visibility:public"], + deps = [ + ":quic_core_circular_deque_lib", + ":quic_core_linux_socket_utils_lib", + ":quic_core_packet_writer_interface_lib", + ":quic_platform", + ], +) + +envoy_cc_library( + name = "quic_core_batch_writer_batch_writer_base_lib", + srcs = select({ + "@envoy//bazel:linux": [ + "quiche/quic/core/batch_writer/quic_batch_writer_base.cc", + ], + "//conditions:default": [], + }), + hdrs = select({ + "@envoy//bazel:linux": [ + "quiche/quic/core/batch_writer/quic_batch_writer_base.h", + ], + "//conditions:default": [], + }), + copts = quiche_copts, + repository = "@envoy", + tags = ["nofips"], + visibility = ["//visibility:public"], + deps = [ + ":quic_core_batch_writer_batch_writer_buffer_lib", + ":quic_core_packet_writer_interface_lib", + ":quic_core_types_lib", + ":quic_platform", + ], +) + +envoy_cc_test_library( + name = "quic_core_batch_writer_batch_writer_test_lib", + hdrs = select({ + "@envoy//bazel:linux": [ + "quiche/quic/core/batch_writer/quic_batch_writer_test.h", + ], + "//conditions:default": [], + }), + copts = quiche_copts, + repository = "@envoy", + tags = ["nofips"], + deps = [ + ":quic_core_batch_writer_batch_writer_base_lib", + ":quic_core_udp_socket_lib", + ":quic_platform_test", + ], +) + +envoy_cc_library( + name = "quic_core_batch_writer_gso_batch_writer_lib", + srcs = select({ + "@envoy//bazel:linux": [ + "quiche/quic/core/batch_writer/quic_gso_batch_writer.cc", + ], + "//conditions:default": [], + }), + hdrs = select({ + "@envoy//bazel:linux": [ + "quiche/quic/core/batch_writer/quic_gso_batch_writer.h", + ], + "//conditions:default": [], + }), + copts = quiche_copts, + repository = "@envoy", + tags = ["nofips"], + visibility = ["//visibility:public"], + deps = [ + ":quic_core_batch_writer_batch_writer_base_lib", + ":quic_core_linux_socket_utils_lib", + ":quic_platform", + ], +) + +envoy_cc_library( + name = "quic_core_batch_writer_sendmmsg_batch_writer_lib", + srcs = select({ + "@envoy//bazel:linux": [ + "quiche/quic/core/batch_writer/quic_sendmmsg_batch_writer.cc", + ], + "//conditions:default": [], + }), + hdrs = select({ + "@envoy//bazel:linux": [ + "quiche/quic/core/batch_writer/quic_sendmmsg_batch_writer.h", + ], + "//conditions:default": [], + }), + copts = quiche_copts, + repository = "@envoy", + tags = ["nofips"], + visibility = ["//visibility:public"], + deps = [ + ":quic_core_batch_writer_batch_writer_base_lib", + ":quic_core_linux_socket_utils_lib", + ], +) + envoy_cc_library( name = "quic_core_blocked_writer_interface_lib", hdrs = ["quiche/quic/core/quic_blocked_writer_interface.h"], @@ -2416,6 +2549,45 @@ envoy_cc_library( ], ) +envoy_cc_library( + name = "quic_core_syscall_wrapper_lib", + srcs = select({ + "@envoy//bazel:linux": ["quiche/quic/core/quic_syscall_wrapper.cc"], + "//conditions:default": [], + }), + hdrs = select({ + "@envoy//bazel:linux": ["quiche/quic/core/quic_syscall_wrapper.h"], + "//conditions:default": [], + }), + copts = quiche_copts, + repository = "@envoy", + tags = ["nofips"], + deps = [ + ":quic_platform_export", + ], +) + +envoy_cc_library( + name = "quic_core_linux_socket_utils_lib", + srcs = select({ + "@envoy//bazel:linux": ["quiche/quic/core/quic_linux_socket_utils.cc"], + "//conditions:default": [], + }), + hdrs = select({ + "@envoy//bazel:linux": ["quiche/quic/core/quic_linux_socket_utils.h"], + "//conditions:default": [], + }), + copts = quiche_copts, + repository = "@envoy", + tags = ["nofips"], + deps = [ + ":quic_core_packet_writer_interface_lib", + ":quic_core_syscall_wrapper_lib", + ":quic_core_types_lib", + ":quic_platform", + ], +) + envoy_cc_library( name = "quic_core_network_blackhole_detector_lib", srcs = ["quiche/quic/core/quic_network_blackhole_detector.cc"], @@ -3181,6 +3353,32 @@ envoy_cc_library( ], ) +envoy_cc_library( + name = "quic_core_udp_socket_lib", + srcs = select({ + "@envoy//bazel:windows_x86_64": [], + "//conditions:default": ["quiche/quic/core/quic_udp_socket_posix.cc"], + }), + hdrs = select({ + "@envoy//bazel:windows_x86_64": [], + "//conditions:default": ["quiche/quic/core/quic_udp_socket.h"], + }), + copts = quiche_copts + select({ + # On OSX/iOS, condstants from RFC 3542 (e.g. IPV6_RECVPKTINFO) are not usable + # without this define. + "@envoy//bazel:apple": ["-D__APPLE_USE_RFC_3542"], + "//conditions:default": [], + }), + repository = "@envoy", + tags = ["nofips"], + deps = [ + ":quic_core_types_lib", + ":quic_core_utils_lib", + ":quic_platform", + ":quic_platform_udp_socket", + ], +) + envoy_cc_library( name = "quic_core_unacked_packet_map_lib", srcs = ["quiche/quic/core/quic_unacked_packet_map.cc"], @@ -3741,3 +3939,17 @@ envoy_cc_test( ":quic_platform_test_mem_slice_vector_lib", ], ) + +envoy_cc_test( + name = "quic_core_batch_writer_batch_writer_test", + srcs = ["quiche/quic/core/batch_writer/quic_batch_writer_test.cc"], + copts = quiche_copts, + repository = "@envoy", + tags = ["nofips"], + deps = [ + ":quic_core_batch_writer_batch_writer_test_lib", + ":quic_core_batch_writer_gso_batch_writer_lib", + ":quic_core_batch_writer_sendmmsg_batch_writer_lib", + ":quic_platform", + ], +) diff --git a/source/extensions/quic_listeners/quiche/platform/BUILD b/source/extensions/quic_listeners/quiche/platform/BUILD index 69eae676a3fef..bdcf41599065a 100644 --- a/source/extensions/quic_listeners/quiche/platform/BUILD +++ b/source/extensions/quic_listeners/quiche/platform/BUILD @@ -228,6 +228,16 @@ envoy_cc_library( ], ) +envoy_cc_library( + name = "quic_platform_udp_socket_impl_lib", + hdrs = select({ + "//bazel:linux": ["quic_udp_socket_platform_impl.h"], + "//conditions:default": [], + }), + repository = "@envoy", + tags = ["nofips"], +) + envoy_cc_library( name = "envoy_quic_clock_lib", srcs = ["envoy_quic_clock.cc"], From 79ca1641c3f4c2f015c4dcc0632647c39c113f31 Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Tue, 16 Jun 2020 15:15:46 -0400 Subject: [PATCH 02/10] add udp socket imple Signed-off-by: Dan Zhang --- .../platform/quic_udp_socket_platform_impl.h | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 source/extensions/quic_listeners/quiche/platform/quic_udp_socket_platform_impl.h diff --git a/source/extensions/quic_listeners/quiche/platform/quic_udp_socket_platform_impl.h b/source/extensions/quic_listeners/quiche/platform/quic_udp_socket_platform_impl.h new file mode 100644 index 0000000000000..a8dd7abe03195 --- /dev/null +++ b/source/extensions/quic_listeners/quiche/platform/quic_udp_socket_platform_impl.h @@ -0,0 +1,21 @@ +#pragma once + +// NOLINT(namespace-envoy) + +// This file is part of the QUICHE platform implementation, and is not to be +// consumed or referenced directly by other Envoy code. It serves purely as a +// porting layer for QUICHE. + +#include + +namespace quic { + +const size_t kCmsgSpaceForGooglePacketHeaderImpl = 0; + +inline bool GetGooglePacketHeadersFromControlMessageImpl(struct ::cmsghdr* cmsg, + char** packet_headers, + size_t* packet_headers_len) { + return false; +} + +} // namespace quic From ce4e2a8e9fbccbc5763e133b5e6851869a447881 Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Thu, 18 Jun 2020 13:24:59 -0400 Subject: [PATCH 03/10] clang-tidy Signed-off-by: Dan Zhang --- bazel/external/quiche.BUILD | 6 +++++- .../quiche/platform/quic_udp_socket_platform_impl.h | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bazel/external/quiche.BUILD b/bazel/external/quiche.BUILD index b290400dae00e..2259125b8500e 100644 --- a/bazel/external/quiche.BUILD +++ b/bazel/external/quiche.BUILD @@ -73,6 +73,7 @@ test_suite( name = "ci_tests", tests = [ "http2_platform_api_test", + "quic_core_batch_writer_batch_writer_test_lib", "quic_platform_api_test", "quiche_common_test", "spdy_platform_api_test", @@ -3942,7 +3943,10 @@ envoy_cc_test( envoy_cc_test( name = "quic_core_batch_writer_batch_writer_test", - srcs = ["quiche/quic/core/batch_writer/quic_batch_writer_test.cc"], + srcs = select({ + "@envoy//bazel:linux": ["quiche/quic/core/batch_writer/quic_batch_writer_test.cc"], + "//conditions:default": [], + }), copts = quiche_copts, repository = "@envoy", tags = ["nofips"], diff --git a/source/extensions/quic_listeners/quiche/platform/quic_udp_socket_platform_impl.h b/source/extensions/quic_listeners/quiche/platform/quic_udp_socket_platform_impl.h index a8dd7abe03195..248cfc193e029 100644 --- a/source/extensions/quic_listeners/quiche/platform/quic_udp_socket_platform_impl.h +++ b/source/extensions/quic_listeners/quiche/platform/quic_udp_socket_platform_impl.h @@ -12,9 +12,10 @@ namespace quic { const size_t kCmsgSpaceForGooglePacketHeaderImpl = 0; -inline bool GetGooglePacketHeadersFromControlMessageImpl(struct ::cmsghdr* cmsg, - char** packet_headers, - size_t* packet_headers_len) { +// NOLINTNEXTLINE(readability-identifier-naming) +inline bool GetGooglePacketHeadersFromControlMessageImpl(struct ::cmsghdr* /*cmsg*/, + char** /*packet_headers*/, + size_t* /*packet_headers_len*/) { return false; } From 1770d86c8cfb60be9fa684dd917cd87a55076394 Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Fri, 19 Jun 2020 12:22:44 -0400 Subject: [PATCH 04/10] fix ci_test Signed-off-by: Dan Zhang --- bazel/external/quiche.BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazel/external/quiche.BUILD b/bazel/external/quiche.BUILD index 2259125b8500e..e5c9d97d62a1b 100644 --- a/bazel/external/quiche.BUILD +++ b/bazel/external/quiche.BUILD @@ -73,7 +73,7 @@ test_suite( name = "ci_tests", tests = [ "http2_platform_api_test", - "quic_core_batch_writer_batch_writer_test_lib", + "quic_core_batch_writer_batch_writer_test", "quic_platform_api_test", "quiche_common_test", "spdy_platform_api_test", From 7b5e9b6a16deb155502bba4d5a1d9d6dadbd0954 Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Fri, 19 Jun 2020 15:07:09 -0400 Subject: [PATCH 05/10] enable info logging Signed-off-by: Dan Zhang --- ci/do_ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 7b1221ed82e0a..aa46731fdc982 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -117,7 +117,7 @@ if [[ "$CI_TARGET" == "bazel.release" ]]; then bazel_binary_build release echo "Testing ${TEST_TARGETS}" - bazel_with_collection test ${BAZEL_BUILD_OPTIONS} -c opt ${TEST_TARGETS} + bazel_with_collection test ${BAZEL_BUILD_OPTIONS} -c opt --test_arg="-l info" ${TEST_TARGETS} exit 0 elif [[ "$CI_TARGET" == "bazel.release.server_only" ]]; then setup_clang_toolchain From 5d22060f404ec6edfab99127ee5ddddd1c7de7b3 Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Fri, 19 Jun 2020 15:11:26 -0400 Subject: [PATCH 06/10] test output all Signed-off-by: Dan Zhang --- ci/do_ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index aa46731fdc982..826d6226905d3 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -117,7 +117,7 @@ if [[ "$CI_TARGET" == "bazel.release" ]]; then bazel_binary_build release echo "Testing ${TEST_TARGETS}" - bazel_with_collection test ${BAZEL_BUILD_OPTIONS} -c opt --test_arg="-l info" ${TEST_TARGETS} + bazel_with_collection test ${BAZEL_BUILD_OPTIONS} -c opt --test_output=all --test_arg="-l info" ${TEST_TARGETS} exit 0 elif [[ "$CI_TARGET" == "bazel.release.server_only" ]]; then setup_clang_toolchain From a5568617ea402ce6675e7e5110508be260559dbf Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Fri, 19 Jun 2020 16:41:02 -0400 Subject: [PATCH 07/10] fix arg sequence Signed-off-by: Dan Zhang --- ci/do_ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 826d6226905d3..20b4baf6117dd 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -117,7 +117,7 @@ if [[ "$CI_TARGET" == "bazel.release" ]]; then bazel_binary_build release echo "Testing ${TEST_TARGETS}" - bazel_with_collection test ${BAZEL_BUILD_OPTIONS} -c opt --test_output=all --test_arg="-l info" ${TEST_TARGETS} + bazel_with_collection test ${BAZEL_BUILD_OPTIONS} -c opt ${TEST_TARGETS} --test_output=all --test_arg="-l info" exit 0 elif [[ "$CI_TARGET" == "bazel.release.server_only" ]]; then setup_clang_toolchain From 1bf9282093d5934039b04ae74b48bc4844bdae0f Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Mon, 22 Jun 2020 14:29:40 -0400 Subject: [PATCH 08/10] add info logging Signed-off-by: Dan Zhang --- ci/do_ci.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 20b4baf6117dd..fba91df239688 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -24,7 +24,7 @@ function collect_build_profile() { function bazel_with_collection() { declare -r BAZEL_OUTPUT="${ENVOY_SRCDIR}"/bazel.output.txt - bazel $* | tee "${BAZEL_OUTPUT}" + bazel "$@" | tee "${BAZEL_OUTPUT}" declare BAZEL_STATUS="${PIPESTATUS[0]}" if [ "${BAZEL_STATUS}" != "0" ] then @@ -117,7 +117,7 @@ if [[ "$CI_TARGET" == "bazel.release" ]]; then bazel_binary_build release echo "Testing ${TEST_TARGETS}" - bazel_with_collection test ${BAZEL_BUILD_OPTIONS} -c opt ${TEST_TARGETS} --test_output=all --test_arg="-l info" + bazel_with_collection test ${BAZEL_BUILD_OPTIONS} -c opt ${TEST_TARGETS} --test_output=all --test_arg=-l\ info exit 0 elif [[ "$CI_TARGET" == "bazel.release.server_only" ]]; then setup_clang_toolchain From 1200169d9b73ffc3d7210f2499fc82e4d9874090 Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Sun, 28 Jun 2020 19:42:40 -0400 Subject: [PATCH 09/10] remove test Signed-off-by: Dan Zhang --- bazel/external/quiche.BUILD | 1 - 1 file changed, 1 deletion(-) diff --git a/bazel/external/quiche.BUILD b/bazel/external/quiche.BUILD index e5c9d97d62a1b..b9536fa6dbb32 100644 --- a/bazel/external/quiche.BUILD +++ b/bazel/external/quiche.BUILD @@ -73,7 +73,6 @@ test_suite( name = "ci_tests", tests = [ "http2_platform_api_test", - "quic_core_batch_writer_batch_writer_test", "quic_platform_api_test", "quiche_common_test", "spdy_platform_api_test", From 38ec0ff61ccc433708fcdde387e32e81028516ec Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Mon, 29 Jun 2020 11:09:17 -0400 Subject: [PATCH 10/10] revert do_ci Signed-off-by: Dan Zhang --- ci/do_ci.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index fba91df239688..7b1221ed82e0a 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -24,7 +24,7 @@ function collect_build_profile() { function bazel_with_collection() { declare -r BAZEL_OUTPUT="${ENVOY_SRCDIR}"/bazel.output.txt - bazel "$@" | tee "${BAZEL_OUTPUT}" + bazel $* | tee "${BAZEL_OUTPUT}" declare BAZEL_STATUS="${PIPESTATUS[0]}" if [ "${BAZEL_STATUS}" != "0" ] then @@ -117,7 +117,7 @@ if [[ "$CI_TARGET" == "bazel.release" ]]; then bazel_binary_build release echo "Testing ${TEST_TARGETS}" - bazel_with_collection test ${BAZEL_BUILD_OPTIONS} -c opt ${TEST_TARGETS} --test_output=all --test_arg=-l\ info + bazel_with_collection test ${BAZEL_BUILD_OPTIONS} -c opt ${TEST_TARGETS} exit 0 elif [[ "$CI_TARGET" == "bazel.release.server_only" ]]; then setup_clang_toolchain