@@ -57,17 +57,17 @@ static __u8 lat_mon_guid[GUID_LEN] = {
57
57
#define RESERVED 0
58
58
59
59
struct __packed feature_latency_monitor {
60
- __u16 active_bucket_timer_threshold ;
61
- __u8 active_threshold_a ;
62
- __u8 active_threshold_b ;
63
- __u8 active_threshold_c ;
64
- __u8 active_threshold_d ;
65
- __u16 active_latency_config ;
66
- __u8 active_latency_minimum_window ;
67
- __u16 debug_log_trigger_enable ;
68
- __u8 discard_debug_log ;
69
- __u8 latency_monitor_feature_enable ;
70
- __u8 reserved [4083 ];
60
+ __le16 active_bucket_timer_threshold ;
61
+ __u8 active_threshold_a ;
62
+ __u8 active_threshold_b ;
63
+ __u8 active_threshold_c ;
64
+ __u8 active_threshold_d ;
65
+ __le16 active_latency_config ;
66
+ __u8 active_latency_minimum_window ;
67
+ __le16 debug_log_trigger_enable ;
68
+ __u8 discard_debug_log ;
69
+ __u8 latency_monitor_feature_enable ;
70
+ __u8 reserved [4083 ];
71
71
};
72
72
73
73
struct erri_entry {
@@ -265,7 +265,7 @@ int ocp_set_latency_monitor_feature(int argc, char **argv, struct command *cmd,
265
265
int err = -1 ;
266
266
struct nvme_dev * dev ;
267
267
__u32 result ;
268
- struct feature_latency_monitor buf = {0 , };
268
+ struct feature_latency_monitor buf = { 0 };
269
269
__u32 nsid = NVME_NSID_ALL ;
270
270
struct stat nvme_stat ;
271
271
struct nvme_id_ctrl ctrl ;
@@ -342,16 +342,14 @@ int ocp_set_latency_monitor_feature(int argc, char **argv, struct command *cmd,
342
342
if (err )
343
343
return err ;
344
344
345
- memset (& buf , 0 , sizeof (struct feature_latency_monitor ));
346
-
347
- buf .active_bucket_timer_threshold = cfg .active_bucket_timer_threshold ;
345
+ buf .active_bucket_timer_threshold = cpu_to_le16 (cfg .active_bucket_timer_threshold );
348
346
buf .active_threshold_a = cfg .active_threshold_a ;
349
347
buf .active_threshold_b = cfg .active_threshold_b ;
350
348
buf .active_threshold_c = cfg .active_threshold_c ;
351
349
buf .active_threshold_d = cfg .active_threshold_d ;
352
- buf .active_latency_config = cfg .active_latency_config ;
350
+ buf .active_latency_config = cpu_to_le16 ( cfg .active_latency_config ) ;
353
351
buf .active_latency_minimum_window = cfg .active_latency_minimum_window ;
354
- buf .debug_log_trigger_enable = cfg .debug_log_trigger_enable ;
352
+ buf .debug_log_trigger_enable = cpu_to_le16 ( cfg .debug_log_trigger_enable ) ;
355
353
buf .discard_debug_log = cfg .discard_debug_log ;
356
354
buf .latency_monitor_feature_enable = cfg .latency_monitor_feature_enable ;
357
355
@@ -373,14 +371,16 @@ int ocp_set_latency_monitor_feature(int argc, char **argv, struct command *cmd,
373
371
perror ("set-feature" );
374
372
} else if (!err ) {
375
373
printf ("NVME_FEAT_OCP_LATENCY_MONITOR: 0x%02x\n" , NVME_FEAT_OCP_LATENCY_MONITOR );
376
- printf ("active bucket timer threshold: 0x%x\n" , buf .active_bucket_timer_threshold );
374
+ printf ("active bucket timer threshold: 0x%x\n" ,
375
+ le16_to_cpu (buf .active_bucket_timer_threshold ));
377
376
printf ("active threshold a: 0x%x\n" , buf .active_threshold_a );
378
377
printf ("active threshold b: 0x%x\n" , buf .active_threshold_b );
379
378
printf ("active threshold c: 0x%x\n" , buf .active_threshold_c );
380
379
printf ("active threshold d: 0x%x\n" , buf .active_threshold_d );
381
- printf ("active latency config: 0x%x\n" , buf .active_latency_config );
380
+ printf ("active latency config: 0x%x\n" , le16_to_cpu ( buf .active_latency_config ) );
382
381
printf ("active latency minimum window: 0x%x\n" , buf .active_latency_minimum_window );
383
- printf ("debug log trigger enable: 0x%x\n" , buf .debug_log_trigger_enable );
382
+ printf ("debug log trigger enable: 0x%x\n" ,
383
+ le16_to_cpu (buf .debug_log_trigger_enable ));
384
384
printf ("discard debug log: 0x%x\n" , buf .discard_debug_log );
385
385
printf ("latency monitor feature enable: 0x%x\n" , buf .latency_monitor_feature_enable );
386
386
} else if (err > 0 ) {
0 commit comments