@@ -161,7 +161,7 @@ static int post_one_recv_wqe(struct pingpong_context *ctx)
161161 struct ibv_sge list ;
162162
163163 list .addr = (uintptr_t )ctx -> buf [0 ];
164- list .length = sizeof (struct pingpong_dest );
164+ list .length = MAX ( sizeof (struct pingpong_dest ), sizeof ( struct perftest_parameters_negotiate ) );
165165 list .lkey = ctx -> mr [0 ]-> lkey ;
166166
167167 wr .next = NULL ;
@@ -952,6 +952,106 @@ int set_up_connection(struct pingpong_context *ctx,
952952 return 0 ;
953953}
954954
955+
956+ /******************************************************************************
957+ *
958+ ******************************************************************************/
959+
960+ int negotiate_params (struct pingpong_context * ctx ,
961+ struct perftest_comm * comm ,
962+ struct perftest_parameters * user_param )
963+ {
964+ /* Fill local parameters */
965+ struct perftest_parameters_negotiate local_params = {
966+ .test_method = hton_int (user_param -> test_method ),
967+ .connection_type = hton_int (user_param -> connection_type ),
968+ .verb = hton_int (user_param -> verb ),
969+ .tst = hton_int (user_param -> tst ),
970+ .atomicType = hton_int (user_param -> atomicType ),
971+ .test_type = hton_int (user_param -> test_type ),
972+ .report_fmt = hton_int (user_param -> report_fmt ),
973+ .size = hton_64 (user_param -> size ),
974+ .iters = hton_64 (user_param -> iters ),
975+ .aes_xts = hton_int ((int )user_param -> aes_xts ),
976+ .num_of_qps = hton_int (user_param -> num_of_qps ),
977+ .duration = hton_int (user_param -> duration ),
978+ .use_rdma_cm = hton_int (user_param -> use_rdma_cm ),
979+ .use_write_with_imm = hton_int (user_param -> use_write_with_imm ),
980+ .no_enhanced_reorder = hton_int (user_param -> no_enhanced_reorder ),
981+ .sig_offload = hton_int (user_param -> sig_offload ),
982+ };
983+
984+ if (ibv_query_device (ctx -> context , & local_params .attr )) {
985+ fprintf (stderr , " Failed to query device attributes\n" );
986+ return FAILURE ;
987+ }
988+
989+ #ifdef HAVE_MLX5DV
990+ if (local_params .attr .vendor_id == MLNX_VENDOR_ID ) {
991+ struct mlx5dv_context ctx_dv ;
992+ #ifdef HAVE_OOO_RECV_WRS
993+ ctx_dv .comp_mask = MLX5DV_CONTEXT_MASK_OOO_RECV_WRS ;
994+ #endif
995+
996+ if (mlx5dv_query_device (ctx -> context , & ctx_dv )){
997+ fprintf (stderr , " Failed to query device capabilities\n" );
998+ return FAILURE ;
999+ }
1000+ local_params .mlx5dv_comp_mask = hton_64 (ctx_dv .comp_mask );
1001+ }
1002+ #endif
1003+
1004+ struct perftest_parameters_negotiate remote_params ;
1005+ /* Exchange parameters */
1006+ if (ctx_xchg_data (comm , & local_params , & remote_params , sizeof (local_params ))) {
1007+ fprintf (stderr , " Failed to exchange negotiation parameters between server and client\n" );
1008+ return FAILURE ;
1009+ }
1010+
1011+ #define COMPARE (func , name , values , type ) \
1012+ { func, #name, &local_params.name, &remote_params.name, values, type }
1013+
1014+ CompareFunction compare_functions [] = {
1015+ // COMPARE(compare_func, name, values, type) -> { compare_func, name, local_value, remote_value, return_values, type }
1016+ COMPARE (compare , test_method , ((char * []){"RUN_REGULAR" , "RUN_ALL" , "RUN_INFINITELY" }), INT ),
1017+ COMPARE (compare , connection_type , ((char * []){"RC" , "UC" , "UD" , "RawEth" , "XRC" , "DC" , "SRD" }), INT ),
1018+ COMPARE (compare , verb , ((char * []){"SEND" , "SEND_IMM" , "WRITE" , "WRITE_IMM" , "READ" , "ATOMIC" }), INT ),
1019+ COMPARE (compare , tst , ((char * []){"LAT" , "BW" , "LAT_BY_BW" , "FS_RATE" }), INT ),
1020+ COMPARE (compare , atomicType , ((char * []){"CMP_AND_SWAP" , "FETCH_AND_ADD" }), INT ),
1021+ COMPARE (compare , test_type , ((char * []){"ITERATIONS" , "DURATION" }), INT ),
1022+ COMPARE (compare , report_fmt , ((char * []){"GBS" , "MBS" }), INT ),
1023+ COMPARE (compare , size , NULL , UINT64 ),
1024+ COMPARE (compare , iters , NULL , UINT64 ),
1025+ COMPARE (compare , aes_xts , ((char * []){"OFF" , "ON" }), INT ),
1026+ COMPARE (compare , num_of_qps , NULL , INT ),
1027+ COMPARE (compare , duration , NULL , INT ),
1028+ COMPARE (compare , use_rdma_cm , ((char * []){"OFF" , "ON" }), INT ),
1029+ COMPARE (compare , use_write_with_imm , ((char * []){"OFF" , "ON" }), INT ),
1030+ COMPARE (compare , no_enhanced_reorder , ((char * []){"OFF" , "ON" }), INT ),
1031+ COMPARE (compare , sig_offload , ((char * []){"OFF" , "ON" }), INT ),
1032+ COMPARE (compare_ibv_device , attr , NULL , NONE ),
1033+ };
1034+ #undef COMPARE
1035+
1036+ for (int i = 0 ; i < sizeof (compare_functions )/sizeof (compare_functions [0 ]); i ++ ) {
1037+ if (compare_functions [i ].compare_func (compare_functions [i ].name ,
1038+ compare_functions [i ].local_value ,
1039+ compare_functions [i ].remote_value ,
1040+ compare_functions [i ].return_values ,
1041+ user_param , compare_functions [i ].type ) == FAILURE ){
1042+ return FAILURE ;
1043+ }
1044+ }
1045+
1046+ #ifdef HAVE_MLX5DV
1047+ if (local_params .attr .vendor_id == MLNX_VENDOR_ID ) {
1048+ compare_mlx5dv ("mlx5dv_comp_mask" , & local_params .mlx5dv_comp_mask , & remote_params .mlx5dv_comp_mask , NULL , user_param , NONE );
1049+ }
1050+ #endif
1051+
1052+ return SUCCESS ;
1053+ }
1054+
9551055/******************************************************************************
9561056 *
9571057 ******************************************************************************/
0 commit comments