Skip to content

Pldm improvement - #379

Open
CourtneyDrant wants to merge 4 commits into
OpenPRoT:mainfrom
CourtneyDrant:pldm-improvement
Open

Pldm improvement#379
CourtneyDrant wants to merge 4 commits into
OpenPRoT:mainfrom
CourtneyDrant:pldm-improvement

Conversation

@CourtneyDrant

Copy link
Copy Markdown
Contributor

This pull request was done to improve on a previous design of the pldm-service. It has one process which is the Firmware Device. Firmware Device is the OpenProt Pldm terminus for FW update. It will loop to receive messages from the UA and when ready, will request data from the UA. The loop insures that between each request the terminus will check for UA requests to receive status or cancel an update.

@CourtneyDrant
CourtneyDrant force-pushed the pldm-improvement branch 2 times, most recently from f487f1c to d16c6b8 Compare July 28, 2026 22:10
if initiator_active {
let pldm_len = self
.cmd_interface
.generate_initiator_request(&mut fw_buf)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what is the state when generate_initiator_request generates a buf len of 0? Does that imply an error? This would then be handled with the ? and we could get rid of the pldm_len > 0?

resp_len.checked_add(1).ok_or(PldmServiceError::Overflow)?;
let resp = fw_buf
.get_mut(..resp_total_len)
.ok_or(PldmServiceError::Overflow)?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Overflow an accurate error to use here?

Comment thread services/pldm/src/lib.rs
//! ▼ ▼
//! ┌──────────────────────────────────────────┐
//! │ openprot-mctp-api │ Stack<C: MctpClient>
//! └───────────┬───────────────────────────────┘

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: improper formatting

Comment thread services/pldm/src/lib.rs
Comment on lines +18 to +19
//! ┌──────────────────────────────────────────┐
//! │ openprot-pldm-service │◄── this crate

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: improper formatting

loop {
// Fragmenter requires the output buffer to be at least the payload
// MTU (255) plus the 4-byte MCTP transport header.
let mut buf = [0u8; 255 + 4];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let mut buf = [0u8; 255 + 4];
let mut buf = [0u8; MTU + 4];

activated: Cell<bool>,
}

impl FdOps for FakeFdOps {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: just my opinion, use Mock* instead of Fake*

}

fn get_mtu(&self) -> usize {
255

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see base_host.rs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems as if base_host and firmware_update_hosts share quite a lot of mock and setup code. Can this somehow be unified to reduce code duplication?

Comment thread services/pldm/README.md
┌──────────────────────────────────────────┐
│ openprot-pldm-service │◄── this crate

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: improper formatting

Comment thread services/pldm/README.md
▼ ▼
┌──────────────────────────────────────────┐
│ openprot-mctp-api │ Stack<C: MctpClient>
└───────────┬───────────────────────────────┘

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: improper formatting

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