opnsense / opnsense/plugins

os-realtek-re: if_re.ko unconditionally enables flow control (pause) on RTL8125, ignores ifconfig mediaopt

Open
#5,495 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

upstream
Dominant language
PHP
Stars
1.2k
Forks
863
Avg merge
2d 6h
Merged PRs (30d)
10

Description

Important notices
Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug

The RTL8125 vendor driver (if_re.ko, packaged by os-realtek-re) unconditionally advertises flow control (pause frames) during auto-negotiation. When connected to a switch that also advertises pause, the link negotiates flow control and the switch can issue pause frames under buffer pressure. This causes TX ring stalls and net_drop_out increments.

There is no userspace workaround: ifconfig re0 -mediaopt rxpause,txpause is silently ignored because the driver never reads media options before programming the PHY.

To Reproduce

  1. Install os-realtek-re plugin (if_re.ko) with an RTL8125 NIC
  2. Run ifconfig re0 -mediaopt rxpause,txpause
  3. ifconfig re0 still shows <full-duplex,rxpause,txpause>

Pause advertisement cannot be removed via mediaopt regardless of what is passed.

Expected behavior

ifconfig re0 -mediaopt rxpause,txpause should clear the pause advertisement bits so the link negotiates without flow control.

Relevant log files

In if_re.c, re_ifmedia_upd_8125() at line 9271:

MP_WritePhyUshort(sc, MII_ANAR, anar | 0x0800 | ANAR_FC);

always ORs ANAR_FC (symmetric pause) and 0x0800 (asymmetric pause) into the MII ANAR register. It never checks IFM_ETH_RXPAUSE or IFM_ETH_TXPAUSE from the requested media options.

The same unconditional ANAR_FC at line 8942 is gated by !RL_PHY_STATUS_FULL_DUP and only for older MACFG types (56/57/61/62), so RTL8125 is entirely uncovered.

Suggested fix

Conditionally include ANAR_FC based on IFM_ETH_RXPAUSE / IFM_ETH_TXPAUSE from media options, consistent with other FreeBSD network drivers.

Environment

OPNsense 26.1, FreeBSD 14.3-RELEASE-p14
Realtek RTL8125 2.5GbE Controller (rev 0x05)
os-realtek-re 1.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in if_re.c at re_ifmedia_upd_8125() around line 9271 and compare its MII_ANAR programming with the older path around line 8942. Trace how the requested media options reach the driver, then reproduce with ifconfig re0 -mediaopt rxpause,txpause. Done means the pause advertisement bits follow the requested IFM_ETH_RXPAUSE and IFM_ETH_TXPAUSE options on RTL8125.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.