【问题标题】:How to test tx_timeout operation of a network kernel module?如何测试网络内核模块的 tx_timeout 操作?
【发布时间】:2014-11-18 11:11:25
【问题描述】:

我对如何测试网络内核模块的操作tx_timeout 有一些疑问。 例如,让我们以 Linux Device Driver book 第 14 章中的 snull 为例。

void snull_tx_timeout (struct net_device *dev)
{
    struct snull_priv *priv = (struct snull_priv *) dev->priv;

    PDEBUG("Transmit timeout at %ld, latency %ld\n", jiffies,
                    jiffies - dev->trans_start);
    priv->status = SNULL_TX_INTR;
    snull_interrupt(0, dev, NULL);
    priv->stats.tx_errors++;
    netif_wake_queue(dev);
    return;
}

及其初始化:

#ifdef HAVE_TX_TIMEOUT
dev->tx_timeout     = snull_tx_timeout;
dev->watchdog_timeo = timeout;
#endif

如何强制超时来测试snull_tx_timeout() 的实现?

我很乐意提出任何建议。

谢谢!

【问题讨论】:

    标签: linux networking kernel driver watchdog


    【解决方案1】:

    来自 David Miller 的This email 回答了这个问题。我使用另一个网络设备驱动程序进行了测试,它运行良好。

    测试tx_timeout的方法就是这么简单。如果您不将存储在缓冲区(或队列)中的包发送到硬件本身。因此,这些包将被累积,直到缓冲区或队列填满。下一个数据包可能没有被存储(和发送),根据watchdog_timeo时间抛出超时异常。

    【讨论】:

      猜你喜欢
      • 2012-10-25
      • 2016-03-19
      • 2013-03-06
      • 1970-01-01
      • 1970-01-01
      • 2012-08-08
      • 2014-08-05
      • 1970-01-01
      • 2021-01-17
      相关资源
      最近更新 更多