Add a call to dev_dstats_rx_dropped_add() in nsim_queue_free() to account for the number of packets dropped when purging the skb queue.
This improves the accuracy of RX drop statistics reported by netdevsim. Suggested-by: Jakub Kicinski <k...@kernel.org> Signed-off-by: Breno Leitao <lei...@debian.org> --- drivers/net/netdevsim/netdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index de309ff69e43e..6e8fb8922ace2 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -634,7 +634,10 @@ static struct nsim_rq *nsim_queue_alloc(void) static void nsim_queue_free(struct nsim_rq *rq) { + struct net_device *dev = rq->napi.dev; + hrtimer_cancel(&rq->napi_timer); + dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen); skb_queue_purge_reason(&rq->skb_queue, SKB_DROP_REASON_QUEUE_PURGE); kfree(rq); } -- 2.47.1