RTL8366RB

From ZS64
Jump to: navigation, search

The Realtek RTL8366RB is a 6-port Ethernet switch controller. It is used in a number of cheap wireless routers, for example the TP-LINK TL-WR1043ND. Since Realtek doesn't make data sheets publicly available anymore, it's hard to figure out how it works. While OpenWrt has a driver for configuring the chip, there's little documentation apart from the code. This page summaries what I was able to find out from reverse-engineering the OpenWrt driver.

Functional Description

The switch has five GMII ports for hooking up PHYs, plus a GMII port for talking to a CPU. Unlike the newer RTL8366S, the PHYs are external.

VLAN Support

Each port can be associated with one of 16 VLAN configuration entries. These entries determine the .1q VLAN ID (VID) as well as the .1q PCP for untagged frames.

In addition, a second table can optionally be used that has one entry per possible VLAN (4096).

VLAN Configuration Entries

VLAN Configuration Entries (VMCR)
Reg. Bits Name Description
0 15 - unused
0 14:12 PCP .1q Priority Code Point for ingress untagged frames.
0 11:0 VID .1q VLAN ID for ingress untagged frames.
1 15:14 - unused
1 13 UNTAG5 On port 5, transmit egress frames from this VLAN without .1q tag.
1 12 UNTAG4 On port 4, transmit egress frames from this VLAN without .1q tag.
1 11 UNTAG3 On port 3, transmit egress frames from this VLAN without .1q tag.
1 10 UNTAG2 On port 2, transmit egress frames from this VLAN without .1q tag.
1 9 UNTAG1 On port 1, transmit egress frames from this VLAN without .1q tag.
1 8 UNTAG0 On port 0, transmit egress frames from this VLAN without .1q tag.
1 7:6 - unused
1 5 MEMBER5 Port 5 is a member of this VLAN.
1 4 MEMBER4 Port 4 is a member of this VLAN.
1 3 MEMBER3 Port 3 is a member of this VLAN.
1 2 MEMBER2 Port 2 is a member of this VLAN.
1 1 MEMBER1 Port 1 is a member of this VLAN.
1 0 MEMBER0 Port 0 is a member of this VLAN.
2 15:3 - unused
2 2:0 FID Use this FID value to differentiate forwarding lookups.