Skip to content

Conversation

@jk-ozlabs
Copy link
Member

@jk-ozlabs jk-ozlabs commented Jul 30, 2025

This series adds support for the PLDM for File Transfer ("type 7") protocol.

Since type 7 is dependent on the PLDM base (type 0) and PLDM for Platform Montioring and Control (type 2), we also add support for dependent parts of those, including PLDM type registration, PLDM version reporting and multipart size negotiation.

We're primarily targeting async here, so we'll need to introduce async versions of some of the pldm transfer functions. For binary protocol parsing, we'll use deku, so introduce that as a workspace-wide dependency.

We introduce a few example utilities along the way, for some reference test support.

mkj and others added 29 commits July 30, 2025 17:51
Conditionally use alloc when feature is enabled. no_std is no longer
conditional on test, instead "extern crate std" is used for that.

CI now tests some creates with "alloc" feature.

Signed-off-by: Matt Johnston <[email protected]>
We're going to introduce code that uses deku for binary parsing. Add a
worspace dependency on the no-alloc-compatible deku fork while that goes
upstream.

Signed-off-by: Jeremy Kerr <[email protected]>
Otherwise the message is silently truncated.

Signed-off-by: Matt Johnston <[email protected]>
Previously it was only emitted on a new EID, but it may be useful for
applications to know when a bus owner assigns an EID.

Signed-off-by: Matt Johnston <[email protected]>
The cookie wasn't being passed to the stack on send, so never got woken
on a response.

Signed-off-by: Matt Johnston <[email protected]>
A message could be received with a particular AppCookie, but the cookie
would have already been dropped from the waker pool.

This is a workaround, needs a proper fix to remove corresponding
flows/reassemblers from the core stack on ReqChannel drop.

Signed-off-by: Matt Johnston <[email protected]>
RouterAsyncReqChannel should not reuse tags between requests
(unless !tag_expires). Now a new tag and cookie are allocated
for each send(), cleared after recv().

The Stack::set_flow() checks for consistency between calls are also
simplified.

Signed-off-by: Matt Johnston <[email protected]>
Containing just the Cmd type for now.

Signed-off-by: Jeremy Kerr <[email protected]>
Add an async version of pldm_xfer_buf()

Signed-off-by: Jeremy Kerr <[email protected]>
Signed-off-by: Matt Johnston <[email protected]>
In order for the control responder to implement multipart transfer
parameter negotiation, it needs to know the max part size values for
each PLDM type handler.

Add an Option<u16> to the registration function, for handlers to do so.

Now that we have the supported multipart size data, implement a simple
Negotiate Transfer Parameters.

This is currently across all types; we only allow one negotiation for
all of a requester's types as one operation (the spec allows multiple).
Any secondary negotiation request will be rejected.

Type handlers can query the negotiated part size with
negotiated_xfer_size().

Signed-off-by: Jeremy Kerr <[email protected]>
This allowing ignoring desc arguments on no-alloc, which would otherwise
give an unused variable warning.

Signed-off-by: Matt Johnston <[email protected]>
Now a truncated version of the original buffer can be kept
by the caller.

Signed-off-by: Matt Johnston <[email protected]>
Signed-off-by: Jeremy Kerr <[email protected]>
Signed-off-by: Matt Johnston <[email protected]>
The second tuple item is a bit skip, not a length.

Signed-off-by: Jeremy Kerr <[email protected]>
Helper for issuing a Negotiate Transfer Parameters command, mainly in
handling the types data.

Signed-off-by: Jeremy Kerr <[email protected]>
This could be extended in future to other calls.

Signed-off-by: Matt Johnston <[email protected]>
Adds
- GetSensorReading
- GetStateSensorReading
- SetNumericSensorEnable
- SetStateSensorEnables

[+minor change by Jeremy Kerr <[email protected]>: don't elide
StateFieldDebug lifetime]

Signed-off-by: Matt Johnston <[email protected]>
Add Platform Data Record (PDR) definitions to the platform core and
requester modules.

Signed-off-by: Matt Johnston <[email protected]>
Supports:
  numeric-sensor    Get Numeric Sensor Reading
  state-sensor      Get State Sensor Reading. Only simple sensors supported.
  numeric-enable    Set Numeric Sensor Enable
  state-enable      Set State Sensor Enable. Only simple sensors supported.

Signed-off-by: Matt Johnston <[email protected]>
jk-ozlabs and others added 14 commits July 30, 2025 17:53
Signed-off-by: Jeremy Kerr <[email protected]>
We'll use these for general command handling too.

Signed-off-by: Jeremy Kerr <[email protected]>
Do a DfProperties, DfOpen and read.

Signed-off-by: Jeremy Kerr <[email protected]>
We can query the part size from the pldm control responder, so use this
for our transfer size selection.

Signed-off-by: Jeremy Kerr <[email protected]>
... and merge the two block_on() invocations.

Signed-off-by: Jeremy Kerr <[email protected]>
These are just the u16 wrappers, so allow Copy, plus the usual set of
PartialEq, Eq and Hash.

Signed-off-by: Jeremy Kerr <[email protected]>
We should be able to close FileDescriptors to free up the host slot.

Signed-off-by: Jeremy Kerr <[email protected]>
We were only registering the DfProperties command; report support for
DfOpen, DfRead and DfClose too.

Signed-off-by: Jeremy Kerr <[email protected]>
Handy to have some indication about individual transfer operations.

Signed-off-by: Jeremy Kerr <[email protected]>
@mkj mkj merged commit 851360e into CodeConstruct:main Jul 30, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants