Skip to content

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

Merged
almaslennikov merged 1 commit intonetwork-operator-26.1.xfrom
bfb-fix-release
Feb 13, 2026
Merged

Add BlueField-4 support and tolerate missing BFB versions#293
almaslennikov merged 1 commit intonetwork-operator-26.1.xfrom
bfb-fix-release

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().

(cherry picked from commit 0e4f210)

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>
(cherry picked from commit 0e4f210)
@greptile-apps
Copy link

greptile-apps bot commented Feb 13, 2026

Greptile Overview

Greptile Summary

Adds BlueField-4 device support and improves firmware version extraction from BFB files to tolerate missing individual versions.

Key changes:

  • Added BlueField4DeviceID constant ("a2df") to support BF4 hardware
  • Refactored GetFWVersionsFromBFB() to loop through BF2/3/4 versions instead of checking each individually
  • Changed error handling to skip missing versions gracefully and only error when no versions found at all
  • Updated IsBlueFieldDevice() to include BF4 device ID
  • Added comprehensive test coverage for partial version scenarios and BF4 support

Issues found:

  • Pre-existing bug at pkg/firmware/utils.go:279-281 where missing info file logs error but doesn't return, allowing execution to continue with non-existent file

Confidence Score: 4/5

  • PR is safe to merge with minor pre-existing issue noted
  • Well-structured refactoring with comprehensive test coverage. Logic correctly handles partial firmware versions. One pre-existing bug found that doesn't return early when info file is missing, but this existed before this PR.
  • Consider fixing the pre-existing bug in pkg/firmware/utils.go:279-281

Important Files Changed

Filename Overview
pkg/firmware/utils.go Refactored version extraction to loop through BF2/3/4, now tolerates missing versions and only errors if none found - has pre-existing bug at line 279-281
pkg/firmware/utils_test.go Comprehensive test updates covering BF4 support and new error handling behavior with partial versions

Sequence Diagram

sequenceDiagram
    participant Caller
    participant GetFWVersionsFromBFB
    participant mlx-mkbfb
    participant AWK as AWK Commands
    participant FileSystem

    Caller->>GetFWVersionsFromBFB: Request versions from BFB
    GetFWVersionsFromBFB->>mlx-mkbfb: Extract info-v0 from BFB
    mlx-mkbfb->>FileSystem: Write dump-info-v0
    GetFWVersionsFromBFB->>FileSystem: Check dump-info-v0 exists
    Note over GetFWVersionsFromBFB: Pre-existing bug: continues even if missing
    
    loop For each BF version (BF2, BF3, BF4)
        GetFWVersionsFromBFB->>AWK: Extract version for device
        alt Version found
            AWK-->>GetFWVersionsFromBFB: Return version string
            GetFWVersionsFromBFB->>GetFWVersionsFromBFB: Add to versions map
        else Version missing or error
            AWK-->>GetFWVersionsFromBFB: Empty or error
            Note over GetFWVersionsFromBFB: Skip and continue (new behavior)
        end
    end
    
    alt At least one version found
        GetFWVersionsFromBFB-->>Caller: Return versions map
    else No versions found
        GetFWVersionsFromBFB-->>Caller: Error: no versions found
    end
Loading

Last reviewed commit: 821f332

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: logs error but doesn't return, allowing code to continue with missing file

	if _, err := os.Stat(infoFile); os.IsNotExist(err) {
		log.Log.Error(err, "GetFWVersionsFromBFB(): failed to extract info-v0 file from BFB", "bfbPath", bfbPath)
		return nil, err
	}

@almaslennikov almaslennikov merged commit 776aefa into network-operator-26.1.x Feb 13, 2026
10 of 14 checks passed
@almaslennikov almaslennikov deleted the bfb-fix-release branch February 13, 2026 15:34
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