include/ccKVS/inline_util.h
static inline bool check_broadcast_credits(uint8_t credits[][MACHINE_NUM], struct hrd_ctrl_blk* cb, struct ibv_wc* credit_wc,
										   uint32_t* credit_debug_cnt, uint16_t vc, int protocol)
{
	uint16_t enough_credits = 1, poll_for_credits = 0, j;
	for (j = 0; j < MACHINE_NUM; j++) {
		if (j == machine_id) continue; // skip the local machine
		if (credits[vc][j] == 0) {
			poll_for_credits = 1;
			break;
		}
	}
	if (poll_for_credits == 1)
		poll_credits(cb->dgram_recv_cq[FC_UD_QP_ID], credit_wc, credits, protocol);
	// We polled for credits, if we did not find enough just break
	for (j = 0; j < MACHINE_NUM; j++) {
		if (j == machine_id) continue; // skip the local machine
		if (credits[vc][j] == 0) {
			(*credit_debug_cnt)++;
			return false;
		}
	}
	*credit_debug_cnt = 0;
	return true;
}
//Checks if there are enough credits to perform a broadcast -- protocol independent
Checks if there are enough credits to perform a broadcast -- protocol independent
Checks if there are enough credits to perform a broadcast -- protocol independent
static inline bool check_broadcast_credits(uint8_t credits[][MACHINE_NUM], struct hrd_ctrl_blk* cb, struct ibv_wc* credit_wc,
										   uint32_t* credit_debug_cnt, uint16_t vc, int protocol)
{
	uint16_t enough_credits = 1, poll_for_credits = 0, j;
	for (j = 0; j < MACHINE_NUM; j++) {
		if (j == machine_id) continue; 
		if (credits[vc][j] == 0) {
			poll_for_credits = 1;
			break;
		}
	}
	if (poll_for_credits == 1)
		poll_credits(cb->dgram_recv_cq[FC_UD_QP_ID], credit_wc, credits, protocol);
	for (j = 0; j < MACHINE_NUM; j++) {
		if (j == machine_id) continue; 
		if (credits[vc][j] == 0) {
			(*credit_debug_cnt)++;
			return false;
		}
	}
	*credit_debug_cnt = 0;
	return true;
}
static inline bool check_broadcast_credits ( uint8_t credits [ ] [ MACHINE_NUM ] , struct hrd_ctrl_blk * cb , struct ibv_wc * credit_wc , uint32_t * credit_debug_cnt , uint16_t vc , int protocol ) { uint16_t enough_credits = 1 , poll_for_credits = 0 , j ; for ( j = 0 ; j < MACHINE_NUM ; j ++ ) { if ( j == machine_id ) continue ; if ( credits [ vc ] [ j ] == 0 ) { poll_for_credits = 1 ; break ; } } if ( poll_for_credits == 1 ) poll_credits ( cb -> dgram_recv_cq [ FC_UD_QP_ID ] , credit_wc , credits , protocol ) ; for ( j = 0 ; j < MACHINE_NUM ; j ++ ) { if ( j == machine_id ) continue ; if ( credits [ vc ] [ j ] == 0 ) { ( * credit_debug_cnt ) ++ ; return false ; } } * credit_debug_cnt = 0 ; return true ; }
Checks if there are enough credits to perform a broadcast -- protocol independent
Checks if there are enough credits to perform a broadcast -- protocol independent
// skip the local machine // We polled for credits, if we did not find enough just break // skip the local machine