diff options
| author | Breno Leitao <[email protected]> | 2025-06-18 08:32:43 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-06-19 23:15:34 +0000 |
| commit | 788eb4de608bbebad237674e1057305340d653ba (patch) | |
| tree | 2b3efef816f0326ce6ca4e7f2ff091118e5ea4dd /drivers/net/netdevsim/netdev.c | |
| parent | netdevsim: migrate to dstats stats collection (diff) | |
| download | kernel-788eb4de608bbebad237674e1057305340d653ba.tar.gz kernel-788eb4de608bbebad237674e1057305340d653ba.zip | |
netdevsim: collect statistics at RX side
When the RX side of netdevsim was added, the RX statistics were missing,
making the driver unusable for GenerateTraffic() test framework.
This patch adds proper statistics tracking on RX side, complementing the
TX path.
Reviewed-by: Joe Damato <[email protected]>
Signed-off-by: Breno Leitao <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'drivers/net/netdevsim/netdev.c')
| -rw-r--r-- | drivers/net/netdevsim/netdev.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 5010d8eefc85..3ea14f5c5e0c 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -331,16 +331,24 @@ static int nsim_get_iflink(const struct net_device *dev) static int nsim_rcv(struct nsim_rq *rq, int budget) { + struct net_device *dev = rq->napi.dev; struct sk_buff *skb; - int i; + unsigned int skblen; + int i, ret; for (i = 0; i < budget; i++) { if (skb_queue_empty(&rq->skb_queue)) break; skb = skb_dequeue(&rq->skb_queue); + /* skb might be discard at netif_receive_skb, save the len */ + skblen = skb->len; skb_mark_napi_id(skb, &rq->napi); - netif_receive_skb(skb); + ret = netif_receive_skb(skb); + if (ret == NET_RX_SUCCESS) + dev_dstats_rx_add(dev, skblen); + else + dev_dstats_rx_dropped(dev); } return i; |
