include/ccKVS/inline_util.h
static inline void post_recvs_and_send(uint16_t recv_counter, uint16_t message_send_counter, struct ibv_send_wr* send_wr,
									   struct ibv_recv_wr* recv_wr, struct ibv_qp* send_qp, struct ibv_qp* recv_qp, uint32_t MAX_RECVS,
									   uint32_t MAX_SENDS)
{
	uint16_t j;
	int ret;
	struct ibv_send_wr *bad_send_wr;
	struct ibv_recv_wr *bad_recv_wr;
	if (recv_counter > 0) { // Must post receives for credits
		if (ENABLE_ASSERTIONS == 1) assert (recv_counter <= MAX_RECVS);
		for (j = 0; j < recv_counter; j++) {
			recv_wr[j].next = (j == recv_counter - 1) ?	NULL : &recv_wr[j + 1];
		}
		ret = ibv_post_recv(recv_qp, &recv_wr[0], &bad_recv_wr);
		CPE(ret, "ibv_post_recv error: posting recvs in generic function ", ret);
	}
	// Batch the messages to the NIC
	if (message_send_counter > 0) {
		if (ENABLE_ASSERTIONS == 1) assert (recv_counter <= MAX_SENDS);
		send_wr[message_send_counter - 1].next = NULL;
		ret = ibv_post_send(send_qp, &send_wr[0], &bad_send_wr);
		CPE(ret, "ibv_post_send error in generic function", ret);
	}
}
// Post some receives and then send some messages
Post some receives and then send some messages
Post some receives and then send some messages
static inline void post_recvs_and_send(uint16_t recv_counter, uint16_t message_send_counter, struct ibv_send_wr* send_wr,
									   struct ibv_recv_wr* recv_wr, struct ibv_qp* send_qp, struct ibv_qp* recv_qp, uint32_t MAX_RECVS,
									   uint32_t MAX_SENDS)
{
	uint16_t j;
	int ret;
	struct ibv_send_wr *bad_send_wr;
	struct ibv_recv_wr *bad_recv_wr;
	if (recv_counter > 0) { 
		if (ENABLE_ASSERTIONS == 1) assert (recv_counter <= MAX_RECVS);
		for (j = 0; j < recv_counter; j++) {
			recv_wr[j].next = (j == recv_counter - 1) ?	NULL : &recv_wr[j + 1];
		}
		ret = ibv_post_recv(recv_qp, &recv_wr[0], &bad_recv_wr);
		CPE(ret, "ibv_post_recv error: posting recvs in generic function ", ret);
	}
	if (message_send_counter > 0) {
		if (ENABLE_ASSERTIONS == 1) assert (recv_counter <= MAX_SENDS);
		send_wr[message_send_counter - 1].next = NULL;
		ret = ibv_post_send(send_qp, &send_wr[0], &bad_send_wr);
		CPE(ret, "ibv_post_send error in generic function", ret);
	}
}
static inline void post_recvs_and_send ( uint16_t recv_counter , uint16_t message_send_counter , struct ibv_send_wr * send_wr , struct ibv_recv_wr * recv_wr , struct ibv_qp * send_qp , struct ibv_qp * recv_qp , uint32_t MAX_RECVS , uint32_t MAX_SENDS ) { uint16_t j ; int ret ; struct ibv_send_wr * bad_send_wr ; struct ibv_recv_wr * bad_recv_wr ; if ( recv_counter > 0 ) { if ( ENABLE_ASSERTIONS == 1 ) assert ( recv_counter <= MAX_RECVS ) ; for ( j = 0 ; j < recv_counter ; j ++ ) { recv_wr [ j ] . next = ( j == recv_counter - 1 ) ? NULL : & recv_wr [ j + 1 ] ; } ret = ibv_post_recv ( recv_qp , & recv_wr [ 0 ] , & bad_recv_wr ) ; CPE ( ret , " " , ret ) ; } if ( message_send_counter > 0 ) { if ( ENABLE_ASSERTIONS == 1 ) assert ( recv_counter <= MAX_SENDS ) ; send_wr [ message_send_counter - 1 ] . next = NULL ; ret = ibv_post_send ( send_qp , & send_wr [ 0 ] , & bad_send_wr ) ; CPE ( ret , " " , ret ) ; } }
Post some receives and then send some messages
Post some receives and then send some messages
// Must post receives for credits // Batch the messages to the NIC