Skip to content

Add BlueField-4 support and tolerate missing BFB versions#292

Merged
almaslennikov merged 1 commit intomainfrom
bfb-update-fix
Feb 13, 2026
Merged

Add BlueField-4 support and tolerate missing BFB versions#292
almaslennikov merged 1 commit intomainfrom
bfb-update-fix

Conversation

@almaslennikov
Copy link
Collaborator

GetFWVersionsFromBFB previously errored if any individual BF version (BF2 or BF3) was missing from the BFB info-v0 file. BFB files may legitimately contain only a subset of versions, so the function now only errors when no versions are found at all. Also adds BF4 (a2df) to the version extraction loop and to IsBlueFieldDevice().

GetFWVersionsFromBFB previously errored if any individual BF version
(BF2 or BF3) was missing from the BFB info-v0 file. BFB files may
legitimately contain only a subset of versions, so the function now
only errors when no versions are found at all. Also adds BF4 (a2df)
to the version extraction loop and to IsBlueFieldDevice().

Signed-off-by: Alexander Maslennikov <amaslennikov@nvidia.com>
@greptile-apps
Copy link

greptile-apps bot commented Feb 13, 2026

Greptile Overview

Greptile Summary

This PR adds support for BlueField-4 devices and makes BFB version extraction more resilient by tolerating missing individual firmware versions. The GetFWVersionsFromBFB() function was refactored from sequential individual checks to a loop-based approach that gracefully skips missing versions and only errors when no versions are found at all.

Key Changes:

  • Added BlueField4DeviceID constant ("a2df") in pkg/consts/consts.go
  • Updated IsBlueFieldDevice() to recognize BF4 device IDs
  • Refactored GetFWVersionsFromBFB() to iterate over BF2/BF3/BF4 versions, skip missing ones, and only fail when all are missing
  • Added comprehensive test coverage for partial version extraction scenarios

Implementation Notes:

  • The loop-based approach is cleaner and more maintainable than the previous sequential implementation
  • The new error handling (only failing when len(versions) == 0) correctly implements the "tolerate missing BFB versions" requirement
  • Tests now cover edge cases: all versions present, some missing, all missing, command failures
  • The change maintains backward compatibility - existing BFB files with only BF2/BF3 will continue to work

Confidence Score: 4/5

  • This PR is safe to merge with low risk
  • The code changes are straightforward and well-tested, but there's a pre-existing issue (not introduced by this PR) where the info file existence check logs but doesn't return an error, which could lead to confusing failures downstream
  • pkg/firmware/utils.go:279-281 - pre-existing issue where missing info file is logged but execution continues

Important Files Changed

Filename Overview
pkg/consts/consts.go Added BlueField4DeviceID constant ("a2df") for BlueField-4 support
pkg/utils/utils.go Updated IsBlueFieldDevice() to include BlueField-4 device ID check
pkg/firmware/utils.go Refactored GetFWVersionsFromBFB() to loop over BF2/BF3/BF4, skip missing versions gracefully, only error when all versions missing
pkg/firmware/utils_test.go Updated tests to cover BF4, partial version extraction, and new error behavior (only fails when zero versions found)

Last reviewed commit: 0e4f210

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Feb 13, 2026

Additional Comments (1)

pkg/firmware/utils.go
Pre-existing issue (not introduced by this PR): if the info file doesn't exist after extraction, this logs an error but continues execution. The subsequent awk commands will fail trying to read the missing file. Consider returning early here to provide clearer error messages

@almaslennikov almaslennikov merged commit 61511a4 into main Feb 13, 2026
12 of 16 checks passed
@almaslennikov almaslennikov deleted the bfb-update-fix branch February 13, 2026 11:57
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