1
/********************************************************************************************************************************
2
* This file is created to process BA Action Frame. According to 802.11 spec, there are 3 BA action types at all. And as BA is
3
* related to TS, this part need some struture defined in QOS side code. Also TX RX is going to be resturctured, so how to send
4
* ADDBAREQ ADDBARSP and DELBA packet is still on consideration. Temporarily use MANAGE QUEUE instead of Normal Queue.
6
* *****************************************************************************************************************************/
2
* This file is created to process BA Action Frame. According to 802.11 spec,
3
* there are 3 BA action types at all. And as BA is related to TS, this part
4
* need some struture defined in QOS side code. Also TX RX is going to be
5
* resturctured, so how to send ADDBAREQ ADDBARSP and DELBA packet is still
6
* on consideration. Temporarily use MANAGE QUEUE instead of Normal Queue.
7
8
#include "ieee80211.h"
8
9
#include "rtl819x_BA.h"
10
/********************************************************************************************************************
11
*function: Activate BA entry. And if Time is nozero, start timer.
12
* input: PBA_RECORD pBA //BA entry to be enabled
13
* u16 Time //indicate time delay.
15
********************************************************************************************************************/
12
* Activate BA entry. And if Time is nozero, start timer.
16
14
void ActivateBAEntry(struct ieee80211_device* ieee, PBA_RECORD pBA, u16 Time)
18
16
pBA->bValid = true;
20
18
mod_timer(&pBA->Timer, jiffies + MSECS(Time));
23
/********************************************************************************************************************
24
*function: deactivate BA entry, including its timer.
25
* input: PBA_RECORD pBA //BA entry to be disabled
27
********************************************************************************************************************/
22
* deactivate BA entry, including its timer.
28
24
void DeActivateBAEntry( struct ieee80211_device* ieee, PBA_RECORD pBA)
30
26
pBA->bValid = false;
31
27
del_timer_sync(&pBA->Timer);
33
/********************************************************************************************************************
34
*function: deactivete BA entry in Tx Ts, and send DELBA.
36
* PTX_TS_RECORD pTxTs //Tx Ts which is to deactivate BA entry.
38
* notice: As PTX_TS_RECORD structure will be defined in QOS, so wait to be merged. //FIXME
39
********************************************************************************************************************/
31
* deactivete BA entry in Tx Ts, and send DELBA.
40
33
u8 TxTsDeleteBA( struct ieee80211_device* ieee, PTX_TS_RECORD pTxTs)
42
35
PBA_RECORD pAdmittedBa = &pTxTs->TxAdmittedBARecord; //These two BA entries must exist in TS structure
63
/********************************************************************************************************************
64
*function: deactivete BA entry in Tx Ts, and send DELBA.
66
* PRX_TS_RECORD pRxTs //Rx Ts which is to deactivate BA entry.
68
* notice: As PRX_TS_RECORD structure will be defined in QOS, so wait to be merged. //FIXME, same with above
69
********************************************************************************************************************/
57
* deactivete BA entry in Tx Ts, and send DELBA.
70
59
u8 RxTsDeleteBA( struct ieee80211_device* ieee, PRX_TS_RECORD pRxTs)
72
61
PBA_RECORD pBa = &pRxTs->RxAdmittedBARecord;
84
/********************************************************************************************************************
85
*function: reset BA entry
87
* PBA_RECORD pBA //entry to be reset
89
********************************************************************************************************************/
90
76
void ResetBaEntry( PBA_RECORD pBA)
92
78
pBA->bValid = false;
95
81
pBA->DialogToken = 0;
96
82
pBA->BaStartSeqCtrl.ShortData = 0;
98
//These functions need porting here or not?
99
/*******************************************************************************************************************************
100
*function: construct ADDBAREQ and ADDBARSP frame here together.
101
* input: u8* Dst //ADDBA frame's destination
102
* PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA.
103
* u16 StatusCode //status code in RSP and I will use it to indicate whether it's RSP or REQ(will I?)
104
* u8 type //indicate whether it's RSP(ACT_ADDBARSP) ow REQ(ACT_ADDBAREQ)
106
* return: sk_buff* skb //return constructed skb to xmit
107
*******************************************************************************************************************************/
86
* construct ADDBAREQ and ADDBARSP frame here together.
87
* return constructed skb to xmit
108
89
static struct sk_buff* ieee80211_ADDBA(struct ieee80211_device* ieee, u8* Dst, PBA_RECORD pBA, u16 StatusCode, u8 type)
110
91
struct sk_buff *skb = NULL;
177
#if 0 //I try to merge ADDBA_REQ and ADDBA_RSP frames together..
178
/********************************************************************************************************************
179
*function: construct ADDBAREQ frame
180
* input: u8* dst //ADDBARsp frame's destination
181
* PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA_RSP.
182
* u16 StatusCode //status code.
184
* return: sk_buff* skb //return constructed skb to xmit
185
********************************************************************************************************************/
186
static struct sk_buff* ieee80211_ADDBA_Rsp( IN struct ieee80211_device* ieee, u8* dst, PBA_RECORD pBA, u16 StatusCode)
188
OCTET_STRING osADDBAFrame, tmp;
190
FillOctetString(osADDBAFrame, Buffer, 0);
201
FillOctetString(tmp, &pBA->DialogToken, 1);
202
PacketAppendData(&osADDBAFrame, tmp);
205
FillOctetString(tmp, &StatusCode, 2);
206
PacketAppendData(&osADDBAFrame, tmp);
209
FillOctetString(tmp, &pBA->BaParamSet, 2);
210
PacketAppendData(&osADDBAFrame, tmp);
213
FillOctetString(tmp, &pBA->BaTimeoutValue, 2);
214
PacketAppendData(&osADDBAFrame, tmp);
216
*pLength = osADDBAFrame.Length;
220
/********************************************************************************************************************
221
*function: construct DELBA frame
222
* input: u8* dst //DELBA frame's destination
223
* PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA
224
* TR_SELECT TxRxSelect //TX RX direction
225
* u16 ReasonCode //status code.
227
* return: sk_buff* skb //return constructed skb to xmit
228
********************************************************************************************************************/
159
* construct DELBA frame
229
161
static struct sk_buff* ieee80211_DELBA(
230
162
struct ieee80211_device* ieee,
289
/********************************************************************************************************************
290
*function: send ADDBAReq frame out
291
* input: u8* dst //ADDBAReq frame's destination
292
* PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA
294
* notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does
295
********************************************************************************************************************/
222
* send ADDBAReq frame out
223
* If any possible, please hide pBA in ieee.
224
* And temporarily use Manage Queue as softmac_mgmt_xmit() usually does
296
226
void ieee80211_send_ADDBAReq(struct ieee80211_device* ieee, u8* dst, PBA_RECORD pBA)
298
228
struct sk_buff *skb = NULL;
310
240
IEEE80211_DEBUG(IEEE80211_DL_ERR, "alloc skb error in function %s()\n", __FUNCTION__);
315
/********************************************************************************************************************
316
*function: send ADDBARSP frame out
317
* input: u8* dst //DELBA frame's destination
318
* PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA
319
* u16 StatusCode //RSP StatusCode
321
* notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does
322
********************************************************************************************************************/
245
* send ADDBARSP frame out
246
* If any possible, please hide pBA in ieee.
247
* And temporarily use Manage Queue as softmac_mgmt_xmit() usually does
323
249
void ieee80211_send_ADDBARsp(struct ieee80211_device* ieee, u8* dst, PBA_RECORD pBA, u16 StatusCode)
325
251
struct sk_buff *skb = NULL;
334
260
IEEE80211_DEBUG(IEEE80211_DL_ERR, "alloc skb error in function %s()\n", __FUNCTION__);
340
/********************************************************************************************************************
341
*function: send ADDBARSP frame out
342
* input: u8* dst //DELBA frame's destination
343
* PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA
344
* TR_SELECT TxRxSelect //TX or RX
345
* u16 ReasonCode //DEL ReasonCode
347
* notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does
348
********************************************************************************************************************/
265
* send ADDBARSP frame out
266
* If any possible, please hide pBA in ieee.
267
* And temporarily use Manage Queue as softmac_mgmt_xmit() usually does
350
269
void ieee80211_send_DELBA(struct ieee80211_device* ieee, u8* dst, PBA_RECORD pBA, TR_SELECT TxRxSelect, u16 ReasonCode)
352
271
struct sk_buff *skb = NULL;
366
/********************************************************************************************************************
367
*function: RX ADDBAReq
368
* input: struct sk_buff * skb //incoming ADDBAReq skb.
369
* return: 0(pass), other(fail)
370
* notice: As this function need support of QOS, I comment some code out. And when qos is ready, this code need to be support.
371
********************************************************************************************************************/
372
285
int ieee80211_rx_ADDBAReq( struct ieee80211_device* ieee, struct sk_buff *skb)
374
287
struct ieee80211_hdr_3addr* req = NULL;
440
353
pBA->BaTimeoutValue = *pBaTimeoutVal;
441
354
pBA->BaStartSeqCtrl = *pBaStartSeqCtrl;
442
355
//for half N mode we only aggregate 1 frame
443
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
356
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee))
444
357
pBA->BaParamSet.field.BufferSize = 1;
446
359
pBA->BaParamSet.field.BufferSize = 32;
466
/********************************************************************************************************************
467
*function: RX ADDBARSP
468
* input: struct sk_buff * skb //incoming ADDBAReq skb.
469
* return: 0(pass), other(fail)
470
* notice: As this function need support of QOS, I comment some code out. And when qos is ready, this code need to be support.
471
********************************************************************************************************************/
472
379
int ieee80211_rx_ADDBARsp( struct ieee80211_device* ieee, struct sk_buff *skb)
474
381
struct ieee80211_hdr_3addr* rsp = NULL;
599
/********************************************************************************************************************
601
* input: struct sk_buff * skb //incoming ADDBAReq skb.
602
* return: 0(pass), other(fail)
603
* notice: As this function need support of QOS, I comment some code out. And when qos is ready, this code need to be support.
604
********************************************************************************************************************/
605
506
int ieee80211_rx_DELBA(struct ieee80211_device* ieee,struct sk_buff *skb)
607
508
struct ieee80211_hdr_3addr* delba = NULL;
734
633
DELBA_REASON_END_BA );
737
/********************************************************************************************************************
738
*function: BA setup timer
739
* input: unsigned long data //acturally we send TX_TS_RECORD or RX_TS_RECORD to these timer
742
********************************************************************************************************************/
639
* acturally we send TX_TS_RECORD or RX_TS_RECORD to these timer
743
641
void BaSetupTimeOut(unsigned long data)
745
643
PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)data;