ZHCAES5 July   2024 DP83822H , DP83822HF , DP83822I , DP83822IF , DP83826E , DP83826I , DP83848-EP , DP83848Q-Q1 , DP83867CR , DP83867CS , DP83867E , DP83867IR , DP83867IS , DP83TC812R-Q1 , DP83TC812S-Q1 , DP83TC813R-Q1 , DP83TC813S-Q1 , DP83TC814R-Q1 , DP83TC814S-Q1 , DP83TG720R-Q1 , DP83TG720S-Q1 , DP83TG721R-Q1 , DP83TG721S-Q1

 

  1.   1
  2.   摘要
  3.   商标
  4. 1德州仪器 (TI) 以太网 PHY 驱动程序
  5. 2以太网 PHY 驱动程序概述
    1. 2.1 了解 Linux 驱动程序类型
      1. 2.1.1 U-Boot 驱动程序
      2. 2.1.2 内核驱动程序
  6. 3驱动程序集成
    1. 3.1 Linux 器件树
    2. 3.2 集成式驱动程序
  7. 4常见终端命令
    1. 4.1 初始化命令
      1. 4.1.1 dmesg | grep -i mdio
      2. 4.1.2 ifconfig
    2. 4.2 功能命令
      1. 4.2.1 Phytool
      2. 4.2.2 ethtool
      3. 4.2.3 强制执行主/从配置
    3. 4.3 诊断命令
      1. 4.3.1 SQI
      2. 4.3.2 TDR
      3. 4.3.3 吞吐量测试 - ping 和 iPerf
  8. 5总结
  9. 6参考资料

吞吐量测试 - ping 和 iPerf

吞吐量测试是指将数据从一个板发送到另一个板。可首先执行初始 ping 测试,确认可与目标通信。以下示例展示了最基本的 ping 类型,其中主机直接连接到目标。此示例不包括任何类型的交换机、集线器或路由器。

ping 示例:运行 Linux 的测试板通过以太网电缆连接到 Linux PC。

  1. 在 Linux PC 上,打开终端并运行 ifconfig 命令以查找 IPv4 地址
    1. (本例中为 169.254.132.246,标记为 inet
  2. 在测试板上,运行 ifconfig 169.254.132.250,以分配静态 IP 地址
    1. 请注意,该地址只有最后三位小数改变,才能是唯一的
      1. 称为主机 ID
    2. 地址的其余部分 (169.254.132) 必须相同
      1. 称为网络 ID
  3. 从测试板运行 ping 169.254.132.246(Linux PC 的 IP 地址)
    1. ping 开始,可通过同时按下“ctrl”和“c”停止。
下面的代码块是从测试板 ping Linux PC 时捕获的,但 ping 可以双向执行,例如 Linux PC 也可以 ping 测试板。

 ping 方框图示例图 4-1 ping 方框图示例
root@j7-evm:~# ifconfig eth0 169.254.132.250
root@j7-evm:~# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 169.254.132.250  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::3608:e1ff:fe59:5cd2  prefixlen 64  scopeid 0x20<link>
        ether 34:08:e1:59:5c:d2  txqueuelen 1000  (Ethernet)
        RX packets 133  bytes 16347 (15.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 481  bytes 117318 (114.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

root@j7-evm:~# ping 169.254.132.246
PING 169.254.132.246 (169.254.132.246): 56 data bytes
64 bytes from 169.254.132.246: seq=0 ttl=64 time=0.579 ms
64 bytes from 169.254.132.246: seq=1 ttl=64 time=0.546 ms
64 bytes from 169.254.132.246: seq=2 ttl=64 time=0.587 ms
64 bytes from 169.254.132.246: seq=3 ttl=64 time=0.557 ms
64 bytes from 169.254.132.246: seq=4 ttl=64 time=0.518 ms
64 bytes from 169.254.132.246: seq=5 ttl=64 time=0.574 ms
64 bytes from 169.254.132.246: seq=6 ttl=64 time=0.548 ms
64 bytes from 169.254.132.246: seq=7 ttl=64 time=0.561 ms
^C
--- 169.254.132.246 ping statistics ---
8 packets transmitted, 8 packets received, 0% packet loss
round-trip min/avg/max = 0.518/0.558/0.587 ms
root@j7-evm:~#

ping 成功运行后,我们可以尝试使用 iPerf(一种用于测量网络性能/带宽的开源工具)执行吞吐量测试。iPerf 需要安装在两台计算机(测试板和 Linux PC)上才能正常运行。

iPerf 示例:

  1. 在测试板上,运行命令 iperf -s 将测试板配置为服务器。
  2. 在 Linux PC 上,运行命令 iperf -c 169.254.132.250(服务器的 IP 地址),将 Linux PC 配置为客户端并连接到服务器。
下面的代码块是从测试板捕获的。这里我们可以看到已成功传输 1.09GB 数据,带宽非常接近网络端口的广播速度 (1000Mbps)。
root@j7-evm:~# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size:  128 KByte (default)
------------------------------------------------------------
[  4] local 169.254.132.250 port 5001 connected with 169.254.132.246 port 37356
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec  1.09 GBytes   933 Mbits/sec    //This step happens after the Linux PC connects as a client