Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Staging: winbond: mto.c Coding style fixes

I changed all things reported by checkpatch.pl except some long lines
and the use of externs in a .c file. I also removed revision comments
and "commented out" code.

Signed-off-by: Lars Lindley <lindley@coyote.org>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Lars Lindley and committed by
Greg Kroah-Hartman
f9a4191c 75df20e0

+123 -164
+123 -164
drivers/staging/winbond/mto.c
··· 1 - //============================================================================ 2 - // MTO.C - 3 - // 4 - // Description: 5 - // MAC Throughput Optimization for W89C33 802.11g WLAN STA. 6 - // 7 - // The following MIB attributes or internal variables will be affected 8 - // while the MTO is being executed: 9 - // dot11FragmentationThreshold, 10 - // dot11RTSThreshold, 11 - // transmission rate and PLCP preamble type, 12 - // CCA mode, 13 - // antenna diversity. 14 - // 15 - // Revision history: 16 - // -------------------------------------------------------------------------- 17 - // 20031227 UN20 Pete Chao 18 - // First draft 19 - // 20031229 Turbo copy from PD43 20 - // 20040210 Kevin revised 21 - // Copyright (c) 2003 Winbond Electronics Corp. All rights reserved. 22 - //============================================================================ 1 + /* 2 + * ============================================================================ 3 + * MTO.C - 4 + * 5 + * Description: 6 + * MAC Throughput Optimization for W89C33 802.11g WLAN STA. 7 + * 8 + * The following MIB attributes or internal variables will be affected 9 + * while the MTO is being executed: 10 + * dot11FragmentationThreshold, 11 + * dot11RTSThreshold, 12 + * transmission rate and PLCP preamble type, 13 + * CCA mode, 14 + * antenna diversity. 15 + * 16 + * Copyright (c) 2003 Winbond Electronics Corp. All rights reserved. 17 + * ============================================================================ 18 + */ 23 19 24 - // LA20040210_DTO kevin 25 20 #include "sysdef.h" 26 21 #include "sme_api.h" 27 22 #include "wbhal_f.h" 28 23 29 - // Declare SQ3 to rate and fragmentation threshold table 30 - // Declare fragmentation thresholds table 31 - #define MTO_MAX_FRAG_TH_LEVELS 5 32 - #define MTO_MAX_DATA_RATE_LEVELS 12 24 + /* Declare SQ3 to rate and fragmentation threshold table */ 25 + /* Declare fragmentation thresholds table */ 26 + #define MTO_MAX_FRAG_TH_LEVELS 5 27 + #define MTO_MAX_DATA_RATE_LEVELS 12 33 28 34 - u16 MTO_Frag_Th_Tbl[MTO_MAX_FRAG_TH_LEVELS] = 35 - { 36 - 256, 384, 512, 768, 1536 29 + u16 MTO_Frag_Th_Tbl[MTO_MAX_FRAG_TH_LEVELS] = { 30 + 256, 384, 512, 768, 1536 37 31 }; 38 32 39 - // Declare data rate table 40 - //The following table will be changed at anytime if the opration rate supported by AP don't 41 - //match the table 33 + /* 34 + * Declare data rate table: 35 + * The following table will be changed at anytime if the opration rate 36 + * supported by AP don't match the table 37 + */ 42 38 static u8 MTO_Data_Rate_Tbl[MTO_MAX_DATA_RATE_LEVELS] = { 43 - 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 39 + 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 44 40 }; 45 41 46 - static int TotalTxPkt = 0; 47 - static int TotalTxPktRetry = 0; 48 - static int retryrate_rec[MTO_MAX_DATA_RATE_LEVELS];//this record the retry rate at different data rate 42 + static int TotalTxPkt; 43 + static int TotalTxPktRetry; 44 + /* this record the retry rate at different data rate */ 45 + static int retryrate_rec[MTO_MAX_DATA_RATE_LEVELS]; 49 46 50 - static int PeriodTotalTxPkt = 0; 51 - static int PeriodTotalTxPktRetry = 0; 47 + static int PeriodTotalTxPkt; 48 + static int PeriodTotalTxPktRetry; 52 49 53 - static u8 boSparseTxTraffic = false; 50 + static u8 boSparseTxTraffic; 54 51 55 52 void MTO_Init(struct wbsoft_priv *adapter); 56 53 void TxRateReductionCtrl(struct wbsoft_priv *adapter); 57 - /** 1.1.31.1000 Turbo modify */ 58 54 void MTO_SetTxCount(struct wbsoft_priv *adapter, u8 t0, u8 index); 59 55 void MTO_TxFailed(struct wbsoft_priv *adapter); 60 56 void hal_get_dto_para(struct wbsoft_priv *adapter, char *buffer); 61 57 62 - //=========================================================================== 63 - // MTO_Init -- 64 - // 65 - // Description: 66 - // Initialize MTO parameters. 67 - // 68 - // This function should be invoked during system initialization. 69 - // 70 - // Arguments: 71 - // adapter - The pointer to the Miniport adapter Context 72 - // 73 - // Return Value: 74 - // None 75 - //============================================================================ 58 + /* 59 + * =========================================================================== 60 + * MTO_Init -- 61 + * 62 + * Description: 63 + * Initialize MTO parameters. 64 + * 65 + * This function should be invoked during system initialization. 66 + * 67 + * Arguments: 68 + * adapter - The pointer to the Miniport adapter Context 69 + * =========================================================================== 70 + */ 76 71 void MTO_Init(struct wbsoft_priv *adapter) 77 72 { 78 - int i; 73 + int i; 79 74 80 - //[WKCHEN]MTO_CCA_MODE_SETUP()= (u8) hal_get_cca_mode(MTO_HAL()); 81 - //[WKCHEN]MTO_CCA_MODE() = MTO_CCA_MODE_SETUP(); 75 + MTO_PREAMBLE_TYPE() = MTO_PREAMBLE_SHORT; /* for test */ 82 76 83 - //MTO_PREAMBLE_TYPE() = MTO_PREAMBLE_LONG; 84 - MTO_PREAMBLE_TYPE() = MTO_PREAMBLE_SHORT; // for test 77 + MTO_CNT_ANT(0) = 0; 78 + MTO_CNT_ANT(1) = 0; 79 + MTO_SQ_ANT(0) = 0; 80 + MTO_SQ_ANT(1) = 0; 85 81 86 - MTO_CNT_ANT(0) = 0; 87 - MTO_CNT_ANT(1) = 0; 88 - MTO_SQ_ANT(0) = 0; 89 - MTO_SQ_ANT(1) = 0; 82 + MTO_AGING_TIMEOUT() = 0; 90 83 91 - MTO_AGING_TIMEOUT() = 0; 84 + /* The following parameters should be initialized to the values set by user */ 85 + MTO_RATE_LEVEL() = 0; 86 + MTO_FRAG_TH_LEVEL() = 4; 87 + MTO_RTS_THRESHOLD() = MTO_FRAG_TH() + 1; 88 + MTO_RTS_THRESHOLD_SETUP() = MTO_FRAG_TH() + 1; 89 + MTO_RATE_CHANGE_ENABLE() = 1; 90 + MTO_FRAG_CHANGE_ENABLE() = 0; 91 + MTO_POWER_CHANGE_ENABLE() = 1; 92 + MTO_PREAMBLE_CHANGE_ENABLE() = 1; 93 + MTO_RTS_CHANGE_ENABLE() = 0; 92 94 93 - // The following parameters should be initialized to the values set by user 94 - // 95 - //MTO_RATE_LEVEL() = 10; 96 - MTO_RATE_LEVEL() = 0; 97 - MTO_FRAG_TH_LEVEL() = 4; 98 - /** 1.1.23.1000 Turbo modify from -1 to +1 99 - MTO_RTS_THRESHOLD() = MTO_FRAG_TH() - 1; 100 - MTO_RTS_THRESHOLD_SETUP() = MTO_FRAG_TH() - 1; 101 - */ 102 - MTO_RTS_THRESHOLD() = MTO_FRAG_TH() + 1; 103 - MTO_RTS_THRESHOLD_SETUP() = MTO_FRAG_TH() + 1; 104 - // 1.1.23.1000 Turbo add for mto change preamble from 0 to 1 105 - MTO_RATE_CHANGE_ENABLE() = 1; 106 - MTO_FRAG_CHANGE_ENABLE() = 0; // 1.1.29.1000 Turbo add don't support frag 107 - //The default valud of ANTDIV_DEFAULT_ON will be decided by EEPROM 108 - //#ifdef ANTDIV_DEFAULT_ON 109 - //#else 110 - //#endif 111 - MTO_POWER_CHANGE_ENABLE() = 1; 112 - MTO_PREAMBLE_CHANGE_ENABLE()= 1; 113 - MTO_RTS_CHANGE_ENABLE() = 0; // 1.1.29.1000 Turbo add don't support frag 114 - // 20040512 Turbo add 115 - //old_antenna[0] = 1; 116 - //old_antenna[1] = 0; 117 - //old_antenna[2] = 1; 118 - //old_antenna[3] = 0; 119 - for (i=0;i<MTO_MAX_DATA_RATE_LEVELS;i++) 120 - retryrate_rec[i]=5; 95 + for (i = 0; i < MTO_MAX_DATA_RATE_LEVELS; i++) 96 + retryrate_rec[i] = 5; 121 97 122 98 MTO_TXFLOWCOUNT() = 0; 123 - //--------- DTO threshold parameters ------------- 124 - //MTOPARA_PERIODIC_CHECK_CYCLE() = 50; 125 - MTOPARA_PERIODIC_CHECK_CYCLE() = 10; 126 - MTOPARA_RSSI_TH_FOR_ANTDIV() = 10; 127 - MTOPARA_TXCOUNT_TH_FOR_CALC_RATE() = 50; 128 - MTOPARA_TXRATE_INC_TH() = 10; 129 - MTOPARA_TXRATE_DEC_TH() = 30; 130 - MTOPARA_TXRATE_EQ_TH() = 40; 131 - MTOPARA_TXRATE_BACKOFF() = 12; 132 - MTOPARA_TXRETRYRATE_REDUCE() = 6; 133 - if ( MTO_TXPOWER_FROM_EEPROM == 0xff) 134 - { 135 - switch( MTO_HAL()->phy_type) 136 - { 137 - case RF_AIROHA_2230: 138 - case RF_AIROHA_2230S: // 20060420 Add this 139 - MTOPARA_TXPOWER_INDEX() = 46; // MAX-8 // @@ Only for AL 2230 140 - break; 141 - case RF_AIROHA_7230: 142 - MTOPARA_TXPOWER_INDEX() = 49; 143 - break; 144 - case RF_WB_242: 145 - MTOPARA_TXPOWER_INDEX() = 10; 146 - break; 147 - case RF_WB_242_1: 148 - MTOPARA_TXPOWER_INDEX() = 24; // ->10 20060316.1 modify 149 - break; 99 + /* --------- DTO threshold parameters ------------- */ 100 + MTOPARA_PERIODIC_CHECK_CYCLE() = 10; 101 + MTOPARA_RSSI_TH_FOR_ANTDIV() = 10; 102 + MTOPARA_TXCOUNT_TH_FOR_CALC_RATE() = 50; 103 + MTOPARA_TXRATE_INC_TH() = 10; 104 + MTOPARA_TXRATE_DEC_TH() = 30; 105 + MTOPARA_TXRATE_EQ_TH() = 40; 106 + MTOPARA_TXRATE_BACKOFF() = 12; 107 + MTOPARA_TXRETRYRATE_REDUCE() = 6; 108 + if (MTO_TXPOWER_FROM_EEPROM == 0xff) { 109 + switch (MTO_HAL()->phy_type) { 110 + case RF_AIROHA_2230: 111 + case RF_AIROHA_2230S: 112 + MTOPARA_TXPOWER_INDEX() = 46; /* MAX-8 @@ Only for AL 2230 */ 113 + break; 114 + case RF_AIROHA_7230: 115 + MTOPARA_TXPOWER_INDEX() = 49; 116 + break; 117 + case RF_WB_242: 118 + MTOPARA_TXPOWER_INDEX() = 10; 119 + break; 120 + case RF_WB_242_1: 121 + MTOPARA_TXPOWER_INDEX() = 24; 122 + break; 150 123 } 151 - } 152 - else //follow the setting from EEPROM 124 + } else { /* follow the setting from EEPROM */ 153 125 MTOPARA_TXPOWER_INDEX() = MTO_TXPOWER_FROM_EEPROM; 154 - RFSynthesizer_SetPowerIndex(MTO_HAL(), (u8)MTOPARA_TXPOWER_INDEX()); 155 - //------------------------------------------------ 126 + } 127 + RFSynthesizer_SetPowerIndex(MTO_HAL(), (u8) MTOPARA_TXPOWER_INDEX()); 128 + /* ------------------------------------------------ */ 156 129 157 - // For RSSI turning 20060808.4 Cancel load from EEPROM 130 + /* For RSSI turning -- Cancel load from EEPROM */ 158 131 MTO_DATA().RSSI_high = -41; 159 132 MTO_DATA().RSSI_low = -60; 160 133 } 161 134 162 - //=========================================================================== 163 - // Description: 164 - // If we enable DTO, we will ignore the tx count with different tx rate from 165 - // DTO rate. This is because when we adjust DTO tx rate, there could be some 166 - // packets in the tx queue with previous tx rate 135 + /* =========================================================================== 136 + * Description: 137 + * If we enable DTO, we will ignore the tx count with different tx rate 138 + * from DTO rate. This is because when we adjust DTO tx rate, there could 139 + * be some packets in the tx queue with previous tx rate 140 + */ 141 + 167 142 void MTO_SetTxCount(struct wbsoft_priv *adapter, u8 tx_rate, u8 index) 168 143 { 169 144 MTO_TXFLOWCOUNT()++; 170 - if ((MTO_ENABLE==1) && (MTO_RATE_CHANGE_ENABLE()==1)) 171 - { 172 - if(tx_rate == MTO_DATA_RATE()) 173 - { 174 - if (index == 0) 175 - { 145 + if ((MTO_ENABLE == 1) && (MTO_RATE_CHANGE_ENABLE() == 1)) { 146 + if (tx_rate == MTO_DATA_RATE()) { 147 + if (index == 0) { 176 148 if (boSparseTxTraffic) 177 149 MTO_HAL()->dto_tx_frag_count += MTOPARA_PERIODIC_CHECK_CYCLE(); 178 150 else 179 151 MTO_HAL()->dto_tx_frag_count += 1; 180 - } 181 - else 182 - { 183 - if (index<8) 184 - { 152 + } else { 153 + if (index < 8) { 185 154 MTO_HAL()->dto_tx_retry_count += index; 186 - MTO_HAL()->dto_tx_frag_count += (index+1); 187 - } 188 - else 189 - { 155 + MTO_HAL()->dto_tx_frag_count += (index + 1); 156 + } else { 190 157 MTO_HAL()->dto_tx_retry_count += 7; 191 158 MTO_HAL()->dto_tx_frag_count += 7; 192 159 } 193 160 } 194 - } 195 - else if(MTO_DATA_RATE()>48 && tx_rate ==48) 196 - {//ALFRED 197 - if (index<3) //for reduciing data rate scheme , 198 - //do not calcu different data rate 199 - //3 is the reducing data rate at retry 200 - { 161 + } else if (MTO_DATA_RATE() > 48 && tx_rate == 48) { 162 + /* for reducing data rate scheme, do not calculate different data rate. 3 is the reducing data rate at retry. */ 163 + if (index < 3) { 201 164 MTO_HAL()->dto_tx_retry_count += index; 202 - MTO_HAL()->dto_tx_frag_count += (index+1); 203 - } 204 - else 205 - { 165 + MTO_HAL()->dto_tx_frag_count += (index + 1); 166 + } else { 206 167 MTO_HAL()->dto_tx_retry_count += 3; 207 168 MTO_HAL()->dto_tx_frag_count += 3; 208 169 } 209 170 210 171 } 211 - } 212 - else 213 - { 172 + } else { 214 173 MTO_HAL()->dto_tx_retry_count += index; 215 - MTO_HAL()->dto_tx_frag_count += (index+1); 174 + MTO_HAL()->dto_tx_frag_count += (index + 1); 216 175 } 217 - TotalTxPkt ++; 218 - TotalTxPktRetry += (index+1); 176 + TotalTxPkt++; 177 + TotalTxPktRetry += (index + 1); 219 178 220 - PeriodTotalTxPkt ++; 221 - PeriodTotalTxPktRetry += (index+1); 179 + PeriodTotalTxPkt++; 180 + PeriodTotalTxPktRetry += (index + 1); 222 181 }