Skip to content

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

@dwizzle204

Description

@dwizzle204

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstreamThird party issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions