From: Ilya Dryomov Date: Mon, 4 May 2020 15:52:13 +0000 (+0200) Subject: msg/async/frames_v2: rename and clarify FRAME_FLAGS_LATEABRT X-Git-Tag: v15.2.5~164^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=36ff2f1fb14d7a430384a47c67c6584d9518bef4;p=ceph.git msg/async/frames_v2: rename and clarify FRAME_FLAGS_LATEABRT Clarify that the frame can be aborted at any point after the preamble and the first segment are put on the wire. When that happens, the remaining segments (including the data segment) may be filled with zeros. Signed-off-by: Ilya Dryomov (cherry picked from commit bc835b8bed627af89b1a0bb0f7585e0e3d531aaa) --- diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index 390f8bffa1bf..d942a761d67c 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -403,7 +403,7 @@ seastar::future<> ProtocolV2::read_frame_payload() // we do have a mechanism that allows transmitter to start sending message // and abort after putting entire data field on wire. This will be used by // the kernel client to avoid unnecessary buffering. - if (late_flags & FRAME_FLAGS_LATEABRT) { + if (late_flags & FRAME_LATE_FLAG_ABORTED) { // TODO ceph_assert(false); } diff --git a/src/msg/async/frames_v2.cc b/src/msg/async/frames_v2.cc index bb292d0cf508..7711cc8d292c 100644 --- a/src/msg/async/frames_v2.cc +++ b/src/msg/async/frames_v2.cc @@ -215,7 +215,7 @@ bool FrameAssembler::disasm_all_crc_rev0(bufferlist segment_bls[], ceph_assert(segment_bls[i].length() == m_descs[i].logical_len); check_segment_crc(segment_bls[i], epilogue->crc_values[i]); } - return !(epilogue->late_flags & FRAME_FLAGS_LATEABRT); + return !(epilogue->late_flags & FRAME_LATE_FLAG_ABORTED); } bool FrameAssembler::disasm_all_secure_rev0(bufferlist segment_bls[], @@ -233,7 +233,7 @@ bool FrameAssembler::disasm_all_secure_rev0(bufferlist segment_bls[], m_crypto->rx->authenticated_decrypt_update_final(epilogue_bl); auto epilogue = reinterpret_cast( epilogue_bl.c_str()); - return !(epilogue->late_flags & FRAME_FLAGS_LATEABRT); + return !(epilogue->late_flags & FRAME_LATE_FLAG_ABORTED); } bool FrameAssembler::disassemble_segments(bufferlist segment_bls[], diff --git a/src/msg/async/frames_v2.h b/src/msg/async/frames_v2.h index 07ce8f55a55b..2f61eb9e20a9 100644 --- a/src/msg/async/frames_v2.h +++ b/src/msg/async/frames_v2.h @@ -130,13 +130,13 @@ static_assert(std::is_standard_layout::value); // conveys late_flags. The initial user of this field will be the late // frame abortion facility. struct epilogue_crc_rev0_block_t { - __u8 late_flags; + __u8 late_flags; // FRAME_LATE_FLAG_ABORTED ceph_le32 crc_values[MAX_NUM_SEGMENTS]; } __attribute__((packed)); static_assert(std::is_standard_layout_v); struct epilogue_secure_rev0_block_t { - __u8 late_flags; + __u8 late_flags; // FRAME_LATE_FLAG_ABORTED __u8 padding[CRYPTO_BLOCK_SIZE - sizeof(late_flags)]; __u8 ciphers_private_data[]; @@ -144,7 +144,10 @@ struct epilogue_secure_rev0_block_t { static_assert(sizeof(epilogue_secure_rev0_block_t) % CRYPTO_BLOCK_SIZE == 0); static_assert(std::is_standard_layout_v); -#define FRAME_FLAGS_LATEABRT (1<<0) /* frame was aborted after txing data */ +// A frame can be aborted by the sender after transmitting the +// preamble and the first segment. The remainder of the frame +// is filled with zeros, up until the epilogue. +#define FRAME_LATE_FLAG_ABORTED (1<<0) struct FrameError : std::runtime_error { using runtime_error::runtime_error;