コード例 #1
0
/**
 * @fn ixEthAccQMgrRxCallbacksRegister(IxQMgrCallback ixQMgrCallback)
 *
 * @brief Change the callback registered to all rx queues.
 *
 * @param IxQMgrCallback ixQMgrCallback[in] QMgr callback to register
 *
 * @return IxEthAccStatus
 *
 * @note The user may decide to use different Rx mechanisms
 * (e.g. receive many frames at the same time , or receive
 *  one frame at a time, depending on the overall application
 *  performances). A different QMgr callback is registered. This
 *  way, there is no excessive pointer checks in the datapath.
 *
 * @internal
 */
IX_ETH_ACC_PUBLIC
IxEthAccStatus ixEthAccQMgrRxCallbacksRegister(IxQMgrCallback ixQMgrCallback)
{
    IxEthAccQregInfo *qInfoDes;
    IxEthAccStatus ret = IX_ETH_ACC_SUCCESS;

    /* parameter check */
    if (NULL == ixQMgrCallback)
    {
	ret = IX_ETH_ACC_FAIL;
    }

    /* iterate thru rx queues */
    for (qInfoDes = ixEthAccQmgrRxQueuesInfo;
	 (qInfoDes->qCallback != (IxQMgrCallback) NULL )
	     && (ret == IX_ETH_ACC_SUCCESS);
	 ++qInfoDes)
    {
	/* register the rx callback for all queues */
	if (ixQMgrNotificationCallbackSet(qInfoDes->qId,
					     ixQMgrCallback,
					     qInfoDes->callbackTag
					     ) != IX_SUCCESS)
	{
	    ret = IX_ETH_ACC_FAIL;
	}
    }
    return(ret);
}
コード例 #2
0
/**
 * @fn ixEthAccQMgrQueueSetup(void)
 *
 * @brief Setup one queue and its event, and register the callback required
 * by this component to the QMgr
 *
 * @internal
 */
IX_ETH_ACC_PRIVATE IxEthAccStatus
ixEthAccQMgrQueueSetup(IxEthAccQregInfo *qInfoDes)
{
    /*
     * Configure each Q.
     */
    if ( ixQMgrQConfig( qInfoDes->qName,
			qInfoDes->qId,
			qInfoDes->qSize,
			qInfoDes->qWords) != IX_SUCCESS)
    {
	return IX_ETH_ACC_FAIL;
    }

    if ( ixQMgrWatermarkSet( qInfoDes->qId,
			     qInfoDes->AlmostEmptyThreshold,
			     qInfoDes->AlmostFullThreshold
			     ) != IX_SUCCESS)
    {
	return IX_ETH_ACC_FAIL;
    }

    /*
     * Set dispatcher priority.
     */
    if ( ixQMgrDispatcherPrioritySet( qInfoDes->qId,
				      IX_ETH_ACC_QM_QUEUE_DISPATCH_PRIORITY)
	 != IX_SUCCESS)
    {
	return IX_ETH_ACC_FAIL;
    }

    /*
     * Register callbacks for each Q.
     */
    if ( ixQMgrNotificationCallbackSet(qInfoDes->qId,
				       qInfoDes->qCallback,
				       qInfoDes->callbackTag)
	 != IX_SUCCESS )
    {
	return IX_ETH_ACC_FAIL;
    }

    /*
     * Set notification condition for Q
     */
    if ( qInfoDes->qNotificationEnableAtStartup == TRUE )
    {
	if (   ixQMgrNotificationEnable(qInfoDes->qId,
					qInfoDes->qConditionSource)
	       != IX_SUCCESS )
	{
	    return IX_ETH_ACC_FAIL;
	}
    }

    return(IX_ETH_ACC_SUCCESS);
}
コード例 #3
0
ファイル: IxCryptoAccQAccess.c プロジェクト: cilynx/dd-wrt
/**
 * @fn ixCryptoQAccessUninit
 * @brief Queue configuration uninitialisation function
 *
 */
IxCryptoAccStatus
ixCryptoQAccessUninit (void)
{
    UINT32 i;
    /* If the module has not been initialized */
    if (FALSE == initDone)
    {
        return IX_CRYPTO_ACC_STATUS_FAIL;
    } /* end of if (initDone) */

    for (i = startQueueIndex; i < endQueueIndex; i++)
    {
        if(IX_SUCCESS != ixQMgrNotificationDisable (queueInfo[i].qId))
        {
            IX_CRYPTO_ACC_LOG(
                IX_OSAL_LOG_LVL_ERROR,
                IX_OSAL_LOG_DEV_STDERR,
                "ixQMgrNotificationDisable Failed for %d Queue-ID\n",
                queueInfo[i].qId, 0, 0, 0, 0, 0);

            return IX_CRYPTO_ACC_STATUS_FAIL;
        }
        if(IX_SUCCESS != ixQMgrNotificationCallbackSet (
                                  queueInfo[i].qId,
                                  NULL,
                                  0))
        {
            IX_CRYPTO_ACC_LOG(
                IX_OSAL_LOG_LVL_ERROR,
                IX_OSAL_LOG_DEV_STDERR,
                "ixQMgrNotificationCallbackSet Failed for %d Queue-ID\n",
                queueInfo[i].qId, 0, 0, 0, 0, 0);

            return IX_CRYPTO_ACC_STATUS_FAIL;
        }
    }
    initDone = FALSE;
    return IX_CRYPTO_ACC_STATUS_SUCCESS;

} /* end of ixCryptoQAccessUninit () function */
コード例 #4
0
ファイル: IxHssAccPktRx.c プロジェクト: janfj/dd-wrt
/*
 * Function definition: ixHssAccPktRxUninit
 */
IX_STATUS
ixHssAccPktRxUninit (void)
{
    IX_STATUS        status = IX_SUCCESS;
    IxHssAccHssPort  hssPortIndex;
    IxHssAccHdlcPort hdlcPortIndex;
    UINT32           hssHdlcPortIdAsCbId;
    INT8             errorString[80];

    IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT,
                      "Entering ixHssAccPktRxUninit\n");

    for (hssPortIndex = IX_HSSACC_HSS_PORT_0;
         hssPortIndex < hssPortMax;
         hssPortIndex++)
    {  /* Disable notification for the HSS Port 0/1 Rx Q */
        status =  ixQMgrNotificationDisable (ixHssAccPktRxQId[hssPortIndex]);
        if (IX_SUCCESS != status)
        {
            sprintf ((char *)errorString, "ixHssAccPktRxUninit:"
                     "Notification disable for the HSS %d PktRx Q failed\n",
                     hssPortIndex);
            /* report the error */
            IX_HSSACC_REPORT_ERROR ((char *)errorString);
            /* return error */
            return IX_FAIL;
        }
        /* Set the callback for the HSS Port 0/1 Rx Q */
        status = ixQMgrNotificationCallbackSet (
            ixHssAccPktRxQId[hssPortIndex],
            NULL,
            hssPortIndex);
        if (IX_SUCCESS != status)
        {
            sprintf ((char *)errorString, "ixHssAccPktRxUninit:"
                     "Setting dummy callback for the HSS%d PktRx Q failed\n",
                     hssPortIndex);
            /* report the error */
            IX_HSSACC_REPORT_ERROR ((char *)errorString);
            /* return error */
            return IX_FAIL;
        }
    }
    /* Set the Callback for the RxFree Q  */
    for (hssPortIndex = IX_HSSACC_HSS_PORT_0;
         hssPortIndex < hssPortMax;
         hssPortIndex++)
    {
        for (hdlcPortIndex = IX_HSSACC_HDLC_PORT_0;
             hdlcPortIndex < IX_HSSACC_HDLC_PORT_MAX;
             hdlcPortIndex++)
        {
            hssHdlcPortIdAsCbId = (hssPortIndex << IX_HSSACC_PKT_CBID_HSS_OFFSET) |
                hdlcPortIndex;

            status = ixQMgrNotificationCallbackSet (
                ixHssAccPCMRxFreeQIdGet (hssPortIndex, hdlcPortIndex),
                NULL,
                hssHdlcPortIdAsCbId);

            if (IX_SUCCESS != status)
            {
                IX_HSSACC_REPORT_ERROR ("ixHssAccPktRxUninit:"
                                        "ixQMgrNotificationCallbackSet (dummy callback) failed\n");
                return IX_FAIL;
             }
        }
    }

    IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT,
                     "Exiting ixHssAccPktRxUninit\n");
    return status;
}
コード例 #5
0
ファイル: IxHssAccPktRx.c プロジェクト: janfj/dd-wrt
/**
 * Function definition: ixHssAccPktRxInit
 */
IX_STATUS 
ixHssAccPktRxInit (void)
{
    IX_STATUS status = IX_SUCCESS;
    IxHssAccHssPort hssPortIndex;
    IxHssAccHdlcPort hdlcPortIndex;
    unsigned hssHdlcPortIdAsCbId;

    IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT, 
		      "Entering ixHssAccPktRxInit\n");

    /* initialise stats */
    ixHssAccPktRxStatsInit ();

    /* Set the Callback for the RxFree Q for this client */
    for (hssPortIndex = IX_HSSACC_HSS_PORT_0; 
	 hssPortIndex < hssPortMax; 
	 hssPortIndex++)
    {
	for (hdlcPortIndex = IX_HSSACC_HDLC_PORT_0; 
	     hdlcPortIndex < IX_HSSACC_HDLC_PORT_MAX; 
	     hdlcPortIndex++)
	{
	    hssHdlcPortIdAsCbId = (hssPortIndex << IX_HSSACC_PKT_CBID_HSS_OFFSET) | 
		hdlcPortIndex;
	    
	    status = ixQMgrNotificationCallbackSet (
		ixHssAccPCMRxFreeQIdGet (hssPortIndex, hdlcPortIndex),
		ixHssAccPktRxFreeLowCallback,
		hssHdlcPortIdAsCbId);

	    if (status != IX_SUCCESS)
	    {
		IX_HSSACC_REPORT_ERROR ("ixHssAccPktRxInit:"
					"ixQMgrNotificationCallbackSet failed\n");
		return IX_FAIL;
	    }
	}
    }

    for (hssPortIndex = IX_HSSACC_HSS_PORT_0; 
	 hssPortIndex < hssPortMax; 
	 hssPortIndex++)
    {
        /* Set the callback for the HSS Port 0/1 Rx Q */
        status = ixQMgrNotificationCallbackSet (
	    ixHssAccPktRxQId[hssPortIndex],
	    ixHssAccPktRxCallback,
	    hssPortIndex);
        if (status != IX_SUCCESS)
        {
	    /* report the error */
	    IX_HSSACC_REPORT_ERROR_WITH_ARG ("ixHssAccPktRxInit:"
	        "Setting callback for the HSS%d PktRx Q failed\n",
		hssPortIndex,
		0, 0, 0, 0, 0);
            /* return error */
            return IX_FAIL;
        }
    
        /* Enable notification for the HSS Port 0/1 Rx Q */
        status =  ixQMgrNotificationEnable (ixHssAccPktRxQId[hssPortIndex],
	                                    IX_QMGR_Q_SOURCE_ID_NOT_E);
        if (status != IX_SUCCESS)
        {
	    /* report the error */
	    IX_HSSACC_REPORT_ERROR_WITH_ARG ("ixHssAccPktRxInit:"
	        "Notification enable for the HSS%d PktRx Q failed\n",
		hssPortIndex,
		0, 0, 0, 0, 0);
            /* return error */
	    return IX_FAIL;
        }
    }
	
    IX_HSSACC_TRACE0 (IX_HSSACC_FN_ENTRY_EXIT, 
		      "Exiting ixHssAccPktRxInit\n");
    return status;
}
コード例 #6
0
ファイル: IxCryptoAccQAccess.c プロジェクト: cilynx/dd-wrt
/**
 * @fn ixCryptoQAccessInit
 * @brief Queue configuration and callback registration function
 *
 */
IxCryptoAccStatus 
ixCryptoQAccessInit (IxCryptoAccCfg compCfg)
{
    UINT32 i;

    if (initDone) /* If the module has been initialized */
    {
        return IX_CRYPTO_ACC_STATUS_FAIL;
    } /* end of if (initDone) */
    
    /* Initialize all the member in the ixCryptoStats struct */
    ixCryptoStats.cryptoSuccessCounter = 0;
    ixCryptoStats.cryptoFailCounter = 0;
    ixCryptoStats.qOverflowCounter = 0;
    ixCryptoStats.qUnderflowCounter = 0;
    ixCryptoStats.qDescAddrInvalidCounter = 0;
    ixCryptoStats.wepNpeSuccessCounter = 0;
    ixCryptoStats.wepNpeFailCounter = 0;
    ixCryptoStats.wepNpeQOverflowCounter = 0;
    ixCryptoStats.wepNpeQUnderflowCounter = 0;
    ixCryptoStats.wepNpeQDescAddrInvalidCounter = 0;
    ixCryptoStats.wepXScaleSuccessCounter = 0;
    ixCryptoStats.wepXScaleFailCounter = 0;
    
    /* Check component configuration to determine which queues should be 
     * initialized
     */
    switch (compCfg)
    {
        /* XScale WEP engine only, no hw queues need to be initialized,
         * thus the function is forced return here 
         */
        case IX_CRYPTO_ACC_CFG_WEP_XSCALE_ACC_EN:
            /* Set flag to indicate this module has been initializaed */
            initDone = TRUE;
            return IX_CRYPTO_ACC_STATUS_SUCCESS;
        
        /* Crypto NPE engine only */
        case IX_CRYPTO_ACC_CFG_CRYPTO_NPE_ACC_EN: 
            startQueueIndex = IX_CRYPTO_HW_ACCEL_QUEUE_START_INDEX;
            endQueueIndex = IX_CRYPTO_HW_ACCEL_QUEUE_END_INDEX;
            break;
        
        /* WEP NPE engine only */
        case IX_CRYPTO_ACC_CFG_WEP_NPE_ACC_EN:
            startQueueIndex = IX_CRYPTO_WEP_QUEUE_START_INDEX;
            endQueueIndex = IX_CRYPTO_WEP_QUEUE_END_INDEX;
            break;
        
        /* CRYPTO NPE and WEP NPE engine only */
        case IX_CRYPTO_ACC_CFG_CRYPTO_WEP_NPE_ACC_EN:
            startQueueIndex = IX_CRYPTO_HW_ACCEL_QUEUE_START_INDEX;
            endQueueIndex = IX_CRYPTO_WEP_QUEUE_END_INDEX;
            break;
        
        /* Invalid configuration */
        default:
            return IX_CRYPTO_ACC_STATUS_FAIL;        
    }
    
    for (i = startQueueIndex; i < endQueueIndex; i++)
    {
        /* Configure each Q */
        if (IX_SUCCESS != (ixQMgrQConfig (
                              queueInfo[i].qName,
                              queueInfo[i].qId,
                              queueInfo[i].qSize,
                              queueInfo[i].qWords)))
        {
            /* configuration failed */
            return IX_CRYPTO_ACC_STATUS_FAIL;
        } /* end of if (ixQMgrQConfig) */

        /* Set notification condition for Q */  
        if (queueInfo[i].qNotificationEnableAtStartup) 
        {
            /* Set Q watermarks for each Q */
            if (IX_SUCCESS != ixQMgrWatermarkSet (
                                  queueInfo[i].qId,
                                  queueInfo[i].AlmostEmptyThreshold,
                                  queueInfo[i].AlmostFullThreshold))
            {
                /* configuration failed */
                return IX_CRYPTO_ACC_STATUS_FAIL;
            } /* end of if (ixQMgrWatermarkSet) */
            
            /* Set dispatcher priority for the Q */
            if (IX_SUCCESS != ixQMgrDispatcherPrioritySet ( 
                                  queueInfo[i].qId, 
                                  IX_CRYPTO_ACC_QM_QUEUE_DISPATCH_PRIORITY))
            {
                /* configuration failed */
                return IX_CRYPTO_ACC_STATUS_FAIL;
            } /* end of if (ixQMgrDispatcherPrioritySet) */
       
            /* Register callbacks for each Q */ 
            if (IX_SUCCESS != ixQMgrNotificationCallbackSet (
                                  queueInfo[i].qId,
                                  queueInfo[i].qCallback,
                                  queueInfo[i].callbackTag))
            {
                /* callback registration failed */
                return IX_CRYPTO_ACC_STATUS_FAIL;
            } /* end of if (ixQMgrNotificationCallbackSet) */

            if (IX_SUCCESS != ixQMgrNotificationEnable (
                                   queueInfo[i].qId,
                                   queueInfo[i].qConditionSource))
            {
                /* configuration failed */
                return IX_CRYPTO_ACC_STATUS_FAIL;
            } /* end of if (ixQMgrNotificationEnable) */
        } /* end of if (queueInfo[i].qNotificationEnableAtStartup) */        
    } /* end of for (i) */
        
    /* Set flag to indicate this module has been initializaed */
    initDone = TRUE;
    
    return IX_CRYPTO_ACC_STATUS_SUCCESS;

} /* end of ixCryptoQAccessInit () function */