From: Radoslaw Zarzynski Date: Thu, 14 Feb 2019 19:25:55 +0000 (+0100) Subject: msg/async: bump up preamble block size to 32 bytes. X-Git-Tag: v14.1.1~157^2~30 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a582600c99848611ae9d5ad6caee6bede781e222;p=ceph-ci.git msg/async: bump up preamble block size to 32 bytes. Signed-off-by: Radoslaw Zarzynski --- 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; }