summaryrefslogtreecommitdiff
path: root/drivers/staging/rt2860/common/spectrum.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-12-11 12:23:13 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 12:23:13 -0800
commit96b3c83dc27dca271594463aa99e166974a91171 (patch)
tree8166750ba1595a3335985c7ffc2eefe03d2544ea /drivers/staging/rt2860/common/spectrum.c
parent66cd8d6ec97bbfac53b5e67df9ef4668c3f96085 (diff)
Staging: rt28x0: run common/*.c files through Lindent
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/rt2860/common/spectrum.c')
-rw-r--r--drivers/staging/rt2860/common/spectrum.c1591
1 files changed, 817 insertions, 774 deletions
diff --git a/drivers/staging/rt2860/common/spectrum.c b/drivers/staging/rt2860/common/spectrum.c
index 7fd715ad39b1..9c2df55f8fa1 100644
--- a/drivers/staging/rt2860/common/spectrum.c
+++ b/drivers/staging/rt2860/common/spectrum.c
@@ -24,7 +24,6 @@
* *
*************************************************************************
-
Module Name:
action.c
@@ -40,94 +39,237 @@
#include "../rt_config.h"
#include "action.h"
-
/* The regulatory information in the USA (US) */
-DOT11_REGULATORY_INFORMATION USARegulatoryInfo[] =
-{
+DOT11_REGULATORY_INFORMATION USARegulatoryInfo[] = {
/* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */
- {0, {0, 0, {0}}}, // Invlid entry
- {1, {4, 16, {36, 40, 44, 48}}},
- {2, {4, 23, {52, 56, 60, 64}}},
- {3, {4, 29, {149, 153, 157, 161}}},
- {4, {11, 23, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}},
- {5, {5, 30, {149, 153, 157, 161, 165}}},
- {6, {10, 14, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}},
- {7, {10, 27, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}},
- {8, {5, 17, {11, 13, 15, 17, 19}}},
- {9, {5, 30, {11, 13, 15, 17, 19}}},
- {10, {2, 20, {21, 25}}},
- {11, {2, 33, {21, 25}}},
- {12, {11, 30, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}}}
+ {0, {0, 0, {0}
+ }
+ }
+ , // Invlid entry
+ {1, {4, 16, {36, 40, 44, 48}
+ }
+ }
+ ,
+ {2, {4, 23, {52, 56, 60, 64}
+ }
+ }
+ ,
+ {3, {4, 29, {149, 153, 157, 161}
+ }
+ }
+ ,
+ {4, {11, 23, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}
+ }
+ }
+ ,
+ {5, {5, 30, {149, 153, 157, 161, 165}
+ }
+ }
+ ,
+ {6, {10, 14, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
+ }
+ }
+ ,
+ {7, {10, 27, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
+ }
+ }
+ ,
+ {8, {5, 17, {11, 13, 15, 17, 19}
+ }
+ }
+ ,
+ {9, {5, 30, {11, 13, 15, 17, 19}
+ }
+ }
+ ,
+ {10, {2, 20, {21, 25}
+ }
+ }
+ ,
+ {11, {2, 33, {21, 25}
+ }
+ }
+ ,
+ {12, {11, 30, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
+ }
+ }
};
-#define USA_REGULATORY_INFO_SIZE (sizeof(USARegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION))
+#define USA_REGULATORY_INFO_SIZE (sizeof(USARegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION))
/* The regulatory information in Europe */
-DOT11_REGULATORY_INFORMATION EuropeRegulatoryInfo[] =
-{
+DOT11_REGULATORY_INFORMATION EuropeRegulatoryInfo[] = {
/* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */
- {0, {0, 0, {0}}}, // Invalid entry
- {1, {4, 20, {36, 40, 44, 48}}},
- {2, {4, 20, {52, 56, 60, 64}}},
- {3, {11, 30, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}},
- {4, {13, 20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}}
+ {0, {0, 0, {0}
+ }
+ }
+ , // Invalid entry
+ {1, {4, 20, {36, 40, 44, 48}
+ }
+ }
+ ,
+ {2, {4, 20, {52, 56, 60, 64}
+ }
+ }
+ ,
+ {3, {11, 30, {100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140}
+ }
+ }
+ ,
+ {4, {13, 20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}
+ }
+ }
};
-#define EU_REGULATORY_INFO_SIZE (sizeof(EuropeRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION))
+#define EU_REGULATORY_INFO_SIZE (sizeof(EuropeRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION))
/* The regulatory information in Japan */
-DOT11_REGULATORY_INFORMATION JapanRegulatoryInfo[] =
-{
+DOT11_REGULATORY_INFORMATION JapanRegulatoryInfo[] = {
/* "regulatory class" "number of channels" "Max Tx Pwr" "channel list" */
- {0, {0, 0, {0}}}, // Invalid entry
- {1, {4, 22, {34, 38, 42, 46}}},
- {2, {3, 24, {8, 12, 16}}},
- {3, {3, 24, {8, 12, 16}}},
- {4, {3, 24, {8, 12, 16}}},
- {5, {3, 24, {8, 12, 16}}},
- {6, {3, 22, {8, 12, 16}}},
- {7, {4, 24, {184, 188, 192, 196}}},
- {8, {4, 24, {184, 188, 192, 196}}},
- {9, {4, 24, {184, 188, 192, 196}}},
- {10, {4, 24, {184, 188, 192, 196}}},
- {11, {4, 22, {184, 188, 192, 196}}},
- {12, {4, 24, {7, 8, 9, 11}}},
- {13, {4, 24, {7, 8, 9, 11}}},
- {14, {4, 24, {7, 8, 9, 11}}},
- {15, {4, 24, {7, 8, 9, 11}}},
- {16, {6, 24, {183, 184, 185, 187, 188, 189}}},
- {17, {6, 24, {183, 184, 185, 187, 188, 189}}},
- {18, {6, 24, {183, 184, 185, 187, 188, 189}}},
- {19, {6, 24, {183, 184, 185, 187, 188, 189}}},
- {20, {6, 17, {183, 184, 185, 187, 188, 189}}},
- {21, {6, 24, {6, 7, 8, 9, 10, 11}}},
- {22, {6, 24, {6, 7, 8, 9, 10, 11}}},
- {23, {6, 24, {6, 7, 8, 9, 10, 11}}},
- {24, {6, 24, {6, 7, 8, 9, 10, 11}}},
- {25, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}},
- {26, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}},
- {27, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}},
- {28, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}}},
- {29, {8, 17, {182, 183, 184, 185, 186, 187, 188, 189}}},
- {30, {13, 23, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}}},
- {31, {1, 23, {14}}},
- {32, {4, 22, {52, 56, 60, 64}}}
+ {0, {0, 0, {0}
+ }
+ }
+ , // Invalid entry
+ {1, {4, 22, {34, 38, 42, 46}
+ }
+ }
+ ,
+ {2, {3, 24, {8, 12, 16}
+ }
+ }
+ ,
+ {3, {3, 24, {8, 12, 16}
+ }
+ }
+ ,
+ {4, {3, 24, {8, 12, 16}
+ }
+ }
+ ,
+ {5, {3, 24, {8, 12, 16}
+ }
+ }
+ ,
+ {6, {3, 22, {8, 12, 16}
+ }
+ }
+ ,
+ {7, {4, 24, {184, 188, 192, 196}
+ }
+ }
+ ,
+ {8, {4, 24, {184, 188, 192, 196}
+ }
+ }
+ ,
+ {9, {4, 24, {184, 188, 192, 196}
+ }
+ }
+ ,
+ {10, {4, 24, {184, 188, 192, 196}
+ }
+ }
+ ,
+ {11, {4, 22, {184, 188, 192, 196}
+ }
+ }
+ ,
+ {12, {4, 24, {7, 8, 9, 11}
+ }
+ }
+ ,
+ {13, {4, 24, {7, 8, 9, 11}
+ }
+ }
+ ,
+ {14, {4, 24, {7, 8, 9, 11}
+ }
+ }
+ ,
+ {15, {4, 24, {7, 8, 9, 11}
+ }
+ }
+ ,
+ {16, {6, 24, {183, 184, 185, 187, 188, 189}
+ }
+ }
+ ,
+ {17, {6, 24, {183, 184, 185, 187, 188, 189}
+ }
+ }
+ ,
+ {18, {6, 24, {183, 184, 185, 187, 188, 189}
+ }
+ }
+ ,
+ {19, {6, 24, {183, 184, 185, 187, 188, 189}
+ }
+ }
+ ,
+ {20, {6, 17, {183, 184, 185, 187, 188, 189}
+ }
+ }
+ ,
+ {21, {6, 24, {6, 7, 8, 9, 10, 11}
+ }
+ }
+ ,
+ {22, {6, 24, {6, 7, 8, 9, 10, 11}
+ }
+ }
+ ,
+ {23, {6, 24, {6, 7, 8, 9, 10, 11}
+ }
+ }
+ ,
+ {24, {6, 24, {6, 7, 8, 9, 10, 11}
+ }
+ }
+ ,
+ {25, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}
+ }
+ }
+ ,
+ {26, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}
+ }
+ }
+ ,
+ {27, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}
+ }
+ }
+ ,
+ {28, {8, 24, {182, 183, 184, 185, 186, 187, 188, 189}
+ }
+ }
+ ,
+ {29, {8, 17, {182, 183, 184, 185, 186, 187, 188, 189}
+ }
+ }
+ ,
+ {30, {13, 23, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}
+ }
+ }
+ ,
+ {31, {1, 23, {14}
+ }
+ }
+ ,
+ {32, {4, 22, {52, 56, 60, 64}
+ }
+ }
};
-#define JP_REGULATORY_INFO_SIZE (sizeof(JapanRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION))
+#define JP_REGULATORY_INFO_SIZE (sizeof(JapanRegulatoryInfo) / sizeof(DOT11_REGULATORY_INFORMATION))
-CHAR RTMP_GetTxPwr(
- IN PRTMP_ADAPTER pAd,
- IN HTTRANSMIT_SETTING HTTxMode)
-{
-typedef struct __TX_PWR_CFG
+CHAR RTMP_GetTxPwr(IN PRTMP_ADAPTER pAd, IN HTTRANSMIT_SETTING HTTxMode)
{
- UINT8 Mode;
- UINT8 MCS;
- UINT16 req;
- UINT8 shift;
- UINT32 BitMask;
-} TX_PWR_CFG;
+ typedef struct __TX_PWR_CFG {
+ UINT8 Mode;
+ UINT8 MCS;
+ UINT16 req;
+ UINT8 shift;
+ UINT32 BitMask;
+ } TX_PWR_CFG;
UINT32 Value;
INT Idx;
@@ -137,7 +279,6 @@ typedef struct __TX_PWR_CFG
CHAR DaltaPwr;
ULONG TxPwr[5];
-
TX_PWR_CFG TxPwrCfg[] = {
{MODE_CCK, 0, 0, 4, 0x000000f0},
{MODE_CCK, 1, 0, 0, 0x0000000f},
@@ -152,7 +293,7 @@ typedef struct __TX_PWR_CFG
{MODE_OFDM, 5, 1, 0, 0x0000000f},
{MODE_OFDM, 6, 1, 12, 0x0000f000},
{MODE_OFDM, 7, 1, 8, 0x00000f00}
- ,{MODE_HTMIX, 0, 1, 20, 0x00f00000},
+ , {MODE_HTMIX, 0, 1, 20, 0x00f00000},
{MODE_HTMIX, 1, 1, 16, 0x000f0000},
{MODE_HTMIX, 2, 1, 28, 0xf0000000},
{MODE_HTMIX, 3, 1, 24, 0x0f000000},
@@ -174,50 +315,40 @@ typedef struct __TX_PWR_CFG
CurTxPwr = 19;
/* check Tx Power setting from UI. */
- if (pAd->CommonCfg.TxPowerPercentage > 90)
- ;
- else if (pAd->CommonCfg.TxPowerPercentage > 60) /* reduce Pwr for 1 dB. */
+ if (pAd->CommonCfg.TxPowerPercentage > 90) ;
+ else if (pAd->CommonCfg.TxPowerPercentage > 60) /* reduce Pwr for 1 dB. */
CurTxPwr -= 1;
- else if (pAd->CommonCfg.TxPowerPercentage > 30) /* reduce Pwr for 3 dB. */
+ else if (pAd->CommonCfg.TxPowerPercentage > 30) /* reduce Pwr for 3 dB. */
CurTxPwr -= 3;
- else if (pAd->CommonCfg.TxPowerPercentage > 15) /* reduce Pwr for 6 dB. */
+ else if (pAd->CommonCfg.TxPowerPercentage > 15) /* reduce Pwr for 6 dB. */
CurTxPwr -= 6;
- else if (pAd->CommonCfg.TxPowerPercentage > 9) /* reduce Pwr for 9 dB. */
+ else if (pAd->CommonCfg.TxPowerPercentage > 9) /* reduce Pwr for 9 dB. */
CurTxPwr -= 9;
- else /* reduce Pwr for 12 dB. */
+ else /* reduce Pwr for 12 dB. */
CurTxPwr -= 12;
- if (pAd->CommonCfg.BBPCurrentBW == BW_40)
- {
- if (pAd->CommonCfg.CentralChannel > 14)
- {
+ if (pAd->CommonCfg.BBPCurrentBW == BW_40) {
+ if (pAd->CommonCfg.CentralChannel > 14) {
TxPwr[0] = pAd->Tx40MPwrCfgABand[0];
TxPwr[1] = pAd->Tx40MPwrCfgABand[1];
TxPwr[2] = pAd->Tx40MPwrCfgABand[2];
TxPwr[3] = pAd->Tx40MPwrCfgABand[3];
TxPwr[4] = pAd->Tx40MPwrCfgABand[4];
- }
- else
- {
+ } else {
TxPwr[0] = pAd->Tx40MPwrCfgGBand[0];
TxPwr[1] = pAd->Tx40MPwrCfgGBand[1];
TxPwr[2] = pAd->Tx40MPwrCfgGBand[2];
TxPwr[3] = pAd->Tx40MPwrCfgGBand[3];
TxPwr[4] = pAd->Tx40MPwrCfgGBand[4];
}
- }
- else
- {
- if (pAd->CommonCfg.Channel > 14)
- {
+ } else {
+ if (pAd->CommonCfg.Channel > 14) {
TxPwr[0] = pAd->Tx20MPwrCfgABand[0];
TxPwr[1] = pAd->Tx20MPwrCfgABand[1];
TxPwr[2] = pAd->Tx20MPwrCfgABand[2];
TxPwr[3] = pAd->Tx20MPwrCfgABand[3];
TxPwr[4] = pAd->Tx20MPwrCfgABand[4];
- }
- else
- {
+ } else {
TxPwr[0] = pAd->Tx20MPwrCfgGBand[0];
TxPwr[1] = pAd->Tx20MPwrCfgGBand[1];
TxPwr[2] = pAd->Tx20MPwrCfgGBand[2];
@@ -226,44 +357,36 @@ typedef struct __TX_PWR_CFG
}
}
+ switch (HTTxMode.field.MODE) {
+ case MODE_CCK:
+ case MODE_OFDM:
+ Value = TxPwr[1];
+ TxPwrRef = (Value & 0x00000f00) >> 8;
- switch(HTTxMode.field.MODE)
- {
- case MODE_CCK:
- case MODE_OFDM:
- Value = TxPwr[1];
- TxPwrRef = (Value & 0x00000f00) >> 8;
+ break;
- break;
-
- case MODE_HTMIX:
- case MODE_HTGREENFIELD:
- if (pAd->CommonCfg.TxStream == 1)
- {
- Value = TxPwr[2];
- TxPwrRef = (Value & 0x00000f00) >> 8;
- }
- else if (pAd->CommonCfg.TxStream == 2)
- {
- Value = TxPwr[3];
- TxPwrRef = (Value & 0x00000f00) >> 8;
- }
- break;
+ case MODE_HTMIX:
+ case MODE_HTGREENFIELD:
+ if (pAd->CommonCfg.TxStream == 1) {
+ Value = TxPwr[2];
+ TxPwrRef = (Value & 0x00000f00) >> 8;
+ } else if (pAd->CommonCfg.TxStream == 2) {
+ Value = TxPwr[3];
+ TxPwrRef = (Value & 0x00000f00) >> 8;
+ }
+ break;
}
- PhyMode =
- (HTTxMode.field.MODE == MODE_HTGREENFIELD)
- ? MODE_HTMIX :
- HTTxMode.field.MODE;
+ PhyMode = (HTTxMode.field.MODE == MODE_HTGREENFIELD)
+ ? MODE_HTMIX : HTTxMode.field.MODE;
- for (Idx = 0; Idx < MAX_TXPWR_TAB_SIZE; Idx++)
- {
+ for (Idx = 0; Idx < MAX_TXPWR_TAB_SIZE; Idx++) {
if ((TxPwrCfg[Idx].Mode == PhyMode)
- && (TxPwrCfg[Idx].MCS == HTTxMode.field.MCS))
- {
+ && (TxPwrCfg[Idx].MCS == HTTxMode.field.MCS)) {
Value = TxPwr[TxPwrCfg[Idx].req];
- DaltaPwr = TxPwrRef - (CHAR)((Value & TxPwrCfg[Idx].BitMask)
- >> TxPwrCfg[Idx].shift);
+ DaltaPwr =
+ TxPwrRef - (CHAR) ((Value & TxPwrCfg[Idx].BitMask)
+ >> TxPwrCfg[Idx].shift);
CurTxPwr -= DaltaPwr;
break;
}
@@ -272,23 +395,24 @@ typedef struct __TX_PWR_CFG
return CurTxPwr;
}
-
-VOID MeasureReqTabInit(
- IN PRTMP_ADAPTER pAd)
+VOID MeasureReqTabInit(IN PRTMP_ADAPTER pAd)
{
NdisAllocateSpinLock(&pAd->CommonCfg.MeasureReqTabLock);
- pAd->CommonCfg.pMeasureReqTab = kmalloc(sizeof(MEASURE_REQ_TAB), GFP_ATOMIC);
+ pAd->CommonCfg.pMeasureReqTab =
+ kmalloc(sizeof(MEASURE_REQ_TAB), GFP_ATOMIC);
if (pAd->CommonCfg.pMeasureReqTab)
- NdisZeroMemory(pAd->CommonCfg.pMeasureReqTab, sizeof(MEASURE_REQ_TAB));
+ NdisZeroMemory(pAd->CommonCfg.pMeasureReqTab,
+ sizeof(MEASURE_REQ_TAB));
else
- DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->CommonCfg.pMeasureReqTab.\n", __func__));
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s Fail to alloc memory for pAd->CommonCfg.pMeasureReqTab.\n",
+ __func__));
return;
}
-VOID MeasureReqTabExit(
- IN PRTMP_ADAPTER pAd)
+VOID MeasureReqTabExit(IN PRTMP_ADAPTER pAd)
{
NdisFreeSpinLock(&pAd->CommonCfg.MeasureReqTabLock);
@@ -299,18 +423,16 @@ VOID MeasureReqTabExit(
return;
}
-PMEASURE_REQ_ENTRY MeasureReqLookUp(
- IN PRTMP_ADAPTER pAd,
- IN UINT8 DialogToken)
+PMEASURE_REQ_ENTRY MeasureReqLookUp(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
{
UINT HashIdx;
PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab;
PMEASURE_REQ_ENTRY pEntry = NULL;
PMEASURE_REQ_ENTRY pPrevEntry = NULL;
- if (pTab == NULL)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab doesn't exist.\n", __func__));
+ if (pTab == NULL) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: pMeasureReqTab doesn't exist.\n", __func__));
return NULL;
}
@@ -319,12 +441,10 @@ PMEASURE_REQ_ENTRY MeasureReqLookUp(
HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(DialogToken);
pEntry = pTab->Hash[HashIdx];
- while (pEntry)
- {
+ while (pEntry) {
if (pEntry->DialogToken == DialogToken)
break;
- else
- {
+ else {
pPrevEntry = pEntry;
pEntry = pEntry->pNext;
}
@@ -335,9 +455,7 @@ PMEASURE_REQ_ENTRY MeasureReqLookUp(
return pEntry;
}
-PMEASURE_REQ_ENTRY MeasureReqInsert(
- IN PRTMP_ADAPTER pAd,
- IN UINT8 DialogToken)
+PMEASURE_REQ_ENTRY MeasureReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
{
INT i;
ULONG HashIdx;
@@ -345,40 +463,41 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(
PMEASURE_REQ_ENTRY pEntry = NULL, pCurrEntry;
ULONG Now;
- if(pTab == NULL)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab doesn't exist.\n", __func__));
+ if (pTab == NULL) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: pMeasureReqTab doesn't exist.\n", __func__));
return NULL;
}
pEntry = MeasureReqLookUp(pAd, DialogToken);
- if (pEntry == NULL)
- {
+ if (pEntry == NULL) {
RTMP_SEM_LOCK(&pAd->CommonCfg.MeasureReqTabLock);
- for (i = 0; i < MAX_MEASURE_REQ_TAB_SIZE; i++)
- {
+ for (i = 0; i < MAX_MEASURE_REQ_TAB_SIZE; i++) {
NdisGetSystemUpTime(&Now);
pEntry = &pTab->Content[i];
if ((pEntry->Valid == TRUE)
- && RTMP_TIME_AFTER((unsigned long)Now, (unsigned long)(pEntry->lastTime + MQ_REQ_AGE_OUT)))
+ && RTMP_TIME_AFTER((unsigned long)Now,
+ (unsigned long)(pEntry->
+ lastTime +
+ MQ_REQ_AGE_OUT)))
{
PMEASURE_REQ_ENTRY pPrevEntry = NULL;
- ULONG HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken);
- PMEASURE_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx];
+ ULONG HashIdx =
+ MQ_DIALOGTOKEN_HASH_INDEX(pEntry->
+ DialogToken);
+ PMEASURE_REQ_ENTRY pProbeEntry =
+ pTab->Hash[HashIdx];
// update Hash list
- do
- {
- if (pProbeEntry == pEntry)
- {
- if (pPrevEntry == NULL)
- {
- pTab->Hash[HashIdx] = pEntry->pNext;
- }
- else
- {
- pPrevEntry->pNext = pEntry->pNext;
+ do {
+ if (pProbeEntry == pEntry) {
+ if (pPrevEntry == NULL) {
+ pTab->Hash[HashIdx] =
+ pEntry->pNext;
+ } else {
+ pPrevEntry->pNext =
+ pEntry->pNext;
}
break;
}
@@ -387,7 +506,8 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(
pProbeEntry = pProbeEntry->pNext;
} while (pProbeEntry);
- NdisZeroMemory(pEntry, sizeof(MEASURE_REQ_ENTRY));
+ NdisZeroMemory(pEntry,
+ sizeof(MEASURE_REQ_ENTRY));
pTab->Size--;
break;
@@ -397,30 +517,24 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(
break;
}
- if (i < MAX_MEASURE_REQ_TAB_SIZE)
- {
+ if (i < MAX_MEASURE_REQ_TAB_SIZE) {
NdisGetSystemUpTime(&Now);
pEntry->lastTime = Now;
pEntry->Valid = TRUE;
pEntry->DialogToken = DialogToken;
pTab->Size++;
- }
- else
- {
+ } else {
pEntry = NULL;
- DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab tab full.\n", __func__));
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: pMeasureReqTab tab full.\n", __func__));
}
// add this Neighbor entry into HASH table
- if (pEntry)
- {
+ if (pEntry) {
HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(DialogToken);
- if (pTab->Hash[HashIdx] == NULL)
- {
+ if (pTab->Hash[HashIdx] == NULL) {
pTab->Hash[HashIdx] = pEntry;
- }
- else
- {
+ } else {
pCurrEntry = pTab->Hash[HashIdx];
while (pCurrEntry->pNext != NULL)
pCurrEntry = pCurrEntry->pNext;
@@ -434,45 +548,35 @@ PMEASURE_REQ_ENTRY MeasureReqInsert(
return pEntry;
}
-VOID MeasureReqDelete(
- IN PRTMP_ADAPTER pAd,
- IN UINT8 DialogToken)
+VOID MeasureReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
{
PMEASURE_REQ_TAB pTab = pAd->CommonCfg.pMeasureReqTab;
PMEASURE_REQ_ENTRY pEntry = NULL;
- if(pTab == NULL)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s: pMeasureReqTab doesn't exist.\n", __func__));
+ if (pTab == NULL) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: pMeasureReqTab doesn't exist.\n", __func__));
return;
}
-
// if empty, return
- if (pTab->Size == 0)
- {
+ if (pTab->Size == 0) {
DBGPRINT(RT_DEBUG_ERROR, ("pMeasureReqTab empty.\n"));
return;
}
pEntry = MeasureReqLookUp(pAd, DialogToken);
- if (pEntry != NULL)
- {
+ if (pEntry != NULL) {
PMEASURE_REQ_ENTRY pPrevEntry = NULL;
ULONG HashIdx = MQ_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken);
PMEASURE_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx];
RTMP_SEM_LOCK(&pAd->CommonCfg.MeasureReqTabLock);
// update Hash list
- do
- {
- if (pProbeEntry == pEntry)
- {
- if (pPrevEntry == NULL)
- {
+ do {
+ if (pProbeEntry == pEntry) {
+ if (pPrevEntry == NULL) {
pTab->Hash[HashIdx] = pEntry->pNext;
- }
- else
- {
+ } else {
pPrevEntry->pNext = pEntry->pNext;
}
break;
@@ -491,8 +595,7 @@ VOID MeasureReqDelete(
return;
}
-VOID TpcReqTabInit(
- IN PRTMP_ADAPTER pAd)
+VOID TpcReqTabInit(IN PRTMP_ADAPTER pAd)
{
NdisAllocateSpinLock(&pAd->CommonCfg.TpcReqTabLock);
@@ -500,13 +603,14 @@ VOID TpcReqTabInit(
if (pAd->CommonCfg.pTpcReqTab)
NdisZeroMemory(pAd->CommonCfg.pTpcReqTab, sizeof(TPC_REQ_TAB));
else
- DBGPRINT(RT_DEBUG_ERROR, ("%s Fail to alloc memory for pAd->CommonCfg.pTpcReqTab.\n", __func__));
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s Fail to alloc memory for pAd->CommonCfg.pTpcReqTab.\n",
+ __func__));
return;
}
-VOID TpcReqTabExit(
- IN PRTMP_ADAPTER pAd)
+VOID TpcReqTabExit(IN PRTMP_ADAPTER pAd)
{
NdisFreeSpinLock(&pAd->CommonCfg.TpcReqTabLock);
@@ -517,18 +621,16 @@ VOID TpcReqTabExit(
return;
}
-static PTPC_REQ_ENTRY TpcReqLookUp(
- IN PRTMP_ADAPTER pAd,
- IN UINT8 DialogToken)
+static PTPC_REQ_ENTRY TpcReqLookUp(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
{
UINT HashIdx;
PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab;
PTPC_REQ_ENTRY pEntry = NULL;
PTPC_REQ_ENTRY pPrevEntry = NULL;
- if (pTab == NULL)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab doesn't exist.\n", __func__));
+ if (pTab == NULL) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: pTpcReqTab doesn't exist.\n", __func__));
return NULL;
}
@@ -537,12 +639,10 @@ static PTPC_REQ_ENTRY TpcReqLookUp(
HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(DialogToken);
pEntry = pTab->Hash[HashIdx];
- while (pEntry)
- {
+ while (pEntry) {
if (pEntry->DialogToken == DialogToken)
break;
- else
- {
+ else {
pPrevEntry = pEntry;
pEntry = pEntry->pNext;
}
@@ -553,10 +653,7 @@ static PTPC_REQ_ENTRY TpcReqLookUp(
return pEntry;
}
-
-static PTPC_REQ_ENTRY TpcReqInsert(
- IN PRTMP_ADAPTER pAd,
- IN UINT8 DialogToken)
+static PTPC_REQ_ENTRY TpcReqInsert(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
{
INT i;
ULONG HashIdx;
@@ -564,40 +661,41 @@ static PTPC_REQ_ENTRY TpcReqInsert(
PTPC_REQ_ENTRY pEntry = NULL, pCurrEntry;
ULONG Now;
- if(pTab == NULL)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab doesn't exist.\n", __func__));
+ if (pTab == NULL) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: pTpcReqTab doesn't exist.\n", __func__));
return NULL;
}
pEntry = TpcReqLookUp(pAd, DialogToken);
- if (pEntry == NULL)
- {
+ if (pEntry == NULL) {
RTMP_SEM_LOCK(&pAd->CommonCfg.TpcReqTabLock);
- for (i = 0; i < MAX_TPC_REQ_TAB_SIZE; i++)
- {
+ for (i = 0; i < MAX_TPC_REQ_TAB_SIZE; i++) {
NdisGetSystemUpTime(&Now);
pEntry = &pTab->Content[i];
if ((pEntry->Valid == TRUE)
- && RTMP_TIME_AFTER((unsigned long)Now, (unsigned long)(pEntry->lastTime + TPC_REQ_AGE_OUT)))
+ && RTMP_TIME_AFTER((unsigned long)Now,
+ (unsigned long)(pEntry->
+ lastTime +
+ TPC_REQ_AGE_OUT)))
{
PTPC_REQ_ENTRY pPrevEntry = NULL;
- ULONG HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken);
- PTPC_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx];
+ ULONG HashIdx =
+ TPC_DIALOGTOKEN_HASH_INDEX(pEntry->
+ DialogToken);
+ PTPC_REQ_ENTRY pProbeEntry =
+ pTab->Hash[HashIdx];
// update Hash list
- do
- {
- if (pProbeEntry == pEntry)
- {
- if (pPrevEntry == NULL)
- {
- pTab->Hash[HashIdx] = pEntry->pNext;
- }
- else
- {
- pPrevEntry->pNext = pEntry->pNext;
+ do {
+ if (pProbeEntry == pEntry) {
+ if (pPrevEntry == NULL) {
+ pTab->Hash[HashIdx] =
+ pEntry->pNext;
+ } else {
+ pPrevEntry->pNext =
+ pEntry->pNext;
}
break;
}
@@ -616,30 +714,24 @@ static PTPC_REQ_ENTRY TpcReqInsert(
break;
}
- if (i < MAX_TPC_REQ_TAB_SIZE)
- {
+ if (i < MAX_TPC_REQ_TAB_SIZE) {
NdisGetSystemUpTime(&Now);
pEntry->lastTime = Now;
pEntry->Valid = TRUE;
pEntry->DialogToken = DialogToken;
pTab->Size++;
- }
- else
- {
+ } else {
pEntry = NULL;
- DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab tab full.\n", __func__));
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: pTpcReqTab tab full.\n", __func__));
}
// add this Neighbor entry into HASH table
- if (pEntry)
- {
+ if (pEntry) {
HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(DialogToken);
- if (pTab->Hash[HashIdx] == NULL)
- {
+ if (pTab->Hash[HashIdx] == NULL) {
pTab->Hash[HashIdx] = pEntry;
- }
- else
- {
+ } else {
pCurrEntry = pTab->Hash[HashIdx];
while (pCurrEntry->pNext != NULL)
pCurrEntry = pCurrEntry->pNext;
@@ -653,45 +745,35 @@ static PTPC_REQ_ENTRY TpcReqInsert(
return pEntry;
}
-static VOID TpcReqDelete(
- IN PRTMP_ADAPTER pAd,
- IN UINT8 DialogToken)
+static VOID TpcReqDelete(IN PRTMP_ADAPTER pAd, IN UINT8 DialogToken)
{
PTPC_REQ_TAB pTab = pAd->CommonCfg.pTpcReqTab;
PTPC_REQ_ENTRY pEntry = NULL;
- if(pTab == NULL)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s: pTpcReqTab doesn't exist.\n", __func__));
+ if (pTab == NULL) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: pTpcReqTab doesn't exist.\n", __func__));
return;
}
-
// if empty, return
- if (pTab->Size == 0)
- {
+ if (pTab->Size == 0) {
DBGPRINT(RT_DEBUG_ERROR, ("pTpcReqTab empty.\n"));
return;
}
pEntry = TpcReqLookUp(pAd, DialogToken);
- if (pEntry != NULL)
- {
+ if (pEntry != NULL) {
PTPC_REQ_ENTRY pPrevEntry = NULL;
ULONG HashIdx = TPC_DIALOGTOKEN_HASH_INDEX(pEntry->DialogToken);
PTPC_REQ_ENTRY pProbeEntry = pTab->Hash[HashIdx];
RTMP_SEM_LOCK(&pAd->CommonCfg.TpcReqTabLock);
// update Hash list
- do
- {
- if (pProbeEntry == pEntry)
- {
- if (pPrevEntry == NULL)
- {
+ do {
+ if (pProbeEntry == pEntry) {
+ if (pPrevEntry == NULL) {
pTab->Hash[HashIdx] = pEntry->pNext;
- }
- else
- {
+ } else {
pPrevEntry->pNext = pEntry->pNext;
}
break;
@@ -720,8 +802,7 @@ static VOID TpcReqDelete(
Return : Current Time Stamp.
==========================================================================
*/
-static UINT64 GetCurrentTimeStamp(
- IN PRTMP_ADAPTER pAd)
+static UINT64 GetCurrentTimeStamp(IN PRTMP_ADAPTER pAd)
{
// get current time stamp.
return 0;
@@ -737,11 +818,9 @@ static UINT64 GetCurrentTimeStamp(
Return : Current Time Stamp.
==========================================================================
*/
-static UINT8 GetCurTxPwr(
- IN PRTMP_ADAPTER pAd,
- IN UINT8 Wcid)
+static UINT8 GetCurTxPwr(IN PRTMP_ADAPTER pAd, IN UINT8 Wcid)
{
- return 16; /* 16 dBm */
+ return 16; /* 16 dBm */
}
/*
@@ -754,12 +833,10 @@ static UINT8 GetCurTxPwr(
Return : Current Time Stamp.
==========================================================================
*/
-VOID InsertChannelRepIE(
- IN PRTMP_ADAPTER pAd,
- OUT PUCHAR pFrameBuf,
- OUT PULONG pFrameLen,
- IN PSTRING pCountry,
- IN UINT8 RegulatoryClass)
+VOID InsertChannelRepIE(IN PRTMP_ADAPTER pAd,
+ OUT PUCHAR pFrameBuf,
+ OUT PULONG pFrameLen,
+ IN PSTRING pCountry, IN UINT8 RegulatoryClass)
{
ULONG TempLen;
UINT8 Len;
@@ -767,43 +844,43 @@ VOID InsertChannelRepIE(
PUCHAR pChListPtr = NULL;
Len = 1;
- if (strncmp(pCountry, "US", 2) == 0)
- {
- if (RegulatoryClass >= USA_REGULATORY_INFO_SIZE)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s: USA Unknow Requlatory class (%d)\n",
- __func__, RegulatoryClass));
+ if (strncmp(pCountry, "US", 2) == 0) {
+ if (RegulatoryClass >= USA_REGULATORY_INFO_SIZE) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: USA Unknow Requlatory class (%d)\n",
+ __func__, RegulatoryClass));
return;
}
- Len += USARegulatoryInfo[RegulatoryClass].ChannelSet.NumberOfChannels;
- pChListPtr = USARegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList;
- }
- else if (strncmp(pCountry, "JP", 2) == 0)
- {
- if (RegulatoryClass >= JP_REGULATORY_INFO_SIZE)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s: JP Unknow Requlatory class (%d)\n",
- __func__, RegulatoryClass));
+ Len +=
+ USARegulatoryInfo[RegulatoryClass].ChannelSet.
+ NumberOfChannels;
+ pChListPtr =
+ USARegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList;
+ } else if (strncmp(pCountry, "JP", 2) == 0) {
+ if (RegulatoryClass >= JP_REGULATORY_INFO_SIZE) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: JP Unknow Requlatory class (%d)\n",
+ __func__, RegulatoryClass));
return;
}
- Len += JapanRegulatoryInfo[RegulatoryClass].ChannelSet.NumberOfChannels;
- pChListPtr = JapanRegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList;
- }
- else
- {
+ Len +=
+ JapanRegulatoryInfo[RegulatoryClass].ChannelSet.
+ NumberOfChannels;
+ pChListPtr =
+ JapanRegulatoryInfo[RegulatoryClass].ChannelSet.ChannelList;
+ } else {
DBGPRINT(RT_DEBUG_ERROR, ("%s: Unknow Country (%s)\n",
- __func__, pCountry));
+ __func__, pCountry));
return;
}
- MakeOutgoingFrame(pFrameBuf, &TempLen,
- 1, &IEId,
- 1, &Len,
- 1, &RegulatoryClass,
- Len -1, pChListPtr,
- END_OF_ARGS);
+ MakeOutgoingFrame(pFrameBuf, &TempLen,
+ 1, &IEId,
+ 1, &Len,
+ 1, &RegulatoryClass,
+ Len - 1, pChListPtr, END_OF_ARGS);
*pFrameLen = *pFrameLen + TempLen;
@@ -823,16 +900,12 @@ VOID InsertChannelRepIE(
Return : None.
==========================================================================
*/
-VOID InsertDialogToken(
- IN PRTMP_ADAPTER pAd,
- OUT PUCHAR pFrameBuf,
- OUT PULONG pFrameLen,
- IN UINT8 DialogToken)
+VOID InsertDialogToken(IN PRTMP_ADAPTER pAd,
+ OUT PUCHAR pFrameBuf,
+ OUT PULONG pFrameLen, IN UINT8 DialogToken)
{
ULONG TempLen;
- MakeOutgoingFrame(pFrameBuf, &TempLen,
- 1, &DialogToken,
- END_OF_ARGS);
+ MakeOutgoingFrame(pFrameBuf, &TempLen, 1, &DialogToken, END_OF_ARGS);
*pFrameLen = *pFrameLen + TempLen;
@@ -851,19 +924,15 @@ VOID InsertDialogToken(
Return : None.
==========================================================================
*/
- static VOID InsertTpcReqIE(
- IN PRTMP_ADAPTER pAd,
- OUT PUCHAR pFrameBuf,
- OUT PULONG pFrameLen)
+static VOID InsertTpcReqIE(IN PRTMP_ADAPTER pAd,
+ OUT PUCHAR pFrameBuf, OUT PULONG pFrameLen)
{
ULONG TempLen;
ULONG Len = 0;
UINT8 ElementID = IE_TPC_REQUEST;
- MakeOutgoingFrame(pFrameBuf, &TempLen,
- 1, &ElementID,
- 1, &Len,
- END_OF_ARGS);
+ MakeOutgoingFrame(pFrameBuf, &TempLen,
+ 1, &ElementID, 1, &Len, END_OF_ARGS);
*pFrameLen = *pFrameLen + TempLen;
@@ -884,12 +953,10 @@ VOID InsertDialogToken(
Return : None.
==========================================================================
*/
-VOID InsertTpcReportIE(
- IN PRTMP_ADAPTER pAd,
- OUT PUCHAR pFrameBuf,
- OUT PULONG pFrameLen,
- IN UINT8 TxPwr,
- IN UINT8 LinkMargin)
+VOID InsertTpcReportIE(IN PRTMP_ADAPTER pAd,
+ OUT PUCHAR pFrameBuf,
+ OUT PULONG pFrameLen,
+ IN UINT8 TxPwr, IN UINT8 LinkMargin)
{
ULONG TempLen;
ULONG Len = sizeof(TPC_REPORT_INFO);
@@ -899,15 +966,12 @@ VOID InsertTpcReportIE(
TpcReportIE.TxPwr = TxPwr;
TpcReportIE.LinkMargin = LinkMargin;
- MakeOutgoingFrame(pFrameBuf, &TempLen,
- 1, &ElementID,
- 1, &Len,
- Len, &TpcReportIE,
- END_OF_ARGS);
+ MakeOutgoingFrame(pFrameBuf, &TempLen,
+ 1, &ElementID,
+ 1, &Len, Len, &TpcReportIE, END_OF_ARGS);
*pFrameLen = *pFrameLen + TempLen;
-
return;
}
@@ -926,13 +990,11 @@ VOID InsertTpcReportIE(
Return : None.
==========================================================================
*/
-static VOID InsertChSwAnnIE(
- IN PRTMP_ADAPTER pAd,
- OUT PUCHAR pFrameBuf,
- OUT PULONG pFrameLen,
- IN UINT8 ChSwMode,
- IN UINT8 NewChannel,
- IN UINT8 ChSwCnt)
+static VOID InsertChSwAnnIE(IN PRTMP_ADAPTER pAd,
+ OUT PUCHAR pFrameBuf,
+ OUT PULONG pFrameLen,
+ IN UINT8 ChSwMode,
+ IN UINT8 NewChannel, IN UINT8 ChSwCnt)
{
ULONG TempLen;
ULONG Len = sizeof(CH_SW_ANN_INFO);
@@ -943,15 +1005,11 @@ static VOID InsertChSwAnnIE(
ChSwAnnIE.Channel = NewChannel;
ChSwAnnIE.ChSwCnt = ChSwCnt;
- MakeOutgoingFrame(pFrameBuf, &TempLen,
- 1, &ElementID,
- 1, &Len,
- Len, &ChSwAnnIE,
- END_OF_ARGS);
+ MakeOutgoingFrame(pFrameBuf, &TempLen,
+ 1, &ElementID, 1, &Len, Len, &ChSwAnnIE, END_OF_ARGS);
*pFrameLen = *pFrameLen + TempLen;
-
return;
}
@@ -970,25 +1028,21 @@ static VOID InsertChSwAnnIE(
7. Measure Start time.
8. Measure Duration.
-
Return : None.
==========================================================================
*/
-static VOID InsertMeasureReqIE(
- IN PRTMP_ADAPTER pAd,
- OUT PUCHAR pFrameBuf,
- OUT PULONG pFrameLen,
- IN UINT8 Len,
- IN PMEASURE_REQ_INFO pMeasureReqIE)
+static VOID InsertMeasureReqIE(IN PRTMP_ADAPTER pAd,
+ OUT PUCHAR pFrameBuf,
+ OUT PULONG pFrameLen,
+ IN UINT8 Len, IN PMEASURE_REQ_INFO pMeasureReqIE)
{
ULONG TempLen;
UINT8 ElementID = IE_MEASUREMENT_REQUEST;
- MakeOutgoingFrame(pFrameBuf, &TempLen,
- 1, &ElementID,
- 1, &Len,
- sizeof(MEASURE_REQ_INFO), pMeasureReqIE,
- END_OF_ARGS);
+ MakeOutgoingFrame(pFrameBuf, &TempLen,
+ 1, &ElementID,
+ 1, &Len,
+ sizeof(MEASURE_REQ_INFO), pMeasureReqIE, END_OF_ARGS);
*pFrameLen = *pFrameLen + TempLen;
@@ -1012,13 +1066,11 @@ static VOID InsertMeasureReqIE(
Return : None.
==========================================================================
*/
-static VOID InsertMeasureReportIE(
- IN PRTMP_ADAPTER pAd,
- OUT PUCHAR pFrameBuf,
- OUT PULONG pFrameLen,
- IN PMEASURE_REPORT_INFO pMeasureReportIE,
- IN UINT8 ReportLnfoLen,
- IN PUINT8 pReportInfo)
+static VOID InsertMeasureReportIE(IN PRTMP_ADAPTER pAd,
+ OUT PUCHAR pFrameBuf,
+ OUT PULONG pFrameLen,
+ IN PMEASURE_REPORT_INFO pMeasureReportIE,
+ IN UINT8 ReportLnfoLen, IN PUINT8 pReportInfo)
{
ULONG TempLen;
ULONG Len;
@@ -1026,19 +1078,15 @@ static VOID InsertMeasureReportIE(
Len = sizeof(MEASURE_REPORT_INFO) + ReportLnfoLen;
- MakeOutgoingFrame(pFrameBuf, &TempLen,
- 1, &ElementID,
- 1, &Len,
- Len, pMeasureReportIE,
- END_OF_ARGS);
+ MakeOutgoingFrame(pFrameBuf, &TempLen,
+ 1, &ElementID,
+ 1, &Len, Len, pMeasureReportIE, END_OF_ARGS);
*pFrameLen = *pFrameLen + TempLen;
- if ((ReportLnfoLen > 0) && (pReportInfo != NULL))
- {
- MakeOutgoingFrame(pFrameBuf + *pFrameLen, &TempLen,
- ReportLnfoLen, pReportInfo,
- END_OF_ARGS);
+ if ((ReportLnfoLen > 0) && (pReportInfo != NULL)) {
+ MakeOutgoingFrame(pFrameBuf + *pFrameLen, &TempLen,
+ ReportLnfoLen, pReportInfo, END_OF_ARGS);
*pFrameLen = *pFrameLen + TempLen;
}
@@ -1057,43 +1105,40 @@ static VOID InsertMeasureReportIE(
Return : None.
==========================================================================
*/
-VOID MakeMeasurementReqFrame(
- IN PRTMP_ADAPTER pAd,
- OUT PUCHAR pOutBuffer,
- OUT PULONG pFrameLen,
- IN UINT8 TotalLen,
- IN UINT8 Category,
- IN UINT8 Action,
- IN UINT8 MeasureToken,
- IN UINT8 MeasureReqMode,
- IN UINT8 MeasureReqType,
- IN UINT8 NumOfRepetitions)
+VOID MakeMeasurementReqFrame(IN PRTMP_ADAPTER pAd,
+ OUT PUCHAR pOutBuffer,
+ OUT PULONG pFrameLen,
+ IN UINT8 TotalLen,
+ IN UINT8 Category,
+ IN UINT8 Action,
+ IN UINT8 MeasureToken,
+ IN UINT8 MeasureReqMode,
+ IN UINT8 MeasureReqType, IN UINT8 NumOfRepetitions)
{
ULONG TempLen;
MEASURE_REQ_INFO MeasureReqIE;
- InsertActField(pAd, (pOutBuffer + *pFrameLen), pFrameLen, Category, Action);
+ InsertActField(pAd, (pOutBuffer + *pFrameLen), pFrameLen, Category,
+ Action);
// fill Dialog Token
- InsertDialogToken(pAd, (pOutBuffer + *pFrameLen), pFrameLen, MeasureToken);
+ InsertDialogToken(pAd, (pOutBuffer + *pFrameLen), pFrameLen,
+ MeasureToken);
/* fill Number of repetitions. */
- if (Category == CATEGORY_RM)
- {
- MakeOutgoingFrame((pOutBuffer+*pFrameLen), &TempLen,
- 2, &NumOfRepetitions,
- END_OF_ARGS);
+ if (Category == CATEGORY_RM) {
+ MakeOutgoingFrame((pOutBuffer + *pFrameLen), &TempLen,
+ 2, &NumOfRepetitions, END_OF_ARGS);
*pFrameLen += TempLen;
}
-
// prepare Measurement IE.
NdisZeroMemory(&MeasureReqIE, sizeof(MEASURE_REQ_INFO));
MeasureReqIE.Token = MeasureToken;
MeasureReqIE.ReqMode.word = MeasureReqMode;
MeasureReqIE.ReqType = MeasureReqType;
- InsertMeasureReqIE(pAd, (pOutBuffer+*pFrameLen), pFrameLen,
- TotalLen, &MeasureReqIE);
+ InsertMeasureReqIE(pAd, (pOutBuffer + *pFrameLen), pFrameLen,
+ TotalLen, &MeasureReqIE);
return;
}
@@ -1110,15 +1155,13 @@ VOID MakeMeasurementReqFrame(
Return : None.
==========================================================================
*/
-VOID EnqueueMeasurementRep(
- IN PRTMP_ADAPTER pAd,
- IN PUCHAR pDA,
- IN UINT8 DialogToken,
- IN UINT8 MeasureToken,
- IN UINT8 MeasureReqMode,
- IN UINT8 MeasureReqType,
- IN UINT8 ReportInfoLen,
- IN PUINT8 pReportInfo)
+VOID EnqueueMeasurementRep(IN PRTMP_ADAPTER pAd,
+ IN PUCHAR pDA,
+ IN UINT8 DialogToken,
+ IN UINT8 MeasureToken,
+ IN UINT8 MeasureReqMode,
+ IN UINT8 MeasureReqType,
+ IN UINT8 ReportInfoLen, IN PUINT8 pReportInfo)
{
PUCHAR pOutBuffer = NULL;
NDIS_STATUS NStatus;
@@ -1128,18 +1171,19 @@ VOID EnqueueMeasurementRep(
// build action frame header.
MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA,
- pAd->CurrentAddress);
+ pAd->CurrentAddress);
- NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory
- if(NStatus != NDIS_STATUS_SUCCESS)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__));
+ NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory
+ if (NStatus != NDIS_STATUS_SUCCESS) {
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("%s() allocate memory failed \n", __func__));
return;
}
- NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11));
+ NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11));
FrameLen = sizeof(HEADER_802_11);
- InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_MRP);
+ InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen,
+ CATEGORY_SPECTRUM, SPEC_MRP);
// fill Dialog Token
InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken);
@@ -1149,7 +1193,8 @@ VOID EnqueueMeasurementRep(
MeasureRepIE.Token = MeasureToken;
MeasureRepIE.ReportMode = MeasureReqMode;
MeasureRepIE.ReportType = MeasureReqType;
- InsertMeasureReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, &MeasureRepIE, ReportInfoLen, pReportInfo);
+ InsertMeasureReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen,
+ &MeasureRepIE, ReportInfoLen, pReportInfo);
MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen);
MlmeFreeMemory(pAd, pOutBuffer);
@@ -1169,10 +1214,7 @@ VOID EnqueueMeasurementRep(
Return : None.
==========================================================================
*/
-VOID EnqueueTPCReq(
- IN PRTMP_ADAPTER pAd,
- IN PUCHAR pDA,
- IN UCHAR DialogToken)
+VOID EnqueueTPCReq(IN PRTMP_ADAPTER pAd, IN PUCHAR pDA, IN UCHAR DialogToken)
{
PUCHAR pOutBuffer = NULL;
NDIS_STATUS NStatus;
@@ -1182,18 +1224,19 @@ VOID EnqueueTPCReq(
// build action frame header.
MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA,
- pAd->CurrentAddress);
+ pAd->CurrentAddress);
- NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory
- if(NStatus != NDIS_STATUS_SUCCESS)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__));
+ NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory
+ if (NStatus != NDIS_STATUS_SUCCESS) {
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("%s() allocate memory failed \n", __func__));
return;
}
- NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11));
+ NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11));
FrameLen = sizeof(HEADER_802_11);
- InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_TPCRQ);
+ InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen,
+ CATEGORY_SPECTRUM, SPEC_TPCRQ);
// fill Dialog Token
InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken);
@@ -1219,12 +1262,9 @@ VOID EnqueueTPCReq(
Return : None.
==========================================================================
*/
-VOID EnqueueTPCRep(
- IN PRTMP_ADAPTER pAd,
- IN PUCHAR pDA,
- IN UINT8 DialogToken,
- IN UINT8 TxPwr,
- IN UINT8 LinkMargin)
+VOID EnqueueTPCRep(IN PRTMP_ADAPTER pAd,
+ IN PUCHAR pDA,
+ IN UINT8 DialogToken, IN UINT8 TxPwr, IN UINT8 LinkMargin)
{
PUCHAR pOutBuffer = NULL;
NDIS_STATUS NStatus;
@@ -1234,24 +1274,26 @@ VOID EnqueueTPCRep(
// build action frame header.
MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA,
- pAd->CurrentAddress);
+ pAd->CurrentAddress);
- NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory
- if(NStatus != NDIS_STATUS_SUCCESS)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__));
+ NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory
+ if (NStatus != NDIS_STATUS_SUCCESS) {
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("%s() allocate memory failed \n", __func__));
return;
}
- NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11));
+ NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11));
FrameLen = sizeof(HEADER_802_11);
- InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_TPCRP);
+ InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen,
+ CATEGORY_SPECTRUM, SPEC_TPCRP);
// fill Dialog Token
InsertDialogToken(pAd, (pOutBuffer + FrameLen), &FrameLen, DialogToken);
// Insert TPC Request IE.
- InsertTpcReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, TxPwr, LinkMargin);
+ InsertTpcReportIE(pAd, (pOutBuffer + FrameLen), &FrameLen, TxPwr,
+ LinkMargin);
MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen);
MlmeFreeMemory(pAd, pOutBuffer);
@@ -1273,11 +1315,8 @@ VOID EnqueueTPCRep(
Return : None.
==========================================================================
*/
-VOID EnqueueChSwAnn(
- IN PRTMP_ADAPTER pAd,
- IN PUCHAR pDA,
- IN UINT8 ChSwMode,
- IN UINT8 NewCh)
+VOID EnqueueChSwAnn(IN PRTMP_ADAPTER pAd,
+ IN PUCHAR pDA, IN UINT8 ChSwMode, IN UINT8 NewCh)
{
PUCHAR pOutBuffer = NULL;
NDIS_STATUS NStatus;
@@ -1287,20 +1326,22 @@ VOID EnqueueChSwAnn(
// build action frame header.
MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pDA,
- pAd->CurrentAddress);
+ pAd->CurrentAddress);
- NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory
- if(NStatus != NDIS_STATUS_SUCCESS)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__));
+ NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory
+ if (NStatus != NDIS_STATUS_SUCCESS) {
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("%s() allocate memory failed \n", __func__));
return;
}
- NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11));
+ NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11));
FrameLen = sizeof(HEADER_802_11);
- InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen, CATEGORY_SPECTRUM, SPEC_CHANNEL_SWITCH);
+ InsertActField(pAd, (pOutBuffer + FrameLen), &FrameLen,
+ CATEGORY_SPECTRUM, SPEC_CHANNEL_SWITCH);
- InsertChSwAnnIE(pAd, (pOutBuffer + FrameLen), &FrameLen, ChSwMode, NewCh, 0);
+ InsertChSwAnnIE(pAd, (pOutBuffer + FrameLen), &FrameLen, ChSwMode,
+ NewCh, 0);
MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen);
MlmeFreeMemory(pAd, pOutBuffer);
@@ -1308,53 +1349,41 @@ VOID EnqueueChSwAnn(
return;
}
-static BOOLEAN DfsRequirementCheck(
- IN PRTMP_ADAPTER pAd,
- IN UINT8 Channel)
+static BOOLEAN DfsRequirementCheck(IN PRTMP_ADAPTER pAd, IN UINT8 Channel)
{
BOOLEAN Result = FALSE;
INT i;
- do
- {
+ do {
// check DFS procedure is running.
// make sure DFS procedure won't start twice.
- if (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)
- {
+ if (pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE) {
Result = FALSE;
break;
}
-
// check the new channel carried from Channel Switch Announcemnet is valid.
- for (i=0; i<pAd->ChannelListNum; i++)
- {
+ for (i = 0; i < pAd->ChannelListNum; i++) {
if ((Channel == pAd->ChannelList[i].Channel)
- &&(pAd->ChannelList[i].RemainingTimeForUse == 0))
- {
+ && (pAd->ChannelList[i].RemainingTimeForUse == 0)) {
// found radar signal in the channel. the channel can't use at least for 30 minutes.
- pAd->ChannelList[i].RemainingTimeForUse = 1800;//30 min = 1800 sec
+ pAd->ChannelList[i].RemainingTimeForUse = 1800; //30 min = 1800 sec
Result = TRUE;
break;
}
}
- } while(FALSE);
+ } while (FALSE);
return Result;
}
-VOID NotifyChSwAnnToPeerAPs(
- IN PRTMP_ADAPTER pAd,
- IN PUCHAR pRA,
- IN PUCHAR pTA,
- IN UINT8 ChSwMode,
- IN UINT8 Channel)
+VOID NotifyChSwAnnToPeerAPs(IN PRTMP_ADAPTER pAd,
+ IN PUCHAR pRA,
+ IN PUCHAR pTA, IN UINT8 ChSwMode, IN UINT8 Channel)
{
}
-static VOID StartDFSProcedure(
- IN PRTMP_ADAPTER pAd,
- IN UCHAR Channel,
- IN UINT8 ChSwMode)
+static VOID StartDFSProcedure(IN PRTMP_ADAPTER pAd,
+ IN UCHAR Channel, IN UINT8 ChSwMode)
{
// start DFS procedure
pAd->CommonCfg.Channel = Channel;
@@ -1375,7 +1404,6 @@ static VOID StartDFSProcedure(
2. message length.
3. Channel switch announcement infomation buffer.
-
Return : None.
==========================================================================
*/
@@ -1387,13 +1415,12 @@ static VOID StartDFSProcedure(
+----+-----+-----------+------------+-----------+
1 1 1 1 1
*/
-static BOOLEAN PeerChSwAnnSanity(
- IN PRTMP_ADAPTER pAd,
- IN VOID *pMsg,
- IN ULONG MsgLen,
- OUT PCH_SW_ANN_INFO pChSwAnnInfo)
+static BOOLEAN PeerChSwAnnSanity(IN PRTMP_ADAPTER pAd,
+ IN VOID * pMsg,
+ IN ULONG MsgLen,
+ OUT PCH_SW_ANN_INFO pChSwAnnInfo)
{
- PFRAME_802_11 Fr = (PFRAME_802_11)pMsg;
+ PFRAME_802_11 Fr = (PFRAME_802_11) pMsg;
PUCHAR pFramePtr = Fr->Octet;
BOOLEAN result = FALSE;
PEID_STRUCT eid_ptr;
@@ -1408,23 +1435,25 @@ static BOOLEAN PeerChSwAnnSanity(
if (pChSwAnnInfo == NULL)
return result;
- eid_ptr = (PEID_STRUCT)pFramePtr;
- while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen))
- {
- switch(eid_ptr->Eid)
- {
- case IE_CHANNEL_SWITCH_ANNOUNCEMENT:
- NdisMoveMemory(&pChSwAnnInfo->ChSwMode, eid_ptr->Octet, 1);
- NdisMoveMemory(&pChSwAnnInfo->Channel, eid_ptr->Octet + 1, 1);
- NdisMoveMemory(&pChSwAnnInfo->ChSwCnt, eid_ptr->Octet + 2, 1);
-
- result = TRUE;
- break;
+ eid_ptr = (PEID_STRUCT) pFramePtr;
+ while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) <
+ ((PUCHAR) pFramePtr + MsgLen)) {
+ switch (eid_ptr->Eid) {
+ case IE_CHANNEL_SWITCH_ANNOUNCEMENT:
+ NdisMoveMemory(&pChSwAnnInfo->ChSwMode, eid_ptr->Octet,
+ 1);
+ NdisMoveMemory(&pChSwAnnInfo->Channel,
+ eid_ptr->Octet + 1, 1);
+ NdisMoveMemory(&pChSwAnnInfo->ChSwCnt,
+ eid_ptr->Octet + 2, 1);
+
+ result = TRUE;
+ break;
- default:
- break;
+ default:
+ break;
}
- eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len);
+ eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len);
}
return result;
@@ -1443,15 +1472,14 @@ static BOOLEAN PeerChSwAnnSanity(
Return : None.
==========================================================================
*/
-static BOOLEAN PeerMeasureReqSanity(
- IN PRTMP_ADAPTER pAd,
- IN VOID *pMsg,
- IN ULONG MsgLen,
- OUT PUINT8 pDialogToken,
- OUT PMEASURE_REQ_INFO pMeasureReqInfo,
- OUT PMEASURE_REQ pMeasureReq)
+static BOOLEAN PeerMeasureReqSanity(IN PRTMP_ADAPTER pAd,
+ IN VOID * pMsg,
+ IN ULONG MsgLen,
+ OUT PUINT8 pDialogToken,
+ OUT PMEASURE_REQ_INFO pMeasureReqInfo,
+ OUT PMEASURE_REQ pMeasureReq)
{
- PFRAME_802_11 Fr = (PFRAME_802_11)pMsg;
+ PFRAME_802_11 Fr = (PFRAME_802_11) pMsg;
PUCHAR pFramePtr = Fr->Octet;
BOOLEAN result = FALSE;
PEID_STRUCT eid_ptr;
@@ -1473,29 +1501,32 @@ static BOOLEAN PeerMeasureReqSanity(
pFramePtr += 1;
MsgLen -= 1;
- eid_ptr = (PEID_STRUCT)pFramePtr;
- while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen))
- {
- switch(eid_ptr->Eid)
- {
- case IE_MEASUREMENT_REQUEST:
- NdisMoveMemory(&pMeasureReqInfo->Token, eid_ptr->Octet, 1);
- NdisMoveMemory(&pMeasureReqInfo->ReqMode.word, eid_ptr->Octet + 1, 1);
- NdisMoveMemory(&pMeasureReqInfo->ReqType, eid_ptr->Octet + 2, 1);
- ptr = (PUCHAR)(eid_ptr->Octet + 3);
- NdisMoveMemory(&pMeasureReq->ChNum, ptr, 1);
- NdisMoveMemory(&MeasureStartTime, ptr + 1, 8);
- pMeasureReq->MeasureStartTime = SWAP64(MeasureStartTime);
- NdisMoveMemory(&MeasureDuration, ptr + 9, 2);
- pMeasureReq->MeasureDuration = SWAP16(MeasureDuration);
-
- result = TRUE;
- break;
+ eid_ptr = (PEID_STRUCT) pFramePtr;
+ while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) <
+ ((PUCHAR) pFramePtr + MsgLen)) {
+ switch (eid_ptr->Eid) {
+ case IE_MEASUREMENT_REQUEST:
+ NdisMoveMemory(&pMeasureReqInfo->Token, eid_ptr->Octet,
+ 1);
+ NdisMoveMemory(&pMeasureReqInfo->ReqMode.word,
+ eid_ptr->Octet + 1, 1);
+ NdisMoveMemory(&pMeasureReqInfo->ReqType,
+ eid_ptr->Octet + 2, 1);
+ ptr = (PUCHAR) (eid_ptr->Octet + 3);
+ NdisMoveMemory(&pMeasureReq->ChNum, ptr, 1);
+ NdisMoveMemory(&MeasureStartTime, ptr + 1, 8);
+ pMeasureReq->MeasureStartTime =
+ SWAP64(MeasureStartTime);
+ NdisMoveMemory(&MeasureDuration, ptr + 9, 2);
+ pMeasureReq->MeasureDuration = SWAP16(MeasureDuration);
+
+ result = TRUE;
+ break;
- default:
- break;
+ default:
+ break;
}
- eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len);
+ eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len);
}
return result;
@@ -1535,15 +1566,15 @@ static BOOLEAN PeerMeasureReqSanity(
+-----+---------------+---------------------+-------+------------+----------+
0 1 2 3 4 5-7
*/
-static BOOLEAN PeerMeasureReportSanity(
- IN PRTMP_ADAPTER pAd,
- IN VOID *pMsg,
- IN ULONG MsgLen,
- OUT PUINT8 pDialogToken,
- OUT PMEASURE_REPORT_INFO pMeasureReportInfo,
- OUT PUINT8 pReportBuf)
+static BOOLEAN PeerMeasureReportSanity(IN PRTMP_ADAPTER pAd,
+ IN VOID * pMsg,
+ IN ULONG MsgLen,
+ OUT PUINT8 pDialogToken,
+ OUT PMEASURE_REPORT_INFO
+ pMeasureReportInfo,
+ OUT PUINT8 pReportBuf)
{
- PFRAME_802_11 Fr = (PFRAME_802_11)pMsg;
+ PFRAME_802_11 Fr = (PFRAME_802_11) pMsg;
PUCHAR pFramePtr = Fr->Octet;
BOOLEAN result = FALSE;
PEID_STRUCT eid_ptr;
@@ -1563,51 +1594,60 @@ static BOOLEAN PeerMeasureReportSanity(
pFramePtr += 1;
MsgLen -= 1;
- eid_ptr = (PEID_STRUCT)pFramePtr;
- while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen))
- {
- switch(eid_ptr->Eid)
- {
- case IE_MEASUREMENT_REPORT:
- NdisMoveMemory(&pMeasureReportInfo->Token, eid_ptr->Octet, 1);
- NdisMoveMemory(&pMeasureReportInfo->ReportMode, eid_ptr->Octet + 1, 1);
- NdisMoveMemory(&pMeasureReportInfo->ReportType, eid_ptr->Octet + 2, 1);
- if (pMeasureReportInfo->ReportType == RM_BASIC)
- {
- PMEASURE_BASIC_REPORT pReport = (PMEASURE_BASIC_REPORT)pReportBuf;
- ptr = (PUCHAR)(eid_ptr->Octet + 3);
- NdisMoveMemory(&pReport->ChNum, ptr, 1);
- NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8);
- NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2);
- NdisMoveMemory(&pReport->Map, ptr + 11, 1);
-
- }
- else if (pMeasureReportInfo->ReportType == RM_CCA)
- {
- PMEASURE_CCA_REPORT pReport = (PMEASURE_CCA_REPORT)pReportBuf;
- ptr = (PUCHAR)(eid_ptr->Octet + 3);
- NdisMoveMemory(&pReport->ChNum, ptr, 1);
- NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8);
- NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2);
- NdisMoveMemory(&pReport->CCA_Busy_Fraction, ptr + 11, 1);
-
- }
- else if (pMeasureReportInfo->ReportType == RM_RPI_HISTOGRAM)
- {
- PMEASURE_RPI_REPORT pReport = (PMEASURE_RPI_REPORT)pReportBuf;
- ptr = (PUCHAR)(eid_ptr->Octet + 3);
- NdisMoveMemory(&pReport->ChNum, ptr, 1);
- NdisMoveMemory(&pReport->MeasureStartTime, ptr + 1, 8);
- NdisMoveMemory(&pReport->MeasureDuration, ptr + 9, 2);
- NdisMoveMemory(&pReport->RPI_Density, ptr + 11, 8);
- }
- result = TRUE;
- break;
+ eid_ptr = (PEID_STRUCT) pFramePtr;
+ while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) <
+ ((PUCHAR) pFramePtr + MsgLen)) {
+ switch (eid_ptr->Eid) {
+ case IE_MEASUREMENT_REPORT:
+ NdisMoveMemory(&pMeasureReportInfo->Token,
+ eid_ptr->Octet, 1);
+ NdisMoveMemory(&pMeasureReportInfo->ReportMode,
+ eid_ptr->Octet + 1, 1);
+ NdisMoveMemory(&pMeasureReportInfo->ReportType,
+ eid_ptr->Octet + 2, 1);
+ if (pMeasureReportInfo->ReportType == RM_BASIC) {
+ PMEASURE_BASIC_REPORT pReport =
+ (PMEASURE_BASIC_REPORT) pReportBuf;
+ ptr = (PUCHAR) (eid_ptr->Octet + 3);
+ NdisMoveMemory(&pReport->ChNum, ptr, 1);
+ NdisMoveMemory(&pReport->MeasureStartTime,
+ ptr + 1, 8);
+ NdisMoveMemory(&pReport->MeasureDuration,
+ ptr + 9, 2);
+ NdisMoveMemory(&pReport->Map, ptr + 11, 1);
+
+ } else if (pMeasureReportInfo->ReportType == RM_CCA) {
+ PMEASURE_CCA_REPORT pReport =
+ (PMEASURE_CCA_REPORT) pReportBuf;
+ ptr = (PUCHAR) (eid_ptr->Octet + 3);
+ NdisMoveMemory(&pReport->ChNum, ptr, 1);
+ NdisMoveMemory(&pReport->MeasureStartTime,
+ ptr + 1, 8);
+ NdisMoveMemory(&pReport->MeasureDuration,
+ ptr + 9, 2);
+ NdisMoveMemory(&pReport->CCA_Busy_Fraction,
+ ptr + 11, 1);
+
+ } else if (pMeasureReportInfo->ReportType ==
+ RM_RPI_HISTOGRAM) {
+ PMEASURE_RPI_REPORT pReport =
+ (PMEASURE_RPI_REPORT) pReportBuf;
+ ptr = (PUCHAR) (eid_ptr->Octet + 3);
+ NdisMoveMemory(&pReport->ChNum, ptr, 1);
+ NdisMoveMemory(&pReport->MeasureStartTime,
+ ptr + 1, 8);
+ NdisMoveMemory(&pReport->MeasureDuration,
+ ptr + 9, 2);
+ NdisMoveMemory(&pReport->RPI_Density, ptr + 11,
+ 8);
+ }
+ result = TRUE;
+ break;
- default:
- break;
+ default:
+ break;
}
- eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len);
+ eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len);
}
return result;
@@ -1626,13 +1666,11 @@ static BOOLEAN PeerMeasureReportSanity(
Return : None.
==========================================================================
*/
-static BOOLEAN PeerTpcReqSanity(
- IN PRTMP_ADAPTER pAd,
- IN VOID *pMsg,
- IN ULONG MsgLen,
- OUT PUINT8 pDialogToken)
+static BOOLEAN PeerTpcReqSanity(IN PRTMP_ADAPTER pAd,
+ IN VOID * pMsg,
+ IN ULONG MsgLen, OUT PUINT8 pDialogToken)
{
- PFRAME_802_11 Fr = (PFRAME_802_11)pMsg;
+ PFRAME_802_11 Fr = (PFRAME_802_11) pMsg;
PUCHAR pFramePtr = Fr->Octet;
BOOLEAN result = FALSE;
PEID_STRUCT eid_ptr;
@@ -1650,19 +1688,18 @@ static BOOLEAN PeerTpcReqSanity(
pFramePtr += 1;
MsgLen -= 1;
- eid_ptr = (PEID_STRUCT)pFramePtr;
- while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen))
- {
- switch(eid_ptr->Eid)
- {
- case IE_TPC_REQUEST:
- result = TRUE;
- break;
+ eid_ptr = (PEID_STRUCT) pFramePtr;
+ while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) <
+ ((PUCHAR) pFramePtr + MsgLen)) {
+ switch (eid_ptr->Eid) {
+ case IE_TPC_REQUEST:
+ result = TRUE;
+ break;
- default:
- break;
+ default:
+ break;
}
- eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len);
+ eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len);
}
return result;
@@ -1682,14 +1719,13 @@ static BOOLEAN PeerTpcReqSanity(
Return : None.
==========================================================================
*/
-static BOOLEAN PeerTpcRepSanity(
- IN PRTMP_ADAPTER pAd,
- IN VOID *pMsg,
- IN ULONG MsgLen,
- OUT PUINT8 pDialogToken,
- OUT PTPC_REPORT_INFO pTpcRepInfo)
+static BOOLEAN PeerTpcRepSanity(IN PRTMP_ADAPTER pAd,
+ IN VOID * pMsg,
+ IN ULONG MsgLen,
+ OUT PUINT8 pDialogToken,
+ OUT PTPC_REPORT_INFO pTpcRepInfo)
{
- PFRAME_802_11 Fr = (PFRAME_802_11)pMsg;
+ PFRAME_802_11 Fr = (PFRAME_802_11) pMsg;
PUCHAR pFramePtr = Fr->Octet;
BOOLEAN result = FALSE;
PEID_STRUCT eid_ptr;
@@ -1707,21 +1743,21 @@ static BOOLEAN PeerTpcRepSanity(
pFramePtr += 1;
MsgLen -= 1;
- eid_ptr = (PEID_STRUCT)pFramePtr;
- while (((UCHAR*)eid_ptr + eid_ptr->Len + 1) < ((PUCHAR)pFramePtr + MsgLen))
- {
- switch(eid_ptr->Eid)
- {
- case IE_TPC_REPORT:
- NdisMoveMemory(&pTpcRepInfo->TxPwr, eid_ptr->Octet, 1);
- NdisMoveMemory(&pTpcRepInfo->LinkMargin, eid_ptr->Octet + 1, 1);
- result = TRUE;
- break;
-
- default:
- break;
+ eid_ptr = (PEID_STRUCT) pFramePtr;
+ while (((UCHAR *) eid_ptr + eid_ptr->Len + 1) <
+ ((PUCHAR) pFramePtr + MsgLen)) {
+ switch (eid_ptr->Eid) {
+ case IE_TPC_REPORT:
+ NdisMoveMemory(&pTpcRepInfo->TxPwr, eid_ptr->Octet, 1);
+ NdisMoveMemory(&pTpcRepInfo->LinkMargin,
+ eid_ptr->Octet + 1, 1);
+ result = TRUE;
+ break;
+
+ default:
+ break;
}
- eid_ptr = (PEID_STRUCT)((UCHAR*)eid_ptr + 2 + eid_ptr->Len);
+ eid_ptr = (PEID_STRUCT) ((UCHAR *) eid_ptr + 2 + eid_ptr->Len);
}
return result;
@@ -1738,64 +1774,69 @@ static BOOLEAN PeerTpcRepSanity(
Return : None.
==========================================================================
*/
-static VOID PeerChSwAnnAction(
- IN PRTMP_ADAPTER pAd,
- IN MLME_QUEUE_ELEM *Elem)
+static VOID PeerChSwAnnAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
{
CH_SW_ANN_INFO ChSwAnnInfo;
- PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg;
+ PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg;
UCHAR index = 0, Channel = 0, NewChannel = 0;
ULONG Bssidx = 0;
NdisZeroMemory(&ChSwAnnInfo, sizeof(CH_SW_ANN_INFO));
- if (! PeerChSwAnnSanity(pAd, Elem->Msg, Elem->MsgLen, &ChSwAnnInfo))
- {
- DBGPRINT(RT_DEBUG_TRACE, ("Invalid Channel Switch Action Frame.\n"));
+ if (!PeerChSwAnnSanity(pAd, Elem->Msg, Elem->MsgLen, &ChSwAnnInfo)) {
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("Invalid Channel Switch Action Frame.\n"));
return;
}
- if (pAd->OpMode == OPMODE_STA)
- {
- Bssidx = BssTableSearch(&pAd->ScanTab, pFr->Hdr.Addr3, pAd->CommonCfg.Channel);
- if (Bssidx == BSS_NOT_FOUND)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("PeerChSwAnnAction - Bssidx is not found\n"));
+ if (pAd->OpMode == OPMODE_STA) {
+ Bssidx =
+ BssTableSearch(&pAd->ScanTab, pFr->Hdr.Addr3,
+ pAd->CommonCfg.Channel);
+ if (Bssidx == BSS_NOT_FOUND) {
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("PeerChSwAnnAction - Bssidx is not found\n"));
return;
}
- DBGPRINT(RT_DEBUG_TRACE, ("\n****Bssidx is %d, Channel = %d\n", index, pAd->ScanTab.BssEntry[Bssidx].Channel));
- hex_dump("SSID",pAd->ScanTab.BssEntry[Bssidx].Bssid ,6);
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("\n****Bssidx is %d, Channel = %d\n", index,
+ pAd->ScanTab.BssEntry[Bssidx].Channel));
+ hex_dump("SSID", pAd->ScanTab.BssEntry[Bssidx].Bssid, 6);
Channel = pAd->CommonCfg.Channel;
NewChannel = ChSwAnnInfo.Channel;
- if ((pAd->CommonCfg.bIEEE80211H == 1) && (NewChannel != 0) && (Channel != NewChannel))
- {
+ if ((pAd->CommonCfg.bIEEE80211H == 1) && (NewChannel != 0)
+ && (Channel != NewChannel)) {
// Switching to channel 1 can prevent from rescanning the current channel immediately (by auto reconnection).
// In addition, clear the MLME queue and the scan table to discard the RX packets and previous scanning results.
AsicSwitchChannel(pAd, 1, FALSE);
AsicLockChannel(pAd, 1);
- LinkDown(pAd, FALSE);
+ LinkDown(pAd, FALSE);
MlmeQueueInit(&pAd->Mlme.Queue);
BssTableInit(&pAd->ScanTab);
- RTMPusecDelay(1000000); // use delay to prevent STA do reassoc
+ RTMPusecDelay(1000000); // use delay to prevent STA do reassoc
// channel sanity check
- for (index = 0 ; index < pAd->ChannelListNum; index++)
- {
- if (pAd->ChannelList[index].Channel == NewChannel)
- {
- pAd->ScanTab.BssEntry[Bssidx].Channel = NewChannel;
+ for (index = 0; index < pAd->ChannelListNum; index++) {
+ if (pAd->ChannelList[index].Channel ==
+ NewChannel) {
+ pAd->ScanTab.BssEntry[Bssidx].Channel =
+ NewChannel;
pAd->CommonCfg.Channel = NewChannel;
- AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
- AsicLockChannel(pAd, pAd->CommonCfg.Channel);
- DBGPRINT(RT_DEBUG_TRACE, ("&&&&&&&&&&&&&&&&PeerChSwAnnAction - STA receive channel switch announcement IE (New Channel =%d)\n", NewChannel));
+ AsicSwitchChannel(pAd,
+ pAd->CommonCfg.
+ Channel, FALSE);
+ AsicLockChannel(pAd,
+ pAd->CommonCfg.Channel);
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("&&&&&&&&&&&&&&&&PeerChSwAnnAction - STA receive channel switch announcement IE (New Channel =%d)\n",
+ NewChannel));
break;
}
}
- if (index >= pAd->ChannelListNum)
- {
+ if (index >= pAd->ChannelListNum) {
DBGPRINT_ERR(("&&&&&&&&&&&&&&&&&&&&&&&&&&PeerChSwAnnAction(can not find New Channel=%d in ChannelList[%d]\n", pAd->CommonCfg.Channel, pAd->ChannelListNum));
}
}
@@ -1804,7 +1845,6 @@ static VOID PeerChSwAnnAction(
return;
}
-
/*
==========================================================================
Description:
@@ -1816,21 +1856,23 @@ static VOID PeerChSwAnnAction(
Return : None.
==========================================================================
*/
-static VOID PeerMeasureReqAction(
- IN PRTMP_ADAPTER pAd,
- IN MLME_QUEUE_ELEM *Elem)
+static VOID PeerMeasureReqAction(IN PRTMP_ADAPTER pAd,
+ IN MLME_QUEUE_ELEM * Elem)
{
- PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg;
+ PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg;
UINT8 DialogToken;
MEASURE_REQ_INFO MeasureReqInfo;
- MEASURE_REQ MeasureReq;
+ MEASURE_REQ MeasureReq;
MEASURE_REPORT_MODE ReportMode;
- if(PeerMeasureReqSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReqInfo, &MeasureReq))
- {
+ if (PeerMeasureReqSanity
+ (pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReqInfo,
+ &MeasureReq)) {
ReportMode.word = 0;
ReportMode.field.Incapable = 1;
- EnqueueMeasurementRep(pAd, pFr->Hdr.Addr2, DialogToken, MeasureReqInfo.Token, ReportMode.word, MeasureReqInfo.ReqType, 0, NULL);
+ EnqueueMeasurementRep(pAd, pFr->Hdr.Addr2, DialogToken,
+ MeasureReqInfo.Token, ReportMode.word,
+ MeasureReqInfo.ReqType, 0, NULL);
}
return;
@@ -1847,54 +1889,65 @@ static VOID PeerMeasureReqAction(
Return : None.
==========================================================================
*/
-static VOID PeerMeasureReportAction(
- IN PRTMP_ADAPTER pAd,
- IN MLME_QUEUE_ELEM *Elem)
+static VOID PeerMeasureReportAction(IN PRTMP_ADAPTER pAd,
+ IN MLME_QUEUE_ELEM * Elem)
{
MEASURE_REPORT_INFO MeasureReportInfo;
- PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg;
+ PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg;
UINT8 DialogToken;
PUINT8 pMeasureReportInfo;
-// if (pAd->CommonCfg.bIEEE80211H != TRUE)
-// return;
+// if (pAd->CommonCfg.bIEEE80211H != TRUE)
+// return;
- if ((pMeasureReportInfo = kmalloc(sizeof(MEASURE_RPI_REPORT), GFP_ATOMIC)) == NULL)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s unable to alloc memory for measure report buffer (size=%zu).\n", __func__, sizeof(MEASURE_RPI_REPORT)));
+ if ((pMeasureReportInfo =
+ kmalloc(sizeof(MEASURE_RPI_REPORT), GFP_ATOMIC)) == NULL) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s unable to alloc memory for measure report buffer (size=%zu).\n",
+ __func__, sizeof(MEASURE_RPI_REPORT)));
return;
}
NdisZeroMemory(&MeasureReportInfo, sizeof(MEASURE_REPORT_INFO));
NdisZeroMemory(pMeasureReportInfo, sizeof(MEASURE_RPI_REPORT));
- if (PeerMeasureReportSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReportInfo, pMeasureReportInfo))
- {
+ if (PeerMeasureReportSanity
+ (pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &MeasureReportInfo,
+ pMeasureReportInfo)) {
do {
PMEASURE_REQ_ENTRY pEntry = NULL;
// Not a autonomous measure report.
// check the dialog token field. drop it if the dialog token doesn't match.
if ((DialogToken != 0)
- && ((pEntry = MeasureReqLookUp(pAd, DialogToken)) == NULL))
+ && ((pEntry = MeasureReqLookUp(pAd, DialogToken)) ==
+ NULL))
break;
if (pEntry != NULL)
MeasureReqDelete(pAd, pEntry->DialogToken);
- if (MeasureReportInfo.ReportType == RM_BASIC)
- {
- PMEASURE_BASIC_REPORT pBasicReport = (PMEASURE_BASIC_REPORT)pMeasureReportInfo;
+ if (MeasureReportInfo.ReportType == RM_BASIC) {
+ PMEASURE_BASIC_REPORT pBasicReport =
+ (PMEASURE_BASIC_REPORT) pMeasureReportInfo;
if ((pBasicReport->Map.field.Radar)
- && (DfsRequirementCheck(pAd, pBasicReport->ChNum) == TRUE))
- {
- NotifyChSwAnnToPeerAPs(pAd, pFr->Hdr.Addr1, pFr->Hdr.Addr2, 1, pBasicReport->ChNum);
- StartDFSProcedure(pAd, pBasicReport->ChNum, 1);
+ &&
+ (DfsRequirementCheck
+ (pAd, pBasicReport->ChNum) == TRUE)) {
+ NotifyChSwAnnToPeerAPs(pAd,
+ pFr->Hdr.Addr1,
+ pFr->Hdr.Addr2,
+ 1,
+ pBasicReport->
+ ChNum);
+ StartDFSProcedure(pAd,
+ pBasicReport->ChNum,
+ 1);
}
}
} while (FALSE);
- }
- else
- DBGPRINT(RT_DEBUG_TRACE, ("Invalid Measurement Report Frame.\n"));
+ } else
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("Invalid Measurement Report Frame.\n"));
kfree(pMeasureReportInfo);
@@ -1912,11 +1965,9 @@ static VOID PeerMeasureReportAction(
Return : None.
==========================================================================
*/
-static VOID PeerTpcReqAction(
- IN PRTMP_ADAPTER pAd,
- IN MLME_QUEUE_ELEM *Elem)
+static VOID PeerTpcReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
{
- PFRAME_802_11 pFr = (PFRAME_802_11)Elem->Msg;
+ PFRAME_802_11 pFr = (PFRAME_802_11) Elem->Msg;
PUCHAR pFramePtr = pFr->Octet;
UINT8 DialogToken;
UINT8 TxPwr = GetCurTxPwr(pAd, Elem->Wcid);
@@ -1924,12 +1975,12 @@ static VOID PeerTpcReqAction(
CHAR RealRssi;
// link margin: Ratio of the received signal power to the minimum desired by the station (STA). The
- // STA may incorporate rate information and channel conditions, including interference, into its computation
- // of link margin.
+ // STA may incorporate rate information and channel conditions, including interference, into its computation
+ // of link margin.
RealRssi = RTMPMaxRssi(pAd, ConvertToRssi(pAd, Elem->Rssi0, RSSI_0),
- ConvertToRssi(pAd, Elem->Rssi1, RSSI_1),
- ConvertToRssi(pAd, Elem->Rssi2, RSSI_2));
+ ConvertToRssi(pAd, Elem->Rssi1, RSSI_1),
+ ConvertToRssi(pAd, Elem->Rssi2, RSSI_2));
// skip Category and action code.
pFramePtr += 2;
@@ -1939,7 +1990,8 @@ static VOID PeerTpcReqAction(
LinkMargin = (RealRssi / MIN_RCV_PWR);
if (PeerTpcReqSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken))
- EnqueueTPCRep(pAd, pFr->Hdr.Addr2, DialogToken, TxPwr, LinkMargin);
+ EnqueueTPCRep(pAd, pFr->Hdr.Addr2, DialogToken, TxPwr,
+ LinkMargin);
return;
}
@@ -1955,22 +2007,21 @@ static VOID PeerTpcReqAction(
Return : None.
==========================================================================
*/
-static VOID PeerTpcRepAction(
- IN PRTMP_ADAPTER pAd,
- IN MLME_QUEUE_ELEM *Elem)
+static VOID PeerTpcRepAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
{
UINT8 DialogToken;
TPC_REPORT_INFO TpcRepInfo;
PTPC_REQ_ENTRY pEntry = NULL;
NdisZeroMemory(&TpcRepInfo, sizeof(TPC_REPORT_INFO));
- if (PeerTpcRepSanity(pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &TpcRepInfo))
- {
- if ((pEntry = TpcReqLookUp(pAd, DialogToken)) != NULL)
- {
+ if (PeerTpcRepSanity
+ (pAd, Elem->Msg, Elem->MsgLen, &DialogToken, &TpcRepInfo)) {
+ if ((pEntry = TpcReqLookUp(pAd, DialogToken)) != NULL) {
TpcReqDelete(pAd, pEntry->DialogToken);
- DBGPRINT(RT_DEBUG_TRACE, ("%s: DialogToken=%x, TxPwr=%d, LinkMargin=%d\n",
- __func__, DialogToken, TpcRepInfo.TxPwr, TpcRepInfo.LinkMargin));
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("%s: DialogToken=%x, TxPwr=%d, LinkMargin=%d\n",
+ __func__, DialogToken, TpcRepInfo.TxPwr,
+ TpcRepInfo.LinkMargin));
}
}
@@ -1989,41 +2040,37 @@ static VOID PeerTpcRepAction(
Return : None.
==========================================================================
*/
-VOID PeerSpectrumAction(
- IN PRTMP_ADAPTER pAd,
- IN MLME_QUEUE_ELEM *Elem)
+VOID PeerSpectrumAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
{
- UCHAR Action = Elem->Msg[LENGTH_802_11+1];
+ UCHAR Action = Elem->Msg[LENGTH_802_11 + 1];
if (pAd->CommonCfg.bIEEE80211H != TRUE)
return;
- switch(Action)
- {
- case SPEC_MRQ:
- // current rt2860 unable do such measure specified in Measurement Request.
- // reject all measurement request.
- PeerMeasureReqAction(pAd, Elem);
- break;
+ switch (Action) {
+ case SPEC_MRQ:
+ // current rt2860 unable do such measure specified in Measurement Request.
+ // reject all measurement request.
+ PeerMeasureReqAction(pAd, Elem);
+ break;
- case SPEC_MRP:
- PeerMeasureReportAction(pAd, Elem);
- break;
+ case SPEC_MRP:
+ PeerMeasureReportAction(pAd, Elem);
+ break;
- case SPEC_TPCRQ:
- PeerTpcReqAction(pAd, Elem);
- break;
+ case SPEC_TPCRQ:
+ PeerTpcReqAction(pAd, Elem);
+ break;
- case SPEC_TPCRP:
- PeerTpcRepAction(pAd, Elem);
- break;
+ case SPEC_TPCRP:
+ PeerTpcRepAction(pAd, Elem);
+ break;
- case SPEC_CHANNEL_SWITCH:
+ case SPEC_CHANNEL_SWITCH:
-
- PeerChSwAnnAction(pAd, Elem);
- break;
+ PeerChSwAnnAction(pAd, Elem);
+ break;
}
return;
@@ -2038,9 +2085,7 @@ VOID PeerSpectrumAction(
Return : None.
==========================================================================
*/
-INT Set_MeasureReq_Proc(
- IN PRTMP_ADAPTER pAd,
- IN PSTRING arg)
+INT Set_MeasureReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg)
{
UINT Aid = 1;
UINT ArgIdx;
@@ -2059,42 +2104,43 @@ INT Set_MeasureReq_Proc(
NDIS_STATUS NStatus;
ULONG FrameLen;
- NStatus = MlmeAllocateMemory(pAd, (PVOID)&pOutBuffer); //Get an unused nonpaged memory
- if(NStatus != NDIS_STATUS_SUCCESS)
- {
- DBGPRINT(RT_DEBUG_TRACE, ("%s() allocate memory failed \n", __func__));
+ NStatus = MlmeAllocateMemory(pAd, (PVOID) & pOutBuffer); //Get an unused nonpaged memory
+ if (NStatus != NDIS_STATUS_SUCCESS) {
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("%s() allocate memory failed \n", __func__));
goto END_OF_MEASURE_REQ;
}
ArgIdx = 1;
- while ((thisChar = strsep((char **)&arg, "-")) != NULL)
- {
- switch(ArgIdx)
- {
- case 1: // Aid.
- Aid = (UINT8) simple_strtol(thisChar, 0, 16);
- break;
+ while ((thisChar = strsep((char **)&arg, "-")) != NULL) {
+ switch (ArgIdx) {
+ case 1: // Aid.
+ Aid = (UINT8) simple_strtol(thisChar, 0, 16);
+ break;
- case 2: // Measurement Request Type.
- MeasureReqType = simple_strtol(thisChar, 0, 16);
- if (MeasureReqType > 3)
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s: unknow MeasureReqType(%d)\n", __func__, MeasureReqType));
- goto END_OF_MEASURE_REQ;
- }
- break;
+ case 2: // Measurement Request Type.
+ MeasureReqType = simple_strtol(thisChar, 0, 16);
+ if (MeasureReqType > 3) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: unknow MeasureReqType(%d)\n",
+ __func__, MeasureReqType));
+ goto END_OF_MEASURE_REQ;
+ }
+ break;
- case 3: // Measurement channel.
- MeasureCh = (UINT8) simple_strtol(thisChar, 0, 16);
- break;
+ case 3: // Measurement channel.
+ MeasureCh = (UINT8) simple_strtol(thisChar, 0, 16);
+ break;
}
ArgIdx++;
}
- DBGPRINT(RT_DEBUG_TRACE, ("%s::Aid = %d, MeasureReqType=%d MeasureCh=%d\n", __func__, Aid, MeasureReqType, MeasureCh));
- if (!VALID_WCID(Aid))
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s: unknow sta of Aid(%d)\n", __func__, Aid));
+ DBGPRINT(RT_DEBUG_TRACE,
+ ("%s::Aid = %d, MeasureReqType=%d MeasureCh=%d\n", __func__,
+ Aid, MeasureReqType, MeasureCh));
+ if (!VALID_WCID(Aid)) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: unknow sta of Aid(%d)\n", __func__, Aid));
goto END_OF_MEASURE_REQ;
}
@@ -2104,18 +2150,18 @@ INT Set_MeasureReq_Proc(
MeasureReqInsert(pAd, MeasureReqToken);
// build action frame header.
- MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0, pAd->MacTab.Content[Aid].Addr,
- pAd->CurrentAddress);
+ MgtMacHeaderInit(pAd, &ActHdr, SUBTYPE_ACTION, 0,
+ pAd->MacTab.Content[Aid].Addr, pAd->CurrentAddress);
- NdisMoveMemory(pOutBuffer, (PCHAR)&ActHdr, sizeof(HEADER_802_11));
+ NdisMoveMemory(pOutBuffer, (PCHAR) & ActHdr, sizeof(HEADER_802_11));
FrameLen = sizeof(HEADER_802_11);
TotalLen = sizeof(MEASURE_REQ_INFO) + sizeof(MEASURE_REQ);
MakeMeasurementReqFrame(pAd, pOutBuffer, &FrameLen,
- sizeof(MEASURE_REQ_INFO), CATEGORY_RM, RM_BASIC,
- MeasureReqToken, MeasureReqMode.word,
- MeasureReqType, 0);
+ sizeof(MEASURE_REQ_INFO), CATEGORY_RM, RM_BASIC,
+ MeasureReqToken, MeasureReqMode.word,
+ MeasureReqType, 0);
MeasureReq.ChNum = MeasureCh;
MeasureReq.MeasureStartTime = cpu2le64(MeasureStartTime);
@@ -2123,13 +2169,13 @@ INT Set_MeasureReq_Proc(
{
ULONG TempLen;
- MakeOutgoingFrame( pOutBuffer+FrameLen, &TempLen,
- sizeof(MEASURE_REQ), &MeasureReq,
- END_OF_ARGS);
+ MakeOutgoingFrame(pOutBuffer + FrameLen, &TempLen,
+ sizeof(MEASURE_REQ), &MeasureReq,
+ END_OF_ARGS);
FrameLen += TempLen;
}
- MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, (UINT)FrameLen);
+ MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, (UINT) FrameLen);
END_OF_MEASURE_REQ:
MlmeFreeMemory(pAd, pOutBuffer);
@@ -2137,9 +2183,7 @@ END_OF_MEASURE_REQ:
return TRUE;
}
-INT Set_TpcReq_Proc(
- IN PRTMP_ADAPTER pAd,
- IN PSTRING arg)
+INT Set_TpcReq_Proc(IN PRTMP_ADAPTER pAd, IN PSTRING arg)
{
UINT Aid;
@@ -2148,9 +2192,9 @@ INT Set_TpcReq_Proc(
Aid = (UINT) simple_strtol(arg, 0, 16);
DBGPRINT(RT_DEBUG_TRACE, ("%s::Aid = %d\n", __func__, Aid));
- if (!VALID_WCID(Aid))
- {
- DBGPRINT(RT_DEBUG_ERROR, ("%s: unknow sta of Aid(%d)\n", __func__, Aid));
+ if (!VALID_WCID(Aid)) {
+ DBGPRINT(RT_DEBUG_ERROR,
+ ("%s: unknow sta of Aid(%d)\n", __func__, Aid));
return TRUE;
}
@@ -2160,4 +2204,3 @@ INT Set_TpcReq_Proc(
return TRUE;
}
-