History

netdev: add per-queue statistics

The ethtool-nl family does a good job exposing various protocol related and IEEE/IETF statistics which used to get dumped under ethtool -S, with creative names. Queue stats don't have a netlink API, yet, and remain a lion's share of ethtool -S output for new drivers. Not only is that bad because the names differ driver to driver but it's also bug-prone. Intuitively drivers try to report only the stats for active queues, but querying ethtool stats involves multiple system calls, and the number of stats is read separately from the stats themselves. Worse still when user space asks for values of the stats, it doesn't inform the kernel how big the buffer is. If number of stats increases in the meantime kernel will overflow user buffer. Add a netlink API for dumping queue stats. Queue information is exposed via the netdev-genl family, so add the stats there. Support per-queue and sum-for-device dumps. Latter will be useful when subsequent patches add more interesting common stats than just bytes and packets. The API does not currently distinguish between HW and SW stats. The expectation is that the source of the stats will either not matter much (good packets) or be obvious (skb alloc errors).

Jakub Kicinski committed 2 years ago

Commit ab63a231 parent e8bb2cc9 files · +421 −0Browse files

Unified · Split

9 files
  1. Documentation/netlink/specs/netdev.yaml +84 −0
  2. Documentation/networking/statistics.rst +15 −0
  3. include/linux/netdevice.h +3 −0
  4. include/net/netdev_queues.h +54 −0
  5. include/uapi/linux/netdev.h +19 −0
  6. net/core/netdev-genl-gen.c +12 −0
  7. net/core/netdev-genl-gen.h +2 −0
  8. net/core/netdev-genl.c +213 −0
  9. tools/include/uapi/linux/netdev.h +19 −0
Documentation/netlink/specs/netdev.yaml+84−0
@@ -74,6 +74,10 @@ definitions: · 73 unmodified lines
74 name: queue-type74 name: queue-type
75 type: enum75 type: enum
76 entries: [ rx, tx ]76 entries: [ rx, tx ]
77 -
78 name: qstats-scope
79 type: flags
80 entries: [ queue ]
77 81
78attribute-sets:82attribute-sets:
79 -83 -
@@ -265,6 +269,66 @@ attribute-sets: · 185 unmodified lines
265 doc: ID of the NAPI instance which services this queue.269 doc: ID of the NAPI instance which services this queue.
266 type: u32270 type: u32
267 271
272 -
273 name: qstats
274 doc: |
275 Get device statistics, scoped to a device or a queue.
276 These statistics extend (and partially duplicate) statistics available
277 in struct rtnl_link_stats64.
278 Value of the `scope` attribute determines how statistics are
279 aggregated. When aggregated for the entire device the statistics
280 represent the total number of events since last explicit reset of
281 the device (i.e. not a reconfiguration like changing queue count).
282 When reported per-queue, however, the statistics may not add
283 up to the total number of events, will only be reported for currently
284 active objects, and will likely report the number of events since last
285 reconfiguration.
286 attributes:
287 -
288 name: ifindex
289 doc: ifindex of the netdevice to which stats belong.
290 type: u32
291 checks:
292 min: 1
293 -
294 name: queue-type
295 doc: Queue type as rx, tx, for queue-id.
296 type: u32
297 enum: queue-type
298 -
299 name: queue-id
300 doc: Queue ID, if stats are scoped to a single queue instance.
301 type: u32
302 -
303 name: scope
304 doc: |
305 What object type should be used to iterate over the stats.
306 type: uint
307 enum: qstats-scope
308 -
309 name: rx-packets
310 doc: |
311 Number of wire packets successfully received and passed to the stack.
312 For drivers supporting XDP, XDP is considered the first layer
313 of the stack, so packets consumed by XDP are still counted here.
314 type: uint
315 value: 8 # reserve some attr ids in case we need more metadata later
316 -
317 name: rx-bytes
318 doc: Successfully received bytes, see `rx-packets`.
319 type: uint
320 -
321 name: tx-packets
322 doc: |
323 Number of wire packets successfully sent. Packet is considered to be
324 successfully sent once it is in device memory (usually this means
325 the device has issued a DMA completion for the packet).
326 type: uint
327 -
328 name: tx-bytes
329 doc: Successfully sent bytes, see `tx-packets`.
330 type: uint
331
268operations:332operations:
269 list:333 list:
270 -334 -
@@ -405,6 +469,26 @@ operations: · 134 unmodified lines
405 attributes:469 attributes:
406 - ifindex470 - ifindex
407 reply: *napi-get-op471 reply: *napi-get-op
472 -
473 name: qstats-get
474 doc: |
475 Get / dump fine grained statistics. Which statistics are reported
476 depends on the device and the driver, and whether the driver stores
477 software counters per-queue.
478 attribute-set: qstats
479 dump:
480 request:
481 attributes:
482 - scope
483 reply:
484 attributes:
485 - ifindex
486 - queue-type
487 - queue-id
488 - rx-packets
489 - rx-bytes
490 - tx-packets
491 - tx-bytes
408 492
409mcast-groups:493mcast-groups:
410 list:494 list:
Documentation/networking/statistics.rst+15−0
@@ -41,6 +41,15 @@ If `-s` is specified once the detailed errors won't be shown. · 40 unmodified lines
41 41
42`ip` supports JSON formatting via the `-j` option.42`ip` supports JSON formatting via the `-j` option.
43 43
44Queue statistics
45~~~~~~~~~~~~~~~~
46
47Queue statistics are accessible via the netdev netlink family.
48
49Currently no widely distributed CLI exists to access those statistics.
50Kernel development tools (ynl) can be used to experiment with them,
51see `Documentation/userspace-api/netlink/intro-specs.rst`.
52
44Protocol-specific statistics53Protocol-specific statistics
45----------------------------54----------------------------
46 55
@@ -147,6 +156,12 @@ Statistics are reported both in the responses to link information · 100 unmodified lines
147requests (`RTM_GETLINK`) and statistic requests (`RTM_GETSTATS`,156requests (`RTM_GETLINK`) and statistic requests (`RTM_GETSTATS`,
148when `IFLA_STATS_LINK_64` bit is set in the `.filter_mask` of the request).157when `IFLA_STATS_LINK_64` bit is set in the `.filter_mask` of the request).
149 158
159netdev (netlink)
160~~~~~~~~~~~~~~~~
161
162`netdev` generic netlink family allows accessing page pool and per queue
163statistics.
164
150ethtool165ethtool
151-------166-------
152 167
include/linux/netdevice.h+3−0
@@ -1955,6 +1955,7 @@ enum netdev_reg_state { · 1954 unmodified lines
1955 *1955 *
1956 * @sysfs_rx_queue_group: Space for optional per-rx queue attributes1956 * @sysfs_rx_queue_group: Space for optional per-rx queue attributes
1957 * @rtnl_link_ops: Rtnl_link_ops1957 * @rtnl_link_ops: Rtnl_link_ops
1958 * @stat_ops: Optional ops for queue-aware statistics
1958 *1959 *
1959 * @gso_max_size: Maximum size of generic segmentation offload1960 * @gso_max_size: Maximum size of generic segmentation offload
1960 * @tso_max_size: Device (as in HW) limit on the max TSO request size1961 * @tso_max_size: Device (as in HW) limit on the max TSO request size
@@ -2335,6 +2336,8 @@ struct net_device { · 374 unmodified lines
2335 2336
2336 const struct rtnl_link_ops *rtnl_link_ops;2337 const struct rtnl_link_ops *rtnl_link_ops;
2337 2338
2339 const struct netdev_stat_ops *stat_ops;
2340
2338 /* for setting kernel sock attribute on TCP connection setup */2341 /* for setting kernel sock attribute on TCP connection setup */
2339#define GSO_MAX_SEGS 65535u2342#define GSO_MAX_SEGS 65535u
2340#define GSO_LEGACY_MAX_SIZE 65536u2343#define GSO_LEGACY_MAX_SIZE 65536u
include/net/netdev_queues.h+54−0
@@ -4,6 +4,60 @@ · 3 unmodified lines
4 4
5#include <linux/netdevice.h>5#include <linux/netdevice.h>
6 6
7struct netdev_queue_stats_rx {
8 u64 bytes;
9 u64 packets;
10};
11
12struct netdev_queue_stats_tx {
13 u64 bytes;
14 u64 packets;
15};
16
17/**
18 * struct netdev_stat_ops - netdev ops for fine grained stats
19 * @get_queue_stats_rx: get stats for a given Rx queue
20 * @get_queue_stats_tx: get stats for a given Tx queue
21 * @get_base_stats: get base stats (not belonging to any live instance)
22 *
23 * Query stats for a given object. The values of the statistics are undefined
24 * on entry (specifically they are *not* zero-initialized). Drivers should
25 * assign values only to the statistics they collect. Statistics which are not
26 * collected must be left undefined.
27 *
28 * Queue objects are not necessarily persistent, and only currently active
29 * queues are queried by the per-queue callbacks. This means that per-queue
30 * statistics will not generally add up to the total number of events for
31 * the device. The @get_base_stats callback allows filling in the delta
32 * between events for currently live queues and overall device history.
33 * When the statistics for the entire device are queried, first @get_base_stats
34 * is issued to collect the delta, and then a series of per-queue callbacks.
35 * Only statistics which are set in @get_base_stats will be reported
36 * at the device level, meaning that unlike in queue callbacks, setting
37 * a statistic to zero in @get_base_stats is a legitimate thing to do.
38 * This is because @get_base_stats has a second function of designating which
39 * statistics are in fact correct for the entire device (e.g. when history
40 * for some of the events is not maintained, and reliable "total" cannot
41 * be provided).
42 *
43 * Device drivers can assume that when collecting total device stats,
44 * the @get_base_stats and subsequent per-queue calls are performed
45 * "atomically" (without releasing the rtnl_lock).
46 *
47 * Device drivers are encouraged to reset the per-queue statistics when
48 * number of queues change. This is because the primary use case for
49 * per-queue statistics is currently to detect traffic imbalance.
50 */
51struct netdev_stat_ops {
52 void (*get_queue_stats_rx)(struct net_device *dev, int idx,
53 struct netdev_queue_stats_rx *stats);
54 void (*get_queue_stats_tx)(struct net_device *dev, int idx,
55 struct netdev_queue_stats_tx *stats);
56 void (*get_base_stats)(struct net_device *dev,
57 struct netdev_queue_stats_rx *rx,
58 struct netdev_queue_stats_tx *tx);
59};
60
7/**61/**
8 * DOC: Lockless queue stopping / waking helpers.62 * DOC: Lockless queue stopping / waking helpers.
9 *63 *
include/uapi/linux/netdev.h+19−0
@@ -70,6 +70,10 @@ enum netdev_queue_type { · 69 unmodified lines
70 NETDEV_QUEUE_TYPE_TX,70 NETDEV_QUEUE_TYPE_TX,
71};71};
72 72
73enum netdev_qstats_scope {
74 NETDEV_QSTATS_SCOPE_QUEUE = 1,
75};
76
73enum {77enum {
74 NETDEV_A_DEV_IFINDEX = 1,78 NETDEV_A_DEV_IFINDEX = 1,
75 NETDEV_A_DEV_PAD,79 NETDEV_A_DEV_PAD,
@@ -132,6 +136,20 @@ enum { · 56 unmodified lines
132 NETDEV_A_QUEUE_MAX = (__NETDEV_A_QUEUE_MAX - 1)136 NETDEV_A_QUEUE_MAX = (__NETDEV_A_QUEUE_MAX - 1)
133};137};
134 138
139enum {
140 NETDEV_A_QSTATS_IFINDEX = 1,
141 NETDEV_A_QSTATS_QUEUE_TYPE,
142 NETDEV_A_QSTATS_QUEUE_ID,
143 NETDEV_A_QSTATS_SCOPE,
144 NETDEV_A_QSTATS_RX_PACKETS = 8,
145 NETDEV_A_QSTATS_RX_BYTES,
146 NETDEV_A_QSTATS_TX_PACKETS,
147 NETDEV_A_QSTATS_TX_BYTES,
148
149 __NETDEV_A_QSTATS_MAX,
150 NETDEV_A_QSTATS_MAX = (__NETDEV_A_QSTATS_MAX - 1)
151};
152
135enum {153enum {
136 NETDEV_CMD_DEV_GET = 1,154 NETDEV_CMD_DEV_GET = 1,
137 NETDEV_CMD_DEV_ADD_NTF,155 NETDEV_CMD_DEV_ADD_NTF,
@@ -144,6 +162,7 @@ enum { · 6 unmodified lines
144 NETDEV_CMD_PAGE_POOL_STATS_GET,162 NETDEV_CMD_PAGE_POOL_STATS_GET,
145 NETDEV_CMD_QUEUE_GET,163 NETDEV_CMD_QUEUE_GET,
146 NETDEV_CMD_NAPI_GET,164 NETDEV_CMD_NAPI_GET,
165 NETDEV_CMD_QSTATS_GET,
147 166
148 __NETDEV_CMD_MAX,167 __NETDEV_CMD_MAX,
149 NETDEV_CMD_MAX = (__NETDEV_CMD_MAX - 1)168 NETDEV_CMD_MAX = (__NETDEV_CMD_MAX - 1)
net/core/netdev-genl-gen.c+12−0
@@ -68,6 +68,11 @@ static const struct nla_policy netdev_napi_get_dump_nl_policy[NETDEV_A_NAPI_IFIN · 67 unmodified lines
68 [NETDEV_A_NAPI_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1),68 [NETDEV_A_NAPI_IFINDEX] = NLA_POLICY_MIN(NLA_U32, 1),
69};69};
70 70
71/* NETDEV_CMD_QSTATS_GET - dump */
72static const struct nla_policy netdev_qstats_get_nl_policy[NETDEV_A_QSTATS_SCOPE + 1] = {
73 [NETDEV_A_QSTATS_SCOPE] = NLA_POLICY_MASK(NLA_UINT, 0x1),
74};
75
71/* Ops table for netdev */76/* Ops table for netdev */
72static const struct genl_split_ops netdev_nl_ops[] = {77static const struct genl_split_ops netdev_nl_ops[] = {
73 {78 {
@@ -138,6 +143,13 @@ static const struct genl_split_ops netdev_nl_ops[] = { · 64 unmodified lines
138 .maxattr = NETDEV_A_NAPI_IFINDEX,143 .maxattr = NETDEV_A_NAPI_IFINDEX,
139 .flags = GENL_CMD_CAP_DUMP,144 .flags = GENL_CMD_CAP_DUMP,
140 },145 },
146 {
147 .cmd = NETDEV_CMD_QSTATS_GET,
148 .dumpit = netdev_nl_qstats_get_dumpit,
149 .policy = netdev_qstats_get_nl_policy,
150 .maxattr = NETDEV_A_QSTATS_SCOPE,
151 .flags = GENL_CMD_CAP_DUMP,
152 },
141};153};
142 154
143static const struct genl_multicast_group netdev_nl_mcgrps[] = {155static const struct genl_multicast_group netdev_nl_mcgrps[] = {
net/core/netdev-genl-gen.h+2−0
@@ -28,6 +28,8 @@ int netdev_nl_queue_get_dumpit(struct sk_buff *skb, · 27 unmodified lines
28 struct netlink_callback *cb);28 struct netlink_callback *cb);
29int netdev_nl_napi_get_doit(struct sk_buff *skb, struct genl_info *info);29int netdev_nl_napi_get_doit(struct sk_buff *skb, struct genl_info *info);
30int netdev_nl_napi_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb);30int netdev_nl_napi_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb);
31int netdev_nl_qstats_get_dumpit(struct sk_buff *skb,
32 struct netlink_callback *cb);
31 33
32enum {34enum {
33 NETDEV_NLGRP_MGMT,35 NETDEV_NLGRP_MGMT,
net/core/netdev-genl.c+213−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
8#include <net/xdp.h>8#include <net/xdp.h>
9#include <net/xdp_sock.h>9#include <net/xdp_sock.h>
10#include <net/netdev_rx_queue.h>10#include <net/netdev_rx_queue.h>
11#include <net/netdev_queues.h>
11#include <net/busy_poll.h>12#include <net/busy_poll.h>
12 13
13#include "netdev-genl-gen.h"14#include "netdev-genl-gen.h"
@@ -460,6 +461,218 @@ int netdev_nl_queue_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb) · 446 unmodified lines
460 return err;461 return err;
461}462}
462 463
464#define NETDEV_STAT_NOT_SET (~0ULL)
465
466static void netdev_nl_stats_add(void *_sum, const void *_add, size_t size)
467{
468 const u64 *add = _add;
469 u64 *sum = _sum;
470
471 while (size) {
472 if (*add != NETDEV_STAT_NOT_SET && *sum != NETDEV_STAT_NOT_SET)
473 *sum += *add;
474 sum++;
475 add++;
476 size -= 8;
477 }
478}
479
480static int netdev_stat_put(struct sk_buff *rsp, unsigned int attr_id, u64 value)
481{
482 if (value == NETDEV_STAT_NOT_SET)
483 return 0;
484 return nla_put_uint(rsp, attr_id, value);
485}
486
487static int
488netdev_nl_stats_write_rx(struct sk_buff *rsp, struct netdev_queue_stats_rx *rx)
489{
490 if (netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_PACKETS, rx->packets) ||
491 netdev_stat_put(rsp, NETDEV_A_QSTATS_RX_BYTES, rx->bytes))
492 return -EMSGSIZE;
493 return 0;
494}
495
496static int
497netdev_nl_stats_write_tx(struct sk_buff *rsp, struct netdev_queue_stats_tx *tx)
498{
499 if (netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_PACKETS, tx->packets) ||
500 netdev_stat_put(rsp, NETDEV_A_QSTATS_TX_BYTES, tx->bytes))
501 return -EMSGSIZE;
502 return 0;
503}
504
505static int
506netdev_nl_stats_queue(struct net_device *netdev, struct sk_buff *rsp,
507 u32 q_type, int i, const struct genl_info *info)
508{
509 const struct netdev_stat_ops *ops = netdev->stat_ops;
510 struct netdev_queue_stats_rx rx;
511 struct netdev_queue_stats_tx tx;
512 void *hdr;
513
514 hdr = genlmsg_iput(rsp, info);
515 if (!hdr)
516 return -EMSGSIZE;
517 if (nla_put_u32(rsp, NETDEV_A_QSTATS_IFINDEX, netdev->ifindex) ||
518 nla_put_u32(rsp, NETDEV_A_QSTATS_QUEUE_TYPE, q_type) ||
519 nla_put_u32(rsp, NETDEV_A_QSTATS_QUEUE_ID, i))
520 goto nla_put_failure;
521
522 switch (q_type) {
523 case NETDEV_QUEUE_TYPE_RX:
524 memset(&rx, 0xff, sizeof(rx));
525 ops->get_queue_stats_rx(netdev, i, &rx);
526 if (!memchr_inv(&rx, 0xff, sizeof(rx)))
527 goto nla_cancel;
528 if (netdev_nl_stats_write_rx(rsp, &rx))
529 goto nla_put_failure;
530 break;
531 case NETDEV_QUEUE_TYPE_TX:
532 memset(&tx, 0xff, sizeof(tx));
533 ops->get_queue_stats_tx(netdev, i, &tx);
534 if (!memchr_inv(&tx, 0xff, sizeof(tx)))
535 goto nla_cancel;
536 if (netdev_nl_stats_write_tx(rsp, &tx))
537 goto nla_put_failure;
538 break;
539 }
540
541 genlmsg_end(rsp, hdr);
542 return 0;
543
544nla_cancel:
545 genlmsg_cancel(rsp, hdr);
546 return 0;
547nla_put_failure:
548 genlmsg_cancel(rsp, hdr);
549 return -EMSGSIZE;
550}
551
552static int
553netdev_nl_stats_by_queue(struct net_device *netdev, struct sk_buff *rsp,
554 const struct genl_info *info,
555 struct netdev_nl_dump_ctx *ctx)
556{
557 const struct netdev_stat_ops *ops = netdev->stat_ops;
558 int i, err;
559
560 if (!(netdev->flags & IFF_UP))
561 return 0;
562
563 i = ctx->rxq_idx;
564 while (ops->get_queue_stats_rx && i < netdev->real_num_rx_queues) {
565 err = netdev_nl_stats_queue(netdev, rsp, NETDEV_QUEUE_TYPE_RX,
566 i, info);
567 if (err)
568 return err;
569 ctx->rxq_idx = i++;
570 }
571 i = ctx->txq_idx;
572 while (ops->get_queue_stats_tx && i < netdev->real_num_tx_queues) {
573 err = netdev_nl_stats_queue(netdev, rsp, NETDEV_QUEUE_TYPE_TX,
574 i, info);
575 if (err)
576 return err;
577 ctx->txq_idx = i++;
578 }
579
580 ctx->rxq_idx = 0;
581 ctx->txq_idx = 0;
582 return 0;
583}
584
585static int
586netdev_nl_stats_by_netdev(struct net_device *netdev, struct sk_buff *rsp,
587 const struct genl_info *info)
588{
589 struct netdev_queue_stats_rx rx_sum, rx;
590 struct netdev_queue_stats_tx tx_sum, tx;
591 const struct netdev_stat_ops *ops;
592 void *hdr;
593 int i;
594
595 ops = netdev->stat_ops;
596 /* Netdev can't guarantee any complete counters */
597 if (!ops->get_base_stats)
598 return 0;
599
600 memset(&rx_sum, 0xff, sizeof(rx_sum));
601 memset(&tx_sum, 0xff, sizeof(tx_sum));
602
603 ops->get_base_stats(netdev, &rx_sum, &tx_sum);
604
605 /* The op was there, but nothing reported, don't bother */
606 if (!memchr_inv(&rx_sum, 0xff, sizeof(rx_sum)) &&
607 !memchr_inv(&tx_sum, 0xff, sizeof(tx_sum)))
608 return 0;
609
610 hdr = genlmsg_iput(rsp, info);
611 if (!hdr)
612 return -EMSGSIZE;
613 if (nla_put_u32(rsp, NETDEV_A_QSTATS_IFINDEX, netdev->ifindex))
614 goto nla_put_failure;
615
616 for (i = 0; i < netdev->real_num_rx_queues; i++) {
617 memset(&rx, 0xff, sizeof(rx));
618 if (ops->get_queue_stats_rx)
619 ops->get_queue_stats_rx(netdev, i, &rx);
620 netdev_nl_stats_add(&rx_sum, &rx, sizeof(rx));
621 }
622 for (i = 0; i < netdev->real_num_tx_queues; i++) {
623 memset(&tx, 0xff, sizeof(tx));
624 if (ops->get_queue_stats_tx)
625 ops->get_queue_stats_tx(netdev, i, &tx);
626 netdev_nl_stats_add(&tx_sum, &tx, sizeof(tx));
627 }
628
629 if (netdev_nl_stats_write_rx(rsp, &rx_sum) ||
630 netdev_nl_stats_write_tx(rsp, &tx_sum))
631 goto nla_put_failure;
632
633 genlmsg_end(rsp, hdr);
634 return 0;
635
636nla_put_failure:
637 genlmsg_cancel(rsp, hdr);
638 return -EMSGSIZE;
639}
640
641int netdev_nl_qstats_get_dumpit(struct sk_buff *skb,
642 struct netlink_callback *cb)
643{
644 struct netdev_nl_dump_ctx *ctx = netdev_dump_ctx(cb);
645 const struct genl_info *info = genl_info_dump(cb);
646 struct net *net = sock_net(skb->sk);
647 struct net_device *netdev;
648 unsigned int scope;
649 int err = 0;
650
651 scope = 0;
652 if (info->attrs[NETDEV_A_QSTATS_SCOPE])
653 scope = nla_get_uint(info->attrs[NETDEV_A_QSTATS_SCOPE]);
654
655 rtnl_lock();
656 for_each_netdev_dump(net, netdev, ctx->ifindex) {
657 if (!netdev->stat_ops)
658 continue;
659
660 switch (scope) {
661 case 0:
662 err = netdev_nl_stats_by_netdev(netdev, skb, info);
663 break;
664 case NETDEV_QSTATS_SCOPE_QUEUE:
665 err = netdev_nl_stats_by_queue(netdev, skb, info, ctx);
666 break;
667 }
668 if (err < 0)
669 break;
670 }
671 rtnl_unlock();
672
673 return err;
674}
675
463static int netdev_genl_netdevice_event(struct notifier_block *nb,676static int netdev_genl_netdevice_event(struct notifier_block *nb,
464 unsigned long event, void *ptr)677 unsigned long event, void *ptr)
465{678{
tools/include/uapi/linux/netdev.h+19−0
@@ -70,6 +70,10 @@ enum netdev_queue_type { · 69 unmodified lines
70 NETDEV_QUEUE_TYPE_TX,70 NETDEV_QUEUE_TYPE_TX,
71};71};
72 72
73enum netdev_qstats_scope {
74 NETDEV_QSTATS_SCOPE_QUEUE = 1,
75};
76
73enum {77enum {
74 NETDEV_A_DEV_IFINDEX = 1,78 NETDEV_A_DEV_IFINDEX = 1,
75 NETDEV_A_DEV_PAD,79 NETDEV_A_DEV_PAD,
@@ -132,6 +136,20 @@ enum { · 56 unmodified lines
132 NETDEV_A_QUEUE_MAX = (__NETDEV_A_QUEUE_MAX - 1)136 NETDEV_A_QUEUE_MAX = (__NETDEV_A_QUEUE_MAX - 1)
133};137};
134 138
139enum {
140 NETDEV_A_QSTATS_IFINDEX = 1,
141 NETDEV_A_QSTATS_QUEUE_TYPE,
142 NETDEV_A_QSTATS_QUEUE_ID,
143 NETDEV_A_QSTATS_SCOPE,
144 NETDEV_A_QSTATS_RX_PACKETS = 8,
145 NETDEV_A_QSTATS_RX_BYTES,
146 NETDEV_A_QSTATS_TX_PACKETS,
147 NETDEV_A_QSTATS_TX_BYTES,
148
149 __NETDEV_A_QSTATS_MAX,
150 NETDEV_A_QSTATS_MAX = (__NETDEV_A_QSTATS_MAX - 1)
151};
152
135enum {153enum {
136 NETDEV_CMD_DEV_GET = 1,154 NETDEV_CMD_DEV_GET = 1,
137 NETDEV_CMD_DEV_ADD_NTF,155 NETDEV_CMD_DEV_ADD_NTF,
@@ -144,6 +162,7 @@ enum { · 6 unmodified lines
144 NETDEV_CMD_PAGE_POOL_STATS_GET,162 NETDEV_CMD_PAGE_POOL_STATS_GET,
145 NETDEV_CMD_QUEUE_GET,163 NETDEV_CMD_QUEUE_GET,
146 NETDEV_CMD_NAPI_GET,164 NETDEV_CMD_NAPI_GET,
165 NETDEV_CMD_QSTATS_GET,
147 166
148 __NETDEV_CMD_MAX,167 __NETDEV_CMD_MAX,
149 NETDEV_CMD_MAX = (__NETDEV_CMD_MAX - 1)168 NETDEV_CMD_MAX = (__NETDEV_CMD_MAX - 1)