Skip to content

Kernel: T8914: add support for 2.5G pluggables on BCM57810S - #1227

Merged
sever-sever merged 1 commit into
vyos:rollingfrom
c-po:bnx2-patch
Jun 26, 2026
Merged

Kernel: T8914: add support for 2.5G pluggables on BCM57810S#1227
sever-sever merged 1 commit into
vyos:rollingfrom
c-po:bnx2-patch

Conversation

@c-po

@c-po c-po commented Jun 25, 2026

Copy link
Copy Markdown
Member

@mergify depends #1226

Change summary

Add the well-known JAMESMTL kernel module patch for bnx2x to advertise 2.5Gbit/s
capabilities on Broadcom NetXtreme2-X cards with BCM57810S chipset.

This is useful for ISP GPON access networks that use 2.5Gbit/s pluggables and
need the NIC to negotiate beyond 1000baseT/Full, avoiding the 940Mbit/s
practical cap on overprovisioned 1G services.

References:

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

How to test / Smoketest result

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@c-po c-po changed the title Bnx2 patch Kernel: T8914: add support for 2.5G pluggables on BCM57810S Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 3b01bed9-b7e8-4cba-9254-c19baf686f42

📥 Commits

Reviewing files that changed from the base of the PR and between 2e1b62c and 33efe03.

📒 Files selected for processing (1)
  • scripts/package-build/linux-kernel/patches/kernel/0003-Kernel-T8914-add-support-for-2.5G-pluggables-on-BCM5.patch
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • ansible/ansible (manual)
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/package-build/linux-kernel/patches/kernel/0003-Kernel-T8914-add-support-for-2.5G-pluggables-on-BCM5.patch
📜 Recent review details
⏰ Context from checks skipped due to timeout. (5)
  • GitHub Check: j2lint / Validate j2 files
  • GitHub Check: codeql-analysis-call / Analyze (python)
  • GitHub Check: typos
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary
🧰 Additional context used
🔍 Remote MCP Context7

Relevant kernel-doc facts for this review:

  • The kernel’s PHY helper genphy_c45_pma_read_abilities() explicitly includes 2.5G and 5G modes via the PMA Extended Abilities register when bit 1.11.14 is set. This supports the general idea that 2.5G capability is represented in standard kernel PHY link-mode handling.
  • Kernel SFP helpers expose sfp_select_interface(struct sfp_bus *bus, const unsigned long *link_modes), which derives the SFP interface mode from the module’s supported link modes; this is relevant to code paths that classify SFP pluggables by advertised/derived modes.
  • Kernel docs for SFP module capabilities define sfp_module_caps with interfaces[] and link_modes[], and note may_have_phy is only a possibility flag due to EEPROM limitations.

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added support for 2.5G pluggable modules on compatible BCM5 network adapters.
    • Expanded speed detection and negotiation to recognize 2.5G links in more connection modes.
    • Added an option to reduce transmit-fault detection on selected ports.
  • Bug Fixes

    • Improved link status handling for 2.5G-capable optics.
    • Broadened module compatibility checks so more 1G/2.5G SFPs are accepted.

Walkthrough

Adds 2.5G pluggable handling in bnx2x link setup and status decoding, updates the 8727 MDIO register split, and adds a mask_tx_fault module parameter that can suppress SFP TX fault detection.

Changes

bnx2x 2.5G pluggable support

Layer / File(s) Summary
2.5G link handling
scripts/package-build/linux-kernel/patches/kernel/0003-Kernel-T8914-add-support-for-2.5G-pluggables-on-BCM5.patch (23-199, 224-239)
bnx2x_link.c adds SPEED_2500 handling in warpcore SGMII and 8727 link setup/status paths, expands dual-media and SFP checks to accept 2.5G, and advertises SUPPORTED_2500baseX_Full; bnx2x_reg.h splits MDIO_AN_REG_8727_MISC_CTRL into MDIO_AN_REG_8727_MISC_CTRL1 and MDIO_AN_REG_8727_MISC_CTRL2.
TX fault mask parameter
scripts/package-build/linux-kernel/patches/kernel/0003-Kernel-T8914-add-support-for-2.5G-pluggables-on-BCM5.patch (200-223)
bnx2x_main.c adds mask_tx_fault, stores it in bp->mask_tx_fault, and gates bnx2x_sfp_tx_fault_detection() in bnx2x_period_func().
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: 2.5G pluggable support for BCM57810S in bnx2x.
Description check ✅ Passed The description is on-topic and accurately summarizes the BCM57810S 2.5G support patch.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch (1)

98-98: 🗄️ Data Integrity & Integration | 🟠 Major

Multi-Arch: same is wrong here (scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch:91-98). linux-perf-${KERNELRELEASE} installs arch-specific perf binaries under shared paths, so co-installing different architectures will conflict. Drop the field, or use foreign only if cross-arch dependency resolution is required.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch`
at line 98, The package metadata in the linux-perf patch is marking the package
as Multi-Arch: same, but the linux-perf-${KERNELRELEASE} package installs
arch-specific binaries into shared paths and cannot be safely co-installed
across architectures. Update the control data in the patch that generates the
package to remove Multi-Arch: same, or switch to Multi-Arch: foreign only if
cross-arch dependency resolution is actually needed, and keep the change aligned
with the package definition for linux-perf-${KERNELRELEASE}.
scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch (3)

59-59: 🎯 Functional Correctness | 🟠 Major

Remove or wire the IPv4 link_filter sysctl.

include/linux/inetdevice.h:139 and net/ipv4/devinet.c:2652 expose /proc/sys/net/ipv4/conf/*/link_filter, but nothing in-tree reads IN_DEV_LINKFILTER(). The only runtime consumer is net/ipv6/route.c:145-160. Either add an IPv4 consumer or drop the IPv4 sysctl/docs in Documentation/networking/ip-sysctl.rst:2042.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch`
at line 59, The new IN_DEV_LINKFILTER macro adds an IPv4 sysctl that is exposed
by the existing inetdevice/devinet plumbing, but there is still no in-tree IPv4
code path using it. Either wire this setting into an IPv4 consumer that reads
IN_DEV_LINKFILTER from the relevant IPv4 routing/device logic, or remove the
IPv4 exposure entirely by undoing the sysctl/doc additions in the inetdevice,
devinet, and ip-sysctl pieces so the interface only exists where it is actually
used.

145-150: 🩺 Stability & Availability | 🟠 Major

Guard __in6_dev_get() before dereferencing in scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch:145-150.
__in6_dev_get(dev) can return NULL when IPv6 state is absent or torn down, so ->cnf.link_filter here can NULL-deref during route lookup. Cache the inet6_dev, return 0 if missing, and read link_filter with READ_ONCE().

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch`
around lines 145 - 150, The rt6_link_filter helper dereferences
__in6_dev_get(dev) without checking for NULL, so update this function to first
cache the inet6_dev pointer from __in6_dev_get, return 0 when it is absent, and
then read cnf.link_filter safely with READ_ONCE() before evaluating the
netif_running/netif_carrier_ok conditions.

127-133: 🎯 Functional Correctness | 🟡 Minor

Clamp link_filter to 0–2 in both sysctls

Documentation/networking/ip-sysctl.rst documents only 0/1/2, but proc_dointvec still accepts negatives and values above 2. That makes negative values behave like mode 1 and >2 behave like mode 2. Use proc_dointvec_minmax with SYSCTL_ZERO/SYSCTL_TWO for both the IPv6 entry here and the IPv4 DEVINET_SYSCTL_RW_ENTRY(LINKFILTER, "link_filter") path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch`
around lines 127 - 133, Clamp the link_filter sysctls to the documented 0–2
range by replacing proc_dointvec with proc_dointvec_minmax for the IPv6 entry in
the ipv6_devconf table and the IPv4 DEVINET_SYSCTL_RW_ENTRY(LINKFILTER,
"link_filter") path. Use SYSCTL_ZERO and SYSCTL_TWO as the bounds so values
below 0 or above 2 are rejected instead of being treated like valid modes.
🧹 Nitpick comments (1)
scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch (1)

94-94: 🚀 Performance & Scalability | 🔵 Trivial

Use Debian shlib substitution for perf deps
scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch:94 should use Depends: ${shlibs:Depends}, ${misc:Depends} instead of listing libpfm4, libslang2, libtraceevent1 directly; that keeps the package metadata aligned with the actual linked libraries and ABI changes.

♻️ Suggested direction
-Depends: libpfm4, libslang2, libtraceevent1
+Depends: ${shlibs:Depends}, ${misc:Depends}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch`
at line 94, The perf package dependency declaration is hardcoding shared library
names instead of using Debian shlib substitution. Update the dependency entry in
the linux-perf package patch to use ${shlibs:Depends} and ${misc:Depends} rather
than listing libpfm4, libslang2, and libtraceevent1 directly, so the packaging
metadata stays aligned with the symbols and ABI actually used by the perf
package build.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@scripts/package-build/linux-kernel/patches/kernel/0003-Kernel-T8914-add-support-for-2.5G-pluggables-on-BCM5.patch`:
- Line 31: Update the `mask_tx_fault` contract in the patch so it is clearly and
consistently treated as a per-port bitmask across the relevant code paths,
especially in the logic around the `mask_tx_fault` field and its read/print
handling. Adjust the surrounding checks and any user-facing description so
`mask_tx_fault=1` is understood as masking only port 0 rather than all TX fault
detection, and make the `port_*`/TX fault handling code reflect bitmask
semantics instead of boolean semantics.
- Around line 51-59: The 2.5G enablement check in the fiber-mode path is too
permissive because `speed_cap_mask & (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G |
PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G)` allows either capability alone to pass.
Update the condition in the `fiber_mode` / `phy->req_line_speed == SPEED_2500`
block (and the matching later path) so the 2.5G programming via
`bnx2x_cl45_write` only runs when both the 1G and 2.5G capability bits are
present, matching the “1G advertisment” requirement.

---

Outside diff comments:
In
`@scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch`:
- Line 59: The new IN_DEV_LINKFILTER macro adds an IPv4 sysctl that is exposed
by the existing inetdevice/devinet plumbing, but there is still no in-tree IPv4
code path using it. Either wire this setting into an IPv4 consumer that reads
IN_DEV_LINKFILTER from the relevant IPv4 routing/device logic, or remove the
IPv4 exposure entirely by undoing the sysctl/doc additions in the inetdevice,
devinet, and ip-sysctl pieces so the interface only exists where it is actually
used.
- Around line 145-150: The rt6_link_filter helper dereferences
__in6_dev_get(dev) without checking for NULL, so update this function to first
cache the inet6_dev pointer from __in6_dev_get, return 0 when it is absent, and
then read cnf.link_filter safely with READ_ONCE() before evaluating the
netif_running/netif_carrier_ok conditions.
- Around line 127-133: Clamp the link_filter sysctls to the documented 0–2 range
by replacing proc_dointvec with proc_dointvec_minmax for the IPv6 entry in the
ipv6_devconf table and the IPv4 DEVINET_SYSCTL_RW_ENTRY(LINKFILTER,
"link_filter") path. Use SYSCTL_ZERO and SYSCTL_TWO as the bounds so values
below 0 or above 2 are rejected instead of being treated like valid modes.

In
`@scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch`:
- Line 98: The package metadata in the linux-perf patch is marking the package
as Multi-Arch: same, but the linux-perf-${KERNELRELEASE} package installs
arch-specific binaries into shared paths and cannot be safely co-installed
across architectures. Update the control data in the patch that generates the
package to remove Multi-Arch: same, or switch to Multi-Arch: foreign only if
cross-arch dependency resolution is actually needed, and keep the change aligned
with the package definition for linux-perf-${KERNELRELEASE}.

---

Nitpick comments:
In
`@scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch`:
- Line 94: The perf package dependency declaration is hardcoding shared library
names instead of using Debian shlib substitution. Update the dependency entry in
the linux-perf package patch to use ${shlibs:Depends} and ${misc:Depends} rather
than listing libpfm4, libslang2, and libtraceevent1 directly, so the packaging
metadata stays aligned with the symbols and ABI actually used by the perf
package build.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: bd54cabf-0685-44d4-987c-6a38b94a40f9

📥 Commits

Reviewing files that changed from the base of the PR and between 0e7145f and 2e1b62c.

📒 Files selected for processing (3)
  • scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch
  • scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch
  • scripts/package-build/linux-kernel/patches/kernel/0003-Kernel-T8914-add-support-for-2.5G-pluggables-on-BCM5.patch
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • ansible/ansible (manual)
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary
🧰 Additional context used
🔍 Remote MCP Context7

Extra review context

  • Linux kernel docs distinguish admin state from carrier state: IFF_UP means the interface is administratively up, IFF_LOWER_UP reflects netif_carrier_on(), and IFF_RUNNING is kept for backward compatibility. The docs also note that ip link shows UP vs NO-CARRIER for these conditions.

  • IPv6/IP sysctl docs already use per-interface configuration under conf/interface/*, with conf/default/* for new interfaces and conf/all/* to update all interfaces. So adding a per-interface link_filter setting matches the existing sysctl layout (inference).

🔇 Additional comments (5)
scripts/package-build/linux-kernel/patches/kernel/0002-build-linux-perf-package.patch (2)

36-48: LGTM!


53-58: LGTM!

Also applies to: 64-76

scripts/package-build/linux-kernel/patches/kernel/0001-linkstate-ip-device-attribute.patch (2)

37-46: LGTM!

Also applies to: 71-71, 83-95, 115-119


156-161: LGTM!

scripts/package-build/linux-kernel/patches/kernel/0003-Kernel-T8914-add-support-for-2.5G-pluggables-on-BCM5.patch (1)

231-233: 🎯 Functional Correctness

No remaining MDIO_AN_REG_8727_MISC_CTRL references.

Comment on lines +51 to +59
+ /* Note that 2.5G works only when used with 1G advertisment */
+ if (fiber_mode && (phy->req_line_speed == SPEED_2500) &&
+ (phy->speed_cap_mask &
+ (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G |
+ PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G))) {
+ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
+ MDIO_WC_REG_SERDESDIGITAL_MISC1,
+ 0x6010);
+ }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Require the documented 1G + 2.5G capability combination.

Line 52 and Line 102 use speed_cap_mask & (1G | 2_5G), so either bit alone enables the 2.5G path. That contradicts Line 51’s “only when used with 1G advertisment” constraint and can configure 2.5G for an incomplete capability mask.

Proposed fix
-			(phy->speed_cap_mask &
-			 (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G |
-			  PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G))) {
+			((phy->speed_cap_mask &
+			  (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G |
+			   PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G)) ==
+			 (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G |
+			  PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G))) {
-			(phy->speed_cap_mask &
-			(PORT_HW_CFG_SPEED_CAPABILITY_D0_1G |
-			 PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G))) {
+			((phy->speed_cap_mask &
+			  (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G |
+			   PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G)) ==
+			 (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G |
+			  PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G))) {

Also applies to: 102-117

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@scripts/package-build/linux-kernel/patches/kernel/0003-Kernel-T8914-add-support-for-2.5G-pluggables-on-BCM5.patch`
around lines 51 - 59, The 2.5G enablement check in the fiber-mode path is too
permissive because `speed_cap_mask & (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G |
PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G)` allows either capability alone to pass.
Update the condition in the `fiber_mode` / `phy->req_line_speed == SPEED_2500`
block (and the matching later path) so the 2.5G programming via
`bnx2x_cl45_write` only runs when both the 1G and 2.5G capability bits are
present, matching the “1G advertisment” requirement.

Add the well-known JAMESMTL kernel module patch for bnx2x to advertise 2.5Gbit/s
capabilities on Broadcom NetXtreme2-X cards with BCM57810S chipset.

This is useful for ISP GPON access networks that use 2.5Gbit/s pluggables and
need the NIC to negotiate beyond 1000baseT/Full, avoiding the 940Mbit/s
practical cap on overprovisioned 1G services.

References:
* https://hack-gpon.org/broadcom-57810s/
* https://github.com/JAMESMTL/snippets/blob/dceb2fee74d80c66d/bnx2x/patches/bnx2x_warpcore_8727_2_5g_sgmii_txfault.patch

@sever-sever sever-sever left a comment

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.

Add support for BCM57810S NICs KERNEL patch

@jestabro jestabro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add JAMESMTL patch for BCM57810S chipset.

@mergify

mergify Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@sever-sever
sever-sever merged commit b3edf28 into vyos:rolling Jun 26, 2026
10 of 11 checks passed
@vyos-bot vyos-bot Bot added mirror-initiated This PR initiated for mirror sync workflow mirror-completed and removed mirror-initiated This PR initiated for mirror sync workflow labels Jun 26, 2026

@dmbaturin dmbaturin left a comment

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.

If the patch is reviewed and tested by the Linux community, I have nothing against including it.

@c-po
c-po deleted the bnx2-patch branch July 2, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants