os-realtek-re: if_re.ko unconditionally enables flow control (pause) on RTL8125, ignores ifconfig mediaopt
Nobody has claimed this yet.
- 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:
- I have read the contributing guide lines at https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md
- I have searched the existing issues, open and closed, and I'm convinced that mine is new.
- The title contains the plugin to which this issue belongs
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
- Install os-realtek-re plugin (if_re.ko) with an RTL8125 NIC
- Run
ifconfig re0 -mediaopt rxpause,txpause ifconfig re0still 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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