环境 -
处理器:Intel® Xeon® Gold 5122 CPU @ 3.60GHz 4核8线程
DPDK: v20.05
测试: 4对接口双向对打流量,报文长度1518字节。
发现有接口丢包,打印出来接口的统计信息,其中rte_eth_stats->imissed字段有数值,查看获取统计的函数i40e_dev_stats_get,可见imissed由两部分组成:
static int
i40e_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct i40e_hw_port_stats *ns = &pf->stats; /* new stats */
...
stats->oerrors = ns->eth.tx_errors +
pf->main_vsi->eth_stats.tx_errors;
/* Rx Errors */
stats->imissed = ns->eth.rx_discards +
pf->main_vsi->eth_stats.rx_discards;
其中一个是i40e_read_stats_registers函数由接口的寄存器GLPRT_RDPC中读出:
static void
i40e_read_stats_registers(struct i40e_pf *pf, struct i40e_hw *hw)
{
i40e_stat_update_32(hw, I40E_GLPRT_RDPC(hw->port),
pf->offset_loaded, &os->eth.rx_discards,
&ns->eth.rx_discards);
另外一个计数,是由函数i40e_update_vsi_stats从寄存器GLV_RDPC中读出:
/* Get all the statistics of a VSI */
void
i40e_update_vsi_stats(struct i40e_vsi *vsi)
{
struct i40e_eth_stats *oes = &vsi->eth_stats_offset;
struct i40e_eth_stats *nes = &vsi->eth_stats;
struct i40e_hw *hw = I40E_VSI_TO_HW(vsi);
...
i40e_stat_update_32(hw, I40E_GLV_RDPC(idx), vsi->offset_loaded,
&oes->rx_discards, &nes->rx_discards);
根据X710的手册,对以上两个寄存器的描述如下:
GLPRT_RDPC
32bit
Received packets from the network that are dropped in the receive packet
buffer. The packets are dropped due to possible lack of bandwidth on the PCIe
or total bandwidth of the internal data path.
可见,寄存器GLPRT_RDPC的计数,是由于PCIe带宽所限,或者网卡内部数据通路带宽所限导致的不能接收报文的统计信息。以下寄存器GLV_RDPC表示的是由于缺少描述符而不能接收的报文统计。
GLV_RDPC
32bit
Counts (per VSI) packets that were drop due to no descriptors in host queue.
经过进一步的排查,imissed中统计的数据全部是由寄存器GLV_RDPC中读出的。随后将X710的接收描述符增加到4096(支持的最大值),丢包问题还是存在。
最后将CPU更换为8核的Xeon® Gold 6244,不再丢包了。