Ejemplo n.º 1
0
uns32 avd_post_amfd_switch_role_change_evt(AVD_CL_CB *cb, SaAmfHAStateT role)
{
	uns32 rc = NCSCC_RC_SUCCESS;
	AVD_EVT *evt;

	evt = malloc(sizeof(AVD_EVT));
	assert(evt);
	evt->rcv_evt = AVD_EVT_ROLE_CHANGE;
	evt->info.avd_msg = malloc(sizeof(AVD_D2D_MSG));
	evt->info.avd_msg->msg_type = AVD_D2D_CHANGE_ROLE_REQ;
	evt->info.avd_msg->msg_info.d2d_chg_role_req.cause = AVD_SWITCH_OVER;
	evt->info.avd_msg->msg_info.d2d_chg_role_req.role =  role; 

	rc = ncs_ipc_send(&avd_cb->avd_mbx, (NCS_IPC_MSG *)evt, MDS_SEND_PRIORITY_HIGH);
	assert(rc == NCSCC_RC_SUCCESS);
	return rc;
}
Ejemplo n.º 2
0
static int mbx_send(RDE_MSG_TYPE type, MDS_DEST fr_dest, NODE_ID fr_node_id)
{
	uns32 rc = NCSCC_RC_SUCCESS;
	struct rde_msg *msg = calloc(1, sizeof(struct rde_msg));
	RDE_CONTROL_BLOCK *cb = rde_get_control_block();

	msg->type = type;
	msg->fr_dest = fr_dest;
	msg->fr_node_id = fr_node_id;

	if (ncs_ipc_send(&cb->mbx, (NCS_IPC_MSG *)msg, NCS_IPC_PRIORITY_HIGH) != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_ipc_send FAILED");
		free(msg);
		rc = NCSCC_RC_FAILURE;
	}

	return rc;
}
Ejemplo n.º 3
0
/**
 * Callback from RDA. Post a message/event to the clms mailbox.
 * @param cb_hdl
 * @param cb_info
 * @param error_code
 */
static void rda_cb(uint32_t cb_hdl, PCS_RDA_CB_INFO *cb_info, PCSRDA_RETURN_CODE error_code)
{
	uint32_t rc;
	CLMSV_CLMS_EVT *evt = NULL;

	TRACE_ENTER();

	evt = calloc(1, sizeof(CLMSV_CLMS_EVT));
	if (NULL == evt) {
		LOG_ER("calloc failed");
		goto done;
	}

	evt->type = CLMSV_CLMS_RDA_EVT;
	evt->info.rda_info.io_role = cb_info->info.io_role;

	rc = ncs_ipc_send(&clms_cb->mbx, (NCS_IPC_MSG *)evt, MDS_SEND_PRIORITY_HIGH);
	if (rc != NCSCC_RC_SUCCESS)
		LOG_ER("IPC send failed %d", rc);

 done:
	TRACE_LEAVE();
}
Ejemplo n.º 4
0
/**
 * Callback from RDA. Post a message/event to the IMMD mailbox.
 * @param cb_hdl
 * @param cb_info
 * @param error_code
 */
static void rda_cb(uns32 cb_hdl, PCS_RDA_CB_INFO *cb_info, PCSRDA_RETURN_CODE error_code)
{
	uns32 rc;
	IMMSV_EVT *evt;

	TRACE_ENTER();

	evt = calloc(1, sizeof(IMMSV_EVT));
	if (NULL == evt) {
		LOG_ER("calloc failed");
		goto done;
	}

	evt->type = IMMSV_EVT_TYPE_IMMD;
	evt->info.immd.type = IMMD_EVT_LGA_CB;
	evt->info.immd.info.rda_info.io_role = cb_info->info.io_role;

	rc = ncs_ipc_send(&immd_cb->mbx, (NCS_IPC_MSG *)evt, MDS_SEND_PRIORITY_HIGH);
	if (rc != NCSCC_RC_SUCCESS)
		LOG_ER("IPC send failed %d", rc);

done:
	TRACE_LEAVE();
}
Ejemplo n.º 5
0
static uns32 mds_callback(struct ncsmds_callback_info *info)
{
	struct rde_msg *msg;
	uns32 rc = NCSCC_RC_SUCCESS;
	RDE_CONTROL_BLOCK *cb = rde_get_control_block();

	switch (info->i_op) {
	case MDS_CALLBACK_COPY:
		rc = NCSCC_RC_FAILURE;
		break;
	case MDS_CALLBACK_ENC:
		rc = msg_encode(&info->info.enc);
		break;
	case MDS_CALLBACK_DEC:
		rc = msg_decode(&info->info.dec);
		break;
	case MDS_CALLBACK_ENC_FLAT:
		break;
	case MDS_CALLBACK_DEC_FLAT:
		break;
	case MDS_CALLBACK_RECEIVE:
		if (!peer_dest) {
			/* Sometimes a message from peer is received before MDS_UP, simulate MDS_UP */
			TRACE("generating up msg from rec event!");
			rc = mbx_send(RDE_MSG_PEER_UP, info->info.receive.i_fr_dest, info->info.receive.i_node_id);
		}

		msg = (struct rde_msg*)info->info.receive.i_msg;
		msg->fr_dest = info->info.receive.i_fr_dest;
		msg->fr_node_id = info->info.receive.i_node_id;
		if (ncs_ipc_send(&cb->mbx, (NCS_IPC_MSG *)info->info.receive.i_msg, NCS_IPC_PRIORITY_NORMAL) != NCSCC_RC_SUCCESS) {
			LOG_ER("ncs_ipc_send FAILED");
			free(msg);
			rc = NCSCC_RC_FAILURE;
			goto done;
		}
		break;
	case MDS_CALLBACK_SVC_EVENT:
		if (rde_my_node_id == info->info.svc_evt.i_node_id)
			goto done;

		if (info->info.svc_evt.i_change == NCSMDS_DOWN) {
			TRACE("MDS DOWN dest: %llx, node ID: %x, svc_id: %d",
				info->info.svc_evt.i_dest, info->info.svc_evt.i_node_id, info->info.svc_evt.i_svc_id);
			peer_dest = 0;
			rc = mbx_send(RDE_MSG_PEER_DOWN, info->info.svc_evt.i_dest, info->info.svc_evt.i_node_id);
		} else if (info->info.svc_evt.i_change == NCSMDS_UP) {
			TRACE("MDS UP dest: %llx, node ID: %x, svc_id: %d",
				info->info.svc_evt.i_dest, info->info.svc_evt.i_node_id, info->info.svc_evt.i_svc_id);
			peer_dest = info->info.svc_evt.i_dest;
			rc = mbx_send(RDE_MSG_PEER_UP, info->info.svc_evt.i_dest, info->info.svc_evt.i_node_id);
		} else {
			TRACE("MDS %u dest: %llx, node ID: %x, svc_id: %d", info->info.svc_evt.i_change,
				info->info.svc_evt.i_dest, info->info.svc_evt.i_node_id, info->info.svc_evt.i_svc_id);
		}

		break;
	case MDS_CALLBACK_QUIESCED_ACK:
		break;
	case MDS_CALLBACK_DIRECT_RECEIVE:
		break;
	default:
		break;
	}
done:
	return rc;
}