summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorAndrew Miller <amiller@amilx.com>2012-03-15 15:05:21 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-15 14:09:03 -0700
commitda45e3fe89fd04d37da3be86999455ce069962ae (patch)
tree2c6b38ac2d7ee10b4247c3e722c33952339a8c05 /drivers/staging
parent536d190d77db6eb5a67ad79bedac0892f36dee12 (diff)
Staging: rtl8187se: r8180_dm.c: Fix comments
Change c++ style comments to c style Signed-off-by: Andrew Miller <amiller@amilx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/rtl8187se/r8180_dm.c1026
1 files changed, 525 insertions, 501 deletions
diff --git a/drivers/staging/rtl8187se/r8180_dm.c b/drivers/staging/rtl8187se/r8180_dm.c
index 02bffa9bddc7..54b676ffb6f3 100644
--- a/drivers/staging/rtl8187se/r8180_dm.c
+++ b/drivers/staging/rtl8187se/r8180_dm.c
@@ -1,14 +1,15 @@
-//#include "r8180.h"
+/*#include "r8180.h" */
#include "r8180_dm.h"
#include "r8180_hw.h"
#include "r8180_93cx6.h"
-//{by amy 080312
-
-//
-// Description:
-// Return TRUE if we shall perform High Power Mecahnism, FALSE otherwise.
-//
-//+by amy 080312
+/*{by amy 080312 */
+
+/*
+ * Description:
+ * Return TRUE if we shall perform High Power Mecahnism, FALSE otherwise.
+ *
+ *+by amy 080312
+ */
#define RATE_ADAPTIVE_TIMER_PERIOD 300
bool CheckHighPower(struct net_device *dev)
@@ -25,17 +26,17 @@ bool CheckHighPower(struct net_device *dev)
return true;
}
-//
-// Description:
-// Update Tx power level if necessary.
-// See also DoRxHighPower() and SetTxPowerLevel8185() for reference.
-//
-// Note:
-// The reason why we udpate Tx power level here instead of DoRxHighPower()
-// is the number of IO to change Tx power is much more than channel TR switch
-// and they are related to OFDM and MAC registers.
-// So, we don't want to update it so frequently in per-Rx packet base.
-//
+/*
+ * Description:
+ * Update Tx power level if necessary.
+ * See also DoRxHighPower() and SetTxPowerLevel8185() for reference.
+ *
+ * Note:
+ * The reason why we udpate Tx power level here instead of DoRxHighPower()
+ * is the number of IO to change Tx power is much more than channel TR switch
+ * and they are related to OFDM and MAC registers.
+ * So, we don't want to update it so frequently in per-Rx packet base.
+ */
void DoTxHighPower(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
@@ -46,7 +47,7 @@ void DoTxHighPower(struct net_device *dev)
u8 u1bTmp;
char OfdmTxPwrIdx, CckTxPwrIdx;
- //printk("----> DoTxHighPower()\n");
+ /* printk("----> DoTxHighPower()\n"); */
HiPwrUpperTh = priv->RegHiPwrUpperTh;
HiPwrLowerTh = priv->RegHiPwrLowerTh;
@@ -56,83 +57,87 @@ void DoTxHighPower(struct net_device *dev)
RSSIHiPwrUpperTh = priv->RegRSSIHiPwrUpperTh;
RSSIHiPwrLowerTh = priv->RegRSSIHiPwrLowerTh;
- //lzm add 080826
+ /* lzm add 080826 */
OfdmTxPwrIdx = priv->chtxpwr_ofdm[priv->ieee80211->current_network.channel];
CckTxPwrIdx = priv->chtxpwr[priv->ieee80211->current_network.channel];
- // printk("DoTxHighPower() - UndecoratedSmoothedSS:%d, CurCCKRSSI = %d , bCurCCKPkt= %d \n", priv->UndecoratedSmoothedSS, priv->CurCCKRSSI, priv->bCurCCKPkt );
+ /*
+ * printk("DoTxHighPower() - UndecoratedSmoothedSS:%d, CurCCKRSSI = %d , bCurCCKPkt= %d \n",
+ * priv->UndecoratedSmoothedSS, priv->CurCCKRSSI, priv->bCurCCKPkt );
+ */
if ((priv->UndecoratedSmoothedSS > HiPwrUpperTh) ||
(priv->bCurCCKPkt && (priv->CurCCKRSSI > RSSIHiPwrUpperTh))) {
- // Stevenl suggested that degrade 8dbm in high power sate. 2007-12-04 Isaiah
+ /* Stevenl suggested that degrade 8dbm in high power sate. 2007-12-04 Isaiah */
- // printk("=====>DoTxHighPower() - High Power - UndecoratedSmoothedSS:%d, HiPwrUpperTh = %d \n", priv->UndecoratedSmoothedSS, HiPwrUpperTh );
+ /* printk("=====>DoTxHighPower() - High Power - UndecoratedSmoothedSS:%d, HiPwrUpperTh = %d \n", priv->UndecoratedSmoothedSS, HiPwrUpperTh ); */
priv->bToUpdateTxPwr = true;
u1bTmp= read_nic_byte(dev, CCK_TXAGC);
- // If it never enter High Power.
+ /* If it never enter High Power. */
if (CckTxPwrIdx == u1bTmp) {
- u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0; // 8dbm
+ u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0; /* 8dbm */
write_nic_byte(dev, CCK_TXAGC, u1bTmp);
u1bTmp= read_nic_byte(dev, OFDM_TXAGC);
- u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0; // 8dbm
+ u1bTmp = (u1bTmp > 16) ? (u1bTmp -16): 0; /* 8dbm */
write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
}
} else if ((priv->UndecoratedSmoothedSS < HiPwrLowerTh) &&
(!priv->bCurCCKPkt || priv->CurCCKRSSI < RSSIHiPwrLowerTh)) {
- // printk("DoTxHighPower() - lower Power - UndecoratedSmoothedSS:%d, HiPwrUpperTh = %d \n", priv->UndecoratedSmoothedSS, HiPwrLowerTh );
+ /* printk("DoTxHighPower() - lower Power - UndecoratedSmoothedSS:%d, HiPwrUpperTh = %d \n", priv->UndecoratedSmoothedSS, HiPwrLowerTh ); */
if (priv->bToUpdateTxPwr) {
priv->bToUpdateTxPwr = false;
- //SD3 required.
+ /* SD3 required. */
u1bTmp= read_nic_byte(dev, CCK_TXAGC);
if (u1bTmp < CckTxPwrIdx) {
- //u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16); // 8dbm
- //write_nic_byte(dev, CCK_TXAGC, u1bTmp);
+ /* u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16); 8dbm */
+ /* write_nic_byte(dev, CCK_TXAGC, u1bTmp); */
write_nic_byte(dev, CCK_TXAGC, CckTxPwrIdx);
}
u1bTmp= read_nic_byte(dev, OFDM_TXAGC);
if (u1bTmp < OfdmTxPwrIdx) {
- //u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16); // 8dbm
- //write_nic_byte(dev, OFDM_TXAGC, u1bTmp);
+ /* u1bTmp = ((u1bTmp+16) > 35) ? 35: (u1bTmp+16); 8dbm */
+ /* write_nic_byte(dev, OFDM_TXAGC, u1bTmp); */
write_nic_byte(dev, OFDM_TXAGC, OfdmTxPwrIdx);
}
}
}
- //printk("<---- DoTxHighPower()\n");
+ /* printk("<---- DoTxHighPower()\n"); */
}
-//
-// Description:
-// Callback function of UpdateTxPowerWorkItem.
-// Because of some event happened, e.g. CCX TPC, High Power Mechanism,
-// We update Tx power of current channel again.
-//
+/*
+ * Description:
+ * Callback function of UpdateTxPowerWorkItem.
+ * Because of some event happened, e.g. CCX TPC, High Power Mechanism,
+ * We update Tx power of current channel again.
+ */
void rtl8180_tx_pw_wq(struct work_struct *work)
{
-// struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
-// struct ieee80211_device * ieee = (struct ieee80211_device*)
-// container_of(work, struct ieee80211_device, watch_dog_wq);
+/* struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
+ * struct ieee80211_device * ieee = (struct ieee80211_device*)
+ * container_of(work, struct ieee80211_device, watch_dog_wq);
+ */
struct delayed_work *dwork = to_delayed_work(work);
struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,tx_pw_wq);
struct net_device *dev = ieee->dev;
-// printk("----> UpdateTxPowerWorkItemCallback()\n");
+/* printk("----> UpdateTxPowerWorkItemCallback()\n"); */
DoTxHighPower(dev);
-// printk("<---- UpdateTxPowerWorkItemCallback()\n");
+/* printk("<---- UpdateTxPowerWorkItemCallback()\n"); */
}
-//
-// Description:
-// Return TRUE if we shall perform DIG Mecahnism, FALSE otherwise.
-//
+/*
+ * Description:
+ * Return TRUE if we shall perform DIG Mecahnism, FALSE otherwise.
+ */
bool CheckDig(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
@@ -144,72 +149,72 @@ bool CheckDig(struct net_device *dev)
if (ieee->state != IEEE80211_LINKED)
return false;
- //if(priv->CurrentOperaRate < 36) // Schedule Dig under all OFDM rates. By Bruce, 2007-06-01.
- if ((priv->ieee80211->rate / 5) < 36) // Schedule Dig under all OFDM rates. By Bruce, 2007-06-01.
+ /* if(priv->CurrentOperaRate < 36) // Schedule Dig under all OFDM rates. By Bruce, 2007-06-01. */
+ if ((priv->ieee80211->rate / 5) < 36) /* Schedule Dig under all OFDM rates. By Bruce, 2007-06-01. */
return false;
return true;
}
-//
-// Description:
-// Implementation of DIG for Zebra and Zebra2.
-//
+/*
+ * Description:
+ * Implementation of DIG for Zebra and Zebra2.
+ */
void DIG_Zebra(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
u16 CCKFalseAlarm, OFDMFalseAlarm;
u16 OfdmFA1, OfdmFA2;
- int InitialGainStep = 7; // The number of initial gain stages.
- int LowestGainStage = 4; // The capable lowest stage of performing dig workitem.
+ int InitialGainStep = 7; /* The number of initial gain stages. */
+ int LowestGainStage = 4; /* The capable lowest stage of performing dig workitem. */
u32 AwakePeriodIn2Sec = 0;
- //printk("---------> DIG_Zebra()\n");
+ /* printk("---------> DIG_Zebra()\n"); */
CCKFalseAlarm = (u16)(priv->FalseAlarmRegValue & 0x0000ffff);
OFDMFalseAlarm = (u16)((priv->FalseAlarmRegValue >> 16) & 0x0000ffff);
OfdmFA1 = 0x15;
OfdmFA2 = ((u16)(priv->RegDigOfdmFaUpTh)) << 8;
-// printk("DIG**********CCK False Alarm: %#X \n",CCKFalseAlarm);
-// printk("DIG**********OFDM False Alarm: %#X \n",OFDMFalseAlarm);
+/* printk("DIG**********CCK False Alarm: %#X \n",CCKFalseAlarm); */
+/* printk("DIG**********OFDM False Alarm: %#X \n",OFDMFalseAlarm); */
- // The number of initial gain steps is different, by Bruce, 2007-04-13.
- if (priv->InitialGain == 0) { //autoDIG
- // Advised from SD3 DZ
- priv->InitialGain = 4; // In 87B, m74dBm means State 4 (m82dBm)
+ /* The number of initial gain steps is different, by Bruce, 2007-04-13. */
+ if (priv->InitialGain == 0) { /* autoDIG */
+ /* Advised from SD3 DZ */
+ priv->InitialGain = 4; /* In 87B, m74dBm means State 4 (m82dBm) */
}
- // Advised from SD3 DZ
+ /* Advised from SD3 DZ */
OfdmFA1 = 0x20;
-#if 1 //lzm reserved 080826
+#if 1 /* lzm reserved 080826 */
AwakePeriodIn2Sec = (2000 - priv->DozePeriodInPast2Sec);
- //printk("&&& DozePeriod=%d AwakePeriod=%d\n", priv->DozePeriodInPast2Sec, AwakePeriodIn2Sec);
+ /* printk("&&& DozePeriod=%d AwakePeriod=%d\n", priv->DozePeriodInPast2Sec, AwakePeriodIn2Sec); */
priv ->DozePeriodInPast2Sec = 0;
if (AwakePeriodIn2Sec) {
- //RT_TRACE(COMP_DIG, DBG_TRACE, ("DIG: AwakePeriodIn2Sec(%d) - FATh(0x%X , 0x%X) ->",AwakePeriodIn2Sec, OfdmFA1, OfdmFA2));
- // adjuest DIG threshold.
+ /* RT_TRACE(COMP_DIG, DBG_TRACE, ("DIG: AwakePeriodIn2Sec(%d) - FATh(0x%X , 0x%X) ->",AwakePeriodIn2Sec, OfdmFA1, OfdmFA2)); */
+ /* adjuest DIG threshold. */
OfdmFA1 = (u16)((OfdmFA1 * AwakePeriodIn2Sec) / 2000) ;
OfdmFA2 = (u16)((OfdmFA2 * AwakePeriodIn2Sec) / 2000) ;
- //RT_TRACE(COMP_DIG, DBG_TRACE, ("( 0x%X , 0x%X)\n", OfdmFA1, OfdmFA2));
+ /* RT_TRACE(COMP_DIG, DBG_TRACE, ("( 0x%X , 0x%X)\n", OfdmFA1, OfdmFA2)); */
} else {
- ;//RT_TRACE(COMP_DIG, DBG_WARNING, ("ERROR!! AwakePeriodIn2Sec should not be ZERO!!\n"));
+ ;/* RT_TRACE(COMP_DIG, DBG_WARNING, ("ERROR!! AwakePeriodIn2Sec should not be ZERO!!\n")); */
}
#endif
InitialGainStep = 8;
- LowestGainStage = priv->RegBModeGainStage; // Lowest gain stage.
+ LowestGainStage = priv->RegBModeGainStage; /* Lowest gain stage. */
if (OFDMFalseAlarm > OfdmFA1) {
if (OFDMFalseAlarm > OfdmFA2) {
priv->DIG_NumberFallbackVote++;
if (priv->DIG_NumberFallbackVote > 1) {
- //serious OFDM False Alarm, need fallback
+ /* serious OFDM False Alarm, need fallback */
if (priv->InitialGain < InitialGainStep) {
priv->InitialGainBackUp = priv->InitialGain;
priv->InitialGain = (priv->InitialGain + 1);
-// printk("DIG**********OFDM False Alarm: %#X, OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2);
-// printk("DIG+++++++ fallback OFDM:%d \n", priv->InitialGain);
+/* printk("DIG**********OFDM False Alarm: %#X, OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2); */
+/* printk("DIG+++++++ fallback OFDM:%d \n", priv->InitialGain); */
UpdateInitialGain(dev);
}
priv->DIG_NumberFallbackVote = 0;
@@ -226,12 +231,12 @@ void DIG_Zebra(struct net_device *dev)
priv->DIG_NumberUpgradeVote++;
if (priv->DIG_NumberUpgradeVote > 9) {
- if (priv->InitialGain > LowestGainStage) { // In 87B, m78dBm means State 4 (m864dBm)
+ if (priv->InitialGain > LowestGainStage) { /* In 87B, m78dBm means State 4 (m864dBm) */
priv->InitialGainBackUp = priv->InitialGain;
priv->InitialGain = (priv->InitialGain - 1);
-// printk("DIG**********OFDM False Alarm: %#X, OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2);
-// printk("DIG--------- Upgrade OFDM:%d \n", priv->InitialGain);
+/* printk("DIG**********OFDM False Alarm: %#X, OfdmFA1: %#X, OfdmFA2: %#X\n", OFDMFalseAlarm, OfdmFA1, OfdmFA2); */
+/* printk("DIG--------- Upgrade OFDM:%d \n", priv->InitialGain); */
UpdateInitialGain(dev);
}
priv->DIG_NumberFallbackVote = 0;
@@ -239,14 +244,14 @@ void DIG_Zebra(struct net_device *dev)
}
}
-// printk("DIG+++++++ OFDM:%d\n", priv->InitialGain);
- //printk("<--------- DIG_Zebra()\n");
+/* printk("DIG+++++++ OFDM:%d\n", priv->InitialGain); */
+/* printk("<--------- DIG_Zebra()\n"); */
}
-//
-// Description:
-// Dispatch DIG implementation according to RF.
-//
+/*
+ * Description:
+ * Dispatch DIG implementation according to RF.
+ */
void DynamicInitGain(struct net_device *dev)
{
DIG_Zebra(dev);
@@ -259,11 +264,11 @@ void rtl8180_hw_dig_wq(struct work_struct *work)
struct net_device *dev = ieee->dev;
struct r8180_priv *priv = ieee80211_priv(dev);
- // Read CCK and OFDM False Alarm.
+ /* Read CCK and OFDM False Alarm. */
priv->FalseAlarmRegValue = read_nic_dword(dev, CCK_FALSE_ALARM);
- // Adjust Initial Gain dynamically.
+ /* Adjust Initial Gain dynamically. */
DynamicInitGain(dev);
}
@@ -296,52 +301,52 @@ int IncludedInSupportedRates(struct r8180_priv *priv, u8 TxRate)
return Found;
}
-//
-// Description:
-// Get the Tx rate one degree up form the input rate in the supported rates.
-// Return the upgrade rate if it is successed, otherwise return the input rate.
-// By Bruce, 2007-06-05.
-//
+/*
+ * Description:
+ * Get the Tx rate one degree up form the input rate in the supported rates.
+ * Return the upgrade rate if it is successed, otherwise return the input rate.
+ * By Bruce, 2007-06-05.
+ */
u8 GetUpgradeTxRate(struct net_device *dev, u8 rate)
{
struct r8180_priv *priv = ieee80211_priv(dev);
u8 UpRate;
- // Upgrade 1 degree.
+ /* Upgrade 1 degree. */
switch (rate) {
- case 108: // Up to 54Mbps.
+ case 108: /* Up to 54Mbps. */
UpRate = 108;
break;
- case 96: // Up to 54Mbps.
+ case 96: /* Up to 54Mbps. */
UpRate = 108;
break;
- case 72: // Up to 48Mbps.
+ case 72: /* Up to 48Mbps. */
UpRate = 96;
break;
- case 48: // Up to 36Mbps.
+ case 48: /* Up to 36Mbps. */
UpRate = 72;
break;
- case 36: // Up to 24Mbps.
+ case 36: /* Up to 24Mbps. */
UpRate = 48;
break;
- case 22: // Up to 18Mbps.
+ case 22: /* Up to 18Mbps. */
UpRate = 36;
break;
- case 11: // Up to 11Mbps.
+ case 11: /* Up to 11Mbps. */
UpRate = 22;
break;
- case 4: // Up to 5.5Mbps.
+ case 4: /* Up to 5.5Mbps. */
UpRate = 11;
break;
- case 2: // Up to 2Mbps.
+ case 2: /* Up to 2Mbps. */
UpRate = 4;
break;
@@ -349,62 +354,63 @@ u8 GetUpgradeTxRate(struct net_device *dev, u8 rate)
printk("GetUpgradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate);
return rate;
}
- // Check if the rate is valid.
+ /* Check if the rate is valid. */
if (IncludedInSupportedRates(priv, UpRate)) {
-// printk("GetUpgradeTxRate(): GetUpgrade Tx rate(%d) from %d !\n", UpRate, priv->CurrentOperaRate);
+/* printk("GetUpgradeTxRate(): GetUpgrade Tx rate(%d) from %d !\n", UpRate, priv->CurrentOperaRate); */
return UpRate;
} else {
- //printk("GetUpgradeTxRate(): Tx rate (%d) is not in supported rates\n", UpRate);
+ /* printk("GetUpgradeTxRate(): Tx rate (%d) is not in supported rates\n", UpRate); */
return rate;
}
return rate;
}
-//
-// Description:
-// Get the Tx rate one degree down form the input rate in the supported rates.
-// Return the degrade rate if it is successed, otherwise return the input rate.
-// By Bruce, 2007-06-05.
-//
+/*
+ * Description:
+ * Get the Tx rate one degree down form the input rate in the supported rates.
+ * Return the degrade rate if it is successed, otherwise return the input rate.
+ * By Bruce, 2007-06-05.
+ */
+
u8 GetDegradeTxRate(struct net_device *dev, u8 rate)
{
struct r8180_priv *priv = ieee80211_priv(dev);
u8 DownRate;
- // Upgrade 1 degree.
+ /* Upgrade 1 degree. */
switch (rate) {
- case 108: // Down to 48Mbps.
+ case 108: /* Down to 48Mbps. */
DownRate = 96;
break;
- case 96: // Down to 36Mbps.
+ case 96: /* Down to 36Mbps. */
DownRate = 72;
break;
- case 72: // Down to 24Mbps.
+ case 72: /* Down to 24Mbps. */
DownRate = 48;
break;
- case 48: // Down to 18Mbps.
+ case 48: /* Down to 18Mbps. */
DownRate = 36;
break;
- case 36: // Down to 11Mbps.
+ case 36: /* Down to 11Mbps. */
DownRate = 22;
break;
- case 22: // Down to 5.5Mbps.
+ case 22: /* Down to 5.5Mbps. */
DownRate = 11;
break;
- case 11: // Down to 2Mbps.
+ case 11: /* Down to 2Mbps. */
DownRate = 4;
break;
- case 4: // Down to 1Mbps.
+ case 4: /* Down to 1Mbps. */
DownRate = 2;
break;
- case 2: // Down to 1Mbps.
+ case 2: /* Down to 1Mbps. */
DownRate = 2;
break;
@@ -412,21 +418,22 @@ u8 GetDegradeTxRate(struct net_device *dev, u8 rate)
printk("GetDegradeTxRate(): Input Tx Rate(%d) is undefined!\n", rate);
return rate;
}
- // Check if the rate is valid.
+ /* Check if the rate is valid. */
if (IncludedInSupportedRates(priv, DownRate)) {
-// printk("GetDegradeTxRate(): GetDegrade Tx rate(%d) from %d!\n", DownRate, priv->CurrentOperaRate);
+/* printk("GetDegradeTxRate(): GetDegrade Tx rate(%d) from %d!\n", DownRate, priv->CurrentOperaRate); */
return DownRate;
} else {
- //printk("GetDegradeTxRate(): Tx rate (%d) is not in supported rates\n", DownRate);
+ /* printk("GetDegradeTxRate(): Tx rate (%d) is not in supported rates\n", DownRate); */
return rate;
}
return rate;
}
-//
-// Helper function to determine if specified data rate is
-// CCK rate.
-// 2005.01.25, by rcnjko.
-//
+/*
+ * Helper function to determine if specified data rate is
+ * CCK rate.
+ * 2005.01.25, by rcnjko.
+ */
+
bool MgntIsCckRate(u16 rate)
{
bool bReturn = false;
@@ -437,43 +444,43 @@ bool MgntIsCckRate(u16 rate)
return bReturn;
}
-//
-// Description:
-// Tx Power tracking mechanism routine on 87SE.
-// Created by Roger, 2007.12.11.
-//
+/*
+ * Description:
+ * Tx Power tracking mechanism routine on 87SE.
+ * Created by Roger, 2007.12.11.
+ */
void TxPwrTracking87SE(struct net_device *dev)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
u8 tmpu1Byte, CurrentThermal, Idx;
char CckTxPwrIdx, OfdmTxPwrIdx;
- //u32 u4bRfReg;
+ /* u32 u4bRfReg; */
tmpu1Byte = read_nic_byte(dev, EN_LPF_CAL);
- CurrentThermal = (tmpu1Byte & 0xf0) >> 4; //[ 7:4]: thermal meter indication.
- CurrentThermal = (CurrentThermal > 0x0c) ? 0x0c:CurrentThermal;//lzm add 080826
+ CurrentThermal = (tmpu1Byte & 0xf0) >> 4; /*[ 7:4]: thermal meter indication. */
+ CurrentThermal = (CurrentThermal > 0x0c) ? 0x0c:CurrentThermal;/* lzm add 080826 */
- //printk("TxPwrTracking87SE(): CurrentThermal(%d)\n", CurrentThermal);
+ /* printk("TxPwrTracking87SE(): CurrentThermal(%d)\n", CurrentThermal); */
if (CurrentThermal != priv->ThermalMeter) {
-// printk("TxPwrTracking87SE(): Thermal meter changed!!!\n");
+/* printk("TxPwrTracking87SE(): Thermal meter changed!!!\n"); */
- // Update Tx Power level on each channel.
+ /* Update Tx Power level on each channel. */
for (Idx = 1; Idx < 15; Idx++) {
CckTxPwrIdx = priv->chtxpwr[Idx];
OfdmTxPwrIdx = priv->chtxpwr_ofdm[Idx];
if (CurrentThermal > priv->ThermalMeter) {
- // higher thermal meter.
+ /* higher thermal meter. */
CckTxPwrIdx += (CurrentThermal - priv->ThermalMeter) * 2;
OfdmTxPwrIdx += (CurrentThermal - priv->ThermalMeter) * 2;
if (CckTxPwrIdx > 35)
- CckTxPwrIdx = 35; // Force TxPower to maximal index.
+ CckTxPwrIdx = 35; /* Force TxPower to maximal index. */
if (OfdmTxPwrIdx > 35)
OfdmTxPwrIdx = 35;
} else {
- // lower thermal meter.
+ /* lower thermal meter. */
CckTxPwrIdx -= (priv->ThermalMeter - CurrentThermal) * 2;
OfdmTxPwrIdx -= (priv->ThermalMeter - CurrentThermal) * 2;
@@ -483,12 +490,12 @@ void TxPwrTracking87SE(struct net_device *dev)
OfdmTxPwrIdx = 0;
}
- // Update TxPower level on CCK and OFDM resp.
+ /* Update TxPower level on CCK and OFDM resp. */
priv->chtxpwr[Idx] = CckTxPwrIdx;
priv->chtxpwr_ofdm[Idx] = OfdmTxPwrIdx;
}
- // Update TxPower level immediately.
+ /* Update TxPower level immediately. */
rtl8225z2_SetTXPowerLevel(dev, priv->ieee80211->current_network.channel);
}
priv->ThermalMeter = CurrentThermal;
@@ -499,7 +506,7 @@ void StaRateAdaptive87SE(struct net_device *dev)
unsigned long CurrTxokCnt;
u16 CurrRetryCnt;
u16 CurrRetryRate;
- //u16 i,idx;
+ /*u16 i,idx; */
unsigned long CurrRxokCnt;
bool bTryUp = false;
bool bTryDown = false;
@@ -521,345 +528,353 @@ void StaRateAdaptive87SE(struct net_device *dev)
TxThroughput = (u32)(priv->NumTxOkBytesTotal - priv->LastTxOKBytes);
priv->LastTxOKBytes = priv->NumTxOkBytesTotal;
priv->CurrentOperaRate = priv->ieee80211->rate / 5;
- //printk("priv->CurrentOperaRate is %d\n",priv->CurrentOperaRate);
- //2 Compute retry ratio.
+ /* printk("priv->CurrentOperaRate is %d\n",priv->CurrentOperaRate); */
+ /* 2 Compute retry ratio. */
if (CurrTxokCnt > 0) {
CurrRetryRate = (u16)(CurrRetryCnt * 100 / CurrTxokCnt);
} else {
- // It may be serious retry. To distinguish serious retry or no packets modified by Bruce
+ /* It may be serious retry. To distinguish serious retry or no packets modified by Bruce */
CurrRetryRate = (u16)(CurrRetryCnt * 100 / 1);
}
- //
- // Added by Roger, 2007.01.02.
- // For debug information.
- //
- //printk("\n(1) pHalData->LastRetryRate: %d \n",priv->LastRetryRate);
- //printk("(2) RetryCnt = %d \n", CurrRetryCnt);
- //printk("(3) TxokCnt = %d \n", CurrTxokCnt);
- //printk("(4) CurrRetryRate = %d \n", CurrRetryRate);
- //printk("(5) CurrSignalStrength = %d \n",CurrSignalStrength);
- //printk("(6) TxThroughput is %d\n",TxThroughput);
- //printk("priv->NumTxOkBytesTotal is %d\n",priv->NumTxOkBytesTotal);
+ /*
+ * Added by Roger, 2007.01.02.
+ * For debug information.
+ *
+ * printk("\n(1) pHalData->LastRetryRate: %d \n",priv->LastRetryRate);
+ * printk("(2) RetryCnt = %d \n", CurrRetryCnt);
+ * printk("(3) TxokCnt = %d \n", CurrTxokCnt);
+ * printk("(4) CurrRetryRate = %d \n", CurrRetryRate);
+ * printk("(5) CurrSignalStrength = %d \n",CurrSignalStrength);
+ * printk("(6) TxThroughput is %d\n",TxThroughput);
+ * printk("priv->NumTxOkBytesTotal is %d\n",priv->NumTxOkBytesTotal);
+ */
priv->LastRetryCnt = priv->CurrRetryCnt;
priv->LastTxokCnt = priv->NumTxOkTotal;
priv->LastRxokCnt = priv->ieee80211->NumRxOkTotal;
priv->CurrRetryCnt = 0;
- //2No Tx packets, return to init_rate or not?
+ /* 2No Tx packets, return to init_rate or not? */
if (CurrRetryRate == 0 && CurrTxokCnt == 0) {
- //
- //After 9 (30*300ms) seconds in this condition, we try to raise rate.
- //
+ /*
+ * After 9 (30*300ms) seconds in this condition, we try to raise rate.
+ */
priv->TryupingCountNoData++;
-// printk("No Tx packets, TryupingCountNoData(%d)\n", priv->TryupingCountNoData);
- //[TRC Dell Lab] Extend raised period from 4.5sec to 9sec, Isaiah 2008-02-15 18:00
+/* printk("No Tx packets, TryupingCountNoData(%d)\n", priv->TryupingCountNoData); */
+ /* [TRC Dell Lab] Extend raised period from 4.5sec to 9sec, Isaiah 2008-02-15 18:00 */
if (priv->TryupingCountNoData > 30) {
priv->TryupingCountNoData = 0;
priv->CurrentOperaRate = GetUpgradeTxRate(dev, priv->CurrentOperaRate);
- // Reset Fail Record
+ /* Reset Fail Record */
priv->LastFailTxRate = 0;
priv->LastFailTxRateSS = -200;
priv->FailTxRateCount = 0;
}
goto SetInitialGain;
} else {
- priv->TryupingCountNoData = 0; //Reset trying up times.
+ priv->TryupingCountNoData = 0; /*Reset trying up times. */
}
- //
- // For Netgear case, I comment out the following signal strength estimation,
- // which can results in lower rate to transmit when sample is NOT enough (e.g. PING request).
- // 2007.04.09, by Roger.
- //
-
- //
- // Restructure rate adaptive as the following main stages:
- // (1) Add retry threshold in 54M upgrading condition with signal strength.
- // (2) Add the mechanism to degrade to CCK rate according to signal strength
- // and retry rate.
- // (3) Remove all Initial Gain Updates over OFDM rate. To avoid the complicated
- // situation, Initial Gain Update is upon on DIG mechanism except CCK rate.
- // (4) Add the mehanism of trying to upgrade tx rate.
- // (5) Record the information of upping tx rate to avoid trying upping tx rate constantly.
- // By Bruce, 2007-06-05.
- //
- //
-
- // 11Mbps or 36Mbps
- // Check more times in these rate(key rates).
- //
+ /*
+ * For Netgear case, I comment out the following signal strength estimation,
+ * which can results in lower rate to transmit when sample is NOT enough (e.g. PING request).
+ * 2007.04.09, by Roger.
+ *
+ *
+ *
+ * Restructure rate adaptive as the following main stages:
+ * (1) Add retry threshold in 54M upgrading condition with signal strength.
+ * (2) Add the mechanism to degrade to CCK rate according to signal strength
+ * and retry rate.
+ * (3) Remove all Initial Gain Updates over OFDM rate. To avoid the complicated
+ * situation, Initial Gain Update is upon on DIG mechanism except CCK rate.
+ * (4) Add the mehanism of trying to upgrade tx rate.
+ * (5) Record the information of upping tx rate to avoid trying upping tx rate constantly.
+ * By Bruce, 2007-06-05.
+ *
+ */
+
+ /*
+ * 11Mbps or 36Mbps
+ * Check more times in these rate(key rates).
+ */
if (priv->CurrentOperaRate == 22 || priv->CurrentOperaRate == 72)
TryUpTh += 9;
- //
- // Let these rates down more difficult.
- //
+ /*
+ * Let these rates down more difficult.
+ */
if (MgntIsCckRate(priv->CurrentOperaRate) || priv->CurrentOperaRate == 36)
TryDownTh += 1;
- //1 Adjust Rate.
+ /* 1 Adjust Rate. */
if (priv->bTryuping == true) {
- //2 For Test Upgrading mechanism
- // Note:
- // Sometimes the throughput is upon on the capability bwtween the AP and NIC,
- // thus the low data rate does not improve the performance.
- // We randomly upgrade the data rate and check if the retry rate is improved.
-
- // Upgrading rate did not improve the retry rate, fallback to the original rate.
+ /* 2 For Test Upgrading mechanism
+ * Note:
+ * Sometimes the throughput is upon on the capability bwtween the AP and NIC,
+ * thus the low data rate does not improve the performance.
+ * We randomly upgrade the data rate and check if the retry rate is improved.
+ */
+
+ /* Upgrading rate did not improve the retry rate, fallback to the original rate. */
if ((CurrRetryRate > 25) && TxThroughput < priv->LastTxThroughput) {
- //Not necessary raising rate, fall back rate.
+ /*Not necessary raising rate, fall back rate. */
bTryDown = true;
- //printk("case1-1: Not necessary raising rate, fall back rate....\n");
- //printk("case1-1: pMgntInfo->CurrentOperaRate =%d, TxThroughput = %d, LastThroughput = %d\n",
- // priv->CurrentOperaRate, TxThroughput, priv->LastTxThroughput);
+ /* printk("case1-1: Not necessary raising rate, fall back rate....\n"); */
+ /* printk("case1-1: pMgntInfo->CurrentOperaRate =%d, TxThroughput = %d, LastThroughput = %d\n", */
+ /* priv->CurrentOperaRate, TxThroughput, priv->LastTxThroughput); */
} else {
priv->bTryuping = false;
}
} else if (CurrSignalStrength > -47 && (CurrRetryRate < 50)) {
- //2For High Power
- //
- // Added by Roger, 2007.04.09.
- // Return to highest data rate, if signal strength is good enough.
- // SignalStrength threshold(-50dbm) is for RTL8186.
- // Revise SignalStrength threshold to -51dbm.
- //
- // Also need to check retry rate for safety, by Bruce, 2007-06-05.
+ /*
+ * 2For High Power
+ *
+ * Added by Roger, 2007.04.09.
+ * Return to highest data rate, if signal strength is good enough.
+ * SignalStrength threshold(-50dbm) is for RTL8186.
+ * Revise SignalStrength threshold to -51dbm.
+ */
+ /* Also need to check retry rate for safety, by Bruce, 2007-06-05. */
if (priv->CurrentOperaRate != priv->ieee80211->current_network.HighestOperaRate) {
bTryUp = true;
- // Upgrade Tx Rate directly.
+ /* Upgrade Tx Rate directly. */
priv->TryupingCount += TryUpTh;
}
-// printk("case2: StaRateAdaptive87SE: Power(%d) is high enough!!. \n", CurrSignalStrength);
+/* printk("case2: StaRateAdaptive87SE: Power(%d) is high enough!!. \n", CurrSignalStrength); */
} else if (CurrTxokCnt > 9 && CurrTxokCnt < 100 && CurrRetryRate >= 600) {
- //2 For Serious Retry
- //
- // Traffic is not busy but our Tx retry is serious.
- //
+ /*
+ *2 For Serious Retry
+ *
+ * Traffic is not busy but our Tx retry is serious.
+ */
bTryDown = true;
- // Let Rate Mechanism to degrade tx rate directly.
+ /* Let Rate Mechanism to degrade tx rate directly. */
priv->TryDownCountLowData += TryDownTh;
-// printk("case3: RA: Tx Retry is serious. Degrade Tx Rate to %d directly...\n", priv->CurrentOperaRate);
+/* printk("case3: RA: Tx Retry is serious. Degrade Tx Rate to %d directly...\n", priv->CurrentOperaRate); */
} else if (priv->CurrentOperaRate == 108) {
- //2For 54Mbps
- // Air Link
+ /* 2For 54Mbps */
+ /* Air Link */
if ((CurrRetryRate > 26) && (priv->LastRetryRate > 25)) {
-// if ((CurrRetryRate>40)&&(priv->LastRetryRate>39))
- //Down to rate 48Mbps.
+/* if ((CurrRetryRate>40)&&(priv->LastRetryRate>39)) */
+ /*Down to rate 48Mbps. */
bTryDown = true;
}
- // Cable Link
+ /* Cable Link */
else if ((CurrRetryRate > 17) && (priv->LastRetryRate > 16) && (CurrSignalStrength > -72)) {
-// else if ((CurrRetryRate>17)&&(priv->LastRetryRate>16) && (CurrSignalStrength > -72))
- //Down to rate 48Mbps.
+/* else if ((CurrRetryRate>17)&&(priv->LastRetryRate>16) && (CurrSignalStrength > -72)) */
+ /*Down to rate 48Mbps. */
bTryDown = true;
}
- if (bTryDown && (CurrSignalStrength < -75)) //cable link
+ if (bTryDown && (CurrSignalStrength < -75)) /* cable link */
priv->TryDownCountLowData += TryDownTh;
- //printk("case4---54M \n");
+ /*printk("case4---54M \n"); */
}
else if (priv->CurrentOperaRate == 96) {
- //2For 48Mbps
- //Air Link
+ /* 2For 48Mbps */
+ /* Air Link */
if (((CurrRetryRate > 48) && (priv->LastRetryRate > 47))) {
-// if ( ((CurrRetryRate>65) && (priv->LastRetryRate>64)))
- //Down to rate 36Mbps.
+/* if ( ((CurrRetryRate>65) && (priv->LastRetryRate>64))) */
+ /* Down to rate 36Mbps. */
bTryDown = true;
- } else if (((CurrRetryRate > 21) && (priv->LastRetryRate > 20)) && (CurrSignalStrength > -74)) { //Cable Link
- //Down to rate 36Mbps.
+ } else if (((CurrRetryRate > 21) && (priv->LastRetryRate > 20)) && (CurrSignalStrength > -74)) { /* Cable Link */
+ /* Down to rate 36Mbps. */
bTryDown = true;
} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) {
-// else if((CurrRetryRate> (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
+/* else if((CurrRetryRate> (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 )) */
bTryDown = true;
priv->TryDownCountLowData += TryDownTh;
- } else if ((CurrRetryRate < 8) && (priv->LastRetryRate < 8)) { //TO DO: need to consider (RSSI)
-// else if ( (CurrRetryRate<28) && (priv->LastRetryRate<8) )
+ } else if ((CurrRetryRate < 8) && (priv->LastRetryRate < 8)) { /* TO DO: need to consider (RSSI) */
+/* else if ( (CurrRetryRate<28) && (priv->LastRetryRate<8) ) */
bTryUp = true;
}
if (bTryDown && (CurrSignalStrength < -75)){
priv->TryDownCountLowData += TryDownTh;
}
- //printk("case5---48M \n");
+ /* printk("case5---48M \n"); */
} else if (priv->CurrentOperaRate == 72) {
- //2For 36Mbps
+ /* 2For 36Mbps */
if ((CurrRetryRate > 43) && (priv->LastRetryRate > 41)) {
-// if ( (CurrRetryRate>60) && (priv->LastRetryRate>59))
- //Down to rate 24Mbps.
+/* if ( (CurrRetryRate>60) && (priv->LastRetryRate>59)) */
+ /* Down to rate 24Mbps. */
bTryDown = true;
} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) {
-// else if((CurrRetryRate> (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
+/* else if((CurrRetryRate> (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 )) */
bTryDown = true;
priv->TryDownCountLowData += TryDownTh;
- } else if ((CurrRetryRate < 15) && (priv->LastRetryRate < 16)) { //TO DO: need to consider (RSSI)
-// else if ( (CurrRetryRate<35) && (priv->LastRetryRate<36))
+ } else if ((CurrRetryRate < 15) && (priv->LastRetryRate < 16)) { /* TO DO: need to consider (RSSI) */
+/* else if ( (CurrRetryRate<35) && (priv->LastRetryRate<36)) */
bTryUp = true;
}
if (bTryDown && (CurrSignalStrength < -80))
priv->TryDownCountLowData += TryDownTh;
- //printk("case6---36M \n");
+ /* printk("case6---36M \n"); */
} else if (priv->CurrentOperaRate == 48) {
- //2For 24Mbps
- // Air Link
+ /* 2For 24Mbps */
+ /* Air Link */
if (((CurrRetryRate > 63) && (priv->LastRetryRate > 62))) {
-// if ( ((CurrRetryRate>83) && (priv->LastRetryRate>82)))
- //Down to rate 18Mbps.
+/* if ( ((CurrRetryRate>83) && (priv->LastRetryRate>82))) */
+ /* Down to rate 18Mbps. */
bTryDown = true;
- } else if (((CurrRetryRate > 33) && (priv->LastRetryRate > 32)) && (CurrSignalStrength > -82)) { //Cable Link
-// else if ( ((CurrRetryRate>50) && (priv->LastRetryRate>49)) && (CurrSignalStrength > -82) )
- //Down to rate 18Mbps.
+ } else if (((CurrRetryRate > 33) && (priv->LastRetryRate > 32)) && (CurrSignalStrength > -82)) { /* Cable Link */
+/* else if ( ((CurrRetryRate>50) && (priv->LastRetryRate>49)) && (CurrSignalStrength > -82) ) */
+ /* Down to rate 18Mbps. */
bTryDown = true;
} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2 )) {
-// else if((CurrRetryRate> (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
+/* else if((CurrRetryRate> (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 )) */
bTryDown = true;
priv->TryDownCountLowData += TryDownTh;
- } else if ((CurrRetryRate < 20) && (priv->LastRetryRate < 21)) { //TO DO: need to consider (RSSI)
-// else if ( (CurrRetryRate<40) && (priv->LastRetryRate<41))
+ } else if ((CurrRetryRate < 20) && (priv->LastRetryRate < 21)) { /* TO DO: need to consider (RSSI) */
+/* else if ( (CurrRetryRate<40) && (priv->LastRetryRate<41)) */
bTryUp = true;
}
if (bTryDown && (CurrSignalStrength < -82))
priv->TryDownCountLowData += TryDownTh;
- //printk("case7---24M \n");
+ /* printk("case7---24M \n"); */
} else if (priv->CurrentOperaRate == 36) {
- //2For 18Mbps
- // original (109, 109)
- //[TRC Dell Lab] (90, 91), Isaiah 2008-02-18 23:24
- // (85, 86), Isaiah 2008-02-18 24:00
+ /* 2For 18Mbps
+ * original (109, 109)
+ * [TRC Dell Lab] (90, 91), Isaiah 2008-02-18 23:24
+ * (85, 86), Isaiah 2008-02-18 24:00
+ */
if (((CurrRetryRate > 85) && (priv->LastRetryRate > 86))) {
-// if ( ((CurrRetryRate>115) && (priv->LastRetryRate>116)))
- //Down to rate 11Mbps.
+/* if ( ((CurrRetryRate>115) && (priv->LastRetryRate>116))) */
+ /* Down to rate 11Mbps. */
bTryDown = true;
- //[TRC Dell Lab] Isaiah 2008-02-18 23:24
+ /* [TRC Dell Lab] Isaiah 2008-02-18 23:24 */
} else if ((CurrRetryRate > (priv->LastRetryRate + 50)) && (priv->FailTxRateCount > 2)) {
-// else if((CurrRetryRate> (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 ))
+/* else if((CurrRetryRate> (priv->LastRetryRate + 70 )) && (priv->FailTxRateCount >2 )) */
bTryDown = true;
priv->TryDownCountLowData += TryDownTh;
- } else