@@ -189,6 +189,7 @@ struct ieee1667_get_cq_entry {
189189
190190static const char * sel = "[0-3]: current/default/saved/supported" ;
191191static const char * no_uuid = "Skip UUID index search (UUID index not required for OCP 1.0)" ;
192+ static const char * all_ns = "Apply to all namespaces" ;
192193const char * data = "Error injection data structure entries" ;
193194const char * number = "Number of valid error injection data entries" ;
194195static const char * type = "Error injection type" ;
@@ -2935,12 +2936,13 @@ static int get_error_injection(int argc, char **argv, struct command *cmd, struc
29352936 return error_injection_get (dev , cfg .sel , !argconfig_parse_seen (opts , "no-uuid" ));
29362937}
29372938
2938- static int error_injection_set (struct nvme_dev * dev , struct erri_config * cfg , bool uuid )
2939+ static int error_injection_set (struct nvme_dev * dev , struct erri_config * cfg , bool uuid , __u32 nsid )
29392940{
29402941 int err ;
29412942 __u32 result ;
29422943 struct nvme_set_features_args args = {
29432944 .args_size = sizeof (args ),
2945+ .nsid = nsid ,
29442946 .fd = dev_fd (dev ),
29452947 .fid = OCP_FID_ERRI ,
29462948 .cdw11 = cfg -> number ,
@@ -3010,6 +3012,7 @@ static int set_error_injection(int argc, char **argv, struct command *cmd, struc
30103012{
30113013 const char * desc = "Inject error conditions" ;
30123014 int err ;
3015+ __u32 nsid ;
30133016 struct erri_config cfg = {
30143017 .number = 1 ,
30153018 };
@@ -3020,14 +3023,22 @@ static int set_error_injection(int argc, char **argv, struct command *cmd, struc
30203023 OPT_FILE ("data" , 'd' , & cfg .file , data ),
30213024 OPT_BYTE ("number" , 'n' , & cfg .number , number ),
30223025 OPT_FLAG ("no-uuid" , 'N' , NULL , no_uuid ),
3026+ OPT_FLAG ("all-ns" , 'a' , NULL , all_ns ),
30233027 OPT_SHRT ("type" , 't' , & cfg .type , type ),
30243028 OPT_SHRT ("nrtdp" , 'r' , & cfg .nrtdp , nrtdp ));
30253029
30263030 err = parse_and_open (& dev , argc , argv , desc , opts );
30273031 if (err )
30283032 return err ;
30293033
3030- return error_injection_set (dev , & cfg , !argconfig_parse_seen (opts , "no-uuid" ));
3034+ /*
3035+ * Different spec versions ask for different nsid values
3036+ * OCP v1.0 - NSID: Shall be set to zero
3037+ * OCP v2.0r21 - NSID: Shall be set to FFFFFFFFh.
3038+ * OCP v2.5 - NSID: The host should either clear this to zero or set this to FFFFFFFFh
3039+ */
3040+ nsid = argconfig_parse_seen (opts , "all-ns" ) ? NVME_NSID_ALL : 0 ;
3041+ return error_injection_set (dev , & cfg , !argconfig_parse_seen (opts , "no-uuid" ), nsid );
30313042}
30323043
30333044static int enable_ieee1667_silo_get (struct nvme_dev * dev , const __u8 sel , bool uuid )
0 commit comments