Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The PortId is defined as a couple of ClockId (an 8-bytes opaque) and …
…the PortNumber (UInterger16). The current implementation compares the entire PortId, consisting of ClockId and PortNumber, using a byte-to-byte comparison (memcmp). This way doesn't consider the HOST's endianess on PortId part, giving wrong results in some cases. Consider the following setup (assuming the same ClockId) PortId_a = (ClockId, PortNumber=0x1234) PortId_b = (ClockId, PortNumber=0x4512) On a LittleEndian HOST, we obtain the following memory setup: PortId_a = ... ClockId ... 0x34 0x12 PortId_b = ... ClockId ... 0x12 0x45 Using just a memcmp() call we obtain the WRONG result PortId_a > PortId_b, because the byte-to-byte comparison will check the PortNumber Lower-Byte (0x34 vs 0x12) first. To fix the BCMA implementation we need to split the PortId comparison in: - ClockId comparison, still using memcmp() on a opaque byte stream - PortNumber, using a natural semantic comparison between integer numbers. In other hands, following the ITU-T G.8275.2 Figure 4, we need to ensure the same ordering criteria on all places: a Compare portIdentities of receiver of A and sender of A b Compare portIdentities of receiver of B and sender of B c Compare portIdentities of sender of A and sender of B d Compare PortNumbers of receiver of A and receiver B Signed-off-by: Luigi Mantellini <[email protected]> Signed-off-by: Luigi Mantellini <[email protected]>
- Loading branch information