Skip to content

Commit 4e82375

Browse files
wdc: Fix conflicts and build errors
Signed-off-by: jeff-lien-wdc <jeff.lien@sandisk.com>
1 parent c5cc292 commit 4e82375

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

plugins/wdc/wdc-nvme.c

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5523,7 +5523,8 @@ static void wdc_print_fb_ca_log_json(struct wdc_ssd_ca_perf_stats *perf)
55235523
static void wdc_print_bd_ca_log_normal(struct nvme_dev *dev, void *data)
55245524
{
55255525
struct wdc_bd_ca_log_format *bd_data = (struct wdc_bd_ca_log_format *)data;
5526-
__u64 *raw, rawSwapped;
5526+
__u64 *raw;
5527+
__u64 rawSwapped;
55275528
__u16 *word_raw1 = NULL,
55285529
*word_raw2 = NULL,
55295530
*word_raw3 = NULL;
@@ -5533,19 +5534,19 @@ static void wdc_print_bd_ca_log_normal(struct nvme_dev *dev, void *data)
55335534

55345535
while (valid_id) {
55355536
raw = (__u64 *)&bd_data->raw_value[0];
5536-
rawSwapped = le64_to_cpu(*raw);
5537+
rawSwapped = (le64_to_cpu(*raw)>>8);
55375538

55385539
switch (bd_data->field_id) {
55395540
case 0x0:
55405541
printf("Additional Smart Log for NVME device:%s namespace-id:%x\n",
55415542
dev->name, WDC_DE_GLOBAL_NSID);
55425543
printf("key normalized raw\n");
55435544
printf("program_fail_count : %3"PRIu8"%% %"PRIu64"\n",
5544-
bd_data->normalized_value, (long unsigned int)rawSwapped>>8);
5545+
bd_data->normalized_value, (unsigned long)rawSwapped);
55455546
break;
55465547
case 0x1:
55475548
printf("erase_fail_count : %3"PRIu8"%% %"PRIu64"\n",
5548-
bd_data->normalized_value, (long unsigned int)rawSwapped>>8);
5549+
bd_data->normalized_value, (unsigned long)rawSwapped);
55495550
break;
55505551
case 0x2:
55515552
word_raw1 = (__u16 *)&bd_data->raw_value[1];
@@ -5560,23 +5561,23 @@ static void wdc_print_bd_ca_log_normal(struct nvme_dev *dev, void *data)
55605561
break;
55615562
case 0x3:
55625563
printf("end_to_end_error_detection_count: %3"PRIu8"%% %"PRIu64"\n",
5563-
bd_data->normalized_value, (long unsigned int)rawSwapped>>8);
5564+
bd_data->normalized_value, (unsigned long)rawSwapped);
55645565
break;
55655566
case 0x4:
55665567
printf("crc_error_count : %3"PRIu8"%% %"PRIu64"\n",
5567-
bd_data->normalized_value, (long unsigned int)rawSwapped>>8);
5568+
bd_data->normalized_value, (unsigned long)rawSwapped);
55685569
break;
55695570
case 0x5:
55705571
printf("timed_workload_media_wear : %3"PRIu8"%% %-.3f%%\n",
5571-
bd_data->normalized_value, safe_div_fp((rawSwapped>>8), 1024.0));
5572+
bd_data->normalized_value, safe_div_fp((rawSwapped), 1024.0));
55725573
break;
55735574
case 0x6:
55745575
printf("timed_workload_host_reads : %3"PRIu8"%% %"PRIu64"\n",
5575-
bd_data->normalized_value, (long unsigned int)rawSwapped>>8);
5576+
bd_data->normalized_value, (unsigned long)rawSwapped);
55765577
break;
55775578
case 0x7:
55785579
printf("timed_workload_timer : %3"PRIu8"%% %"PRIu64"\n",
5579-
bd_data->normalized_value, (long unsigned int)rawSwapped>>8);
5580+
bd_data->normalized_value, (unsigned long)rawSwapped);
55805581
break;
55815582
case 0x8:
55825583
byte_raw = (__u8 *)&bd_data->raw_value[1];
@@ -5587,19 +5588,19 @@ static void wdc_print_bd_ca_log_normal(struct nvme_dev *dev, void *data)
55875588
break;
55885589
case 0x9:
55895590
printf("retry_buffer_overflow_count : %3"PRIu8"%% %"PRIu64"\n",
5590-
bd_data->normalized_value, (long unsigned int)rawSwapped>>8);
5591+
bd_data->normalized_value, (unsigned long)rawSwapped);
55915592
break;
55925593
case 0xA:
55935594
printf("pll_lock_loss_count : %3"PRIu8"%% %"PRIu64"\n",
5594-
bd_data->normalized_value, (long unsigned int)rawSwapped>>8);
5595+
bd_data->normalized_value, (unsigned long)rawSwapped);
55955596
break;
55965597
case 0xB:
55975598
printf("nand_bytes_written : %3"PRIu8"%% %"PRIu64"\n",
5598-
bd_data->normalized_value, (long unsigned int)rawSwapped>>8);
5599+
bd_data->normalized_value, (unsigned long)rawSwapped);
55995600
break;
56005601
case 0xC:
56015602
printf("host_bytes_written : %3"PRIu8"%% %"PRIu64"\n",
5602-
bd_data->normalized_value, (long unsigned int)rawSwapped>>8);
5603+
bd_data->normalized_value, (unsigned long)rawSwapped);
56035604
/* last entry, break from while loop */
56045605
valid_id = false;
56055606
break;
@@ -5626,20 +5627,20 @@ static void wdc_print_bd_ca_log_json(void *data)
56265627

56275628
while (valid_id) {
56285629
raw = (__u64 *)&bd_data->raw_value[0];
5629-
rawSwapped = le64_to_cpu(*raw);
5630+
rawSwapped = (le64_to_cpu(*raw)>>8);
56305631

56315632
switch (bd_data->field_id) {
56325633
case 0x0:
56335634
json_object_add_value_int(root, "program_fail_count normalized",
56345635
bd_data->normalized_value);
56355636
json_object_add_value_uint64(root, "program_fail_count raw",
5636-
rawSwapped>>8);
5637+
rawSwapped);
56375638
break;
56385639
case 0x1:
56395640
json_object_add_value_int(root, "erase_fail_count normalized",
56405641
bd_data->normalized_value);
56415642
json_object_add_value_uint64(root, "erase_fail_count raw",
5642-
rawSwapped>>8);
5643+
rawSwapped);
56435644
break;
56445645
case 0x2:
56455646
word_raw = (__u16 *)&bd_data->raw_value[1];
@@ -5658,31 +5659,31 @@ static void wdc_print_bd_ca_log_json(void *data)
56585659
json_object_add_value_int(root, "end_to_end_error_detection_count normalized",
56595660
bd_data->normalized_value);
56605661
json_object_add_value_uint64(root, "end_to_end_error_detection_count raw",
5661-
rawSwapped>>8);
5662+
rawSwapped);
56625663
break;
56635664
case 0x4:
56645665
json_object_add_value_int(root, "crc_error_count normalized",
56655666
bd_data->normalized_value);
56665667
json_object_add_value_uint64(root, "crc_error_count raw",
5667-
rawSwapped>>8);
5668+
rawSwapped);
56685669
break;
56695670
case 0x5:
56705671
json_object_add_value_int(root, "timed_workload_media_wear normalized",
56715672
bd_data->normalized_value);
56725673
json_object_add_value_double(root, "timed_workload_media_wear raw",
5673-
safe_div_fp(((long unsigned int)rawSwapped>>8), 1024.0));
5674+
safe_div_fp(((unsigned long)rawSwapped), 1024.0));
56745675
break;
56755676
case 0x6:
56765677
json_object_add_value_int(root, "timed_workload_host_reads normalized",
56775678
bd_data->normalized_value);
56785679
json_object_add_value_uint64(root, "timed_workload_host_reads raw",
5679-
rawSwapped>>8);
5680+
rawSwapped);
56805681
break;
56815682
case 0x7:
56825683
json_object_add_value_int(root, "timed_workload_timer normalized",
56835684
bd_data->normalized_value);
56845685
json_object_add_value_uint64(root, "timed_workload_timer",
5685-
rawSwapped>>8);
5686+
rawSwapped);
56865687
break;
56875688
case 0x8:
56885689
byte_raw = (__u8 *)&bd_data->raw_value[1];
@@ -5698,25 +5699,25 @@ static void wdc_print_bd_ca_log_json(void *data)
56985699
json_object_add_value_int(root, "retry_buffer_overflow_count normalized",
56995700
bd_data->normalized_value);
57005701
json_object_add_value_uint64(root, "retry_buffer_overflow_count raw",
5701-
rawSwapped>>8);
5702+
rawSwapped);
57025703
break;
57035704
case 0xA:
57045705
json_object_add_value_int(root, "pll_lock_loss_count normalized",
57055706
bd_data->normalized_value);
57065707
json_object_add_value_uint64(root, "pll_lock_loss_count raw",
5707-
rawSwapped>>8);
5708+
rawSwapped);
57085709
break;
57095710
case 0xB:
57105711
json_object_add_value_int(root, "nand_bytes_written normalized",
57115712
bd_data->normalized_value);
57125713
json_object_add_value_uint64(root, "nand_bytes_written raw",
5713-
rawSwapped>>8);
5714+
rawSwapped);
57145715
break;
57155716
case 0xC:
57165717
json_object_add_value_int(root, "host_bytes_written normalized",
57175718
bd_data->normalized_value);
57185719
json_object_add_value_uint64(root, "host_bytes_written raw",
5719-
rawSwapped>>8);
5720+
rawSwapped);
57205721

57215722
/* last entry, break from while loop */
57225723
valid_id = false;
@@ -8498,6 +8499,9 @@ static int wdc_cu_smart_log(int argc, char **argv, struct command *command,
84988499
fprintf(stderr, "ERROR: WDC: Command not supported on this device\n");
84998500
ret = -1;
85008501
}
8502+
} else {
8503+
fprintf(stderr, "ERROR: WDC: CA log page supported on this device\n");
8504+
ret = -1;
85018505
}
85028506

85038507
out:

0 commit comments

Comments
 (0)