The branch main has been updated by seuros:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=92dec9201bf9759fc760da49a175fc99f3277c6c

commit 92dec9201bf9759fc760da49a175fc99f3277c6c
Author:     Abdelkader Boudih <[email protected]>
AuthorDate: 2026-09-25 21:42:15 +0000
Commit:     Abdelkader Boudih <[email protected]>
CommitDate: 2026-09-25 21:42:15 +0000

    nvme: share one handler between the interrupt coalescing sysctls
    
    The int_coal_time and int_coal_threshold handlers differed only in which
    controller field they updated before reprogramming the feature.
    
    Reviewed by:    imp, adrian
    Differential Revision:  https://reviews.freebsd.org/D60018
---
 sys/dev/nvme/nvme_sysctl.c | 37 ++++++++++---------------------------
 1 file changed, 10 insertions(+), 27 deletions(-)

diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c
index d94bff15244f..6da1be02f4b2 100644
--- a/sys/dev/nvme/nvme_sysctl.c
+++ b/sys/dev/nvme/nvme_sysctl.c
@@ -93,36 +93,17 @@ nvme_sysctl_dump_debug(SYSCTL_HANDLER_ARGS)
 }
 
 static int
-nvme_sysctl_int_coal_time(SYSCTL_HANDLER_ARGS)
+nvme_sysctl_int_coal(SYSCTL_HANDLER_ARGS)
 {
        struct nvme_controller *ctrlr = arg1;
-       uint32_t oldval = ctrlr->int_coal_time;
-       int error = sysctl_handle_int(oidp, &ctrlr->int_coal_time, 0,
-           req);
+       uint32_t *valp = (uint32_t *)((char *)ctrlr + (size_t)arg2);
+       uint32_t oldval = *valp;
+       int error = sysctl_handle_int(oidp, valp, 0, req);
 
        if (error)
                return (error);
 
-       if (oldval != ctrlr->int_coal_time)
-               nvme_ctrlr_cmd_set_interrupt_coalescing(ctrlr,
-                   ctrlr->int_coal_time, ctrlr->int_coal_threshold, NULL,
-                   NULL);
-
-       return (0);
-}
-
-static int
-nvme_sysctl_int_coal_threshold(SYSCTL_HANDLER_ARGS)
-{
-       struct nvme_controller *ctrlr = arg1;
-       uint32_t oldval = ctrlr->int_coal_threshold;
-       int error = sysctl_handle_int(oidp, &ctrlr->int_coal_threshold, 0,
-           req);
-
-       if (error)
-               return (error);
-
-       if (oldval != ctrlr->int_coal_threshold)
+       if (oldval != *valp)
                nvme_ctrlr_cmd_set_interrupt_coalescing(ctrlr,
                    ctrlr->int_coal_time, ctrlr->int_coal_threshold, NULL,
                    NULL);
@@ -361,13 +342,15 @@ nvme_sysctl_initialize_ctrlr(struct nvme_controller 
*ctrlr)
 
        SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO,
            "int_coal_time", CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE,
-           ctrlr, 0, nvme_sysctl_int_coal_time, "IU",
+           ctrlr, offsetof(struct nvme_controller, int_coal_time),
+           nvme_sysctl_int_coal, "IU",
            "Interrupt coalescing timeout (in microseconds)");
 
        SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO,
            "int_coal_threshold",
-           CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, ctrlr, 0,
-           nvme_sysctl_int_coal_threshold, "IU",
+           CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, ctrlr,
+           offsetof(struct nvme_controller, int_coal_threshold),
+           nvme_sysctl_int_coal, "IU",
            "Interrupt coalescing threshold");
 
        SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO,

Reply via email to