@@ -34,6 +34,9 @@ static const char *portStates[] = {"Nop","Down","Init","Armed","","Active Defer"
3434static const char * qp_state [] = {"OFF" ,"ON" };
3535static const char * exchange_state [] = {"Ethernet" ,"rdma_cm" };
3636static const char * atomicTypesStr [] = {"CMP_AND_SWAP" ,"FETCH_AND_ADD" };
37+ #ifdef HAVE_HNSDV
38+ static const char * congestStr [] = {"DCQCN" ,"LDCP" ,"HC3" ,"DIP" };
39+ #endif
3740
3841/******************************************************************************
3942 * parse_mac_from_str.
@@ -438,6 +441,11 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
438441 printf (" --cpu_util " );
439442 printf (" Show CPU Utilization in report, valid only in Duration mode \n" );
440443
444+ #ifdef HAVE_HNSDV
445+ printf (" --congest_type=<DCQCN, LDCP, HC3, DIP> " );
446+ printf (" Use the hnsdv interface to set congestion control algorithm.\n" );
447+ #endif
448+
441449 if (tst != FS_RATE ) {
442450 printf (" --dlid " );
443451 printf (" Set a Destination LID instead of getting it from the other side.\n" );
@@ -863,6 +871,7 @@ static void init_perftest_params(struct perftest_parameters *user_param)
863871 user_param -> source_ip = NULL ;
864872 user_param -> has_source_ip = 0 ;
865873 user_param -> use_write_with_imm = 0 ;
874+ user_param -> congest_type = OFF ;
866875}
867876
868877static int open_file_write (const char * file_path )
@@ -961,6 +970,25 @@ static void change_conn_type(int *cptr, VerbType verb, const char *optarg)
961970 exit (1 );
962971 }
963972}
973+
974+ #ifdef HAVE_HNSDV
975+ static void set_congest_type (int * cgtr , const char * optarg )
976+ {
977+ if (strcmp (congestStr [0 ], optarg ) == 0 ) {
978+ * cgtr = HNSDV_QP_CREATE_ENABLE_DCQCN ;
979+ } else if (strcmp (congestStr [1 ], optarg ) == 0 ) {
980+ * cgtr = HNSDV_QP_CREATE_ENABLE_LDCP ;
981+ } else if (strcmp (congestStr [2 ], optarg ) == 0 ) {
982+ * cgtr = HNSDV_QP_CREATE_ENABLE_HC3 ;
983+ } else if (strcmp (congestStr [3 ], optarg ) == 0 ) {
984+ * cgtr = HNSDV_QP_CREATE_ENABLE_DIP ;
985+ } else {
986+ fprintf (stderr , " Invalid congest type. Please choose from {DCQCN,LDCP,HC3,DIP}\n" );
987+ exit (1 );
988+ }
989+ }
990+ #endif
991+
964992/******************************************************************************
965993 *
966994 ******************************************************************************/
@@ -1757,6 +1785,23 @@ static void force_dependecies(struct perftest_parameters *user_param)
17571785 }
17581786 }
17591787
1788+ #ifdef HAVE_HNSDV
1789+ if (user_param -> congest_type ) {
1790+ if (user_param -> work_rdma_cm == ON )
1791+ {
1792+ printf (RESULT_LINE );
1793+ fprintf (stderr , "rdma_cm does not support setting congest type.\n" );
1794+ exit (1 );
1795+ }
1796+
1797+ if (user_param -> connection_type == XRC || user_param -> connection_type == UD ) {
1798+ printf (RESULT_LINE );
1799+ fprintf (stdout , "XRC/UD does not support setting congest type.\n" );
1800+ exit (1 );
1801+ }
1802+ }
1803+ #endif
1804+
17601805 return ;
17611806}
17621807/******************************************************************************
@@ -2274,6 +2319,9 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
22742319 static int credentials_path_flag = 0 ;
22752320 static int data_enc_key_app_path_flag = 0 ;
22762321 #endif
2322+ #ifdef HAVE_HNSDV
2323+ static int congest_type_flag = 0 ;
2324+ #endif
22772325
22782326 char * server_ip = NULL ;
22792327 char * client_ip = NULL ;
@@ -2427,6 +2475,9 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
24272475 #if defined HAVE_OOO_ATTR
24282476 {.name = "use_ooo" , .has_arg = 0 , .flag = & use_ooo_flag , .val = 1 },
24292477 #endif
2478+ #ifdef HAVE_HNSDV
2479+ { .name = "congest_type" , .has_arg = 1 , .flag = & congest_type_flag , .val = 1 },
2480+ #endif
24302481 {.name = "bind_source_ip" , .has_arg = 1 , .flag = & source_ip_flag , .val = 1 },
24312482 {.name = "write_with_imm" , .has_arg = 0 , .flag = & use_write_with_imm_flag , .val = 1 },
24322483 {0 }
@@ -2721,6 +2772,12 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
27212772 free (duplicates_checker );
27222773 return FAILURE ;
27232774 case 0 : /* required for long options to work. */
2775+ #ifdef HAVE_HNSDV
2776+ if (congest_type_flag ) {
2777+ set_congest_type (& user_param -> congest_type , optarg );
2778+ congest_type_flag = 0 ;
2779+ }
2780+ #endif
27242781 if (pkey_flag ) {
27252782 CHECK_VALUE (user_param -> pkey_index ,int ,"Pkey index" ,not_int_ptr );
27262783 pkey_flag = 0 ;
0 commit comments