Skip to content

pldm-fw: ua: send actual component count in RequestUpdate#59

Open
brcarr-nv wants to merge 1 commit into
CodeConstruct:mainfrom
brcarr-nv:patch1
Open

pldm-fw: ua: send actual component count in RequestUpdate#59
brcarr-nv wants to merge 1 commit into
CodeConstruct:mainfrom
brcarr-nv:patch1

Conversation

@brcarr-nv

Copy link
Copy Markdown

request_update() hardcoded the RequestUpdate NumberOfComponents field to 1. DSP0267 Table 27 defines this field as "the number of components that will be passed to the FD during the update", and the FD may use it to compare against the number of PassComponentTable/UpdateComponent commands it receives. When a package applies more than one component, the UA passes all of them (pass_component_table and update_components_progress iterate over update.components) while still announcing only 1, which a conformant FD can reject as a mismatch.

Derive the count from update.components, the same list driven through the rest of the update flow, so the announced value matches what is actually sent. The value is fallibly converted to u16 to guard the (practically impossible) >65535 component case rather than truncating.

request_update() hardcoded the RequestUpdate NumberOfComponents field
to 1. DSP0267 Table 27 defines this field as "the number of components
that will be passed to the FD during the update", and the FD may use it
to compare against the number of PassComponentTable/UpdateComponent
commands it receives. When a package applies more than one component,
the UA passes all of them (pass_component_table and
update_components_progress iterate over update.components) while still
announcing only 1, which a conformant FD can reject as a mismatch.

Derive the count from update.components, the same list driven through
the rest of the update flow, so the announced value matches what is
actually sent. The value is fallibly converted to u16 to guard the
(practically impossible) >65535 component case rather than truncating.

Add a unit test (request_update_reports_actual_component_count) that
drives request_update over a mock MCTP ReqChannel and asserts the
RequestUpdate NumberOfComponents field reflects the actual component
count, along with the cfg(test) package-builder and temp-file helpers it
depends on.

Signed-off-by: Brian Carr <brcarr@nvidia.com>
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.

1 participant