Example #1
0
IX_STATUS 
ixEthAccCodeletDispatcherStop(BOOL useInterrupt)
{
    if(useInterrupt) /* Interrupt mode */
    {
	/* 
	 * Unhook the QM QLOW dispatcher to the interrupt controller. 
	 */
	if (ixOsalIrqUnbind(IX_ETH_CODELET_QMGR_IRQ) != IX_SUCCESS)
	{
	    printf("Dispatcher: Failed to unbind to QM1 interrupt\n");
	    return (IX_FAIL);
	}
    }
    else
    {
	if (!ixEthAccCodeletDispatcherPollStopTrigger)
	{
	    ixEthAccCodeletDispatcherPollStopTrigger = TRUE;
	    if (ixOsalMutexLock (&ixEthAccCodeletDispatcherPollRunning,
				 IX_OSAL_WAIT_FOREVER) != IX_SUCCESS)
	    {
		printf("Dispatcher: Error stopping QMgr Dispatcher thread!\n");
		return (IX_FAIL);
	    }
	    ixOsalMutexUnlock (&ixEthAccCodeletDispatcherPollRunning);
	    
	    ixOsalMutexDestroy(&ixEthAccCodeletDispatcherPollRunning);
	}
    }

    ixEthAccCodeletDispatcherInitialized = FALSE;

    return (IX_SUCCESS);
}
Example #2
0
/* -------------------------------------------
*   Uninitialise the tx subcomponent
*/
IX_STATUS
ixAtmdAccTxCfgIfUninit (void)
{
    IX_STATUS returnStatus = IX_SUCCESS;

      /* uninitialise tx data structures */
    if ((TRUE == ixAtmdAccTxCfgInitDone))
    {
        /* unregister port state interface to port management */
        ixAtmdAccPortStateHandlersUnregister ();

        if (IX_SUCCESS == ixOsalMutexDestroy (&txControlLock))
        {
            /* uninitialisae the security flag */
            ixAtmdAccTxCfgInitDone = FALSE;
        }
        else
        {
            returnStatus = IX_FAIL;
        }
    }
    else
    {
        returnStatus = IX_FAIL;
    } /* end of if-else */
    return returnStatus;
}
Example #3
0
void
ixEthAccMiiUnload(void)
{
    ixOsalMutexDestroy(&miiAccessLock);
    IX_OSAL_MEM_UNMAP(miiBaseAddressVirt);
  
    miiBaseAddressVirt = 0;
}
/*
 * Function definition: ixEthAccCodeletDBMaintenanceStart()
 *
 * Start the EDB Maintenance task
 */
IX_STATUS 
ixEthAccCodeletDBMaintenanceStart(void)
{
    IxOsalThread maintenanceThread;
    IxOsalThreadAttr threadAttr;

    threadAttr.name      = "Codelet EDB Maintenance";
    threadAttr.stackSize = 32 * 1024; /* 32kbytes */
    threadAttr.priority  = IX_ETHACC_CODELET_DB_PRIORITY;

    if (!ixEthAccCodeletDBMaintenanceInitialized)
    {
	/* this should be initialized once */
	ixOsalMutexInit (&ixEthAccCodeletDBMaintenanceTaskRunning);
	ixEthAccCodeletDBMaintenanceInitialized = TRUE;
	ixEthAccCodeletDBMaintenanceTaskStopTrigger = TRUE;
    }

    if (ixEthAccCodeletDBMaintenanceTaskStopTrigger)
    {
	/* Polled mode based on a task running a loop */
	if (ixOsalThreadCreate(&maintenanceThread,
			       &threadAttr,
			       (IxOsalVoidFnVoidPtr) ixEthAccCodeletDBMaintenanceTask,
			       NULL)	
	    != IX_SUCCESS)
	{
	    ixOsalMutexDestroy(&ixEthAccCodeletDBMaintenanceTaskRunning);	
	    printf("DBLearning: Error spawning DB maintenance task\n");
	    return (IX_FAIL);
	}

	/* Start the thread */
	if (ixOsalThreadStart(&maintenanceThread) != IX_SUCCESS)
	{
	    ixOsalMutexDestroy(&ixEthAccCodeletDBMaintenanceTaskRunning);	
	    printf("DBLearning: Error failed to start the maintenance thread\n");
	    return IX_FAIL;
	}
    }

    return (IX_SUCCESS);
}
Example #5
0
/**
 * @brief prepares EthDB for unloading
 *
 * This function must be called before removing the
 * EthDB component from memory (e.g. doing rmmod in 
 * Linux) if the component is to be re-initialized again
 * without rebooting the platform.
 *
 * All the EthDB ports must be disabled before this 
 * function is to be called. Failure to disable all
 * the ports will return the IX_ETH_DB_BUSY error.
 *
 * This function will destroy mutexes, deallocate
 * memory and stop the event processor.
 *
 * Note that this function is fully documented in the
 * main component header file, IxEthDB.h.
 *
 * @return IX_ETH_DB_SUCCESS if de-initialization
 * completed successfully or an appropriate error
 * message otherwise
 */
IX_ETH_DB_PUBLIC
IxEthDBStatus ixEthDBUnload(void)
{
    IxEthDBPortId portIndex;
    
    if (!ethDBInitializationComplete)
    {
        /* redundant */
        return IX_ETH_DB_SUCCESS;
    }

    /* check if any ports are enabled */
    for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
    {
        if (ixEthDBPortInfo[portIndex].enabled)
        {
            return IX_ETH_DB_BUSY;
        }

        ixEthDBPortInfo[portIndex].wifiRecordsCount = 0;
        ixEthDBPortInfo[portIndex].fwRecordsCount = 0;
        ixEthDBPortInfo[portIndex].featureCapability = 0;
	ixEthDBPortInfo[portIndex].featureStatus = 0; 
    }

    /* free port resources */
    for (portIndex = 0 ; portIndex < IX_ETH_DB_NUMBER_OF_PORTS ; portIndex++)
    {        
        if (ixEthDBPortDefinitions[portIndex].type == IX_ETH_NPE)
        {
            ixOsalMutexDestroy(&ixEthDBPortInfo[portIndex].npeAckLock);
        }

        ixEthDBPortInfo[portIndex].initialized = FALSE;
    }
    
    /* shutdown event processor */
    ixEthDBStopLearningFunction();
    
    /* deallocate NPE update zones */
    ixEthDBNPEUpdateAreasUnload();

    ethDBInitializationComplete = FALSE;

    return IX_ETH_DB_SUCCESS;
}
Example #6
0
/* ---------------------------------------------------------
*   Module Uninitialisation
*/
IX_STATUS
ixAtmdAccUtilUninit (void)
{
    IX_STATUS returnStatus = IX_FAIL;

    if (TRUE == initDone)
    {
        returnStatus = ixOsalMutexDestroy (&utilLock);

        if (IX_SUCCESS != returnStatus)
        {
            returnStatus = IX_FAIL;
        }
        else
        {
            initDone = FALSE;
        } /* end of if-else(returnStatus) */
    } /* end of if(initDone) */
    return returnStatus;
}
/*
 * Function definition: ixEthAccCodeletDBMaintenanceStop()
 *
 * Stop the EDB Maintenance task
 */
IX_STATUS 
ixEthAccCodeletDBMaintenanceStop(void)
{
    if (!(ixEthAccCodeletDBMaintenanceTaskStopTrigger))
    {
	ixEthAccCodeletDBMaintenanceTaskStopTrigger = TRUE;
	if (ixOsalMutexLock (&ixEthAccCodeletDBMaintenanceTaskRunning, IX_OSAL_WAIT_FOREVER)
	    != IX_SUCCESS)
	{
	    printf("DBLearning: Error stopping Database Maintenance thread!\n");
	    return (IX_FAIL);
	}
	ixOsalMutexUnlock (&ixEthAccCodeletDBMaintenanceTaskRunning);
	
	ixOsalMutexDestroy(&ixEthAccCodeletDBMaintenanceTaskRunning);
    }

    ixEthAccCodeletDBMaintenanceInitialized = FALSE; 

    return (IX_SUCCESS);
}
Example #8
0
/* DescMgmt Uninitialisation */
IX_STATUS
ixAtmdAccDescMgmtUninit (void)
{
    IX_STATUS returnStatus = IX_FAIL;

    if (initDone)
    {

		descPointer -= (NPE_ADDR_ALIGN - 1);
        /* de-allocate the buffer containing all elements */
        IX_OSAL_CACHE_DMA_FREE(descPointer);
        IxAtmdDmaDescPointer = NULL;

        returnStatus = ixOsalMutexDestroy (&descMgmtLock);

        if (IX_SUCCESS == returnStatus)
        {  /*uninitialisation complete */
            initDone = FALSE;
        }
    } /* end of if(initDone) */
    return returnStatus;
}
Example #9
0
IX_STATUS 
ixEthAccCodeletDispatcherStart(BOOL useInterrupt)
{ 
    IxOsalThread qDispatchThread;
    IxOsalThreadAttr threadAttr;

    threadAttr.name      = "Codelet Q Dispatcher";
    threadAttr.stackSize = 32 * 1024; /* 32kbytes */
    threadAttr.priority  = IX_ETHACC_CODELET_QMR_PRIORITY;

    if (!ixEthAccCodeletDispatcherInitialized)
    {
	/* this should be initialized once */
	ixQMgrDispatcherLoopGet(&ixEthAccCodeletDispatcherFunc);

	ixOsalMutexInit (&ixEthAccCodeletDispatcherPollRunning);
	ixEthAccCodeletDispatcherPollStopTrigger = TRUE;
	ixEthAccCodeletDispatcherInitialized = TRUE;
    }

    if(useInterrupt)	/* Interrupt mode */
    {
	/* 
	 * Hook the QM QLOW dispatcher to the interrupt controller. 
	 */
	if (ixOsalIrqBind(IX_ETH_CODELET_QMGR_IRQ,
			  (IxOsalVoidFnVoidPtr)(ixEthAccCodeletDispatcherFunc),
			  (void *)IX_QMGR_QUELOW_GROUP) != IX_SUCCESS)
	{
	    ixOsalMutexDestroy(&ixEthAccCodeletDispatcherPollRunning);	
	    printf("Dispatcher: Failed to bind to QM1 interrupt\n");
	    return (IX_FAIL);
	}
    }
    else
    {  
	if (ixEthAccCodeletDispatcherPollStopTrigger)
	{
	    /* Polled mode based on a task running a loop */
	    if (ixOsalThreadCreate(&qDispatchThread,
				   &threadAttr,
				   (IxOsalVoidFnVoidPtr) ixEthAccCodeletDispatcherPoll,
				   NULL)	
		!= IX_SUCCESS)
	    {
	    	ixOsalMutexDestroy(&ixEthAccCodeletDispatcherPollRunning);
		printf("Dispatcher: Error spawning Q Dispatcher task\n");
		return (IX_FAIL);
	    }
	    
	    /* Start the thread */
	    if (ixOsalThreadStart(&qDispatchThread) != IX_SUCCESS)
	    {
	    	ixOsalMutexDestroy(&ixEthAccCodeletDispatcherPollRunning);
		printf("Dispatcher: Error failed to start the Q Dispatcher thread\n");
		return IX_FAIL;
	    }
	}
    }

    return (IX_SUCCESS);
}