aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/phy_common.h
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-08-28 13:33:40 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-08-29 16:24:13 -0400
commit18c8adeb0244f823ba78a51e23f813fe68bc3c54 (patch)
tree1b294669d04c207d8e90b5807780fe4eb81778d9 /drivers/net/wireless/b43/phy_common.h
parentef1a628d83fc0423c36e773281162be790503168 (diff)
b43: Rewrite TX power adjustment
This patch rewrites the TX power recalculation algorithms to scale better with changed enviromnent. If there's low TX traffic, the power will be checked against the desired values every 60 seconds. If there is high TX traffic, the check is redone every 2 seconds. This improves the reaction times a lot and confuses the rate control less. It will also reduce the time it initially takes to tune to a new TX power value. With the old algorithm it could take about 30 to 45 seconds to settle to a new power value. This will happen in about two to four seconds now. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/phy_common.h')
-rw-r--r--drivers/net/wireless/b43/phy_common.h75
1 files changed, 72 insertions, 3 deletions
diff --git a/drivers/net/wireless/b43/phy_common.h b/drivers/net/wireless/b43/phy_common.h
index 9b9635eda9c4..f8db9f40df5d 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -61,6 +61,17 @@ enum {
61}; 61};
62 62
63/** 63/**
64 * enum b43_txpwr_result - Return value for the recalc_txpower PHY op.
65 *
66 * @B43_TXPWR_RES_NEED_ADJUST: Values changed. Hardware adjustment is needed.
67 * @B43_TXPWR_RES_DONE: No more work to do. Everything is done.
68 */
69enum b43_txpwr_result {
70 B43_TXPWR_RES_NEED_ADJUST,
71 B43_TXPWR_RES_DONE,
72};
73
74/**
64 * struct b43_phy_operations - Function pointers for PHY ops. 75 * struct b43_phy_operations - Function pointers for PHY ops.
65 * 76 *
66 * @prepare: Prepare the PHY. This is called before @init. 77 * @prepare: Prepare the PHY. This is called before @init.
@@ -96,8 +107,23 @@ enum {
96 * @interf_mitigation: Switch the Interference Mitigation mode. 107 * @interf_mitigation: Switch the Interference Mitigation mode.
97 * Can be NULL, if not supported. 108 * Can be NULL, if not supported.
98 * 109 *
99 * @xmitpower: FIXME REMOVEME 110 * @recalc_txpower: Recalculate the transmission power parameters.
111 * This callback has to recalculate the TX power settings,
112 * but does not need to write them to the hardware, yet.
113 * Returns enum b43_txpwr_result to indicate whether the hardware
114 * needs to be adjusted.
115 * If B43_TXPWR_NEED_ADJUST is returned, @adjust_txpower
116 * will be called later.
117 * If the parameter "ignore_tssi" is true, the TSSI values should
118 * be ignored and a recalculation of the power settings should be
119 * done even if the TSSI values did not change.
120 * This callback is called with wl->irq_lock held and must not sleep.
100 * Must not be NULL. 121 * Must not be NULL.
122 * @adjust_txpower: Write the previously calculated TX power settings
123 * (from @recalc_txpower) to the hardware.
124 * This function may sleep.
125 * Can be NULL, if (and ONLY if) @recalc_txpower _always_
126 * returns B43_TXPWR_RES_DONE.
101 * 127 *
102 * @pwork_15sec: Periodic work. Called every 15 seconds. 128 * @pwork_15sec: Periodic work. Called every 15 seconds.
103 * Can be NULL, if not required. 129 * Can be NULL, if not required.
@@ -127,7 +153,9 @@ struct b43_phy_operations {
127 enum b43_interference_mitigation new_mode); 153 enum b43_interference_mitigation new_mode);
128 154
129 /* Transmission power adjustment */ 155 /* Transmission power adjustment */
130 void (*xmitpower)(struct b43_wldev *dev); 156 enum b43_txpwr_result (*recalc_txpower)(struct b43_wldev *dev,
157 bool ignore_tssi);
158 void (*adjust_txpower)(struct b43_wldev *dev);
131 159
132 /* Misc */ 160 /* Misc */
133 void (*pwork_15sec)(struct b43_wldev *dev); 161 void (*pwork_15sec)(struct b43_wldev *dev);
@@ -183,11 +211,15 @@ struct b43_phy {
183 211
184 /* Desired TX power level (in dBm). 212 /* Desired TX power level (in dBm).
185 * This is set by the user and adjusted in b43_phy_xmitpower(). */ 213 * This is set by the user and adjusted in b43_phy_xmitpower(). */
186 u8 power_level; 214 int desired_txpower;
187 215
188 /* Hardware Power Control enabled? */ 216 /* Hardware Power Control enabled? */
189 bool hardware_power_control; 217 bool hardware_power_control;
190 218
219 /* The time (in absolute jiffies) when the next TX power output
220 * check is needed. */
221 unsigned long next_txpwr_check_time;
222
191 /* current channel */ 223 /* current channel */
192 unsigned int channel; 224 unsigned int channel;
193 225
@@ -309,4 +341,41 @@ int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel);
309 */ 341 */
310void b43_software_rfkill(struct b43_wldev *dev, enum rfkill_state state); 342void b43_software_rfkill(struct b43_wldev *dev, enum rfkill_state state);
311 343
344/**
345 * b43_phy_txpower_check - Check TX power output.
346 *
347 * Compare the current TX power output to the desired power emission
348 * and schedule an adjustment in case it mismatches.
349 * Requires wl->irq_lock locked.
350 *
351 * @flags: OR'ed enum b43_phy_txpower_check_flags flags.
352 * See the docs below.
353 */
354void b43_phy_txpower_check(struct b43_wldev *dev, unsigned int flags);
355/**
356 * enum b43_phy_txpower_check_flags - Flags for b43_phy_txpower_check()
357 *
358 * @B43_TXPWR_IGNORE_TIME: Ignore the schedule time and force-redo
359 * the check now.
360 * @B43_TXPWR_IGNORE_TSSI: Redo the recalculation, even if the average
361 * TSSI did not change.
362 */
363enum b43_phy_txpower_check_flags {
364 B43_TXPWR_IGNORE_TIME = (1 << 0),
365 B43_TXPWR_IGNORE_TSSI = (1 << 1),
366};
367
368struct work_struct;
369void b43_phy_txpower_adjust_work(struct work_struct *work);
370
371/**
372 * b43_phy_shm_tssi_read - Read the average of the last 4 TSSI from SHM.
373 *
374 * @shm_offset: The SHM address to read the values from.
375 *
376 * Returns the average of the 4 TSSI values, or a negative error code.
377 */
378int b43_phy_shm_tssi_read(struct b43_wldev *dev, u16 shm_offset);
379
380
312#endif /* LINUX_B43_PHY_COMMON_H_ */ 381#endif /* LINUX_B43_PHY_COMMON_H_ */