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; }
VOID CliWds_ProxyTabUpdate( IN PRTMP_ADAPTER pAd, IN SHORT Aid, IN PUCHAR pMac) { UINT8 HashId = (*(pMac + 5) & (CLIWDS_HASH_TAB_SIZE - 1)); PCLIWDS_PROXY_ENTRY pCliWdsEntry; if (CliWds_ProxyLookup(pAd, pMac) != NULL) return; pCliWdsEntry = CliWdsEntyAlloc(pAd); if (pCliWdsEntry) { ULONG Now; NdisGetSystemUpTime(&Now); pCliWdsEntry->Aid = Aid; COPY_MAC_ADDR(&pCliWdsEntry->Addr, pMac); pCliWdsEntry->LastRefTime = Now; pCliWdsEntry->pNext = NULL; insertTailList(&pAd->ApCfg.CliWdsProxyTab[HashId], (PLIST_ENTRY)pCliWdsEntry); } return; }
static VOID InsertIgmpMember( IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, IN PLIST_HEADER pList, IN PUCHAR pMemberAddr) { PMEMBER_ENTRY pMemberEntry; if(pList == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("%s: membert list doesn't exist.\n", __FUNCTION__)); return; } if (pMemberAddr == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("%s: invalid member.\n", __FUNCTION__)); return; } if((pMemberEntry = (PMEMBER_ENTRY)AllocaGrpMemberEntry(pMulticastFilterTable)) != NULL) { NdisZeroMemory(pMemberEntry, sizeof(MEMBER_ENTRY)); COPY_MAC_ADDR(pMemberEntry->Addr, pMemberAddr); insertTailList(pList, (PLIST_ENTRY)pMemberEntry); DBGPRINT(RT_DEBUG_TRACE, ("%s Member Mac=%02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__, pMemberEntry->Addr[0], pMemberEntry->Addr[1], pMemberEntry->Addr[2], pMemberEntry->Addr[3], pMemberEntry->Addr[4], pMemberEntry->Addr[5])); } return; }
VOID MultipathEntryInsert( IN PRTMP_ADAPTER pAd, IN UCHAR LinkIdx, IN PUCHAR pMac) { PMESH_MULTIPATH_ENTRY pEntry; UINT8 HashId = *(pMac + 5); ULONG Now; if (!VALID_MESH_LINK_ID(LinkIdx)) return; pEntry = MultipathEntryLookUp(pAd, LinkIdx, pMac); if(pEntry == NULL) { if ((pEntry = MultipathEntyAlloc(pAd)) == NULL) return; insertTailList(&pAd->MeshTab.MeshLink[LinkIdx].Entry.MultiPathHash[HashId], (PLIST_ENTRY)pEntry); } DBGPRINT(RT_DEBUG_TRACE, ("Block multipath pkt to link(%d) from SA=%02x:%02x:%02x:%02x:%02x:%02x\n", LinkIdx, pMac[0], pMac[1], pMac[2], pMac[3], pMac[4], pMac[5])); NdisGetSystemUpTime(&Now); COPY_MAC_ADDR(pEntry->MeshSA, pMac); pEntry->ReferTime = Now; return; }
static inline VOID FreeGrpMemberEntry( IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, IN PMEMBER_ENTRY pEntry) { RTMP_SEM_LOCK(&pMulticastFilterTable->FreeMemberPoolTabLock); insertTailList(&pMulticastFilterTable->freeEntryList, (PLIST_ENTRY)pEntry); RTMP_SEM_UNLOCK(&pMulticastFilterTable->FreeMemberPoolTabLock); }
static inline void initFreeEntryList( IN PMULTICAST_FILTER_TABLE pMulticastFilterTable, IN PLIST_HEADER pList) { int i; for (i = 0; i < FREE_MEMBER_POOL_SIZE; i++) insertTailList(pList, (PLIST_ENTRY)&(pMulticastFilterTable->freeMemberPool[i])); return; }
VOID CliWdsEntyFree( IN PRTMP_ADAPTER pAd, IN PCLIWDS_PROXY_ENTRY pCliWdsEntry) { RTMP_SEM_LOCK(&pAd->ApCfg.CliWdsTabLock); insertTailList(&pAd->ApCfg.CliWdsEntryFreeList, (PLIST_ENTRY)pCliWdsEntry); RTMP_SEM_UNLOCK(&pAd->ApCfg.CliWdsTabLock); return; }
VOID MultipathEntyFree( IN PRTMP_ADAPTER pAd, IN PMESH_MULTIPATH_ENTRY pEntry) { RTMP_SEM_LOCK(&pAd->MeshTab.MultipathTabLock); insertTailList(&pAd->MeshTab.MultipathEntryFreeList, (PLIST_ENTRY)pEntry); RTMP_SEM_UNLOCK(&pAd->MeshTab.MultipathTabLock); return; }
void initblockQueueTab(RTMP_ADAPTER *pAd) { int i; initList(&freeNetIfEntryList); for (i = 0; i < FREE_NETIF_POOL_SIZE; i++) insertTailList(&freeNetIfEntryList, (RT_LIST_ENTRY *)&freeNetIfEntryPool[i]); for (i=0; i < NUM_OF_TX_RING; i++) initList(&pAd->blockQueueTab[i].NetIfList); return; }
VOID releaseNetIf( IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry) { PNETIF_ENTRY pNetIfEntry = NULL; PLIST_HEADER pNetIfList = &pBlockQueueEntry->NetIfList; while((pNetIfEntry = (PNETIF_ENTRY)removeHeadList(pNetIfList)) != NULL) { PNET_DEV pNetDev = pNetIfEntry->pNetDev; netif_wake_queue(pNetDev); insertTailList(&freeNetIfEntryList, (PLIST_ENTRY)pNetIfEntry); DBGPRINT(RT_DEBUG_TRACE, "netif_wake_queue(%s)\n", pNetDev->name); } pBlockQueueEntry->SwTxQueueBlockFlag = FALSE; return; }
VOID releaseNetIf( IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry) { PNETIF_ENTRY pNetIfEntry = NULL; PLIST_HEADER pNetIfList = &pBlockQueueEntry->NetIfList; while((pNetIfEntry = (PNETIF_ENTRY)removeHeadList(pNetIfList)) != NULL) { PNET_DEV pNetDev = pNetIfEntry->pNetDev; RTMP_OS_NETDEV_WAKE_QUEUE(pNetDev); insertTailList(&freeNetIfEntryList, (PLIST_ENTRY)pNetIfEntry); DBGPRINT(RT_DEBUG_TRACE, ("RTMP_OS_NETDEV_WAKE_QUEUE(%s)\n", RTMP_OS_NETDEV_GET_DEVNAME(pNetDev))); } pBlockQueueEntry->SwTxQueueBlockFlag = FALSE; return; }
BOOLEAN blockNetIf(BLOCK_QUEUE_ENTRY *pBlockQueueEntry, PNET_DEV pNetDev) { NETIF_ENTRY *pNetIfEntry = NULL; if ((pNetIfEntry = (NETIF_ENTRY *)removeHeadList(&freeNetIfEntryList)) != NULL) { RTMP_OS_NETDEV_STOP_QUEUE(pNetDev); pNetIfEntry->pNetDev = pNetDev; insertTailList(&pBlockQueueEntry->NetIfList, (RT_LIST_ENTRY *)pNetIfEntry); pBlockQueueEntry->SwTxQueueBlockFlag = TRUE; MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("RTMP_OS_NETDEV_STOP_QUEUE(%s)\n", RTMP_OS_NETDEV_GET_DEVNAME(pNetDev))); } else return FALSE; return TRUE; }
void RTMP_CFG80211_AddVifEntry(void *pAdSrc, PNET_DEV pNewNetDev, UINT32 DevType) { PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdSrc; PCFG80211_VIF_DEV pNewVifDev; pNewVifDev = os_alloc_mem(sizeof(CFG80211_VIF_DEV)); if (pNewVifDev) { NdisZeroMemory(pNewVifDev, sizeof(CFG80211_VIF_DEV)); pNewVifDev->pNext = NULL; pNewVifDev->net_dev = pNewNetDev; pNewVifDev->devType = DevType; NdisZeroMemory(pNewVifDev->CUR_MAC, MAC_ADDR_LEN); NdisCopyMemory(pNewVifDev->CUR_MAC, pNewNetDev->dev_addr, MAC_ADDR_LEN); insertTailList(&pAd->cfg80211_ctrl.Cfg80211VifDevSet.vifDevList, (PLIST_ENTRY)pNewVifDev); DBGPRINT(RT_DEBUG_TRACE, ("Add CFG80211 VIF Device, Type: %d.\n", pNewVifDev->devType)); } }
BOOLEAN blockNetIf( IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry, IN PNET_DEV pNetDev) { PNETIF_ENTRY pNetIfEntry = NULL; if ((pNetIfEntry = (PNETIF_ENTRY)removeHeadList(&freeNetIfEntryList)) != NULL) { netif_stop_queue(pNetDev); pNetIfEntry->pNetDev = pNetDev; insertTailList(&pBlockQueueEntry->NetIfList, (PLIST_ENTRY)pNetIfEntry); pBlockQueueEntry->SwTxQueueBlockFlag = TRUE; DBGPRINT(RT_DEBUG_TRACE, "netif_stop_queue(%s)\n", pNetDev->name); } else return FALSE; return TRUE; }
VOID releaseNetIf(BLOCK_QUEUE_ENTRY *pBlockQueueEntry) { NETIF_ENTRY *pNetIfEntry = NULL; LIST_HEADER *pNetIfList = &pBlockQueueEntry->NetIfList; while((pNetIfEntry = (NETIF_ENTRY *)removeHeadList(pNetIfList)) != NULL) { PNET_DEV pNetDev = pNetIfEntry->pNetDev; if (pNetDev) { RTMP_OS_NETDEV_WAKE_QUEUE(pNetDev); MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_TRACE, ("RTMP_OS_NETDEV_WAKE_QUEUE(%s)\n", RTMP_OS_NETDEV_GET_DEVNAME(pNetDev))); } insertTailList(&freeNetIfEntryList, (RT_LIST_ENTRY *)pNetIfEntry); } pBlockQueueEntry->SwTxQueueBlockFlag = FALSE; return; }
BOOLEAN blockNetIf( IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry, IN PNET_DEV pNetDev) { PNETIF_ENTRY pNetIfEntry = NULL; if ((pNetIfEntry = (PNETIF_ENTRY)removeHeadList(&freeNetIfEntryList)) != NULL) { RTMP_OS_NETDEV_STOP_QUEUE(pNetDev); pNetIfEntry->pNetDev = pNetDev; insertTailList(&pBlockQueueEntry->NetIfList, (PLIST_ENTRY)pNetIfEntry); pBlockQueueEntry->SwTxQueueBlockFlag = TRUE; DBGPRINT(RT_DEBUG_TRACE, ("RTMP_OS_NETDEV_STOP_QUEUE(%s)\n", RTMP_OS_NETDEV_GET_DEVNAME(pNetDev))); } else return FALSE; return TRUE; }
VOID MultipathPoolInit( IN PRTMP_ADAPTER pAd) { ULONG i; NdisAllocateSpinLock(pAd, &pAd->MeshTab.MultipathTabLock); os_alloc_mem(pAd, (UCHAR **)&(pAd->MeshTab.pMultipathEntryPool), sizeof(MESH_MULTIPATH_ENTRY) * MULTIPATH_POOL_SIZE); if (pAd->MeshTab.pMultipathEntryPool) { NdisZeroMemory(pAd->MeshTab.pMultipathEntryPool, sizeof(MESH_BMPKTSIG_TAB)); initList(&pAd->MeshTab.MultipathEntryFreeList); for (i = 0; i < MULTIPATH_POOL_SIZE; i++) insertTailList(&pAd->MeshTab.MultipathEntryFreeList, (PLIST_ENTRY)(pAd->MeshTab.pMultipathEntryPool + (ULONG)i)); } else DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->MeshTab.pMultipathEntryPool", __FUNCTION__)); return; }
VOID RTMP_CFG80211_AddVifEntry(struct rtmp_adapter *pAd, struct net_device *pNewNetDev, uint32_t DevType) { PCFG80211_VIF_DEV pNewVifDev = NULL; pNewVifDev = kmalloc(sizeof(CFG80211_VIF_DEV), GFP_ATOMIC); if (pNewVifDev) { memset(pNewVifDev, 0, sizeof(CFG80211_VIF_DEV)); pNewVifDev->pNext = NULL; pNewVifDev->net_dev = pNewNetDev; pNewVifDev->devType = DevType; memset(pNewVifDev->CUR_MAC, 0, MAC_ADDR_LEN); memcpy(pNewVifDev->CUR_MAC, pNewNetDev->dev_addr, MAC_ADDR_LEN); insertTailList(&pAd->cfg80211_ctrl.Cfg80211VifDevSet.vifDevList, (PLIST_ENTRY)pNewVifDev); DBGPRINT(RT_DEBUG_TRACE, ("Add CFG80211 VIF Device, Type: %d.\n", pNewVifDev->devType)); } else { DBGPRINT(RT_DEBUG_ERROR, ("Error in alloc mem in New CFG80211 VIF Function.\n")); } }
VOID RTMP_CFG80211_AddVifEntry(VOID *pAdSrc, PNET_DEV pNewNetDev, UINT32 DevType) { PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)pAdSrc; PCFG80211_VIF_DEV pNewVifDev = NULL; os_alloc_mem(NULL, (UCHAR **)&pNewVifDev, sizeof(CFG80211_VIF_DEV)); if (pNewVifDev) { NdisZeroMemory(pNewVifDev, sizeof(CFG80211_VIF_DEV)); pNewVifDev->pNext = NULL; pNewVifDev->net_dev = pNewNetDev; pNewVifDev->devType = DevType; NdisZeroMemory(pNewVifDev->CUR_MAC, MAC_ADDR_LEN); NdisCopyMemory(pNewVifDev->CUR_MAC, pNewNetDev->dev_addr, MAC_ADDR_LEN); insertTailList(&pAd->cfg80211_ctrl.Cfg80211VifDevSet.vifDevList, (PLIST_ENTRY)pNewVifDev); DBGPRINT(RT_DEBUG_TRACE, ("Add CFG80211 VIF Device, Type: %d.\n", pNewVifDev->devType)); } else { DBGPRINT(RT_DEBUG_ERROR, ("Error in alloc mem in New CFG80211 VIF Function.\n")); } }