mctp-estack: I2C transport: Unit tests, fix surfaced bugs, small improvements and doc#43
mctp-estack: I2C transport: Unit tests, fix surfaced bugs, small improvements and doc#43embediver wants to merge 6 commits intoCodeConstruct:mainfrom
Conversation
3715f55 to
71b23c6
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
Thanks! Given the dot-points are fairly independent, can you split this up into those separate changes? And in the case of bug fixes, would be handy to include some detail about the bug. |
| MctpI2cHeader::decode(packet.get(..4).ok_or(Error::InvalidInput)?)?; | ||
| // total packet len == byte_count + 3 (destination, command code, byte count) | ||
| // pec is not included | ||
| if header.byte_count + 3 != packet.len() { |
There was a problem hiding this comment.
It sounds like we're getting different packet formats input here?
There was a problem hiding this comment.
From the MCTP SMBus/I2C Transport Binding Specification:
This value is the count of bytes that follow the Byte Count field up to, but not including, the PEC byte
The packet holds the complete packet at this point (including the 3 bytes for source address , Command Code and Byte Count), with the PEC already stripped if checked.
…acket Signed-off-by: Marvin Gudel <marvin.gudel@9elements.com>
…ddress when decoding Signed-off-by: Marvin Gudel <marvin.gudel@9elements.com>
Signed-off-by: Marvin Gudel <marvin.gudel@9elements.com>
71b23c6 to
8ed9a25
Compare
I have created individual commits for the separate changes now. |
The `MctpI2cHeader::decode(...)` method errors on slices that are not 4-byte. Signed-off-by: Marvin Gudel <marvin.gudel@9elements.com>
The complete packet includes destination address, command code, byte count and source address. The check previously accounted only for the source adddress, while the checked packet includes the whole header at that point. Signed-off-by: Marvin Gudel <marvin.gudel@9elements.com>
Signed-off-by: Marvin Gudel <marvin.gudel@9elements.com>
8ed9a25 to
9e83a4f
Compare
MctpI2cHeader::decode()function has to be called with only the 4-byte header (not the whole packet)