@@ -895,7 +895,7 @@ static int ctx_xrc_srq_create(struct pingpong_context *ctx,
895895 srq_init_attr .srq_type = IBV_SRQT_XRC ;
896896 srq_init_attr .xrcd = ctx -> xrc_domain ;
897897
898- if (user_param -> verb == SEND || user_param -> verb == SEND_IMM || user_param -> verb == WRITE_IMM )
898+ if (has_recv_comp ( user_param -> verb ) )
899899 srq_init_attr .cq = ctx -> recv_cq ;
900900 else
901901 srq_init_attr .cq = ctx -> send_cq ;
@@ -1216,7 +1216,7 @@ int alloc_ctx(struct pingpong_context *ctx,struct perftest_parameters *user_para
12161216 memset (ctx -> ccnt , 0 , user_param -> num_of_qps * sizeof (uint64_t ));
12171217
12181218 } else if ((user_param -> tst == BW || user_param -> tst == LAT_BY_BW )
1219- && (user_param -> verb == SEND || user_param -> verb == SEND_IMM || user_param -> verb == WRITE_IMM )
1219+ && has_recv_comp (user_param -> verb )
12201220 && user_param -> machine == SERVER ) {
12211221
12221222 ALLOC (ctx -> my_addr , uint64_t , user_param -> num_of_qps );
@@ -1259,8 +1259,7 @@ int alloc_ctx(struct pingpong_context *ctx,struct perftest_parameters *user_para
12591259 ALLOC (ctx -> ah , struct ibv_ah * , user_param -> num_of_qps );
12601260 }
12611261
1262- if ((user_param -> verb == SEND || user_param -> verb == SEND_IMM || user_param -> verb == WRITE_IMM )
1263- && (user_param -> tst == LAT || user_param -> machine == SERVER || user_param -> duplex )) {
1262+ if (has_recv_comp (user_param -> verb ) && (user_param -> tst == LAT || user_param -> machine == SERVER || user_param -> duplex )) {
12641263 ALLOC (ctx -> recv_sge_list , struct ibv_sge ,
12651264 user_param -> num_of_qps * user_param -> recv_post_list );
12661265 ALLOC (ctx -> rwr , struct ibv_recv_wr ,
@@ -1404,8 +1403,7 @@ void dealloc_ctx(struct pingpong_context *ctx,struct perftest_parameters *user_p
14041403 free (ctx -> ah );
14051404 }
14061405
1407- if ((user_param -> verb == SEND || user_param -> verb == SEND_IMM || user_param -> verb == WRITE_IMM )
1408- && (user_param -> tst == LAT || user_param -> machine == SERVER || user_param -> duplex )) {
1406+ if (has_recv_comp (user_param -> verb ) && (user_param -> tst == LAT || user_param -> machine == SERVER || user_param -> duplex )) {
14091407 if (ctx -> recv_sge_list != NULL )
14101408 free (ctx -> recv_sge_list );
14111409 if (ctx -> rwr != NULL )
@@ -1507,8 +1505,7 @@ int destroy_ctx(struct pingpong_context *ctx,
15071505 test_result = 1 ;
15081506 }
15091507
1510- if ((user_param -> verb == SEND || user_param -> verb == SEND_IMM || user_param -> verb == WRITE_IMM )
1511- || (user_param -> connection_type == DC && !dct_only )){
1508+ if (has_recv_comp (user_param -> verb ) || (user_param -> connection_type == DC && !dct_only )){
15121509 if (ibv_destroy_cq (ctx -> recv_cq )) {
15131510 fprintf (stderr , "Failed to destroy CQ - %s\n" , strerror (errno ));
15141511 test_result = 1 ;
@@ -1650,7 +1647,7 @@ int destroy_ctx(struct pingpong_context *ctx,
16501647 free (ctx -> wr );
16511648 }
16521649
1653- if ((user_param -> verb == SEND || user_param -> verb == SEND_IMM || user_param -> verb == WRITE_IMM )
1650+ if (has_recv_comp (user_param -> verb )
16541651 && (user_param -> tst == LAT || user_param -> machine == SERVER || user_param -> duplex )) {
16551652
16561653 free (ctx -> rx_buffer_addr );
@@ -1907,8 +1904,7 @@ int create_cqs(struct pingpong_context *ctx, struct perftest_parameters *user_pa
19071904 if (dct_only )
19081905 tx_buffer_depth = user_param -> rx_depth ;
19091906
1910- if ((user_param -> connection_type == DC && !dct_only )
1911- || (user_param -> verb == SEND || user_param -> verb == SEND_IMM || user_param -> verb == WRITE_IMM ))
1907+ if ((user_param -> connection_type == DC && !dct_only ) || has_recv_comp (user_param -> verb ))
19121908 need_recv_cq = 1 ;
19131909
19141910 ret = create_reg_cqs (ctx , user_param , tx_buffer_depth , need_recv_cq );
@@ -2776,8 +2772,7 @@ xrcd: __attribute__((unused))
27762772cqs :
27772773 ibv_destroy_cq (ctx -> send_cq );
27782774
2779- if ((user_param -> verb == SEND || user_param -> verb == SEND_IMM || user_param -> verb == WRITE_IMM )
2780- || (user_param -> connection_type == DC && !dct_only )){
2775+ if (has_recv_comp (user_param -> verb ) || (user_param -> connection_type == DC && !dct_only )) {
27812776 ibv_destroy_cq (ctx -> recv_cq );
27822777 }
27832778
@@ -2931,7 +2926,7 @@ struct ibv_qp* ctx_qp_create(struct pingpong_context *ctx,
29312926 #endif
29322927
29332928 attr .send_cq = ctx -> send_cq ;
2934- attr .recv_cq = (user_param -> verb == SEND || user_param -> verb == SEND_IMM || user_param -> verb == WRITE_IMM ) ? ctx -> recv_cq : ctx -> send_cq ;
2929+ attr .recv_cq = has_recv_comp (user_param -> verb ) ? ctx -> recv_cq : ctx -> send_cq ;
29352930
29362931 is_dc_server_side = ((!(user_param -> duplex || user_param -> tst == LAT ) &&
29372932 (user_param -> machine == SERVER )) ||
@@ -5111,7 +5106,7 @@ int run_iter_bw_infinitely(struct pingpong_context *ctx,struct perftest_paramete
51115106 return FAILURE ;
51125107 }
51135108
5114- if (!user_param -> duplex && user_param -> verb != WRITE_IMM && user_param -> verb != SEND && user_param -> verb != SEND_IMM ) {
5109+ if (!user_param -> duplex && ! has_recv_comp ( user_param -> verb ) ) {
51155110 signal (SIGINT , handle_sigint );
51165111 }
51175112
0 commit comments