From a582600c99848611ae9d5ad6caee6bede781e222 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Thu, 14 Feb 2019 20:25:55 +0100 Subject: [PATCH] msg/async: bump up preamble block size to 32 bytes. Signed-off-by: Radoslaw Zarzynski --- src/msg/async/ProtocolV2.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 59df602ab01..028e8dfc8d4 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -123,8 +123,10 @@ using segment_t = ProtocolV2::segment_t; // V2 preamble consists of one or more preamble blocks depending on // the number of segments a particular frame needs. Each block holds // up to 2 segments and has its own CRC. +// +// XXX: currently the multi-segment facility is NOT implemented. struct preamble_block_t { - static constexpr std::size_t MAX_NUM_SEGMENTS = 2; + static constexpr std::size_t MAX_NUM_SEGMENTS = 4; // ProtocolV2::Tag. For multi-segmented frames the value is the same // between subsequent preamble blocks. @@ -136,15 +138,16 @@ struct preamble_block_t { __u8 num_segments; std::array segments; + __u8 _reserved[4]; // CRC16 for this single preamble block. __le16 crc; } __attribute__((packed)); -static_assert(sizeof(preamble_block_t) == CRYPTO_BLOCK_SIZE); +static_assert(sizeof(preamble_block_t) % CRYPTO_BLOCK_SIZE == 0); static_assert(std::is_standard_layout::value); -static constexpr uint32_t FRAME_PREAMBLE_SIZE = CRYPTO_BLOCK_SIZE; +static constexpr uint32_t FRAME_PREAMBLE_SIZE = sizeof(preamble_block_t); template struct Frame { @@ -210,7 +213,9 @@ public: Frame() : preamble_filler(payload.append_hole(FRAME_PREAMBLE_SIZE)) {} ceph::bufferlist &get_buffer() { - fill_preamble({ segment_t{ payload.length() - FRAME_PREAMBLE_SIZE, 1} }, {}); + fill_preamble({ + segment_t{ payload.length() - FRAME_PREAMBLE_SIZE, 1 } + }, {}); return payload; } -- 2.39.5