/**
 * @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);
}
Exemplo n.º 2
0
/**
 * 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;
}
Exemplo n.º 3
0
/**
 * @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 */