Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Nov 2021 14:55:54 -0500
From:      Anthony Jenkins via freebsd-current <freebsd-current@freebsd.org>
To:        Warner Losh <imp@bsdimp.com>, Chuck Tuffli <ctuffli@gmail.com>
Cc:        Chris <bsd-lists@bsdforge.com>, FreeBSD-Current <freebsd-current@freebsd.org>
Subject:   Re: problem with re(4) interface
Message-ID:  <97ac9123-48fc-68f8-16cb-ebfdd96037ac@yahoo.com>
In-Reply-To: <CANCZdfpaw%2Ba33NqzSMrBz0PshsK0YJN2CtTVUiqYu9bdKLAADQ@mail.gmail.com>
References:  <CAKAYmMKOEPrr1qeS45gh9mTcrQetsChX5w4%2BiU=9TTOLSWJTCw@mail.gmail.com> <e587d339450b1e22f1ff1ce35aea2464@bsdforge.com> <CAKAYmML4Lty5MVYXYM6sS87ZLFs9Len6Di8KU3d7BCTSj-PD7Q@mail.gmail.com> <CANCZdfpaw%2Ba33NqzSMrBz0PshsK0YJN2CtTVUiqYu9bdKLAADQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On 11/22/21 12:55 PM, Warner Losh wrote:
> On Mon, Nov 22, 2021 at 10:51 AM Chuck Tuffli <ctuffli@gmail.com> wrote:
>
>> On Mon, Nov 22, 2021 at 9:34 AM Chris <bsd-lists@bsdforge.com> wrote:
>>> On 2021-11-22 08:47, Chuck Tuffli wrote:
>>>> Running on a recent-ish -current
>>>> # uname -a
>>>> FreeBSD stargate.tuffli.net 14.0-CURRENT FreeBSD 14.0-CURRENT
>>>> main-81b22a9892 GENERIC  amd64
>>>>
>>>> I'm having trouble using the second NIC interface in a bridge to
>> provide
>>>> network connectivity to bhyve VMs and need some help figuring out what
>> is
>>>> wrong.
>> ...
>>> Because there's subtle differences between them; are you using the re
>> driver
>>> from base, or from ports?
>> The driver is from base. Didn't realize there was one in ports.
>>
> The ports driver is tricky... It's an older, buggier version of the base
> driver... *BUT*
> a number of issues that aren't fixed in base are fixed in it (mostly
> dealing better with
> errata)...  Ideally, we'd pull in the actual fixes from this driver, but
> it's a huge patch-set
> where it's unclear which bits are for what thing fixed, so nobody (that I
> know of) has
> gone through and even come up with an ugly patch for -current.
>
> Warner
>
I use the Realtek BSD driver; it supports one of their newer 2.5GbE 
Ethernet chips on my motherboard.

Aug 22 19:37:29 vickie kernel: re1: <Realtek PCIe 2.5GbE Family 
Controller> port 0xc000-0xc0ff mem 
0xfc200000-0xfc20ffff,0xfc210000-0xfc213fff at device 0.0 on pci7
Aug 22 19:37:29 vickie kernel: re1: Using Memory Mapping!
Aug 22 19:37:29 vickie kernel: re1: attempting to allocate 1 MSI-X 
vectors (32 supported)
Aug 22 19:37:29 vickie kernel: msi: routing MSI-X IRQ 84 to local APIC 2 
vector 51
Aug 22 19:37:29 vickie kernel: re1: using IRQ 84 for MSI-X
Aug 22 19:37:29 vickie kernel: re1: Using 1 MSI-X message
Aug 22 19:37:29 vickie kernel: re1: version:1.96.04
Aug 22 19:37:29 vickie kernel: re1: Ethernet address: 2c:f0:5d:**:**:**
Aug 22 19:37:29 vickie kernel:
Aug 22 19:37:29 vickie kernel: This product is covered by one or more of 
the following patents:
Aug 22 19:37:29 vickie kernel: US6,570,884, US6,115,776, and US6,327,625.
Aug 22 19:37:29 vickie kernel: re1: bpf attached
Aug 22 19:37:29 vickie kernel: re1: Ethernet address: 2c:f0:5d:**:**:**

The stock re(4) driver doesn't detect it.

The Realtek driver sources are here

https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software

but they're for FreeBSD 7.x and 8.0; I had to patch the driver for my 
14.0-CURRENT  box (panic on an mtx_lock(9) call; adding flag MTX_RECURSE 
to the mtx_init(9) call "fixes" it).

diff --git a/if_rereg.h b/if_rereg.h
index 18592a7..4885063 100755
--- a/if_rereg.h
+++ b/if_rereg.h
@@ -1016,7 +1016,7 @@ enum bits {

  #define RE_LOCK(_sc)           mtx_lock(&(_sc)->mtx)
  #define RE_UNLOCK(_sc)         mtx_unlock(&(_sc)->mtx)
-#define RE_LOCK_INIT(_sc,_name) 
mtx_init(&(_sc)->mtx,_name,MTX_NETWORK_LOCK,MTX_DEF)
+#define RE_LOCK_INIT(_sc,_name) 
mtx_init(&(_sc)->mtx,_name,MTX_NETWORK_LOCK,MTX_DEF | MTX_RECURSE)
  #define RE_LOCK_DESTROY(_sc)   mtx_destroy(&(_sc)->mtx)
  #define RE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->mtx,MA_OWNED)

Maybe I can try making this into a port - oh great, someone beat me to it!

https://www.freshports.org/net/realtek-re-kmod

Looks like they "properly" fix the locking isue - 
https://bugs.freebsd.org/bugzilla/attachment.cgi?id=225980&action=diff

Anthony





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?97ac9123-48fc-68f8-16cb-ebfdd96037ac>