-
Notifications
You must be signed in to change notification settings - Fork 11
mctp-estack: I2C transport: Unit tests, fix surfaced bugs, small improvements and doc #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds like we're getting different packet formats input here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)