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 *************************************************************************
28 #include "../rt_config.h"
29 #include "netif_block.h"
31 static NETIF_ENTRY freeNetIfEntryPool
[FREE_NETIF_POOL_SIZE
];
32 static LIST_HEADER freeNetIfEntryList
;
34 void initblockQueueTab(
39 initList(&freeNetIfEntryList
);
40 for (i
= 0; i
< FREE_NETIF_POOL_SIZE
; i
++)
41 insertTailList(&freeNetIfEntryList
, (PLIST_ENTRY
)&freeNetIfEntryPool
[i
]);
43 for (i
=0; i
< NUM_OF_TX_RING
; i
++)
44 initList(&pAd
->blockQueueTab
[i
].NetIfList
);
50 IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry
,
53 PNETIF_ENTRY pNetIfEntry
= NULL
;
55 if ((pNetIfEntry
= (PNETIF_ENTRY
)removeHeadList(&freeNetIfEntryList
)) != NULL
)
57 netif_stop_queue(pNetDev
);
58 pNetIfEntry
->pNetDev
= pNetDev
;
59 insertTailList(&pBlockQueueEntry
->NetIfList
, (PLIST_ENTRY
)pNetIfEntry
);
61 pBlockQueueEntry
->SwTxQueueBlockFlag
= TRUE
;
62 DBGPRINT(RT_DEBUG_TRACE
, ("netif_stop_queue(%s)\n", pNetDev
->name
));
71 IN PBLOCK_QUEUE_ENTRY pBlockQueueEntry
)
73 PNETIF_ENTRY pNetIfEntry
= NULL
;
74 PLIST_HEADER pNetIfList
= &pBlockQueueEntry
->NetIfList
;
76 while((pNetIfEntry
= (PNETIF_ENTRY
)removeHeadList(pNetIfList
)) != NULL
)
78 PNET_DEV pNetDev
= pNetIfEntry
->pNetDev
;
79 netif_wake_queue(pNetDev
);
80 insertTailList(&freeNetIfEntryList
, (PLIST_ENTRY
)pNetIfEntry
);
82 DBGPRINT(RT_DEBUG_TRACE
, ("netif_wake_queue(%s)\n", pNetDev
->name
));
84 pBlockQueueEntry
->SwTxQueueBlockFlag
= FALSE
;
92 IN PNDIS_PACKET pPacket
)
94 PNET_DEV NetDev
= NULL
;
96 BOOLEAN valid
= FALSE
;
99 if (RTMP_GET_PACKET_NET_DEVICE(pPacket
) >= MIN_NET_DEVICE_FOR_APCLI
)
101 IfIdx
= (RTMP_GET_PACKET_NET_DEVICE(pPacket
) - MIN_NET_DEVICE_FOR_APCLI
) % MAX_APCLI_NUM
;
102 NetDev
= pAd
->ApCfg
.ApCliTab
[IfIdx
].dev
;
105 #endif // APCLI_SUPPORT //
107 if (RTMP_GET_PACKET_NET_DEVICE(pPacket
) >= MIN_NET_DEVICE_FOR_WDS
)
109 IfIdx
= (RTMP_GET_PACKET_NET_DEVICE(pPacket
) - MIN_NET_DEVICE_FOR_WDS
) % MAX_WDS_ENTRY
;
110 NetDev
= pAd
->WdsTab
.WdsEntry
[IfIdx
].dev
;
113 #endif // WDS_SUPPORT //
116 if (pAd
->OpMode
== OPMODE_AP
)
118 IfIdx
= (RTMP_GET_PACKET_NET_DEVICE(pPacket
) - MIN_NET_DEVICE_FOR_MBSSID
) % MAX_MBSSID_NUM
;
119 NetDev
= pAd
->ApCfg
.MBSSID
[IfIdx
].MSSIDDev
;
124 NetDev
= pAd
->net_dev
;
128 NetDev
= pAd
->net_dev
;
132 // WMM support 4 software queues.
133 // One software queue full doesn't mean device have no capbility to transmit packet.
134 // So disable block Net-If queue function while WMM enable.
135 #ifdef CONFIG_STA_SUPPORT
136 IF_DEV_CONFIG_OPMODE_ON_STA(pAd
)
137 valid
= (pAd
->CommonCfg
.bWmmCapable
== TRUE
) ? FALSE
: TRUE
;
138 #endif // CONFIG_STA_SUPPORT //
141 blockNetIf(&pAd
->blockQueueTab
[QueIdx
], NetDev
);