Skip to content

Commit c9a1aea

Browse files
author
CKI Backport Bot
committed
netdev: add queue stat for alloc failures
JIRA: https://issues.redhat.com/browse/RHEL-57771 commit 92f8b1f Author: Jakub Kicinski <[email protected]> Date: Wed Mar 6 11:55:08 2024 -0800 netdev: add queue stat for alloc failures Rx alloc failures are commonly counted by drivers. Support reporting those via netdev-genl queue stats. Acked-by: Stanislav Fomichev <[email protected]> Reviewed-by: Amritha Nambiar <[email protected]> Reviewed-by: Xuan Zhuo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: CKI Backport Bot <[email protected]>
1 parent a5f1418 commit c9a1aea

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

Documentation/netlink/specs/netdev.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,13 @@ attribute-sets:
328328
name: tx-bytes
329329
doc: Successfully sent bytes, see `tx-packets`.
330330
type: uint
331+
-
332+
name: rx-alloc-fail
333+
doc: |
334+
Number of times skb or buffer allocation failed on the Rx datapath.
335+
Allocation failure may, or may not result in a packet drop, depending
336+
on driver implementation and whether system recovers quickly.
337+
type: uint
331338

332339
operations:
333340
list:

include/net/netdev_queues.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44

55
#include <linux/netdevice.h>
66

7+
/* See the netdev.yaml spec for definition of each statistic */
78
struct netdev_queue_stats_rx {
89
u64 bytes;
910
u64 packets;
11+
u64 alloc_fail;
1012
};
1113

1214
struct netdev_queue_stats_tx {

include/uapi/linux/netdev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ enum {
145145
NETDEV_A_QSTATS_RX_BYTES,
146146
NETDEV_A_QSTATS_TX_PACKETS,
147147
NETDEV_A_QSTATS_TX_BYTES,
148+
NETDEV_A_QSTATS_RX_ALLOC_FAIL,
148149

149150
__NETDEV_A_QSTATS_MAX,
150151
NETDEV_A_QSTATS_MAX = (__NETDEV_A_QSTATS_MAX - 1)

net/core/netdev-genl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@ static int
497497
netdev_nl_stats_write_rx(struct sk_buff *rsp, struct netdev_queue_stats_rx *rx)
498498
{
499499
if (netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_PACKETS, rx->packets) ||
500-
netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_BYTES, rx->bytes))
500+
netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_BYTES, rx->bytes) ||
501+
netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_ALLOC_FAIL, rx->alloc_fail))
501502
return -EMSGSIZE;
502503
return 0;
503504
}

tools/include/uapi/linux/netdev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ enum {
148148
NETDEV_A_QSTATS_RX_BYTES,
149149
NETDEV_A_QSTATS_TX_PACKETS,
150150
NETDEV_A_QSTATS_TX_BYTES,
151+
NETDEV_A_QSTATS_RX_ALLOC_FAIL,
151152

152153
__NETDEV_A_QSTATS_MAX,
153154
NETDEV_A_QSTATS_MAX = (__NETDEV_A_QSTATS_MAX - 1)

0 commit comments

Comments
 (0)