2 *************************************************************************
4 * 5F., No.36, Taiyuan St., Jhubei City,
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
25 *************************************************************************
29 #include "../rt_config.h"
30 #include "../netif_block.h"
33 static NETIF_ENTRY freeNetIfEntryPool[FREE_NETIF_POOL_SIZE];
34 static LIST_HEADER freeNetIfEntryList;
36 void initblockQueueTab(
41 initList(&freeNetIfEntryList);
42 for (i = 0; i < FREE_NETIF_POOL_SIZE; i++)
43 insertTailList(&freeNetIfEntryList, (PLIST_ENTRY)&freeNetIfEntryPool[i]);
45 for (i=0; i < NUM_OF_TX_RING; i++)
46 initList(&pAd->blockQueueTab[i].NetIfList);
52 IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry,
55 PNETIF_ENTRY pNetIfEntry = NULL;
57 if ((pNetIfEntry = (PNETIF_ENTRY)removeHeadList(&freeNetIfEntryList)) != NULL)
59 RTMP_OS_NETDEV_STOP_QUEUE(pNetDev);
60 pNetIfEntry->pNetDev = pNetDev;
61 insertTailList(&pBlockQueueEntry->NetIfList, (PLIST_ENTRY)pNetIfEntry);
63 pBlockQueueEntry->SwTxQueueBlockFlag = TRUE;
64 DBGPRINT(RT_DEBUG_TRACE, ("RTMP_OS_NETDEV_STOP_QUEUE(%s)\n", RTMP_OS_NETDEV_GET_DEVNAME(pNetDev)));
73 IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry)
75 PNETIF_ENTRY pNetIfEntry = NULL;
76 PLIST_HEADER pNetIfList = &pBlockQueueEntry->NetIfList;
78 while((pNetIfEntry = (PNETIF_ENTRY)removeHeadList(pNetIfList)) != NULL)
80 PNET_DEV pNetDev = pNetIfEntry->pNetDev;
81 RTMP_OS_NETDEV_WAKE_QUEUE(pNetDev);
82 insertTailList(&freeNetIfEntryList, (PLIST_ENTRY)pNetIfEntry);
84 DBGPRINT(RT_DEBUG_TRACE, ("RTMP_OS_NETDEV_WAKE_QUEUE(%s)\n", RTMP_OS_NETDEV_GET_DEVNAME(pNetDev)));
86 pBlockQueueEntry->SwTxQueueBlockFlag = FALSE;
94 IN PNDIS_PACKET pPacket)
96 PNET_DEV NetDev = NULL;
98 BOOLEAN valid = FALSE;
101 if (RTMP_GET_PACKET_NET_DEVICE(pPacket) >= MIN_NET_DEVICE_FOR_APCLI)
103 IfIdx = (RTMP_GET_PACKET_NET_DEVICE(pPacket) - MIN_NET_DEVICE_FOR_APCLI) % MAX_APCLI_NUM;
104 NetDev = pAd->ApCfg.ApCliTab[IfIdx].dev;
107 #endif // APCLI_SUPPORT //
109 if (RTMP_GET_PACKET_NET_DEVICE(pPacket) >= MIN_NET_DEVICE_FOR_WDS)
111 IfIdx = (RTMP_GET_PACKET_NET_DEVICE(pPacket) - MIN_NET_DEVICE_FOR_WDS) % MAX_WDS_ENTRY;
112 NetDev = pAd->WdsTab.WdsEntry[IfIdx].dev;
115 #endif // WDS_SUPPORT //
118 if (pAd->OpMode == OPMODE_AP)
120 IfIdx = (RTMP_GET_PACKET_NET_DEVICE(pPacket) - MIN_NET_DEVICE_FOR_MBSSID) % MAX_MBSSID_NUM;
121 NetDev = pAd->ApCfg.MBSSID[IfIdx].MSSIDDev;
126 NetDev = pAd->net_dev;
130 NetDev = pAd->net_dev;
134 // WMM support 4 software queues.
135 // One software queue full doesn't mean device have no capbility to transmit packet.
136 // So disable block Net-If queue function while WMM enable.
137 #ifdef CONFIG_STA_SUPPORT
138 IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
139 valid = (pAd->CommonCfg.bWmmCapable == TRUE) ? FALSE : TRUE;
140 #endif // CONFIG_STA_SUPPORT //
143 blockNetIf(&pAd->blockQueueTab[QueIdx], NetDev);
147 #endif // BLOCK_NET_IF //