当前位置:网站首页>dpdk 问题分析:ice 100G 网卡 rx_packets 与 rx_bytes 统计问题
dpdk 问题分析:ice 100G 网卡 rx_packets 与 rx_bytes 统计问题
2022-04-21 06:24:00 【longyu_wlz】
问题描述
1. ipackets 减掉 imissed 统计的问题
ice 100G 网卡获取的 ipackets 会减掉 imissed 的报文,此时统计的是软件实际从网卡收包的 pps,但收包的 bps 中没有减掉这部分报文长度且硬件不能提供这部分信息用于计算,为此屏蔽 ipackets 中减掉 imissed 报文的统计以修复 pps 显示问题。
2. ibytes 每个报文减掉 crc 长度导致显示带宽变少问题
ice 100G 网卡 ibytes 统计会为每个报文减掉 crc 长度,bps 变小。
手册中的相关信息
接口收到的正确报文字节统计:

vsi 收到的正确的报文统计:

dpdk-20.11 ice 驱动代码分析
ice_stats_get 函数代码:
/* Get all statistics of a port */
static int
ice_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct ice_hw_port_stats *ns = &pf->stats; /* new stats */
/* call read registers - updates values, now write them to struct */
ice_read_stats_registers(pf, hw);
stats->ipackets = pf->main_vsi->eth_stats.rx_unicast +
pf->main_vsi->eth_stats.rx_multicast +
pf->main_vsi->eth_stats.rx_broadcast -
pf->main_vsi->eth_stats.rx_discards;
stats->opackets = ns->eth.tx_unicast +
ns->eth.tx_multicast +
ns->eth.tx_broadcast;
stats->ibytes = pf->main_vsi->eth_stats.rx_bytes;
stats->obytes = ns->eth.tx_bytes;
stats->oerrors = ns->eth.tx_errors +
pf->main_vsi->eth_stats.tx_errors;
ibytes 为输出的值,从 pf->main_vsi->eth_stats.rx_bytes 字段中获取。
ice_read_stats_registers 函数中从寄存器中读取收发包字节长度,此函数代码:
struct ice_hw_port_stats *ns = &pf->stats; /* new stats */
struct ice_hw_port_stats *os = &pf->stats_offset; /* old stats */
/* Get statistics of struct ice_eth_stats */
ice_stat_update_40(hw, GLPRT_GORCH(hw->port_info->lport),
GLPRT_GORCL(hw->port_info->lport),
pf->offset_loaded, &os->eth.rx_bytes,
&ns->eth.rx_bytes);
.........
/* Workaround: CRC size should not be included in byte statistics, * so subtract RTE_ETHER_CRC_LEN from the byte counter for each rx * packet. * Add crc len size because it's not be included in ns->eth.rx_bytes! */
/* ns->eth.rx_bytes -= (ns->eth.rx_unicast + ns->eth.rx_multicast + ns->eth.rx_broadcast) * RTE_ETHER_CRC_LEN; */
读取发包字节长度:
ice_stat_update_40(hw, GLPRT_GOTCH(hw->port_info->lport),
GLPRT_GOTCL(hw->port_info->lport),
pf->offset_loaded, &os->eth.tx_bytes,
&ns->eth.tx_bytes);
当 pf->main_vsi 存在时,调用 ice_update_vsi_stats 继续获取 vsi 的统计信息。相关代码:
static void
ice_update_vsi_stats(struct ice_vsi *vsi)
{
struct ice_eth_stats *oes = &vsi->eth_stats_offset;
struct ice_eth_stats *nes = &vsi->eth_stats;
struct ice_hw *hw = ICE_VSI_TO_HW(vsi);
int idx = rte_le_to_cpu_16(vsi->vsi_id);
ice_stat_update_40(hw, GLV_GORCH(idx), GLV_GORCL(idx),
vsi->offset_loaded, &oes->rx_bytes,
&nes->rx_bytes);
.........
vsi->old_rx_bytes = nes->rx_bytes;
/* exclude CRC bytes */
nes->rx_bytes -= (nes->rx_unicast + nes->rx_multicast +
nes->rx_broadcast) * RTE_ETHER_CRC_LEN;
ice 驱动中,ibytes 是使用 ice_update_vsi_stats 中获取的 pf->vsi->eth_stats->rx_bytes 的值,此值为每个收到的报文减掉了 crc len 长度。
解决方法
- 去掉 ipackets 减掉 rx_discards 统计的逻辑
- 将 ibytes 的数据源修改为 ns->eth.rx_bytes 并去掉为每个报文减掉 crc len 的逻辑。
版权声明
本文为[longyu_wlz]所创,转载请带上原文链接,感谢
https://blog.csdn.net/Longyu_wlz/article/details/119791696
边栏推荐
- P1586 四方定理题解
- Sakura Substring思维
- uView的Waterfall 瀑布流,实现单列,加载更多
- grub boot.S代码分析
- The jupyter notebook of win10 uses pyspark 2 3.2 error reporting problems solved
- 格式检查工具eslint
- 【LeetCode 459 】重复的子字符串
- [STM32 H7] h743 notes on address distribution of each memory block
- 云计算中网络基础知识
- Reflection cannot find the class message classnotfound of UDF when executing flinksql code
猜你喜欢

Micro Service -- service splitting strategy and principle
![[STM32 H7] h743 notes on address distribution of each memory block](/img/69/afc9be30693b9b2a64ce5b896e309f.jpg)
[STM32 H7] h743 notes on address distribution of each memory block

什么是PaaS?平台即服务介绍

MySQL Workbench cannot use clear text authentication over non-ssl connections 问题解决
![[LabVIEW] record some pits in LabVIEW project](/img/88/5556dd887d54f11bbc3afc9dfce25e.png)
[LabVIEW] record some pits in LabVIEW project

C语言版:链队的建立和基本操作

What is PAAS? Platform as a service introduction

将在CSDN中写好的文章导出为pdf格式

Notes on the use of STM32 h743 ECC memory

C#中的类型转换
随机推荐
Judge whether the resource is referenced and whether the resource is circularly referenced
yolov5的onnx模型去除transpose层
Sql中 代替not in的一种解决方式
Substring Inversion (Easy Version)
【LeetCode 350】两个数组的交集 II
MySQL Workbench cannot use clear text authentication over non-ssl connections 问题解决
What is PAAS? Platform as a service introduction
systemd如何使用/etc/init.d脚本
从 systemd-udevd 运行 log 中研究其自动加载内核模块的过程
用JS函數形式實現一個Array.prototype.forEach(),.map(),.filter()
2021年YCU蓝桥杯程序设计竞赛选拔赛题解
PowerShell - 延迟 Start-Sleep
Eal:Error reading from file descriptor 33: Input/output error
虚拟化特性介绍
Remember a MySQL slow SQL optimization
【LeetCode 67】二个进制数求和
动画—Keyframes介绍
WordPress插件-Easy WP SMTP
Reflection cannot find the class message classnotfound of UDF when executing flinksql code
WordPress修改上传文件大小限制