Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 1 | /* |
| 2 | ************************************************************************* |
| 3 | * Ralink Tech Inc. |
| 4 | * 5F., No.36, Taiyuan St., Jhubei City, |
| 5 | * Hsinchu County 302, |
| 6 | * Taiwan, R.O.C. |
| 7 | * |
| 8 | * (c) Copyright 2002-2007, Ralink Technology, Inc. |
| 9 | * |
| 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. * |
| 14 | * * |
| 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. * |
| 19 | * * |
| 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. * |
| 24 | * * |
| 25 | ************************************************************************* |
| 26 | |
| 27 | Module Name: |
| 28 | action.c |
| 29 | |
| 30 | Abstract: |
| 31 | Handle association related requests either from WSTA or from local MLME |
| 32 | |
| 33 | Revision History: |
| 34 | Who When What |
| 35 | -------- ---------- ---------------------------------------------- |
| 36 | Jan Lee 2006 created for rt2860 |
| 37 | */ |
| 38 | |
| 39 | #include "../rt_config.h" |
| 40 | #include "action.h" |
| 41 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 42 | static void ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 43 | |
| 44 | /* |
| 45 | ========================================================================== |
| 46 | Description: |
| 47 | association state machine init, including state transition and timer init |
| 48 | Parameters: |
| 49 | S - pointer to the association state machine |
| 50 | Note: |
| 51 | The state machine looks like the following |
| 52 | |
| 53 | ASSOC_IDLE |
| 54 | MT2_MLME_DISASSOC_REQ mlme_disassoc_req_action |
| 55 | MT2_PEER_DISASSOC_REQ peer_disassoc_action |
| 56 | MT2_PEER_ASSOC_REQ drop |
| 57 | MT2_PEER_REASSOC_REQ drop |
| 58 | MT2_CLS3ERR cls3err_action |
| 59 | ========================================================================== |
| 60 | */ |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 61 | void ActionStateMachineInit(IN PRTMP_ADAPTER pAd, |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 62 | IN STATE_MACHINE * S, |
| 63 | OUT STATE_MACHINE_FUNC Trans[]) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 64 | { |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 65 | StateMachineInit(S, (STATE_MACHINE_FUNC *) Trans, MAX_ACT_STATE, |
| 66 | MAX_ACT_MSG, (STATE_MACHINE_FUNC) Drop, ACT_IDLE, |
| 67 | ACT_MACHINE_BASE); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 68 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 69 | StateMachineSetAction(S, ACT_IDLE, MT2_PEER_SPECTRUM_CATE, |
| 70 | (STATE_MACHINE_FUNC) PeerSpectrumAction); |
| 71 | StateMachineSetAction(S, ACT_IDLE, MT2_PEER_QOS_CATE, |
| 72 | (STATE_MACHINE_FUNC) PeerQOSAction); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 73 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 74 | StateMachineSetAction(S, ACT_IDLE, MT2_PEER_DLS_CATE, |
| 75 | (STATE_MACHINE_FUNC) ReservedAction); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 76 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 77 | StateMachineSetAction(S, ACT_IDLE, MT2_PEER_BA_CATE, |
| 78 | (STATE_MACHINE_FUNC) PeerBAAction); |
| 79 | StateMachineSetAction(S, ACT_IDLE, MT2_PEER_HT_CATE, |
| 80 | (STATE_MACHINE_FUNC) PeerHTAction); |
| 81 | StateMachineSetAction(S, ACT_IDLE, MT2_MLME_ADD_BA_CATE, |
| 82 | (STATE_MACHINE_FUNC) MlmeADDBAAction); |
| 83 | StateMachineSetAction(S, ACT_IDLE, MT2_MLME_ORI_DELBA_CATE, |
| 84 | (STATE_MACHINE_FUNC) MlmeDELBAAction); |
| 85 | StateMachineSetAction(S, ACT_IDLE, MT2_MLME_REC_DELBA_CATE, |
| 86 | (STATE_MACHINE_FUNC) MlmeDELBAAction); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 87 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 88 | StateMachineSetAction(S, ACT_IDLE, MT2_PEER_PUBLIC_CATE, |
| 89 | (STATE_MACHINE_FUNC) PeerPublicAction); |
| 90 | StateMachineSetAction(S, ACT_IDLE, MT2_PEER_RM_CATE, |
| 91 | (STATE_MACHINE_FUNC) PeerRMAction); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 92 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 93 | StateMachineSetAction(S, ACT_IDLE, MT2_MLME_QOS_CATE, |
| 94 | (STATE_MACHINE_FUNC) MlmeQOSAction); |
| 95 | StateMachineSetAction(S, ACT_IDLE, MT2_MLME_DLS_CATE, |
| 96 | (STATE_MACHINE_FUNC) MlmeDLSAction); |
| 97 | StateMachineSetAction(S, ACT_IDLE, MT2_ACT_INVALID, |
| 98 | (STATE_MACHINE_FUNC) MlmeInvalidAction); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 99 | } |
| 100 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 101 | void MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 102 | { |
| 103 | MLME_ADDBA_REQ_STRUCT *pInfo; |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 104 | u8 Addr[6]; |
| 105 | u8 *pOutBuffer = NULL; |
| 106 | int NStatus; |
| 107 | unsigned long Idx; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 108 | FRAME_ADDBA_REQ Frame; |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 109 | unsigned long FrameLen; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 110 | BA_ORI_ENTRY *pBAEntry = NULL; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 111 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 112 | pInfo = (MLME_ADDBA_REQ_STRUCT *) Elem->Msg; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 113 | NdisZeroMemory(&Frame, sizeof(FRAME_ADDBA_REQ)); |
| 114 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 115 | if (MlmeAddBAReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr)) { |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 116 | NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 117 | if (NStatus != NDIS_STATUS_SUCCESS) { |
| 118 | DBGPRINT(RT_DEBUG_TRACE, |
| 119 | ("BA - MlmeADDBAAction() allocate memory failed \n")); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 120 | return; |
| 121 | } |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 122 | /* 1. find entry */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 123 | Idx = |
| 124 | pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; |
| 125 | if (Idx == 0) { |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 126 | MlmeFreeMemory(pAd, pOutBuffer); |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 127 | DBGPRINT(RT_DEBUG_ERROR, |
| 128 | ("BA - MlmeADDBAAction() can't find BAOriEntry \n")); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 129 | return; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 130 | } else { |
| 131 | pBAEntry = &pAd->BATable.BAOriEntry[Idx]; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 132 | } |
| 133 | |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 134 | { |
| 135 | if (ADHOC_ON(pAd)) |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 136 | ActHeaderInit(pAd, &Frame.Hdr, pInfo->pAddr, |
| 137 | pAd->CurrentAddress, |
| 138 | pAd->CommonCfg.Bssid); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 139 | else |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 140 | ActHeaderInit(pAd, &Frame.Hdr, |
| 141 | pAd->CommonCfg.Bssid, |
| 142 | pAd->CurrentAddress, |
| 143 | pInfo->pAddr); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 144 | } |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 145 | |
| 146 | Frame.Category = CATEGORY_BA; |
| 147 | Frame.Action = ADDBA_REQ; |
| 148 | Frame.BaParm.AMSDUSupported = 0; |
| 149 | Frame.BaParm.BAPolicy = IMMED_BA; |
| 150 | Frame.BaParm.TID = pInfo->TID; |
| 151 | Frame.BaParm.BufSize = pInfo->BaBufSize; |
| 152 | Frame.Token = pInfo->Token; |
| 153 | Frame.TimeOutValue = pInfo->TimeOutValue; |
| 154 | Frame.BaStartSeq.field.FragNum = 0; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 155 | Frame.BaStartSeq.field.StartSeq = |
| 156 | pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 157 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 158 | *(u16 *) (&Frame.BaParm) = |
| 159 | cpu2le16(*(u16 *) (&Frame.BaParm)); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 160 | Frame.TimeOutValue = cpu2le16(Frame.TimeOutValue); |
| 161 | Frame.BaStartSeq.word = cpu2le16(Frame.BaStartSeq.word); |
| 162 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 163 | MakeOutgoingFrame(pOutBuffer, &FrameLen, |
| 164 | sizeof(FRAME_ADDBA_REQ), &Frame, END_OF_ARGS); |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 165 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 166 | MiniportMMRequest(pAd, |
| 167 | (MGMT_USE_QUEUE_FLAG | |
| 168 | MapUserPriorityToAccessCategory[pInfo->TID]), |
| 169 | pOutBuffer, FrameLen); |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 170 | |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 171 | MlmeFreeMemory(pAd, pOutBuffer); |
| 172 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 173 | DBGPRINT(RT_DEBUG_TRACE, |
| 174 | ("BA - Send ADDBA request. StartSeq = %x, FrameLen = %ld. BufSize = %d\n", |
| 175 | Frame.BaStartSeq.field.StartSeq, FrameLen, |
| 176 | Frame.BaParm.BufSize)); |
| 177 | } |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | /* |
| 181 | ========================================================================== |
| 182 | Description: |
| 183 | send DELBA and delete BaEntry if any |
| 184 | Parametrs: |
| 185 | Elem - MLME message MLME_DELBA_REQ_STRUCT |
| 186 | |
| 187 | IRQL = DISPATCH_LEVEL |
| 188 | |
| 189 | ========================================================================== |
| 190 | */ |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 191 | void MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 192 | { |
| 193 | MLME_DELBA_REQ_STRUCT *pInfo; |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 194 | u8 *pOutBuffer = NULL; |
| 195 | u8 *pOutBuffer2 = NULL; |
| 196 | int NStatus; |
| 197 | unsigned long Idx; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 198 | FRAME_DELBA_REQ Frame; |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 199 | unsigned long FrameLen; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 200 | FRAME_BAR FrameBar; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 201 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 202 | pInfo = (MLME_DELBA_REQ_STRUCT *) Elem->Msg; |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 203 | /* must send back DELBA */ |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 204 | NdisZeroMemory(&Frame, sizeof(FRAME_DELBA_REQ)); |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 205 | DBGPRINT(RT_DEBUG_TRACE, |
| 206 | ("==> MlmeDELBAAction(), Initiator(%d) \n", pInfo->Initiator)); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 207 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 208 | if (MlmeDelBAReqSanity(pAd, Elem->Msg, Elem->MsgLen)) { |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 209 | NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 210 | if (NStatus != NDIS_STATUS_SUCCESS) { |
| 211 | DBGPRINT(RT_DEBUG_ERROR, |
| 212 | ("BA - MlmeDELBAAction() allocate memory failed 1. \n")); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 213 | return; |
| 214 | } |
| 215 | |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 216 | NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); /*Get an unused nonpaged memory */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 217 | if (NStatus != NDIS_STATUS_SUCCESS) { |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 218 | MlmeFreeMemory(pAd, pOutBuffer); |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 219 | DBGPRINT(RT_DEBUG_ERROR, |
| 220 | ("BA - MlmeDELBAAction() allocate memory failed 2. \n")); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 221 | return; |
| 222 | } |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 223 | /* SEND BAR (Send BAR to refresh peer reordering buffer.) */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 224 | Idx = |
| 225 | pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; |
Bartlomiej Zolnierkiewicz | 6a28a69a | 2009-04-26 16:05:46 +0200 | [diff] [blame] | 226 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 227 | BarHeaderInit(pAd, &FrameBar, |
| 228 | pAd->MacTab.Content[pInfo->Wcid].Addr, |
| 229 | pAd->CurrentAddress); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 230 | |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 231 | FrameBar.StartingSeq.field.FragNum = 0; /* make sure sequence not clear in DEL funciton. */ |
| 232 | FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; /* make sure sequence not clear in DEL funciton. */ |
| 233 | FrameBar.BarControl.TID = pInfo->TID; /* make sure sequence not clear in DEL funciton. */ |
| 234 | FrameBar.BarControl.ACKPolicy = IMMED_BA; /* make sure sequence not clear in DEL funciton. */ |
| 235 | FrameBar.BarControl.Compressed = 1; /* make sure sequence not clear in DEL funciton. */ |
| 236 | FrameBar.BarControl.MTID = 0; /* make sure sequence not clear in DEL funciton. */ |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 237 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 238 | MakeOutgoingFrame(pOutBuffer2, &FrameLen, |
| 239 | sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 240 | MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer2, FrameLen); |
| 241 | MlmeFreeMemory(pAd, pOutBuffer2); |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 242 | DBGPRINT(RT_DEBUG_TRACE, |
| 243 | ("BA - MlmeDELBAAction() . Send BAR to refresh peer reordering buffer \n")); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 244 | |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 245 | /* SEND DELBA FRAME */ |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 246 | FrameLen = 0; |
Bartlomiej Zolnierkiewicz | 6a28a69a | 2009-04-26 16:05:46 +0200 | [diff] [blame] | 247 | |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 248 | { |
| 249 | if (ADHOC_ON(pAd)) |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 250 | ActHeaderInit(pAd, &Frame.Hdr, |
| 251 | pAd->MacTab.Content[pInfo->Wcid]. |
| 252 | Addr, pAd->CurrentAddress, |
| 253 | pAd->CommonCfg.Bssid); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 254 | else |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 255 | ActHeaderInit(pAd, &Frame.Hdr, |
| 256 | pAd->CommonCfg.Bssid, |
| 257 | pAd->CurrentAddress, |
| 258 | pAd->MacTab.Content[pInfo->Wcid]. |
| 259 | Addr); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 260 | } |
Bartlomiej Zolnierkiewicz | 6a28a69a | 2009-04-26 16:05:46 +0200 | [diff] [blame] | 261 | |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 262 | Frame.Category = CATEGORY_BA; |
| 263 | Frame.Action = DELBA; |
| 264 | Frame.DelbaParm.Initiator = pInfo->Initiator; |
| 265 | Frame.DelbaParm.TID = pInfo->TID; |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 266 | Frame.ReasonCode = 39; /* Time Out */ |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 267 | *(u16 *) (&Frame.DelbaParm) = |
| 268 | cpu2le16(*(u16 *) (&Frame.DelbaParm)); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 269 | Frame.ReasonCode = cpu2le16(Frame.ReasonCode); |
| 270 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 271 | MakeOutgoingFrame(pOutBuffer, &FrameLen, |
| 272 | sizeof(FRAME_DELBA_REQ), &Frame, END_OF_ARGS); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 273 | MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); |
| 274 | MlmeFreeMemory(pAd, pOutBuffer); |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 275 | DBGPRINT(RT_DEBUG_TRACE, |
| 276 | ("BA - MlmeDELBAAction() . 3 DELBA sent. Initiator(%d)\n", |
| 277 | pInfo->Initiator)); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 278 | } |
| 279 | } |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 280 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 281 | void MlmeQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 282 | { |
| 283 | } |
| 284 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 285 | void MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 286 | { |
| 287 | } |
| 288 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 289 | void MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 290 | { |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 291 | /*u8 * pOutBuffer = NULL; */ |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 292 | /*Return the receiving frame except the MSB of category filed set to 1. 7.3.1.11 */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 293 | } |
| 294 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 295 | void PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 296 | { |
| 297 | } |
| 298 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 299 | void PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 300 | { |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 301 | u8 Action = Elem->Msg[LENGTH_802_11 + 1]; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 302 | |
| 303 | switch (Action) { |
| 304 | case ADDBA_REQ: |
| 305 | PeerAddBAReqAction(pAd, Elem); |
| 306 | break; |
| 307 | case ADDBA_RESP: |
| 308 | PeerAddBARspAction(pAd, Elem); |
| 309 | break; |
| 310 | case DELBA: |
| 311 | PeerDelBAAction(pAd, Elem); |
| 312 | break; |
| 313 | } |
| 314 | } |
| 315 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 316 | void PeerPublicAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 317 | { |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 318 | if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) |
| 319 | return; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 320 | } |
| 321 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 322 | static void ReservedAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 323 | { |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 324 | u8 Category; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 325 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 326 | if (Elem->MsgLen <= LENGTH_802_11) { |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 327 | return; |
| 328 | } |
| 329 | |
| 330 | Category = Elem->Msg[LENGTH_802_11]; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 331 | DBGPRINT(RT_DEBUG_TRACE, |
| 332 | ("Rcv reserved category(%d) Action Frame\n", Category)); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 333 | hex_dump("Reserved Action Frame", &Elem->Msg[0], Elem->MsgLen); |
| 334 | } |
| 335 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 336 | void PeerRMAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 337 | { |
| 338 | return; |
| 339 | } |
| 340 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 341 | static void respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd, |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 342 | IN MLME_QUEUE_ELEM * Elem) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 343 | { |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 344 | u8 *pOutBuffer = NULL; |
| 345 | int NStatus; |
| 346 | unsigned long FrameLen; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 347 | FRAME_HT_INFO HTINFOframe, *pFrame; |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 348 | u8 *pAddr; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 349 | |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 350 | /* 2. Always send back ADDBA Response */ |
| 351 | NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 352 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 353 | if (NStatus != NDIS_STATUS_SUCCESS) { |
| 354 | DBGPRINT(RT_DEBUG_TRACE, |
| 355 | ("ACTION - respond_ht_information_exchange_action() allocate memory failed \n")); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 356 | return; |
| 357 | } |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 358 | /* get RA */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 359 | pFrame = (FRAME_HT_INFO *) & Elem->Msg[0]; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 360 | pAddr = pFrame->Hdr.Addr2; |
| 361 | |
| 362 | NdisZeroMemory(&HTINFOframe, sizeof(FRAME_HT_INFO)); |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 363 | /* 2-1. Prepare ADDBA Response frame. */ |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 364 | { |
| 365 | if (ADHOC_ON(pAd)) |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 366 | ActHeaderInit(pAd, &HTINFOframe.Hdr, pAddr, |
| 367 | pAd->CurrentAddress, |
| 368 | pAd->CommonCfg.Bssid); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 369 | else |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 370 | ActHeaderInit(pAd, &HTINFOframe.Hdr, |
| 371 | pAd->CommonCfg.Bssid, pAd->CurrentAddress, |
| 372 | pAddr); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 373 | } |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 374 | |
| 375 | HTINFOframe.Category = CATEGORY_HT; |
| 376 | HTINFOframe.Action = HT_INFO_EXCHANGE; |
| 377 | HTINFOframe.HT_Info.Request = 0; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 378 | HTINFOframe.HT_Info.Forty_MHz_Intolerant = |
| 379 | pAd->CommonCfg.HtCapability.HtCapInfo.Forty_Mhz_Intolerant; |
| 380 | HTINFOframe.HT_Info.STA_Channel_Width = |
| 381 | pAd->CommonCfg.AddHTInfo.AddHtInfo.RecomWidth; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 382 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 383 | MakeOutgoingFrame(pOutBuffer, &FrameLen, |
| 384 | sizeof(FRAME_HT_INFO), &HTINFOframe, END_OF_ARGS); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 385 | |
| 386 | MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen); |
| 387 | MlmeFreeMemory(pAd, pOutBuffer); |
| 388 | } |
| 389 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 390 | void PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 391 | { |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 392 | u8 Action = Elem->Msg[LENGTH_802_11 + 1]; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 393 | |
| 394 | if (Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) |
| 395 | return; |
| 396 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 397 | switch (Action) { |
| 398 | case NOTIFY_BW_ACTION: |
| 399 | DBGPRINT(RT_DEBUG_TRACE, |
| 400 | ("ACTION - HT Notify Channel bandwidth action----> \n")); |
Bartlomiej Zolnierkiewicz | 6a28a69a | 2009-04-26 16:05:46 +0200 | [diff] [blame] | 401 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 402 | if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) { |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 403 | /* Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps */ |
| 404 | /* sending BW_Notify Action frame, and cause us to linkup and linkdown. */ |
| 405 | /* In legacy mode, don't need to parse HT action frame. */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 406 | DBGPRINT(RT_DEBUG_TRACE, |
| 407 | ("ACTION -Ignore HT Notify Channel BW when link as legacy mode. BW = %d---> \n", |
| 408 | Elem->Msg[LENGTH_802_11 + 2])); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 409 | break; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 410 | } |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 411 | |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 412 | if (Elem->Msg[LENGTH_802_11 + 2] == 0) /* 7.4.8.2. if value is 1, keep the same as supported channel bandwidth. */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 413 | pAd->MacTab.Content[Elem->Wcid].HTPhyMode.field.BW = 0; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 414 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 415 | break; |
| 416 | case SMPS_ACTION: |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 417 | /* 7.3.1.25 */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 418 | DBGPRINT(RT_DEBUG_TRACE, ("ACTION - SMPS action----> \n")); |
| 419 | if (((Elem->Msg[LENGTH_802_11 + 2] & 0x1) == 0)) { |
| 420 | pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_ENABLE; |
| 421 | } else if (((Elem->Msg[LENGTH_802_11 + 2] & 0x2) == 0)) { |
| 422 | pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_STATIC; |
| 423 | } else { |
| 424 | pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_DYNAMIC; |
| 425 | } |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 426 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 427 | DBGPRINT(RT_DEBUG_TRACE, |
| 428 | ("Aid(%d) MIMO PS = %d\n", Elem->Wcid, |
| 429 | pAd->MacTab.Content[Elem->Wcid].MmpsMode)); |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 430 | /* rt2860c : add something for smps change. */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 431 | break; |
| 432 | |
| 433 | case SETPCO_ACTION: |
| 434 | break; |
| 435 | case MIMO_CHA_MEASURE_ACTION: |
| 436 | break; |
| 437 | case HT_INFO_EXCHANGE: |
| 438 | { |
| 439 | HT_INFORMATION_OCTET *pHT_info; |
| 440 | |
| 441 | pHT_info = |
| 442 | (HT_INFORMATION_OCTET *) & Elem->Msg[LENGTH_802_11 + |
| 443 | 2]; |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 444 | /* 7.4.8.10 */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 445 | DBGPRINT(RT_DEBUG_TRACE, |
| 446 | ("ACTION - HT Information Exchange action----> \n")); |
| 447 | if (pHT_info->Request) { |
| 448 | respond_ht_information_exchange_action(pAd, |
| 449 | Elem); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 450 | } |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 451 | } |
| 452 | break; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 453 | } |
| 454 | } |
| 455 | |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 456 | /* |
| 457 | ========================================================================== |
| 458 | Description: |
| 459 | Retry sending ADDBA Reqest. |
| 460 | |
| 461 | IRQL = DISPATCH_LEVEL |
| 462 | |
| 463 | Parametrs: |
| 464 | p8023Header: if this is already 802.3 format, p8023Header is NULL |
| 465 | |
| 466 | Return : TRUE if put into rx reordering buffer, shouldn't indicaterxhere. |
| 467 | FALSE , then continue indicaterx at this moment. |
| 468 | ========================================================================== |
| 469 | */ |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 470 | void ORIBATimerTimeout(IN PRTMP_ADAPTER pAd) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 471 | { |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 472 | MAC_TABLE_ENTRY *pEntry; |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 473 | int i, total; |
| 474 | u8 TID; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 475 | |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 476 | total = pAd->MacTab.Size * NUM_OF_TID; |
| 477 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 478 | for (i = 1; ((i < MAX_LEN_OF_BA_ORI_TABLE) && (total > 0)); i++) { |
| 479 | if (pAd->BATable.BAOriEntry[i].ORI_BA_Status == Originator_Done) { |
| 480 | pEntry = |
| 481 | &pAd->MacTab.Content[pAd->BATable.BAOriEntry[i]. |
| 482 | Wcid]; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 483 | TID = pAd->BATable.BAOriEntry[i].TID; |
| 484 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 485 | ASSERT(pAd->BATable.BAOriEntry[i].Wcid < |
| 486 | MAX_LEN_OF_MAC_TABLE); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 487 | } |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 488 | total--; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 489 | } |
| 490 | } |
| 491 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 492 | void SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 493 | { |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 494 | FRAME_BAR FrameBar; |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 495 | unsigned long FrameLen; |
| 496 | int NStatus; |
| 497 | u8 *pOutBuffer = NULL; |
| 498 | u16 Sequence; |
| 499 | u8 i, TID; |
| 500 | u16 idx; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 501 | BA_ORI_ENTRY *pBAEntry; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 502 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 503 | for (i = 0; i < NUM_OF_TID; i++) { |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 504 | idx = pEntry->BAOriWcidArray[i]; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 505 | if (idx == 0) { |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 506 | continue; |
| 507 | } |
| 508 | pBAEntry = &pAd->BATable.BAOriEntry[idx]; |
| 509 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 510 | if (pBAEntry->ORI_BA_Status == Originator_Done) { |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 511 | TID = pBAEntry->TID; |
| 512 | |
| 513 | ASSERT(pBAEntry->Wcid < MAX_LEN_OF_MAC_TABLE); |
| 514 | |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 515 | NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 516 | if (NStatus != NDIS_STATUS_SUCCESS) { |
| 517 | DBGPRINT(RT_DEBUG_ERROR, |
| 518 | ("BA - MlmeADDBAAction() allocate memory failed \n")); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 519 | return; |
| 520 | } |
| 521 | |
| 522 | Sequence = pEntry->TxSeq[TID]; |
Bartlomiej Zolnierkiewicz | 6a28a69a | 2009-04-26 16:05:46 +0200 | [diff] [blame] | 523 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 524 | BarHeaderInit(pAd, &FrameBar, pEntry->Addr, |
| 525 | pAd->CurrentAddress); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 526 | |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 527 | FrameBar.StartingSeq.field.FragNum = 0; /* make sure sequence not clear in DEL function. */ |
| 528 | FrameBar.StartingSeq.field.StartSeq = Sequence; /* make sure sequence not clear in DEL funciton. */ |
| 529 | FrameBar.BarControl.TID = TID; /* make sure sequence not clear in DEL funciton. */ |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 530 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 531 | MakeOutgoingFrame(pOutBuffer, &FrameLen, |
| 532 | sizeof(FRAME_BAR), &FrameBar, |
| 533 | END_OF_ARGS); |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 534 | /*if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET))) */ |
| 535 | if (1) /* Now we always send BAR. */ |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 536 | { |
Bartlomiej Zolnierkiewicz | ec278fa | 2009-12-11 12:23:15 -0800 | [diff] [blame] | 537 | /*MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen); */ |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 538 | MiniportMMRequest(pAd, |
| 539 | (MGMT_USE_QUEUE_FLAG | |
| 540 | MapUserPriorityToAccessCategory |
| 541 | [TID]), pOutBuffer, |
| 542 | FrameLen); |
Bartlomiej Zolnierkiewicz | 59fe2d8 | 2009-04-26 16:06:28 +0200 | [diff] [blame] | 543 | |
Bartlomiej Zolnierkiewicz | ca97b83 | 2009-09-22 20:44:07 +0200 | [diff] [blame] | 544 | } |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 545 | MlmeFreeMemory(pAd, pOutBuffer); |
| 546 | } |
| 547 | } |
| 548 | } |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 549 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 550 | void ActHeaderInit(IN PRTMP_ADAPTER pAd, |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 551 | IN OUT PHEADER_802_11 pHdr80211, |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 552 | u8 *Addr1, u8 *Addr2, u8 *Addr3) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 553 | { |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 554 | NdisZeroMemory(pHdr80211, sizeof(HEADER_802_11)); |
| 555 | pHdr80211->FC.Type = BTYPE_MGMT; |
| 556 | pHdr80211->FC.SubType = SUBTYPE_ACTION; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 557 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 558 | COPY_MAC_ADDR(pHdr80211->Addr1, Addr1); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 559 | COPY_MAC_ADDR(pHdr80211->Addr2, Addr2); |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 560 | COPY_MAC_ADDR(pHdr80211->Addr3, Addr3); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 561 | } |
| 562 | |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 563 | void BarHeaderInit(IN PRTMP_ADAPTER pAd, |
| 564 | IN OUT PFRAME_BAR pCntlBar, u8 *pDA, u8 *pSA) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 565 | { |
| 566 | NdisZeroMemory(pCntlBar, sizeof(FRAME_BAR)); |
| 567 | pCntlBar->FC.Type = BTYPE_CNTL; |
| 568 | pCntlBar->FC.SubType = SUBTYPE_BLOCK_ACK_REQ; |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 569 | pCntlBar->BarControl.MTID = 0; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 570 | pCntlBar->BarControl.Compressed = 1; |
| 571 | pCntlBar->BarControl.ACKPolicy = 0; |
| 572 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 573 | pCntlBar->Duration = |
| 574 | 16 + RTMPCalcDuration(pAd, RATE_1, sizeof(FRAME_BA)); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 575 | |
| 576 | COPY_MAC_ADDR(pCntlBar->Addr1, pDA); |
| 577 | COPY_MAC_ADDR(pCntlBar->Addr2, pSA); |
| 578 | } |
| 579 | |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 580 | /* |
| 581 | ========================================================================== |
| 582 | Description: |
| 583 | Insert Category and action code into the action frame. |
| 584 | |
| 585 | Parametrs: |
| 586 | 1. frame buffer pointer. |
| 587 | 2. frame length. |
| 588 | 3. category code of the frame. |
| 589 | 4. action code of the frame. |
| 590 | |
| 591 | Return : None. |
| 592 | ========================================================================== |
| 593 | */ |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 594 | void InsertActField(IN PRTMP_ADAPTER pAd, |
| 595 | u8 *pFrameBuf, |
| 596 | unsigned long *pFrameLen, u8 Category, u8 ActCode) |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 597 | { |
Bartlomiej Zolnierkiewicz | 51126de | 2009-12-11 12:23:15 -0800 | [diff] [blame^] | 598 | unsigned long TempLen; |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 599 | |
Bartlomiej Zolnierkiewicz | 96b3c83d | 2009-12-11 12:23:13 -0800 | [diff] [blame] | 600 | MakeOutgoingFrame(pFrameBuf, &TempLen, |
| 601 | 1, &Category, 1, &ActCode, END_OF_ARGS); |
Greg Kroah-Hartman | 9198099 | 2008-10-28 14:48:09 -0700 | [diff] [blame] | 602 | |
| 603 | *pFrameLen = *pFrameLen + TempLen; |
| 604 | |
| 605 | return; |
| 606 | } |