TL-WR1043: switch

Stefan Bethke stb at lassitu.de
Mon Dec 12 20:37:40 UTC 2011


Am 11.12.2011 um 11:45 schrieb Stefan Bethke:

> Am 11.12.2011 um 01:06 schrieb Stefan Bethke:
> 
>> Am 05.12.2011 um 00:22 schrieb Stefan Bethke:
>> 
>>> Limping along…
>>> 
>>> You can find a first version of a kernel driver at
>>> http://www.lassitu.de/freebsd/rtl8366rb.c
>>> http://www.lassitu.de/freebsd/rtl8366rbvar.h
>>> 
>>> It has no external interface, but it does set up a sensible VLAN config for the TL-WR1043RB.
>> 
>> Here's a much more complete interim version:
>> http://www.lassitu.de/freebsd/etherswitch-rtl8366rb.patch
> 
> I've updated the patch to include commands to set VLAN configuration and membership.
Further update to the patch: every phy is now on it's own minibus, the PHYs received a tick every second (enabling link status changes to the console), and I've added code to query and print the current media status (more or less lifted from ifconfig).

# kldload rtl8366rb
rtl8366rb0: <RTL8366RB Ethernet Switch Controller> at addr 0xa8 on iicbus0
rtl8366rb0: rev. 3
miibus0: <MII bus> on rtl8366rb0
ukphy0: <Generic IEEE 802.3u media interface> PHY 0 on miibus0
ukphy0: OUI 0x00e04c, model 0x0016, rev. 1
ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus1: <MII bus> on rtl8366rb0
ukphy1: <Generic IEEE 802.3u media interface> PHY 1 on miibus1
ukphy1: OUI 0x00e04c, model 0x0016, rev. 1
ukphy1:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus2: <MII bus> on rtl8366rb0
ukphy2: <Generic IEEE 802.3u media interface> PHY 2 on miibus2
ukphy2: OUI 0x00e04c, model 0x0016, rev. 1
ukphy2:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus3: <MII bus> on rtl8366rb0
ukphy3: <Generic IEEE 802.3u media interface> PHY 3 on miibus3
ukphy3: OUI 0x00e04c, model 0x0016, rev. 1
ukphy3:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
miibus4: <MII bus> on rtl8366rb0
ukphy4: <Generic IEEE 802.3u media interface> PHY 4 on miibus4
ukphy4: OUI 0x00e04c, model 0x0016, rev. 1
ukphy4:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
etherswitch0: <Switch controller> on rtl8366rb0
rtl8366rb0port0: link state changed to DOWN
rtl8366rb0port1: link state changed to DOWN
rtl8366rb0port2: link state changed to DOWN
rtl8366rb0port3: link state changed to DOWN
rtl8366rb0port4: link state changed to DOWN
rtl8366rb0port0: link state changed to UP
rtl8366rb0port1: link state changed to UP

# etherswitchcfg
etherswitch0: Realtek RTL8366RB with 6 ports and 16 VLAN groups
        port0 vlangroup 1 media Ethernet autoselect (10baseT/UTP <half-duplex>) status active
        port1 vlangroup 0 media Ethernet autoselect (1000baseT <full-duplex>) status active
        port2 vlangroup 0 media Ethernet autoselect (none) status no carrier
        port3 vlangroup 0 media Ethernet autoselect (none) status no carrier
        port4 vlangroup 0 media Ethernet autoselect (none) status no carrier
        port5 vlangroup 0 media Ethernet 1000baseT <full-duplex> status active
        vlangroup0 vlan 1 members 1,2,3,4,5
        vlangroup1 vlan 2 members 0,5t


Port 0 is set to 10baseT half-duplex on the other side of the link, so this is the result of auto negotiation.  I'll add code to also set the media on the switch side soon.


Stefan

-- 
Stefan Bethke <stb at lassitu.de>   Fon +49 151 14070811





More information about the freebsd-embedded mailing list