diff options
Diffstat (limited to 'drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c')
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 179 |
1 files changed, 85 insertions, 94 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 86c73570e88a..01b631c2a180 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -19,7 +19,7 @@ static void ActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA, u16 Time) { pBA->bValid = true; - if(Time != 0) + if (Time != 0) mod_timer(&pBA->Timer, jiffies + msecs_to_jiffies(Time)); } @@ -36,14 +36,14 @@ static void DeActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA) /******************************************************************************************************************** *function: deactivete BA entry in Tx Ts, and send DELBA. * input: - * PTX_TS_RECORD pTxTs //Tx Ts which is to deactivate BA entry. + * struct tx_ts_record *pTxTs //Tx Ts which is to deactivate BA entry. * output: none - * notice: As PTX_TS_RECORD structure will be defined in QOS, so wait to be merged. //FIXME + * notice: As struct tx_ts_record * structure will be defined in QOS, so wait to be merged. //FIXME ********************************************************************************************************************/ -static u8 TxTsDeleteBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTs) +static u8 TxTsDeleteBA(struct ieee80211_device *ieee, struct tx_ts_record *pTxTs) { - PBA_RECORD pAdmittedBa = &pTxTs->TxAdmittedBARecord; //These two BA entries must exist in TS structure - PBA_RECORD pPendingBa = &pTxTs->TxPendingBARecord; + PBA_RECORD pAdmittedBa = &pTxTs->tx_admitted_ba_record; //These two BA entries must exist in TS structure + PBA_RECORD pPendingBa = &pTxTs->tx_pending_ba_record; u8 bSendDELBA = false; // Delete pending BA @@ -64,13 +64,13 @@ static u8 TxTsDeleteBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTs) /******************************************************************************************************************** *function: deactivete BA entry in Tx Ts, and send DELBA. * input: - * PRX_TS_RECORD pRxTs //Rx Ts which is to deactivate BA entry. + * struct rx_ts_record *pRxTs //Rx Ts which is to deactivate BA entry. * output: none - * notice: As PRX_TS_RECORD structure will be defined in QOS, so wait to be merged. //FIXME, same with above + * notice: As struct rx_ts_record * structure will be defined in QOS, so wait to be merged. //FIXME, same with above ********************************************************************************************************************/ -static u8 RxTsDeleteBA(struct ieee80211_device *ieee, PRX_TS_RECORD pRxTs) +static u8 RxTsDeleteBA(struct ieee80211_device *ieee, struct rx_ts_record *pRxTs) { - PBA_RECORD pBa = &pRxTs->RxAdmittedBARecord; + PBA_RECORD pBa = &pRxTs->rx_admitted_ba_record; u8 bSendDELBA = false; if (pBa->bValid) { @@ -117,13 +117,13 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P IEEE80211_DEBUG(IEEE80211_DL_ERR, "pBA is NULL\n"); return NULL; } - skb = dev_alloc_skb(len + sizeof( struct rtl_80211_hdr_3addr)); //need to add something others? FIXME + skb = dev_alloc_skb(len + sizeof(struct rtl_80211_hdr_3addr)); //need to add something others? FIXME if (!skb) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); return NULL; } - memset(skb->data, 0, sizeof( struct rtl_80211_hdr_3addr)); //I wonder whether it's necessary. Apparently kernel will not do it when alloc a skb. + memset(skb->data, 0, sizeof(struct rtl_80211_hdr_3addr)); //I wonder whether it's necessary. Apparently kernel will not do it when alloc a skb. skb_reserve(skb, ieee->tx_headroom); BAReq = skb_put(skb, sizeof(struct rtl_80211_hdr_3addr)); @@ -137,10 +137,10 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P //tag += sizeof( struct rtl_80211_hdr_3addr); //move to action field tag = skb_put(skb, 9); - *tag ++= ACT_CAT_BA; - *tag ++= type; + *tag++ = ACT_CAT_BA; + *tag++ = type; // Dialog Token - *tag ++= pBA->DialogToken; + *tag++ = pBA->DialogToken; if (ACT_ADDBARSP == type) { // Status Code @@ -174,7 +174,7 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P *function: construct DELBA frame * input: u8* dst //DELBA frame's destination * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA - * TR_SELECT TxRxSelect //TX RX direction + * enum tr_select TxRxSelect //TX RX direction * u16 ReasonCode //status code. * output: none * return: sk_buff* skb //return constructed skb to xmit @@ -183,7 +183,7 @@ static struct sk_buff *ieee80211_DELBA( struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA, - TR_SELECT TxRxSelect, + enum tr_select TxRxSelect, u16 ReasonCode ) { @@ -201,10 +201,10 @@ static struct sk_buff *ieee80211_DELBA( memset(&DelbaParamSet, 0, 2); - DelbaParamSet.field.Initiator = (TxRxSelect==TX_DIR)?1:0; + DelbaParamSet.field.Initiator = (TxRxSelect == TX_DIR) ? 1 : 0; DelbaParamSet.field.TID = pBA->BaParamSet.field.TID; - skb = dev_alloc_skb(len + sizeof( struct rtl_80211_hdr_3addr)); //need to add something others? FIXME + skb = dev_alloc_skb(len + sizeof(struct rtl_80211_hdr_3addr)); //need to add something others? FIXME if (!skb) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); return NULL; @@ -221,8 +221,8 @@ static struct sk_buff *ieee80211_DELBA( tag = skb_put(skb, 6); - *tag ++= ACT_CAT_BA; - *tag ++= ACT_DELBA; + *tag++ = ACT_CAT_BA; + *tag++ = ACT_DELBA; // DELBA Parameter Set @@ -258,8 +258,7 @@ static void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee, //add statistic needed here. //and skb will be freed in softmac_mgmt_xmit(), so omit all dev_kfree_skb_any() outside softmac_mgmt_xmit() //WB - } - else { + } else { IEEE80211_DEBUG(IEEE80211_DL_ERR, "alloc skb error in function %s()\n", __func__); } } @@ -280,8 +279,7 @@ static void ieee80211_send_ADDBARsp(struct ieee80211_device *ieee, u8 *dst, if (skb) { softmac_mgmt_xmit(skb, ieee); //same above - } - else { + } else { IEEE80211_DEBUG(IEEE80211_DL_ERR, "alloc skb error in function %s()\n", __func__); } @@ -292,14 +290,14 @@ static void ieee80211_send_ADDBARsp(struct ieee80211_device *ieee, u8 *dst, *function: send ADDBARSP frame out * input: u8* dst //DELBA frame's destination * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA - * TR_SELECT TxRxSelect //TX or RX + * enum tr_select TxRxSelect //TX or RX * u16 ReasonCode //DEL ReasonCode * output: none * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does ********************************************************************************************************************/ static void ieee80211_send_DELBA(struct ieee80211_device *ieee, u8 *dst, - PBA_RECORD pBA, TR_SELECT TxRxSelect, + PBA_RECORD pBA, enum tr_select TxRxSelect, u16 ReasonCode) { struct sk_buff *skb; @@ -307,8 +305,7 @@ static void ieee80211_send_DELBA(struct ieee80211_device *ieee, u8 *dst, if (skb) { softmac_mgmt_xmit(skb, ieee); //same above - } - else { + } else { IEEE80211_DEBUG(IEEE80211_DL_ERR, "alloc skb error in function %s()\n", __func__); } } @@ -328,7 +325,7 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) PBA_PARAM_SET pBaParamSet = NULL; u16 *pBaTimeoutVal = NULL; PSEQUENCE_CONTROL pBaStartSeqCtrl = NULL; - PRX_TS_RECORD pTS = NULL; + struct rx_ts_record *pTS = NULL; if (skb->len < sizeof(struct rtl_80211_hdr_3addr) + 9) { IEEE80211_DEBUG(IEEE80211_DL_ERR, @@ -363,16 +360,16 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb) // If there is no matched TS, reject the ADDBA request. if (!GetTs( ieee, - (PTS_COMMON_INFO *)(&pTS), + (struct ts_common_info **)(&pTS), dst, (u8)(pBaParamSet->field.TID), RX_DIR, - true) ) { + true)) { rc = ADDBA_STATUS_REFUSED; IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS in %s()\n", __func__); goto OnADDBAReq_Fail; } - pBA = &pTS->RxAdmittedBARecord; + pBA = &pTS->rx_admitted_ba_record; // To Determine the ADDBA Req content // We can do much more check here, including BufferSize, AMSDU_Support, Policy, StartSeqCtrl... // I want to check StartSeqCtrl to make sure when we start aggregation!!! @@ -423,7 +420,7 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) { struct rtl_80211_hdr_3addr *rsp = NULL; PBA_RECORD pPendingBA, pAdmittedBA; - PTX_TS_RECORD pTS = NULL; + struct tx_ts_record *pTS = NULL; u8 *dst = NULL, *pDialogToken = NULL, *tag = NULL; u16 *pStatusCode = NULL, *pBaTimeoutVal = NULL; PBA_PARAM_SET pBaParamSet = NULL; @@ -450,7 +447,7 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) if (ieee->current_network.qos_data.active == 0 || !ieee->pHTInfo->bCurrentHTSupport || !ieee->pHTInfo->bCurrentAMPDUEnable) { - IEEE80211_DEBUG(IEEE80211_DL_ERR, "reject to ADDBA_RSP as some capability is not ready(%d, %d, %d)\n",ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport, ieee->pHTInfo->bCurrentAMPDUEnable); + IEEE80211_DEBUG(IEEE80211_DL_ERR, "reject to ADDBA_RSP as some capability is not ready(%d, %d, %d)\n", ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport, ieee->pHTInfo->bCurrentAMPDUEnable); ReasonCode = DELBA_REASON_UNKNOWN_BA; goto OnADDBARsp_Reject; } @@ -462,19 +459,19 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) // if (!GetTs( ieee, - (PTS_COMMON_INFO *)(&pTS), + (struct ts_common_info **)(&pTS), dst, (u8)(pBaParamSet->field.TID), TX_DIR, - false) ) { + false)) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS in %s()\n", __func__); ReasonCode = DELBA_REASON_UNKNOWN_BA; goto OnADDBARsp_Reject; } - pTS->bAddBaReqInProgress = false; - pPendingBA = &pTS->TxPendingBARecord; - pAdmittedBA = &pTS->TxAdmittedBARecord; + pTS->add_ba_req_in_progress = false; + pPendingBA = &pTS->tx_pending_ba_record; + pAdmittedBA = &pTS->tx_admitted_ba_record; // @@ -485,19 +482,17 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) // Since BA is already setup, we ignore all other ADDBA Response. IEEE80211_DEBUG(IEEE80211_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. Drop because already admit it! \n"); return -1; - } - else if((!pPendingBA->bValid) ||(*pDialogToken != pPendingBA->DialogToken)) { + } else if ((!pPendingBA->bValid) || (*pDialogToken != pPendingBA->DialogToken)) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "OnADDBARsp(): Recv ADDBA Rsp. BA invalid, DELBA! \n"); ReasonCode = DELBA_REASON_UNKNOWN_BA; goto OnADDBARsp_Reject; - } - else { + } else { IEEE80211_DEBUG(IEEE80211_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n", *pStatusCode); DeActivateBAEntry(ieee, pPendingBA); } - if(*pStatusCode == ADDBA_STATUS_SUCCESS) { + if (*pStatusCode == ADDBA_STATUS_SUCCESS) { // // Determine ADDBA Rsp content here. // We can compare the value of BA parameter set that Peer returned and Self sent. @@ -505,7 +500,7 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) // if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) { // Since this is a kind of ADDBA failed, we delay next ADDBA process. - pTS->bAddBaReqDelayed = true; + pTS->add_ba_req_delayed = true; DeActivateBAEntry(ieee, pAdmittedBA); ReasonCode = DELBA_REASON_END_BA; goto OnADDBARsp_Reject; @@ -521,10 +516,9 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb) pAdmittedBA->BaParamSet = *pBaParamSet; DeActivateBAEntry(ieee, pAdmittedBA); ActivateBAEntry(ieee, pAdmittedBA, *pBaTimeoutVal); - } - else { + } else { // Delay next ADDBA process. - pTS->bAddBaReqDelayed = true; + pTS->add_ba_req_delayed = true; } // End of procedure @@ -562,7 +556,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) if (ieee->current_network.qos_data.active == 0 || !ieee->pHTInfo->bCurrentHTSupport) { - IEEE80211_DEBUG(IEEE80211_DL_ERR, "received DELBA while QOS or HT is not supported(%d, %d)\n",ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); + IEEE80211_DEBUG(IEEE80211_DL_ERR, "received DELBA while QOS or HT is not supported(%d, %d)\n", ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); return -1; } @@ -571,41 +565,40 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) dst = &delba->addr2[0]; pDelBaParamSet = (PDELBA_PARAM_SET)&delba->payload[2]; - if(pDelBaParamSet->field.Initiator == 1) { - PRX_TS_RECORD pRxTs; + if (pDelBaParamSet->field.Initiator == 1) { + struct rx_ts_record *pRxTs; if (!GetTs( ieee, - (PTS_COMMON_INFO *)&pRxTs, + (struct ts_common_info **)&pRxTs, dst, (u8)pDelBaParamSet->field.TID, RX_DIR, - false) ) { + false)) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS for RXTS in %s()\n", __func__); return -1; } RxTsDeleteBA(ieee, pRxTs); - } - else { - PTX_TS_RECORD pTxTs; + } else { + struct tx_ts_record *pTxTs; if (!GetTs( ieee, - (PTS_COMMON_INFO *)&pTxTs, + (struct ts_common_info **)&pTxTs, dst, (u8)pDelBaParamSet->field.TID, TX_DIR, - false) ) { + false)) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't get TS for TXTS in %s()\n", __func__); return -1; } - pTxTs->bUsingBa = false; - pTxTs->bAddBaReqInProgress = false; - pTxTs->bAddBaReqDelayed = false; - del_timer_sync(&pTxTs->TsAddBaTimer); - //PlatformCancelTimer(Adapter, &pTxTs->TsAddBaTimer); + pTxTs->using_ba = false; + pTxTs->add_ba_req_in_progress = false; + pTxTs->add_ba_req_delayed = false; + del_timer_sync(&pTxTs->ts_add_ba_timer); + //PlatformCancelTimer(Adapter, &pTxTs->ts_add_ba_timer); TxTsDeleteBA(ieee, pTxTs); } return 0; @@ -617,12 +610,12 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb) void TsInitAddBA( struct ieee80211_device *ieee, - PTX_TS_RECORD pTS, + struct tx_ts_record *pTS, u8 Policy, u8 bOverwritePending ) { - PBA_RECORD pBA = &pTS->TxPendingBARecord; + PBA_RECORD pBA = &pTS->tx_pending_ba_record; if (pBA->bValid && !bOverwritePending) return; @@ -633,81 +626,79 @@ TsInitAddBA( pBA->DialogToken++; // DialogToken: Only keep the latest dialog token pBA->BaParamSet.field.AMSDU_Support = 0; // Do not support A-MSDU with A-MPDU now!! pBA->BaParamSet.field.BAPolicy = Policy; // Policy: Delayed or Immediate - pBA->BaParamSet.field.TID = pTS->TsCommonInfo.TSpec.f.TSInfo.field.ucTSID; // TID + pBA->BaParamSet.field.TID = pTS->ts_common_info.t_spec.ts_info.uc_tsid; // TID // BufferSize: This need to be set according to A-MPDU vector pBA->BaParamSet.field.BufferSize = 32; // BufferSize: This need to be set according to A-MPDU vector pBA->BaTimeoutValue = 0; // Timeout value: Set 0 to disable Timer - pBA->BaStartSeqCtrl.field.SeqNum = (pTS->TxCurSeq + 3) % 4096; // Block Ack will start after 3 packets later. + pBA->BaStartSeqCtrl.field.SeqNum = (pTS->tx_cur_seq + 3) % 4096; // Block Ack will start after 3 packets later. ActivateBAEntry(ieee, pBA, BA_SETUP_TIMEOUT); - ieee80211_send_ADDBAReq(ieee, pTS->TsCommonInfo.Addr, pBA); + ieee80211_send_ADDBAReq(ieee, pTS->ts_common_info.addr, pBA); } void -TsInitDelBA( struct ieee80211_device *ieee, PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect) +TsInitDelBA(struct ieee80211_device *ieee, struct ts_common_info *pTsCommonInfo, enum tr_select TxRxSelect) { + if (TxRxSelect == TX_DIR) { + struct tx_ts_record *pTxTs = (struct tx_ts_record *)pTsCommonInfo; - if(TxRxSelect == TX_DIR) { - PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)pTsCommonInfo; - - if(TxTsDeleteBA(ieee, pTxTs)) + if (TxTsDeleteBA(ieee, pTxTs)) ieee80211_send_DELBA( ieee, - pTsCommonInfo->Addr, - (pTxTs->TxAdmittedBARecord.bValid)?(&pTxTs->TxAdmittedBARecord):(&pTxTs->TxPendingBARecord), + pTsCommonInfo->addr, + (pTxTs->tx_admitted_ba_record.bValid)?(&pTxTs->tx_admitted_ba_record):(&pTxTs->tx_pending_ba_record), TxRxSelect, DELBA_REASON_END_BA); - } - else if(TxRxSelect == RX_DIR) { - PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)pTsCommonInfo; - if(RxTsDeleteBA(ieee, pRxTs)) + } else if (TxRxSelect == RX_DIR) { + struct rx_ts_record *pRxTs = (struct rx_ts_record *)pTsCommonInfo; + if (RxTsDeleteBA(ieee, pRxTs)) ieee80211_send_DELBA( ieee, - pTsCommonInfo->Addr, - &pRxTs->RxAdmittedBARecord, + pTsCommonInfo->addr, + &pRxTs->rx_admitted_ba_record, TxRxSelect, - DELBA_REASON_END_BA ); + DELBA_REASON_END_BA); } } /******************************************************************************************************************** *function: BA setup timer - * input: unsigned long data //acturally we send TX_TS_RECORD or RX_TS_RECORD to these timer + * input: unsigned long data //acturally we send struct tx_ts_record or struct rx_ts_record to these timer * return: NULL * notice: ********************************************************************************************************************/ void BaSetupTimeOut(struct timer_list *t) { - PTX_TS_RECORD pTxTs = from_timer(pTxTs, t, TxPendingBARecord.Timer); + struct tx_ts_record *pTxTs = from_timer(pTxTs, t, tx_pending_ba_record.Timer); - pTxTs->bAddBaReqInProgress = false; - pTxTs->bAddBaReqDelayed = true; - pTxTs->TxPendingBARecord.bValid = false; + pTxTs->add_ba_req_in_progress = false; + pTxTs->add_ba_req_delayed = true; + pTxTs->tx_pending_ba_record.bValid = false; } void TxBaInactTimeout(struct timer_list *t) { - PTX_TS_RECORD pTxTs = from_timer(pTxTs, t, TxAdmittedBARecord.Timer); + struct tx_ts_record *pTxTs = from_timer(pTxTs, t, tx_admitted_ba_record.Timer); struct ieee80211_device *ieee = container_of(pTxTs, struct ieee80211_device, TxTsRecord[pTxTs->num]); TxTsDeleteBA(ieee, pTxTs); ieee80211_send_DELBA( ieee, - pTxTs->TsCommonInfo.Addr, - &pTxTs->TxAdmittedBARecord, + pTxTs->ts_common_info.addr, + &pTxTs->tx_admitted_ba_record, TX_DIR, DELBA_REASON_TIMEOUT); } void RxBaInactTimeout(struct timer_list *t) { - PRX_TS_RECORD pRxTs = from_timer(pRxTs, t, RxAdmittedBARecord.Timer); + struct rx_ts_record *pRxTs = from_timer(pRxTs, t, rx_admitted_ba_record.Timer); struct ieee80211_device *ieee = container_of(pRxTs, struct ieee80211_device, RxTsRecord[pRxTs->num]); RxTsDeleteBA(ieee, pRxTs); ieee80211_send_DELBA( ieee, - pRxTs->TsCommonInfo.Addr, - &pRxTs->RxAdmittedBARecord, + pRxTs->ts_common_info.addr, + &pRxTs->rx_admitted_ba_record, RX_DIR, DELBA_REASON_TIMEOUT); } |