# Not recognized PCI-E Network card



## goshanecr (Sep 20, 2016)

Good day!

I have PC with 3 network cards. And one of them not recognized by system.
`uname -a`

```
FreeBSD BSD-PRK 11.0-PRERELEASE FreeBSD 11.0-PRERELEASE #0 r305926: Sun Sep 18 15:22:47 NSK 2016     user@BSD-PRK:/usr/obj/usr/src/sys/BSDSERV  amd64
```
`pciconf -lv`

```
re0@pci0:1:0:0: class=0x020000 card=0x34687470 chip=0x816810ec rev=0x06 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet
re1@pci0:2:0:0: class=0x020000 card=0x81681849 chip=0x816810ec rev=0x11 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet
none3@pci0:3:0:0:       class=0x020000 card=0x34687470 chip=0x816810ff rev=0x06 hdr=0x00
    vendor     = 'NCube'
    class      = network
    subclass   = ethernet
```

`lspci -v`

```
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
        Subsystem: TP-LINK Technologies Co., Ltd. TG-3468 Gigabit PCI Express Network Adapter
        Flags: bus master, fast devsel, latency 0, IRQ 32
        I/O ports at e000
        Memory at ff600000 (64-bit, non-prefetchable)
        Memory at d0a00000 (64-bit, prefetchable)
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable+ Count=4 Masked-
        Capabilities: [d0] Vital Product Data

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 11)
        Subsystem: ASRock Incorporation Motherboard (one of many)
        Flags: bus master, fast devsel, latency 0, IRQ 36
        I/O ports at d000
        Memory at ff500000 (64-bit, non-prefetchable)
        Memory at d0900000 (64-bit, prefetchable)
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable+ Count=4 Masked-
        Capabilities: [d0] Vital Product Data

03:00.0 Ethernet controller: NCube Device 8168 (rev 06)
        Subsystem: TP-LINK Technologies Co., Ltd. Device 3468
        Flags: bus master, fast devsel, latency 0, IRQ 40
        I/O ports at c000
        Memory at ff400000 (64-bit, non-prefetchable)
        Memory at d0800000 (64-bit, prefetchable)
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
        Capabilities: [d0] Vital Product Data
```
Also order info to that PC says that this PC has 1 internal LAN + 2 identical external network card, model: *TP-LINK TG-3468* , identical it's or not I don't know.


----------



## SirDice (Sep 20, 2016)

I'm afraid you're out of luck.


----------



## goshanecr (Sep 20, 2016)

SirDice said:


> I'm afraid you're out of luck.


*SirDice*, what that mean? That problem has not solution?


----------



## SirDice (Sep 20, 2016)

I'm afraid you managed to get a system with three different network cards and all three aren't supported.


----------



## kpa (Sep 20, 2016)

Most likely none of the FreeBSD developers have gotten their hands on the card and the company (NCube the real manufacturer, not TP-Link) behind it has no interest in supporting FreeBSD either.


----------



## goshanecr (Sep 20, 2016)

I understand, but 2 cards are working with re(4) driver. Only NCube not working. But FreeBSD known as very good networking system and my experience (not very large of course) of using that system shows me that wired network card always supported, if no, supporting appears in short time.


----------



## SirDice (Sep 20, 2016)

goshanecr said:


> I understand, but 2 cards are working with re(4) driver.


Ah, I misread one of your lines as "And *n*one of them not recognized by system.".



> But FreeBSD known as very good networking system


It is but if a card isn't recognized right away it's usually not supported. 



> if no, supporting appears in short time.


Yes, but probably not in this upcoming release. Functionality is fairly finalized at this point in time, adding support for a new card would be considered "new" functionality and will most likely be postponed until the next release. Strickly speaking it will be added to -CURRENT first then, after tests, added to -STABLE which will make sure it's included in the next release (A -RELEASE is always branched from -STABLE).


----------



## YuryG (Sep 20, 2016)

I'm not sure, but may be this Thread 55861 could be a workaround. Just noticed similar numbers in your output.


----------



## goshanecr (Sep 20, 2016)

Friends, I see several times on various internet resources, solutions with non working devices, and that solutions are:
add device magic numbers to existing driver source manually and try to compile it.
As I see, these numbers for working card:

```
re0@pci0:1:0:0: class=0x020000 card=0x34687470 chip=0x816810ec rev=0x06 hdr=0x00
```
and non working

```
none3@pci0:3:0:0:       class=0x020000 card=0x34687470 chip=0x816810ff rev=0x06 hdr=0x00
```
are very closer and differs only in chip. Maybe I can try to add info to re(4) driver and try?
Just tell me in which file I must search that codes?


----------



## tobik@ (Sep 20, 2016)

Here is a patch you can try: https://gist.github.com/t6/a1a4e9035c72e5ff527e7dd591dfd20f

Apply with `cd /usr/src; patch -p1 -i ~/if_re.diff`

Since re(4) is compiled into the GENERIC kernel, you'll have to rebuild the kernel after patching.


----------



## goshanecr (Sep 21, 2016)

tobik said:


> Here is a patch you can try: https://gist.github.com/t6/a1a4e9035c72e5ff527e7dd591dfd20f
> 
> Apply with `cd /usr/src; patch -p1 -i ~/if_re.diff`
> 
> Since re(4) is compiled into the GENERIC kernel, you'll have to rebuild the kernel after patching.


Thank's *Tobik*!

Now all cards are recognized and I do simple tests with iperf. That card work in 1000Mbit mode and gives about 800Mbit/s in iperf.
Also I check all three cards, and they all works.
Is that patch can be included in -STABLE branch or only in -CURRENT and appears in 12-STABLE?


----------



## tobik@ (Sep 21, 2016)

goshanecr said:


> Also I check all three cards, and they all works.


That sounds good 


goshanecr said:


> Is that patch can be included in -STABLE branch or only in -CURRENT and appears in 12-STABLE?


I've opened PR 212876. Let's see what happens. Be sure to CC yourself and let them know that you want to have it in STABLE.


----------



## SirDice (Sep 21, 2016)

goshanecr said:


> Is that patch can be included in -STABLE branch or only in -CURRENT and appears in 12-STABLE?


There is no 12-STABLE, at least not for quite some time. At this time there's 9-STABLE (will be EoL at the end of this year), 10-STABLE and 11-STABLE.


----------



## goshanecr (Sep 21, 2016)

SirDice said:


> There is no 12-STABLE, at least not for quite some time. At this time there's 9-STABLE (will be EoL at the end of this year), 10-STABLE and 11-STABLE.


Yes *SirDice*, I know that at this time there is not exist 12-STABLE branch, I talk about future stable branch after today's -CURRENT


----------



## goshanecr (Sep 21, 2016)

tobik said:


> That sounds good
> I've opened PR 212876. Let's see what happens. Be sure to CC yourself and let them know that you want to have it in STABLE.


Thank's again, I will see that PR.


----------



## SirDice (Sep 21, 2016)

Typically new additions are added to -CURRENT first (which is 12.0-CURRENT at the moment). Once tested and approved it will be MFC'ed (_Merged From Current_) into 11-STABLE and 10-STABLE. 11.0-RELEASE has already been branched off so it can't be added there. The next 11.1-RELEASE will be branched off from 11-STABLE some time in the near future and would include the new addition.


----------



## goshanecr (Sep 21, 2016)

SirDice, now I know what means word MFC, till that your post, when I see mailing list _src-all@_, I don't know what MFC means, now I know


----------



## SirDice (Sep 21, 2016)

Yeah, you'll find a few more of those abbreviations on the mailinglists. The Glossary in the handbook can be quite helpful 

https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/freebsd-glossary.html#mfc-glossary


----------

