【国产网卡】异常报文造成wx网卡的tx模块挂起不发包

在DPDK环境中的WX网卡遇到万兆接口在DNS reply源认证测试时停止发送包的问题。分析发现,硬件tx模块因描述符不一致而挂起,而非业务层问题。通过特定调试寄存器状态和开关可以定位类似问题。
摘要由CSDN通过智能技术生成

背景

  1. DPDK下的WX网卡万兆接口在DNS reply源认证功能测试中,出现接口不发包的现象。
  2. 通过接口DOWN->UP操作后,可恢复状态,重复步骤1操作稳定复现。

环境

kylin-4.19
DPDK19.11.14

问题分析

1.确认不发包位置

带业务的环境中,首先要确认出不发包的位置,通过DPDK调试工具定位发现,接口的上层逻辑在调用驱动发送接口正常,但在异常时,驱动反压,回弹发送数量0,排除了业务层发送问题。
通过GDB跟踪DPDK设备的发送接口txgbe_xmit_pkts(具体使用的发送接口可通过查看rte_eth_devices的设备信息获取)

txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
		uint16_t nb_pkts)
{
   
	...
	...
		/*
		 * Make sure there are enough TX descriptors available to
		 * transmit the entire packet.
		 * nb_used better be less than or equal to txq->tx_free_thresh
		 */
		if (nb_used > txq->nb_tx_free) {
   
			PMD_TX_FREE_LOG(DEBUG,
					"Not enough free TX descriptors "
					"nb_used=%4u nb_free=%4u "
					"(port=%d queue=%d)",
					nb_used, txq->nb_tx_free,
					txq->port_id, txq->queue_id);

			if (txgbe_xmit_cleanup(txq) != 0) {
   
				/* Could not clean any descriptors */
				if (nb_tx == 0)
					return 0;
				goto end_of_tx;
			}

			/* nb_used better be <= txq->tx_free_thresh */
			if (unlikely(nb_used > txq->tx_free_thresh)) {
   
				PMD_TX_FREE_LOG(DEBUG,
					"The number of descriptors needed to "
					"transmit the packet exceeds the "
					"RS bit threshold. This will impact "
					"performance."
					"nb_used=%4u nb_free=%4u "
					"tx_free_thresh=%4u. "
					"(port=%d queue=%d)",
					nb_used, txq->nb_tx_free,
					txq->tx_free_thresh,
					txq->port_id, txq->queue_id);
				/*
				 * Loop here until there are enough TX
				 * descriptors or until the ring cannot be
				 * cleaned.
				 */
				while (nb_used > txq->nb_tx_free) {
   
					if (txgbe_xmit_cleanup(txq) != 0) {
   
						/*
						 * Could not clean any
						 * descriptors
						 */
						if (nb_tx == 0)
							return 0;
						goto end_of_tx;
					}
				}
			}
		}

		/*
		 * By now there are enough free TX descriptors to transmit
		 * the packet.
		 */
		...
		...
}

发现在异常是,接口调用直接会到空闲描述符不够使用的逻辑中,并在txgbe_xmit_cleanup函数调用返回失败。

static inline int
txgbe_xmit_cleanup(struct txgbe_tx_queue *txq)
{
   
	...
	...
	if (desc_to_clean_to >= nb_tx_desc)
		desc_to_clean_to = 
  • 28
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wyh_halo

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值