VOID tr_tb_set_entry(RTMP_ADAPTER *pAd, UCHAR tr_tb_idx, MAC_TABLE_ENTRY *pEntry) { struct _STA_TR_ENTRY *tr_entry; INT qidx, tid,upId; //MAC_TABLE_ENTRY *mac_entry; struct wtbl_entry tb_entry; //struct wtbl_2_struc *wtbl_2; if (tr_tb_idx < MAX_LEN_OF_TR_TABLE) { tr_entry = &pAd->MacTab.tr_entry[tr_tb_idx]; tr_entry->EntryType = pEntry->EntryType; tr_entry->wdev = pEntry->wdev; tr_entry->func_tb_idx = pEntry->func_tb_idx; tr_entry->wcid = pEntry->wcid; NdisMoveMemory(tr_entry->Addr, pEntry->Addr, MAC_ADDR_LEN); tr_entry->NonQosDataSeq = 0; for (tid = 0; tid < NUM_OF_TID; tid++) tr_entry->TxSeq[tid] = 0; for(upId = 0 ; upId < NUM_OF_UP ; upId ++) { tr_entry->cacheSn[upId] = -1; } /* Reset BA SSN & Score Board Bitmap, for BA Receiptor */ NdisZeroMemory(&tb_entry, sizeof(tb_entry)); if (mt_wtbl_get_entry234(pAd, tr_entry->wcid, &tb_entry) == FALSE) { DBGPRINT(RT_DEBUG_ERROR, ("%s(): Not found WTBL2/3/4 for tr_entry->wcid(%d), !ERROR!\n", __FUNCTION__, tr_entry->wcid)); return; } //mac_entry = &pAd->MacTab.Content[tr_entry->wcid]; tr_entry->PsMode = PWR_ACTIVE; tr_entry->isCached = FALSE; tr_entry->PortSecured = WPA_802_1X_PORT_NOT_SECURED; tr_entry->CurrTxRate = pEntry->CurrTxRate; for (qidx = 0 ; qidx < WMM_QUE_NUM; qidx++) { InitializeQueueHeader(&tr_entry->tx_queue[qidx]); NdisAllocateSpinLock(pAd, &tr_entry->txq_lock[qidx]); } InitializeQueueHeader(&tr_entry->ps_queue); NdisAllocateSpinLock(pAd, &tr_entry->ps_queue_lock); tr_entry->deq_cnt = 0; tr_entry->deq_bytes = 0; tr_entry->PsQIdleCount = 0; tr_entry->enq_cap = TRUE; tr_entry->deq_cap = TRUE; tr_entry->PsTokenFlag = 0; NdisMoveMemory(tr_entry->bssid, pEntry->wdev->bssid, MAC_ADDR_LEN); } }
SshInterceptorIoDevice ssh_interceptor_iodevice_alloc(SshInterceptor interceptor, const unsigned char *device_name, Boolean exclusive_access, SshInterceptorIoDeviceStatusCB status_cb, SshInterceptorIoDeviceReceiveCB receive_cb, void *callback_context) { SshInterceptorIoDevice io_dev = NULL; UINT i; SSH_DEBUG(SSH_D_HIGHSTART, ("Allocating I/O device object '%s'", device_name)); /* Create device object */ io_dev = ssh_calloc(1, sizeof(*io_dev)); if (io_dev == NULL) { SSH_DEBUG(SSH_D_FAIL,("Memory allocation failed")); return NULL; } io_dev->notify_event = CreateEvent(NULL, FALSE, FALSE, NULL); if (io_dev->notify_event == NULL) { SSH_DEBUG(SSH_D_FAIL,("Failed to create event object")); ssh_free(io_dev); return NULL; } /* Initialize variables allocated in the device extension area */ io_dev->open = 0; io_dev->cancel_io = 0; io_dev->status_cb = status_cb; io_dev->receive_cb = receive_cb; io_dev->cb_context = callback_context; NdisInitializeListHead(&io_dev->output_queue); NdisInitializeListHead(&io_dev->unreliable_output_queue); NdisAllocateSpinLock(&io_dev->output_queue_lock); NdisInitializeListHead(&io_dev->free_list); NdisAllocateSpinLock(&io_dev->free_list_lock); /* Initialize the read critical section. */ InitializeCriticalSection(&io_dev->read_cs); /* Pre-allocate some "free" SshDeviceBuffers */ for (i = 0; i < SSH_IODEVICE_QUEUE_SIZE; i++) { SshDeviceBuffer buf = &(io_dev->pre_allocated_buffers[i]); buf->pre_allocated = 1; InsertTailList(&io_dev->free_list, &buf->link); } SSH_ASSERT(interceptor->ipm_device == NULL); interceptor->ipm_device = io_dev; return io_dev; }
VOID OvsInitIoctl() { gOvsCtrlLock = &ovsCtrlLockObj; ovsFlowLock = &ovsFlowLockObj; NdisAllocateSpinLock(ovsFlowLock); NdisAllocateSpinLock(gOvsCtrlLock); }
static NDIS_STATUS VenetSetupAdapter(PADAPTER a) { NDIS_STATUS rc; NDIS_TIMER_CHARACTERISTICS timer; a->lookAhead = NIC_MAX_LOOKAHEAD; a->numTcbs = NIC_MAX_BUSY_SENDS; a->refCount = 1; VENET_SET_FLAG(a, VNET_DISCONNECTED); QueueInit(&a->sendQueue); NdisInitializeListHead(&a->recvFreeList); NdisInitializeListHead(&a->recvToProcess); NdisInitializeListHead(&a->tcbFree); NdisInitializeListHead(&a->tcbBusy); NdisAllocateSpinLock(&a->lock); NdisAllocateSpinLock(&a->recvLock); NdisAllocateSpinLock(&a->sendLock); NdisInitializeEvent(&a->removeEvent); NdisInitializeEvent(&a->sendEvent); /* We use the opposite sense of the sendEvent, * SET == No Tx in use * UNSET == Tx in use */ NdisInitializeEvent(&a->sendEvent); NdisSetEvent(&a->sendEvent); /* Create Rest and receive timers. */ NdisZeroMemory(&timer, sizeof(NDIS_TIMER_CHARACTERISTICS)); timer.Header.Type = NDIS_OBJECT_TYPE_TIMER_CHARACTERISTICS; timer.Header.Revision = NDIS_TIMER_CHARACTERISTICS_REVISION_1; timer.Header.Size = sizeof(NDIS_TIMER_CHARACTERISTICS); timer.AllocationTag = VNET; timer.TimerFunction = VenetResetTimerDpc; timer.FunctionContext = a; rc = NdisAllocateTimerObject(a->adapterHandle, &timer, &a->resetTimer); if (rc != NDIS_STATUS_SUCCESS) goto done; timer.TimerFunction = VenetReceiveTimerDpc; rc = NdisAllocateTimerObject(a->adapterHandle, &timer, &a->recvTimer); if (rc != NDIS_STATUS_SUCCESS) goto done; done: return rc; }
VOID BBUPollingModeInit(IN RTMP_ADAPTER *pAd){ NdisAllocateSpinLock(&pAd->Pollingmode.PollingModeLock);//for polling mode RTMPInitTimer(pAd, &pAd->Pollingmode.PollingModeDetect, GET_TIMER_FUNCTION(PeriodicPollingModeDetect), pAd, FALSE); pAd->Pollingmode.PollingModeDetectRunning = FALSE; }
void mp8711init(_adapter *padapter) { struct mp_priv *pmppriv=&padapter->mppriv; // MP8711 WorkItem struct mp_wi_cntx *pmp_wi_cntx = &(pmppriv->wi_cntx); pmp_wi_cntx->bmpdrv_unload =_FALSE; pmp_wi_cntx->bmp_wi_progress=_FALSE; pmp_wi_cntx->curractfunc=NULL; NdisInitializeEvent(&(pmp_wi_cntx->mp_wi_evt)); NdisAllocateSpinLock(&(pmp_wi_cntx->mp_wi_lock)); NdisInitializeWorkItem(&(pmp_wi_cntx->mp_wi), mp_wi_callback,// MP8711WorkItemCallback, padapter); // H2C/C2H // padapter->nH2cCmdCnt = 0 ; // NdisAllocateSpinLock(&(pAdapter->MpH2cSpinLock)); // NdisInitializeEvent(&(pAdapter->CMDCommEvent)); //New Arch. init_mp_priv(&padapter->mppriv); }
CParaNdisRX::CParaNdisRX() : m_nReusedRxBuffersCounter(0), m_NetNofReceiveBuffers(0) { InitializeListHead(&m_NetReceiveBuffers); NdisAllocateSpinLock(&m_UnclassifiedPacketsQueue.Lock); InitializeListHead(&m_UnclassifiedPacketsQueue.BuffersList); }
/***************************************************************************** * DriverEntry() * * この関数のは System がこのドライバをロードするときに呼ばれ、ドライバを * NDIS と関連付け、エントリポイントを登録する。 * * 引数: * DriverObject : ドライバーオブジェクトのポインタ * RegistryPath : ドライバーのレジストリのパス 関連付け * * 返り値: * * NDIS_STATUS * ********************************************************************************/ NDIS_STATUS DriverEntry( IN PVOID DriverObject, IN PVOID RegistryPath) { NDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics; NDIS_STATUS Status; DEBUG_PRINT0(3, "DriverEntry called\n"); NdisZeroMemory(&MiniportCharacteristics, sizeof(NDIS_MINIPORT_CHARACTERISTICS)); /* * ミニポートドライバを NDIS に関連付けし、NdisWrapperHandle を得る。 */ NdisMInitializeWrapper( &NdisWrapperHandle, // OUT PNDIS_HANDLE DriverObject, // IN ドライバーオブジェクト RegistryPath, // IN レジストリパス NULL // IN 必ず NULL ); if(NdisWrapperHandle == NULL){ DEBUG_PRINT0(1, "NdisInitializeWrapper failed\n"); return(STATUS_INVALID_HANDLE); } MiniportCharacteristics.MajorNdisVersion = STE_NDIS_MAJOR_VERSION; // Major Version MiniportCharacteristics.MinorNdisVersion = STE_NDIS_MINOR_VERSION; // Minor Version MiniportCharacteristics.CheckForHangHandler = SteMiniportCheckForHang; MiniportCharacteristics.HaltHandler = SteMiniportHalt; MiniportCharacteristics.InitializeHandler = SteMiniportInitialize; MiniportCharacteristics.QueryInformationHandler = SteMiniportQueryInformation; MiniportCharacteristics.ResetHandler = SteMiniportReset ; MiniportCharacteristics.SetInformationHandler = SteMiniportSetInformation; MiniportCharacteristics.ReturnPacketHandler = SteMiniportReturnPacket; MiniportCharacteristics.SendPacketsHandler = SteMiniportSendPackets; Status = NdisMRegisterMiniport( NdisWrapperHandle, // IN NDIS_HANDLE &MiniportCharacteristics, // IN PNDIS_MINIPORT_CHARACTERISTICS sizeof(NDIS_MINIPORT_CHARACTERISTICS) // IN UINT ); if( Status != NDIS_STATUS_SUCCESS){ DEBUG_PRINT1(1, "NdisMRegisterMiniport failed(Status = 0x%x)\n", Status); NdisTerminateWrapper( NdisWrapperHandle, // IN NDIS_HANDLE NULL ); return(Status); } // グローバルロックを初期化 NdisAllocateSpinLock(&SteGlobalSpinLock); NdisMRegisterUnloadHandler(NdisWrapperHandle, SteMiniportUnload); return(NDIS_STATUS_SUCCESS); }
/* ======================================================================== Routine Description: Initialize FT RIC Module. Arguments: pAd - WLAN control block pointer Return Value: None Note: ======================================================================== */ VOID TYPE_FUNC FT_RIC_Init( IN PRTMP_ADAPTER pAd) { DBGPRINT(RT_DEBUG_TRACE, ("ap_ftrc> Initialize FT RIC Module...\n")); #ifdef CONFIG_STA_SUPPORT /* allocate control block */ if (pAd->pFT_RIC_Ctrl_BK == NULL) { os_alloc_mem(pAd, (UCHAR **)&pAd->pFT_RIC_Ctrl_BK, sizeof(FT_RIC_CTRL_BLOCK)); if (pAd->pFT_RIC_Ctrl_BK == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("ap_ftrc> Allocate control block fail!\n")); return; } /* End of if */ /* init spin lock */ NdisAllocateSpinLock(pAd, &(pAd->FT_RicLock)); /* init resource list */ initList(&(FT_RIC_CB->ResourceList)); } /* End of if */ #endif /* CONFIG_STA_SUPPORT */ } /* End of FT_RIC_Init */
VOID CliWds_ProxyTabInit( IN PRTMP_ADAPTER pAd) { INT idx; ULONG i; NdisAllocateSpinLock(&pAd->ApCfg.CliWdsTabLock); pAd->ApCfg.pCliWdsEntryPool = kmalloc(sizeof(CLIWDS_PROXY_ENTRY) * CLIWDS_POOL_SIZE, GFP_ATOMIC); if (pAd->ApCfg.pCliWdsEntryPool) { NdisZeroMemory(pAd->ApCfg.pCliWdsEntryPool, sizeof(CLIWDS_PROXY_ENTRY) * CLIWDS_POOL_SIZE); initList(&pAd->ApCfg.CliWdsEntryFreeList); for (i = 0; i < CLIWDS_POOL_SIZE; i++) insertTailList(&pAd->ApCfg.CliWdsEntryFreeList, (PLIST_ENTRY)(pAd->ApCfg.pCliWdsEntryPool + (ULONG)i)); } else { DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->CommonCfg.pCliWdsEntryPool", __FUNCTION__)); } for (idx = 0; idx < CLIWDS_HASH_TAB_SIZE; idx++) initList(&pAd->ApCfg.CliWdsProxyTab[idx]); return; }
A_STATUS HIFInit(OSDRV_CALLBACKS *callbacks) { SD_API_STATUS sdStatus; AR_DEBUG_ASSERT(callbacks != NULL); /* store the callback handlers */ osdrvCallbacks = *callbacks; /* Register with bus driver core */ NDIS_DEBUG_PRINTF(DBG_LEVEL_HIF, "AR6000: HIFInit registering \r\n"); registered = 1; #if defined(CONFIG_PM) // TODO about power management. #endif /* CONFIG_PM */ /* Register with bus driver core */ sdFunction.pName = "sdio_wlan"; sdFunction.pProbe = hifDeviceInserted; sdFunction.pRemove = hifDeviceRemoved; A_MUTEX_INIT(&hif_lock); NdisAllocateSpinLock(&sLock); sdStatus = SDIORegisterFunction(&sdFunction); AR_DEBUG_ASSERT(SD_API_SUCCESS(sdStatus)); return A_OK; }
NDIS_STATUS NDIS_API PacketReset(POPEN_INSTANCE pOpen) { // reset the protocol PLIST_ENTRY ResetListEntry; NDIS_STATUS Status; // Acquire request element from list NdisAllocateSpinLock(&pOpen->RequestSpinLock); if (IsListEmpty(&pOpen->RequestList)) { NdisReleaseSpinLock(&pOpen->RequestSpinLock); return NDIS_STATUS_RESOURCES; } ResetListEntry = RemoveHeadList(&pOpen->RequestList); NdisReleaseSpinLock(&pOpen->RequestSpinLock); // Insert Reset IRP into Request Queue NdisAcquireSpinLock(&pOpen->ResetSpinLock); InsertTailList(&pOpen->ResetIrpList, ResetListEntry); NdisReleaseSpinLock(&pOpen->ResetSpinLock); // Reset the adapter NdisReset(&Status, pOpen->AdapterHandle); if (Status != NDIS_STATUS_PENDING) PacketResetComplete(pOpen, Status); return Status; }
void RtmpTimerQInit(RTMP_ADAPTER *pAd) { int i; RTMP_TIMER_TASK_ENTRY *pQNode, *pEntry; unsigned long irqFlags; NdisAllocateSpinLock(&pAd->TimerQLock); NdisZeroMemory(&pAd->TimerQ, sizeof(pAd->TimerQ)); os_alloc_mem(pAd, &pAd->TimerQ.pTimerQPoll, sizeof(RTMP_TIMER_TASK_ENTRY) * TIMER_QUEUE_SIZE_MAX); if (pAd->TimerQ.pTimerQPoll) { pEntry = NULL; pQNode = (RTMP_TIMER_TASK_ENTRY *)pAd->TimerQ.pTimerQPoll; NdisZeroMemory(pAd->TimerQ.pTimerQPoll, sizeof(RTMP_TIMER_TASK_ENTRY) * TIMER_QUEUE_SIZE_MAX); RTMP_INT_LOCK(&pAd->TimerQLock, irqFlags); for (i = 0 ;i <TIMER_QUEUE_SIZE_MAX; i++) { pQNode->pNext = pEntry; pEntry = pQNode; pQNode++; } pAd->TimerQ.pQPollFreeList = pEntry; pAd->TimerQ.pQHead = NULL; pAd->TimerQ.pQTail = NULL; pAd->TimerQ.status = RTMP_TASK_STAT_INITED; RTMP_INT_UNLOCK(&pAd->TimerQLock, irqFlags); } }
VOID OvsInit() { gOvsCtrlLock = &ovsCtrlLockObj; NdisAllocateSpinLock(gOvsCtrlLock); OvsInitEventQueue(); OvsUserInit(); }
VOID ArcInitializePackage(VOID) { NdisAllocateSpinLock(&ArcReferenceLock); KeInitializeEvent( &ArcPagedInEvent, NotificationEvent, FALSE ); }
VOID tr_tb_set_mcast_entry(RTMP_ADAPTER *pAd, UCHAR tr_tb_idx, struct wifi_dev *wdev) { struct _STA_TR_ENTRY *tr_entry = &pAd->MacTab.tr_entry[tr_tb_idx]; INT qidx, tid; NdisZeroMemory(tr_entry, sizeof(struct _STA_TR_ENTRY)); tr_entry->EntryType = ENTRY_CAT_MCAST; tr_entry->wdev = wdev; tr_entry->func_tb_idx = wdev->func_idx; tr_entry->PsMode = PWR_ACTIVE; tr_entry->isCached = FALSE; tr_entry->PortSecured = WPA_802_1X_PORT_SECURED; tr_entry->CurrTxRate = pAd->CommonCfg.MlmeRate; NdisMoveMemory(tr_entry->Addr, &BROADCAST_ADDR[0], MAC_ADDR_LEN); // TODO: shiang-usw, for following fields, need better assignment! tr_entry->wcid = tr_tb_idx; tr_entry->NonQosDataSeq = 0; for (tid = 0; tid < NUM_OF_TID; tid++) tr_entry->TxSeq[tid] = 0; for (qidx = 0 ; qidx < WMM_QUE_NUM; qidx++) { InitializeQueueHeader(&tr_entry->tx_queue[qidx]); NdisAllocateSpinLock(pAd, &tr_entry->txq_lock[qidx]); } InitializeQueueHeader(&tr_entry->ps_queue); NdisAllocateSpinLock(pAd, &tr_entry->ps_queue_lock); tr_entry->deq_cnt = 0; tr_entry->deq_bytes = 0; tr_entry->PsQIdleCount = 0; tr_entry->enq_cap = TRUE; tr_entry->deq_cap = TRUE; tr_entry->PsTokenFlag = 0; #ifdef DATA_QUEUE_RESERVE tr_entry->high_pkt_cnt = 0; tr_entry->high_pkt_drop_cnt = 0; #endif /* DATA_QUEUE_RESERVE */ NdisMoveMemory(tr_entry->bssid, wdev->bssid, MAC_ADDR_LEN); }
/* ========================================================================== Description: This routine init the entire IGMP table. ========================================================================== */ VOID MulticastFilterTableInit( IN PMULTICAST_FILTER_TABLE *ppMulticastFilterTable) { // Initialize MAC table and allocate spin lock *ppMulticastFilterTable = kmalloc(sizeof(MULTICAST_FILTER_TABLE), MEM_ALLOC_FLAG); if (*ppMulticastFilterTable == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("%s unable to alloc memory for Multicase filter table, size=%d\n", __FUNCTION__, sizeof(MULTICAST_FILTER_TABLE))); return; } NdisZeroMemory(*ppMulticastFilterTable, sizeof(MULTICAST_FILTER_TABLE)); NdisAllocateSpinLock(&((*ppMulticastFilterTable)->MulticastFilterTabLock)); NdisAllocateSpinLock(&((*ppMulticastFilterTable)->FreeMemberPoolTabLock)); initList(&((*ppMulticastFilterTable)->freeEntryList)); initFreeEntryList(*ppMulticastFilterTable, &((*ppMulticastFilterTable)->freeEntryList)); return; }
/* ========================================================================== Description: This routine init the entire IGMP table. ========================================================================== */ VOID MulticastFilterTableInit( IN PRTMP_ADAPTER pAd, IN PMULTICAST_FILTER_TABLE *ppMulticastFilterTable) { /* Initialize MAC table and allocate spin lock */ os_alloc_mem(NULL, (UCHAR **)ppMulticastFilterTable, sizeof(MULTICAST_FILTER_TABLE)); if (*ppMulticastFilterTable == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("%s unable to alloc memory for Multicase filter table, size=%d\n", __FUNCTION__, sizeof(MULTICAST_FILTER_TABLE))); return; } NdisZeroMemory(*ppMulticastFilterTable, sizeof(MULTICAST_FILTER_TABLE)); NdisAllocateSpinLock(pAd, &((*ppMulticastFilterTable)->MulticastFilterTabLock)); NdisAllocateSpinLock(pAd, &((*ppMulticastFilterTable)->FreeMemberPoolTabLock)); initList(&((*ppMulticastFilterTable)->freeEntryList)); initFreeEntryList(*ppMulticastFilterTable, &((*ppMulticastFilterTable)->freeEntryList)); return; }
VOID BMPktSigTabInit( IN PRTMP_ADAPTER pAd) { NdisAllocateSpinLock(pAd, &pAd->MeshTab.MeshBMPktTabLock); os_alloc_mem(pAd, (UCHAR **)&(pAd->MeshTab.pBMPktSigTab), sizeof(MESH_BMPKTSIG_TAB)); if (pAd->MeshTab.pBMPktSigTab) NdisZeroMemory(pAd->MeshTab.pBMPktSigTab, sizeof(MESH_BMPKTSIG_TAB)); else DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->MeshTab.pBMPktSigTab", __FUNCTION__)); return; }
VOID ndisprotAllocateSpinLock( IN PNPROT_LOCK pLock, IN ULONG FileNumber, IN ULONG LineNumber ) { if (ndisprotdSpinLockInitDone == 0) { ndisprotdSpinLockInitDone = 1; NdisAllocateSpinLock(&(ndisprotdLockLock)); } NdisAcquireSpinLock(&(ndisprotdLockLock)); pLock->Signature = NPROTL_SIG; pLock->TouchedByFileNumber = FileNumber; pLock->TouchedInLineNumber = LineNumber; pLock->IsAcquired = 0; pLock->OwnerThread = 0; NdisAllocateSpinLock(&(pLock->NdisLock)); NdisReleaseSpinLock(&(ndisprotdLockLock)); }
VOID filterAllocateSpinLock( IN PFILTER_LOCK pLock, IN ULONG FileNumber, IN ULONG LineNumber ) { if (filterdSpinLockInitDone == 0) { filterdSpinLockInitDone = 1; NdisAllocateSpinLock(&(filterdLockLock)); } NdisAcquireSpinLock(&(filterdLockLock)); pLock->Signature = FILT_LOCK_SIG; pLock->TouchedByFileNumber = FileNumber; pLock->TouchedInLineNumber = LineNumber; pLock->IsAcquired = 0; pLock->OwnerThread = 0; NdisAllocateSpinLock(&(pLock->NdisLock)); NdisReleaseSpinLock(&(filterdLockLock)); }
VOID natInitFwSession() { LARGE_INTEGER DueTime; KeInitializeTimer(&g_FwSessionTimer); KeInitializeDpc(&g_FwSessionDpc, natFwSessionTimerFunction, NULL); InitializeListHead(&g_FwSessionList); NdisAllocateSpinLock(&g_FwSessionLock); DueTime.QuadPart = -1; KeSetTimerEx(&g_FwSessionTimer, DueTime, INIT_SESSION_TIMEOUT_SEC*1000 ,&g_FwSessionDpc); }
VOID MeasureReqTabInit( IN PRTMP_ADAPTER pAd) { NdisAllocateSpinLock(&pAd->CommonCfg.MeasureReqTabLock); pAd->CommonCfg.pMeasureReqTab = kmalloc(sizeof(MEASURE_REQ_TAB), GFP_ATOMIC); if (pAd->CommonCfg.pMeasureReqTab) NdisZeroMemory(pAd->CommonCfg.pMeasureReqTab, sizeof(MEASURE_REQ_TAB)); else DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->CommonCfg.pMeasureReqTab.\n", __func__)); return; }
VOID CFG80211_ScanStatusLockInit( IN VOID *pAdCB, IN UINT init) { PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdCB; CFG80211_CB *pCfg80211_CB = (CFG80211_CB *)pAd->pCfg80211_CB; if (init) { NdisAllocateSpinLock(pAd, &pCfg80211_CB->scan_notify_lock); } else { NdisFreeSpinLock(&pCfg80211_CB->scan_notify_lock); } }
void _rtw_spinlock_init(_lock *plock) { #ifdef PLATFORM_LINUX spin_lock_init(plock); #endif #ifdef PLATFORM_WINDOWS NdisAllocateSpinLock(plock); #endif }
/* ======================================================================== Routine Description: Initialze TDLS UAPSD function. Arguments: pAd - WLAN control block pointer pFSM - TDLS Finite State Machine Return Value: TRUE - init ok FALSE - init fail Note: Peer U-APSD Sleep STA is default feature in spec. Peer U-APSD Buffer STA is optional feature in spec. ======================================================================== */ BOOLEAN TDLS_UAPSDP_Init( IN PRTMP_ADAPTER pAd, IN STATE_MACHINE *pFSM) { /* init FSM */ StateMachineSetAction(pFSM, TDLS_IDLE, MT2_PEER_TDLS_TRAFFIC_IND, (STATE_MACHINE_FUNC)TDLS_UAPSD_PeerTrafficIndAction); StateMachineSetAction(pFSM, TDLS_IDLE, MT2_PEER_TDLS_TRAFFIC_RSP, (STATE_MACHINE_FUNC)TDLS_UAPSD_PeerTrafficRspAction); /* init lock */ NdisAllocateSpinLock(pAd, &pAd->StaCfg.TdlsInfo.TDLSUapsdLock); DBGPRINT(RT_DEBUG_TRACE, ("tdls uapsd> initialization ok!\n")); return TRUE; }
/* * Allocate all resource for reordering mechanism */ BOOLEAN ba_reordering_resource_init(struct rt_rtmp_adapter *pAd, int num) { int i; u8 *mem; struct reordering_mpdu *mpdu_blk; struct reordering_list *freelist; /* allocate spinlock */ NdisAllocateSpinLock(&pAd->mpdu_blk_pool.lock); /* initialize freelist */ freelist = &pAd->mpdu_blk_pool.freelist; freelist->next = NULL; freelist->qlen = 0; DBGPRINT(RT_DEBUG_TRACE, ("Allocate %d memory for BA reordering\n", (u32)(num * sizeof(struct reordering_mpdu)))); /* allocate number of mpdu_blk memory */ os_alloc_mem(pAd, (u8 **) & mem, (num * sizeof(struct reordering_mpdu))); pAd->mpdu_blk_pool.mem = mem; if (mem == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("Can't Allocate Memory for BA Reordering\n")); return (FALSE); } /* build mpdu_blk free list */ for (i = 0; i < num; i++) { /* get mpdu_blk */ mpdu_blk = (struct reordering_mpdu *)mem; /* initial mpdu_blk */ NdisZeroMemory(mpdu_blk, sizeof(struct reordering_mpdu)); /* next mpdu_blk */ mem += sizeof(struct reordering_mpdu); /* insert mpdu_blk into freelist */ ba_enqueue(freelist, mpdu_blk); } return (TRUE); }
// Create a new lock NEO_LOCK *NeoNewLock() { NDIS_SPIN_LOCK *spin_lock; // Memory allocation NEO_LOCK *lock = NeoZeroMalloc(sizeof(NEO_LOCK)); if (lock == NULL) { return NULL; } // Initialize spin lock spin_lock = &lock->spin_lock; NdisAllocateSpinLock(spin_lock); return lock; }
void _spinlock_init(_lock *plock) { #ifdef PLATFORM_LINUX //eason 20100210 spin_lock_init(plock); cyg_mutex_t * mut_t = plock; cyg_mutex_init(mut_t); #endif #ifdef PLATFORM_WINDOWS NdisAllocateSpinLock(plock); #endif }
void _rtw_spinlock_init(_lock *plock) { #ifdef PLATFORM_LINUX spin_lock_init(plock); #endif #ifdef PLATFORM_FREEBSD mtx_init(plock, "", NULL, MTX_DEF|MTX_RECURSE); #endif #ifdef PLATFORM_WINDOWS NdisAllocateSpinLock(plock); #endif }