Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| stefanbethke:etherswitch [2011/12/16 15:45] – StefanBethke | stefanbethke:etherswitch [2015/08/31 07:10] (current) – add a space to make hyper link parsing work LiWenHsu | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| This page contains my ideas on how to design and implement a framework for configuring (embedded) ethernet switch controllers from %%FreeBSD%%. | This page contains my ideas on how to design and implement a framework for configuring (embedded) ethernet switch controllers from %%FreeBSD%%. | ||
| + | |||
| + | As of May 16th, this is only a slightly dated brain dump of various ideas and questions that I had during the past couple of months. I'm planning on updating this page shortly with information on the implementation that Adrian committed to -head. | ||
| + | |||
| + | In the meantime, please refer to my talk at BSDCan 2012 http:// | ||
| + | |||
| + | ---- | ||
| Many wireless router devices contain multiple Ethernet ports that are implemented by an Ethernet switch chip. These chips can often be configured in various ways. Interesting aspects include the port link parameters, VLAN settings, per-port and per-switch statistics. Newer switch chips contain hardware features for NAT, %%PPPoE%% processing, and similar advanced features. | Many wireless router devices contain multiple Ethernet ports that are implemented by an Ethernet switch chip. These chips can often be configured in various ways. Interesting aspects include the port link parameters, VLAN settings, per-port and per-switch statistics. Newer switch chips contain hardware features for NAT, %%PPPoE%% processing, and similar advanced features. | ||
| Line 51: | Line 57: | ||
| This Realtek Ethernet switch is used in the TP-LINK TL-WR1043ND. | This Realtek Ethernet switch is used in the TP-LINK TL-WR1043ND. | ||
| - | Accessing PHY registers through the switch controller over the bit-banging I2C is slow, about 2 millisecond per register | + | Accessing PHY registers through the switch controller over the bit-banging I2C is slow. The media status update routing uses the switch port status registers, resulting in a total of 3 register |
| + | |||
| + | ===== AR8x16 ===== | ||
| + | |||
| + | This family of Atheros switches is used in a number of devices, including | ||
| + | |||
| + | VLAN configuration | ||
| ====== Current Implementation ====== | ====== Current Implementation ====== | ||
| Line 70: | Line 82: | ||
| Register access over the software-implemented I2C bus is slow, accessing PHY registers even more so. In one iteration of the kernel driver, a callout ran every second to run the miitick and miipoll functions for each of the five PHYs. This took about 100 milliseconds per PHY per function, or about a second in total. | Register access over the software-implemented I2C bus is slow, accessing PHY registers even more so. In one iteration of the kernel driver, a callout ran every second to run the miitick and miipoll functions for each of the five PHYs. This took about 100 milliseconds per PHY per function, or about a second in total. | ||
| + | |||
| + | ===== MII, MDIO, and miibus ===== | ||
| + | |||
| + | In a typical Ethernet controller, there is one MAC, one MDIO master, and one or more PHYs (with MII slave and MDIO slave interfaces). | ||
| + | |||
| + | {{stefanbethke/ | ||
| + | |||
| + | For embedded systems with an Ethernet switch, the picture becomes more complicated. | ||
| + | |||
| + | {{stefanbethke/ | ||
| + | |||
| + | arge0 has it's MAC connected to PHY4; it's MDIO master is not connected. | ||
| + | |||
| + | arge1 has it's MAC connected to a MAC of the switch core (back-to-back, | ||
| + | |||
| + | The switch controller has an internal MDIO master, which is used to communicate with the PHYs. PHY0 to PHY3 are connected to their respective switch MAC via an MII each. | ||
| + | |||
| + | ==== miibus Challenge ==== | ||
| + | |||
| + | Since arge1 has a fixed connection to the switch core, a hard-coded (via hints) setup is sufficient. | ||
| + | |||
| + | With the current miibus code, this poses a number of challenges: | ||
| + | * ethernet switches that are attached via MDIO may not look like PHYs, in particular, they might not have a BMSR or ID1 and ID2. This is the case with the Atheros AR8x16 series. | ||
| + | |||
| + | * attach hierarchy and sequence, e.g. for the PHY in the switch chip, where the switch chip is attached to arge1, but the PHY needs to be at arge0. | ||
| + | |||
| + | * creating miibus' | ||