Commit 831cb9db authored by Larry Finger's avatar Larry Finger Committed by Greg Kroah-Hartman

staging: rtl8192e: Cleanup checkpatch -f warnings and errors - Part V

Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 547d0c34
...@@ -38,11 +38,10 @@ ...@@ -38,11 +38,10 @@
#define DELBA_REASON_TIMEOUT 39 #define DELBA_REASON_TIMEOUT 39
union sequence_control { union sequence_control {
u16 ShortData; u16 ShortData;
struct struct {
{
u16 FragNum:4; u16 FragNum:4;
u16 SeqNum:12; u16 SeqNum:12;
}field; } field;
}; };
union ba_param_set { union ba_param_set {
......
...@@ -20,46 +20,44 @@ ...@@ -20,46 +20,44 @@
#include "rtl819x_BA.h" #include "rtl819x_BA.h"
#include "rtl_core.h" #include "rtl_core.h"
void ActivateBAEntry(struct rtllib_device* ieee, struct ba_record *pBA, u16 Time) void ActivateBAEntry(struct rtllib_device *ieee, struct ba_record *pBA,
u16 Time)
{ {
pBA->bValid = true; pBA->bValid = true;
if (Time != 0) if (Time != 0)
mod_timer(&pBA->Timer, jiffies + MSECS(Time)); mod_timer(&pBA->Timer, jiffies + MSECS(Time));
} }
void DeActivateBAEntry( struct rtllib_device* ieee, struct ba_record *pBA) void DeActivateBAEntry(struct rtllib_device *ieee, struct ba_record *pBA)
{ {
pBA->bValid = false; pBA->bValid = false;
del_timer_sync(&pBA->Timer); del_timer_sync(&pBA->Timer);
} }
u8 TxTsDeleteBA( struct rtllib_device* ieee, struct tx_ts_record *pTxTs)
u8 TxTsDeleteBA(struct rtllib_device *ieee, struct tx_ts_record *pTxTs)
{ {
struct ba_record *pAdmittedBa = &pTxTs->TxAdmittedBARecord; struct ba_record *pAdmittedBa = &pTxTs->TxAdmittedBARecord;
struct ba_record *pPendingBa = &pTxTs->TxPendingBARecord; struct ba_record *pPendingBa = &pTxTs->TxPendingBARecord;
u8 bSendDELBA = false; u8 bSendDELBA = false;
if (pPendingBa->bValid) if (pPendingBa->bValid) {
{
DeActivateBAEntry(ieee, pPendingBa); DeActivateBAEntry(ieee, pPendingBa);
bSendDELBA = true; bSendDELBA = true;
} }
if (pAdmittedBa->bValid) if (pAdmittedBa->bValid) {
{
DeActivateBAEntry(ieee, pAdmittedBa); DeActivateBAEntry(ieee, pAdmittedBa);
bSendDELBA = true; bSendDELBA = true;
} }
return bSendDELBA; return bSendDELBA;
} }
u8 RxTsDeleteBA( struct rtllib_device* ieee, struct rx_ts_record *pRxTs) u8 RxTsDeleteBA(struct rtllib_device *ieee, struct rx_ts_record *pRxTs)
{ {
struct ba_record *pBa = &pRxTs->RxAdmittedBARecord; struct ba_record *pBa = &pRxTs->RxAdmittedBARecord;
u8 bSendDELBA = false; u8 bSendDELBA = false;
if (pBa->bValid) if (pBa->bValid) {
{
DeActivateBAEntry(ieee, pBa); DeActivateBAEntry(ieee, pBa);
bSendDELBA = true; bSendDELBA = true;
} }
...@@ -67,7 +65,7 @@ u8 RxTsDeleteBA( struct rtllib_device* ieee, struct rx_ts_record *pRxTs) ...@@ -67,7 +65,7 @@ u8 RxTsDeleteBA( struct rtllib_device* ieee, struct rx_ts_record *pRxTs)
return bSendDELBA; return bSendDELBA;
} }
void ResetBaEntry( struct ba_record *pBA) void ResetBaEntry(struct ba_record *pBA)
{ {
pBA->bValid = false; pBA->bValid = false;
pBA->BaParamSet.shortData = 0; pBA->BaParamSet.shortData = 0;
...@@ -75,31 +73,35 @@ void ResetBaEntry( struct ba_record *pBA) ...@@ -75,31 +73,35 @@ void ResetBaEntry( struct ba_record *pBA)
pBA->DialogToken = 0; pBA->DialogToken = 0;
pBA->BaStartSeqCtrl.ShortData = 0; pBA->BaStartSeqCtrl.ShortData = 0;
} }
static struct sk_buff* rtllib_ADDBA(struct rtllib_device* ieee, u8* Dst, struct ba_record *pBA, u16 StatusCode, u8 type) static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,
struct ba_record *pBA,
u16 StatusCode, u8 type)
{ {
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct rtllib_hdr_3addr* BAReq = NULL; struct rtllib_hdr_3addr *BAReq = NULL;
u8* tag = NULL; u8 *tag = NULL;
u16 tmp = 0; u16 tmp = 0;
u16 len = ieee->tx_headroom + 9; u16 len = ieee->tx_headroom + 9;
RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, "========>%s(), frame(%d) sentd to:"MAC_FMT", ieee->dev:%p\n", __func__, type, MAC_ARG(Dst), ieee->dev); RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, "========>%s(), frame(%d)"
if (pBA == NULL||ieee == NULL) " sentd to:"MAC_FMT", ieee->dev:%p\n", __func__,
{ type, MAC_ARG(Dst), ieee->dev);
RTLLIB_DEBUG(RTLLIB_DL_ERR, "pBA(%p) is NULL or ieee(%p) is NULL\n", pBA, ieee); if (pBA == NULL || ieee == NULL) {
RTLLIB_DEBUG(RTLLIB_DL_ERR, "pBA(%p) is NULL or ieee(%p) is "
"NULL\n", pBA, ieee);
return NULL; return NULL;
} }
skb = dev_alloc_skb(len + sizeof( struct rtllib_hdr_3addr)); skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr));
if (skb == NULL) if (skb == NULL) {
{
RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't alloc skb for ADDBA_REQ\n");
return NULL; return NULL;
} }
memset(skb->data, 0, sizeof( struct rtllib_hdr_3addr)); memset(skb->data, 0, sizeof(struct rtllib_hdr_3addr));
skb_reserve(skb, ieee->tx_headroom); skb_reserve(skb, ieee->tx_headroom);
BAReq = ( struct rtllib_hdr_3addr *) skb_put(skb,sizeof( struct rtllib_hdr_3addr)); BAReq = (struct rtllib_hdr_3addr *)skb_put(skb,
sizeof(struct rtllib_hdr_3addr));
memcpy(BAReq->addr1, Dst, ETH_ALEN); memcpy(BAReq->addr1, Dst, ETH_ALEN);
memcpy(BAReq->addr2, ieee->dev->dev_addr, ETH_ALEN); memcpy(BAReq->addr2, ieee->dev->dev_addr, ETH_ALEN);
...@@ -107,28 +109,26 @@ static struct sk_buff* rtllib_ADDBA(struct rtllib_device* ieee, u8* Dst, struct ...@@ -107,28 +109,26 @@ static struct sk_buff* rtllib_ADDBA(struct rtllib_device* ieee, u8* Dst, struct
memcpy(BAReq->addr3, ieee->current_network.bssid, ETH_ALEN); memcpy(BAReq->addr3, ieee->current_network.bssid, ETH_ALEN);
BAReq->frame_ctl = cpu_to_le16(RTLLIB_STYPE_MANAGE_ACT); BAReq->frame_ctl = cpu_to_le16(RTLLIB_STYPE_MANAGE_ACT);
tag = (u8*)skb_put(skb, 9); tag = (u8 *)skb_put(skb, 9);
*tag ++= ACT_CAT_BA; *tag ++= ACT_CAT_BA;
*tag ++= type; *tag ++= type;
*tag ++= pBA->DialogToken; *tag ++= pBA->DialogToken;
if (ACT_ADDBARSP == type) if (ACT_ADDBARSP == type) {
{
RT_TRACE(COMP_DBG, "====>to send ADDBARSP\n"); RT_TRACE(COMP_DBG, "====>to send ADDBARSP\n");
tmp = cpu_to_le16(StatusCode); tmp = cpu_to_le16(StatusCode);
memcpy(tag, (u8*)&tmp, 2); memcpy(tag, (u8 *)&tmp, 2);
tag += 2; tag += 2;
} }
tmp = cpu_to_le16(pBA->BaParamSet.shortData); tmp = cpu_to_le16(pBA->BaParamSet.shortData);
memcpy(tag, (u8*)&tmp, 2); memcpy(tag, (u8 *)&tmp, 2);
tag += 2; tag += 2;
tmp = cpu_to_le16(pBA->BaTimeoutValue); tmp = cpu_to_le16(pBA->BaTimeoutValue);
memcpy(tag, (u8*)&tmp, 2); memcpy(tag, (u8 *)&tmp, 2);
tag += 2; tag += 2;
if (ACT_ADDBAREQ == type) if (ACT_ADDBAREQ == type) {
{ memcpy(tag, (u8 *)&(pBA->BaStartSeqCtrl), 2);
memcpy(tag,(u8*)&(pBA->BaStartSeqCtrl), 2);
tag += 2; tag += 2;
} }
...@@ -136,64 +136,65 @@ static struct sk_buff* rtllib_ADDBA(struct rtllib_device* ieee, u8* Dst, struct ...@@ -136,64 +136,65 @@ static struct sk_buff* rtllib_ADDBA(struct rtllib_device* ieee, u8* Dst, struct
return skb; return skb;
} }
static struct sk_buff* rtllib_DELBA( static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst,
struct rtllib_device* ieee, struct ba_record *pBA,
u8* dst, enum tr_select TxRxSelect, u16 ReasonCode)
struct ba_record *pBA,
enum tr_select TxRxSelect,
u16 ReasonCode
)
{ {
union delba_param_set DelbaParamSet; union delba_param_set DelbaParamSet;
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct rtllib_hdr_3addr* Delba = NULL; struct rtllib_hdr_3addr *Delba = NULL;
u8* tag = NULL; u8 *tag = NULL;
u16 tmp = 0; u16 tmp = 0;
u16 len = 6 + ieee->tx_headroom; u16 len = 6 + ieee->tx_headroom;
if (net_ratelimit()) if (net_ratelimit())
RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, "========>%s(), ReasonCode(%d) sentd to:"MAC_FMT"\n", __func__, ReasonCode, MAC_ARG(dst)); RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA,
"========>%s(), Reason"
"Code(%d) sentd to:"MAC_FMT"\n", __func__,
ReasonCode, MAC_ARG(dst));
memset(&DelbaParamSet, 0, 2); 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; DelbaParamSet.field.TID = pBA->BaParamSet.field.TID;
skb = dev_alloc_skb(len + sizeof( struct rtllib_hdr_3addr)); skb = dev_alloc_skb(len + sizeof(struct rtllib_hdr_3addr));
if (skb == NULL) if (skb == NULL) {
{
RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't alloc skb for ADDBA_REQ\n"); RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't alloc skb for ADDBA_REQ\n");
return NULL; return NULL;
} }
skb_reserve(skb, ieee->tx_headroom); skb_reserve(skb, ieee->tx_headroom);
Delba = ( struct rtllib_hdr_3addr *) skb_put(skb,sizeof( struct rtllib_hdr_3addr)); Delba = (struct rtllib_hdr_3addr *) skb_put(skb,
sizeof(struct rtllib_hdr_3addr));
memcpy(Delba->addr1, dst, ETH_ALEN); memcpy(Delba->addr1, dst, ETH_ALEN);
memcpy(Delba->addr2, ieee->dev->dev_addr, ETH_ALEN); memcpy(Delba->addr2, ieee->dev->dev_addr, ETH_ALEN);
memcpy(Delba->addr3, ieee->current_network.bssid, ETH_ALEN); memcpy(Delba->addr3, ieee->current_network.bssid, ETH_ALEN);
Delba->frame_ctl = cpu_to_le16(RTLLIB_STYPE_MANAGE_ACT); Delba->frame_ctl = cpu_to_le16(RTLLIB_STYPE_MANAGE_ACT);
tag = (u8*)skb_put(skb, 6); tag = (u8 *)skb_put(skb, 6);
*tag ++= ACT_CAT_BA; *tag ++= ACT_CAT_BA;
*tag ++= ACT_DELBA; *tag ++= ACT_DELBA;
tmp = cpu_to_le16(DelbaParamSet.shortData); tmp = cpu_to_le16(DelbaParamSet.shortData);
memcpy(tag, (u8*)&tmp, 2); memcpy(tag, (u8 *)&tmp, 2);
tag += 2; tag += 2;
tmp = cpu_to_le16(ReasonCode); tmp = cpu_to_le16(ReasonCode);
memcpy(tag, (u8*)&tmp, 2); memcpy(tag, (u8 *)&tmp, 2);
tag += 2; tag += 2;
RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_BA, skb->data, skb->len); RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_BA, skb->data, skb->len);
if (net_ratelimit()) if (net_ratelimit())
RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, "<=====%s()\n", __func__); RTLLIB_DEBUG(RTLLIB_DL_TRACE | RTLLIB_DL_BA, "<=====%s()\n",
__func__);
return skb; return skb;
} }
void rtllib_send_ADDBAReq(struct rtllib_device* ieee, u8* dst, struct ba_record *pBA) void rtllib_send_ADDBAReq(struct rtllib_device *ieee, u8 *dst,
struct ba_record *pBA)
{ {
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
skb = rtllib_ADDBA(ieee, dst, pBA, 0, ACT_ADDBAREQ); skb = rtllib_ADDBA(ieee, dst, pBA, 0, ACT_ADDBAREQ);
...@@ -202,65 +203,66 @@ void rtllib_send_ADDBAReq(struct rtllib_device* ieee, u8* dst, struct ba_record ...@@ -202,65 +203,66 @@ void rtllib_send_ADDBAReq(struct rtllib_device* ieee, u8* dst, struct ba_record
RT_TRACE(COMP_DBG, "====>to send ADDBAREQ!!!!!\n"); RT_TRACE(COMP_DBG, "====>to send ADDBAREQ!!!!!\n");
softmac_mgmt_xmit(skb, ieee); softmac_mgmt_xmit(skb, ieee);
} else { } else {
RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in function %s()\n", __func__); RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in function"
" %s()\n", __func__);
} }
return; return;
} }
void rtllib_send_ADDBARsp(struct rtllib_device* ieee, u8* dst, struct ba_record *pBA, u16 StatusCode) void rtllib_send_ADDBARsp(struct rtllib_device *ieee, u8 *dst,
struct ba_record *pBA, u16 StatusCode)
{ {
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
skb = rtllib_ADDBA(ieee, dst, pBA, StatusCode, ACT_ADDBARSP); skb = rtllib_ADDBA(ieee, dst, pBA, StatusCode, ACT_ADDBARSP);
if (skb) if (skb)
softmac_mgmt_xmit(skb, ieee); softmac_mgmt_xmit(skb, ieee);
else else
RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in function %s()\n", __func__); RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in function"
" %s()\n", __func__);
return; return;
} }
void rtllib_send_DELBA(struct rtllib_device* ieee, u8* dst, struct ba_record *pBA, enum tr_select TxRxSelect, u16 ReasonCode) void rtllib_send_DELBA(struct rtllib_device *ieee, u8 *dst,
struct ba_record *pBA, enum tr_select TxRxSelect,
u16 ReasonCode)
{ {
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
skb = rtllib_DELBA(ieee, dst, pBA, TxRxSelect, ReasonCode); skb = rtllib_DELBA(ieee, dst, pBA, TxRxSelect, ReasonCode);
if (skb) if (skb)
{
softmac_mgmt_xmit(skb, ieee); softmac_mgmt_xmit(skb, ieee);
}
else else
{ RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in func"
RTLLIB_DEBUG(RTLLIB_DL_ERR, "alloc skb error in function %s()\n", __func__); "tion %s()\n", __func__);
}
return ; return ;
} }
int rtllib_rx_ADDBAReq( struct rtllib_device* ieee, struct sk_buff *skb) int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb)
{ {
struct rtllib_hdr_3addr* req = NULL; struct rtllib_hdr_3addr *req = NULL;
u16 rc = 0; u16 rc = 0;
u8 * dst = NULL, *pDialogToken = NULL, *tag = NULL; u8 *dst = NULL, *pDialogToken = NULL, *tag = NULL;
struct ba_record *pBA = NULL; struct ba_record *pBA = NULL;
union ba_param_set *pBaParamSet = NULL; union ba_param_set *pBaParamSet = NULL;
u16* pBaTimeoutVal = NULL; u16 *pBaTimeoutVal = NULL;
union sequence_control *pBaStartSeqCtrl = NULL; union sequence_control *pBaStartSeqCtrl = NULL;
struct rx_ts_record *pTS = NULL; struct rx_ts_record *pTS = NULL;
if (skb->len < sizeof( struct rtllib_hdr_3addr) + 9) if (skb->len < sizeof(struct rtllib_hdr_3addr) + 9) {
{ RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in BAREQ(%d / "
RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in BAREQ(%d / %d)\n",(int)skb->len, (int)(sizeof( struct rtllib_hdr_3addr) + 9)); "%d)\n", (int)skb->len,
(int)(sizeof(struct rtllib_hdr_3addr) + 9));
return -1; return -1;
} }
RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_BA, skb->data, skb->len); RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_BA, skb->data, skb->len);
req = ( struct rtllib_hdr_3addr*) skb->data; req = (struct rtllib_hdr_3addr *) skb->data;
tag = (u8*)req; tag = (u8 *)req;
dst = (u8*)(&req->addr2[0]); dst = (u8 *)(&req->addr2[0]);
tag += sizeof( struct rtllib_hdr_3addr); tag += sizeof(struct rtllib_hdr_3addr);
pDialogToken = tag + 2; pDialogToken = tag + 2;
pBaParamSet = (union ba_param_set *)(tag + 3); pBaParamSet = (union ba_param_set *)(tag + 3);
pBaTimeoutVal = (u16*)(tag + 5); pBaTimeoutVal = (u16 *)(tag + 5);
pBaStartSeqCtrl = (union sequence_control *)(req + 7); pBaStartSeqCtrl = (union sequence_control *)(req + 7);
RT_TRACE(COMP_DBG, "====>rx ADDBAREQ from :"MAC_FMT"\n", MAC_ARG(dst)); RT_TRACE(COMP_DBG, "====>rx ADDBAREQ from :"MAC_FMT"\n", MAC_ARG(dst));
...@@ -268,31 +270,27 @@ int rtllib_rx_ADDBAReq( struct rtllib_device* ieee, struct sk_buff *skb) ...@@ -268,31 +270,27 @@ int rtllib_rx_ADDBAReq( struct rtllib_device* ieee, struct sk_buff *skb)
(ieee->pHTInfo->bCurrentHTSupport == false) || (ieee->pHTInfo->bCurrentHTSupport == false) ||
(ieee->pHTInfo->IOTAction & HT_IOT_ACT_REJECT_ADDBA_REQ)) { (ieee->pHTInfo->IOTAction & HT_IOT_ACT_REJECT_ADDBA_REQ)) {
rc = ADDBA_STATUS_REFUSED; rc = ADDBA_STATUS_REFUSED;
RTLLIB_DEBUG(RTLLIB_DL_ERR, "Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n", ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); RTLLIB_DEBUG(RTLLIB_DL_ERR, "Failed to reply on ADDBA_REQ as "
"some capability is not ready(%d, %d)\n",
ieee->current_network.qos_data.active,
ieee->pHTInfo->bCurrentHTSupport);
goto OnADDBAReq_Fail; goto OnADDBAReq_Fail;
} }
if (!GetTs( if (!GetTs(ieee, (struct ts_common_info **)(&pTS), dst,
ieee, (u8)(pBaParamSet->field.TID), RX_DIR, true)) {
(struct ts_common_info **)(&pTS),
dst,
(u8)(pBaParamSet->field.TID),
RX_DIR,
true) )
{
rc = ADDBA_STATUS_REFUSED; rc = ADDBA_STATUS_REFUSED;
RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS in %s()\n", __func__); RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS in %s()\n", __func__);
goto OnADDBAReq_Fail; goto OnADDBAReq_Fail;
} }
pBA = &pTS->RxAdmittedBARecord; pBA = &pTS->RxAdmittedBARecord;
if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) {
{
rc = ADDBA_STATUS_INVALID_PARAM; rc = ADDBA_STATUS_INVALID_PARAM;
RTLLIB_DEBUG(RTLLIB_DL_ERR, "BA Policy is not correct in %s()\n", __func__); RTLLIB_DEBUG(RTLLIB_DL_ERR, "BA Policy is not correct in "
"%s()\n", __func__);
goto OnADDBAReq_Fail; goto OnADDBAReq_Fail;
} }
rtllib_FlushRxTsPendingPkts(ieee, pTS); rtllib_FlushRxTsPendingPkts(ieee, pTS);
DeActivateBAEntry(ieee, pBA); DeActivateBAEntry(ieee, pBA);
...@@ -301,11 +299,11 @@ int rtllib_rx_ADDBAReq( struct rtllib_device* ieee, struct sk_buff *skb) ...@@ -301,11 +299,11 @@ int rtllib_rx_ADDBAReq( struct rtllib_device* ieee, struct sk_buff *skb)
pBA->BaTimeoutValue = *pBaTimeoutVal; pBA->BaTimeoutValue = *pBaTimeoutVal;
pBA->BaStartSeqCtrl = *pBaStartSeqCtrl; pBA->BaStartSeqCtrl = *pBaStartSeqCtrl;
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)|| if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev) ||
(ieee->pHTInfo->IOTAction & HT_IOT_ACT_ALLOW_PEER_AGG_ONE_PKT)) (ieee->pHTInfo->IOTAction & HT_IOT_ACT_ALLOW_PEER_AGG_ONE_PKT))
pBA->BaParamSet.field.BufferSize = 1; pBA->BaParamSet.field.BufferSize = 1;
else else
pBA->BaParamSet.field.BufferSize = 32; pBA->BaParamSet.field.BufferSize = 32;
ActivateBAEntry(ieee, pBA, 0); ActivateBAEntry(ieee, pBA, 0);
rtllib_send_ADDBARsp(ieee, dst, pBA, ADDBA_STATUS_SUCCESS); rtllib_send_ADDBARsp(ieee, dst, pBA, ADDBA_STATUS_SUCCESS);
...@@ -322,40 +320,42 @@ int rtllib_rx_ADDBAReq( struct rtllib_device* ieee, struct sk_buff *skb) ...@@ -322,40 +320,42 @@ int rtllib_rx_ADDBAReq( struct rtllib_device* ieee, struct sk_buff *skb)
rtllib_send_ADDBARsp(ieee, dst, &BA, rc); rtllib_send_ADDBARsp(ieee, dst, &BA, rc);
return 0; return 0;
} }
} }
int rtllib_rx_ADDBARsp( struct rtllib_device* ieee, struct sk_buff *skb) int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb)
{ {
struct rtllib_hdr_3addr* rsp = NULL; struct rtllib_hdr_3addr *rsp = NULL;
struct ba_record *pPendingBA, *pAdmittedBA; struct ba_record *pPendingBA, *pAdmittedBA;
struct tx_ts_record *pTS = NULL; struct tx_ts_record *pTS = NULL;
u8* dst = NULL, *pDialogToken = NULL, *tag = NULL; u8 *dst = NULL, *pDialogToken = NULL, *tag = NULL;
u16* pStatusCode = NULL, *pBaTimeoutVal = NULL; u16 *pStatusCode = NULL, *pBaTimeoutVal = NULL;
union ba_param_set *pBaParamSet = NULL; union ba_param_set *pBaParamSet = NULL;
u16 ReasonCode; u16 ReasonCode;
if (skb->len < sizeof( struct rtllib_hdr_3addr) + 9) if (skb->len < sizeof(struct rtllib_hdr_3addr) + 9) {
{ RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in BARSP(%d / "
RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in BARSP(%d / %d)\n", (int)skb->len, (int)(sizeof( struct rtllib_hdr_3addr) + 9)); "%d)\n", (int)skb->len,
(int)(sizeof(struct rtllib_hdr_3addr) + 9));
return -1; return -1;
} }
rsp = ( struct rtllib_hdr_3addr*)skb->data; rsp = (struct rtllib_hdr_3addr *)skb->data;
tag = (u8*)rsp; tag = (u8 *)rsp;
dst = (u8*)(&rsp->addr2[0]); dst = (u8 *)(&rsp->addr2[0]);
tag += sizeof( struct rtllib_hdr_3addr); tag += sizeof(struct rtllib_hdr_3addr);
pDialogToken = tag + 2; pDialogToken = tag + 2;
pStatusCode = (u16*)(tag + 3); pStatusCode = (u16 *)(tag + 3);
pBaParamSet = (union ba_param_set *)(tag + 5); pBaParamSet = (union ba_param_set *)(tag + 5);
pBaTimeoutVal = (u16*)(tag + 7); pBaTimeoutVal = (u16 *)(tag + 7);
RT_TRACE(COMP_DBG, "====>rx ADDBARSP from :"MAC_FMT"\n", MAC_ARG(dst)); RT_TRACE(COMP_DBG, "====>rx ADDBARSP from :"MAC_FMT"\n", MAC_ARG(dst));
if ( if (ieee->current_network.qos_data.active == 0 ||
ieee->current_network.qos_data.active == 0 || ieee->pHTInfo->bCurrentHTSupport == false ||
ieee->pHTInfo->bCurrentHTSupport == false || ieee->pHTInfo->bCurrentAMPDUEnable == false) {
ieee->pHTInfo->bCurrentAMPDUEnable == false ) RTLLIB_DEBUG(RTLLIB_DL_ERR, "reject to ADDBA_RSP as some capab"
{ "ility is not ready(%d, %d, %d)\n",
RTLLIB_DEBUG(RTLLIB_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); ieee->current_network.qos_data.active,
ieee->pHTInfo->bCurrentHTSupport,
ieee->pHTInfo->bCurrentAMPDUEnable);
ReasonCode = DELBA_REASON_UNKNOWN_BA; ReasonCode = DELBA_REASON_UNKNOWN_BA;
goto OnADDBARsp_Reject; goto OnADDBARsp_Reject;
} }
...@@ -373,28 +373,25 @@ int rtllib_rx_ADDBARsp( struct rtllib_device* ieee, struct sk_buff *skb) ...@@ -373,28 +373,25 @@ int rtllib_rx_ADDBARsp( struct rtllib_device* ieee, struct sk_buff *skb)
pAdmittedBA = &pTS->TxAdmittedBARecord; pAdmittedBA = &pTS->TxAdmittedBARecord;
if ((pAdmittedBA->bValid==true)) if ((pAdmittedBA->bValid == true)) {
{ RTLLIB_DEBUG(RTLLIB_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp."
RTLLIB_DEBUG(RTLLIB_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. Drop because already admit it! \n"); " Drop because already admit it!\n");
return -1; return -1;
} } else if ((pPendingBA->bValid == false) ||
else if ((pPendingBA->bValid == false) ||(*pDialogToken != pPendingBA->DialogToken)) (*pDialogToken != pPendingBA->DialogToken)) {
{ RTLLIB_DEBUG(RTLLIB_DL_ERR, "OnADDBARsp(): Recv ADDBA Rsp. "
RTLLIB_DEBUG(RTLLIB_DL_ERR, "OnADDBARsp(): Recv ADDBA Rsp. BA invalid, DELBA! \n"); "BA invalid, DELBA!\n");
ReasonCode = DELBA_REASON_UNKNOWN_BA; ReasonCode = DELBA_REASON_UNKNOWN_BA;
goto OnADDBARsp_Reject; goto OnADDBARsp_Reject;
} } else {
else RTLLIB_DEBUG(RTLLIB_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. BA "
{ "is admitted! Status code:%X\n", *pStatusCode);
RTLLIB_DEBUG(RTLLIB_DL_BA, "OnADDBARsp(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n", *pStatusCode);
DeActivateBAEntry(ieee, pPendingBA); DeActivateBAEntry(ieee, pPendingBA);
} }
if (*pStatusCode == ADDBA_STATUS_SUCCESS) if (*pStatusCode == ADDBA_STATUS_SUCCESS) {
{ if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED) {
if (pBaParamSet->field.BAPolicy == BA_POLICY_DELAYED)
{
pTS->bAddBaReqDelayed = true; pTS->bAddBaReqDelayed = true;
DeActivateBAEntry(ieee, pAdmittedBA); DeActivateBAEntry(ieee, pAdmittedBA);
ReasonCode = DELBA_REASON_END_BA; ReasonCode = DELBA_REASON_END_BA;
...@@ -424,68 +421,58 @@ int rtllib_rx_ADDBARsp( struct rtllib_device* ieee, struct sk_buff *skb) ...@@ -424,68 +421,58 @@ int rtllib_rx_ADDBARsp( struct rtllib_device* ieee, struct sk_buff *skb)
rtllib_send_DELBA(ieee, dst, &BA, TX_DIR, ReasonCode); rtllib_send_DELBA(ieee, dst, &BA, TX_DIR, ReasonCode);
return 0; return 0;
} }
} }
int rtllib_rx_DELBA(struct rtllib_device* ieee,struct sk_buff *skb) int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb)
{ {
struct rtllib_hdr_3addr* delba = NULL; struct rtllib_hdr_3addr *delba = NULL;
union delba_param_set *pDelBaParamSet = NULL; union delba_param_set *pDelBaParamSet = NULL;
u16* pReasonCode = NULL; u16 *pReasonCode = NULL;
u8* dst = NULL; u8 *dst = NULL;
if (skb->len < sizeof( struct rtllib_hdr_3addr) + 6) if (skb->len < sizeof(struct rtllib_hdr_3addr) + 6) {
{ RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in DELBA(%d /"
RTLLIB_DEBUG(RTLLIB_DL_ERR, " Invalid skb len in DELBA(%d / %d)\n", (int)skb->len, (int)(sizeof( struct rtllib_hdr_3addr) + 6)); " %d)\n", (int)skb->len,
(int)(sizeof(struct rtllib_hdr_3addr) + 6));
return -1; return -1;
} }
if ( if (ieee->current_network.qos_data.active == 0 ||
ieee->current_network.qos_data.active == 0 || ieee->pHTInfo->bCurrentHTSupport == false) {
ieee->pHTInfo->bCurrentHTSupport == false ) RTLLIB_DEBUG(RTLLIB_DL_ERR, "received DELBA while QOS or HT "
{ "is not supported(%d, %d)\n",
RTLLIB_DEBUG(RTLLIB_DL_ERR, "received DELBA while QOS or HT is not supported(%d, %d)\n",ieee->current_network.qos_data.active, ieee->pHTInfo->bCurrentHTSupport); ieee->current_network. qos_data.active,
ieee->pHTInfo->bCurrentHTSupport);
return -1; return -1;
} }
RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_BA, skb->data, skb->len); RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_BA, skb->data, skb->len);
delba = ( struct rtllib_hdr_3addr*)skb->data; delba = (struct rtllib_hdr_3addr *)skb->data;
dst = (u8*)(&delba->addr2[0]); dst = (u8 *)(&delba->addr2[0]);
delba += sizeof( struct rtllib_hdr_3addr); delba += sizeof(struct rtllib_hdr_3addr);
pDelBaParamSet = (union delba_param_set *)(delba+2); pDelBaParamSet = (union delba_param_set *)(delba+2);
pReasonCode = (u16*)(delba+4); pReasonCode = (u16 *)(delba+4);
if (pDelBaParamSet->field.Initiator == 1) if (pDelBaParamSet->field.Initiator == 1) {
{
struct rx_ts_record *pRxTs; struct rx_ts_record *pRxTs;
if ( !GetTs( if (!GetTs(ieee, (struct ts_common_info **)&pRxTs, dst,
ieee, (u8)pDelBaParamSet->field.TID, RX_DIR, false)) {
(struct ts_common_info **)&pRxTs, RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS for RXTS in "
dst, "%s().dst:"MAC_FMT" TID:%d\n", __func__,
(u8)pDelBaParamSet->field.TID, MAC_ARG(dst),
RX_DIR, (u8)pDelBaParamSet->field.TID);
false) )
{
RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS for RXTS in %s().dst:"MAC_FMT" TID:%d\n", __func__, MAC_ARG(dst), (u8)pDelBaParamSet->field.TID);
return -1; return -1;
} }
RxTsDeleteBA(ieee, pRxTs); RxTsDeleteBA(ieee, pRxTs);
} } else {
else
{
struct tx_ts_record *pTxTs; struct tx_ts_record *pTxTs;
if (!GetTs( if (!GetTs(ieee, (struct ts_common_info **)&pTxTs, dst,
ieee, (u8)pDelBaParamSet->field.TID, TX_DIR, false)) {
(struct ts_common_info **)&pTxTs, RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS for TXTS in "
dst, "%s()\n", __func__);
(u8)pDelBaParamSet->field.TID,
TX_DIR,
false) )
{
RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't get TS for TXTS in %s()\n", __func__);
return -1; return -1;
} }
...@@ -498,17 +485,12 @@ int rtllib_rx_DELBA(struct rtllib_device* ieee,struct sk_buff *skb) ...@@ -498,17 +485,12 @@ int rtllib_rx_DELBA(struct rtllib_device* ieee,struct sk_buff *skb)
return 0; return 0;
} }
void void TsInitAddBA(struct rtllib_device *ieee, struct tx_ts_record *pTS,
TsInitAddBA( u8 Policy, u8 bOverwritePending)
struct rtllib_device* ieee,
struct tx_ts_record *pTS,
u8 Policy,
u8 bOverwritePending
)
{ {
struct ba_record *pBA = &pTS->TxPendingBARecord; struct ba_record *pBA = &pTS->TxPendingBARecord;
if (pBA->bValid==true && bOverwritePending==false) if (pBA->bValid == true && bOverwritePending == false)
return; return;
DeActivateBAEntry(ieee, pBA); DeActivateBAEntry(ieee, pBA);
...@@ -516,7 +498,8 @@ TsInitAddBA( ...@@ -516,7 +498,8 @@ TsInitAddBA(
pBA->DialogToken++; pBA->DialogToken++;
pBA->BaParamSet.field.AMSDU_Support = 0; pBA->BaParamSet.field.AMSDU_Support = 0;
pBA->BaParamSet.field.BAPolicy = Policy; pBA->BaParamSet.field.BAPolicy = Policy;
pBA->BaParamSet.field.TID = pTS->TsCommonInfo.TSpec.f.TSInfo.field.ucTSID; pBA->BaParamSet.field.TID =
pTS->TsCommonInfo.TSpec.f.TSInfo.field.ucTSID;
pBA->BaParamSet.field.BufferSize = 32; pBA->BaParamSet.field.BufferSize = 32;
pBA->BaTimeoutValue = 0; pBA->BaTimeoutValue = 0;
pBA->BaStartSeqCtrl.field.SeqNum = (pTS->TxCurSeq + 3) % 4096; pBA->BaStartSeqCtrl.field.SeqNum = (pTS->TxCurSeq + 3) % 4096;
...@@ -526,34 +509,30 @@ TsInitAddBA( ...@@ -526,34 +509,30 @@ TsInitAddBA(
rtllib_send_ADDBAReq(ieee, pTS->TsCommonInfo.Addr, pBA); rtllib_send_ADDBAReq(ieee, pTS->TsCommonInfo.Addr, pBA);
} }
void void TsInitDelBA(struct rtllib_device *ieee,
TsInitDelBA( struct rtllib_device* ieee, struct ts_common_info *pTsCommonInfo, enum tr_select TxRxSelect) struct ts_common_info *pTsCommonInfo,
enum tr_select TxRxSelect)
{ {
if (TxRxSelect == TX_DIR) {
if (TxRxSelect == TX_DIR) struct tx_ts_record *pTxTs =
{ (struct tx_ts_record *)pTsCommonInfo;
struct tx_ts_record *pTxTs = (struct tx_ts_record *)pTsCommonInfo;
if (TxTsDeleteBA(ieee, pTxTs)) if (TxTsDeleteBA(ieee, pTxTs))
rtllib_send_DELBA( rtllib_send_DELBA(ieee, pTsCommonInfo->Addr,
ieee, (pTxTs->TxAdmittedBARecord.bValid) ?
pTsCommonInfo->Addr, (&pTxTs->TxAdmittedBARecord) :
(pTxTs->TxAdmittedBARecord.bValid)?(&pTxTs->TxAdmittedBARecord):(&pTxTs->TxPendingBARecord), (&pTxTs->TxPendingBARecord),
TxRxSelect, TxRxSelect, DELBA_REASON_END_BA);
DELBA_REASON_END_BA); } else if (TxRxSelect == RX_DIR) {
} struct rx_ts_record *pRxTs =
else if (TxRxSelect == RX_DIR) (struct rx_ts_record *)pTsCommonInfo;
{
struct rx_ts_record *pRxTs = (struct rx_ts_record *)pTsCommonInfo;
if (RxTsDeleteBA(ieee, pRxTs)) if (RxTsDeleteBA(ieee, pRxTs))
rtllib_send_DELBA( rtllib_send_DELBA(ieee, pTsCommonInfo->Addr,
ieee, &pRxTs->RxAdmittedBARecord,
pTsCommonInfo->Addr, TxRxSelect, DELBA_REASON_END_BA);
&pRxTs->RxAdmittedBARecord,
TxRxSelect,
DELBA_REASON_END_BA );
} }
} }
void BaSetupTimeOut(unsigned long data) void BaSetupTimeOut(unsigned long data)
{ {
struct tx_ts_record *pTxTs = (struct tx_ts_record *)data; struct tx_ts_record *pTxTs = (struct tx_ts_record *)data;
...@@ -566,27 +545,23 @@ void BaSetupTimeOut(unsigned long data) ...@@ -566,27 +545,23 @@ void BaSetupTimeOut(unsigned long data)
void TxBaInactTimeout(unsigned long data) void TxBaInactTimeout(unsigned long data)
{ {
struct tx_ts_record *pTxTs = (struct tx_ts_record *)data; struct tx_ts_record *pTxTs = (struct tx_ts_record *)data;
struct rtllib_device *ieee = container_of(pTxTs, struct rtllib_device, TxTsRecord[pTxTs->num]); struct rtllib_device *ieee = container_of(pTxTs, struct rtllib_device,
TxTsRecord[pTxTs->num]);
TxTsDeleteBA(ieee, pTxTs); TxTsDeleteBA(ieee, pTxTs);
rtllib_send_DELBA( rtllib_send_DELBA(ieee, pTxTs->TsCommonInfo.Addr,
ieee, &pTxTs->TxAdmittedBARecord, TX_DIR,
pTxTs->TsCommonInfo.Addr, DELBA_REASON_TIMEOUT);
&pTxTs->TxAdmittedBARecord,
TX_DIR,
DELBA_REASON_TIMEOUT);
} }
void RxBaInactTimeout(unsigned long data) void RxBaInactTimeout(unsigned long data)
{ {
struct rx_ts_record *pRxTs = (struct rx_ts_record *)data; struct rx_ts_record *pRxTs = (struct rx_ts_record *)data;
struct rtllib_device *ieee = container_of(pRxTs, struct rtllib_device, RxTsRecord[pRxTs->num]); struct rtllib_device *ieee = container_of(pRxTs, struct rtllib_device,
RxTsRecord[pRxTs->num]);
RxTsDeleteBA(ieee, pRxTs); RxTsDeleteBA(ieee, pRxTs);
rtllib_send_DELBA( rtllib_send_DELBA(ieee, pRxTs->TsCommonInfo.Addr,
ieee, &pRxTs->RxAdmittedBARecord, RX_DIR,
pRxTs->TsCommonInfo.Addr, DELBA_REASON_TIMEOUT);
&pRxTs->RxAdmittedBARecord,
RX_DIR,
DELBA_REASON_TIMEOUT);
return ; return ;
} }
...@@ -34,10 +34,10 @@ ...@@ -34,10 +34,10 @@
#define sHTCLng 4 #define sHTCLng 4
#define HT_SUPPORTED_MCS_1SS_BITMAP 0x000000ff #define HT_SUPPORTED_MCS_1SS_BITMAP 0x000000ff
#define HT_SUPPORTED_MCS_2SS_BITMAP 0x0000ff00 #define HT_SUPPORTED_MCS_2SS_BITMAP 0x0000ff00
#define HT_SUPPORTED_MCS_1SS_2SS_BITMAP HT_MCS_1SS_BITMAP|HT_MCS_1SS_2SS_BITMAP #define HT_SUPPORTED_MCS_1SS_2SS_BITMAP \
(HT_MCS_1SS_BITMAP | HT_MCS_1SS_2SS_BITMAP)
enum ht_mcs_rate { enum ht_mcs_rate {
HT_MCS0 = 0x00000001, HT_MCS0 = 0x00000001,
...@@ -381,13 +381,12 @@ extern u8 MCS_FILTER_ALL[16]; ...@@ -381,13 +381,12 @@ extern u8 MCS_FILTER_ALL[16];
extern u8 MCS_FILTER_1SS[16]; extern u8 MCS_FILTER_1SS[16];
#define PICK_RATE(_nLegacyRate, _nMcsRate) \ #define PICK_RATE(_nLegacyRate, _nMcsRate) \
(_nMcsRate==0)?(_nLegacyRate&0x7f):(_nMcsRate) ((_nMcsRate == 0) ? (_nLegacyRate&0x7f) : (_nMcsRate))
#define LEGACY_WIRELESS_MODE IEEE_MODE_MASK #define LEGACY_WIRELESS_MODE IEEE_MODE_MASK
#define CURRENT_RATE(WirelessMode, LegacyRate, HTRate) \ #define CURRENT_RATE(WirelessMode, LegacyRate, HTRate) \
((WirelessMode & (LEGACY_WIRELESS_MODE))!=0)?\ ((WirelessMode & (LEGACY_WIRELESS_MODE)) != 0) ? \
(LegacyRate):\ (LegacyRate) : (PICK_RATE(LegacyRate, HTRate))
(PICK_RATE(LegacyRate, HTRate))
...@@ -411,8 +410,8 @@ enum ht_iot_peer { ...@@ -411,8 +410,8 @@ enum ht_iot_peer {
HT_IOT_PEER_BROADCOM = 3, HT_IOT_PEER_BROADCOM = 3,
HT_IOT_PEER_RALINK = 4, HT_IOT_PEER_RALINK = 4,
HT_IOT_PEER_ATHEROS = 5, HT_IOT_PEER_ATHEROS = 5,
HT_IOT_PEER_CISCO= 6, HT_IOT_PEER_CISCO = 6,
HT_IOT_PEER_MARVELL=7, HT_IOT_PEER_MARVELL = 7,
HT_IOT_PEER_92U_SOFTAP = 8, HT_IOT_PEER_92U_SOFTAP = 8,
HT_IOT_PEER_SELF_SOFTAP = 9, HT_IOT_PEER_SELF_SOFTAP = 9,
HT_IOT_PEER_AIRGO = 10, HT_IOT_PEER_AIRGO = 10,
...@@ -447,10 +446,10 @@ enum ht_iot_action { ...@@ -447,10 +446,10 @@ enum ht_iot_action {
HT_IOT_ACT_TX_NO_AGGREGATION = 0x00100000, HT_IOT_ACT_TX_NO_AGGREGATION = 0x00100000,
HT_IOT_ACT_DISABLE_TX_2SS = 0x00200000, HT_IOT_ACT_DISABLE_TX_2SS = 0x00200000,
HT_IOT_ACT_MID_HIGHPOWER = 0x00400000, HT_IOT_ACT_MID_HIGHPOWER = 0x00400000,
HT_IOT_ACT_NULL_DATA_POWER_SAVING = 0x00800000, HT_IOT_ACT_NULL_DATA_POWER_SAVING = 0x00800000,
HT_IOT_ACT_DISABLE_CCK_RATE = 0x01000000, HT_IOT_ACT_DISABLE_CCK_RATE = 0x01000000,
HT_IOT_ACT_FORCED_ENABLE_BE_TXOP = 0x02000000, HT_IOT_ACT_FORCED_ENABLE_BE_TXOP = 0x02000000,
HT_IOT_ACT_WA_IOT_Broadcom = 0x04000000, HT_IOT_ACT_WA_IOT_Broadcom = 0x04000000,
......
...@@ -18,53 +18,75 @@ ...@@ -18,53 +18,75 @@
******************************************************************************/ ******************************************************************************/
#include "rtllib.h" #include "rtllib.h"
#include "rtl819x_HT.h" #include "rtl819x_HT.h"
u8 MCS_FILTER_ALL[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; u8 MCS_FILTER_ALL[16] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
u8 MCS_FILTER_1SS[16] = {0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
u16 MCS_DATA_RATE[2][2][77] =
{ { {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78 ,104, 156, 208, 234, 260, u8 MCS_FILTER_1SS[16] = {
39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 312, 416, 468, 520, 0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 182, 182, 208, 156, 195, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
195, 234, 273, 273, 312, 130, 156, 181, 156, 181, 208, 234, 208, 234, 260, 260, ;
286, 195, 234, 273, 234, 273, 312, 351, 312, 351, 390, 390, 429},
{14, 29, 43, 58, 87, 116, 130, 144, 29, 58, 87, 116, 173, 231, 260, 289, u16 MCS_DATA_RATE[2][2][77] = {
43, 87, 130, 173, 260, 347, 390, 433, 58, 116, 173, 231, 347, 462, 520, 578, {{13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 234,
0, 87, 116, 144, 130, 173, 217, 116, 144, 144, 173, 202, 202, 231, 173, 217, 260, 39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 312, 416,
217, 260, 303, 303, 347, 144, 173, 202, 173, 202, 231, 260, 231, 260, 289, 289, 468, 520, 0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 182,
318, 217, 260, 303, 260, 303, 347, 390, 347, 390, 433, 433, 477} }, 182, 208, 156, 195, 195, 234, 273, 273, 312, 130, 156, 181, 156,
{ {27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486, 540, 181, 208, 234, 208, 234, 260, 260, 286, 195, 234, 273, 234, 273,
81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 432, 648, 864, 972, 1080, 312, 351, 312, 351, 390, 390, 429} ,
12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324, 378, 378, 432, 324, 405, {14, 29, 43, 58, 87, 116, 130, 144, 29, 58, 87, 116, 173, 231, 260, 289,
405, 486, 567, 567, 648, 270, 324, 378, 324, 378, 432, 486, 432, 486, 540, 540, 43, 87, 130, 173, 260, 347, 390, 433, 58, 116, 173, 231, 347, 462, 520,
594, 405, 486, 567, 486, 567, 648, 729, 648, 729, 810, 810, 891}, 578, 0, 87, 116, 144, 130, 173, 217, 116, 144, 144, 173, 202, 202, 231,
{30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540, 600, 173, 217, 217, 260, 303, 303, 347, 144, 173, 202, 173, 202, 231, 260,
90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 480, 720, 960, 1080, 1200, 231, 260, 289, 289, 318, 217, 260, 303, 260, 303, 347, 390, 347, 390,
13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360, 420, 420, 480, 360, 450, 433, 433, 477} } ,
450, 540, 630, 630, 720, 300, 360, 420, 360, 420, 480, 540, 480, 540, 600, 600, {{27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 432, 486,
660, 450, 540, 630, 540, 630, 720, 810, 720, 810, 900, 900, 990} } 540, 81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 432, 648,
}; 864, 972, 1080, 12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324,
378, 378, 432, 324, 405, 405, 486, 567, 567, 648, 270, 324, 378, 324,
378, 432, 486, 432, 486, 540, 540, 594, 405, 486, 567, 486, 567, 648,
729, 648, 729, 810, 810, 891},
{30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 480, 540,
600, 90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 480, 720,
960, 1080, 1200, 13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360,
420, 420, 480, 360, 450, 450, 540, 630, 630, 720, 300, 360, 420, 360,
420, 480, 540, 480, 540, 600, 600, 660, 450, 540, 630, 540, 630, 720,
810, 720, 810, 900, 900, 990} }
};
static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf}; static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf};
static u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM[3] = {0x00, 0x1a, 0x70}; static u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM[3] = {0x00, 0x1a, 0x70};
static u8 LINKSYSWRT350_LINKSYSWRT150_BROADCOM[3] = {0x00, 0x1d, 0x7e}; static u8 LINKSYSWRT350_LINKSYSWRT150_BROADCOM[3] = {0x00, 0x1d, 0x7e};
static u8 BELKINF5D8233V1_RALINK[3] = {0x00, 0x17, 0x3f}; static u8 BELKINF5D8233V1_RALINK[3] = {0x00, 0x17, 0x3f};
static u8 BELKINF5D82334V3_RALINK[3] = {0x00, 0x1c, 0xdf}; static u8 BELKINF5D82334V3_RALINK[3] = {0x00, 0x1c, 0xdf};
static u8 PCI_RALINK[3] = {0x00, 0x90, 0xcc}; static u8 PCI_RALINK[3] = {0x00, 0x90, 0xcc};
static u8 EDIMAX_RALINK[3] = {0x00, 0x0e, 0x2e}; static u8 EDIMAX_RALINK[3] = {0x00, 0x0e, 0x2e};
static u8 AIRLINK_RALINK[3] = {0x00, 0x18, 0x02}; static u8 AIRLINK_RALINK[3] = {0x00, 0x18, 0x02};
static u8 DLINK_ATHEROS_1[3] = {0x00, 0x1c, 0xf0}; static u8 DLINK_ATHEROS_1[3] = {0x00, 0x1c, 0xf0};
static u8 DLINK_ATHEROS_2[3] = {0x00, 0x21, 0x91}; static u8 DLINK_ATHEROS_2[3] = {0x00, 0x21, 0x91};
static u8 CISCO_BROADCOM[3] = {0x00, 0x17, 0x94}; static u8 CISCO_BROADCOM[3] = {0x00, 0x17, 0x94};
static u8 LINKSYS_MARVELL_4400N[3] = {0x00, 0x14, 0xa4}; static u8 LINKSYS_MARVELL_4400N[3] = {0x00, 0x14, 0xa4};
void HTUpdateDefaultSetting(struct rtllib_device* ieee)
void HTUpdateDefaultSetting(struct rtllib_device *ieee)
{ {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
pHTInfo->bAcceptAddbaReq = 1; pHTInfo->bAcceptAddbaReq = 1;
pHTInfo->bRegShortGI20MHz= 1; pHTInfo->bRegShortGI20MHz = 1;
pHTInfo->bRegShortGI40MHz= 1; pHTInfo->bRegShortGI40MHz = 1;
pHTInfo->bRegBW40MHz = 1; pHTInfo->bRegBW40MHz = 1;
...@@ -94,97 +116,110 @@ void HTUpdateDefaultSetting(struct rtllib_device* ieee) ...@@ -94,97 +116,110 @@ void HTUpdateDefaultSetting(struct rtllib_device* ieee)
pHTInfo->RxReorderWinSize = 64; pHTInfo->RxReorderWinSize = 64;
pHTInfo->RxReorderPendingTime = 30; pHTInfo->RxReorderPendingTime = 30;
} }
void HTDebugHTCapability(u8* CapIE, u8* TitleString )
void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
{ {
static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
struct ht_capab_ele *pCapELE; struct ht_capab_ele *pCapELE;
if (!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap))) if (!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap))) {
{
RTLLIB_DEBUG(RTLLIB_DL_HT, "EWC IE in %s()\n", __func__); RTLLIB_DEBUG(RTLLIB_DL_HT, "EWC IE in %s()\n", __func__);
pCapELE = (struct ht_capab_ele *)(&CapIE[4]); pCapELE = (struct ht_capab_ele *)(&CapIE[4]);
}else } else
pCapELE = (struct ht_capab_ele *)(&CapIE[0]); pCapELE = (struct ht_capab_ele *)(&CapIE[0]);
RTLLIB_DEBUG(RTLLIB_DL_HT, "<Log HT Capability>. Called by %s\n", TitleString ); RTLLIB_DEBUG(RTLLIB_DL_HT, "<Log HT Capability>. Called by %s\n",
TitleString);
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupported Channel Width = %s\n", (pCapELE->ChlWidth)?"20MHz": "20/40MHz");
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport Short GI for 20M = %s\n", (pCapELE->ShortGI20Mhz)?"YES": "NO"); RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupported Channel Width = %s\n",
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport Short GI for 40M = %s\n", (pCapELE->ShortGI40Mhz)?"YES": "NO"); (pCapELE->ChlWidth) ? "20MHz" : "20/40MHz");
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport TX STBC = %s\n", (pCapELE->TxSTBC)?"YES": "NO"); RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport Short GI for 20M = %s\n",
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMax AMSDU Size = %s\n", (pCapELE->MaxAMSDUSize)?"3839": "7935"); (pCapELE->ShortGI20Mhz) ? "YES" : "NO");
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport CCK in 20/40 mode = %s\n", (pCapELE->DssCCk)?"YES": "NO"); RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport Short GI for 40M = %s\n",
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMax AMPDU Factor = %d\n", pCapELE->MaxRxAMPDUFactor); (pCapELE->ShortGI40Mhz) ? "YES" : "NO");
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMPDU Density = %d\n", pCapELE->MPDUDensity); RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport TX STBC = %s\n",
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMCS Rate Set = [%x][%x][%x][%x][%x]\n", pCapELE->MCS[0],\ (pCapELE->TxSTBC) ? "YES" : "NO");
pCapELE->MCS[1], pCapELE->MCS[2], pCapELE->MCS[3], pCapELE->MCS[4]); RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMax AMSDU Size = %s\n",
(pCapELE->MaxAMSDUSize) ? "3839" : "7935");
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSupport CCK in 20/40 mode = %s\n",
(pCapELE->DssCCk) ? "YES" : "NO");
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMax AMPDU Factor = %d\n",
pCapELE->MaxRxAMPDUFactor);
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMPDU Density = %d\n",
pCapELE->MPDUDensity);
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tMCS Rate Set = [%x][%x][%x][%x][%x]\n",
pCapELE->MCS[0], pCapELE->MCS[1], pCapELE->MCS[2],
pCapELE->MCS[3], pCapELE->MCS[4]);
return; return;
} }
void HTDebugHTInfo(u8* InfoIE, u8* TitleString)
void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
{ {
static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};
struct ht_info_ele *pHTInfoEle; struct ht_info_ele *pHTInfoEle;
if (!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo))) if (!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo))) {
{
RTLLIB_DEBUG(RTLLIB_DL_HT, "EWC IE in %s()\n", __func__); RTLLIB_DEBUG(RTLLIB_DL_HT, "EWC IE in %s()\n", __func__);
pHTInfoEle = (struct ht_info_ele *)(&InfoIE[4]); pHTInfoEle = (struct ht_info_ele *)(&InfoIE[4]);
}else } else
pHTInfoEle = (struct ht_info_ele *)(&InfoIE[0]); pHTInfoEle = (struct ht_info_ele *)(&InfoIE[0]);
RTLLIB_DEBUG(RTLLIB_DL_HT, "<Log HT Information Element>. Called by %s\n", TitleString); RTLLIB_DEBUG(RTLLIB_DL_HT, "<Log HT Information Element>. "
"Called by %s\n", TitleString);
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tPrimary channel = %d\n", pHTInfoEle->ControlChl); RTLLIB_DEBUG(RTLLIB_DL_HT, "\tPrimary channel = %d\n",
pHTInfoEle->ControlChl);
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSenondary channel ="); RTLLIB_DEBUG(RTLLIB_DL_HT, "\tSenondary channel =");
switch (pHTInfoEle->ExtChlOffset) switch (pHTInfoEle->ExtChlOffset) {
{ case 0:
case 0: RTLLIB_DEBUG(RTLLIB_DL_HT, "Not Present\n");
RTLLIB_DEBUG(RTLLIB_DL_HT, "Not Present\n"); break;
break; case 1:
case 1: RTLLIB_DEBUG(RTLLIB_DL_HT, "Upper channel\n");
RTLLIB_DEBUG(RTLLIB_DL_HT, "Upper channel\n"); break;
break; case 2:
case 2: RTLLIB_DEBUG(RTLLIB_DL_HT, "Reserved. Eooro!!!\n");
RTLLIB_DEBUG(RTLLIB_DL_HT, "Reserved. Eooro!!!\n"); break;
break; case 3:
case 3: RTLLIB_DEBUG(RTLLIB_DL_HT, "Lower Channel\n");
RTLLIB_DEBUG(RTLLIB_DL_HT, "Lower Channel\n"); break;
break;
} }
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tRecommended channel width = %s\n", (pHTInfoEle->RecommemdedTxWidth)?"20Mhz": "40Mhz"); RTLLIB_DEBUG(RTLLIB_DL_HT, "\tRecommended channel width = %s\n",
(pHTInfoEle->RecommemdedTxWidth) ? "20Mhz" : "40Mhz");
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tOperation mode for protection = "); RTLLIB_DEBUG(RTLLIB_DL_HT, "\tOperation mode for protection = ");
switch (pHTInfoEle->OptMode) switch (pHTInfoEle->OptMode) {
{ case 0:
case 0: RTLLIB_DEBUG(RTLLIB_DL_HT, "No Protection\n");
RTLLIB_DEBUG(RTLLIB_DL_HT, "No Protection\n"); break;
break; case 1:
case 1: RTLLIB_DEBUG(RTLLIB_DL_HT, "HT non-member protection mode\n");
RTLLIB_DEBUG(RTLLIB_DL_HT, "HT non-member protection mode\n"); break;
break; case 2:
case 2: RTLLIB_DEBUG(RTLLIB_DL_HT, "Suggest to open protection\n");
RTLLIB_DEBUG(RTLLIB_DL_HT, "Suggest to open protection\n"); break;
break; case 3:
case 3: RTLLIB_DEBUG(RTLLIB_DL_HT, "HT mixed mode\n");
RTLLIB_DEBUG(RTLLIB_DL_HT, "HT mixed mode\n"); break;
break;
} }
RTLLIB_DEBUG(RTLLIB_DL_HT, "\tBasic MCS Rate Set = [%x][%x][%x][%x][%x]\n", pHTInfoEle->BasicMSC[0],\ RTLLIB_DEBUG(RTLLIB_DL_HT, "\tBasic MCS Rate Set = [%x][%x][%x][%x]"
pHTInfoEle->BasicMSC[1], pHTInfoEle->BasicMSC[2], pHTInfoEle->BasicMSC[3], pHTInfoEle->BasicMSC[4]); "[%x]\n", pHTInfoEle->BasicMSC[0], pHTInfoEle->BasicMSC[1],
pHTInfoEle->BasicMSC[2], pHTInfoEle->BasicMSC[3],
pHTInfoEle->BasicMSC[4]);
return; return;
} }
bool IsHTHalfNmode40Bandwidth(struct rtllib_device* ieee) bool IsHTHalfNmode40Bandwidth(struct rtllib_device *ieee)
{ {
bool retValue = false; bool retValue = false;
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
if (pHTInfo->bCurrentHTSupport == false ) if (pHTInfo->bCurrentHTSupport == false)
retValue = false; retValue = false;
else if (pHTInfo->bRegBW40MHz == false) else if (pHTInfo->bRegBW40MHz == false)
retValue = false; retValue = false;
...@@ -198,25 +233,24 @@ bool IsHTHalfNmode40Bandwidth(struct rtllib_device* ieee) ...@@ -198,25 +233,24 @@ bool IsHTHalfNmode40Bandwidth(struct rtllib_device* ieee)
return retValue; return retValue;
} }
bool IsHTHalfNmodeSGI(struct rtllib_device* ieee, bool is40MHz) bool IsHTHalfNmodeSGI(struct rtllib_device *ieee, bool is40MHz)
{ {
bool retValue = false; bool retValue = false;
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
if (pHTInfo->bCurrentHTSupport == false ) if (pHTInfo->bCurrentHTSupport == false)
retValue = false; retValue = false;
else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
retValue = false; retValue = false;
else if (is40MHz) else if (is40MHz) {
{ if (((struct ht_capab_ele *)
if (((struct ht_capab_ele *)(pHTInfo->PeerHTCapBuf))->ShortGI40Mhz) (pHTInfo->PeerHTCapBuf))->ShortGI40Mhz)
retValue = true; retValue = true;
else else
retValue = false; retValue = false;
} } else {
else if (((struct ht_capab_ele *)
{ (pHTInfo->PeerHTCapBuf))->ShortGI20Mhz)
if (((struct ht_capab_ele *)(pHTInfo->PeerHTCapBuf))->ShortGI20Mhz)
retValue = true; retValue = true;
else else
retValue = false; retValue = false;
...@@ -225,89 +259,75 @@ bool IsHTHalfNmodeSGI(struct rtllib_device* ieee, bool is40MHz) ...@@ -225,89 +259,75 @@ bool IsHTHalfNmodeSGI(struct rtllib_device* ieee, bool is40MHz)
return retValue; return retValue;
} }
u16 HTHalfMcsToDataRate(struct rtllib_device* ieee, u8 nMcsRate) u16 HTHalfMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate)
{ {
u8 is40MHz; u8 is40MHz;
u8 isShortGI; u8 isShortGI;
is40MHz = (IsHTHalfNmode40Bandwidth(ieee))?1:0; is40MHz = (IsHTHalfNmode40Bandwidth(ieee)) ? 1 : 0;
isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz))? 1:0; isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz)) ? 1 : 0;
return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)]; return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate & 0x7f)];
} }
u16 HTMcsToDataRate( struct rtllib_device* ieee, u8 nMcsRate) u16 HTMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate)
{ {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
u8 is40MHz = (pHTInfo->bCurBW40MHz)?1:0; u8 is40MHz = (pHTInfo->bCurBW40MHz) ? 1 : 0;
u8 isShortGI = (pHTInfo->bCurBW40MHz)? u8 isShortGI = (pHTInfo->bCurBW40MHz) ?
((pHTInfo->bCurShortGI40MHz)?1:0): ((pHTInfo->bCurShortGI40MHz) ? 1 : 0) :
((pHTInfo->bCurShortGI20MHz)?1:0); ((pHTInfo->bCurShortGI20MHz) ? 1 : 0);
return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)]; return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate & 0x7f)];
} }
u16 TxCountToDataRate( struct rtllib_device* ieee, u8 nDataRate) u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate)
{ {
u16 CCKOFDMRate[12] = {0x02 , 0x04 , 0x0b , 0x16 , 0x0c , 0x12 , 0x18 , 0x24 , 0x30 , 0x48 , 0x60 , 0x6c}; u16 CCKOFDMRate[12] = {0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18,
0x24, 0x30, 0x48, 0x60, 0x6c};
u8 is40MHz = 0; u8 is40MHz = 0;
u8 isShortGI = 0; u8 isShortGI = 0;
if (nDataRate < 12) if (nDataRate < 12) {
{
return CCKOFDMRate[nDataRate]; return CCKOFDMRate[nDataRate];
} } else {
else if (nDataRate >= 0x10 && nDataRate <= 0x1f) {
{
if (nDataRate >= 0x10 && nDataRate <= 0x1f)
{
is40MHz = 0; is40MHz = 0;
isShortGI = 0; isShortGI = 0;
} else if (nDataRate >= 0x20 && nDataRate <= 0x2f) {
}
else if (nDataRate >=0x20 && nDataRate <= 0x2f )
{
is40MHz = 1; is40MHz = 1;
isShortGI = 0; isShortGI = 0;
} } else if (nDataRate >= 0x30 && nDataRate <= 0x3f) {
else if (nDataRate >= 0x30 && nDataRate <= 0x3f )
{
is40MHz = 0; is40MHz = 0;
isShortGI = 1; isShortGI = 1;
} else if (nDataRate >= 0x40 && nDataRate <= 0x4f) {
}
else if (nDataRate >= 0x40 && nDataRate <= 0x4f )
{
is40MHz = 1; is40MHz = 1;
isShortGI = 1; isShortGI = 1;
} }
return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf]; return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf];
} }
} }
bool IsHTHalfNmodeAPs(struct rtllib_device *ieee)
bool IsHTHalfNmodeAPs(struct rtllib_device* ieee)
{ {
bool retValue = false; bool retValue = false;
struct rtllib_network* net = &ieee->current_network; struct rtllib_network *net = &ieee->current_network;
if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) || if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
(memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) || (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
(memcmp(net->bssid, PCI_RALINK, 3)==0) || (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
(memcmp(net->bssid, EDIMAX_RALINK, 3)==0) || (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
(memcmp(net->bssid, AIRLINK_RALINK, 3)==0) || (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
(net->ralink_cap_exist)) (net->ralink_cap_exist))
retValue = true;
else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
!memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
!memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ||
(net->broadcom_cap_exist))
retValue = true; retValue = true;
else if ((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) ||
(memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)||
(memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)||
(net->broadcom_cap_exist))
retValue = true;
else if (net->bssht.bdRT2RTAggregation) else if (net->bssht.bdRT2RTAggregation)
retValue = true; retValue = true;
else else
...@@ -316,38 +336,35 @@ bool IsHTHalfNmodeAPs(struct rtllib_device* ieee) ...@@ -316,38 +336,35 @@ bool IsHTHalfNmodeAPs(struct rtllib_device* ieee)
return retValue; return retValue;
} }
void HTIOTPeerDetermine(struct rtllib_device* ieee) void HTIOTPeerDetermine(struct rtllib_device *ieee)
{ {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
struct rtllib_network* net = &ieee->current_network; struct rtllib_network *net = &ieee->current_network;
if (net->bssht.bdRT2RTAggregation){ if (net->bssht.bdRT2RTAggregation) {
pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK; pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK;
if (net->bssht.RT2RT_HT_Mode & RT_HT_CAP_USE_92SE){ if (net->bssht.RT2RT_HT_Mode & RT_HT_CAP_USE_92SE)
pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK_92SE; pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK_92SE;
} if (net->bssht.RT2RT_HT_Mode & RT_HT_CAP_USE_SOFTAP)
if (net->bssht.RT2RT_HT_Mode & RT_HT_CAP_USE_SOFTAP){
pHTInfo->IOTPeer = HT_IOT_PEER_92U_SOFTAP; pHTInfo->IOTPeer = HT_IOT_PEER_92U_SOFTAP;
} } else if (net->broadcom_cap_exist)
}
else if (net->broadcom_cap_exist)
pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM; pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
else if ((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) || else if (!memcmp(net->bssid, UNKNOWN_BORADCOM, 3) ||
(memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)|| !memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) ||
(memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)/*|| !memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3))
(memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) */)
pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM; pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
else if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) || else if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
(memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) || (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
(memcmp(net->bssid, PCI_RALINK, 3)==0) || (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
(memcmp(net->bssid, EDIMAX_RALINK, 3)==0) || (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
(memcmp(net->bssid, AIRLINK_RALINK, 3)==0) || (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
net->ralink_cap_exist) net->ralink_cap_exist)
pHTInfo->IOTPeer = HT_IOT_PEER_RALINK; pHTInfo->IOTPeer = HT_IOT_PEER_RALINK;
else if ((net->atheros_cap_exist )|| else if ((net->atheros_cap_exist) ||
(memcmp(net->bssid, DLINK_ATHEROS_1, 3) == 0)|| (memcmp(net->bssid, DLINK_ATHEROS_1, 3) == 0) ||
(memcmp(net->bssid, DLINK_ATHEROS_2, 3) == 0)) (memcmp(net->bssid, DLINK_ATHEROS_2, 3) == 0))
pHTInfo->IOTPeer = HT_IOT_PEER_ATHEROS; pHTInfo->IOTPeer = HT_IOT_PEER_ATHEROS;
else if ((memcmp(net->bssid, CISCO_BROADCOM, 3)==0)||net->cisco_cap_exist) else if ((memcmp(net->bssid, CISCO_BROADCOM, 3) == 0) ||
net->cisco_cap_exist)
pHTInfo->IOTPeer = HT_IOT_PEER_CISCO; pHTInfo->IOTPeer = HT_IOT_PEER_CISCO;
else if ((memcmp(net->bssid, LINKSYS_MARVELL_4400N, 3) == 0) || else if ((memcmp(net->bssid, LINKSYS_MARVELL_4400N, 3) == 0) ||
net->marvell_cap_exist) net->marvell_cap_exist)
...@@ -357,35 +374,35 @@ void HTIOTPeerDetermine(struct rtllib_device* ieee) ...@@ -357,35 +374,35 @@ void HTIOTPeerDetermine(struct rtllib_device* ieee)
else else
pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN; pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
RTLLIB_DEBUG(RTLLIB_DL_IOT, "Joseph debug!! IOTPEER: %x\n", pHTInfo->IOTPeer); RTLLIB_DEBUG(RTLLIB_DL_IOT, "Joseph debug!! IOTPEER: %x\n",
pHTInfo->IOTPeer);
} }
u8 HTIOTActIsDisableMCS14(struct rtllib_device* ieee, u8* PeerMacAddr) u8 HTIOTActIsDisableMCS14(struct rtllib_device *ieee, u8 *PeerMacAddr)
{ {
return 0; return 0;
} }
bool HTIOTActIsDisableMCS15(struct rtllib_device* ieee) bool HTIOTActIsDisableMCS15(struct rtllib_device *ieee)
{ {
bool retValue = false; bool retValue = false;
return retValue; return retValue;
} }
bool HTIOTActIsDisableMCSTwoSpatialStream(struct rtllib_device* ieee) bool HTIOTActIsDisableMCSTwoSpatialStream(struct rtllib_device *ieee)
{ {
bool retValue = false; return false;
return retValue;
} }
u8 HTIOTActIsDisableEDCATurbo(struct rtllib_device* ieee, u8* PeerMacAddr) u8 HTIOTActIsDisableEDCATurbo(struct rtllib_device *ieee, u8 *PeerMacAddr)
{ {
return false; return false;
} }
bool HTIOTActIsEnableBETxOPLimit(struct rtllib_device* ieee) bool HTIOTActIsEnableBETxOPLimit(struct rtllib_device *ieee)
{ {
bool retValue = false; bool retValue = false;
...@@ -393,70 +410,65 @@ bool HTIOTActIsEnableBETxOPLimit(struct rtllib_device* ieee) ...@@ -393,70 +410,65 @@ bool HTIOTActIsEnableBETxOPLimit(struct rtllib_device* ieee)
} }
u8 HTIOTActIsMgntUseCCK6M(struct rtllib_device* ieee,struct rtllib_network *network) u8 HTIOTActIsMgntUseCCK6M(struct rtllib_device *ieee,
struct rtllib_network *network)
{ {
u8 retValue = 0; u8 retValue = 0;
if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM) if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM)
{
retValue = 1; retValue = 1;
}
return retValue; return retValue;
} }
u8 u8 HTIOTActWAIOTBroadcom(struct rtllib_device *ieee)
HTIOTActWAIOTBroadcom(struct rtllib_device* ieee)
{ {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
u8 retValue = false; u8 retValue = false;
u8 boundary=59; u8 boundary = 59;
pHTInfo->bWAIotBroadcom = false; pHTInfo->bWAIotBroadcom = false;
if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM) if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM) {
{ if (ieee->current_network.bssht.bdBandWidth ==
if (ieee->current_network.bssht.bdBandWidth == HT_CHANNEL_WIDTH_20_40) HT_CHANNEL_WIDTH_20_40) {
{ if (!(pHTInfo->bRegBW40MHz)) {
if (!(pHTInfo->bRegBW40MHz)) if (ieee->current_network.mode !=
{ WIRELESS_MODE_B) {
if (ieee->current_network.mode != WIRELESS_MODE_B)
{
pHTInfo->bWAIotBroadcom = true; pHTInfo->bWAIotBroadcom = true;
if (ieee->b_customer_lenovo_id == true) if (ieee->b_customer_lenovo_id)
boundary = 30; boundary = 30;
if ( ieee->current_network.RSSI >= boundary) if (ieee->current_network.RSSI >=
boundary)
retValue = true; retValue = true;
} }
}else{
;
} }
} }
} }
return retValue; return retValue;
} }
u8 HTIOTActIsForcedCTS2Self(struct rtllib_device *ieee, struct rtllib_network *network) u8 HTIOTActIsForcedCTS2Self(struct rtllib_device *ieee,
struct rtllib_network *network)
{ {
u8 retValue = 0; u8 retValue = 0;
if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_MARVELL) if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_MARVELL)
{
retValue = 1; retValue = 1;
}
return retValue; return retValue;
} }
u8 HTIOTActIsForcedRTSCTS(struct rtllib_device *ieee, struct rtllib_network *network) u8 HTIOTActIsForcedRTSCTS(struct rtllib_device *ieee,
struct rtllib_network *network)
{ {
u8 retValue = 0; u8 retValue = 0;
return retValue; return retValue;
} }
u8 u8 HTIOTActIsForcedAMSDU8K(struct rtllib_device *ieee,
HTIOTActIsForcedAMSDU8K(struct rtllib_device *ieee, struct rtllib_network *network) struct rtllib_network *network)
{ {
u8 retValue = 0; u8 retValue = 0;
...@@ -466,54 +478,48 @@ HTIOTActIsForcedAMSDU8K(struct rtllib_device *ieee, struct rtllib_network *netwo ...@@ -466,54 +478,48 @@ HTIOTActIsForcedAMSDU8K(struct rtllib_device *ieee, struct rtllib_network *netwo
u8 HTIOTActIsCCDFsync(struct rtllib_device *ieee) u8 HTIOTActIsCCDFsync(struct rtllib_device *ieee)
{ {
u8 retValue = 0; u8 retValue = 0;
if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM) if (ieee->pHTInfo->IOTPeer == HT_IOT_PEER_BROADCOM)
{
retValue = 1; retValue = 1;
}
return retValue; return retValue;
} }
u8 u8 HTIOCActRejcectADDBARequest(struct rtllib_network *network)
HTIOCActRejcectADDBARequest(struct rtllib_network *network)
{ {
u8 retValue = 0; u8 retValue = 0;
return retValue; return retValue;
} }
u8 u8 HTIOTActIsEDCABiasRx(struct rtllib_device *ieee,
HTIOTActIsEDCABiasRx(struct rtllib_device* ieee,struct rtllib_network *network) struct rtllib_network *network)
{ {
u8 retValue = 0; u8 retValue = 0;
return retValue; return retValue;
} }
u8 u8 HTIOTActDisableShortGI(struct rtllib_device *ieee,
HTIOTActDisableShortGI(struct rtllib_device* ieee,struct rtllib_network *network) struct rtllib_network *network)
{ {
u8 retValue = 0; u8 retValue = 0;
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
if (pHTInfo->IOTPeer==HT_IOT_PEER_RALINK) if (pHTInfo->IOTPeer == HT_IOT_PEER_RALINK)
{
retValue = 1; retValue = 1;
}
return retValue; return retValue;
} }
u8 u8 HTIOTActDisableHighPower(struct rtllib_device *ieee,
HTIOTActDisableHighPower(struct rtllib_device* ieee,struct rtllib_network *network) struct rtllib_network *network)
{ {
u8 retValue = 0; u8 retValue = 0;
return retValue; return retValue;
} }
void void HTIOTActDetermineRaFunc(struct rtllib_device *ieee, bool bPeerRx2ss)
HTIOTActDetermineRaFunc(struct rtllib_device* ieee, bool bPeerRx2ss)
{ {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
pHTInfo->IOTRaFunc &= HT_IOT_RAFUNC_DISABLE_ALL; pHTInfo->IOTRaFunc &= HT_IOT_RAFUNC_DISABLE_ALL;
...@@ -527,81 +533,77 @@ HTIOTActDetermineRaFunc(struct rtllib_device* ieee, bool bPeerRx2ss) ...@@ -527,81 +533,77 @@ HTIOTActDetermineRaFunc(struct rtllib_device* ieee, bool bPeerRx2ss)
} }
u8 u8 HTIOTActIsDisableTx40MHz(struct rtllib_device *ieee,
HTIOTActIsDisableTx40MHz(struct rtllib_device* ieee,struct rtllib_network *network) struct rtllib_network *network)
{ {
u8 retValue = 0; u8 retValue = 0;
return retValue; return retValue;
} }
u8 u8 HTIOTActIsTxNoAggregation(struct rtllib_device *ieee,
HTIOTActIsTxNoAggregation(struct rtllib_device* ieee,struct rtllib_network *network) struct rtllib_network *network)
{ {
u8 retValue = 0; u8 retValue = 0;
return retValue; return retValue;
} }
u8 HTIOTActIsDisableTx2SS(struct rtllib_device *ieee,
u8 struct rtllib_network *network)
HTIOTActIsDisableTx2SS(struct rtllib_device* ieee,struct rtllib_network *network)
{ {
u8 retValue = 0; u8 retValue = 0;
return retValue; return retValue;
} }
bool HTIOCActIsDisableCckRate(struct rtllib_device *ieee,
bool HTIOCActIsDisableCckRate(struct rtllib_device* ieee,struct rtllib_network *network) struct rtllib_network *network)
{ {
bool retValue = false; bool retValue = false;
return retValue; return retValue;
} }
bool HTIOCActAllowPeerAggOnePacket(struct rtllib_device* ieee,struct rtllib_network *network) bool HTIOCActAllowPeerAggOnePacket(struct rtllib_device *ieee,
struct rtllib_network *network)
{ {
bool retValue = false; bool retValue = false;
return retValue; return retValue;
} }
bool bool HTIOTActIsNullDataPowerSaving(struct rtllib_device *ieee,
HTIOTActIsNullDataPowerSaving(struct rtllib_device* ieee,struct rtllib_network *network) struct rtllib_network *network)
{ {
bool retValue = false; bool retValue = false;
return retValue; return retValue;
} }
void HTResetIOTSetting( void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo)
struct rt_hi_throughput *pHTInfo
)
{ {
pHTInfo->IOTAction = 0; pHTInfo->IOTAction = 0;
pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN; pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
pHTInfo->IOTRaFunc = 0; pHTInfo->IOTRaFunc = 0;
} }
void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap,
void HTConstructCapabilityElement(struct rtllib_device* ieee, u8* posHTCap, u8* len, u8 IsEncrypt, bool bAssoc) u8 *len, u8 IsEncrypt, bool bAssoc)
{ {
struct rt_hi_throughput *pHT = ieee->pHTInfo; struct rt_hi_throughput *pHT = ieee->pHTInfo;
struct ht_capab_ele *pCapELE = NULL; struct ht_capab_ele *pCapELE = NULL;
if ((posHTCap == NULL) || (pHT == NULL)) if ((posHTCap == NULL) || (pHT == NULL)) {
{ RTLLIB_DEBUG(RTLLIB_DL_ERR, "posHTCap or pHTInfo can't be "
RTLLIB_DEBUG(RTLLIB_DL_ERR, "posHTCap or pHTInfo can't be null in HTConstructCapabilityElement()\n"); "null in HTConstructCapabilityElement()\n");
return; return;
} }
memset(posHTCap, 0, *len); memset(posHTCap, 0, *len);
if ((bAssoc) && (pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC)) if ((bAssoc) && (pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC)) {
{
u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap)); memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
pCapELE = (struct ht_capab_ele *)&(posHTCap[4]); pCapELE = (struct ht_capab_ele *)&(posHTCap[4]);
*len = 30 + 2; *len = 30 + 2;
}else } else {
{
pCapELE = (struct ht_capab_ele *)posHTCap; pCapELE = (struct ht_capab_ele *)posHTCap;
*len = 26 + 2; *len = 26 + 2;
} }
...@@ -610,7 +612,7 @@ void HTConstructCapabilityElement(struct rtllib_device* ieee, u8* posHTCap, u8* ...@@ -610,7 +612,7 @@ void HTConstructCapabilityElement(struct rtllib_device* ieee, u8* posHTCap, u8*
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
pCapELE->ChlWidth = 0; pCapELE->ChlWidth = 0;
else else
pCapELE->ChlWidth = (pHT->bRegBW40MHz?1:0); pCapELE->ChlWidth = (pHT->bRegBW40MHz ? 1 : 0);
pCapELE->MimoPwrSave = pHT->SelfMimoPs; pCapELE->MimoPwrSave = pHT->SelfMimoPs;
pCapELE->GreenField = 0; pCapELE->GreenField = 0;
...@@ -620,21 +622,20 @@ void HTConstructCapabilityElement(struct rtllib_device* ieee, u8* posHTCap, u8* ...@@ -620,21 +622,20 @@ void HTConstructCapabilityElement(struct rtllib_device* ieee, u8* posHTCap, u8*
pCapELE->TxSTBC = 1; pCapELE->TxSTBC = 1;
pCapELE->RxSTBC = 0; pCapELE->RxSTBC = 0;
pCapELE->DelayBA = 0; pCapELE->DelayBA = 0;
pCapELE->MaxAMSDUSize = (MAX_RECEIVE_BUFFER_SIZE>=7935)?1:0; pCapELE->MaxAMSDUSize = (MAX_RECEIVE_BUFFER_SIZE >= 7935) ? 1 : 0;
pCapELE->DssCCk = ((pHT->bRegBW40MHz)?(pHT->bRegSuppCCK?1:0):0); pCapELE->DssCCk = ((pHT->bRegBW40MHz) ? (pHT->bRegSuppCCK ? 1 : 0) : 0);
pCapELE->PSMP = 0; pCapELE->PSMP = 0;
pCapELE->LSigTxopProtect = 0; pCapELE->LSigTxopProtect = 0;
RTLLIB_DEBUG(RTLLIB_DL_HT, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk); RTLLIB_DEBUG(RTLLIB_DL_HT, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d "
"DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize,
pCapELE->DssCCk);
if ( IsEncrypt) if (IsEncrypt) {
{
pCapELE->MPDUDensity = 7; pCapELE->MPDUDensity = 7;
pCapELE->MaxRxAMPDUFactor = 2; pCapELE->MaxRxAMPDUFactor = 2;
} } else {
else
{
pCapELE->MaxRxAMPDUFactor = 3; pCapELE->MaxRxAMPDUFactor = 3;
pCapELE->MPDUDensity = 0; pCapELE->MPDUDensity = 0;
} }
...@@ -658,67 +659,63 @@ void HTConstructCapabilityElement(struct rtllib_device* ieee, u8* posHTCap, u8* ...@@ -658,67 +659,63 @@ void HTConstructCapabilityElement(struct rtllib_device* ieee, u8* posHTCap, u8*
if (pHT->IOTAction & HT_IOT_ACT_DISABLE_RX_40MHZ_SHORT_GI) if (pHT->IOTAction & HT_IOT_ACT_DISABLE_RX_40MHZ_SHORT_GI)
pCapELE->ShortGI40Mhz = 0; pCapELE->ShortGI40Mhz = 0;
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) {
{
pCapELE->ChlWidth = 0; pCapELE->ChlWidth = 0;
pCapELE->MCS[1] = 0; pCapELE->MCS[1] = 0;
} }
} }
return; return;
} }
void HTConstructInfoElement(struct rtllib_device* ieee, u8* posHTInfo, u8* len, u8 IsEncrypt)
void HTConstructInfoElement(struct rtllib_device *ieee, u8 *posHTInfo,
u8 *len, u8 IsEncrypt)
{ {
struct rt_hi_throughput *pHT = ieee->pHTInfo; struct rt_hi_throughput *pHT = ieee->pHTInfo;
struct ht_info_ele *pHTInfoEle = (struct ht_info_ele *)posHTInfo; struct ht_info_ele *pHTInfoEle = (struct ht_info_ele *)posHTInfo;
if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) {
{ RTLLIB_DEBUG(RTLLIB_DL_ERR, "posHTInfo or pHTInfoEle can't be "
RTLLIB_DEBUG(RTLLIB_DL_ERR, "posHTInfo or pHTInfoEle can't be null in HTConstructInfoElement()\n"); "null in HTConstructInfoElement()\n");
return; return;
} }
memset(posHTInfo, 0, *len); memset(posHTInfo, 0, *len);
if ( (ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == IW_MODE_MASTER)) if ((ieee->iw_mode == IW_MODE_ADHOC) ||
{ (ieee->iw_mode == IW_MODE_MASTER)) {
pHTInfoEle->ControlChl = ieee->current_network.channel; pHTInfoEle->ControlChl = ieee->current_network.channel;
pHTInfoEle->ExtChlOffset = ((pHT->bRegBW40MHz == false)?HT_EXTCHNL_OFFSET_NO_EXT: pHTInfoEle->ExtChlOffset = ((pHT->bRegBW40MHz == false) ?
(ieee->current_network.channel<=6)? HT_EXTCHNL_OFFSET_NO_EXT :
HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER); (ieee->current_network.channel <= 6)
? HT_EXTCHNL_OFFSET_UPPER :
HT_EXTCHNL_OFFSET_LOWER);
pHTInfoEle->RecommemdedTxWidth = pHT->bRegBW40MHz; pHTInfoEle->RecommemdedTxWidth = pHT->bRegBW40MHz;
pHTInfoEle->RIFS = 0; pHTInfoEle->RIFS = 0;
pHTInfoEle->PSMPAccessOnly = 0; pHTInfoEle->PSMPAccessOnly = 0;
pHTInfoEle->SrvIntGranularity = 0; pHTInfoEle->SrvIntGranularity = 0;
pHTInfoEle->OptMode = pHT->CurrentOpMode; pHTInfoEle->OptMode = pHT->CurrentOpMode;
pHTInfoEle->NonGFDevPresent = 0; pHTInfoEle->NonGFDevPresent = 0;
pHTInfoEle->DualBeacon = 0; pHTInfoEle->DualBeacon = 0;
pHTInfoEle->SecondaryBeacon = 0; pHTInfoEle->SecondaryBeacon = 0;
pHTInfoEle->LSigTxopProtectFull = 0; pHTInfoEle->LSigTxopProtectFull = 0;
pHTInfoEle->PcoActive = 0; pHTInfoEle->PcoActive = 0;
pHTInfoEle->PcoPhase = 0; pHTInfoEle->PcoPhase = 0;
memset(pHTInfoEle->BasicMSC, 0, 16); memset(pHTInfoEle->BasicMSC, 0, 16);
*len = 22 + 2; *len = 22 + 2;
} } else {
else
{
*len = 0; *len = 0;
} }
return; return;
} }
void HTConstructRT2RTAggElement(struct rtllib_device* ieee, u8* posRT2RTAgg, u8* len) void HTConstructRT2RTAggElement(struct rtllib_device *ieee, u8 *posRT2RTAgg,
u8 *len)
{ {
if (posRT2RTAgg == NULL) { if (posRT2RTAgg == NULL) {
RTLLIB_DEBUG(RTLLIB_DL_ERR, "posRT2RTAgg can't be null in HTConstructRT2RTAggElement()\n"); RTLLIB_DEBUG(RTLLIB_DL_ERR, "posRT2RTAgg can't be null in "
"HTConstructRT2RTAggElement()\n");
return; return;
} }
memset(posRT2RTAgg, 0, *len); memset(posRT2RTAgg, 0, *len);
...@@ -730,21 +727,20 @@ void HTConstructRT2RTAggElement(struct rtllib_device* ieee, u8* posRT2RTAgg, u8* ...@@ -730,21 +727,20 @@ void HTConstructRT2RTAggElement(struct rtllib_device* ieee, u8* posRT2RTAgg, u8*
*posRT2RTAgg = 0x30; *posRT2RTAgg = 0x30;
if (ieee->bSupportRemoteWakeUp) { if (ieee->bSupportRemoteWakeUp)
*posRT2RTAgg |= RT_HT_CAP_USE_WOW; *posRT2RTAgg |= RT_HT_CAP_USE_WOW;
}
*len = 6 + 2; *len = 6 + 2;
return; return;
} }
u8 HT_PickMCSRate(struct rtllib_device* ieee, u8* pOperateMCS) u8 HT_PickMCSRate(struct rtllib_device *ieee, u8 *pOperateMCS)
{ {
u8 i; u8 i;
if (pOperateMCS == NULL) if (pOperateMCS == NULL) {
{ RTLLIB_DEBUG(RTLLIB_DL_ERR, "pOperateMCS can't be null"
RTLLIB_DEBUG(RTLLIB_DL_ERR, "pOperateMCS can't be null in HT_PickMCSRate()\n"); " in HT_PickMCSRate()\n");
return false; return false;
} }
...@@ -752,14 +748,14 @@ u8 HT_PickMCSRate(struct rtllib_device* ieee, u8* pOperateMCS) ...@@ -752,14 +748,14 @@ u8 HT_PickMCSRate(struct rtllib_device* ieee, u8* pOperateMCS)
case IEEE_A: case IEEE_A:
case IEEE_B: case IEEE_B:
case IEEE_G: case IEEE_G:
for (i=0;i<=15;i++) for (i = 0; i <= 15; i++)
pOperateMCS[i] = 0; pOperateMCS[i] = 0;
break; break;
case IEEE_N_24G: case IEEE_N_24G:
case IEEE_N_5G: case IEEE_N_5G:
pOperateMCS[0] &=RATE_ADPT_1SS_MASK; pOperateMCS[0] &= RATE_ADPT_1SS_MASK;
pOperateMCS[1] &=RATE_ADPT_2SS_MASK; pOperateMCS[1] &= RATE_ADPT_2SS_MASK;
pOperateMCS[3] &=RATE_ADPT_MCS32_MASK; pOperateMCS[3] &= RATE_ADPT_MCS32_MASK;
break; break;
default: default:
break; break;
...@@ -769,145 +765,151 @@ u8 HT_PickMCSRate(struct rtllib_device* ieee, u8* pOperateMCS) ...@@ -769,145 +765,151 @@ u8 HT_PickMCSRate(struct rtllib_device* ieee, u8* pOperateMCS)
return true; return true;
} }
u8 HTGetHighestMCSRate(struct rtllib_device* ieee, u8* pMCSRateSet, u8* pMCSFilter) u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet,
u8 *pMCSFilter)
{ {
u8 i, j; u8 i, j;
u8 bitMap; u8 bitMap;
u8 mcsRate = 0; u8 mcsRate = 0;
u8 availableMcsRate[16]; u8 availableMcsRate[16];
if (pMCSRateSet == NULL || pMCSFilter == NULL) if (pMCSRateSet == NULL || pMCSFilter == NULL) {
{ RTLLIB_DEBUG(RTLLIB_DL_ERR, "pMCSRateSet or pMCSFilter can't "
RTLLIB_DEBUG(RTLLIB_DL_ERR, "pMCSRateSet or pMCSFilter can't be null in HTGetHighestMCSRate()\n"); "be null in HTGetHighestMCSRate()\n");
return false; return false;
} }
for (i=0; i<16; i++) for (i = 0; i < 16; i++)
availableMcsRate[i] = pMCSRateSet[i] & pMCSFilter[i]; availableMcsRate[i] = pMCSRateSet[i] & pMCSFilter[i];
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++) {
{
if (availableMcsRate[i] != 0) if (availableMcsRate[i] != 0)
break; break;
} }
if (i == 16) if (i == 16)
return false; return false;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++) {
{ if (availableMcsRate[i] != 0) {
if (availableMcsRate[i] != 0)
{
bitMap = availableMcsRate[i]; bitMap = availableMcsRate[i];
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++) {
{ if ((bitMap%2) != 0) {
if ((bitMap%2) != 0) if (HTMcsToDataRate(ieee, (8*i+j)) >
{ HTMcsToDataRate(ieee, mcsRate))
if (HTMcsToDataRate(ieee, (8*i+j)) > HTMcsToDataRate(ieee, mcsRate))
mcsRate = (8*i+j); mcsRate = (8*i+j);
} }
bitMap = bitMap>>1; bitMap = bitMap>>1;
} }
} }
} }
return (mcsRate|0x80); return mcsRate | 0x80;
} }
u8 HTFilterMCSRate( struct rtllib_device* ieee, u8* pSupportMCS, u8* pOperateMCS) u8 HTFilterMCSRate(struct rtllib_device *ieee, u8 *pSupportMCS, u8 *pOperateMCS)
{ {
u8 i=0; u8 i;
for (i=0;i<=15;i++){
pOperateMCS[i] = ieee->Regdot11TxHTOperationalRateSet[i]&pSupportMCS[i];
}
for (i = 0; i <= 15; i++)
pOperateMCS[i] = ieee->Regdot11TxHTOperationalRateSet[i] &
pSupportMCS[i];
HT_PickMCSRate(ieee, pOperateMCS); HT_PickMCSRate(ieee, pOperateMCS);
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
pOperateMCS[1] = 0; pOperateMCS[1] = 0;
for (i=2; i<=15; i++) for (i = 2; i <= 15; i++)
pOperateMCS[i] = 0; pOperateMCS[i] = 0;
return true; return true;
} }
void HTSetConnectBwMode(struct rtllib_device* ieee, enum ht_channel_width Bandwidth, enum ht_extchnl_offset Offset);
void HTSetConnectBwMode(struct rtllib_device *ieee,
enum ht_channel_width Bandwidth,
enum ht_extchnl_offset Offset);
void HTOnAssocRsp(struct rtllib_device *ieee) void HTOnAssocRsp(struct rtllib_device *ieee)
{ {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
struct ht_capab_ele *pPeerHTCap = NULL; struct ht_capab_ele *pPeerHTCap = NULL;
struct ht_info_ele *pPeerHTInfo = NULL; struct ht_info_ele *pPeerHTInfo = NULL;
u16 nMaxAMSDUSize = 0; u16 nMaxAMSDUSize = 0;
u8* pMcsFilter = NULL; u8 *pMcsFilter = NULL;
static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};
static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};
if ( pHTInfo->bCurrentHTSupport == false ) if (pHTInfo->bCurrentHTSupport == false) {
{ RTLLIB_DEBUG(RTLLIB_DL_ERR, "<=== HTOnAssocRsp(): "
RTLLIB_DEBUG(RTLLIB_DL_ERR, "<=== HTOnAssocRsp(): HT_DISABLE\n"); "HT_DISABLE\n");
return; return;
} }
RTLLIB_DEBUG(RTLLIB_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n"); RTLLIB_DEBUG(RTLLIB_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n");
if (!memcmp(pHTInfo->PeerHTCapBuf,EWC11NHTCap, sizeof(EWC11NHTCap))) if (!memcmp(pHTInfo->PeerHTCapBuf, EWC11NHTCap, sizeof(EWC11NHTCap)))
pPeerHTCap = (struct ht_capab_ele *)(&pHTInfo->PeerHTCapBuf[4]); pPeerHTCap = (struct ht_capab_ele *)(&pHTInfo->PeerHTCapBuf[4]);
else else
pPeerHTCap = (struct ht_capab_ele *)(pHTInfo->PeerHTCapBuf); pPeerHTCap = (struct ht_capab_ele *)(pHTInfo->PeerHTCapBuf);
if (!memcmp(pHTInfo->PeerHTInfoBuf, EWC11NHTInfo, sizeof(EWC11NHTInfo))) if (!memcmp(pHTInfo->PeerHTInfoBuf, EWC11NHTInfo, sizeof(EWC11NHTInfo)))
pPeerHTInfo = (struct ht_info_ele *)(&pHTInfo->PeerHTInfoBuf[4]); pPeerHTInfo = (struct ht_info_ele *)
(&pHTInfo->PeerHTInfoBuf[4]);
else else
pPeerHTInfo = (struct ht_info_ele *)(pHTInfo->PeerHTInfoBuf); pPeerHTInfo = (struct ht_info_ele *)(pHTInfo->PeerHTInfoBuf);
RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA|RTLLIB_DL_HT, pPeerHTCap, sizeof(struct ht_capab_ele)); RTLLIB_DEBUG_DATA(RTLLIB_DL_DATA | RTLLIB_DL_HT, pPeerHTCap,
HTSetConnectBwMode(ieee, (enum ht_channel_width)(pPeerHTCap->ChlWidth), (enum ht_extchnl_offset)(pPeerHTInfo->ExtChlOffset)); sizeof(struct ht_capab_ele));
pHTInfo->bCurTxBW40MHz = ((pPeerHTInfo->RecommemdedTxWidth == 1)?true:false); HTSetConnectBwMode(ieee, (enum ht_channel_width)(pPeerHTCap->ChlWidth),
(enum ht_extchnl_offset)(pPeerHTInfo->ExtChlOffset));
pHTInfo->bCurTxBW40MHz = ((pPeerHTInfo->RecommemdedTxWidth == 1) ?
true : false);
pHTInfo->bCurShortGI20MHz= pHTInfo->bCurShortGI20MHz = ((pHTInfo->bRegShortGI20MHz) ?
((pHTInfo->bRegShortGI20MHz)?((pPeerHTCap->ShortGI20Mhz==1)?true:false):false); ((pPeerHTCap->ShortGI20Mhz == 1) ?
pHTInfo->bCurShortGI40MHz= true : false) : false);
((pHTInfo->bRegShortGI40MHz)?((pPeerHTCap->ShortGI40Mhz==1)?true:false):false); pHTInfo->bCurShortGI40MHz = ((pHTInfo->bRegShortGI40MHz) ?
((pPeerHTCap->ShortGI40Mhz == 1) ?
true : false) : false);
pHTInfo->bCurSuppCCK = pHTInfo->bCurSuppCCK = ((pHTInfo->bRegSuppCCK) ?
((pHTInfo->bRegSuppCCK)?((pPeerHTCap->DssCCk==1)?true:false):false); ((pPeerHTCap->DssCCk == 1) ? true :
false) : false);
pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support; pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support;
nMaxAMSDUSize = (pPeerHTCap->MaxAMSDUSize==0)?3839:7935; nMaxAMSDUSize = (pPeerHTCap->MaxAMSDUSize == 0) ? 3839 : 7935;
if (pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize ) if (pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize)
pHTInfo->nCurrent_AMSDU_MaxSize = nMaxAMSDUSize; pHTInfo->nCurrent_AMSDU_MaxSize = nMaxAMSDUSize;
else else
pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize; pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
pHTInfo->bCurrentAMPDUEnable = pHTInfo->bAMPDUEnable; pHTInfo->bCurrentAMPDUEnable = pHTInfo->bAMPDUEnable;
if (ieee->rtllib_ap_sec_type && if (ieee->rtllib_ap_sec_type &&
(ieee->rtllib_ap_sec_type(ieee)&(SEC_ALG_WEP|SEC_ALG_TKIP))){ (ieee->rtllib_ap_sec_type(ieee)&(SEC_ALG_WEP|SEC_ALG_TKIP))) {
if ( (pHTInfo->IOTPeer== HT_IOT_PEER_ATHEROS) || if ((pHTInfo->IOTPeer == HT_IOT_PEER_ATHEROS) ||
(pHTInfo->IOTPeer == HT_IOT_PEER_UNKNOWN) ) (pHTInfo->IOTPeer == HT_IOT_PEER_UNKNOWN))
pHTInfo->bCurrentAMPDUEnable = false; pHTInfo->bCurrentAMPDUEnable = false;
} }
if (!pHTInfo->bRegRT2RTAggregation) if (!pHTInfo->bRegRT2RTAggregation) {
{
if (pHTInfo->AMPDU_Factor > pPeerHTCap->MaxRxAMPDUFactor) if (pHTInfo->AMPDU_Factor > pPeerHTCap->MaxRxAMPDUFactor)
pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor; pHTInfo->CurrentAMPDUFactor =
pPeerHTCap->MaxRxAMPDUFactor;
else else
pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor; pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
} else { } else {
if (ieee->current_network.bssht.bdRT2RTAggregation) if (ieee->current_network.bssht.bdRT2RTAggregation) {
{ if (ieee->pairwise_key_type != KEY_TYPE_NA)
if ( ieee->pairwise_key_type != KEY_TYPE_NA) pHTInfo->CurrentAMPDUFactor =
pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor; pPeerHTCap->MaxRxAMPDUFactor;
else else
pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_64K; pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_64K;
}else } else {
{
if (pPeerHTCap->MaxRxAMPDUFactor < HT_AGG_SIZE_32K) if (pPeerHTCap->MaxRxAMPDUFactor < HT_AGG_SIZE_32K)
pHTInfo->CurrentAMPDUFactor = pPeerHTCap->MaxRxAMPDUFactor; pHTInfo->CurrentAMPDUFactor =
pPeerHTCap->MaxRxAMPDUFactor;
else else
pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_32K; pHTInfo->CurrentAMPDUFactor = HT_AGG_SIZE_32K;
} }
...@@ -916,8 +918,7 @@ void HTOnAssocRsp(struct rtllib_device *ieee) ...@@ -916,8 +918,7 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density; pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
else else
pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity; pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity;
if (pHTInfo->IOTAction & HT_IOT_ACT_TX_USE_AMSDU_8K) if (pHTInfo->IOTAction & HT_IOT_ACT_TX_USE_AMSDU_8K) {
{
pHTInfo->bCurrentAMPDUEnable = false; pHTInfo->bCurrentAMPDUEnable = false;
pHTInfo->ForcedAMSDUMode = HT_AGG_FORCE_ENABLE; pHTInfo->ForcedAMSDUMode = HT_AGG_FORCE_ENABLE;
pHTInfo->ForcedAMSDUMaxSize = 7935; pHTInfo->ForcedAMSDUMaxSize = 7935;
...@@ -927,7 +928,7 @@ void HTOnAssocRsp(struct rtllib_device *ieee) ...@@ -927,7 +928,7 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
if (pPeerHTCap->MCS[0] == 0) if (pPeerHTCap->MCS[0] == 0)
pPeerHTCap->MCS[0] = 0xff; pPeerHTCap->MCS[0] = 0xff;
HTIOTActDetermineRaFunc(ieee, ((pPeerHTCap->MCS[1])!=0)); HTIOTActDetermineRaFunc(ieee, ((pPeerHTCap->MCS[1]) != 0));
HTFilterMCSRate(ieee, pPeerHTCap->MCS, ieee->dot11HTOperationalRateSet); HTFilterMCSRate(ieee, pPeerHTCap->MCS, ieee->dot11HTOperationalRateSet);
...@@ -936,15 +937,14 @@ void HTOnAssocRsp(struct rtllib_device *ieee) ...@@ -936,15 +937,14 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
pMcsFilter = MCS_FILTER_1SS; pMcsFilter = MCS_FILTER_1SS;
else else
pMcsFilter = MCS_FILTER_ALL; pMcsFilter = MCS_FILTER_ALL;
ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee, ieee->dot11HTOperationalRateSet, pMcsFilter); ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee,
ieee->dot11HTOperationalRateSet, pMcsFilter);
ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate; ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate;
pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode; pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode;
} }
void HTSetConnectBwModeCallback(struct rtllib_device* ieee); void HTInitializeHTInfo(struct rtllib_device *ieee)
void HTInitializeHTInfo(struct rtllib_device* ieee)
{ {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
...@@ -965,10 +965,14 @@ void HTInitializeHTInfo(struct rtllib_device* ieee) ...@@ -965,10 +965,14 @@ void HTInitializeHTInfo(struct rtllib_device* ieee)
pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density; pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor; pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
memset((void*)(&(pHTInfo->SelfHTCap)), 0, sizeof(pHTInfo->SelfHTCap)); memset((void *)(&(pHTInfo->SelfHTCap)), 0,
memset((void*)(&(pHTInfo->SelfHTInfo)), 0, sizeof(pHTInfo->SelfHTInfo)); sizeof(pHTInfo->SelfHTCap));
memset((void*)(&(pHTInfo->PeerHTCapBuf)), 0, sizeof(pHTInfo->PeerHTCapBuf)); memset((void *)(&(pHTInfo->SelfHTInfo)), 0,
memset((void*)(&(pHTInfo->PeerHTInfoBuf)), 0, sizeof(pHTInfo->PeerHTInfoBuf)); sizeof(pHTInfo->SelfHTInfo));
memset((void *)(&(pHTInfo->PeerHTCapBuf)), 0,
sizeof(pHTInfo->PeerHTCapBuf));
memset((void *)(&(pHTInfo->PeerHTInfoBuf)), 0,
sizeof(pHTInfo->PeerHTInfoBuf));
pHTInfo->bSwBwInProgress = false; pHTInfo->bSwBwInProgress = false;
pHTInfo->ChnlOp = CHNLOP_NONE; pHTInfo->ChnlOp = CHNLOP_NONE;
...@@ -984,12 +988,13 @@ void HTInitializeHTInfo(struct rtllib_device* ieee) ...@@ -984,12 +988,13 @@ void HTInitializeHTInfo(struct rtllib_device* ieee)
pHTInfo->IOTRaFunc = 0; pHTInfo->IOTRaFunc = 0;
{ {
u8* RegHTSuppRateSets = &(ieee->RegHTSuppRateSet[0]); u8 *RegHTSuppRateSets = &(ieee->RegHTSuppRateSet[0]);
RegHTSuppRateSets[0] = 0xFF; RegHTSuppRateSets[0] = 0xFF;
RegHTSuppRateSets[1] = 0xFF; RegHTSuppRateSets[1] = 0xFF;
RegHTSuppRateSets[4] = 0x01; RegHTSuppRateSets[4] = 0x01;
} }
} }
void HTInitializeBssDesc(struct bss_ht *pBssHT) void HTInitializeBssDesc(struct bss_ht *pBssHT)
{ {
...@@ -999,39 +1004,46 @@ void HTInitializeBssDesc(struct bss_ht *pBssHT) ...@@ -999,39 +1004,46 @@ void HTInitializeBssDesc(struct bss_ht *pBssHT)
memset(pBssHT->bdHTInfoBuf, 0, sizeof(pBssHT->bdHTInfoBuf)); memset(pBssHT->bdHTInfoBuf, 0, sizeof(pBssHT->bdHTInfoBuf));
pBssHT->bdHTInfoLen = 0; pBssHT->bdHTInfoLen = 0;
pBssHT->bdHTSpecVer= HT_SPEC_VER_IEEE; pBssHT->bdHTSpecVer = HT_SPEC_VER_IEEE;
pBssHT->bdRT2RTAggregation = false; pBssHT->bdRT2RTAggregation = false;
pBssHT->bdRT2RTLongSlotTime = false; pBssHT->bdRT2RTLongSlotTime = false;
pBssHT->RT2RT_HT_Mode = (enum rt_ht_capability)0; pBssHT->RT2RT_HT_Mode = (enum rt_ht_capability)0;
} }
void HTResetSelfAndSavePeerSetting(struct rtllib_device* ieee, struct rtllib_network * pNetwork) void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,
struct rtllib_network *pNetwork)
{ {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
u8 bIOTAction = 0; u8 bIOTAction = 0;
RTLLIB_DEBUG(RTLLIB_DL_HT, "==============>%s()\n", __func__); RTLLIB_DEBUG(RTLLIB_DL_HT, "==============>%s()\n", __func__);
/*unmark bEnableHT flag here is the same reason why unmarked in function rtllib_softmac_new_net. WB 2008.09.10*/ /* unmark bEnableHT flag here is the same reason why unmarked in
if (pNetwork->bssht.bdSupportHT) * function rtllib_softmac_new_net. WB 2008.09.10*/
{ if (pNetwork->bssht.bdSupportHT) {
pHTInfo->bCurrentHTSupport = true; pHTInfo->bCurrentHTSupport = true;
pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer; pHTInfo->ePeerHTSpecVer = pNetwork->bssht.bdHTSpecVer;
if (pNetwork->bssht.bdHTCapLen > 0 && pNetwork->bssht.bdHTCapLen <= sizeof(pHTInfo->PeerHTCapBuf)) if (pNetwork->bssht.bdHTCapLen > 0 &&
memcpy(pHTInfo->PeerHTCapBuf, pNetwork->bssht.bdHTCapBuf, pNetwork->bssht.bdHTCapLen); pNetwork->bssht.bdHTCapLen <= sizeof(pHTInfo->PeerHTCapBuf))
memcpy(pHTInfo->PeerHTCapBuf,
if (pNetwork->bssht.bdHTInfoLen > 0 && pNetwork->bssht.bdHTInfoLen <= sizeof(pHTInfo->PeerHTInfoBuf)) pNetwork->bssht.bdHTCapBuf,
memcpy(pHTInfo->PeerHTInfoBuf, pNetwork->bssht.bdHTInfoBuf, pNetwork->bssht.bdHTInfoLen); pNetwork->bssht.bdHTCapLen);
if (pHTInfo->bRegRT2RTAggregation) if (pNetwork->bssht.bdHTInfoLen > 0 &&
{ pNetwork->bssht.bdHTInfoLen <=
pHTInfo->bCurrentRT2RTAggregation = pNetwork->bssht.bdRT2RTAggregation; sizeof(pHTInfo->PeerHTInfoBuf))
pHTInfo->bCurrentRT2RTLongSlotTime = pNetwork->bssht.bdRT2RTLongSlotTime; memcpy(pHTInfo->PeerHTInfoBuf,
pNetwork->bssht.bdHTInfoBuf,
pNetwork->bssht.bdHTInfoLen);
if (pHTInfo->bRegRT2RTAggregation) {
pHTInfo->bCurrentRT2RTAggregation =
pNetwork->bssht.bdRT2RTAggregation;
pHTInfo->bCurrentRT2RTLongSlotTime =
pNetwork->bssht.bdRT2RTLongSlotTime;
pHTInfo->RT2RT_HT_Mode = pNetwork->bssht.RT2RT_HT_Mode; pHTInfo->RT2RT_HT_Mode = pNetwork->bssht.RT2RT_HT_Mode;
} } else {
else
{
pHTInfo->bCurrentRT2RTAggregation = false; pHTInfo->bCurrentRT2RTAggregation = false;
pHTInfo->bCurrentRT2RTLongSlotTime = false; pHTInfo->bCurrentRT2RTLongSlotTime = false;
pHTInfo->RT2RT_HT_Mode = (enum rt_ht_capability)0; pHTInfo->RT2RT_HT_Mode = (enum rt_ht_capability)0;
...@@ -1057,7 +1069,7 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device* ieee, struct rtllib_net ...@@ -1057,7 +1069,7 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device* ieee, struct rtllib_net
if (bIOTAction) if (bIOTAction)
pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_EDCA_TURBO; pHTInfo->IOTAction |= HT_IOT_ACT_DISABLE_EDCA_TURBO;
bIOTAction = HTIOTActIsMgntUseCCK6M(ieee,pNetwork); bIOTAction = HTIOTActIsMgntUseCCK6M(ieee, pNetwork);
if (bIOTAction) if (bIOTAction)
pHTInfo->IOTAction |= HT_IOT_ACT_MGNT_USE_CCK_6M; pHTInfo->IOTAction |= HT_IOT_ACT_MGNT_USE_CCK_6M;
bIOTAction = HTIOTActIsCCDFsync(ieee); bIOTAction = HTIOTActIsCCDFsync(ieee);
...@@ -1072,23 +1084,22 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device* ieee, struct rtllib_net ...@@ -1072,23 +1084,22 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device* ieee, struct rtllib_net
pHTInfo->IOTAction = 0; pHTInfo->IOTAction = 0;
pHTInfo->IOTRaFunc = 0; pHTInfo->IOTRaFunc = 0;
} }
} }
void HTUpdateSelfAndPeerSetting(struct rtllib_device* ieee, struct rtllib_network * pNetwork) void HTUpdateSelfAndPeerSetting(struct rtllib_device *ieee,
struct rtllib_network *pNetwork)
{ {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
struct ht_info_ele *pPeerHTInfo = (struct ht_info_ele *)pNetwork->bssht.bdHTInfoBuf; struct ht_info_ele *pPeerHTInfo =
(struct ht_info_ele *)pNetwork->bssht.bdHTInfoBuf;
if (pHTInfo->bCurrentHTSupport) if (pHTInfo->bCurrentHTSupport) {
{
if (pNetwork->bssht.bdHTInfoLen != 0) if (pNetwork->bssht.bdHTInfoLen != 0)
pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode; pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode;
} }
} }
void HTUseDefaultSetting(struct rtllib_device* ieee) void HTUseDefaultSetting(struct rtllib_device *ieee)
{ {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
...@@ -1097,14 +1108,13 @@ void HTUseDefaultSetting(struct rtllib_device* ieee) ...@@ -1097,14 +1108,13 @@ void HTUseDefaultSetting(struct rtllib_device* ieee)
pHTInfo->bCurSuppCCK = pHTInfo->bRegSuppCCK; pHTInfo->bCurSuppCCK = pHTInfo->bRegSuppCCK;
pHTInfo->bCurBW40MHz = pHTInfo->bRegBW40MHz; pHTInfo->bCurBW40MHz = pHTInfo->bRegBW40MHz;
pHTInfo->bCurShortGI20MHz= pHTInfo->bRegShortGI20MHz; pHTInfo->bCurShortGI20MHz = pHTInfo->bRegShortGI20MHz;
pHTInfo->bCurShortGI40MHz= pHTInfo->bRegShortGI40MHz; pHTInfo->bCurShortGI40MHz = pHTInfo->bRegShortGI40MHz;
if (ieee->iw_mode == IW_MODE_ADHOC) if (ieee->iw_mode == IW_MODE_ADHOC)
{ ieee->current_network.qos_data.active =
ieee->current_network.qos_data.active = ieee->current_network.qos_data.supported; ieee->current_network.qos_data.supported;
}
pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support; pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support;
pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize; pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
...@@ -1113,9 +1123,11 @@ void HTUseDefaultSetting(struct rtllib_device* ieee) ...@@ -1113,9 +1123,11 @@ void HTUseDefaultSetting(struct rtllib_device* ieee)
pHTInfo->CurrentMPDUDensity = pHTInfo->CurrentMPDUDensity; pHTInfo->CurrentMPDUDensity = pHTInfo->CurrentMPDUDensity;
HTFilterMCSRate(ieee, ieee->Regdot11TxHTOperationalRateSet,
HTFilterMCSRate(ieee, ieee->Regdot11TxHTOperationalRateSet, ieee->dot11HTOperationalRateSet); ieee->dot11HTOperationalRateSet);
ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee, ieee->dot11HTOperationalRateSet, MCS_FILTER_ALL); ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee,
ieee->dot11HTOperationalRateSet,
MCS_FILTER_ALL);
ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate; ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate;
} else { } else {
...@@ -1124,20 +1136,49 @@ void HTUseDefaultSetting(struct rtllib_device* ieee) ...@@ -1124,20 +1136,49 @@ void HTUseDefaultSetting(struct rtllib_device* ieee)
return; return;
} }
u8 HTCCheck(struct rtllib_device* ieee, u8* pFrame) u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame)
{ {
if (ieee->pHTInfo->bCurrentHTSupport) if (ieee->pHTInfo->bCurrentHTSupport) {
{ if ((IsQoSDataFrame(pFrame) && Frame_Order(pFrame)) == 1) {
if ( (IsQoSDataFrame(pFrame) && Frame_Order(pFrame)) == 1) RTLLIB_DEBUG(RTLLIB_DL_HT, "HT CONTROL FILED "
{ "EXIST!!\n");
RTLLIB_DEBUG(RTLLIB_DL_HT, "HT CONTROL FILED EXIST!!\n");
return true; return true;
} }
} }
return false; return false;
} }
void HTSetConnectBwMode(struct rtllib_device* ieee, enum ht_channel_width Bandwidth, enum ht_extchnl_offset Offset) void HTSetConnectBwModeCallback(struct rtllib_device *ieee)
{
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
RTLLIB_DEBUG(RTLLIB_DL_HT, "======>%s()\n", __func__);
if (pHTInfo->bCurBW40MHz) {
if (pHTInfo->CurSTAExtChnlOffset == HT_EXTCHNL_OFFSET_UPPER)
ieee->set_chan(ieee->dev,
ieee->current_network.channel + 2);
else if (pHTInfo->CurSTAExtChnlOffset ==
HT_EXTCHNL_OFFSET_LOWER)
ieee->set_chan(ieee->dev,
ieee->current_network.channel - 2);
else
ieee->set_chan(ieee->dev,
ieee->current_network.channel);
ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20_40,
pHTInfo->CurSTAExtChnlOffset);
} else {
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20,
HT_EXTCHNL_OFFSET_NO_EXT);
}
pHTInfo->bSwBwInProgress = false;
}
void HTSetConnectBwMode(struct rtllib_device *ieee,
enum ht_channel_width Bandwidth,
enum ht_extchnl_offset Offset)
{ {
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
...@@ -1145,18 +1186,18 @@ void HTSetConnectBwMode(struct rtllib_device* ieee, enum ht_channel_width Bandwi ...@@ -1145,18 +1186,18 @@ void HTSetConnectBwMode(struct rtllib_device* ieee, enum ht_channel_width Bandwi
return; return;
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
Bandwidth=HT_CHANNEL_WIDTH_20; Bandwidth = HT_CHANNEL_WIDTH_20;
if (pHTInfo->bSwBwInProgress) { if (pHTInfo->bSwBwInProgress) {
printk("%s: bSwBwInProgress!!\n", __func__); printk(KERN_INFO "%s: bSwBwInProgress!!\n", __func__);
return; return;
} }
if (Bandwidth==HT_CHANNEL_WIDTH_20_40) if (Bandwidth == HT_CHANNEL_WIDTH_20_40) {
{ if (ieee->current_network.channel < 2 &&
if (ieee->current_network.channel<2 && Offset==HT_EXTCHNL_OFFSET_LOWER) Offset == HT_EXTCHNL_OFFSET_LOWER)
Offset = HT_EXTCHNL_OFFSET_NO_EXT; Offset = HT_EXTCHNL_OFFSET_NO_EXT;
if (Offset==HT_EXTCHNL_OFFSET_UPPER || Offset==HT_EXTCHNL_OFFSET_LOWER) { if (Offset == HT_EXTCHNL_OFFSET_UPPER ||
Offset == HT_EXTCHNL_OFFSET_LOWER) {
pHTInfo->bCurBW40MHz = true; pHTInfo->bCurBW40MHz = true;
pHTInfo->CurSTAExtChnlOffset = Offset; pHTInfo->CurSTAExtChnlOffset = Offset;
} else { } else {
...@@ -1168,33 +1209,10 @@ void HTSetConnectBwMode(struct rtllib_device* ieee, enum ht_channel_width Bandwi ...@@ -1168,33 +1209,10 @@ void HTSetConnectBwMode(struct rtllib_device* ieee, enum ht_channel_width Bandwi
pHTInfo->CurSTAExtChnlOffset = HT_EXTCHNL_OFFSET_NO_EXT; pHTInfo->CurSTAExtChnlOffset = HT_EXTCHNL_OFFSET_NO_EXT;
} }
printk("%s():pHTInfo->bCurBW40MHz:%x\n", __func__, pHTInfo->bCurBW40MHz); printk(KERN_INFO "%s():pHTInfo->bCurBW40MHz:%x\n", __func__,
pHTInfo->bCurBW40MHz);
pHTInfo->bSwBwInProgress = true; pHTInfo->bSwBwInProgress = true;
HTSetConnectBwModeCallback(ieee); HTSetConnectBwModeCallback(ieee);
}
void HTSetConnectBwModeCallback(struct rtllib_device* ieee)
{
struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;
RTLLIB_DEBUG(RTLLIB_DL_HT, "======>%s()\n", __func__);
if (pHTInfo->bCurBW40MHz)
{
if (pHTInfo->CurSTAExtChnlOffset==HT_EXTCHNL_OFFSET_UPPER)
ieee->set_chan(ieee->dev, ieee->current_network.channel+2);
else if (pHTInfo->CurSTAExtChnlOffset==HT_EXTCHNL_OFFSET_LOWER)
ieee->set_chan(ieee->dev, ieee->current_network.channel-2);
else
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20_40, pHTInfo->CurSTAExtChnlOffset);
} else {
ieee->set_chan(ieee->dev, ieee->current_network.channel);
ieee->SetBWModeHandler(ieee->dev, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
}
pHTInfo->bSwBwInProgress = false;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment