Skip to content

Commit 53ee103

Browse files
committed
Merge tag 'wireless-drivers-for-davem-2015-05-05' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers
Kalle Valo says: ==================== iwlwifi: * fix firmware API for -13.ucode * fix RSSI handling that avoid bad roaming decision * fix firmware debug * fix MFUART operation * fix ASSERT while restart the hardware (because of another ASSERT e.g) ath9k: * fix per-packet tx power configuration rtlwifi: * rtl8192cu: Fix kernel deadlock ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents c967a08 + f673821 commit 53ee103

File tree

15 files changed

+161
-144
lines changed

15 files changed

+161
-144
lines changed

drivers/net/wireless/ath/ath9k/xmit.c

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,28 +1103,14 @@ static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf,
11031103
struct sk_buff *skb;
11041104
struct ath_frame_info *fi;
11051105
struct ieee80211_tx_info *info;
1106-
struct ieee80211_vif *vif;
11071106
struct ath_hw *ah = sc->sc_ah;
11081107

11091108
if (sc->tx99_state || !ah->tpc_enabled)
11101109
return MAX_RATE_POWER;
11111110

11121111
skb = bf->bf_mpdu;
1113-
info = IEEE80211_SKB_CB(skb);
1114-
vif = info->control.vif;
1115-
1116-
if (!vif) {
1117-
max_power = sc->cur_chan->cur_txpower;
1118-
goto out;
1119-
}
1120-
1121-
if (vif->bss_conf.txpower_type != NL80211_TX_POWER_LIMITED) {
1122-
max_power = min_t(u8, sc->cur_chan->cur_txpower,
1123-
2 * vif->bss_conf.txpower);
1124-
goto out;
1125-
}
1126-
11271112
fi = get_frame_info(skb);
1113+
info = IEEE80211_SKB_CB(skb);
11281114

11291115
if (!AR_SREV_9300_20_OR_LATER(ah)) {
11301116
int txpower = fi->tx_power;
@@ -1161,25 +1147,26 @@ static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf,
11611147
txpower -= 2;
11621148

11631149
txpower = max(txpower, 0);
1164-
max_power = min_t(u8, ah->tx_power[rateidx],
1165-
2 * vif->bss_conf.txpower);
1166-
max_power = min_t(u8, max_power, txpower);
1150+
max_power = min_t(u8, ah->tx_power[rateidx], txpower);
1151+
1152+
/* XXX: clamp minimum TX power at 1 for AR9160 since if
1153+
* max_power is set to 0, frames are transmitted at max
1154+
* TX power
1155+
*/
1156+
if (!max_power && !AR_SREV_9280_20_OR_LATER(ah))
1157+
max_power = 1;
11671158
} else if (!bf->bf_state.bfs_paprd) {
11681159
if (rateidx < 8 && (info->flags & IEEE80211_TX_CTL_STBC))
11691160
max_power = min_t(u8, ah->tx_power_stbc[rateidx],
1170-
2 * vif->bss_conf.txpower);
1161+
fi->tx_power);
11711162
else
11721163
max_power = min_t(u8, ah->tx_power[rateidx],
1173-
2 * vif->bss_conf.txpower);
1174-
max_power = min(max_power, fi->tx_power);
1164+
fi->tx_power);
11751165
} else {
11761166
max_power = ah->paprd_training_power;
11771167
}
1178-
out:
1179-
/* XXX: clamp minimum TX power at 1 for AR9160 since if max_power
1180-
* is set to 0, frames are transmitted at max TX power
1181-
*/
1182-
return (!max_power && !AR_SREV_9280_20_OR_LATER(ah)) ? 1 : max_power;
1168+
1169+
return max_power;
11831170
}
11841171

11851172
static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
@@ -2129,6 +2116,7 @@ static void setup_frame_info(struct ieee80211_hw *hw,
21292116
struct ath_node *an = NULL;
21302117
enum ath9k_key_type keytype;
21312118
bool short_preamble = false;
2119+
u8 txpower;
21322120

21332121
/*
21342122
* We check if Short Preamble is needed for the CTS rate by
@@ -2145,6 +2133,16 @@ static void setup_frame_info(struct ieee80211_hw *hw,
21452133
if (sta)
21462134
an = (struct ath_node *) sta->drv_priv;
21472135

2136+
if (tx_info->control.vif) {
2137+
struct ieee80211_vif *vif = tx_info->control.vif;
2138+
2139+
txpower = 2 * vif->bss_conf.txpower;
2140+
} else {
2141+
struct ath_softc *sc = hw->priv;
2142+
2143+
txpower = sc->cur_chan->cur_txpower;
2144+
}
2145+
21482146
memset(fi, 0, sizeof(*fi));
21492147
fi->txq = -1;
21502148
if (hw_key)
@@ -2155,7 +2153,7 @@ static void setup_frame_info(struct ieee80211_hw *hw,
21552153
fi->keyix = ATH9K_TXKEYIX_INVALID;
21562154
fi->keytype = keytype;
21572155
fi->framelen = framelen;
2158-
fi->tx_power = MAX_RATE_POWER;
2156+
fi->tx_power = txpower;
21592157

21602158
if (!rate)
21612159
return;

drivers/net/wireless/iwlwifi/iwl-fw-file.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ enum iwl_ucode_tlv_flag {
244244
* longer than the passive one, which is essential for fragmented scan.
245245
* @IWL_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source.
246246
* IWL_UCODE_TLV_API_HDC_PHASE_0: ucode supports finer configuration of LTR
247+
* @IWL_UCODE_TLV_API_TX_POWER_DEV: new API for tx power.
247248
* @IWL_UCODE_TLV_API_BASIC_DWELL: use only basic dwell time in scan command,
248249
* regardless of the band or the number of the probes. FW will calculate
249250
* the actual dwell time.
@@ -260,6 +261,7 @@ enum iwl_ucode_tlv_api {
260261
IWL_UCODE_TLV_API_FRAGMENTED_SCAN = BIT(8),
261262
IWL_UCODE_TLV_API_WIFI_MCC_UPDATE = BIT(9),
262263
IWL_UCODE_TLV_API_HDC_PHASE_0 = BIT(10),
264+
IWL_UCODE_TLV_API_TX_POWER_DEV = BIT(11),
263265
IWL_UCODE_TLV_API_BASIC_DWELL = BIT(13),
264266
IWL_UCODE_TLV_API_SCD_CFG = BIT(15),
265267
IWL_UCODE_TLV_API_SINGLE_SCAN_EBS = BIT(16),

drivers/net/wireless/iwlwifi/iwl-trans.h

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* GPL LICENSE SUMMARY
77
*
88
* Copyright(c) 2007 - 2014 Intel Corporation. All rights reserved.
9-
* Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
9+
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
1010
*
1111
* This program is free software; you can redistribute it and/or modify
1212
* it under the terms of version 2 of the GNU General Public License as
@@ -32,7 +32,7 @@
3232
* BSD LICENSE
3333
*
3434
* Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
35-
* Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
35+
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
3636
* All rights reserved.
3737
*
3838
* Redistribution and use in source and binary forms, with or without
@@ -421,8 +421,9 @@ struct iwl_trans_txq_scd_cfg {
421421
*
422422
* All the handlers MUST be implemented
423423
*
424-
* @start_hw: starts the HW- from that point on, the HW can send interrupts
425-
* May sleep
424+
* @start_hw: starts the HW. If low_power is true, the NIC needs to be taken
425+
* out of a low power state. From that point on, the HW can send
426+
* interrupts. May sleep.
426427
* @op_mode_leave: Turn off the HW RF kill indication if on
427428
* May sleep
428429
* @start_fw: allocates and inits all the resources for the transport
@@ -432,10 +433,11 @@ struct iwl_trans_txq_scd_cfg {
432433
* the SCD base address in SRAM, then provide it here, or 0 otherwise.
433434
* May sleep
434435
* @stop_device: stops the whole device (embedded CPU put to reset) and stops
435-
* the HW. From that point on, the HW will be in low power but will still
436-
* issue interrupt if the HW RF kill is triggered. This callback must do
437-
* the right thing and not crash even if start_hw() was called but not
438-
* start_fw(). May sleep
436+
* the HW. If low_power is true, the NIC will be put in low power state.
437+
* From that point on, the HW will be stopped but will still issue an
438+
* interrupt if the HW RF kill switch is triggered.
439+
* This callback must do the right thing and not crash even if %start_hw()
440+
* was called but not &start_fw(). May sleep.
439441
* @d3_suspend: put the device into the correct mode for WoWLAN during
440442
* suspend. This is optional, if not implemented WoWLAN will not be
441443
* supported. This callback may sleep.
@@ -491,14 +493,14 @@ struct iwl_trans_txq_scd_cfg {
491493
*/
492494
struct iwl_trans_ops {
493495

494-
int (*start_hw)(struct iwl_trans *iwl_trans);
496+
int (*start_hw)(struct iwl_trans *iwl_trans, bool low_power);
495497
void (*op_mode_leave)(struct iwl_trans *iwl_trans);
496498
int (*start_fw)(struct iwl_trans *trans, const struct fw_img *fw,
497499
bool run_in_rfkill);
498500
int (*update_sf)(struct iwl_trans *trans,
499501
struct iwl_sf_region *st_fwrd_space);
500502
void (*fw_alive)(struct iwl_trans *trans, u32 scd_addr);
501-
void (*stop_device)(struct iwl_trans *trans);
503+
void (*stop_device)(struct iwl_trans *trans, bool low_power);
502504

503505
void (*d3_suspend)(struct iwl_trans *trans, bool test);
504506
int (*d3_resume)(struct iwl_trans *trans, enum iwl_d3_status *status,
@@ -652,11 +654,16 @@ static inline void iwl_trans_configure(struct iwl_trans *trans,
652654
trans->ops->configure(trans, trans_cfg);
653655
}
654656

655-
static inline int iwl_trans_start_hw(struct iwl_trans *trans)
657+
static inline int _iwl_trans_start_hw(struct iwl_trans *trans, bool low_power)
656658
{
657659
might_sleep();
658660

659-
return trans->ops->start_hw(trans);
661+
return trans->ops->start_hw(trans, low_power);
662+
}
663+
664+
static inline int iwl_trans_start_hw(struct iwl_trans *trans)
665+
{
666+
return trans->ops->start_hw(trans, true);
660667
}
661668

662669
static inline void iwl_trans_op_mode_leave(struct iwl_trans *trans)
@@ -703,15 +710,21 @@ static inline int iwl_trans_update_sf(struct iwl_trans *trans,
703710
return 0;
704711
}
705712

706-
static inline void iwl_trans_stop_device(struct iwl_trans *trans)
713+
static inline void _iwl_trans_stop_device(struct iwl_trans *trans,
714+
bool low_power)
707715
{
708716
might_sleep();
709717

710-
trans->ops->stop_device(trans);
718+
trans->ops->stop_device(trans, low_power);
711719

712720
trans->state = IWL_TRANS_NO_FW;
713721
}
714722

723+
static inline void iwl_trans_stop_device(struct iwl_trans *trans)
724+
{
725+
_iwl_trans_stop_device(trans, true);
726+
}
727+
715728
static inline void iwl_trans_d3_suspend(struct iwl_trans *trans, bool test)
716729
{
717730
might_sleep();

drivers/net/wireless/iwlwifi/mvm/d3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ iwl_mvm_netdetect_query_results(struct iwl_mvm *mvm,
17261726
results->matched_profiles = le32_to_cpu(query->matched_profiles);
17271727
memcpy(results->matches, query->matches, sizeof(results->matches));
17281728

1729-
#ifdef CPTCFG_IWLWIFI_DEBUGFS
1729+
#ifdef CONFIG_IWLWIFI_DEBUGFS
17301730
mvm->last_netdetect_scans = le32_to_cpu(query->n_scans_done);
17311731
#endif
17321732

drivers/net/wireless/iwlwifi/mvm/fw-api-power.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,40 @@ struct iwl_uapsd_misbehaving_ap_notif {
297297
u8 reserved[3];
298298
} __packed;
299299

300+
/**
301+
* struct iwl_reduce_tx_power_cmd - TX power reduction command
302+
* REDUCE_TX_POWER_CMD = 0x9f
303+
* @flags: (reserved for future implementation)
304+
* @mac_context_id: id of the mac ctx for which we are reducing TX power.
305+
* @pwr_restriction: TX power restriction in dBms.
306+
*/
307+
struct iwl_reduce_tx_power_cmd {
308+
u8 flags;
309+
u8 mac_context_id;
310+
__le16 pwr_restriction;
311+
} __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
312+
313+
/**
314+
* struct iwl_dev_tx_power_cmd - TX power reduction command
315+
* REDUCE_TX_POWER_CMD = 0x9f
316+
* @set_mode: 0 - MAC tx power, 1 - device tx power
317+
* @mac_context_id: id of the mac ctx for which we are reducing TX power.
318+
* @pwr_restriction: TX power restriction in 1/8 dBms.
319+
* @dev_24: device TX power restriction in 1/8 dBms
320+
* @dev_52_low: device TX power restriction upper band - low
321+
* @dev_52_high: device TX power restriction upper band - high
322+
*/
323+
struct iwl_dev_tx_power_cmd {
324+
__le32 set_mode;
325+
__le32 mac_context_id;
326+
__le16 pwr_restriction;
327+
__le16 dev_24;
328+
__le16 dev_52_low;
329+
__le16 dev_52_high;
330+
} __packed; /* TX_REDUCED_POWER_API_S_VER_2 */
331+
332+
#define IWL_DEV_MAX_TX_POWER 0x7FFF
333+
300334
/**
301335
* struct iwl_beacon_filter_cmd
302336
* REPLY_BEACON_FILTERING_CMD = 0xd2 (command)

drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -122,46 +122,6 @@ enum iwl_scan_complete_status {
122122
SCAN_COMP_STATUS_ERR_ALLOC_TE = 0x0C,
123123
};
124124

125-
/**
126-
* struct iwl_scan_results_notif - scan results for one channel
127-
* ( SCAN_RESULTS_NOTIFICATION = 0x83 )
128-
* @channel: which channel the results are from
129-
* @band: 0 for 5.2 GHz, 1 for 2.4 GHz
130-
* @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
131-
* @num_probe_not_sent: # of request that weren't sent due to not enough time
132-
* @duration: duration spent in channel, in usecs
133-
* @statistics: statistics gathered for this channel
134-
*/
135-
struct iwl_scan_results_notif {
136-
u8 channel;
137-
u8 band;
138-
u8 probe_status;
139-
u8 num_probe_not_sent;
140-
__le32 duration;
141-
__le32 statistics[SCAN_RESULTS_STATISTICS];
142-
} __packed; /* SCAN_RESULT_NTF_API_S_VER_2 */
143-
144-
/**
145-
* struct iwl_scan_complete_notif - notifies end of scanning (all channels)
146-
* ( SCAN_COMPLETE_NOTIFICATION = 0x84 )
147-
* @scanned_channels: number of channels scanned (and number of valid results)
148-
* @status: one of SCAN_COMP_STATUS_*
149-
* @bt_status: BT on/off status
150-
* @last_channel: last channel that was scanned
151-
* @tsf_low: TSF timer (lower half) in usecs
152-
* @tsf_high: TSF timer (higher half) in usecs
153-
* @results: array of scan results, only "scanned_channels" of them are valid
154-
*/
155-
struct iwl_scan_complete_notif {
156-
u8 scanned_channels;
157-
u8 status;
158-
u8 bt_status;
159-
u8 last_channel;
160-
__le32 tsf_low;
161-
__le32 tsf_high;
162-
struct iwl_scan_results_notif results[];
163-
} __packed; /* SCAN_COMPLETE_NTF_API_S_VER_2 */
164-
165125
/* scan offload */
166126
#define IWL_SCAN_MAX_BLACKLIST_LEN 64
167127
#define IWL_SCAN_SHORT_BLACKLIST_LEN 16
@@ -554,15 +514,15 @@ struct iwl_scan_req_unified_lmac {
554514
} __packed;
555515

556516
/**
557-
* struct iwl_lmac_scan_results_notif - scan results for one channel -
517+
* struct iwl_scan_results_notif - scan results for one channel -
558518
* SCAN_RESULT_NTF_API_S_VER_3
559519
* @channel: which channel the results are from
560520
* @band: 0 for 5.2 GHz, 1 for 2.4 GHz
561521
* @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
562522
* @num_probe_not_sent: # of request that weren't sent due to not enough time
563523
* @duration: duration spent in channel, in usecs
564524
*/
565-
struct iwl_lmac_scan_results_notif {
525+
struct iwl_scan_results_notif {
566526
u8 channel;
567527
u8 band;
568528
u8 probe_status;

drivers/net/wireless/iwlwifi/mvm/fw-api.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -281,19 +281,6 @@ struct iwl_tx_ant_cfg_cmd {
281281
__le32 valid;
282282
} __packed;
283283

284-
/**
285-
* struct iwl_reduce_tx_power_cmd - TX power reduction command
286-
* REDUCE_TX_POWER_CMD = 0x9f
287-
* @flags: (reserved for future implementation)
288-
* @mac_context_id: id of the mac ctx for which we are reducing TX power.
289-
* @pwr_restriction: TX power restriction in dBms.
290-
*/
291-
struct iwl_reduce_tx_power_cmd {
292-
u8 flags;
293-
u8 mac_context_id;
294-
__le16 pwr_restriction;
295-
} __packed; /* TX_REDUCED_POWER_API_S_VER_1 */
296-
297284
/*
298285
* Calibration control struct.
299286
* Sent as part of the phy configuration command.

0 commit comments

Comments
 (0)