Skip to content

Commit 733f477

Browse files
jimmunnigaw
authored andcommitted
feat: fix bugs in arbitration and power-thresh commands
arbitration_set() used temp_thresh_feat instead of arbitration_feat in the error path, and feat_arbitration() passed TEMP_THRESH_DESC instead of ARBITRATION_DESC to parse_and_open(). power_thresh_set() used __u8 instead of __u16 for the ptv parameter, truncating the power threshold value. Signed-off-by: Jim Munn <[email protected]>
1 parent 7e89b0d commit 733f477

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

plugins/feat/feat-nvme.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ static int arbitration_set(struct nvme_transport_handle *hdl, const __u8 fid,
500500
if (err > 0) {
501501
nvme_show_status(err);
502502
} else if (err < 0) {
503-
nvme_show_perror("Set %s", temp_thresh_feat);
503+
nvme_show_perror("Set %s", arbitration_feat);
504504
} else {
505505
nvme_show_result("Set %s: (%s)", arbitration_feat, sv ? "Save" : "Not save");
506506
nvme_feature_show_fields(fid, NVME_SET(cfg->ab, FEAT_ARBITRATION_BURST) |
@@ -534,7 +534,7 @@ static int feat_arbitration(int argc, char **argv, struct command *acmd, struct
534534
OPT_BYTE("mpw", 'm', &cfg.mpw, mpw),
535535
OPT_BYTE("hpw", 'H', &cfg.hpw, hpw));
536536

537-
err = parse_and_open(&ctx, &hdl, argc, argv, TEMP_THRESH_DESC, opts);
537+
err = parse_and_open(&ctx, &hdl, argc, argv, ARBITRATION_DESC, opts);
538538
if (err)
539539
return err;
540540

@@ -672,7 +672,7 @@ static int feat_power_limit(int argc, char **argv, struct command *acmd,
672672
}
673673

674674
static int power_thresh_set(struct nvme_transport_handle *hdl, const __u8 fid,
675-
__u8 ptv, __u8 pts, __u8 pmts, __u8 ept, __u8 uidx,
675+
__u16 ptv, __u8 pts, __u8 pmts, __u8 ept, __u8 uidx,
676676
bool sv)
677677
{
678678
__u32 cdw11 = NVME_SET(ptv, FEAT_POWER_THRESH_PTV) |
@@ -718,7 +718,7 @@ static int feat_power_thresh(int argc, char **argv, struct command *acmd,
718718
int err;
719719

720720
struct config {
721-
__u8 ptv;
721+
__u16 ptv;
722722
__u8 pts;
723723
__u8 pmts;
724724
__u8 ept;
@@ -729,17 +729,18 @@ static int feat_power_thresh(int argc, char **argv, struct command *acmd,
729729
struct config cfg = { 0 };
730730

731731
FEAT_ARGS(opts,
732-
OPT_BYTE("ptv", 'p', &cfg.ptv, ptv),
732+
OPT_SHRT("ptv", 'p', &cfg.ptv, ptv),
733733
OPT_BYTE("pts", 't', &cfg.pts, pts),
734734
OPT_BYTE("pmts", 'm', &cfg.pmts, pmts),
735735
OPT_BYTE("ept", 'e', &cfg.ept, ept),
736736
OPT_BYTE("uuid-index", 'u', &cfg.uidx, uuid_index));
737737

738-
err = parse_and_open(&ctx, &hdl, argc, argv, POWER_LIMIT_DESC, opts);
738+
err = parse_and_open(&ctx, &hdl, argc, argv, POWER_THRESH_DESC, opts);
739739
if (err)
740740
return err;
741741

742742
if (argconfig_parse_seen(opts, "ptv") ||
743+
argconfig_parse_seen(opts, "pts") ||
743744
argconfig_parse_seen(opts, "pmts") ||
744745
argconfig_parse_seen(opts, "ept"))
745746
err = power_thresh_set(hdl, fid, cfg.ptv, cfg.pts, cfg.pmts,

0 commit comments

Comments
 (0)