rootroot@rootroot-X99-Turbo:~/source$ ./build.sh buildroot-config
root@rk3566-buildroot:/# ethtool --version
ethtool version 5.12
root@rk3566-buildroot:/#
ethtool eth0 查看网卡参数
ethtool -s eth0 speed 100 duplex full autoneg on 强制切换百兆指令
20250326解决在荣品的PRO-RK3566核心板的buildroot系统下使用4线以太网出现IP地址169.254.1.244的问题【修改驱动程序】
2025/3/26 14:57
缘起:在荣品的PRO-RK3566核心板的buildroot系统下,使用了RTL8211F-CG这个PHY。
我司使用场景是极度要求小体积/不占用空间的情况,因此只使用了4线的以太网。
也就是将千兆网卡当百兆网卡用了。【这个年头,纯百兆的以太网卡难买了^_也犯不着费这个劲了!】
Z:\source\kernel\drivers\net\ethernet\stmicro\stmmac\stmmac_main.c
static void stmmac_validate(struct phylink_config *config,
unsigned long *supported,
struct phylink_link_state *state)
{
struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
__ETHTOOL_DECLARE_LINK_MODE_MASK(mac_supported) = { 0, };
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
int tx_cnt = priv->plat->tx_queues_to_use;
int max_speed = priv->plat->max_speed;
phylink_set(mac_supported, 10baseT_Half);
phylink_set(mac_supported, 10baseT_Full);
phylink_set(mac_supported, 100baseT_Half);
phylink_set(mac_supported, 100baseT_Full);
// phylink_set(mac_supported, 1000baseT_Half);
// phylink_set(mac_supported, 1000baseT_Full);
// phylink_set(mac_supported, 1000baseKX_Full);
phylink_set(mac_supported, 100baseT1_Full);
// phylink_set(mac_supported, 1000baseT1_Full);
phylink_set(mac_supported, Autoneg);
phylink_set(mac_supported, Pause);
phylink_set(mac_supported, Asym_Pause);
phylink_set_port_modes(mac_supported);
/* Cut down 1G if asked to */
if ((max_speed > 0) && (max_speed < 1000)) {
phylink_set(mask, 1000baseT_Full);
phylink_set(mask, 1000baseX_Full);
} else if (priv->plat->has_xgmac) {
if (!max_speed || (max_speed >= 2500)) {
phylink_set(mac_supported, 2500baseT_Full);
phylink_set(mac_supported, 2500baseX_Full);
}
if (!max_speed || (max_speed >= 5000)) {
phylink_set(mac_supported, 5000baseT_Full);
}
if (!max_speed || (max_speed >= 10000)) {
phylink_set(mac_supported, 10000baseSR_Full);
phylink_set(mac_supported, 10000baseLR_Full);
phylink_set(mac_supported, 10000baseER_Full);
phylink_set(mac_supported, 10000baseLRM_Full);
phylink_set(mac_supported, 10000baseT_Full);
phylink_set(mac_supported, 10000baseKX4_Full);
phylink_set(mac_supported, 10000baseKR_Full);
}
if (!max_speed || (max_speed >= 25000)) {
phylink_set(mac_supported, 25000baseCR_Full);
phylink_set(mac_supported, 25000baseKR_Full);
phylink_set(mac_supported, 25000baseSR_Full);
}
if (!max_speed || (max_speed >= 40000)) {
phylink_set(mac_supported, 40000baseKR4_Full);
phylink_set(mac_supported, 40000baseCR4_Full);
phylink_set(mac_supported, 40000baseSR4_Full);
phylink_set(mac_supported, 40000baseLR4_Full);
}
if (!max_speed || (max_speed >= 50000)) {
phylink_set(mac_supported, 50000baseCR2_Full);
phylink_set(mac_supported, 50000baseKR2_Full);
phylink_set(mac_supported, 50000baseSR2_Full);
phylink_set(mac_supported, 50000baseKR_Full);
phylink_set(mac_supported, 50000baseSR_Full);
phylink_set(mac_supported, 50000baseCR_Full);
phylink_set(mac_supported, 50000baseLR_ER_FR_Full);
phylink_set(mac_supported, 50000baseDR_Full);
}
if (!max_speed || (max_speed >= 100000)) {
phylink_set(mac_supported, 100000baseKR4_Full);
phylink_set(mac_supported, 100000baseSR4_Full);
phylink_set(mac_supported, 100000baseCR4_Full);
phylink_set(mac_supported, 100000baseLR4_ER4_Full);
phylink_set(mac_supported, 100000baseKR2_Full);
phylink_set(mac_supported, 100000baseSR2_Full);
phylink_set(mac_supported, 100000baseCR2_Full);
phylink_set(mac_supported, 100000baseLR2_ER2_FR2_Full);
phylink_set(mac_supported, 100000baseDR2_Full);
}
}
/* Half-Duplex can only work with single queue */
if (tx_cnt > 1) {
phylink_set(mask, 10baseT_Half);
phylink_set(mask, 100baseT_Half);
phylink_set(mask, 1000baseT_Half);
}
linkmode_and(supported, supported, mac_supported);
linkmode_andnot(supported, supported, mask);
linkmode_and(state->advertising, state->advertising, mac_supported);
linkmode_andnot(state->advertising, state->advertising, mask);
/* If PCS is supported, check which modes it supports. */
stmmac_xpcs_validate(priv, &priv->hw->xpcs_args, supported, state);
}
【荣品推荐】
Z:\source\kernel\arch\arm64\boot\dts\rockchip\rk356x\rp-gmac1-m0-pro-rk3566.dtsi
&mdio1 {
rgmii_phy1: phy@0 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0x0>;
clocks = <&cru CLK_MAC1_OUT>;
max-speed = <100>;
};
};
完整的LOG:
D:\DOCX\20250114固定softAP的地址\iperf3.18_64>iperf3 -c 192.168.3.79 -i 1 -t 10
Connecting to host 192.168.3.79, port 5201
[ 5] local 192.168.3.48 port 9511 connected to 192.168.3.79 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.01 sec 8.38 MBytes 69.8 Mbits/sec
[ 5] 1.01-2.00 sec 11.2 MBytes 94.7 Mbits/sec
[ 5] 2.00-3.00 sec 11.4 MBytes 95.6 Mbits/sec
[ 5] 3.00-4.02 sec 11.4 MBytes 94.0 Mbits/sec
[ 5] 4.02-5.01 sec 11.4 MBytes 95.7 Mbits/sec
[ 5] 5.01-6.01 sec 11.2 MBytes 94.2 Mbits/sec
[ 5] 6.01-7.01 sec 11.2 MBytes 94.7 Mbits/sec
[ 5] 7.01-8.01 sec 11.2 MBytes 94.8 Mbits/sec
[ 5] 8.01-9.00 sec 11.4 MBytes 95.6 Mbits/sec
[ 5] 9.00-10.00 sec 11.2 MBytes 94.5 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.00 sec 110 MBytes 92.4 Mbits/sec sender
[ 5] 0.00-10.02 sec 110 MBytes 91.9 Mbits/sec receiver
iperf Done.
D:\DOCX\20250114固定softAP的地址\iperf3.18_64>
xkbcommon: ERROR: couldn't find a Compose file for locale "en_US.UTF-8" (mapped to "en_US.UTF-8")
could not create XKB compose table for locale 'en_US.UTF-8'. Disabiling compose
root@rk3566-buildroot:/# xkbcommon: ERROR: couldn't find a Compose file for locale "en_US.UTF-8" (mapped to "en_US.UTF-8")
could not create XKB compose table for locale 'en_US.UTF-8'. Disabiling compose
[ 9.816324] Freeing drm_logo memory: 736K
[ 10.646661] rk_gmac-dwmac fe010000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
[ 10.646818] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 36.269578] vcc3v3_lcd0_n: disabling
[ 36.269674] vcc3v3_lcd1_n: disabling
root@rk3566-buildroot:/#
root@rk3566-buildroot:/#
root@rk3566-buildroot:/# ifconfig
dummy0 Link encap:Ethernet HWaddr 4A:CC:AB:AE:BC:C3
inet addr:169.254.99.45 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::63:6811:8d80:7d3d/64 Scope:Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:2116 (2.0 KiB)
eth0 Link encap:Ethernet HWaddr 4A:96:3C:8F:F1:C3
inet addr:192.168.3.79 Bcast:192.168.3.255 Mask:255.255.255.0
inet6 addr: fe80::6597:4b56:696a:24e1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:736 errors:0 dropped:0 overruns:0 frame:0
TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:142441 (139.1 KiB) TX bytes:3762 (3.6 KiB)
Interrupt:48
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
root@rk3566-buildroot:/#
root@rk3566-buildroot:/# uname -a
Linux rk3566-buildroot 5.10.198 #1 SMP Wed Mar 26 17:05:37 CST 2025 aarch64 GNU/Linux
root@rk3566-buildroot:/#
root@rk3566-buildroot:/# iperf3 -s
-----------------------------------------------------------
Server listening on 5201 (test #1)
-----------------------------------------------------------
Accepted connection from 192.168.3.48, port 9510
[ 5] local 192.168.3.79 port 5201 connected to 192.168.3.48 port 9511
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 7.91 MBytes 66.3 Mbits/sec
[ 5] 1.00-2.00 sec 11.3 MBytes 94.8 Mbits/sec
[ 5] 2.00-3.00 sec 11.3 MBytes 94.8 Mbits/sec
[ 5] 3.00-4.00 sec 11.3 MBytes 94.8 Mbits/sec
[ 5] 4.00-5.00 sec 11.3 MBytes 94.8 Mbits/sec
[ 5] 5.00-6.00 sec 11.3 MBytes 94.8 Mbits/sec
[ 5] 6.00-7.00 sec 11.3 MBytes 94.8 Mbits/sec
[ 5] 7.00-8.00 sec 11.3 MBytes 94.8 Mbits/sec
[ 5] 8.00-9.00 sec 11.3 MBytes 94.8 Mbits/sec
[ 5] 9.00-10.00 sec 11.3 MBytes 94.8 Mbits/sec
[ 5] 10.00-10.02 sec 130 KBytes 54.4 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.02 sec 110 MBytes 91.9 Mbits/sec receiver
-----------------------------------------------------------
Server listening on 5201 (test #2)
-----------------------------------------------------------
^Ciperf3: interrupt - the server has terminated
root@rk3566-buildroot:/#