include/ccKVS/inline_util.h
static inline void forge_bcast_wrs_SC(uint16_t op_i, struct extended_cache_op *ops, struct hrd_ctrl_blk *cb,
									  struct ibv_sge *coh_send_sgl, struct ibv_send_wr *coh_send_wr,
									  struct mica_op *coh_buf, uint16_t *coh_buf_i, long long *br_tx,
									  uint16_t local_client_id, uint16_t br_i)
{
	struct ibv_wc signal_send_wc;
	c_stats[local_client_id].updates_per_client++;
	// Do a Signaled Send every BROADCAST_SS_BATCH broadcasts (BROADCAST_SS_BATCH * (MACHINE_NUM - 1) messages)
	if ((*br_tx) % BROADCAST_SS_BATCH == 0) {
		coh_send_wr[0].send_flags |= IBV_SEND_SIGNALED;
	}
	(*br_tx)++;
	if((*br_tx) % BROADCAST_SS_BATCH == BROADCAST_SS_BATCH - 1) {
		// printf("polling for broadcast send completions\n" );
		hrd_poll_cq(cb->dgram_send_cq[BROADCAST_UD_QP_ID], 1, &signal_send_wc);
		// printf("Client %d polling br_tx = %llu\n", clt_gid, (*br_tx) );
	}
	ops[op_i].opcode = CACHE_OP_UPD;
	if (CLIENT_ENABLE_INLINING == 1)	coh_send_sgl[br_i].addr = (uint64_t) (uintptr_t) (ops + op_i);
	if (CLIENT_ENABLE_INLINING == 0) {
		if (ENABLE_ASSERTIONS == 1) assert((*coh_buf_i)< COH_BUF_SLOTS);
		memcpy(coh_buf + (*coh_buf_i), ops + op_i, HERD_PUT_REQ_SIZE);
		coh_send_sgl[br_i].addr = (uint64_t) (uintptr_t) (coh_buf + (*coh_buf_i));
		MOD_ADD_WITH_BASE((*coh_buf_i), COH_BUF_SLOTS, 0);
	} // when not inlining ops cannot be used, as the pointer will shift in the next iteration
	// if (machine_id == 1); green_printf("CLIENT %d : I send Broadcast, opcode: %d credits: %d, (*br_tx) %llu, tag %d \n",
	// 		clt_gid, ops[op_i].opcode, credits[SC_UPD_VC][(machine_id + 1) % MACHINE_NUM], (*br_tx), ops[op_i].key.tag);
	if (br_i > 0)
		coh_send_wr[(br_i * MESSAGES_IN_BCAST) - 1].next = &coh_send_wr[br_i * MESSAGES_IN_BCAST];
}
// Form Broadcast work requests specifically for SC
Form Broadcast work requests specifically for SC
Form Broadcast work requests specifically for SC
static inline void forge_bcast_wrs_SC(uint16_t op_i, struct extended_cache_op *ops, struct hrd_ctrl_blk *cb,
									  struct ibv_sge *coh_send_sgl, struct ibv_send_wr *coh_send_wr,
									  struct mica_op *coh_buf, uint16_t *coh_buf_i, long long *br_tx,
									  uint16_t local_client_id, uint16_t br_i)
{
	struct ibv_wc signal_send_wc;
	c_stats[local_client_id].updates_per_client++;
	if ((*br_tx) % BROADCAST_SS_BATCH == 0) {
		coh_send_wr[0].send_flags |= IBV_SEND_SIGNALED;
	}
	(*br_tx)++;
	if((*br_tx) % BROADCAST_SS_BATCH == BROADCAST_SS_BATCH - 1) {
		hrd_poll_cq(cb->dgram_send_cq[BROADCAST_UD_QP_ID], 1, &signal_send_wc);
	}
	ops[op_i].opcode = CACHE_OP_UPD;
	if (CLIENT_ENABLE_INLINING == 1)	coh_send_sgl[br_i].addr = (uint64_t) (uintptr_t) (ops + op_i);
	if (CLIENT_ENABLE_INLINING == 0) {
		if (ENABLE_ASSERTIONS == 1) assert((*coh_buf_i)< COH_BUF_SLOTS);
		memcpy(coh_buf + (*coh_buf_i), ops + op_i, HERD_PUT_REQ_SIZE);
		coh_send_sgl[br_i].addr = (uint64_t) (uintptr_t) (coh_buf + (*coh_buf_i));
		MOD_ADD_WITH_BASE((*coh_buf_i), COH_BUF_SLOTS, 0);
	} 
	if (br_i > 0)
		coh_send_wr[(br_i * MESSAGES_IN_BCAST) - 1].next = &coh_send_wr[br_i * MESSAGES_IN_BCAST];
}
static inline void forge_bcast_wrs_SC ( uint16_t op_i , struct extended_cache_op * ops , struct hrd_ctrl_blk * cb , struct ibv_sge * coh_send_sgl , struct ibv_send_wr * coh_send_wr , struct mica_op * coh_buf , uint16_t * coh_buf_i , long long * br_tx , uint16_t local_client_id , uint16_t br_i ) { struct ibv_wc signal_send_wc ; c_stats [ local_client_id ] . updates_per_client ++ ; if ( ( * br_tx ) % BROADCAST_SS_BATCH == 0 ) { coh_send_wr [ 0 ] . send_flags |= IBV_SEND_SIGNALED ; } ( * br_tx ) ++ ; if ( ( * br_tx ) % BROADCAST_SS_BATCH == BROADCAST_SS_BATCH - 1 ) { hrd_poll_cq ( cb -> dgram_send_cq [ BROADCAST_UD_QP_ID ] , 1 , & signal_send_wc ) ; } ops [ op_i ] . opcode = CACHE_OP_UPD ; if ( CLIENT_ENABLE_INLINING == 1 ) coh_send_sgl [ br_i ] . addr = ( uint64_t ) ( uintptr_t ) ( ops + op_i ) ; if ( CLIENT_ENABLE_INLINING == 0 ) { if ( ENABLE_ASSERTIONS == 1 ) assert ( ( * coh_buf_i ) < COH_BUF_SLOTS ) ; memcpy ( coh_buf + ( * coh_buf_i ) , ops + op_i , HERD_PUT_REQ_SIZE ) ; coh_send_sgl [ br_i ] . addr = ( uint64_t ) ( uintptr_t ) ( coh_buf + ( * coh_buf_i ) ) ; MOD_ADD_WITH_BASE ( ( * coh_buf_i ) , COH_BUF_SLOTS , 0 ) ; } if ( br_i > 0 ) coh_send_wr [ ( br_i * MESSAGES_IN_BCAST ) - 1 ] . next = & coh_send_wr [ br_i * MESSAGES_IN_BCAST ] ; }
Form Broadcast work requests specifically for SC
Form Broadcast work requests specifically for SC
// Do a Signaled Send every BROADCAST_SS_BATCH broadcasts (BROADCAST_SS_BATCH * (MACHINE_NUM - 1) messages) // printf("polling for broadcast send completions\n" ); // printf("Client %d polling br_tx = %llu\n", clt_gid, (*br_tx) ); // when not inlining ops cannot be used, as the pointer will shift in the next iteration // if (machine_id == 1); green_printf("CLIENT %d : I send Broadcast, opcode: %d credits: %d, (*br_tx) %llu, tag %d \n", // 		clt_gid, ops[op_i].opcode, credits[SC_UPD_VC][(machine_id + 1) % MACHINE_NUM], (*br_tx), ops[op_i].key.tag);