netdev-genl: Dump napi_defer_hard_irqs
authorJoe Damato <jdamato@fastly.com>
Fri, 11 Oct 2024 18:44:57 +0000 (18:44 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 15 Oct 2024 00:54:29 +0000 (17:54 -0700)
Support dumping defer_hard_irqs for a NAPI ID.

Signed-off-by: Joe Damato <jdamato@fastly.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20241011184527.16393-3-jdamato@fastly.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/netlink/specs/netdev.yaml
include/uapi/linux/netdev.h
net/core/netdev-genl.c
tools/include/uapi/linux/netdev.h

index 08412c279297bfbb212b78bc15cd29cc6c435d2a..585e87ec3c16166599fe1b3e5f87495ed264ddd0 100644 (file)
@@ -248,6 +248,13 @@ attribute-sets:
              threaded mode. If NAPI is not in threaded mode (i.e. uses normal
              softirq context), the attribute will be absent.
         type: u32
+      -
+        name: defer-hard-irqs
+        doc: The number of consecutive empty polls before IRQ deferral ends
+             and hardware IRQs are re-enabled.
+        type: u32
+        checks:
+          max: s32-max
   -
     name: queue
     attributes:
@@ -636,6 +643,7 @@ operations:
             - ifindex
             - irq
             - pid
+            - defer-hard-irqs
       dump:
         request:
           attributes:
index 7c308f04e7a0630cd3e18b6c268dbae268e225af..13dc0b027e8623c7381f5bc82942a5434b3483e2 100644 (file)
@@ -122,6 +122,7 @@ enum {
        NETDEV_A_NAPI_ID,
        NETDEV_A_NAPI_IRQ,
        NETDEV_A_NAPI_PID,
+       NETDEV_A_NAPI_DEFER_HARD_IRQS,
 
        __NETDEV_A_NAPI_MAX,
        NETDEV_A_NAPI_MAX = (__NETDEV_A_NAPI_MAX - 1)
index 358cba2487967333e0e9b1efce9e9151f4cc67c5..f98e5d1d0d217850f2f5d045979a79aa16f0d33a 100644 (file)
@@ -161,6 +161,7 @@ static int
 netdev_nl_napi_fill_one(struct sk_buff *rsp, struct napi_struct *napi,
                        const struct genl_info *info)
 {
+       u32 napi_defer_hard_irqs;
        void *hdr;
        pid_t pid;
 
@@ -189,6 +190,11 @@ netdev_nl_napi_fill_one(struct sk_buff *rsp, struct napi_struct *napi,
                        goto nla_put_failure;
        }
 
+       napi_defer_hard_irqs = napi_get_defer_hard_irqs(napi);
+       if (nla_put_s32(rsp, NETDEV_A_NAPI_DEFER_HARD_IRQS,
+                       napi_defer_hard_irqs))
+               goto nla_put_failure;
+
        genlmsg_end(rsp, hdr);
 
        return 0;
index 7c308f04e7a0630cd3e18b6c268dbae268e225af..13dc0b027e8623c7381f5bc82942a5434b3483e2 100644 (file)
@@ -122,6 +122,7 @@ enum {
        NETDEV_A_NAPI_ID,
        NETDEV_A_NAPI_IRQ,
        NETDEV_A_NAPI_PID,
+       NETDEV_A_NAPI_DEFER_HARD_IRQS,
 
        __NETDEV_A_NAPI_MAX,
        NETDEV_A_NAPI_MAX = (__NETDEV_A_NAPI_MAX - 1)