📄 ixatmdrxcfgif.c
字号:
aalServiceType, rxQueueId, userId, rxCallback, minimumQueueSize, connIdPtr, npeVcIdPtr); } if (returnStatus == IX_SUCCESS) { /* increment statistics */ ixAtmdAccRxStats.connectCount++; } else { /* increment statistics */ ixAtmdAccRxStats.connectDenied++; } /* end of if-else(returnStatus) */ IX_ATMDACC_RX_UNLOCK (); return returnStatus;}/* ---------------------------------------------------------* rx start*/PUBLIC IX_STATUSixAtmdAccRxVcEnable (IxAtmConnId connId){ IX_STATUS returnStatus = IX_FAIL; unsigned int npeVcId = 0; /* if we have not been initialised no point * in continuing */ if(ixAtmdAccRxCfgInitDone) { IX_ATMDACC_RX_LOCK (); /* check the connId and retrieve the channel id */ if(ixAtmdAccRxCfgNpeVcIdGet (connId, &npeVcId) == IX_SUCCESS) { /* check if there is a disconnect in progress */ if(!ixAtmdAccRxCfgVcIsDisconnecting (npeVcId)) { /* check if the VC is already disabled */ if(ixAtmdAccRxCfgVcIsDisabled (npeVcId)) { /* Rx is Disabled so we enable it */ ixAtmdAccRxCfgVcEnable (npeVcId); returnStatus = ixAtmdAccRxCfgNpeVcLookupTableUpdate(npeVcId); if (returnStatus != IX_SUCCESS) { /* rollback on failure */ ixAtmdAccRxCfgVcEnableRollback (npeVcId); } } else { /* check if the VC is already enabled */ if(ixAtmdAccRxCfgVcIsEnabled (npeVcId)) { /* Rx is already enabled */ returnStatus = IX_ATMDACC_WARNING; } else { /* Rx is not enabled (disable is pending) */ returnStatus = IX_FAIL; } /* end of if-else(ixAtmdAccRxCfgVcIsEnabled) */ } /* end of if-else(ixAtmdAccRxCfgVcIsDisabled) */ } else { /* Rx is disconnecting */ returnStatus = IX_FAIL; } } IX_ATMDACC_RX_UNLOCK (); } return returnStatus;}/* ---------------------------------------------------------* rx stop*/PUBLIC IX_STATUSixAtmdAccRxVcDisable (IxAtmConnId connId){ IX_STATUS returnStatus = IX_FAIL; unsigned int npeVcId = 0; /* if we have not been initialised no point * in continuing */ if(ixAtmdAccRxCfgInitDone) { IX_ATMDACC_RX_LOCK (); /* check the connId and retrieve the channel id */ if(ixAtmdAccRxCfgNpeVcIdGet (connId, &npeVcId) == IX_SUCCESS) { if(ixAtmdAccRxCfgVcIsEnabled(npeVcId)) { /* Rx is enabled so initiate disabling */ ixAtmdAccRxCfgVcDisable (npeVcId); returnStatus = ixAtmdAccUtilNpeMsgSend(IX_NPE_A_MSSG_ATM_RX_DISABLE, npeVcId, NPE_IGNORE); if (returnStatus != IX_SUCCESS) { /* rollback on failure */ ixAtmdAccRxCfgVcEnable (npeVcId); } } else { /* Rx is already disabled or disabled pending */ returnStatus = IX_ATMDACC_WARNING; } /* end of if-else(ixAtmdAccRxCfgVcIsEnabled) */ } IX_ATMDACC_RX_UNLOCK (); } return returnStatus;}/* ---------------------------------------------------------* rx disconnect*/PUBLIC IX_STATUSixAtmdAccRxVcTryDisconnect (IxAtmConnId connId){ IX_STATUS returnStatus = IX_FAIL; unsigned int npeVcId = 0; /* if we have not been initialised no point * in continuing */ if(ixAtmdAccRxCfgInitDone) { IX_ATMDACC_RX_LOCK (); /* check the connId and retrieve the channel id */ if(ixAtmdAccRxCfgNpeVcIdGet (connId, &npeVcId) == IX_SUCCESS) { /* we must be disabled before a disconnect is allowed */ if(ixAtmdAccRxCfgVcIsDisabled (npeVcId)) { /* invalidate the internal connId */ returnStatus = ixAtmdAccRxCfgConnIdInvalidate (npeVcId); if (returnStatus == IX_SUCCESS) { /* disable the interrupts for this queue */ returnStatus = ixAtmdAccRxCfgRxFreeCallbackDisable (npeVcId); } if (returnStatus == IX_SUCCESS) { /* check if resources are still allocated */ returnStatus = ixAtmdAccRxCfgResourcesRelease (npeVcId); } if (returnStatus == IX_SUCCESS) { /* reset internal data */ returnStatus = ixAtmdAccRxCfgChannelReset (npeVcId); } } else { /* Rx has not been disabled, or has not completed */ returnStatus = IX_ATMDACC_RESOURCES_STILL_ALLOCATED; } /* end of if-else(returnStatus) */ } if (returnStatus == IX_SUCCESS) { /* increment statistics */ ixAtmdAccRxStats.disconnectCount++; } else { ixAtmdAccRxStats.disconnectDenied++; } /* end of if-else(returnStatus) */ IX_ATMDACC_RX_UNLOCK (); } return returnStatus;}/* ---------------------------------------------------------* rx free threshold set*/PUBLIC IX_STATUSixAtmdAccRxVcFreeLowCallbackRegister (IxAtmConnId connId, unsigned int mbufNumber, IxAtmdAccRxVcFreeLowCallback callback){ IX_STATUS returnStatus = IX_FAIL; unsigned int npeVcId = 0; /* we have not been initialised no point * in continuing */ if(ixAtmdAccRxCfgInitDone) { IX_ATMDACC_RX_LOCK (); if(callback != NULL) { /* check the connId and retrieve the channel id */ if(ixAtmdAccRxCfgNpeVcIdGet (connId, &npeVcId) == IX_SUCCESS) { /* we only allow callbacks to be set when idle */ if(ixAtmdAccRxCfgVcIsDisabled(npeVcId)) { returnStatus = ixAtmdAccRxCfgRxFreeCallbackSet (npeVcId, mbufNumber, callback); } } } if(returnStatus != IX_SUCCESS) { /* increment error counter */ ixAtmdAccRxStats.rxFreeThresholdSetErrorCount++; } IX_ATMDACC_RX_UNLOCK (); } return returnStatus;}/* ---------------------------------------------------------* rx notification set*/PUBLIC IX_STATUSixAtmdAccRxDispatcherRegister (IxAtmRxQueueId atmdQueueId, IxAtmdAccRxDispatcher callback){ IX_STATUS returnStatus = IX_FAIL; IxQMgrQId qMgrQueueId; /* we have not been initialised no point * in continuing */ if(ixAtmdAccRxCfgInitDone) { IX_ATMDACC_RX_LOCK (); /* the call back must be valid, * no Vcs must exist yet, and the atmdQueueId * must convert to valid QmgrQueueId */ if ((callback != NULL) && (!ixAtmdAccRxCfgRxVcsExist ()) && (ixAtmdAccUtilQmgrQIdGet (atmdQueueId, &qMgrQueueId) == IX_SUCCESS)) { /* set the callback */ returnStatus = ixAtmdAccRxCfgRxCallbackSet (atmdQueueId, qMgrQueueId, callback); } if (returnStatus != IX_SUCCESS) { /* increment error counter */ ixAtmdAccRxStats.rxNotificationSetErrorCount++; } IX_ATMDACC_RX_UNLOCK (); } return returnStatus;}/* ---------------------------------------------------------* rx notification reset*/PUBLIC IX_STATUSixAtmdAccRxDispatcherUnregister (IxAtmRxQueueId atmdQueueId){ IX_STATUS returnStatus = IX_FAIL; IxQMgrQId qMgrQueueId; /* we have not been initialised no point in continuing */ if (ixAtmdAccRxCfgInitDone) { IX_ATMDACC_RX_LOCK (); /* the call back must be valid, * no Vcs must exist yet, and the atmdQueueId * must convert to valid QmgrQueueId */ if (ixAtmdAccUtilQmgrQIdGet (atmdQueueId, &qMgrQueueId) == IX_SUCCESS) { /* set the callback */ returnStatus = ixAtmdAccRxCfgRxCallbackReset (atmdQueueId,qMgrQueueId); } IX_ATMDACC_RX_UNLOCK (); } return returnStatus;}/* ----------------------------------------------------* get the Rx Queue size*/PUBLIC IX_STATUSixAtmdAccRxQueueSizeQuery (IxAtmRxQueueId atmdQueueId, unsigned int *numberOfPdusPtr){ IX_STATUS returnStatus; IxQMgrQId qMgrQueueId; /* check parameters */ if (numberOfPdusPtr == NULL) { returnStatus = IX_FAIL; } else { /* convert amd check input parameter */ returnStatus = ixAtmdAccUtilQmgrQIdGet (atmdQueueId, &qMgrQueueId); } /* end of if-else(numberOfPdusPtr) */ if (returnStatus == IX_SUCCESS) { /* read the queue size */ returnStatus = ixAtmdAccUtilQueueSizeQuery (qMgrQueueId, numberOfPdusPtr); } return returnStatus;}/* -----------------------------------------------------* display rx configuration*/voidixAtmdAccRxCfgIfChannelShow (IxAtmLogicalPort port){ if(ixAtmdAccRxCfgInitDone) { IX_ATMDACC_RX_LOCK (); ixAtmdAccRxCfgInfoChannelShow (port); IX_ATMDACC_RX_UNLOCK (); } }/* ---------------------------------------------------------* internal display*/voidixAtmdAccRxCfgIfStatsShow (void){ IxAtmdAccRxStats statsSnapshot; /* get a snapshort */ IX_ATMDACC_RX_LOCK (); statsSnapshot = ixAtmdAccRxStats; IX_ATMDACC_RX_UNLOCK (); printf ("AtmdRx\n"); printf ("Rx Connect ok ............................. : %10u\n", statsSnapshot.connectCount); printf ("Rx Disconnect ok .......................... : %10u\n", statsSnapshot.disconnectCount); printf ("Rx Connect denied ......................... : %10u (should be 0)\n", statsSnapshot.connectDenied); printf ("Rx Disconnect denied ...................... : %10u\n", statsSnapshot.disconnectDenied); printf ("Rx NotificationSet errors ................. : %10u (should be 0)\n", statsSnapshot.rxNotificationSetErrorCount); printf ("Rx Free ThresholdSet errors ............... : %10u (should be 0)\n", statsSnapshot.rxFreeThresholdSetErrorCount); ixAtmdAccRxCfgInfoStatsShow ();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -