Page MenuHomeFreeBSD

if_rge: initial import of if_rge driver from OpenBSD.
ClosedPublic

Authored by adrian on Sat, Dec 6, 5:27 AM.
Tags
None
Referenced Files
F141100886: D54101.diff
Wed, Dec 31, 9:14 PM
Unknown Object (File)
Mon, Dec 29, 11:52 PM
Unknown Object (File)
Sun, Dec 28, 9:45 AM
Unknown Object (File)
Thu, Dec 18, 11:06 AM
Unknown Object (File)
Wed, Dec 17, 11:00 PM
Unknown Object (File)
Wed, Dec 17, 9:30 PM
Unknown Object (File)
Wed, Dec 17, 4:06 PM
Unknown Object (File)
Wed, Dec 17, 3:57 PM

Details

Summary

This is an initial import of the if_rge driver from OpenBSD
and adapted to FreeBSD.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69218
Build 66101: arc lint + arc unit

Event Timeline

adrian requested review of this revision.Sat, Dec 6, 5:27 AM
bz added inline comments.
share/man/man4/rge.4
3

You can use SPDX these days.

sys/dev/rge/if_rge_hw.c
669

Random place; I wonder how we can have all this without any attribution to Realtek? Was this extracted from specification or a vendor driver?

sys/modules/rge/Makefile
7

Do you really need opt_platform.h ?

share/man/man4/rge.4
30

This shouldn't be quoted

80

The macro here behaves weird in different implementations

131
144

Or similar

Detected on:

rge0@pci0:2:0:0:        class=0x020000 rev=0x05 hdr=0x00 vendor=0x10ec device=0x8125 subvendor=0x10ec subdevice=0
x0123
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8125 2.5GbE Controller'                                                                         class      = network
    subclass   = ethernet

Need to manually load the module (not auto-loaded when detected).

Physically connected to a 2.5Gb/s switch, but not able to go beyond 1Gb/s:

media: Ethernet autoselect (2500Base-T <full-duplex>)

From a 10G server on this same switch (iperf3 -P 8 -c 192.168.100.163):

- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   104 MBytes  87.1 Mbits/sec   42            sender
[  5]   0.00-10.01  sec   103 MBytes  86.4 Mbits/sec                  receiver
[  7]   0.00-10.00  sec   212 MBytes   178 Mbits/sec    0            sender
[  7]   0.00-10.01  sec   211 MBytes   177 Mbits/sec                  receiver
[  9]   0.00-10.00  sec  96.4 MBytes  80.8 Mbits/sec    0            sender
[  9]   0.00-10.01  sec  96.0 MBytes  80.5 Mbits/sec                  receiver
[ 11]   0.00-10.00  sec  82.1 MBytes  68.9 Mbits/sec   35            sender
[ 11]   0.00-10.01  sec  80.1 MBytes  67.2 Mbits/sec                  receiver
[ 13]   0.00-10.00  sec   141 MBytes   118 Mbits/sec   24            sender
[ 13]   0.00-10.01  sec   140 MBytes   117 Mbits/sec                  receiver
[ 15]   0.00-10.00  sec   122 MBytes   102 Mbits/sec   11            sender
[ 15]   0.00-10.01  sec   119 MBytes  99.9 Mbits/sec                  receiver
[ 17]   0.00-10.00  sec   193 MBytes   162 Mbits/sec    0            sender
[ 17]   0.00-10.01  sec   192 MBytes   161 Mbits/sec                  receiver
[ 19]   0.00-10.00  sec   124 MBytes   104 Mbits/sec   11            sender
[ 19]   0.00-10.01  sec   122 MBytes   102 Mbits/sec                  receiver
[SUM]   0.00-10.00  sec  1.05 GBytes   901 Mbits/sec  123             sender
[SUM]   0.00-10.01  sec  1.04 GBytes   891 Mbits/sec                  receiver

iperf Done.

And from the if_rge host:

               /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
Load Average   |

 Interface           Traffic               Peak                Total
      rge0  in      0.002 Mb/s        978.725 Mb/s            4.548 GB
            out     0.000 Mb/s          0.000 Mb/s            1.578 KB

For data, here is pmc while iperf3 limited to 1Gb/s in place of the expected 2.5Gb/s:

PMC: [ls_not_halted_cyc] Samples: 209521 (100.0%) , 0 unresolved

%SAMP IMAGE      FUNCTION                       CALLERS
 24.1 kernel     lock_delay                     rge_transmit_if:13.3 tcp_usr_send:6.1 tcp_usr_rcvd:4.1
  5.9 kernel     cpu_idle                       sched_idletd
  5.0 if_rge.ko  rge_rxeof                      rge_intr_msi
  3.6 if_rge.ko  rge_intr_msi                   ithread_loop
  3.4 kernel     bpf_filter                     bpf_mtap
  3.1 kernel     bus_dmamap_load_mbuf_sg        rge_fill_rx_ring
  3.1 kernel     cpu_search_highest             cpu_search_highest
  2.8 if_rge.ko  rge_txeof                      rge_intr_msi
  2.1 kernel     _epoch_enter_preempt           bpf_mtap
  2.1 if_rge.ko  rge_tx_task                    taskqueue_run_locked
  1.7 kernel     ether_nh_input                 netisr_dispatch_src
  1.6 kernel     taskqueue_run_locked           taskqueue_thread_loop
  1.6 kernel     copyout_smap_erms              uiomove_faultflag
  1.5 kernel     tcp_default_output             tcp_do_segment:0.7 tcp_output:0.6
  1.4 kernel     cpu_switch                     mi_switch
  1.3 kernel     fpu_activate_sw                cpu_switch
  1.2 kernel     sched_switch                   mi_switch
  1.1 kernel     doreti
  0.9 kernel     pmap_activate_sw               cpu_switch
  0.9 kernel     tcp_do_segment                 tcp_input_with_port
  0.9 kernel     bpf_mtap                       rge_tx_task
  0.9 kernel     sched_pickcpu                  sched_add
  0.9 kernel     copyin_smap_erms               uiomove_faultflag
  0.9 libc.so.7  bsearch                        0xaf9f
  0.8 kernel     fpurestore_xrstor3264          fpu_activate_sw
  • remove opt_platform.h (bz)
  • update locking (adrian)
  • clean up busdma stuff (adrian)
adrian added inline comments.
sys/dev/rge/if_rge_hw.c
669

It's from openbsd via what I gather is the realtek vendor driver.

Let me update the copyright for everything.

  • copyright updates (adrian, bz)
share/man/man4/rge.4
2

This hyphen was only used for a long abandoned parser that never quite worked, and should have been removed from all the style guides.

3

If you want you can just use SPDX, like is shown in style.9 or the FreeBSD license guide: https://docs.freebsd.org/en/articles/license-guide/

33

Adapter is kinda a useless word, and removing it brings the apropos listing down to 77 char to fit neatly on one line.

share/man/man4/rge.4
3

So just that and omit the rest of the copyright notice?

share/man/man4/rge.4
3

Well, it switches position to match what has been done in other SPDX only projects like Linux (I think...), so this should be precise:

.\"
.\" Copyright (c) 2025 Adrian Chadd <adrian@freebsd.org>
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.Dd December 12, 2025

  • address manpage nits, from ziaee
This revision was not accepted when it landed; it landed in state Needs Review.Mon, Dec 15, 2:00 AM
This revision was automatically updated to reflect the committed changes.