原创 NXP iMX8M Plus 双网口性能测试

2021-6-25 15:58 2057 14 14 分类: MCU/ 嵌入式

By Toradex 胡珊逢

Verdin iMX8M Plus 是 Toradex 采用 NXP 最新的 i.MX 8M Plus 处理器的计算机模块,其具有 4x Cortex-A53 和 Cortex-M7 核心,支持神经网络加速运算的 NPUH.265 硬件编码,CAN FD ,以及双路千兆以太网。配合 Verdin 开发板,用户可以直接测试两路以太网。文章将对网络性能做简要的测试。

 

使用 Toradex Easy Installer 安装 Linux BSP v5.3.0, 默认的配置已经支持两路千兆以太网。因此安装完成重启后即可看到两个网络接口。

NXP iMX8M Plus 双网口性能测试_web618.png 

----------------------------------

root@verdin-imx8mp:~# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:14:2D:78:82:04  

          inet addr:192.168.20.120  Bcast:192.168.20.255  Mask:255.255.255.0

          inet6 addr: fe80::214:2dff:fe78:8204/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:5105505 errors:0 dropped:0 overruns:0 frame:0

          TX packets:5988237 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:7344324802 (6.8 GiB)  TX bytes:8611102924 (8.0 GiB)

          Interrupt:48

 

eth1      Link encap:Ethernet  HWaddr 00:14:2D:68:82:04  

          inet addr:192.168.200.150  Bcast:192.168.200.255  Mask:255.255.255.0

          inet6 addr: fe80::214:2dff:fe68:8204/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:6686311 errors:0 dropped:0 overruns:0 frame:0

          TX packets:247321 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:6234153398 (5.8 GiB)  TX bytes:8180651220 (7.6 GiB)

----------------------------------

 

Verdin 开发板分别和两台电脑相连,链路速度为 1000Mbps

NXP iMX8M Plus 双网口性能测试_web686.png 

I地址设置如下。

PC1:192.168.200.1

PC2:192.168.20.132

Eth0: 192.168.200.150

Eth1:192.168.20.120

 

测试场景为

Eth0和 Eth1 单独向 PC1 和 PC2 发送数据

Eth0和 Eth1同时向 PC1 和 PC2 发送数据

Eth0和 Eth1 单独接收来自 PC1 和 PC2 的数据

Eth0和 Eth1 同时接收来自 PC1 和 PC2 的数据

Eth上的数据转发到 Eth1

期间测试模块 Eth0和 Eth1 的最大带宽以及 CPU 占用率。

 

Eth0和 Eth1 单独向 PC1 和 PC2 发送数据

在 PC1 和 PC2 上运行 iperf3 服务器。

----------------------------------

$ iperf3 -s

----------------------------------

 

在 Verdin iMX8M Plus 运行 iperf向 PC 发送数据。Eth和 Eth的测试数据如下。

Eth0:

----------------------------------

root@verdin-imx8mp:~# iperf3 -c 192.168.20.132

Connecting to host 192.168.20.132, port 5201

[  5] local 192.168.20.120 port 34982 connected to 192.168.20.132 port 5201

[ ID] Interval           Transfer     Bitrate         Retr  Cwnd

[  5]   0.00-1.00   sec   114 MBytes   957 Mbits/sec    0    373 KBytes       

[  5]   1.00-2.00   sec   112 MBytes   942 Mbits/sec    0    373 KBytes       

[  5]   2.00-3.00   sec   112 MBytes   937 Mbits/sec    0    410 KBytes       

[  5]   3.00-4.00   sec   112 MBytes   942 Mbits/sec    0    410 KBytes       

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate         Retr

[  5]   0.00-10.00  sec  1.10 GBytes   942 Mbits/sec    0             sender

[  5]   0.00-10.00  sec  1.10 GBytes   941 Mbits/sec                  receiver

 

iperf Done.

----------------------------------

 

Eth1:

----------------------------------

root@verdin-imx8mp:~# iperf3 -c 192.168.200.1

Connecting to host 192.168.200.1, port 5201

[  5] local 192.168.200.150 port 59206 connected to 192.168.200.1 port 5201

[ ID] Interval           Transfer     Bitrate         Retr  Cwnd

[  5]   0.00-1.00   sec   111 MBytes   934 Mbits/sec    0   1.14 MBytes       

[  5]   1.00-2.00   sec   112 MBytes   944 Mbits/sec    0   1.23 MBytes       

[  5]   2.00-3.00   sec   111 MBytes   933 Mbits/sec    0   1.23 MBytes       

[  5]   3.00-4.00   sec   112 MBytes   943 Mbits/sec    0   1.23 MBytes       

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate         Retr

[  5]   0.00-10.00  sec  1.09 GBytes   940 Mbits/sec    0             sender

[  5]   0.00-10.00  sec  1.09 GBytes   937 Mbits/sec                  receiver

 

iperf Done.

----------------------------------

 

Verdin iMX8M Plus CPU 占用率:

NXP iMX8M Plus 双网口性能测试_web1224.png 

Eth0和 Eth1同时向 PC1 和 PC2 发送数据

Eth0

----------------------------------

root@verdin-imx8mp:~# iperf3 -c 192.168.20.132

Connecting to host 192.168.20.132, port 5201

[  5] local 192.168.20.120 port 34994 connected to 192.168.20.132 port 5201

[ ID] Interval           Transfer     Bitrate         Retr  Cwnd

[  5]   0.00-1.00   sec   113 MBytes   949 Mbits/sec    0    438 KBytes       

[  5]   1.00-2.00   sec   112 MBytes   937 Mbits/sec    0    464 KBytes       

[  5]   2.00-3.00   sec   112 MBytes   943 Mbits/sec    0    464 KBytes       

[  5]   3.00-4.00   sec   111 MBytes   935 Mbits/sec    0    464 KBytes       

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate         Retr

[  5]   0.00-10.00  sec  1.09 GBytes   940 Mbits/sec    0             sender

[  5]   0.00-10.00  sec  1.09 GBytes   939 Mbits/sec                  receiver

 

iperf Done.

----------------------------------

 

Eth1

----------------------------------

root@verdin-imx8mp:~# iperf3 -c 192.168.200.1

Connecting to host 192.168.200.1, port 5201

[  5] local 192.168.200.150 port 59210 connected to 192.168.200.1 port 5201

[ ID] Interval           Transfer     Bitrate         Retr  Cwnd

[  5]   0.00-1.00   sec   111 MBytes   929 Mbits/sec    0   1.14 MBytes       

[  5]   1.00-2.00   sec   112 MBytes   944 Mbits/sec    0   1.14 MBytes       

[  5]   2.00-3.00   sec   111 MBytes   933 Mbits/sec    0   1.14 MBytes       

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate         Retr

[  5]   0.00-10.00  sec  1.09 GBytes   936 Mbits/sec    0             sender

[  5]   0.00-10.00  sec  1.09 GBytes   933 Mbits/sec                  receiver

 

iperf Done.

----------------------------------

 

Verdin iMX8M Plus CPU 占用率:

NXP iMX8M Plus 双网口性能测试_web1353.png 

Eth0和 Eth1 单独接收来自 PC1 和 PC2 的数据

在 Verdin iMX8M Plus 分别运行 iperf服务器,针对 Eth和 Eth使用不同的端口。

----------------------------------

root@verdin-imx8mp:~# iperf3 -B 192.168.20.120 -s

root@verdin-imx8mp:~# iperf3 -B 192.168.200.150 -p 5202 -s

----------------------------------

 

Eth0

----------------------------------

root@verdin-imx8mp:~# iperf3 -B 192.168.20.120 -s

-----------------------------------------------------------

Server listening on 5201

-----------------------------------------------------------

Accepted connection from 192.168.20.132, port 48674

[  5] local 192.168.20.120 port 5201 connected to 192.168.20.132 port 48676

[ ID] Interval           Transfer     Bitrate

[  5]   0.00-1.00   sec   111 MBytes   933 Mbits/sec                  

[  5]   1.00-2.00   sec   111 MBytes   935 Mbits/sec                  

[  5]   2.00-3.00   sec   111 MBytes   934 Mbits/sec                  

[  5]   3.00-4.00   sec   111 MBytes   935 Mbits/sec                  

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate

[  5]   0.00-10.00  sec  1.09 GBytes   934 Mbits/sec                  receiver

-----------------------------------------------------------

Server listening on 5201

-----------------------------------------------------------

----------------------------------

 

Eth1

----------------------------------

root@verdin-imx8mp:~# iperf3 -B 192.168.200.150 -p 5202 -s

-----------------------------------------------------------

Server listening on 5202

-----------------------------------------------------------

Accepted connection from 192.168.200.1, port 47290

[  5] local 192.168.200.150 port 5202 connected to 192.168.200.1 port 47292

[ ID] Interval           Transfer     Bitrate

[  5]   0.00-1.00   sec   110 MBytes   919 Mbits/sec                  

[  5]   1.00-2.00   sec   112 MBytes   939 Mbits/sec                  

[  5]   2.00-3.00   sec   112 MBytes   941 Mbits/sec                  

[  5]   3.00-4.00   sec   112 MBytes   941 Mbits/sec                  

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate

[  5]   0.00-10.00  sec  1.09 GBytes   938 Mbits/sec                  receiver

----------------------------------

 

Verdin iMX8M Plus CPU 占用率:

NXP iMX8M Plus 双网口性能测试_web1574.png 

 

 

Eth0和 Eth1 同时接收来自 PC1 和 PC2 的数据

 

Eth0

----------------------------------

root@verdin-imx8mp:~# iperf3 -B 192.168.20.120 -s

-----------------------------------------------------------

Server listening on 5201

-----------------------------------------------------------

Accepted connection from 192.168.20.132, port 48712

[  5] local 192.168.20.120 port 5201 connected to 192.168.20.132 port 48714

[ ID] Interval           Transfer     Bitrate

[  5]   0.00-1.00   sec   111 MBytes   931 Mbits/sec                  

[  5]   1.00-2.00   sec   111 MBytes   934 Mbits/sec                  

[  5]   2.00-3.00   sec   111 MBytes   934 Mbits/sec                  

[  5]   3.00-4.00   sec   111 MBytes   935 Mbits/sec                  

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate

[  5]   0.00-10.00  sec  1.09 GBytes   934 Mbits/sec                  receiver

-----------------------------------------------------------

Server listening on 5201

-----------------------------------------------------------

----------------------------------

 

 

Eth1

----------------------------------

root@verdin-imx8mp:~# iperf3 -B 192.168.200.150 -p 5202 -s

-----------------------------------------------------------

Server listening on 5202

-----------------------------------------------------------

Accepted connection from 192.168.200.1, port 47308

[  5] local 192.168.200.150 port 5202 connected to 192.168.200.1 port 47310

[ ID] Interval           Transfer     Bitrate

[  5]   0.00-1.00   sec   110 MBytes   919 Mbits/sec                  

[  5]   1.00-2.00   sec   112 MBytes   941 Mbits/sec                  

[  5]   2.00-3.00   sec   112 MBytes   941 Mbits/sec                  

[  5]   3.00-4.00   sec   112 MBytes   941 Mbits/sec                  

[  5]   4.00-5.00   sec   112 MBytes   941 Mbits/sec                  

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate

[  5]   0.00-10.00  sec  1.08 GBytes   928 Mbits/sec                  receiver

-----------------------------------------------------------

Server listening on 5202

-----------------------------------------------------------

----------------------------------

 

Verdin iMX8M Plus CPU 占用率:

NXP iMX8M Plus 双网口性能测试_web1710.png 

 

 

 

Eth上的数据转发到 Eth1

为了将 Eth的数据转发到 Eth1,需要设置 /etc/sysctl.conf 

----------------------------------

# needed for routing, including masquerading or NAT

net/ipv4/ip_forward=1  

----------------------------------

 

然后运行 sysctl 另设置生效,当然重启系统也可以。

----------------------------------

root@verdin-imx8mp:~# sysctl -p

----------------------------------

 

设置转发规则。

----------------------------------

root@verdin-imx8mp:~# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

root@verdin-imx8mp:~# iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

root@verdin-imx8mp:~# iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

----------------------------------

 

在 PC2 上启动 iperf服务器,PC 1 运行 iper客户端发送数据,所有的数据由 Verdin iMX8M Plus 负责从 Eth转发到 Eth上。

 

PC2 Server:

----------------------------------

$ iperf3 -s

-----------------------------------------------------------

Server listening on 5201

-----------------------------------------------------------

Accepted connection from 192.168.20.120, port 55360

[  5] local 192.168.20.132 port 5201 connected to 192.168.20.120 port 55362

[ ID] Interval           Transfer     Bitrate

[  5]   0.00-1.00   sec   105 MBytes   881 Mbits/sec                  

[  5]   1.00-2.00   sec   111 MBytes   928 Mbits/sec                  

[  5]   2.00-3.00   sec   110 MBytes   921 Mbits/sec                  

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate

[  5]   0.00-10.00  sec  1.08 GBytes   931 Mbits/sec                  receiver

 

----------------------------------

 

 

PC1 Client:

----------------------------------

$ iperf3 -c 192.168.20.132

Connecting to host 192.168.20.132, port 5201

[  5] local 192.168.200.1 port 55362 connected to 192.168.20.132 port 5201

[ ID] Interval           Transfer     Bitrate         Retr  Cwnd

[  5]   0.00-1.00   sec   108 MBytes   904 Mbits/sec    0    471 KBytes       

[  5]   1.00-2.00   sec   110 MBytes   926 Mbits/sec    0    492 KBytes       

[  5]   2.00-3.00   sec   109 MBytes   916 Mbits/sec    0    492 KBytes       

[  5]   3.00-4.00   sec   112 MBytes   938 Mbits/sec    0    492 KBytes       

- - - - - - - - - - - - - - - - - - - - - - - - -

[ ID] Interval           Transfer     Bitrate         Retr

[  5]   0.00-10.00  sec  1.09 GBytes   934 Mbits/sec    0             sender

[  5]   0.00-10.00  sec  1.08 GBytes   931 Mbits/sec                  receiver

----------------------------------

 

Verdin iMX8M Plus CPU 占用率:

NXP iMX8M Plus 双网口性能测试_web2105.png 

 

 

数据汇总如下。

NXP iMX8M Plus 双网口性能测试_web2117.png 

两个千兆网口无论是在单独还是同时收发数据时都达到920Mbps 以上,包括网口之间的数据转发,基本接近满带宽。在 CPU 占用方面,当两个千兆网口以接近满带宽速率同时工作时,其中一个核心站占用率会超过 70%

 

 

总结

Verdin iMX8M Plus 的双网口设计为多网口需求的应用提供了理想的选择,例如在工业自动化中,一个网口运行实时性要求高的应用如 EtherCAT,而另外一个则可以用于一般的网络通信。或者另一个网口可以用作冗余接口,或者连接两个不同的网络。Verdin iMX8M Plus 还有许多其他实用的功能,我们会在后续的文章进行介绍


作者: hai.qin_651820742, 来源:面包板社区

链接: https://mbb.eet-china.com/blog/uid-me-1864768.html

版权声明:本文为博主原创,未经本人允许,禁止转载!

文章评论0条评论)

登录后参与讨论
我要评论
0
14
关闭 站长推荐上一条 /2 下一条