Beispiel #1
0
/****************************************************************************
  Name          : cpa_mds_callback
 
  Description   : This callback routine will be called by MDS on event arrival
 
  Arguments     : info - pointer to the mds callback info
 
  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 
  Notes         : None.
******************************************************************************/
uns32 cpa_mds_callback(struct ncsmds_callback_info *info)
{
	CPA_CB *cpa_cb = NULL;
	uns32 rc = NCSCC_RC_FAILURE;

	if (info == NULL)
		return rc;

	cpa_cb = (CPA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_CPA, gl_cpa_hdl);

	if (!cpa_cb) {
		m_LOG_CPA_CCLL(CPA_PROC_FAILED, NCSFL_LC_CKPT_MGMT, NCSFL_SEV_ERROR, "mds_callback:HDL_TAKE", __FILE__,
			       __LINE__, rc);
		return m_LEAP_DBG_SINK(rc);
	}

	switch (info->i_op) {
	case MDS_CALLBACK_COPY:
		rc = NCSCC_RC_FAILURE;
		break;

	case MDS_CALLBACK_ENC_FLAT:
		rc = cpa_mds_enc_flat(cpa_cb, &info->info.enc_flat);
		break;

	case MDS_CALLBACK_DEC_FLAT:
		rc = cpa_mds_dec_flat(cpa_cb, &info->info.dec_flat);
		break;
	case MDS_CALLBACK_RECEIVE:
		rc = cpa_mds_rcv(cpa_cb, &info->info.receive);
		break;

	case MDS_CALLBACK_SVC_EVENT:
		rc = cpa_mds_svc_evt(cpa_cb, &info->info.svc_evt);
		break;

	case MDS_CALLBACK_ENC:
		rc = cpa_mds_enc(cpa_cb, &info->info.enc);
		break;

	case MDS_CALLBACK_DEC:
		rc = cpa_mds_dec(cpa_cb, &info->info.dec);
		break;

	default:
		m_LOG_CPA_CCLL(CPA_PROC_FAILED, NCSFL_LC_CKPT_MGMT, NCSFL_SEV_INFO, "mds_callback:unknown_op", __FILE__,
			       __LINE__, rc);
		break;
	}

	if (rc != NCSCC_RC_SUCCESS) {
		m_LOG_CPA_CCLL(CPA_PROC_FAILED, NCSFL_LC_CKPT_MGMT, NCSFL_SEV_INFO, "mds_callback", __FILE__, __LINE__,
			       rc);
	}

	ncshm_give_hdl(gl_cpa_hdl);

	return rc;
}
Beispiel #2
0
/****************************************************************************
  Name          : cpa_mds_callback
 
  Description   : This callback routine will be called by MDS on event arrival
 
  Arguments     : info - pointer to the mds callback info
 
  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
 
  Notes         : None.
******************************************************************************/
uint32_t cpa_mds_callback(struct ncsmds_callback_info *info)
{
	CPA_CB *cpa_cb = NULL;
	uint32_t rc = NCSCC_RC_FAILURE;
	
	TRACE_ENTER();
	if (info == NULL)
		return rc;

	cpa_cb = (CPA_CB *)ncshm_take_hdl(NCS_SERVICE_ID_CPA, gl_cpa_hdl);

	if (!cpa_cb) 
		goto done;

	switch (info->i_op) {
	case MDS_CALLBACK_COPY:
		rc = NCSCC_RC_FAILURE;
		break;

	case MDS_CALLBACK_ENC_FLAT:
		rc = cpa_mds_enc_flat(cpa_cb, &info->info.enc_flat);
		if (NCSCC_RC_SUCCESS != rc)
			TRACE_4("MDS flat encode callback failed");
		else
			TRACE_1("MDS flat encode callback success");
		break;

	case MDS_CALLBACK_DEC_FLAT:
		rc = cpa_mds_dec_flat(cpa_cb, &info->info.dec_flat);
		if (NCSCC_RC_SUCCESS != rc)
			TRACE_4("MDS flat decode callback failed");
		else
			TRACE_1("MDS flat decode callback success");
		break;
	case MDS_CALLBACK_RECEIVE:
		rc = cpa_mds_rcv(cpa_cb, &info->info.receive);
		if (NCSCC_RC_SUCCESS != rc)
			TRACE_4("MDS receive callback failed");
		else
			TRACE_1("MDS receive callback success");
		break;

	case MDS_CALLBACK_SVC_EVENT:
		rc = cpa_mds_svc_evt(cpa_cb, &info->info.svc_evt);
		if (NCSCC_RC_SUCCESS != rc)
			TRACE_4("MDS service event callback failed");
		else
			TRACE_1("MDS service event callback success");
		break;

	case MDS_CALLBACK_ENC:
		rc = cpa_mds_enc(cpa_cb, &info->info.enc);
		if (NCSCC_RC_SUCCESS != rc)
			TRACE_4("MDS encode callback failed");
		else
			TRACE_1("MDS encode callback success");
		break;

	case MDS_CALLBACK_DEC:
		rc = cpa_mds_dec(cpa_cb, &info->info.dec);
		if (NCSCC_RC_SUCCESS != rc)
			TRACE_4("MDS decode callback failed");
		else
			TRACE_1("MDS decode callback success");
		break;

	default:
		TRACE_4("CPA mds_callback:unknown_op");
		break;
	}

done:
        /* return ava cb */
        if (cpa_cb)
		ncshm_give_hdl(gl_cpa_hdl);

	TRACE_LEAVE();


	return rc;
}