概述
参考手册:QorIQ LS1043A Data Path Acceleration Architecture (DPAA) Reference Manual
MAC/BMI/QMI寄存器组成都是由下面3个部分组成的
The full register address of any DPAA register consists of all of the following:
• CCSR window base address, specified in CCSRBAR (default address 0_0100_0000h)
• Block base address
• The specific register’s offset within that block
MAC/BMI/QMI寄存器都是FMan memory map的一部分。
针对MAC而言,每个网口,对应不同的 基地址 ,下面红框,是访问MAC寄存器要用哪个到的
从下面的Map 可以看出来,QMI 和 BMI 的基地址是一样的,就是offset 不一样
1、MAC 寄存器
MAC1 0x01A0_0000 + 0xE_0000 + offset = 0x01AE0000
MAC2 0x01A0_0000 + 0xE_2000 + offset = 0x01AE2000
MAC3 0x01A0_0000 + 0xE_4000 + offset = 0x01AE4000
MAC4 0x01A0_0000 + 0xE_6000 + offset = 0x01AE6000
MAC5 0x01A0_0000 + 0xE_8000 + offset = 0x01AE8000
MAC6 0x01A0_0000 + 0xE_A000 + offset = 0x01AEA000
然后参考手册中 6.4.2 mEMAC Detailed Memory Map ,
offset 0x100开始是Rx Statistics Counter Registers;
offset 0x200开始是Tx Statistics Counter Registers。
比如我想看下 RX ERR 相关的统计
6.4.2 mEMAC Detailed Memory Map
6.4.3.2.8 Receive Frame Error Counter Register (RERRn)
offset 0x138 0x13c
Incremented for each frame received with an error (except for undersized/fragment frame) :
• FIFO overflow error
• CRC error
• Payload length error
• Jabber and oversized error
• Alignment error (if supported)
• Reception of PHY/PCS error indication (0xFE, not a code error)
注意返回的结果是大端显示
MAC1:
# devmem 0x01AE013C 32
0x00000000
# devmem 0x01AE0138 32
0x00000000
MAC2:
# devmem 0x01AE213C 32
0x00000000
# devmem 0x01AE2138 32
0x00000000
同样的 TX 也有一个相关的统计
6.4.3.2.33 Transmit Frame Error Counter Register (TERRn)
Incremented for each frame transmitted with an error:
• FIFO overflow error
• FIFO underflow error
• memory double ECC errors
注意返回的结果是大端显示
MAC1:
# devmem 0x01AE023C 32
0x00000000
# devmem 0x01AE0238 32
0x00000000
MAC2:
# devmem 0x01AE223C 32
0x00000000
# devmem 0x01AE2238 32
0x00000000
2、BMI/QMI 寄存器
BMI/QMI rx port寄存器, 不同的MAC 对应rx_port_id 不一样,见上面的图。
0x01000000 + 0x1A00000 + 0x80000 + 0x01000* rx_port_id + offset
BMI/QMI tx port寄存器, 不同的MAC 对应tx_port_id 不一样,见上面的图。
0x1A00000 + 0x80000 + 0x01000* tx_port_id + offset
BMI Rx port寄存器请参考手册章节BMI Rx Port Registers部分,0x200开始是一些统计。
BMI Tx port寄存器请参考手册章节 BMI Tx Port Registers部分,0x200开始是一些统计。
QMI Rx port寄存器请参考手册章节 QMI Rx Port Registers部分,0x41c和0x420是一些统计。
QMI Tx port寄存器请参考手册章节 QMI Tx Port Registers部分,0x41c开始是一些统计。
3、检测脚本
big_endian_to_little()
{
byte1=`echo $1 | cut -b 3-4`
byte2=`echo $1 | cut -b 5-6`
byte3=`echo $1 | cut -b 7-8`
byte4=`echo $1 | cut -b 9-10`
echo "0x${byte4}${byte3}${byte2}${byte1}"
}
echo "Receive Frame Packet Counter Check!"
echo "[QSGMII][MAC1] Low 32bit: `big_endian_to_little $(devmem 0x01AE0120 32)`"
echo "[QSGMII][MAC2] Low 32bit: `big_endian_to_little $(devmem 0x01AE2120 32)`"
echo "[RGMII] [MAC3] Low 32bit: `big_endian_to_little $(devmem 0x01AE4120 32)`"
echo "[RGMII] [MAC4] Low 32bit: `big_endian_to_little $(devmem 0x01AE6120 32)`"
echo "[QSGMII][MAC5] Low 32bit: `big_endian_to_little $(devmem 0x01AE8120 32)`"
echo "[QSGMII][MAC6] Low 32bit: `big_endian_to_little $(devmem 0x01AEa120 32)`"
echo "Receive Frame Error Counter Check!"
echo "[QSGMII][MAC1] Low 32bit: `big_endian_to_little $(devmem 0x01AE0138 32)`"
echo "[QSGMII][MAC2] Low 32bit: `big_endian_to_little $(devmem 0x01AE2138 32)`"
echo "[RGMII] [MAC3] Low 32bit: `big_endian_to_little $(devmem 0x01AE4138 32)`"
echo "[RGMII] [MAC4] Low 32bit: `big_endian_to_little $(devmem 0x01AE6138 32)`"
echo "[QSGMII][MAC5] Low 32bit: `big_endian_to_little $(devmem 0x01AE8138 32)`"
echo "[QSGMII][MAC6] Low 32bit: `big_endian_to_little $(devmem 0x01AEa138 32)`"
echo ""
echo "Transmit Frame Packet Counter Check!"
echo "[QSGMII][MAC1] Low 32bit: `big_endian_to_little $(devmem 0x01AE0260 32)`"
echo "[QSGMII][MAC2] Low 32bit: `big_endian_to_little $(devmem 0x01AE2260 32)`"
echo "[RGMII] [MAC3] Low 32bit: `big_endian_to_little $(devmem 0x01AE4260 32)`"
echo "[RGMII] [MAC4] Low 32bit: `big_endian_to_little $(devmem 0x01AE6260 32)`"
echo "[QSGMII][MAC5] Low 32bit: `big_endian_to_little $(devmem 0x01AE8260 32)`"
echo "[QSGMII][MAC6] Low 32bit: `big_endian_to_little $(devmem 0x01AEa260 32)`"
echo "Transmit Frame Error Counter Check!"
echo "[QSGMII][MAC1] Low 32bit: `big_endian_to_little $(devmem 0x01AE0238 32)`"
echo "[QSGMII][MAC2] Low 32bit: `big_endian_to_little $(devmem 0x01AE2238 32)`"
echo "[RGMII] [MAC3] Low 32bit: `big_endian_to_little $(devmem 0x01AE4238 32)`"
echo "[RGMII] [MAC4] Low 32bit: `big_endian_to_little $(devmem 0x01AE6238 32)`"
echo "[QSGMII][MAC5] Low 32bit: `big_endian_to_little $(devmem 0x01AE8238 32)`"
echo "[QSGMII][MAC6] Low 32bit: `big_endian_to_little $(devmem 0x01AEa238 32)`"
最后
以上就是内向口红为你收集整理的LS1043A 查看 MAC、BMI、QMI寄存器, 查看网口发包丢包情况的全部内容,希望文章能够帮你解决LS1043A 查看 MAC、BMI、QMI寄存器, 查看网口发包丢包情况所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复