How to test tx_timeout operation of a network kernel module?

1.1k views Asked by At

I'm having some doubts about how I can test the operation tx_timeout of a network kernel module. For example, lets take the snull example from chapter 14 of Linux Device Driver book.

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;
}

And its initialization:

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

How can I force a timeout to test the implementation of snull_tx_timeout() ?

I would be glad for any suggestion.

Thanks!

1

There are 1 answers

0
jcfaracco On BEST ANSWER

This email from David Miller answer this question. I tested using another network device driver and it worked very well.

The way to test tx_timeout is so simple. If you don't send the packages that are stored in a buffer (or a queue) to the hardware itself. So, those packages will be accumulated until the buffer or queue fill. The next packet may not be stored (and sent), throwing a timeout exception according watchdog_timeo time.