# PCMCIA Gigabit Ethernet Adapter



## balanga (Mar 17, 2020)

I would like to turn one of my laptops into a router so installed a PCMCIA Gigabit Ethernet Adapter into my Thinkad X61 and was amazed that it worked immediately when I booted up without me needing to add any drivers...

However it didn't work reliably... Here is some info about the device:-

```
re0@pci0:6:0:0:>class=0x020000 card=0x816910ec chip=0x816910ec rev=0x10 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTL8169 PCI Gigabit Ethernet Controller'
    class      = network
    subclass   = ethernet
```

It didn't seem very efficient and frequently switched off


```
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: icmp_seq=0 ttl=64 time=0.270 ms
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=1053.871 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=1060.188 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=1054.125 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=1060.122 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=636.009 ms
64 bytes from 192.168.1.1: icmp_seq=6 ttl=64 time=2016.903 ms
64 bytes from 192.168.1.1: icmp_seq=7 ttl=64 time=1689.028 ms
64 bytes from 192.168.1.1: icmp_seq=8 ttl=64 time=1021.137 ms
64 bytes from 192.168.1.1: icmp_seq=9 ttl=64 time=1672.745 ms
64 bytes from 192.168.1.1: icmp_seq=10 ttl=64 time=1021.113 ms
64 bytes from 192.168.1.1: icmp_seq=11 ttl=64 time=3186.135 ms
64 bytes from 192.168.1.1: icmp_seq=12 ttl=64 time=3186.132 ms
64 bytes from 192.168.1.1: icmp_seq=13 ttl=64 time=2439.048 ms
64 bytes from 192.168.1.1: icmp_seq=14 ttl=64 time=2105.685 ms
64 bytes from 192.168.1.1: icmp_seq=15 ttl=64 time=2045.146 ms
64 bytes from 192.168.1.1: icmp_seq=16 ttl=64 time=4287.463 ms
64 bytes from 192.168.1.1: icmp_seq=17 ttl=64 time=8263.021 ms

--- 192.168.1.1 ping statistics ---
20 packets transmitted, 18 packets received, 10.0% packet loss
round-trip min/avg/max/stddev = 0.270/2099.897/8263.021/1807.921 ms
```

Here is some info from dmesg:-

```
re0: <RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet> port 0x4000-0x40ff mem 0xd4000000-0xd40000ff irq 16 at device 0.0 on cardbus0
re0: Chip rev. 0x18000000
re0: MAC rev. 0x00000000
miibus0: <MII bus> on re0
rgephy0: <RTL8169S/8110S/8211 1000BASE-T media interface> PHY 1 on miibus0
rgephy0:  none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master,
re0: Using defaults for TSO: 65518/35/2048
re0: Ethernet address: 00:0a:cd:27:e4:83
re0: netmap queues/slots: TX 1/256, RX 1/256
```

Is there anything I can do to improve performance, or could it be faulty?


----------



## T-Daemon (Mar 17, 2020)

Apparently you need an external GMII [1] or TBI [2] PHY. The if_re(4) man page states for the 8169:

```
The 8169 is a 10/100/1000 MAC only, requiring a GMII or TBI external PHY.
```
Maybe sombody can explain what exactly a "external PHY" is. To my understanding it's a chip found on Ethernet cards, switches, router, etc., "_ to provide analog signal physical access to the link_."





						Physical layer - Wikipedia
					






					en.wikipedia.org
				




[1] (gigabit media independent interface)





						Media-independent interface - Wikipedia
					






					en.m.wikipedia.org
				



[2] Terabit?



balanga said:


> *miibus0: <MII bus> on re0
> rgephy0*: <RTL8169S/8110S/8211 1000BASE-T media interface> *PHY 1 on miibus0* *rgephy0*: *none*, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master


Does the PCMCIA has a integrated PHY chip, but the rgephy(4) driver does not attach?

What does pciconf -lv | grep 8169[
return?
Obviously it has attached: rgephy0

What does `ifconfig -m re0` return?


----------



## balanga (Mar 17, 2020)

T-Daemon said:


> What does `ifconfig -m re0` return?



`root@S08:~ # ifconfig -m re0`

```
re0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
    capabilities=8399b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_UCAST,WOL_MCAST,WOL_MAGIC,LINKSTATE>
    ether 00:0a:cd:27:e4:83
    media: Ethernet autoselect (10baseT/UTP <half-duplex>)
    status: no carrier
    supported media:
        media autoselect mediaopt flowcontrol
        media autoselect
        media 1000baseT mediaopt full-duplex,flowcontrol,master
        media 1000baseT mediaopt full-duplex,flowcontrol
        media 1000baseT mediaopt full-duplex,master
        media 1000baseT mediaopt full-duplex
        media 1000baseT mediaopt master
        media 1000baseT
        media 100baseTX mediaopt full-duplex,flowcontrol
        media 100baseTX mediaopt full-duplex
        media 100baseTX
        media 10baseT/UTP mediaopt full-duplex,flowcontrol
        media 10baseT/UTP mediaopt full-duplex
        media 10baseT/UTP
        media none
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
```

It isn't currently attached to the network.


----------



## SirDice (Mar 17, 2020)

Did you change the media settings? It seems to be switched to 10Mbit half-duplex.


----------



## balanga (Mar 17, 2020)

That was with the card being disconnected. This is what I get after inserting a cable:-


```
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
    capabilities=8399b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_UCAST,WOL_MCAST,WOL_MAGIC,LINKSTATE>
    ether 00:0a:cd:27:e4:83
    inet 192.168.1.71 netmask 0xffffff00 broadcast 192.168.1.255
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
    supported media:
        media autoselect mediaopt flowcontrol
        media autoselect
        media 1000baseT mediaopt full-duplex,flowcontrol,master
        media 1000baseT mediaopt full-duplex,flowcontrol
        media 1000baseT mediaopt full-duplex,master
        media 1000baseT mediaopt full-duplex
        media 1000baseT mediaopt master
        media 1000baseT
        media 100baseTX mediaopt full-duplex,flowcontrol
        media 100baseTX mediaopt full-duplex
        media 100baseTX
        media 10baseT/UTP mediaopt full-duplex,flowcontrol
        media 10baseT/UTP mediaopt full-duplex
        media 10baseT/UTP
        media none
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
```

When it is connected I can barely connect to my LAN.


----------



## T-Daemon (Mar 17, 2020)

balanga said:


> media 1000baseT mediaopt full-duplex,flowcontrol,master
> media 1000baseT mediaopt full-duplex,flowcontrol
> media 1000baseT mediaopt full-duplex,master
> media 1000baseT mediaopt full-duplex media 1000baseT mediaopt master


Try setting the flag0 for the media (manually setting media, disable autonegotiation) option for rgephy(4), see DESCRIPTION, flag0 and EXAMPLES section.


----------



## SirDice (Mar 17, 2020)

balanga said:


> That was with the card being disconnected.


Yes, but I would have expected to see "none" instead.


```
% ifconfig re0
re0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether d4:3d:7e:bc:5d:07
        media: Ethernet autoselect (none)
        status: no carrier
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
```




balanga said:


> When it is connected I can barely connect to my LAN.


You mean if you connect it your whole network suddenly has problems? If that's the case then this card is broken, throw it away.


----------



## T-Daemon (Mar 17, 2020)

SirDice said:


> balanga said:
> That was with the card being disconnected
> 
> Yes, but I would have expected to see "none" instead.
> ...


You overlooked the ifconfig(8) -m option.


balanga said:


> root@S08:~ # ifconfig -m re0


----------



## balanga (Mar 17, 2020)

What should I have in /etc/conf  regarding this card?

And if I want to PING an address, is there any way to specify which interface I want to use?


----------



## T-Daemon (Mar 18, 2020)

Is it the case what SirDice asks, that the whole network suddenly has a problem after connecting over the PCMCIA adapter?


balanga said:


> And if I want to PING an address, is there any way to specify which interface I want to use?


`ping -c20 -S 1.2.3.4 192.168.1.1` (replace 1.2.3.4 with the laptops alternative interface IP address as source for outgoing pings). For -_S_ option see ping(8).


----------



## balanga (Mar 18, 2020)

Thanks for the heads up about the -S option I'll give it a try. Never come across it before...

What I'm unsure about is what I should have in /etc/rc.conf for ifconfig_re0 wrt to flag0


----------



## SirDice (Mar 18, 2020)

SirDice said:


> You mean if you connect it your whole network suddenly has problems?


Please answer this question. If this is indeed the case no amount of fiddling with settings is going to make it magically work.


----------



## balanga (Mar 19, 2020)

It doesn't affect the network, it did ping the network intermittently albeit slowly but I've just found that my laptop is dead.

Is it possible for a dodgy PCMCIA adapter to kill the computer it is attached to? I can't believe it is simply a coincidence. It shows absolutely no signs of life


----------

