Skip to content

Commit 1fc4c10

Browse files
committed
mctp-estack: Remove ReceiveHandle
Cookies can now be set directly on the MctpMessage. Deferred users need to call .retain() before dropping a a MctpMessage to avoid the reassembler being marked as completed (that is handled inside the Router). Unused Reassembler slots are now stored as a State::Unused on the Reassembler itself, rather than None in the Stack's reassembler array. That make it more convenient for a Reassembler to set itself as unused from the MctpMessage's drop handler. Signed-off-by: Matt Johnston <[email protected]>
1 parent 3ea4f6a commit 1fc4c10

File tree

6 files changed

+229
-297
lines changed

6 files changed

+229
-297
lines changed

mctp-estack/src/i2c.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
use crate::fmt::{debug, error, info, trace, warn};
1010

1111
use crate::{
12-
AppCookie, Fragmenter, MctpMessage, MsgIC, ReceiveHandle, SendOutput,
13-
Stack, MAX_PAYLOAD,
12+
AppCookie, Fragmenter, MctpMessage, MsgIC, SendOutput, Stack, MAX_PAYLOAD,
1413
};
1514
use mctp::{Eid, Error, MsgType, Result, Tag};
1615

@@ -85,14 +84,14 @@ impl MctpI2cEncap {
8584
&self,
8685
packet: &[u8],
8786
mctp: &'f mut Stack,
88-
) -> Result<Option<(MctpMessage<'f>, u8, ReceiveHandle)>> {
87+
) -> Result<Option<(MctpMessage<'f>, u8)>> {
8988
let (mctp_packet, i2c_src) = self.decode(packet, false)?;
9089

9190
// Pass to MCTP stack
9291
let m = mctp.receive(mctp_packet)?;
9392

9493
// Return a (message, i2c_source) tuple on completion
95-
Ok(m.map(|(msg, handle)| (msg, i2c_src, handle)))
94+
Ok(m.map(|msg| (msg, i2c_src)))
9695
}
9796

9897
/// `out` must be sized to hold 8+mctp_mtu, to allow for MCTP and I2C headers
@@ -218,7 +217,7 @@ impl MctpI2cHandler {
218217
&mut self,
219218
packet: &[u8],
220219
mctp: &'f mut Stack,
221-
) -> Result<Option<(MctpMessage<'f>, u8, ReceiveHandle)>> {
220+
) -> Result<Option<(MctpMessage<'f>, u8)>> {
222221
self.encap.receive_done_pec(packet, mctp)
223222
}
224223

0 commit comments

Comments
 (0)