14。イーサネットの使用法
14.1 イーサネットの概要
ArmSoM シリーズ製品は主に 2 つのイーサネット チップを使用します。
- RTL8211F-CG
- RTL8125B
14.2 RTL8211F-CG チップ
ArmSoM シリーズのArmSoM ~ AIM7 は、RTL8211F-CG ギガビット イーサネット チップを使用します。
14.2.1 ドライバー
ドライバー/ネット/イーサネット/stmicro/stmmac/*
14.2.2 DTS ノード構成
チップレベルの共通構成 kernel/arch/arm64/boot/dts/rockchip/rk3588.dtsi
完全なコード/コマンドと出力を展開します (完全なオリジナル)
gmac0: ethernet@fe1b0000 {
compatible = "rockchip,rk3588-gmac", "snps,dwmac-4.20a";
reg = <0x0 0xfe1b0000 0x0 0x10000>;
interrupts = <GIC_SPI 227 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "macirq", "eth_wake_irq";
rockchip,grf = <&sys_grf>;
rockchip,php_grf = <&php_grf>;
clocks = <&cru CLK_GMAC_125M>, <&cru CLK_GMAC_50M>,
<&cru PCLK_GMAC0>, <&cru ACLK_GMAC0>,
<&cru CLK_GMAC0_PTP_REF>;
clock-names = "stmmaceth", "clk_mac_ref",
"pclk_mac", "aclk_mac",
"ptp_ref";
resets = <&cru SRST_A_GMAC0>;
reset-names = "stmmaceth";
power-domains = <&power RK3588_PD_GMAC>;
snps,mixed-burst;
snps,tso;
snps,axi-config = <&gmac0_stmmac_axi_setup>;
snps,mtl-rx-config = <&gmac0_mtl_rx_setup>;
snps,mtl-tx-config = <&gmac0_mtl_tx_setup>;
status = "disabled";
mdio0: mdio {
compatible = "snps,dwmac-mdio";
#address-cells = <0x1>;
#size-cells = <0x0>;
};
gmac0_stmmac_axi_setup: stmmac-axi-config {
snps,wr_osr_lmt = <4>;
snps,rd_osr_lmt = <8>;
snps,blen = <0 0 0 0 16 8 4>;
};
gmac0_mtl_rx_setup: rx-queues-config {
snps,rx-queues-to-use = <1>;
queue0 {};
};
gmac0_mtl_tx_setup: tx-queues-config {
snps,tx-queues-to-use = <1>;
queue0 {};
};
};
カーネル\アーチ\アーム64\ブート\dts\rockchip\rk3588-armsom-aim7.dts
完全なコード/コマンドと出力を展開します (完全なオリジナル)
&gmac0 {
/* Use rgmii-rxid mode to disable rx delay inside Soc */
phy-mode = "rgmii-rxid";
clock_in_out = "output";
snps,reset-gpio = <&gpio2 RK_PB4 GPIO_ACTIVE_LOW>;
snps,reset-active-low;
/* Reset time is 20ms, 100ms for rtl8211f */
snps,reset-delays-us = <0 20000 100000>;
pinctrl-names = "default";
pinctrl-0 = <&gmac0_miim
&gmac0_tx_bus2
&gmac0_rx_bus2
&gmac0_rgmii_clk
&gmac0_rgmii_bus>;
tx_delay = <0x43>;
/* rx_delay = <0x3f>; */
phy-handle = <&rgmii_phy>;
status = "okay";
};
&mdio0 {
rgmii_phy: phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0x1>;
};
};
14.3 RTL8125B チップ
- ArmSoM シリーズでは、ArmSoM ~ Sige7 および ArmSoM-W3 は RTL8125B ネットワーク コントローラー チップを使用します。
- RTL8125B は、PCIE-to-RJ45 ネットワーク コントローラー チップです。低レベルのデバッグ中は、PCIE のみを構成する必要があります。
14.3.1 DTS ノード構成
- カーネル\アーチ\アーム64\ブート\dts\rockchip\rk3588-armsom-sige7.dts
&pcie2x1l0 {
reset-gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>;
rockchip,init-delay-ms = <100>;
status = "okay";
};
&pcie2x1l2 {
reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_HIGH>;
rockchip,init-delay-ms = <100>;
status = "okay";
};
14.4 イーサネットテスト
14.4.1 VIP アドレスを表示
1. ifconfig -a
2. ip addr
14.4.2 接続テスト
armsom@armsom-sige7:/$ sudo ping -c 10 www.baidu.com
PING www.a.shifen.com (183.2.172.42) 56(84) bytes of data.
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=1 ttl=52 time=8.40 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=2 ttl=52 time=8.17 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=3 ttl=52 time=7.81 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=4 ttl=52 time=8.38 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=5 ttl=52 time=10.1 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=6 ttl=52 time=8.59 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=7 ttl=52 time=8.62 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=8 ttl=52 time=8.89 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=9 ttl=52 time=8.70 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=10 ttl=52 time=8.81 ms
--- www.a.shifen.com ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9015ms
rtt min/avg/max/mdev = 7.806/8.644/10.086/0.568 ms
14.4.3 2.5G ネットワーク速度テスト
iperf は、2 台のコンピュータ間でデータを送信することによってネットワーク帯域幅を測定するネットワーク パフォーマンス テスト ツールです。この場合、armsom-w3 は iperf サーバーとして機能し、armsom-sige7 は iperf クライアントとして機能します。サーバーは指定されたポートで待機し、iperf クライアントは特定のサイズのデータ ストリームを生成し、TCP または UDP プロトコルを通じてサーバーにデータを送信します。テスト結果は次のとおりです。
- クライアント:
armsom@armsom-sige7:/$ sudo iperf -c 192.168.100.111 -t 10 -i 1
-------------------------------------------------------------
Client connecting to 192.168.100.111, TCP port 5001
TCP window size: 45.0 KByte (default)
-------------------------------------------------------------
[ 3] local 192.168.100.110 port 60564 connected with 192.168.100.111 port 5001
[ID] Interval Transfer Bandwidth
[ 3] 0.0000-1.0000 sec 275 MBytes 2.31 Gbits/sec
[ 3] 1.0000-2.0000 sec 281 MBytes 2.35 Gbits/sec
[ 3] 2.0000-3.0000 sec 278 MBytes 2.34 Gbits/sec
[ 3] 3.0000-4.0000 sec 280 MBytes 2.35 Gbits/sec
[ 3] 4.0000-5.0000 sec 279 MBytes 2.34 Gbits/sec
[ 3] 5.0000-6.0000 sec 279 MBytes 2.34 Gbits/sec
[ 3] 6.0000-7.0000 sec 276 MBytes 2.32 Gbits/sec
[ 3] 7.0000-8.0000 sec 282 MBytes 2.36 Gbits/sec
[ 3] 8.0000-9.0000 sec 279 MBytes 2.34 Gbits/sec
[ 3] 9.0000-10.0000 sec 278 MBytes 2.33 Gbits/sec
[ 3] 10.0000-10.0002 sec 256 KBytes 11.2 Gbits/sec
[ 3] 0.0000-10.0002 sec 2.72 GBytes 2.34 Gbits/sec
- サーバー:
armsom@armsom-w3:/$ iperf -s
-------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 128 KByte (default)
-------------------------------------------------------------
[ 4] local 192.168.100.111 port 5001 connected with 192.168.100.110 port 60564
[ID] Interval Transfer Bandwidth
[ 4] 0.0000-10.0045 sec 2.72 GBytes 2.34 Gbits/sec
テスト結果では、1 秒あたりの帯域幅はおおよそ 2.31 Gbits/秒と 2.36 Gbits/秒の間で変動し、最終的な平均帯域幅は 2.34 Gbits/秒になります。
