]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
doc/dev: document exact CRC parameters for crc32c used in msgr2
authordatdenkikniet <jcdra1@gmail.com>
Mon, 15 Dec 2025 21:01:23 +0000 (22:01 +0100)
committerdatdenkikniet <jcdra1@gmail.com>
Mon, 15 Dec 2025 22:20:40 +0000 (23:20 +0100)
The description of the CRC used by the msgr2 protocol as CRC32-C
can be ambiguous. Document the actual parameters that make up
the CRC that is used.

Signed-off-by: Johannes Cornelis Draaijer <jcdra1@gmail.com>
doc/dev/msgr2.rst

index ecd6c8258cd0acd2b1c5f866d81c74227222f7db..154f5fc482db5d13d2bc426b1663f71ed2231e56 100644 (file)
@@ -121,9 +121,10 @@ length and segment alignment fields are zeroed.
 
 The reserved bytes are zeroed.
 
-The preamble checksum is CRC32-C.  It covers everything up to
-itself (28 bytes) and is calculated and verified irrespective of
-the connection mode (i.e. even if the frame is encrypted).
+The preamble checksum is CRC32-C (see :ref:`crc`).  It covers
+everything up to itself (28 bytes) and is calculated and verified
+irrespective of the connection mode (i.e. even if the frame is
+encrypted).
 
 ### msgr2.0-crc mode
 
@@ -152,8 +153,9 @@ back to the user immediately, without making a copy or blocking
 until the whole frame is transmitted.  Currently this is used only
 by the kernel client, see ceph_msg_revoke().
 
-The segment checksum is CRC32-C.  For "used" empty segments, it is
-set to (__le32)-1.  For unused (trailing) segments, it is zeroed.
+The segment checksum is CRC32-C (see :ref:`crc`).  For "used"
+empty segments, it is initialized with (__le32)-1. For unused
+(trailing) segments, it is zeroed.
 
 The crcs are calculated just to protect against bit errors.
 No authenticity guarantees are provided, unlike in msgr1 which
@@ -954,3 +956,20 @@ _____________________________________
      session_accepting -> ready [label = "client ident", tooltip = "set connection features"];
      ready -> ready [label = "keep alive"];
    }
+
+
+.. _crc:
+
+CRC Calculation
+---------------
+
+The CRC algorithm used in this section has the following parameters:
+
+* Width: 32 bits
+* Poly: ``0x1EDC6F41``
+* Init: ``0`` (for preamble CRC), ``(__le32)-1`` = ``0xFFFFFFFF`` (for segment data CRC)
+* Refin: ``true``
+* Refout: ``true``
+* Xorout: ``0``
+* Check: ``0``
+* Residue: ``0``
\ No newline at end of file