49 | | |
50 | | == ethtool/mii-tool == |
51 | | These two tools ({{{ethtool}}}/{{{mii-tool}}}) are tools used to talk to the Ethernet PHY. |
52 | | |
53 | | In general, we recommend {{{ethtool}}} because it is kept up to date. {{{mii-tool}}} is now '''deprecated''' and so we will not include it by default in our BSPs moving forward. |
54 | | |
55 | | Below are two examples getting information from the Ventana FEC Ethernet device using both {{{ethtool}}} and {{{mii-tool}}}: |
56 | | * {{{ethtool}}} |
57 | | {{{ |
58 | | #!bash |
59 | | root@OpenWrt:/# ethtool eth0 |
60 | | Settings for eth0: |
61 | | Supported ports: [ TP MII ] |
62 | | Supported link modes: 10baseT/Half 10baseT/Full |
63 | | 100baseT/Half 100baseT/Full |
64 | | 1000baseT/Full |
65 | | Supported pause frame use: Symmetric |
66 | | Supports auto-negotiation: Yes |
67 | | Advertised link modes: 10baseT/Half 10baseT/Full |
68 | | 100baseT/Half 100baseT/Full |
69 | | 1000baseT/Full |
70 | | Advertised pause frame use: Symmetric |
71 | | Advertised auto-negotiation: Yes |
72 | | Link partner advertised link modes: 10baseT/Half 10baseT/Full |
73 | | 100baseT/Half 100baseT/Full |
74 | | 1000baseT/Full |
75 | | Link partner advertised pause frame use: Symmetric Receive-only |
76 | | Link partner advertised auto-negotiation: Yes |
77 | | Speed: 1000Mb/s |
78 | | Duplex: Full |
79 | | Port: MII |
80 | | PHYAD: 0 |
81 | | Transceiver: external |
82 | | Auto-negotiation: on |
83 | | Supports Wake-on: d |
84 | | Wake-on: d |
85 | | Link detected: yes |
86 | | }}} |
87 | | |
88 | | * {{{mii-tool}}} |
89 | | {{{ |
90 | | #!bash |
91 | | root@OpenWrt:/# mii-tool eth0 |
92 | | eth0: negotiated 1000baseT-FD flow-control, link ok |
93 | | }}} |
94 | | |
95 | | [=#portconfig] |
96 | | === Setting the Ethernet Port Speed === |
97 | | For customers who would like to force a specific speed, you can use the following: |
98 | | |
99 | | * Using {{{ethtool}}} |
100 | | {{{ |
101 | | #!bash |
102 | | # In order to change link speed, you must also turn autonegotiation off |
103 | | root@OpenWrt:/# ethtool -s eth0 autoneg off speed 100 |
104 | | root@OpenWrt:/# [ 261.516832] libphy: 2188000.ethernet:00 - Link is Down |
105 | | [ 265.516787] libphy: 2188000.ethernet:00 - Link is Up - 100/Full |
106 | | }}} |
107 | | |
108 | | * Using {{{mii-tool}}} |
109 | | {{{ |
110 | | #!bash |
111 | | # Change link to 10mbps |
112 | | root@OpenWrt:/# mii-tool eth0 -F 10baseT-FD |
113 | | root@OpenWrt:/# [ 259.359135] libphy: 2188000.ethernet:00 - Link is Down |
114 | | [ 259.364390] br-lan: port 1(eth0) entered disabled state |
115 | | [ 261.359160] libphy: 2188000.ethernet:00 - Link is Up - 10/Full |
116 | | [ 261.365045] br-lan: port 1(eth0) entered forwarding state |
117 | | [ 261.370543] br-lan: port 1(eth0) entered forwarding state |
118 | | [ 263.368898] br-lan: port 1(eth0) entered forwarding state |
119 | | }}} |
120 | | |
121 | | [=#duplex] |
122 | | === Duplex === |
123 | | Most Ethernet NICs can be configured to be either full or half duplex. For information on what this means, please see [https://en.wikipedia.org/wiki/Duplex_%28telecommunications%29 this page]. |
124 | | |
125 | | * Using {{{ethtool}}} |
126 | | {{{ |
127 | | #!bash |
128 | | # To set duplex, autonegotiaion must be turned off |
129 | | root@OpenWrt:/# ethtool -s eth0 autoneg off duplex half |
130 | | root@OpenWrt:/# [ 465.514658] libphy: 2188000.ethernet:00 - Link is Down |
131 | | root@OpenWrt:/# ethtool eth0 | grep Duplex |
132 | | Duplex: Half |
133 | | }}} |
134 | | |
135 | | [=#flowcontrol] |
136 | | === Ethernet PAUSE frames for flow control (802.3x) === |
137 | | The IEEE 802.3x standard introduced Ethernet PAUSE frames which can be used at the MAC level as a mechanism of flow-control much like that used in UARTs. A transmitter can send a PAUSE frame to a receiver to tell them to stop sending for a specified period of time if they can't keep up with the data flow. |
138 | | |
139 | | This is typically only used if one end of the transmission can't keep up with the line-speed of the medium (ie a board supporting GigE that can't keep up with 1gbps). |
140 | | |
141 | | Because the Fast Ethernet Controller (FEC) integrated into the IMX6 can't perform at 1000mbps the use of PAUSE frames may be desirable in certain cases. |
142 | | |
143 | | Ethernet PAUSE frames are not supported across all the various Network Interface Controllers (NICs) used on the Ventana product line (in some cases the hardware can't support it, in others the drivers may not support it): |
144 | | * IMX6 FEC: (used as eth0 on GW51xx/GW52xx/GW53xx/GW54xx/GW55x) supports PAUSE frames (yet tx/rx must be set the same) |
145 | | * Intel i210: (used on GW5520 and GW16083) supports symmetric PAUSE frames with independent control |
146 | | * Marvell SKY2: (used as eth1 on GW54xx/GW53xx) supports PAUSE frames but no autonegotiation |
147 | | |
148 | | To configure: |
149 | | * Using {{{ethtool}}} |
150 | | {{{ |
151 | | #!bash |
152 | | # Show pause-frame status |
153 | | root@OpenWrt:/# ethtool --show-pause eth0 |
154 | | Pause parameters for eth0: |
155 | | Autonegotiate: on |
156 | | RX: off |
157 | | TX: off |
158 | | RX negotiated: on |
159 | | TX negotiated: on |
160 | | |
161 | | # Disable pause frame support |
162 | | root@OpenWrt:/# ethtool --pause eth0 autoneg off rx off tx off |
163 | | rx unmodified, ignoring |
164 | | tx unmodified, ignoring |
165 | | root@OpenWrt:/# [ 92.519412] libphy: 2188000.ethernet:00 - Link is Up - 1000/Full |
166 | | |
167 | | # Enable pause frame |
168 | | root@OpenWrt:/# ethtool --pause eth0 autoneg on # enable pause frame autoneg |
169 | | root@OpenWrt:/# [ 137.518636] libphy: 2188000.ethernet:00 - Link is Up - 1000/Full |
170 | | }}} |
171 | | |
172 | | Notes: |
173 | | * Note that FEC tx/rx pause frame support must be the same (you can't enable tx and disable rx for example) |
174 | | * If PAUSE frames are supported by the NIC/driver their default configuration is auto-negotiated. |
175 | | * If autonegotiation of PAUSE frames is enabled from a disabled state the link will go down and come back up |
176 | | |
177 | | |
178 | | See also: |
179 | | * https://en.wikipedia.org/wiki/Ethernet_flow_control |