From bc835b8bed627af89b1a0bb0f7585e0e3d531aaa Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Mon, 4 May 2020 17:52:13 +0200 Subject: [PATCH] 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 --- src/crimson/net/ProtocolV2.cc | 2 +- src/msg/async/frames_v2.cc | 4 ++-- src/msg/async/frames_v2.h | 9 ++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/crimson/net/ProtocolV2.cc b/src/crimson/net/ProtocolV2.cc index a524497d80b..26c2f6c4099 100644 --- a/src/crimson/net/ProtocolV2.cc +++ b/src/crimson/net/ProtocolV2.cc @@ -377,7 +377,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 bb292d0cf50..7711cc8d292 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 74c9d5ed9c7..f7eea559a2a 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; -- 2.39.5