Skip to content

Commit 4884703

Browse files
lgdacunhigaw
authored andcommitted
plugins/solidigm: Bug Fix reversed Telemetry array dimensions order.
Configuration file was showing arrays in reverse order compared to C arrays. Signed-off-by: Leonardo da Cunha <leonardo.da.cunha@solidigm.com>
1 parent 874e025 commit 4884703

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

plugins/solidigm/solidigm-nvme.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "cmd.h"
1515

16-
#define SOLIDIGM_PLUGIN_VERSION "1.20"
16+
#define SOLIDIGM_PLUGIN_VERSION "1.21"
1717

1818
PLUGIN(NAME("solidigm", "Solidigm vendor specific extensions", SOLIDIGM_PLUGIN_VERSION),
1919
COMMAND_LIST(

plugins/solidigm/solidigm-telemetry/data-area.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* Author: leonardo.da.cunha@solidigm.com
66
*/
77

8-
#include <ctype.h>
9-
108
#include "cod.h"
119
#include "common.h"
1210
#include "config.h"
@@ -210,12 +208,17 @@ int sldm_telemetry_structure_parse(const struct telemetry_log *tl,
210208

211209
if (array_rank > 1) {
212210
uint32_t linear_pos_per_index = 1;
211+
uint32_t outer_size = array_size_dimension[array_rank - 1];
213212
uint32_t prev_index_offset_bit = 0;
214213
struct json_object *dimension_output;
215214
struct json_object *inner_dim_array;
216215

217-
/* Stride = product of all inner dimensions (1..rank-1) */
218-
for (unsigned int i = 1; i < array_rank; i++)
216+
/*
217+
* arraySize convention: the last element is the outermost
218+
* (major) dimension. Stride = product of all inner dims
219+
* [0..rank-2].
220+
*/
221+
for (unsigned int i = 0; i < array_rank - 1; i++)
219222
linear_pos_per_index *= array_size_dimension[i];
220223

221224
/*
@@ -230,11 +233,11 @@ int sldm_telemetry_structure_parse(const struct telemetry_log *tl,
230233
}
231234

232235
/*
233-
* Build a copy of arraySize without the first dimension
234-
* so recursive calls see only the inner dimensions.
236+
* Build a copy of arraySize without the last (outermost)
237+
* dimension so recursive calls see only the inner dimensions.
235238
*/
236239
inner_dim_array = json_create_array();
237-
for (size_t i = 1; i < array_rank; i++) {
240+
for (size_t i = 0; i < array_rank - 1; i++) {
238241
struct json_object *dim =
239242
json_object_array_get_idx(
240243
obj_arraySizeArray, i);
@@ -246,7 +249,7 @@ int sldm_telemetry_structure_parse(const struct telemetry_log *tl,
246249
json_object_object_add(struct_def, "arraySize",
247250
inner_dim_array);
248251

249-
for (unsigned int i = 0 ; i < array_size_dimension[0]; i++) {
252+
for (unsigned int i = 0 ; i < outer_size; i++) {
250253
struct json_object *sub_array = json_create_array();
251254
uint64_t offset;
252255

0 commit comments

Comments
 (0)