2018-06-24 09:59:08

by John Whitmore

[permalink] [raw]
Subject: V2 Coding style changes. Plus one change to use memset()

Simple coding style changes to single file
drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c

Given feedback on some of the comments, I truncated to the 80 character limit,
in code, (as opposed to function block comments). I have left a number of the
contentious comments as they are.

Another piece of feedback suggested using memset() instead of a loop to
initialise memory so I've added that change to the set.

I tried to respond to issues raised on the mailing list in the gmail web gui,
rather then in mutt. That was not a good idea and I don't think my comms got
through to the list. I know for future no web gmail.




2018-06-24 09:59:27

by John Whitmore

[permalink] [raw]
Subject: [PATCH v2 8/8] staging: rtl8192u: Correction of spelling mistake in comment.

Simple spelling correction.

Signed-off-by: John Whitmore <[email protected]>
---
drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 2643312625dd..e3b0403194a8 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -866,7 +866,7 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 *pSupportMCS,
/*
* TODO: fill suggested rate adaptive rate index and give firmware info
* using Tx command packet we also shall suggested the first start rate
- * set according to our singal strength
+ * set according to our signal strength
*/
HT_PickMCSRate(ieee, pOperateMCS);

--
2.17.1


2018-06-24 09:59:54

by John Whitmore

[permalink] [raw]
Subject: [PATCH v2 5/8] staging: rtl8192u: Use %s and __func__ instead of hardcoded string - Style

Changed a number of hard coded function names to use %s and __func__

Mailing list response suggest that there is a better method for debugging
using netdev_dbg(). I can't argue with that, but for the moment this change
will clear the checkpatch.pl Warning.

Signed-off-by: John Whitmore <[email protected]>
---
drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 604b393d856f..742d2202652f 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -534,7 +534,7 @@ void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u
//u8 bIsDeclareMCS13;

if (!posHTCap || !pHT) {
- IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTCap or pHTInfo can't be null in HTConstructCapabilityElement()\n");
+ IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTCap or pHTInfo can't be null in %s\n", __func__);
return;
}
memset(posHTCap, 0, *len);
@@ -646,7 +646,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *le
PHT_INFORMATION_ELE pHTInfoEle = (PHT_INFORMATION_ELE)posHTInfo;

if (!posHTInfo || !pHTInfoEle) {
- IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTInfo or pHTInfoEle can't be null in HTConstructInfoElement()\n");
+ IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTInfo or pHTInfoEle can't be null in %s\n", __func__);
return;
}

@@ -710,7 +710,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *le
void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg, u8 *len)
{
if (!posRT2RTAgg) {
- IEEE80211_DEBUG(IEEE80211_DL_ERR, "posRT2RTAgg can't be null in HTConstructRT2RTAggElement()\n");
+ IEEE80211_DEBUG(IEEE80211_DL_ERR, "posRT2RTAgg can't be null in %s\n", __func__);
return;
}
memset(posRT2RTAgg, 0, *len);
@@ -758,7 +758,7 @@ void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg,
static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
{
if (!pOperateMCS) {
- IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in HT_PickMCSRate()\n");
+ IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in %s\n", __func__);
return false;
}

@@ -819,7 +819,7 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 *pMCSRateSet, u8 *pMCSF
u8 availableMcsRate[16];

if (!pMCSRateSet || !pMCSFilter) {
- IEEE80211_DEBUG(IEEE80211_DL_ERR, "pMCSRateSet or pMCSFilter can't be null in HTGetHighestMCSRate()\n");
+ IEEE80211_DEBUG(IEEE80211_DL_ERR, "pMCSRateSet or pMCSFilter can't be null in %s\n", __func__);
return false;
}
for (i = 0; i < 16; i++)
@@ -901,7 +901,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; // For 11n EWC definition, 2007.07.17, by Emily

if (!pHTInfo->bCurrentHTSupport) {
- IEEE80211_DEBUG(IEEE80211_DL_ERR, "<=== HTOnAssocRsp(): HT_DISABLE\n");
+ IEEE80211_DEBUG(IEEE80211_DL_ERR, "<=== %s: HT_DISABLE\n", __func__);
return;
}
IEEE80211_DEBUG(IEEE80211_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n");
--
2.17.1


2018-06-24 10:00:35

by John Whitmore

[permalink] [raw]
Subject: [PATCH v2 2/8] staging: rtl8192u: Correct indentation of switch statement - Coding Style

Removed an extra indentation from the code of the various case options in a
switch statement.

Signed-off-by: John Whitmore <[email protected]>
---
.../rtl8192u/ieee80211/rtl819x_HTProc.c | 30 +++++++++----------
1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 54c48747f5fa..4bfadb49c363 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -753,28 +753,28 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
case IEEE_A:
case IEEE_B:
case IEEE_G:
- //legacy rate routine handled at selectedrate
+ //legacy rate routine handled at selectedrate

- //no MCS rate
- for (i = 0; i <= 15; i++)
- pOperateMCS[i] = 0;
- break;
+ //no MCS rate
+ for (i = 0; i <= 15; i++)
+ pOperateMCS[i] = 0;
+ break;

case IEEE_N_24G: //assume CCK rate ok
case IEEE_N_5G:
- // Legacy part we only use 6, 5.5,2,1 for N_24G and 6 for N_5G.
- // Legacy part shall be handled at SelectRateSet().
-
- //HT part
- // TODO: may be different if we have different number of antenna
- pOperateMCS[0] &= RATE_ADPT_1SS_MASK; //support MCS 0~7
- pOperateMCS[1] &= RATE_ADPT_2SS_MASK;
- pOperateMCS[3] &= RATE_ADPT_MCS32_MASK;
- break;
+ // Legacy part we only use 6, 5.5,2,1 for N_24G and 6 for N_5G.
+ // Legacy part shall be handled at SelectRateSet().
+
+ //HT part
+ // TODO: may be different if we have different number of antenna
+ pOperateMCS[0] &= RATE_ADPT_1SS_MASK; //support MCS 0~7
+ pOperateMCS[1] &= RATE_ADPT_2SS_MASK;
+ pOperateMCS[3] &= RATE_ADPT_MCS32_MASK;
+ break;

//should never reach here
default:
- break;
+ break;
}

return true;
--
2.17.1


2018-06-24 10:00:54

by John Whitmore

[permalink] [raw]
Subject: [PATCH v2 4/8] staging: rtl8192u: Truncate block comments to 80 character length - Style

Where possible truncation of block comments to the 80 character length
preferred by the coding style.

In a previous version of this commit some of the comments were contentious so
those have not been touched in this version.

Signed-off-by: John Whitmore <[email protected]>
---
.../rtl8192u/ieee80211/rtl819x_HTProc.c | 108 +++++++++++-------
1 file changed, 64 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index bbac9d04c23e..604b393d856f 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -1,6 +1,9 @@
// SPDX-License-Identifier: GPL-2.0

-//As this function is mainly ported from Windows driver, so leave the name little changed. If any confusion caused, tell me. Created by WB. 2008.05.08
+/*
+ * As this function is mainly ported from Windows driver, so leave the name
+ * little changed. If any confusion caused, tell me. Created by WB. 2008.05.08
+ */
#include "ieee80211.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};
@@ -42,8 +45,8 @@ static u8 AIRLINK_RALINK[3] = {0x00, 0x18, 0x02};
//static u8 DLINK_ATHEROS[3] = {0x00, 0x1c, 0xf0};
static u8 CISCO_BROADCOM[3] = {0x00, 0x17, 0x94};
/*
- * 2008/04/01 MH For Cisco G mode RX TP We need to change FW duration. Should we put the
- * code in other place??
+ * 2008/04/01 MH For Cisco G mode RX TP We need to change FW duration. Should we
+ * put the code in other place??
* static u8 WIFI_CISCO_G_AP[3] = {0x00, 0x40, 0x96};
*/
/*
@@ -117,7 +120,8 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
}

/*
- *function: This function print out each field on HT capability IE mainly from (Beacon/ProbeRsp/AssocReq)
+ *function: This function print out each field on HT capability
+ * IE mainly from (Beacon/ProbeRsp/AssocReq)
* input: u8* CapIE //Capability IE to be printed out
* u8* TitleString //mainly print out caller function
* output: none
@@ -151,7 +155,8 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
}

/*
- *function: This function print out each field on HT Information IE mainly from (Beacon/ProbeRsp)
+ *function: This function print out each field on HT Information
+ * IE mainly from (Beacon/ProbeRsp)
* input: u8* InfoIE //Capability IE to be printed out
* u8* TitleString //mainly print out caller function
* output: none
@@ -387,8 +392,9 @@ static void HTIOTPeerDetermine(struct ieee80211_device *ieee)
}

/*
- *function: Check whether driver should declare received rate up to MCS13 only since some chipset is not good
- * at receiving MCS14~15 frame from some AP.
+ *function: Check whether driver should declare received rate up to MCS13
+ * only since some chipset is not good at receiving MCS14~15 frame
+ * from some AP.
* input: struct ieee80211_device* ieee
* u8 * PeerMacAddr
* output: none
@@ -402,7 +408,8 @@ static u8 HTIOTActIsDisableMCS14(struct ieee80211_device *ieee, u8 *PeerMacAddr)
/*
* Function: HTIOTActIsDisableMCS15
*
- * Overview: Check whether driver should declare capability of receiving MCS15
+ * Overview: Check whether driver should declare capability of receiving
+ * MCS15
*
* Input:
* PADAPTER Adapter,
@@ -439,7 +446,8 @@ static bool HTIOTActIsDisableMCS15(struct ieee80211_device *ieee)
/*
* Function: HTIOTActIsDisableMCSTwoSpatialStream
*
- * Overview: Check whether driver should declare capability of receiving All 2 ss packets
+ * Overview: Check whether driver should declare capability of receiving
+ * All 2 ss packets
*
* Input:
* PADAPTER Adapter,
@@ -462,7 +470,8 @@ static bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device *ieee,
* input: struct ieee80211_device* ieee
* u8* PeerMacAddr
* output: none
- * return: return 1 if driver should disable EDCA turbo mode(otherwise return 0)
+ * return: return 1 if driver should disable EDCA turbo mode
+ * (otherwise return 0)
*/
static u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device *ieee,
u8 *PeerMacAddr)
@@ -471,7 +480,8 @@ static u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device *ieee,
}

/*
- *function: Check whether we need to use OFDM to sned MGNT frame for broadcom AP
+ *function: Check whether we need to use OFDM to sned MGNT frame for
+ * broadcom AP
* input: struct ieee80211_network *network //current network we live
* output: none
* return: return 1 if true
@@ -510,9 +520,9 @@ void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo)
/*
*function: Construct Capablility Element in Beacon... if HTEnable is turned on
* input: struct ieee80211_device* ieee
- * u8* posHTCap //pointer to store Capability Ele
- * u8* len //store length of CE
- * u8 IsEncrypt //whether encrypt, needed further
+ * u8* posHTCap //pointer to store Capability Ele
+ * u8* len //store length of CE
+ * u8 IsEncrypt //whether encrypt, needed further
* output: none
* return: none
* notice: posHTCap can't be null and should be initialized before.
@@ -551,7 +561,7 @@ void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u
pCapELE->ShortGI20Mhz = 1; // We can receive Short GI!!
pCapELE->ShortGI40Mhz = 1; // We can receive Short GI!!
//DbgPrint("TX HT cap/info ele BW=%d SG20=%d SG40=%d\n\r",
- //pCapELE->ChlWidth, pCapELE->ShortGI20Mhz, pCapELE->ShortGI40Mhz);
+ //pCapELE->ChlWidth, pCapELE->ShortGI20Mhz, pCapELE->ShortGI40Mhz);
pCapELE->TxSTBC = 1;
pCapELE->RxSTBC = 0;
pCapELE->DelayBA = 0; // Do not support now!!
@@ -612,19 +622,23 @@ void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u

// IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA | IEEE80211_DL_HT, posHTCap, *len -2);

- //Print each field in detail. Driver should not print out this message by default
+ /*
+ * Print each field in detail. Driver should not print out this message
+ * by default
+ */
// HTDebugHTCapability(posHTCap, (u8*)"HTConstructCapability()");
}

/*
- *function: Construct Information Element in Beacon... if HTEnable is turned on
+ *function: Construct Information Element in Beacon... if HTEnable is turned on
* input: struct ieee80211_device* ieee
- * u8* posHTCap //pointer to store Information Ele
- * u8* len //store len of
- * u8 IsEncrypt //whether encrypt, needed further
+ * u8* posHTCap //pointer to store Information Ele
+ * u8* len //store len of
+ * u8 IsEncrypt //whether encrypt, needed further
* output: none
* return: none
- * notice: posHTCap can't be null and be initialized before. only AP and IBSS sta should do this
+ * notice: posHTCap can't be null and be initialized before.
+ * only AP and IBSS sta should do this
*/
void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *len, u8 IsEncrypt)
{
@@ -666,16 +680,17 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *le
}

/*
- * According to experiment, Realtek AP to STA (based on rtl8190) may achieve best performance
- * if both STA and AP set limitation of aggregation size to 32K, that is, set AMPDU density to 2
- * (Ref: IEEE 11n specification). However, if Realtek STA associates to other AP, STA should set
- * limitation of aggregation size to 8K, otherwise, performance of traffic stream from STA to AP
- * will be much less than the traffic stream from AP to STA if both of the stream runs concurrently
- * at the same time.
+ * According to experiment, Realtek AP to STA (based on rtl8190) may achieve
+ * best performance if both STA and AP set limitation of aggregation size to
+ * 32K, that is, set AMPDU density to 2 (Ref: IEEE 11n specification).
+ * However, if Realtek STA associates to other AP, STA should set limitation of
+ * aggregation size to 8K, otherwise, performance of traffic stream from STA to
+ * AP will be much less than the traffic stream from AP to STA if both of the
+ * stream runs concurrently at the same time.
*
* Frame Format
- * Element ID Length OUI Type1 Reserved
- * 1 byte 1 byte 3 bytes 1 byte 1 byte
+ * Element ID Length OUI Type1 Reserved
+ * 1 byte 1 byte 3 bytes 1 byte 1 byte
*
* OUI = 0x00, 0xe0, 0x4c,
* Type = 0x02
@@ -686,8 +701,8 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *le
/*
*function: Construct Information Element in Beacon... in RT2RT condition
* input: struct ieee80211_device* ieee
- * u8* posRT2RTAgg //pointer to store Information Ele
- * u8* len //store len
+ * u8* posRT2RTAgg //pointer to store Information Ele
+ * u8* len //store len
* output: none
* return: none
* notice:
@@ -735,8 +750,8 @@ void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg,

/*
*function: Pick the right Rate Adaptive table to use
- * input: struct ieee80211_device* ieee
- * u8* pOperateMCS //A pointer to MCS rate bitmap
+ * input: struct ieee80211_device* ieee
+ * u8* pOperateMCS //A pointer to MCS rate bitmap
* return: always we return true
* notice:
*/
@@ -853,8 +868,9 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 *pSupportMCS,
// TODO: adjust our operational rate set according to our channel bandwidth, STBC and Antenna number

/*
- * TODO: fill suggested rate adaptive rate index and give firmware info using Tx command packet
- * we also shall suggested the first start rate set according to our singal strength
+ * TODO: fill suggested rate adaptive rate index and give firmware info
+ * using Tx command packet we also shall suggested the first start rate
+ * set according to our singal strength
*/
HT_PickMCSRate(ieee, pOperateMCS);

@@ -1013,7 +1029,8 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
/*
* Filter out unsupported HT rate for this AP
* Update RATR table
- * This is only for 8190 ,8192 or later product which using firmware to handle rate adaptive mechanism.
+ * This is only for 8190 ,8192 or later product which using firmware to
+ * handle rate adaptive mechanism.
*/

/*
@@ -1050,7 +1067,9 @@ void HTSetConnectBwModeCallback(struct ieee80211_device *ieee);
* input: struct ieee80211_device* ieee
* output: none
* return: none
- * notice: This function is called when * (1) MPInitialization Phase * (2) Receiving of Deauthentication from AP
+ * notice: This function is called when
+ * * (1) MPInitialization Phase
+ * * (2) Receiving of Deauthentication from AP
*/
// TODO: Should this funciton be called when receiving of Disassociation?
void HTInitializeHTInfo(struct ieee80211_device *ieee)
@@ -1075,8 +1094,8 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
/*
* CCK rate support
* This flag is set to true to support CCK rate by default.
- * It will be affected by "pHTInfo->bRegSuppCCK" and AP capabilities only when associate to
- * 11N BSS.
+ * It will be affected by "pHTInfo->bRegSuppCCK" and AP capabilities
+ * only when associate to 11N BSS.
*/
pHTInfo->bCurSuppCCK = true;

@@ -1140,7 +1159,8 @@ void HTInitializeBssDesc(PBSS_HT pBssHT)
/*
*function: initialize Bss HT structure(struct PBSS_HT)
* input: struct ieee80211_device *ieee
- * struct ieee80211_network *pNetwork //usually current network we are live in
+ * struct ieee80211_network *pNetwork //usually current network
+ * we are live in
* output: none
* return: none
* notice: This function should ONLY be called before association
@@ -1300,10 +1320,10 @@ void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH Bandwidt
pHTInfo->bSwBwInProgress = true;

/*
- * TODO: 2007.7.13 by Emily Wait 2000ms in order to guarantee that switching
- * bandwidth is executed after scan is finished. It is a temporal solution
- * because software should ganrantee the last operation of switching bandwidth
- * is executed properlly.
+ * TODO: 2007.7.13 by Emily Wait 2000ms in order to guarantee that
+ * switching bandwidth is executed after scan is finished. It is a
+ * temporal solution because software should ganrantee the last
+ * operation of switching bandwidth is executed properlly.
*/
HTSetConnectBwModeCallback(ieee);

--
2.17.1


2018-06-24 10:01:01

by John Whitmore

[permalink] [raw]
Subject: [PATCH v2 3/8] staging: rtl8192u: User memset to initialize memory, instead of loop.

Replaced memory initialising loop with memset, as suggested by Andy Shevchenko

Signed-off-by: John Whitmore <[email protected]>
---
drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 4bfadb49c363..bbac9d04c23e 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -742,8 +742,6 @@ void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg,
*/
static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
{
- u8 i;
-
if (!pOperateMCS) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in HT_PickMCSRate()\n");
return false;
@@ -756,8 +754,7 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
//legacy rate routine handled at selectedrate

//no MCS rate
- for (i = 0; i <= 15; i++)
- pOperateMCS[i] = 0;
+ memset(pOperateMCS, 0, 15);
break;

case IEEE_N_24G: //assume CCK rate ok
--
2.17.1


2018-06-24 10:01:05

by John Whitmore

[permalink] [raw]
Subject: [PATCH v2 1/8] staging: rtl8192u: change block comments to prefered style - Coding Style

Some of the comment blocks are commening out code so have been left for the
moment.

Signed-off-by: John Whitmore <[email protected]>
---
.../rtl8192u/ieee80211/rtl819x_HTProc.c | 366 ++++++++++--------
1 file changed, 195 insertions(+), 171 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 5a48693e2cf3..54c48747f5fa 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -41,17 +41,18 @@ static u8 EDIMAX_RALINK[3] = {0x00, 0x0e, 0x2e};
static u8 AIRLINK_RALINK[3] = {0x00, 0x18, 0x02};
//static u8 DLINK_ATHEROS[3] = {0x00, 0x1c, 0xf0};
static u8 CISCO_BROADCOM[3] = {0x00, 0x17, 0x94};
-
-// 2008/04/01 MH For Cisco G mode RX TP We need to change FW duration. Should we put the
-// code in other place??
-//static u8 WIFI_CISCO_G_AP[3] = {0x00, 0x40, 0x96};
-/********************************************************************************************************************
+/*
+ * 2008/04/01 MH For Cisco G mode RX TP We need to change FW duration. Should we put the
+ * code in other place??
+ * static u8 WIFI_CISCO_G_AP[3] = {0x00, 0x40, 0x96};
+ */
+/*
*function: This function update default settings in pHTInfo structure
* input: PRT_HIGH_THROUGHPUT pHTInfo
* output: none
* return: none
* notice: These value need be modified if any changes.
- * *****************************************************************************************************************/
+ */
void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
{
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
@@ -93,8 +94,10 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
// 8190 only. Assign duration operation mode to firmware
pMgntInfo->bTxEnableFwCalcDur = (BOOLEAN)pNdisCommon->bRegTxEnableFwCalcDur;
#endif
- // 8190 only, Realtek proprietary aggregation mode
- // Set MPDUDensity=2, 1: Set MPDUDensity=2(32k) for Realtek AP and set MPDUDensity=0(8k) for others
+ /*
+ * 8190 only, Realtek proprietary aggregation mode
+ * Set MPDUDensity=2, 1: Set MPDUDensity=2(32k) for Realtek AP and set MPDUDensity=0(8k) for others
+ */
pHTInfo->bRegRT2RTAggregation = 1;//0: Set MPDUDensity=2, 1: Set MPDUDensity=2(32k) for Realtek AP and set MPDUDensity=0(8k) for others

// For Rx Reorder Control
@@ -113,14 +116,14 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
#endif
}

-/********************************************************************************************************************
+/*
*function: This function print out each field on HT capability IE mainly from (Beacon/ProbeRsp/AssocReq)
* input: u8* CapIE //Capability IE to be printed out
* u8* TitleString //mainly print out caller function
* output: none
* return: none
* notice: Driver should not print out this message by default.
- * *****************************************************************************************************************/
+ */
void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
{
static u8 EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33}; // For 11n EWC definition, 2007.07.17, by Emily
@@ -147,14 +150,14 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
pCapELE->MCS[1], pCapELE->MCS[2], pCapELE->MCS[3], pCapELE->MCS[4]);
}

-/********************************************************************************************************************
+/*
*function: This function print out each field on HT Information IE mainly from (Beacon/ProbeRsp)
* input: u8* InfoIE //Capability IE to be printed out
* u8* TitleString //mainly print out caller function
* output: none
* return: none
* notice: Driver should not print out this message by default.
- * *****************************************************************************************************************/
+ */
void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
{
static u8 EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34}; // For 11n EWC definition, 2007.07.17, by Emily
@@ -209,8 +212,8 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
}

/*
-* Return: true if station in half n mode and AP supports 40 bw
-*/
+ * Return: true if station in half n mode and AP supports 40 bw
+ */
static bool IsHTHalfNmode40Bandwidth(struct ieee80211_device *ieee)
{
bool retValue = false;
@@ -276,14 +279,14 @@ u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate)
return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate & 0x7f)];
}

-/********************************************************************************************************************
+/*
*function: This function returns current datarate.
* input: struct ieee80211_device* ieee
* u8 nDataRate
* output: none
* return: tx rate
* notice: quite unsure about how to use this function //wb
- * *****************************************************************************************************************/
+ */
u16 TxCountToDataRate(struct ieee80211_device *ieee, u8 nDataRate)
{
//PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
@@ -345,13 +348,13 @@ bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee)
return retValue;
}

-/********************************************************************************************************************
+/*
*function: This function returns peer IOT.
* input: struct ieee80211_device* ieee
* output: none
* return:
* notice:
- * *****************************************************************************************************************/
+ */
static void HTIOTPeerDetermine(struct ieee80211_device *ieee)
{
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
@@ -383,31 +386,31 @@ static void HTIOTPeerDetermine(struct ieee80211_device *ieee)
IEEE80211_DEBUG(IEEE80211_DL_IOT, "Joseph debug!! IOTPEER: %x\n", pHTInfo->IOTPeer);
}

-/********************************************************************************************************************
+/*
*function: Check whether driver should declare received rate up to MCS13 only since some chipset is not good
* at receiving MCS14~15 frame from some AP.
* input: struct ieee80211_device* ieee
* u8 * PeerMacAddr
* output: none
* return: return 1 if driver should declare MCS13 only(otherwise return 0)
- * *****************************************************************************************************************/
+ */
static u8 HTIOTActIsDisableMCS14(struct ieee80211_device *ieee, u8 *PeerMacAddr)
{
return 0;
}

-/**
-* Function: HTIOTActIsDisableMCS15
-*
-* Overview: Check whether driver should declare capability of receiving MCS15
-*
-* Input:
-* PADAPTER Adapter,
-*
-* Output: None
-* Return: true if driver should disable MCS15
-* 2008.04.15 Emily
-*/
+/*
+ * Function: HTIOTActIsDisableMCS15
+ *
+ * Overview: Check whether driver should declare capability of receiving MCS15
+ *
+ * Input:
+ * PADAPTER Adapter,
+ *
+ * Output: None
+ * Return: true if driver should disable MCS15
+ * 2008.04.15 Emily
+ */
static bool HTIOTActIsDisableMCS15(struct ieee80211_device *ieee)
{
bool retValue = false;
@@ -433,18 +436,18 @@ static bool HTIOTActIsDisableMCS15(struct ieee80211_device *ieee)
return retValue;
}

-/**
-* Function: HTIOTActIsDisableMCSTwoSpatialStream
-*
-* Overview: Check whether driver should declare capability of receiving All 2 ss packets
-*
-* Input:
-* PADAPTER Adapter,
-*
-* Output: None
-* Return: true if driver should disable all two spatial stream packet
-* 2008.04.21 Emily
-*/
+/*
+ * Function: HTIOTActIsDisableMCSTwoSpatialStream
+ *
+ * Overview: Check whether driver should declare capability of receiving All 2 ss packets
+ *
+ * Input:
+ * PADAPTER Adapter,
+ *
+ * Output: None
+ * Return: true if driver should disable all two spatial stream packet
+ * 2008.04.21 Emily
+ */
static bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device *ieee,
u8 *PeerMacAddr)
{
@@ -454,25 +457,25 @@ static bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device *ieee,
return false;
}

-/********************************************************************************************************************
+/*
*function: Check whether driver should disable EDCA turbo mode
* input: struct ieee80211_device* ieee
* u8* PeerMacAddr
* output: none
* return: return 1 if driver should disable EDCA turbo mode(otherwise return 0)
- * *****************************************************************************************************************/
+ */
static u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device *ieee,
u8 *PeerMacAddr)
{ /* default enable EDCA Turbo mode. */
return false;
}

-/********************************************************************************************************************
+/*
*function: Check whether we need to use OFDM to sned MGNT frame for broadcom AP
* input: struct ieee80211_network *network //current network we live
* output: none
* return: return 1 if true
- * *****************************************************************************************************************/
+ */
static u8 HTIOTActIsMgntUseCCK6M(struct ieee80211_network *network)
{
u8 retValue = 0;
@@ -504,7 +507,7 @@ void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo)
pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
}

-/********************************************************************************************************************
+/*
*function: Construct Capablility Element in Beacon... if HTEnable is turned on
* input: struct ieee80211_device* ieee
* u8* posHTCap //pointer to store Capability Ele
@@ -513,7 +516,7 @@ void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo)
* output: none
* return: none
* notice: posHTCap can't be null and should be initialized before.
- * *****************************************************************************************************************/
+ */
void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u8 *len, u8 IsEncrypt)
{
PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo;
@@ -557,8 +560,10 @@ void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u
pCapELE->PSMP = 0; // Do not support now!!
pCapELE->LSigTxopProtect = 0; // Do not support now!!

- //MAC HT parameters info
- // TODO: Nedd to take care of this part
+ /*
+ * MAC HT parameters info
+ * TODO: Nedd to take care of this part
+ */
IEEE80211_DEBUG(IEEE80211_DL_HT, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk);

if (IsEncrypt) {
@@ -580,8 +585,10 @@ void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u
if (pHT->IOTAction & HT_IOT_ACT_DISABLE_ALL_2SS)
pCapELE->MCS[1] &= 0x00;

- // 2008.06.12
- // For RTL819X, if pairwisekey = wep/tkip, ap is ralink, we support only MCS0~7.
+ /*
+ * 2008.06.12
+ * For RTL819X, if pairwisekey = wep/tkip, ap is ralink, we support only MCS0~7.
+ */
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) {
int i;

@@ -609,7 +616,7 @@ void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u
// HTDebugHTCapability(posHTCap, (u8*)"HTConstructCapability()");
}

-/********************************************************************************************************************
+/*
*function: Construct Information Element in Beacon... if HTEnable is turned on
* input: struct ieee80211_device* ieee
* u8* posHTCap //pointer to store Information Ele
@@ -618,7 +625,7 @@ void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u
* output: none
* return: none
* notice: posHTCap can't be null and be initialized before. only AP and IBSS sta should do this
- * *****************************************************************************************************************/
+ */
void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *len, u8 IsEncrypt)
{
PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo;
@@ -659,24 +666,24 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *le
}

/*
- * According to experiment, Realtek AP to STA (based on rtl8190) may achieve best performance
- * if both STA and AP set limitation of aggregation size to 32K, that is, set AMPDU density to 2
- * (Ref: IEEE 11n specification). However, if Realtek STA associates to other AP, STA should set
- * limitation of aggregation size to 8K, otherwise, performance of traffic stream from STA to AP
- * will be much less than the traffic stream from AP to STA if both of the stream runs concurrently
- * at the same time.
- *
- * Frame Format
- * Element ID Length OUI Type1 Reserved
- * 1 byte 1 byte 3 bytes 1 byte 1 byte
- *
- * OUI = 0x00, 0xe0, 0x4c,
- * Type = 0x02
- * Reserved = 0x00
- *
- * 2007.8.21 by Emily
-*/
-/********************************************************************************************************************
+ * According to experiment, Realtek AP to STA (based on rtl8190) may achieve best performance
+ * if both STA and AP set limitation of aggregation size to 32K, that is, set AMPDU density to 2
+ * (Ref: IEEE 11n specification). However, if Realtek STA associates to other AP, STA should set
+ * limitation of aggregation size to 8K, otherwise, performance of traffic stream from STA to AP
+ * will be much less than the traffic stream from AP to STA if both of the stream runs concurrently
+ * at the same time.
+ *
+ * Frame Format
+ * Element ID Length OUI Type1 Reserved
+ * 1 byte 1 byte 3 bytes 1 byte 1 byte
+ *
+ * OUI = 0x00, 0xe0, 0x4c,
+ * Type = 0x02
+ * Reserved = 0x00
+ *
+ * 2007.8.21 by Emily
+ */
+/*
*function: Construct Information Element in Beacon... in RT2RT condition
* input: struct ieee80211_device* ieee
* u8* posRT2RTAgg //pointer to store Information Ele
@@ -684,7 +691,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 *le
* output: none
* return: none
* notice:
- * *****************************************************************************************************************/
+ */
void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg, u8 *len)
{
if (!posRT2RTAgg) {
@@ -726,13 +733,13 @@ void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg,
#endif
}

-/********************************************************************************************************************
+/*
*function: Pick the right Rate Adaptive table to use
* input: struct ieee80211_device* ieee
* u8* pOperateMCS //A pointer to MCS rate bitmap
* return: always we return true
* notice:
- * *****************************************************************************************************************/
+ */
static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
{
u8 i;
@@ -774,24 +781,24 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
}

/*
-* Description:
-* This function will get the highest speed rate in input MCS set.
-*
-* /param Adapter Pionter to Adapter entity
-* pMCSRateSet Pointer to MCS rate bitmap
-* pMCSFilter Pointer to MCS rate filter
-*
-* /return Highest MCS rate included in pMCSRateSet and filtered by pMCSFilter.
-*
-*/
-/********************************************************************************************************************
+ * Description:
+ * This function will get the highest speed rate in input MCS set.
+ *
+ * /param Adapter Pionter to Adapter entity
+ * pMCSRateSet Pointer to MCS rate bitmap
+ * pMCSFilter Pointer to MCS rate filter
+ *
+ * /return Highest MCS rate included in pMCSRateSet and filtered by pMCSFilter.
+ *
+ */
+/*
*function: This function will get the highest speed rate in input MCS set.
* input: struct ieee80211_device* ieee
* u8* pMCSRateSet //Pointer to MCS rate bitmap
* u8* pMCSFilter //Pointer to MCS rate filter
* return: Highest MCS rate included in pMCSRateSet and filtered by pMCSFilter
* notice:
- * *****************************************************************************************************************/
+ */
u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 *pMCSRateSet, u8 *pMCSFilter)
{
u8 i, j;
@@ -829,14 +836,13 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 *pMCSRateSet, u8 *pMCSF
}

/*
-**
-**1.Filter our operation rate set with AP's rate set
-**2.shall reference channel bandwidth, STBC, Antenna number
-**3.generate rate adative table for firmware
-**David 20060906
-**
-** \pHTSupportedCap: the connected STA's supported rate Capability element
-*/
+ * 1.Filter our operation rate set with AP's rate set
+ * 2.shall reference channel bandwidth, STBC, Antenna number
+ * 3.generate rate adative table for firmware
+ * David 20060906
+ *
+ * \pHTSupportedCap: the connected STA's supported rate Capability element
+ */
static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 *pSupportMCS,
u8 *pOperateMCS)
{
@@ -849,18 +855,20 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 *pSupportMCS,

// TODO: adjust our operational rate set according to our channel bandwidth, STBC and Antenna number

- // TODO: fill suggested rate adaptive rate index and give firmware info using Tx command packet
- // we also shall suggested the first start rate set according to our singal strength
+ /*
+ * TODO: fill suggested rate adaptive rate index and give firmware info using Tx command packet
+ * we also shall suggested the first start rate set according to our singal strength
+ */
HT_PickMCSRate(ieee, pOperateMCS);

// For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7.
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
pOperateMCS[1] = 0;

- //
- // For RTL819X, we support only MCS0~15.
- // And also, we do not know how to use MCS32 now.
- //
+ /*
+ * For RTL819X, we support only MCS0~15.
+ * And also, we do not know how to use MCS32 now.
+ */
for (i = 2; i <= 15; i++)
pOperateMCS[i] = 0;

@@ -911,30 +919,33 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)

pHTInfo->bCurTxBW40MHz = (pPeerHTInfo->RecommemdedTxWidth == 1);

- //
- // Update short GI/ long GI setting
- //
- // TODO:
+ /*
+ * Update short GI/ long GI setting
+ *
+ * TODO:
+ */
pHTInfo->bCurShortGI20MHz = pHTInfo->bRegShortGI20MHz &&
(pPeerHTCap->ShortGI20Mhz == 1);
pHTInfo->bCurShortGI40MHz = pHTInfo->bRegShortGI40MHz &&
(pPeerHTCap->ShortGI40Mhz == 1);

- //
- // Config TX STBC setting
- //
- // TODO:
+ /*
+ * Config TX STBC setting
+ *
+ * TODO:
+ */

- //
- // Config DSSS/CCK mode in 40MHz mode
- //
- // TODO:
+ /*
+ * Config DSSS/CCK mode in 40MHz mode
+ *
+ * TODO:
+ */
pHTInfo->bCurSuppCCK = pHTInfo->bRegSuppCCK &&
(pPeerHTCap->DssCCk == 1);

- //
- // Config and configure A-MSDU setting
- //
+ /*
+ * Config and configure A-MSDU setting
+ */
pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support;

nMaxAMSDUSize = (pPeerHTCap->MaxAMSDUSize == 0) ? 3839 : 7935;
@@ -943,14 +954,15 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
pHTInfo->nCurrent_AMSDU_MaxSize = nMaxAMSDUSize;
else
pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
- //
- // Config A-MPDU setting
- //
+ /*
+ * Config A-MPDU setting
+ */
pHTInfo->bCurrentAMPDUEnable = pHTInfo->bAMPDUEnable;

- // <1> Decide AMPDU Factor
-
- // By Emily
+ /*
+ * <1> Decide AMPDU Factor
+ * By Emily
+ */
if (!pHTInfo->bRegRT2RTAggregation) {
// Decide AMPDU Factor according to protocol handshake
if (pHTInfo->AMPDU_Factor > pPeerHTCap->MaxRxAMPDUFactor)
@@ -958,8 +970,10 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
else
pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
} else {
- // Set MPDU density to 2 to Realtek AP, and set it to 0 for others
- // Replace MPDU factor declared in original association response frame format. 2007.08.20 by Emily
+ /*
+ * Set MPDU density to 2 to Realtek AP, and set it to 0 for others
+ * Replace MPDU factor declared in original association response frame format. 2007.08.20 by Emily
+ */
if (ieee->current_network.bssht.bdRT2RTAggregation) {
if (ieee->pairwise_key_type != KEY_TYPE_NA)
// Realtek may set 32k in security mode and 64k for others
@@ -974,8 +988,10 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
}
}

- // <2> Set AMPDU Minimum MPDU Start Spacing
- // 802.11n 3.0 section 9.7d.3
+ /*
+ * <2> Set AMPDU Minimum MPDU Start Spacing
+ * 802.11n 3.0 section 9.7d.3
+ */
if (pHTInfo->MPDU_Density > pPeerHTCap->MPDUDensity)
pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
else
@@ -997,22 +1013,24 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
// Rx Reorder Setting
pHTInfo->bCurRxReorderEnable = pHTInfo->bRegRxReorderEnable;

- //
- // Filter out unsupported HT rate for this AP
- // Update RATR table
- // This is only for 8190 ,8192 or later product which using firmware to handle rate adaptive mechanism.
- //
+ /*
+ * Filter out unsupported HT rate for this AP
+ * Update RATR table
+ * This is only for 8190 ,8192 or later product which using firmware to handle rate adaptive mechanism.
+ */

- // Handle Ralink AP bad MCS rate set condition. Joseph.
- // This fix the bug of Ralink AP. This may be removed in the future.
+ /*
+ * Handle Ralink AP bad MCS rate set condition. Joseph.
+ * This fix the bug of Ralink AP. This may be removed in the future.
+ */
if (pPeerHTCap->MCS[0] == 0)
pPeerHTCap->MCS[0] = 0xff;

HTFilterMCSRate(ieee, pPeerHTCap->MCS, ieee->dot11HTOperationalRateSet);

- //
- // Config MIMO Power Save setting
- //
+ /*
+ * Config MIMO Power Save setting
+ */
pHTInfo->PeerMimoPs = pPeerHTCap->MimoPwrSave;
if (pHTInfo->PeerMimoPs == MIMO_PS_STATIC)
pMcsFilter = MCS_FILTER_1SS;
@@ -1023,28 +1041,28 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee, ieee->dot11HTOperationalRateSet, pMcsFilter);
ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate;

- //
- // Config current operation mode.
- //
+ /*
+ * Config current operation mode.
+ */
pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode;
}

void HTSetConnectBwModeCallback(struct ieee80211_device *ieee);
-/********************************************************************************************************************
+/*
*function: initialize HT info(struct PRT_HIGH_THROUGHPUT)
* input: struct ieee80211_device* ieee
* output: none
* return: none
* notice: This function is called when * (1) MPInitialization Phase * (2) Receiving of Deauthentication from AP
-********************************************************************************************************************/
+ */
// TODO: Should this funciton be called when receiving of Disassociation?
void HTInitializeHTInfo(struct ieee80211_device *ieee)
{
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;

- //
- // These parameters will be reset when receiving deauthentication packet
- //
+ /*
+ * These parameters will be reset when receiving deauthentication packet
+ */
IEEE80211_DEBUG(IEEE80211_DL_HT, "===========>%s()\n", __func__);
pHTInfo->bCurrentHTSupport = false;

@@ -1057,10 +1075,12 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
pHTInfo->bCurShortGI40MHz = false;
pHTInfo->bForcedShortGI = false;

- // CCK rate support
- // This flag is set to true to support CCK rate by default.
- // It will be affected by "pHTInfo->bRegSuppCCK" and AP capabilities only when associate to
- // 11N BSS.
+ /*
+ * CCK rate support
+ * This flag is set to true to support CCK rate by default.
+ * It will be affected by "pHTInfo->bRegSuppCCK" and AP capabilities only when associate to
+ * 11N BSS.
+ */
pHTInfo->bCurSuppCCK = true;

// AMSDU related
@@ -1099,13 +1119,13 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
}
}

-/********************************************************************************************************************
+/*
*function: initialize Bss HT structure(struct PBSS_HT)
* input: PBSS_HT pBssHT //to be initialized
* output: none
* return: none
* notice: This function is called when initialize network structure
-********************************************************************************************************************/
+ */
void HTInitializeBssDesc(PBSS_HT pBssHT)
{
pBssHT->bdSupportHT = false;
@@ -1120,14 +1140,14 @@ void HTInitializeBssDesc(PBSS_HT pBssHT)
pBssHT->bdRT2RTLongSlotTime = false;
}

-/********************************************************************************************************************
+/*
*function: initialize Bss HT structure(struct PBSS_HT)
* input: struct ieee80211_device *ieee
* struct ieee80211_network *pNetwork //usually current network we are live in
* output: none
* return: none
* notice: This function should ONLY be called before association
-********************************************************************************************************************/
+ */
void HTResetSelfAndSavePeerSetting(struct ieee80211_device *ieee, struct ieee80211_network *pNetwork)
{
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
@@ -1166,8 +1186,10 @@ void HTResetSelfAndSavePeerSetting(struct ieee80211_device *ieee, struct ieee802
// Determine the IOT Peer Vendor.
HTIOTPeerDetermine(ieee);

- // Decide IOT Action
- // Must be called after the parameter of pHTInfo->bCurrentRT2RTAggregation is decided
+ /*
+ * Decide IOT Action
+ * Must be called after the parameter of pHTInfo->bCurrentRT2RTAggregation is decided
+ */
pHTInfo->IOTAction = 0;
bIOTAction = HTIOTActIsDisableMCS14(ieee, pNetwork->bssid);
if (bIOTAction)
@@ -1208,27 +1230,27 @@ void HTUpdateSelfAndPeerSetting(struct ieee80211_device *ieee, struct ieee80211_
PHT_INFORMATION_ELE pPeerHTInfo = (PHT_INFORMATION_ELE)pNetwork->bssht.bdHTInfoBuf;

if (pHTInfo->bCurrentHTSupport) {
- //
- // Config current operation mode.
- //
+ /*
+ * Config current operation mode.
+ */
if (pNetwork->bssht.bdHTInfoLen != 0)
pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode;

- //
- // <TODO: Config according to OBSS non-HT STA present!!>
- //
+ /*
+ * <TODO: Config according to OBSS non-HT STA present!!>
+ */
}
}
EXPORT_SYMBOL(HTUpdateSelfAndPeerSetting);

-/********************************************************************************************************************
+/*
*function: check whether HT control field exists
* input: struct ieee80211_device *ieee
* u8* pFrame //coming skb->data
* output: none
* return: return true if HT control field exists(false otherwise)
* notice:
-********************************************************************************************************************/
+ */
u8 HTCCheck(struct ieee80211_device *ieee, u8 *pFrame)
{
if (ieee->pHTInfo->bCurrentHTSupport) {
@@ -1240,9 +1262,9 @@ u8 HTCCheck(struct ieee80211_device *ieee, u8 *pFrame)
return false;
}

-//
-// This function set bandwidth mode in protocol layer.
-//
+/*
+ * This function set bandwidth mode in protocol layer.
+ */
void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset)
{
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
@@ -1280,10 +1302,12 @@ void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH Bandwidt

pHTInfo->bSwBwInProgress = true;

- // TODO: 2007.7.13 by Emily Wait 2000ms in order to guarantee that switching
- // bandwidth is executed after scan is finished. It is a temporal solution
- // because software should ganrantee the last operation of switching bandwidth
- // is executed properlly.
+ /*
+ * TODO: 2007.7.13 by Emily Wait 2000ms in order to guarantee that switching
+ * bandwidth is executed after scan is finished. It is a temporal solution
+ * because software should ganrantee the last operation of switching bandwidth
+ * is executed properlly.
+ */
HTSetConnectBwModeCallback(ieee);

// spin_unlock_irqrestore(&(ieee->bw_spinlock), flags);
--
2.17.1


2018-06-24 10:01:14

by John Whitmore

[permalink] [raw]
Subject: [PATCH v2 7/8] staging: rtl8192u: Correct if statement - Coding Style

Corrected the coding style of if statement.

Signed-off-by: John Whitmore <[email protected]>
---
drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 03ec7e6373c6..2643312625dd 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -732,7 +732,7 @@ void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg,
section of code.
if(IS_UNDER_11N_AES_MODE(Adapter))
{
- posRT2RTAgg->Octet[5] |=RT_HT_CAP_USE_AMPDU;
+ posRT2RTAgg->Octet[5] |= RT_HT_CAP_USE_AMPDU;
}else
{
posRT2RTAgg->Octet[5] &= 0xfb;
--
2.17.1


2018-06-24 10:01:29

by John Whitmore

[permalink] [raw]
Subject: [PATCH v2 6/8] staging: rtl8192u: Remove braces from single statement blocks - Style

Removed the unrequired braces from single statement blocks - Coding Style.

Signed-off-by: John Whitmore <[email protected]>
---
drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 742d2202652f..03ec7e6373c6 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -549,11 +549,10 @@ void HTConstructCapabilityElement(struct ieee80211_device *ieee, u8 *posHTCap, u

//HT capability info
pCapELE->AdvCoding = 0; // This feature is not supported now!!
- if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) {
+ if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
pCapELE->ChlWidth = 0;
- } else {
+ else
pCapELE->ChlWidth = (pHT->bRegBW40MHz ? 1 : 0);
- }

// pCapELE->ChlWidth = (pHT->bRegBW40MHz?1:0);
pCapELE->MimoPwrSave = pHT->SelfMimoPs;
@@ -721,9 +720,8 @@ void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg,
*posRT2RTAgg++ = 0x01;
*posRT2RTAgg = 0x10;//*posRT2RTAgg = 0x02;

- if (ieee->bSupportRemoteWakeUp) {
+ if (ieee->bSupportRemoteWakeUp)
*posRT2RTAgg |= 0x08;//RT_HT_CAP_USE_WOW;
- }

*len = 6 + 2;
return;
@@ -861,12 +859,10 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 *pSupportMCS,
u8 i = 0;

// filter out operational rate set not supported by AP, the length of it is 16
- for (i = 0; i <= 15; i++) {
+ for (i = 0; i <= 15; i++)
pOperateMCS[i] = ieee->Regdot11HTOperationalRateSet[i] & pSupportMCS[i];
- }

// TODO: adjust our operational rate set according to our channel bandwidth, STBC and Antenna number
-
/*
* TODO: fill suggested rate adaptive rate index and give firmware info
* using Tx command packet we also shall suggested the first start rate
--
2.17.1


2018-06-24 10:54:25

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: V2 Coding style changes. Plus one change to use memset()

On Sun, Jun 24, 2018 at 10:57:24AM +0100, John Whitmore wrote:
> Simple coding style changes to single file
> drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c

Nit, please include the driver and subsystem in your 00/XX emails,
otherwise they get lost in my filters and I see an odd semi-completed
series of emails...

No need to change it this time, just for the future please do so.

thanks,

greg k-h

2018-06-24 11:11:00

by John Whitmore

[permalink] [raw]
Subject: Re: V2 Coding style changes. Plus one change to use memset()

On Sun, Jun 24, 2018 at 06:53:24PM +0800, Greg KH wrote:
> On Sun, Jun 24, 2018 at 10:57:24AM +0100, John Whitmore wrote:
> > Simple coding style changes to single file
> > drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
>
> Nit, please include the driver and subsystem in your 00/XX emails,
> otherwise they get lost in my filters and I see an odd semi-completed
> series of emails...
>

Certainly will and sorry for any inconvenience caused by the omission,
should have been obvious in hindsight.

2018-06-24 14:28:16

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH v2 3/8] staging: rtl8192u: User memset to initialize memory, instead of loop.

On Sun, 2018-06-24 at 10:57 +0100, John Whitmore wrote:
> Replaced memory initialising loop with memset, as suggested by Andy Shevchenko
[]
> diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
[]
> @@ -742,8 +742,6 @@ void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg,
> */
> static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
> {
> - u8 i;
> -
> if (!pOperateMCS) {
> IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in HT_PickMCSRate()\n");
> return false;
> @@ -756,8 +754,7 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
> //legacy rate routine handled at selectedrate
>
> //no MCS rate
> - for (i = 0; i <= 15; i++)
> - pOperateMCS[i] = 0;
> + memset(pOperateMCS, 0, 15);

Not the same code.

Loop is <= 15, so memset should use 16



2018-06-24 14:34:06

by John Whitmore

[permalink] [raw]
Subject: Re: [PATCH v2 3/8] staging: rtl8192u: User memset to initialize memory, instead of loop.

On Sun, Jun 24, 2018 at 07:26:41AM -0700, Joe Perches wrote:
> On Sun, 2018-06-24 at 10:57 +0100, John Whitmore wrote:
> > Replaced memory initialising loop with memset, as suggested by Andy Shevchenko
> []
> > diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
> []
> > @@ -742,8 +742,6 @@ void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg,
> > */
> > static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
> > {
> > - u8 i;
> > -
> > if (!pOperateMCS) {
> > IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in HT_PickMCSRate()\n");
> > return false;
> > @@ -756,8 +754,7 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
> > //legacy rate routine handled at selectedrate
> >
> > //no MCS rate
> > - for (i = 0; i <= 15; i++)
> > - pOperateMCS[i] = 0;
> > + memset(pOperateMCS, 0, 15);
>
> Not the same code.
>
> Loop is <= 15, so memset should use 16
>

Arragghhhh! Thank you and thank you for spotting that. I'll reissue again. I
should have been more careful. Sorry.

2018-06-24 14:40:58

by John Whitmore

[permalink] [raw]
Subject: Re: [PATCH v2 3/8] staging: rtl8192u: User memset to initialize memory, instead of loop.

On Sun, Jun 24, 2018 at 07:26:41AM -0700, Joe Perches wrote:
> On Sun, 2018-06-24 at 10:57 +0100, John Whitmore wrote:
> > Replaced memory initialising loop with memset, as suggested by Andy Shevchenko
> []
> > diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
> []
> > @@ -742,8 +742,6 @@ void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 *posRT2RTAgg,
> > */
> > static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
> > {
> > - u8 i;
> > -
> > if (!pOperateMCS) {
> > IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in HT_PickMCSRate()\n");
> > return false;
> > @@ -756,8 +754,7 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
> > //legacy rate routine handled at selectedrate
> >
> > //no MCS rate
> > - for (i = 0; i <= 15; i++)
> > - pOperateMCS[i] = 0;
> > + memset(pOperateMCS, 0, 15);
>
> Not the same code.
>
> Loop is <= 15, so memset should use 16
>

I wonder could I simply edit that single patch file to change "15" to "16" and
re-issue the set as "v3"? There's no checksums on the patch file just but
there are git hashes which will change with content I guess :(

I'll re-do that patch set. Stupid mistake.