]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
ioctl: set correct bits in Set Features commands
authorCaleb Sander <csander@purestorage.com>
Fri, 8 Sep 2023 16:51:19 +0000 (10:51 -0600)
committerDaniel Wagner <wagi@monom.org>
Wed, 20 Sep 2023 08:33:57 +0000 (10:33 +0200)
A few nvme_set_features_*() functions are setting the wrong bits in
CDW11 based on their inputs. Correct the fields passed to NVME_SET().

Signed-off-by: Caleb Sander <csander@purestorage.com>
src/nvme/ioctl.c

index 91429f473a02a3b63045d0ec3c89c2970e21bf48..eb6cd8b7a7029573a1d8814617abbb9d3ff520f9 100644 (file)
@@ -585,7 +585,7 @@ int nvme_set_features_power_mgmt(int fd, __u8 ps, __u8 wh, bool save,
                                 __u32 *result)
 {
        __u32 value = NVME_SET(ps, FEAT_PWRMGMT_PS) |
-                       NVME_SET(wh, FEAT_PWRMGMT_PS);
+                       NVME_SET(wh, FEAT_PWRMGMT_WH);
 
        return __nvme_set_features(fd, NVME_FEAT_FID_POWER_MGMT, value, save,
                                   result);
@@ -630,8 +630,8 @@ int nvme_set_features_volatile_wc(int fd, bool wce, bool save, __u32 *result)
 int nvme_set_features_irq_coalesce(int fd, __u8 thr, __u8 time, bool save,
                                   __u32 *result)
 {
-       __u32 value = NVME_SET(thr, FEAT_IRQC_TIME) |
-                       NVME_SET(time, FEAT_IRQC_THR);
+       __u32 value = NVME_SET(thr, FEAT_IRQC_THR) |
+                       NVME_SET(time, FEAT_IRQC_TIME);
 
        return __nvme_set_features(fd, NVME_FEAT_FID_IRQ_COALESCE, value, save,
                                   result);