2010-03-17 08:47:58 +08:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* GPL LICENSE SUMMARY
|
|
|
|
*
|
2011-04-06 00:42:00 +08:00
|
|
|
* Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
|
2010-03-17 08:47:58 +08:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of version 2 of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
|
|
|
|
* USA
|
|
|
|
*
|
|
|
|
* The full GNU General Public License is included in this distribution
|
|
|
|
* in the file called LICENSE.GPL.
|
|
|
|
*
|
|
|
|
* Contact Information:
|
|
|
|
* Intel Linux Wireless <ilw@linux.intel.com>
|
|
|
|
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
2010-03-18 04:34:36 +08:00
|
|
|
#include <linux/etherdevice.h>
|
2010-03-17 08:47:58 +08:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
|
|
|
|
#include "iwl-dev.h"
|
|
|
|
#include "iwl-core.h"
|
|
|
|
#include "iwl-io.h"
|
|
|
|
#include "iwl-helpers.h"
|
|
|
|
#include "iwl-agn-hw.h"
|
|
|
|
#include "iwl-agn.h"
|
2010-04-28 23:44:52 +08:00
|
|
|
#include "iwl-sta.h"
|
2011-07-08 23:46:16 +08:00
|
|
|
#include "iwl-trans.h"
|
2011-08-26 14:10:36 +08:00
|
|
|
#include "iwl-shared.h"
|
2010-03-17 08:47:58 +08:00
|
|
|
|
2010-09-21 00:12:33 +08:00
|
|
|
static inline u32 iwlagn_get_scd_ssn(struct iwlagn_tx_resp *tx_resp)
|
2010-03-17 08:47:58 +08:00
|
|
|
{
|
|
|
|
return le32_to_cpup((__le32 *)&tx_resp->status +
|
|
|
|
tx_resp->frame_count) & MAX_SN;
|
|
|
|
}
|
|
|
|
|
2010-09-06 01:49:41 +08:00
|
|
|
static void iwlagn_count_tx_err_status(struct iwl_priv *priv, u16 status)
|
|
|
|
{
|
|
|
|
status &= TX_STATUS_MSK;
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
case TX_STATUS_POSTPONE_DELAY:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.pp_delay++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_POSTPONE_FEW_BYTES:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.pp_few_bytes++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_POSTPONE_BT_PRIO:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.pp_bt_prio++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_POSTPONE_QUIET_PERIOD:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.pp_quiet_period++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_POSTPONE_CALC_TTAK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.pp_calc_ttak++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.int_crossed_retry++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_SHORT_LIMIT:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.short_limit++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_LONG_LIMIT:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.long_limit++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_FIFO_UNDERRUN:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.fifo_underrun++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_DRAIN_FLOW:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.drain_flow++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_RFKILL_FLUSH:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.rfkill_flush++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_LIFE_EXPIRE:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.life_expire++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_DEST_PS:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.dest_ps++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_HOST_ABORTED:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.host_abort++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_BT_RETRY:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.bt_retry++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_STA_INVALID:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.sta_invalid++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_FRAG_DROPPED:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.frag_drop++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_TID_DISABLE:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.tid_disable++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_FIFO_FLUSHED:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.fifo_flush++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
case TX_STATUS_FAIL_INSUFFICIENT_CF_POLL:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.insuff_cf_poll++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
2010-09-08 03:42:20 +08:00
|
|
|
case TX_STATUS_FAIL_PASSIVE_NO_RX:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.fail_hw_drop++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
2010-09-08 03:42:20 +08:00
|
|
|
case TX_STATUS_FAIL_NO_BEACON_ON_RADAR:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.sta_color_mismatch++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
default:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_tx_stats.unknown++;
|
2010-09-06 01:49:41 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-06 01:49:44 +08:00
|
|
|
static void iwlagn_count_agg_tx_err_status(struct iwl_priv *priv, u16 status)
|
|
|
|
{
|
|
|
|
status &= AGG_TX_STATUS_MSK;
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
case AGG_TX_STATE_UNDERRUN_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.underrun++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
case AGG_TX_STATE_BT_PRIO_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.bt_prio++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
case AGG_TX_STATE_FEW_BYTES_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.few_bytes++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
case AGG_TX_STATE_ABORT_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.abort++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
case AGG_TX_STATE_LAST_SENT_TTL_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.last_sent_ttl++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
case AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.last_sent_try++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
case AGG_TX_STATE_LAST_SENT_BT_KILL_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.last_sent_bt_kill++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
case AGG_TX_STATE_SCD_QUERY_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.scd_query++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
case AGG_TX_STATE_TEST_BAD_CRC32_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.bad_crc32++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
case AGG_TX_STATE_RESPONSE_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.response++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
case AGG_TX_STATE_DUMP_TX_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.dump_tx++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
case AGG_TX_STATE_DELAY_TX_MSK:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.delay_tx++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
default:
|
2011-07-13 23:38:57 +08:00
|
|
|
priv->reply_agg_tx_stats.unknown++;
|
2010-09-06 01:49:44 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-05 00:00:14 +08:00
|
|
|
static void iwlagn_set_tx_status(struct iwl_priv *priv,
|
|
|
|
struct ieee80211_tx_info *info,
|
2011-03-30 17:29:32 +08:00
|
|
|
struct iwl_rxon_context *ctx,
|
2010-09-21 00:12:33 +08:00
|
|
|
struct iwlagn_tx_resp *tx_resp,
|
2010-09-05 00:00:14 +08:00
|
|
|
int txq_id, bool is_agg)
|
|
|
|
{
|
|
|
|
u16 status = le16_to_cpu(tx_resp->status.status);
|
|
|
|
|
|
|
|
info->status.rates[0].count = tx_resp->failure_frame + 1;
|
|
|
|
if (is_agg)
|
|
|
|
info->flags &= ~IEEE80211_TX_CTL_AMPDU;
|
|
|
|
info->flags |= iwl_tx_status_to_mac80211(status);
|
|
|
|
iwlagn_hwrate_to_tx_control(priv, le32_to_cpu(tx_resp->rate_n_flags),
|
|
|
|
info);
|
2010-09-06 01:49:41 +08:00
|
|
|
if (!iwl_is_tx_success(status))
|
|
|
|
iwlagn_count_tx_err_status(priv, status);
|
2010-09-05 00:00:14 +08:00
|
|
|
|
2011-03-30 17:29:32 +08:00
|
|
|
if (status == TX_STATUS_FAIL_PASSIVE_NO_RX &&
|
|
|
|
iwl_is_associated_ctx(ctx) && ctx->vif &&
|
|
|
|
ctx->vif->type == NL80211_IFTYPE_STATION) {
|
|
|
|
ctx->last_tx_rejected = true;
|
|
|
|
iwl_stop_queue(priv, &priv->txq[txq_id]);
|
|
|
|
}
|
|
|
|
|
2010-09-05 00:00:14 +08:00
|
|
|
IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) rate_n_flags "
|
|
|
|
"0x%x retries %d\n",
|
|
|
|
txq_id,
|
|
|
|
iwl_get_tx_fail_reason(status), status,
|
|
|
|
le32_to_cpu(tx_resp->rate_n_flags),
|
|
|
|
tx_resp->failure_frame);
|
|
|
|
}
|
|
|
|
|
2010-09-06 01:49:43 +08:00
|
|
|
#ifdef CONFIG_IWLWIFI_DEBUG
|
|
|
|
#define AGG_TX_STATE_FAIL(x) case AGG_TX_STATE_ ## x: return #x
|
|
|
|
|
|
|
|
const char *iwl_get_agg_tx_fail_reason(u16 status)
|
|
|
|
{
|
|
|
|
status &= AGG_TX_STATUS_MSK;
|
|
|
|
switch (status) {
|
|
|
|
case AGG_TX_STATE_TRANSMITTED:
|
|
|
|
return "SUCCESS";
|
|
|
|
AGG_TX_STATE_FAIL(UNDERRUN_MSK);
|
|
|
|
AGG_TX_STATE_FAIL(BT_PRIO_MSK);
|
|
|
|
AGG_TX_STATE_FAIL(FEW_BYTES_MSK);
|
|
|
|
AGG_TX_STATE_FAIL(ABORT_MSK);
|
|
|
|
AGG_TX_STATE_FAIL(LAST_SENT_TTL_MSK);
|
|
|
|
AGG_TX_STATE_FAIL(LAST_SENT_TRY_CNT_MSK);
|
|
|
|
AGG_TX_STATE_FAIL(LAST_SENT_BT_KILL_MSK);
|
|
|
|
AGG_TX_STATE_FAIL(SCD_QUERY_MSK);
|
|
|
|
AGG_TX_STATE_FAIL(TEST_BAD_CRC32_MSK);
|
|
|
|
AGG_TX_STATE_FAIL(RESPONSE_MSK);
|
|
|
|
AGG_TX_STATE_FAIL(DUMP_TX_MSK);
|
|
|
|
AGG_TX_STATE_FAIL(DELAY_TX_MSK);
|
|
|
|
}
|
|
|
|
|
|
|
|
return "UNKNOWN";
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_IWLWIFI_DEBUG */
|
|
|
|
|
2010-03-17 08:47:58 +08:00
|
|
|
static int iwlagn_tx_status_reply_tx(struct iwl_priv *priv,
|
|
|
|
struct iwl_ht_agg *agg,
|
2010-09-21 00:12:33 +08:00
|
|
|
struct iwlagn_tx_resp *tx_resp,
|
2010-03-17 08:47:58 +08:00
|
|
|
int txq_id, u16 start_idx)
|
|
|
|
{
|
|
|
|
u16 status;
|
|
|
|
struct agg_tx_status *frame_status = &tx_resp->status;
|
|
|
|
struct ieee80211_hdr *hdr = NULL;
|
|
|
|
int i, sh, idx;
|
|
|
|
u16 seq;
|
|
|
|
|
|
|
|
if (agg->wait_for_ba)
|
|
|
|
IWL_DEBUG_TX_REPLY(priv, "got tx response w/o block-ack\n");
|
|
|
|
|
|
|
|
agg->frame_count = tx_resp->frame_count;
|
|
|
|
agg->start_idx = start_idx;
|
2010-09-05 00:00:14 +08:00
|
|
|
agg->rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags);
|
2010-03-17 08:47:58 +08:00
|
|
|
agg->bitmap = 0;
|
|
|
|
|
|
|
|
/* # frames attempted by Tx command */
|
|
|
|
if (agg->frame_count == 1) {
|
2011-03-30 17:29:32 +08:00
|
|
|
struct iwl_tx_info *txb;
|
|
|
|
|
2010-03-17 08:47:58 +08:00
|
|
|
/* Only one frame was attempted; no block-ack will arrive */
|
|
|
|
idx = start_idx;
|
|
|
|
|
|
|
|
IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n",
|
|
|
|
agg->frame_count, agg->start_idx, idx);
|
2011-03-30 17:29:32 +08:00
|
|
|
txb = &priv->txq[txq_id].txb[idx];
|
|
|
|
iwlagn_set_tx_status(priv, IEEE80211_SKB_CB(txb->skb),
|
|
|
|
txb->ctx, tx_resp, txq_id, true);
|
2010-03-17 08:47:58 +08:00
|
|
|
agg->wait_for_ba = 0;
|
|
|
|
} else {
|
|
|
|
/* Two or more frames were attempted; expect block-ack */
|
|
|
|
u64 bitmap = 0;
|
2010-05-26 01:22:49 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Start is the lowest frame sent. It may not be the first
|
|
|
|
* frame in the batch; we figure this out dynamically during
|
|
|
|
* the following loop.
|
|
|
|
*/
|
2010-03-17 08:47:58 +08:00
|
|
|
int start = agg->start_idx;
|
|
|
|
|
|
|
|
/* Construct bit-map of pending frames within Tx window */
|
|
|
|
for (i = 0; i < agg->frame_count; i++) {
|
|
|
|
u16 sc;
|
|
|
|
status = le16_to_cpu(frame_status[i].status);
|
|
|
|
seq = le16_to_cpu(frame_status[i].sequence);
|
|
|
|
idx = SEQ_TO_INDEX(seq);
|
|
|
|
txq_id = SEQ_TO_QUEUE(seq);
|
|
|
|
|
2010-09-06 01:49:44 +08:00
|
|
|
if (status & AGG_TX_STATUS_MSK)
|
|
|
|
iwlagn_count_agg_tx_err_status(priv, status);
|
|
|
|
|
2010-03-17 08:47:58 +08:00
|
|
|
if (status & (AGG_TX_STATE_FEW_BYTES_MSK |
|
|
|
|
AGG_TX_STATE_ABORT_MSK))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n",
|
|
|
|
agg->frame_count, txq_id, idx);
|
2010-09-06 01:49:43 +08:00
|
|
|
IWL_DEBUG_TX_REPLY(priv, "status %s (0x%08x), "
|
|
|
|
"try-count (0x%08x)\n",
|
|
|
|
iwl_get_agg_tx_fail_reason(status),
|
|
|
|
status & AGG_TX_STATUS_MSK,
|
|
|
|
status & AGG_TX_TRY_MSK);
|
2010-03-17 08:47:58 +08:00
|
|
|
|
|
|
|
hdr = iwl_tx_queue_get_hdr(priv, txq_id, idx);
|
|
|
|
if (!hdr) {
|
|
|
|
IWL_ERR(priv,
|
|
|
|
"BUG_ON idx doesn't point to valid skb"
|
|
|
|
" idx=%d, txq_id=%d\n", idx, txq_id);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sc = le16_to_cpu(hdr->seq_ctrl);
|
|
|
|
if (idx != (SEQ_TO_SN(sc) & 0xff)) {
|
|
|
|
IWL_ERR(priv,
|
|
|
|
"BUG_ON idx doesn't match seq control"
|
|
|
|
" idx=%d, seq_idx=%d, seq=%d\n",
|
|
|
|
idx, SEQ_TO_SN(sc),
|
|
|
|
hdr->seq_ctrl);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
IWL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n",
|
|
|
|
i, idx, SEQ_TO_SN(sc));
|
|
|
|
|
2010-05-26 01:22:49 +08:00
|
|
|
/*
|
|
|
|
* sh -> how many frames ahead of the starting frame is
|
|
|
|
* the current one?
|
|
|
|
*
|
|
|
|
* Note that all frames sent in the batch must be in a
|
|
|
|
* 64-frame window, so this number should be in [0,63].
|
|
|
|
* If outside of this window, then we've found a new
|
|
|
|
* "first" frame in the batch and need to change start.
|
|
|
|
*/
|
2010-03-17 08:47:58 +08:00
|
|
|
sh = idx - start;
|
2010-05-26 01:22:49 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If >= 64, out of window. start must be at the front
|
|
|
|
* of the circular buffer, idx must be near the end of
|
|
|
|
* the buffer, and idx is the new "first" frame. Shift
|
|
|
|
* the indices around.
|
|
|
|
*/
|
|
|
|
if (sh >= 64) {
|
|
|
|
/* Shift bitmap by start - idx, wrapped */
|
|
|
|
sh = 0x100 - idx + start;
|
2010-03-17 08:47:58 +08:00
|
|
|
bitmap = bitmap << sh;
|
2010-05-26 01:22:49 +08:00
|
|
|
/* Now idx is the new start so sh = 0 */
|
2010-03-17 08:47:58 +08:00
|
|
|
sh = 0;
|
|
|
|
start = idx;
|
2010-05-26 01:22:49 +08:00
|
|
|
/*
|
|
|
|
* If <= -64 then wraps the 256-pkt circular buffer
|
|
|
|
* (e.g., start = 255 and idx = 0, sh should be 1)
|
|
|
|
*/
|
|
|
|
} else if (sh <= -64) {
|
|
|
|
sh = 0x100 - start + idx;
|
|
|
|
/*
|
|
|
|
* If < 0 but > -64, out of window. idx is before start
|
|
|
|
* but not wrapped. Shift the indices around.
|
|
|
|
*/
|
|
|
|
} else if (sh < 0) {
|
|
|
|
/* Shift by how far start is ahead of idx */
|
2010-03-17 08:47:58 +08:00
|
|
|
sh = start - idx;
|
|
|
|
bitmap = bitmap << sh;
|
2010-05-26 01:22:49 +08:00
|
|
|
/* Now idx is the new start so sh = 0 */
|
|
|
|
start = idx;
|
2010-03-17 08:47:58 +08:00
|
|
|
sh = 0;
|
|
|
|
}
|
2010-05-26 01:22:49 +08:00
|
|
|
/* Sequence number start + sh was sent in this batch */
|
2010-03-17 08:47:58 +08:00
|
|
|
bitmap |= 1ULL << sh;
|
|
|
|
IWL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n",
|
|
|
|
start, (unsigned long long)bitmap);
|
|
|
|
}
|
|
|
|
|
2010-05-26 01:22:49 +08:00
|
|
|
/*
|
|
|
|
* Store the bitmap and possibly the new start, if we wrapped
|
|
|
|
* the buffer above
|
|
|
|
*/
|
2010-03-17 08:47:58 +08:00
|
|
|
agg->bitmap = bitmap;
|
|
|
|
agg->start_idx = start;
|
|
|
|
IWL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n",
|
|
|
|
agg->frame_count, agg->start_idx,
|
|
|
|
(unsigned long long)agg->bitmap);
|
|
|
|
|
|
|
|
if (bitmap)
|
|
|
|
agg->wait_for_ba = 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-04-01 08:57:28 +08:00
|
|
|
void iwl_check_abort_status(struct iwl_priv *priv,
|
|
|
|
u8 frame_count, u32 status)
|
|
|
|
{
|
|
|
|
if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
|
2010-06-25 04:18:35 +08:00
|
|
|
IWL_ERR(priv, "Tx flush command to flush out all frames\n");
|
2011-08-26 14:10:42 +08:00
|
|
|
if (!test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
|
2011-08-26 14:10:41 +08:00
|
|
|
queue_work(priv->shrd->workqueue, &priv->tx_flush);
|
2010-04-01 08:57:28 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-03 20:45:34 +08:00
|
|
|
void iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
|
2010-03-17 08:47:58 +08:00
|
|
|
{
|
|
|
|
struct iwl_rx_packet *pkt = rxb_addr(rxb);
|
|
|
|
u16 sequence = le16_to_cpu(pkt->hdr.sequence);
|
|
|
|
int txq_id = SEQ_TO_QUEUE(sequence);
|
|
|
|
int index = SEQ_TO_INDEX(sequence);
|
|
|
|
struct iwl_tx_queue *txq = &priv->txq[txq_id];
|
|
|
|
struct ieee80211_tx_info *info;
|
2010-09-21 00:12:33 +08:00
|
|
|
struct iwlagn_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
|
2011-07-16 04:23:45 +08:00
|
|
|
struct ieee80211_hdr *hdr;
|
2011-03-30 17:29:32 +08:00
|
|
|
struct iwl_tx_info *txb;
|
|
|
|
u32 status = le16_to_cpu(tx_resp->status.status);
|
2010-03-17 08:47:58 +08:00
|
|
|
int tid;
|
|
|
|
int sta_id;
|
|
|
|
int freed;
|
2010-05-05 17:26:06 +08:00
|
|
|
unsigned long flags;
|
2010-03-17 08:47:58 +08:00
|
|
|
|
|
|
|
if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
|
2011-05-27 23:40:28 +08:00
|
|
|
IWL_ERR(priv, "%s: Read index for DMA queue txq_id (%d) "
|
|
|
|
"index %d is out of range [0-%d] %d %d\n", __func__,
|
|
|
|
txq_id, index, txq->q.n_bd, txq->q.write_ptr,
|
2010-03-17 08:47:58 +08:00
|
|
|
txq->q.read_ptr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-12-03 22:41:48 +08:00
|
|
|
txq->time_stamp = jiffies;
|
2011-03-30 17:29:32 +08:00
|
|
|
txb = &txq->txb[txq->q.read_ptr];
|
|
|
|
info = IEEE80211_SKB_CB(txb->skb);
|
2010-03-17 08:47:58 +08:00
|
|
|
memset(&info->status, 0, sizeof(info->status));
|
|
|
|
|
2010-09-21 00:12:33 +08:00
|
|
|
tid = (tx_resp->ra_tid & IWLAGN_TX_RES_TID_MSK) >>
|
|
|
|
IWLAGN_TX_RES_TID_POS;
|
|
|
|
sta_id = (tx_resp->ra_tid & IWLAGN_TX_RES_RA_MSK) >>
|
|
|
|
IWLAGN_TX_RES_RA_POS;
|
2010-03-17 08:47:58 +08:00
|
|
|
|
2011-08-26 14:10:47 +08:00
|
|
|
spin_lock_irqsave(&priv->shrd->sta_lock, flags);
|
2011-07-16 04:23:45 +08:00
|
|
|
|
|
|
|
hdr = (void *)txb->skb->data;
|
|
|
|
if (!ieee80211_is_data_qos(hdr->frame_control))
|
|
|
|
priv->last_seq_ctl = tx_resp->seq_ctl;
|
|
|
|
|
2010-03-17 08:47:58 +08:00
|
|
|
if (txq->sched_retry) {
|
|
|
|
const u32 scd_ssn = iwlagn_get_scd_ssn(tx_resp);
|
2010-05-05 17:26:06 +08:00
|
|
|
struct iwl_ht_agg *agg;
|
2010-03-17 08:47:58 +08:00
|
|
|
|
|
|
|
agg = &priv->stations[sta_id].tid[tid].agg;
|
2010-08-23 22:57:06 +08:00
|
|
|
/*
|
|
|
|
* If the BT kill count is non-zero, we'll get this
|
|
|
|
* notification again.
|
|
|
|
*/
|
|
|
|
if (tx_resp->bt_kill_count && tx_resp->frame_count == 1 &&
|
2010-10-06 23:10:00 +08:00
|
|
|
priv->cfg->bt_params &&
|
|
|
|
priv->cfg->bt_params->advanced_bt_coexist) {
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "receive reply tx with bt_kill\n");
|
2010-08-23 22:57:06 +08:00
|
|
|
}
|
2010-03-17 08:47:58 +08:00
|
|
|
iwlagn_tx_status_reply_tx(priv, agg, tx_resp, txq_id, index);
|
|
|
|
|
|
|
|
/* check if BAR is needed */
|
|
|
|
if ((tx_resp->frame_count == 1) && !iwl_is_tx_success(status))
|
|
|
|
info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
|
|
|
|
|
|
|
|
if (txq->q.read_ptr != (scd_ssn & 0xff)) {
|
|
|
|
index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd);
|
|
|
|
IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim "
|
|
|
|
"scd_ssn=%d idx=%d txq=%d swq=%d\n",
|
|
|
|
scd_ssn , index, txq_id, txq->swq_id);
|
|
|
|
|
2010-03-18 04:34:34 +08:00
|
|
|
freed = iwlagn_tx_queue_reclaim(priv, txq_id, index);
|
2010-03-17 08:47:58 +08:00
|
|
|
iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
|
|
|
|
|
|
|
|
if (priv->mac80211_registered &&
|
|
|
|
(iwl_queue_space(&txq->q) > txq->q.low_mark) &&
|
2010-11-11 10:25:43 +08:00
|
|
|
(agg->state != IWL_EMPTYING_HW_QUEUE_DELBA))
|
2010-11-11 10:25:44 +08:00
|
|
|
iwl_wake_queue(priv, txq);
|
2010-03-17 08:47:58 +08:00
|
|
|
}
|
|
|
|
} else {
|
2011-03-30 17:29:32 +08:00
|
|
|
iwlagn_set_tx_status(priv, info, txb->ctx, tx_resp,
|
|
|
|
txq_id, false);
|
2010-03-18 04:34:34 +08:00
|
|
|
freed = iwlagn_tx_queue_reclaim(priv, txq_id, index);
|
2010-03-17 08:47:58 +08:00
|
|
|
iwl_free_tfds_in_queue(priv, sta_id, tid, freed);
|
|
|
|
|
|
|
|
if (priv->mac80211_registered &&
|
2011-03-30 17:29:32 +08:00
|
|
|
iwl_queue_space(&txq->q) > txq->q.low_mark &&
|
|
|
|
status != TX_STATUS_FAIL_PASSIVE_NO_RX)
|
2010-11-11 10:25:44 +08:00
|
|
|
iwl_wake_queue(priv, txq);
|
2010-03-17 08:47:58 +08:00
|
|
|
}
|
|
|
|
|
2010-03-18 04:34:34 +08:00
|
|
|
iwlagn_txq_check_empty(priv, sta_id, tid, txq_id);
|
2010-03-17 08:47:58 +08:00
|
|
|
|
2010-04-01 08:57:28 +08:00
|
|
|
iwl_check_abort_status(priv, tx_resp->frame_count, status);
|
2011-08-26 14:10:47 +08:00
|
|
|
spin_unlock_irqrestore(&priv->shrd->sta_lock, flags);
|
2010-03-17 08:47:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int iwlagn_hw_valid_rtc_data_addr(u32 addr)
|
|
|
|
{
|
|
|
|
return (addr >= IWLAGN_RTC_DATA_LOWER_BOUND) &&
|
|
|
|
(addr < IWLAGN_RTC_DATA_UPPER_BOUND);
|
|
|
|
}
|
|
|
|
|
|
|
|
int iwlagn_send_tx_power(struct iwl_priv *priv)
|
|
|
|
{
|
2010-09-21 00:12:31 +08:00
|
|
|
struct iwlagn_tx_power_dbm_cmd tx_power_cmd;
|
2010-03-17 08:47:58 +08:00
|
|
|
u8 tx_ant_cfg_cmd;
|
|
|
|
|
2011-08-26 14:10:42 +08:00
|
|
|
if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->shrd->status),
|
2010-10-25 16:34:50 +08:00
|
|
|
"TX Power requested while scanning!\n"))
|
|
|
|
return -EAGAIN;
|
|
|
|
|
2010-03-17 08:47:58 +08:00
|
|
|
/* half dBm need to multiply */
|
|
|
|
tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt);
|
|
|
|
|
|
|
|
if (priv->tx_power_lmt_in_half_dbm &&
|
|
|
|
priv->tx_power_lmt_in_half_dbm < tx_power_cmd.global_lmt) {
|
|
|
|
/*
|
|
|
|
* For the newer devices which using enhanced/extend tx power
|
|
|
|
* table in EEPROM, the format is in half dBm. driver need to
|
|
|
|
* convert to dBm format before report to mac80211.
|
|
|
|
* By doing so, there is a possibility of 1/2 dBm resolution
|
|
|
|
* lost. driver will perform "round-up" operation before
|
|
|
|
* reporting, but it will cause 1/2 dBm tx power over the
|
|
|
|
* regulatory limit. Perform the checking here, if the
|
|
|
|
* "tx_power_user_lmt" is higher than EEPROM value (in
|
|
|
|
* half-dBm format), lower the tx power based on EEPROM
|
|
|
|
*/
|
|
|
|
tx_power_cmd.global_lmt = priv->tx_power_lmt_in_half_dbm;
|
|
|
|
}
|
2010-09-21 00:12:31 +08:00
|
|
|
tx_power_cmd.flags = IWLAGN_TX_POWER_NO_CLOSED;
|
|
|
|
tx_power_cmd.srv_chan_lmt = IWLAGN_TX_POWER_AUTO;
|
2010-03-17 08:47:58 +08:00
|
|
|
|
|
|
|
if (IWL_UCODE_API(priv->ucode_ver) == 1)
|
|
|
|
tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD_V1;
|
|
|
|
else
|
|
|
|
tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;
|
|
|
|
|
iwlagn: bus layer chooses its transport layer
Remove iwl_transport_register which was a W/A. The bus layer knows what
transport to use. So now, the bus layer gives the upper layer a pointer to the
iwl_trans_ops struct that it wants to use. The upper layer then, allocates the
desired transport layer using iwl_trans_ops->alloc function.
As a result of this, priv->trans, no longer exists, priv holds a pointer to
iwl_shared, which holds a pointer to iwl_trans. This required to change all the
calls to the transport layer from upper layer. While we were at it, trans_X
inlines have been renamed to iwl_trans_X to avoid confusions, which of course
required to rename the functions inside the transport layer because of
conflicts in names. So the static API functions inside the transport layer
implementation have been renamed to iwl_trans_pcie_X.
Until now, the IRQ / Tasklet were initialized in iwl_transport_layer. This is
confusing since the registration doesn't mean to request IRQ, so I added a
handler for that.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-26 14:10:48 +08:00
|
|
|
return iwl_trans_send_cmd_pdu(trans(priv), tx_ant_cfg_cmd, CMD_SYNC,
|
2011-07-08 23:46:14 +08:00
|
|
|
sizeof(tx_power_cmd), &tx_power_cmd);
|
2010-03-17 08:47:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void iwlagn_temperature(struct iwl_priv *priv)
|
|
|
|
{
|
2011-02-26 01:44:48 +08:00
|
|
|
/* store temperature from correct statistics (in Celsius) */
|
2011-04-08 23:14:56 +08:00
|
|
|
priv->temperature = le32_to_cpu(priv->statistics.common.temperature);
|
2010-03-17 08:47:58 +08:00
|
|
|
iwl_tt_handler(priv);
|
|
|
|
}
|
|
|
|
|
|
|
|
u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
struct iwl_eeprom_calib_hdr {
|
|
|
|
u8 version;
|
|
|
|
u8 pa_type;
|
|
|
|
u16 voltage;
|
|
|
|
} *hdr;
|
|
|
|
|
|
|
|
hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv,
|
2010-04-07 12:10:33 +08:00
|
|
|
EEPROM_CALIB_ALL);
|
2010-03-17 08:47:58 +08:00
|
|
|
return hdr->version;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* EEPROM
|
|
|
|
*/
|
|
|
|
static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
|
|
|
|
{
|
|
|
|
u16 offset = 0;
|
|
|
|
|
|
|
|
if ((address & INDIRECT_ADDRESS) == 0)
|
|
|
|
return address;
|
|
|
|
|
|
|
|
switch (address & INDIRECT_TYPE_MSK) {
|
|
|
|
case INDIRECT_HOST:
|
2010-04-07 12:10:33 +08:00
|
|
|
offset = iwl_eeprom_query16(priv, EEPROM_LINK_HOST);
|
2010-03-17 08:47:58 +08:00
|
|
|
break;
|
|
|
|
case INDIRECT_GENERAL:
|
2010-04-07 12:10:33 +08:00
|
|
|
offset = iwl_eeprom_query16(priv, EEPROM_LINK_GENERAL);
|
2010-03-17 08:47:58 +08:00
|
|
|
break;
|
|
|
|
case INDIRECT_REGULATORY:
|
2010-04-07 12:10:33 +08:00
|
|
|
offset = iwl_eeprom_query16(priv, EEPROM_LINK_REGULATORY);
|
2010-03-17 08:47:58 +08:00
|
|
|
break;
|
2010-12-10 01:30:14 +08:00
|
|
|
case INDIRECT_TXP_LIMIT:
|
|
|
|
offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT);
|
|
|
|
break;
|
|
|
|
case INDIRECT_TXP_LIMIT_SIZE:
|
|
|
|
offset = iwl_eeprom_query16(priv, EEPROM_LINK_TXP_LIMIT_SIZE);
|
|
|
|
break;
|
2010-03-17 08:47:58 +08:00
|
|
|
case INDIRECT_CALIBRATION:
|
2010-04-07 12:10:33 +08:00
|
|
|
offset = iwl_eeprom_query16(priv, EEPROM_LINK_CALIBRATION);
|
2010-03-17 08:47:58 +08:00
|
|
|
break;
|
|
|
|
case INDIRECT_PROCESS_ADJST:
|
2010-04-07 12:10:33 +08:00
|
|
|
offset = iwl_eeprom_query16(priv, EEPROM_LINK_PROCESS_ADJST);
|
2010-03-17 08:47:58 +08:00
|
|
|
break;
|
|
|
|
case INDIRECT_OTHERS:
|
2010-04-07 12:10:33 +08:00
|
|
|
offset = iwl_eeprom_query16(priv, EEPROM_LINK_OTHERS);
|
2010-03-17 08:47:58 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
IWL_ERR(priv, "illegal indirect type: 0x%X\n",
|
|
|
|
address & INDIRECT_TYPE_MSK);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* translate the offset from words to byte */
|
|
|
|
return (address & ADDRESS_MSK) + (offset << 1);
|
|
|
|
}
|
|
|
|
|
2011-07-08 23:46:19 +08:00
|
|
|
const u8 *iwl_eeprom_query_addr(const struct iwl_priv *priv, size_t offset)
|
2010-03-17 08:47:58 +08:00
|
|
|
{
|
|
|
|
u32 address = eeprom_indirect_address(priv, offset);
|
2010-10-06 23:10:00 +08:00
|
|
|
BUG_ON(address >= priv->cfg->base_params->eeprom_size);
|
2010-03-17 08:47:58 +08:00
|
|
|
return &priv->eeprom[address];
|
|
|
|
}
|
2010-03-17 03:37:27 +08:00
|
|
|
|
|
|
|
struct iwl_mod_params iwlagn_mod_params = {
|
|
|
|
.amsdu_size_8K = 1,
|
|
|
|
.restart_fw = 1,
|
2011-02-28 21:33:15 +08:00
|
|
|
.plcp_check = true,
|
2011-06-04 04:52:38 +08:00
|
|
|
.bt_coex_active = true,
|
2011-06-04 04:52:40 +08:00
|
|
|
.no_sleep_autoadjust = true,
|
2011-06-12 01:00:06 +08:00
|
|
|
.power_level = IWL_POWER_INDEX_1,
|
2011-08-26 14:10:36 +08:00
|
|
|
.bt_ch_announce = 1,
|
|
|
|
.wanted_ucode_alternative = 1,
|
2011-08-26 14:10:55 +08:00
|
|
|
.auto_agg = true,
|
2010-03-17 03:37:27 +08:00
|
|
|
/* the rest are 0 by default */
|
|
|
|
};
|
2010-03-18 04:34:34 +08:00
|
|
|
|
2010-03-18 04:34:36 +08:00
|
|
|
int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band)
|
|
|
|
{
|
|
|
|
int idx = 0;
|
|
|
|
int band_offset = 0;
|
|
|
|
|
|
|
|
/* HT rate format: mac80211 wants an MCS number, which is just LSB */
|
|
|
|
if (rate_n_flags & RATE_MCS_HT_MSK) {
|
|
|
|
idx = (rate_n_flags & 0xff);
|
|
|
|
return idx;
|
|
|
|
/* Legacy rate format, search for match in table */
|
|
|
|
} else {
|
|
|
|
if (band == IEEE80211_BAND_5GHZ)
|
|
|
|
band_offset = IWL_FIRST_OFDM_RATE;
|
|
|
|
for (idx = band_offset; idx < IWL_RATE_COUNT_LEGACY; idx++)
|
|
|
|
if (iwl_rates[idx].plcp == (rate_n_flags & 0xFF))
|
|
|
|
return idx - band_offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2010-04-06 19:12:42 +08:00
|
|
|
static int iwl_get_single_channel_for_scan(struct iwl_priv *priv,
|
2010-04-29 19:43:06 +08:00
|
|
|
struct ieee80211_vif *vif,
|
|
|
|
enum ieee80211_band band,
|
|
|
|
struct iwl_scan_channel *scan_ch)
|
2010-04-06 19:12:42 +08:00
|
|
|
{
|
|
|
|
const struct ieee80211_supported_band *sband;
|
|
|
|
u16 passive_dwell = 0;
|
|
|
|
u16 active_dwell = 0;
|
2010-06-03 12:15:10 +08:00
|
|
|
int added = 0;
|
2010-04-06 19:12:42 +08:00
|
|
|
u16 channel = 0;
|
|
|
|
|
|
|
|
sband = iwl_get_hw_mode(priv, band);
|
|
|
|
if (!sband) {
|
|
|
|
IWL_ERR(priv, "invalid band\n");
|
|
|
|
return added;
|
|
|
|
}
|
|
|
|
|
|
|
|
active_dwell = iwl_get_active_dwell_time(priv, band, 0);
|
2010-04-29 19:43:06 +08:00
|
|
|
passive_dwell = iwl_get_passive_dwell_time(priv, band, vif);
|
2010-04-06 19:12:42 +08:00
|
|
|
|
|
|
|
if (passive_dwell <= active_dwell)
|
|
|
|
passive_dwell = active_dwell + 1;
|
|
|
|
|
2010-06-03 12:15:10 +08:00
|
|
|
channel = iwl_get_single_channel_number(priv, band);
|
2010-04-06 19:12:42 +08:00
|
|
|
if (channel) {
|
|
|
|
scan_ch->channel = cpu_to_le16(channel);
|
|
|
|
scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
|
|
|
|
scan_ch->active_dwell = cpu_to_le16(active_dwell);
|
|
|
|
scan_ch->passive_dwell = cpu_to_le16(passive_dwell);
|
|
|
|
/* Set txpower levels to defaults */
|
|
|
|
scan_ch->dsp_atten = 110;
|
|
|
|
if (band == IEEE80211_BAND_5GHZ)
|
|
|
|
scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
|
|
|
|
else
|
|
|
|
scan_ch->tx_gain = ((1 << 5) | (5 << 3));
|
|
|
|
added++;
|
|
|
|
} else
|
|
|
|
IWL_ERR(priv, "no valid channel found\n");
|
|
|
|
return added;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int iwl_get_channels_for_scan(struct iwl_priv *priv,
|
2010-04-29 19:43:06 +08:00
|
|
|
struct ieee80211_vif *vif,
|
2010-04-06 19:12:42 +08:00
|
|
|
enum ieee80211_band band,
|
|
|
|
u8 is_active, u8 n_probes,
|
|
|
|
struct iwl_scan_channel *scan_ch)
|
|
|
|
{
|
|
|
|
struct ieee80211_channel *chan;
|
|
|
|
const struct ieee80211_supported_band *sband;
|
|
|
|
const struct iwl_channel_info *ch_info;
|
|
|
|
u16 passive_dwell = 0;
|
|
|
|
u16 active_dwell = 0;
|
|
|
|
int added, i;
|
|
|
|
u16 channel;
|
|
|
|
|
|
|
|
sband = iwl_get_hw_mode(priv, band);
|
|
|
|
if (!sband)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
active_dwell = iwl_get_active_dwell_time(priv, band, n_probes);
|
2010-04-29 19:43:06 +08:00
|
|
|
passive_dwell = iwl_get_passive_dwell_time(priv, band, vif);
|
2010-04-06 19:12:42 +08:00
|
|
|
|
|
|
|
if (passive_dwell <= active_dwell)
|
|
|
|
passive_dwell = active_dwell + 1;
|
|
|
|
|
|
|
|
for (i = 0, added = 0; i < priv->scan_request->n_channels; i++) {
|
|
|
|
chan = priv->scan_request->channels[i];
|
|
|
|
|
|
|
|
if (chan->band != band)
|
|
|
|
continue;
|
|
|
|
|
2010-07-29 04:40:27 +08:00
|
|
|
channel = chan->hw_value;
|
2010-04-06 19:12:42 +08:00
|
|
|
scan_ch->channel = cpu_to_le16(channel);
|
|
|
|
|
|
|
|
ch_info = iwl_get_channel_info(priv, band, channel);
|
|
|
|
if (!is_channel_valid(ch_info)) {
|
|
|
|
IWL_DEBUG_SCAN(priv, "Channel %d is INVALID for this band.\n",
|
|
|
|
channel);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!is_active || is_channel_passive(ch_info) ||
|
|
|
|
(chan->flags & IEEE80211_CHAN_PASSIVE_SCAN))
|
|
|
|
scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
|
|
|
|
else
|
|
|
|
scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE;
|
|
|
|
|
|
|
|
if (n_probes)
|
|
|
|
scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes);
|
|
|
|
|
|
|
|
scan_ch->active_dwell = cpu_to_le16(active_dwell);
|
|
|
|
scan_ch->passive_dwell = cpu_to_le16(passive_dwell);
|
|
|
|
|
|
|
|
/* Set txpower levels to defaults */
|
|
|
|
scan_ch->dsp_atten = 110;
|
|
|
|
|
|
|
|
/* NOTE: if we were doing 6Mb OFDM for scans we'd use
|
|
|
|
* power level:
|
|
|
|
* scan_ch->tx_gain = ((1 << 5) | (2 << 3)) | 3;
|
|
|
|
*/
|
|
|
|
if (band == IEEE80211_BAND_5GHZ)
|
|
|
|
scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
|
|
|
|
else
|
|
|
|
scan_ch->tx_gain = ((1 << 5) | (5 << 3));
|
|
|
|
|
|
|
|
IWL_DEBUG_SCAN(priv, "Scanning ch=%d prob=0x%X [%s %d]\n",
|
|
|
|
channel, le32_to_cpu(scan_ch->type),
|
|
|
|
(scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ?
|
|
|
|
"ACTIVE" : "PASSIVE",
|
|
|
|
(scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ?
|
|
|
|
active_dwell : passive_dwell);
|
|
|
|
|
|
|
|
scan_ch++;
|
|
|
|
added++;
|
|
|
|
}
|
|
|
|
|
|
|
|
IWL_DEBUG_SCAN(priv, "total channels to scan %d\n", added);
|
|
|
|
return added;
|
|
|
|
}
|
|
|
|
|
2010-09-13 20:46:33 +08:00
|
|
|
int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
|
2010-04-06 19:12:42 +08:00
|
|
|
{
|
|
|
|
struct iwl_host_cmd cmd = {
|
|
|
|
.id = REPLY_SCAN_CMD,
|
2011-05-04 22:50:38 +08:00
|
|
|
.len = { sizeof(struct iwl_scan_cmd), },
|
2011-07-08 23:46:14 +08:00
|
|
|
.flags = CMD_SYNC,
|
2010-04-06 19:12:42 +08:00
|
|
|
};
|
|
|
|
struct iwl_scan_cmd *scan;
|
2010-08-27 23:53:46 +08:00
|
|
|
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
|
2010-04-06 19:12:42 +08:00
|
|
|
u32 rate_flags = 0;
|
|
|
|
u16 cmd_len;
|
|
|
|
u16 rx_chain = 0;
|
|
|
|
enum ieee80211_band band;
|
|
|
|
u8 n_probes = 0;
|
2011-08-26 14:10:39 +08:00
|
|
|
u8 rx_ant = hw_params(priv).valid_rx_ant;
|
2010-04-06 19:12:42 +08:00
|
|
|
u8 rate;
|
|
|
|
bool is_active = false;
|
|
|
|
int chan_mod;
|
|
|
|
u8 active_chains;
|
2011-08-26 14:10:39 +08:00
|
|
|
u8 scan_tx_antennas = hw_params(priv).valid_tx_ant;
|
2010-09-13 20:46:33 +08:00
|
|
|
int ret;
|
|
|
|
|
2011-08-26 14:10:44 +08:00
|
|
|
lockdep_assert_held(&priv->shrd->mutex);
|
2010-04-06 19:12:42 +08:00
|
|
|
|
2010-08-27 23:53:46 +08:00
|
|
|
if (vif)
|
|
|
|
ctx = iwl_rxon_ctx_from_vif(vif);
|
|
|
|
|
2010-04-06 19:12:42 +08:00
|
|
|
if (!priv->scan_cmd) {
|
|
|
|
priv->scan_cmd = kmalloc(sizeof(struct iwl_scan_cmd) +
|
|
|
|
IWL_MAX_SCAN_SIZE, GFP_KERNEL);
|
|
|
|
if (!priv->scan_cmd) {
|
|
|
|
IWL_DEBUG_SCAN(priv,
|
|
|
|
"fail to allocate memory for scan\n");
|
2010-09-13 20:46:33 +08:00
|
|
|
return -ENOMEM;
|
2010-04-06 19:12:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
scan = priv->scan_cmd;
|
|
|
|
memset(scan, 0, sizeof(struct iwl_scan_cmd) + IWL_MAX_SCAN_SIZE);
|
|
|
|
|
|
|
|
scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
|
|
|
|
scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
|
|
|
|
|
2011-07-24 01:24:47 +08:00
|
|
|
if (priv->scan_type != IWL_SCAN_ROC &&
|
2011-03-11 12:13:26 +08:00
|
|
|
iwl_is_any_associated(priv)) {
|
2010-04-06 19:12:42 +08:00
|
|
|
u16 interval = 0;
|
|
|
|
u32 extra;
|
|
|
|
u32 suspend_time = 100;
|
|
|
|
u32 scan_suspend_time = 100;
|
|
|
|
|
|
|
|
IWL_DEBUG_INFO(priv, "Scanning while associated...\n");
|
2011-03-11 12:13:26 +08:00
|
|
|
switch (priv->scan_type) {
|
2011-07-24 01:24:47 +08:00
|
|
|
case IWL_SCAN_ROC:
|
2011-03-11 12:13:26 +08:00
|
|
|
WARN_ON(1);
|
|
|
|
break;
|
|
|
|
case IWL_SCAN_RADIO_RESET:
|
2010-07-23 03:24:56 +08:00
|
|
|
interval = 0;
|
2011-03-11 12:13:26 +08:00
|
|
|
break;
|
|
|
|
case IWL_SCAN_NORMAL:
|
2010-07-23 03:24:56 +08:00
|
|
|
interval = vif->bss_conf.beacon_int;
|
2011-03-11 12:13:26 +08:00
|
|
|
break;
|
|
|
|
}
|
2010-04-06 19:12:42 +08:00
|
|
|
|
|
|
|
scan->suspend_time = 0;
|
|
|
|
scan->max_out_time = cpu_to_le32(200 * 1024);
|
|
|
|
if (!interval)
|
|
|
|
interval = suspend_time;
|
|
|
|
|
|
|
|
extra = (suspend_time / interval) << 22;
|
|
|
|
scan_suspend_time = (extra |
|
|
|
|
((suspend_time % interval) * 1024));
|
|
|
|
scan->suspend_time = cpu_to_le32(scan_suspend_time);
|
|
|
|
IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n",
|
|
|
|
scan_suspend_time, interval);
|
2011-07-24 01:24:47 +08:00
|
|
|
} else if (priv->scan_type == IWL_SCAN_ROC) {
|
2011-03-11 12:13:26 +08:00
|
|
|
scan->suspend_time = 0;
|
2011-07-24 01:24:47 +08:00
|
|
|
scan->max_out_time = 0;
|
|
|
|
scan->quiet_time = 0;
|
|
|
|
scan->quiet_plcp_th = 0;
|
2010-04-06 19:12:42 +08:00
|
|
|
}
|
|
|
|
|
2011-03-11 12:13:26 +08:00
|
|
|
switch (priv->scan_type) {
|
|
|
|
case IWL_SCAN_RADIO_RESET:
|
2010-04-06 19:12:42 +08:00
|
|
|
IWL_DEBUG_SCAN(priv, "Start internal passive scan.\n");
|
2011-03-11 12:13:26 +08:00
|
|
|
break;
|
|
|
|
case IWL_SCAN_NORMAL:
|
|
|
|
if (priv->scan_request->n_ssids) {
|
|
|
|
int i, p = 0;
|
|
|
|
IWL_DEBUG_SCAN(priv, "Kicking off active scan\n");
|
|
|
|
for (i = 0; i < priv->scan_request->n_ssids; i++) {
|
|
|
|
/* always does wildcard anyway */
|
|
|
|
if (!priv->scan_request->ssids[i].ssid_len)
|
|
|
|
continue;
|
|
|
|
scan->direct_scan[p].id = WLAN_EID_SSID;
|
|
|
|
scan->direct_scan[p].len =
|
|
|
|
priv->scan_request->ssids[i].ssid_len;
|
|
|
|
memcpy(scan->direct_scan[p].ssid,
|
|
|
|
priv->scan_request->ssids[i].ssid,
|
|
|
|
priv->scan_request->ssids[i].ssid_len);
|
|
|
|
n_probes++;
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
is_active = true;
|
|
|
|
} else
|
|
|
|
IWL_DEBUG_SCAN(priv, "Start passive scan.\n");
|
|
|
|
break;
|
2011-07-24 01:24:47 +08:00
|
|
|
case IWL_SCAN_ROC:
|
|
|
|
IWL_DEBUG_SCAN(priv, "Start ROC scan.\n");
|
2011-03-11 12:13:26 +08:00
|
|
|
break;
|
|
|
|
}
|
2010-04-06 19:12:42 +08:00
|
|
|
|
|
|
|
scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
|
2010-08-27 23:53:46 +08:00
|
|
|
scan->tx_cmd.sta_id = ctx->bcast_sta_id;
|
2010-04-06 19:12:42 +08:00
|
|
|
scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
|
|
|
|
|
|
|
|
switch (priv->scan_band) {
|
|
|
|
case IEEE80211_BAND_2GHZ:
|
|
|
|
scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
|
2010-08-23 16:46:32 +08:00
|
|
|
chan_mod = le32_to_cpu(
|
|
|
|
priv->contexts[IWL_RXON_CTX_BSS].active.flags &
|
|
|
|
RXON_FLG_CHANNEL_MODE_MSK)
|
2010-04-06 19:12:42 +08:00
|
|
|
>> RXON_FLG_CHANNEL_MODE_POS;
|
|
|
|
if (chan_mod == CHANNEL_MODE_PURE_40) {
|
|
|
|
rate = IWL_RATE_6M_PLCP;
|
|
|
|
} else {
|
|
|
|
rate = IWL_RATE_1M_PLCP;
|
|
|
|
rate_flags = RATE_MCS_CCK_MSK;
|
|
|
|
}
|
2010-08-23 22:56:56 +08:00
|
|
|
/*
|
|
|
|
* Internal scans are passive, so we can indiscriminately set
|
|
|
|
* the BT ignore flag on 2.4 GHz since it applies to TX only.
|
|
|
|
*/
|
2010-10-06 23:10:00 +08:00
|
|
|
if (priv->cfg->bt_params &&
|
|
|
|
priv->cfg->bt_params->advanced_bt_coexist)
|
2010-08-23 22:56:56 +08:00
|
|
|
scan->tx_cmd.tx_flags |= TX_CMD_FLG_IGNORE_BT;
|
2010-04-06 19:12:42 +08:00
|
|
|
break;
|
|
|
|
case IEEE80211_BAND_5GHZ:
|
|
|
|
rate = IWL_RATE_6M_PLCP;
|
|
|
|
break;
|
|
|
|
default:
|
2010-09-13 20:46:33 +08:00
|
|
|
IWL_WARN(priv, "Invalid scan band\n");
|
|
|
|
return -EIO;
|
2010-04-06 19:12:42 +08:00
|
|
|
}
|
|
|
|
|
2010-10-04 20:47:23 +08:00
|
|
|
/*
|
|
|
|
* If active scanning is requested but a certain channel is
|
|
|
|
* marked passive, we can do active scanning if we detect
|
|
|
|
* transmissions.
|
|
|
|
*
|
|
|
|
* There is an issue with some firmware versions that triggers
|
|
|
|
* a sysassert on a "good CRC threshold" of zero (== disabled),
|
|
|
|
* on a radar channel even though this means that we should NOT
|
|
|
|
* send probes.
|
|
|
|
*
|
|
|
|
* The "good CRC threshold" is the number of frames that we
|
|
|
|
* need to receive during our dwell time on a channel before
|
|
|
|
* sending out probes -- setting this to a huge value will
|
|
|
|
* mean we never reach it, but at the same time work around
|
|
|
|
* the aforementioned issue. Thus use IWL_GOOD_CRC_TH_NEVER
|
|
|
|
* here instead of IWL_GOOD_CRC_TH_DISABLED.
|
2011-04-21 00:10:39 +08:00
|
|
|
*
|
|
|
|
* This was fixed in later versions along with some other
|
|
|
|
* scan changes, and the threshold behaves as a flag in those
|
|
|
|
* versions.
|
2010-10-04 20:47:23 +08:00
|
|
|
*/
|
2011-04-21 00:10:39 +08:00
|
|
|
if (priv->new_scan_threshold_behaviour)
|
|
|
|
scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT :
|
|
|
|
IWL_GOOD_CRC_TH_DISABLED;
|
|
|
|
else
|
|
|
|
scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT :
|
|
|
|
IWL_GOOD_CRC_TH_NEVER;
|
2010-10-04 20:47:23 +08:00
|
|
|
|
2010-04-06 19:12:42 +08:00
|
|
|
band = priv->scan_band;
|
|
|
|
|
2010-05-18 17:48:36 +08:00
|
|
|
if (priv->cfg->scan_rx_antennas[band])
|
|
|
|
rx_ant = priv->cfg->scan_rx_antennas[band];
|
2010-04-13 16:04:35 +08:00
|
|
|
|
2010-12-23 22:12:30 +08:00
|
|
|
if (band == IEEE80211_BAND_2GHZ &&
|
|
|
|
priv->cfg->bt_params &&
|
|
|
|
priv->cfg->bt_params->advanced_bt_coexist) {
|
|
|
|
/* transmit 2.4 GHz probes only on first antenna */
|
|
|
|
scan_tx_antennas = first_antenna(scan_tx_antennas);
|
2010-08-23 22:57:04 +08:00
|
|
|
}
|
|
|
|
|
2010-05-18 17:48:36 +08:00
|
|
|
priv->scan_tx_ant[band] = iwl_toggle_tx_ant(priv, priv->scan_tx_ant[band],
|
|
|
|
scan_tx_antennas);
|
2010-04-06 19:12:42 +08:00
|
|
|
rate_flags |= iwl_ant_idx_to_flags(priv->scan_tx_ant[band]);
|
|
|
|
scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags);
|
|
|
|
|
|
|
|
/* In power save mode use one chain, otherwise use all chains */
|
2011-08-26 14:10:42 +08:00
|
|
|
if (test_bit(STATUS_POWER_PMI, &priv->shrd->status)) {
|
2010-04-06 19:12:42 +08:00
|
|
|
/* rx_ant has been set to all valid chains previously */
|
|
|
|
active_chains = rx_ant &
|
|
|
|
((u8)(priv->chain_noise_data.active_chains));
|
|
|
|
if (!active_chains)
|
|
|
|
active_chains = rx_ant;
|
|
|
|
|
|
|
|
IWL_DEBUG_SCAN(priv, "chain_noise_data.active_chains: %u\n",
|
|
|
|
priv->chain_noise_data.active_chains);
|
|
|
|
|
|
|
|
rx_ant = first_antenna(active_chains);
|
|
|
|
}
|
2010-10-06 23:10:00 +08:00
|
|
|
if (priv->cfg->bt_params &&
|
|
|
|
priv->cfg->bt_params->advanced_bt_coexist &&
|
|
|
|
priv->bt_full_concurrent) {
|
2010-08-23 22:57:04 +08:00
|
|
|
/* operated as 1x1 in full concurrency mode */
|
|
|
|
rx_ant = first_antenna(rx_ant);
|
|
|
|
}
|
|
|
|
|
2010-04-06 19:12:42 +08:00
|
|
|
/* MIMO is not used here, but value is required */
|
2011-08-26 14:10:39 +08:00
|
|
|
rx_chain |=
|
|
|
|
hw_params(priv).valid_rx_ant << RXON_RX_CHAIN_VALID_POS;
|
2010-04-06 19:12:42 +08:00
|
|
|
rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS;
|
|
|
|
rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS;
|
|
|
|
rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS;
|
|
|
|
scan->rx_chain = cpu_to_le16(rx_chain);
|
2011-03-11 12:13:26 +08:00
|
|
|
switch (priv->scan_type) {
|
|
|
|
case IWL_SCAN_NORMAL:
|
2010-04-06 19:12:42 +08:00
|
|
|
cmd_len = iwl_fill_probe_req(priv,
|
|
|
|
(struct ieee80211_mgmt *)scan->data,
|
2010-05-12 18:33:12 +08:00
|
|
|
vif->addr,
|
2010-04-06 19:12:42 +08:00
|
|
|
priv->scan_request->ie,
|
|
|
|
priv->scan_request->ie_len,
|
|
|
|
IWL_MAX_SCAN_SIZE - sizeof(*scan));
|
2011-03-11 12:13:26 +08:00
|
|
|
break;
|
|
|
|
case IWL_SCAN_RADIO_RESET:
|
2011-07-24 01:24:47 +08:00
|
|
|
case IWL_SCAN_ROC:
|
2010-05-12 18:33:12 +08:00
|
|
|
/* use bcast addr, will not be transmitted but must be valid */
|
2010-04-06 19:12:42 +08:00
|
|
|
cmd_len = iwl_fill_probe_req(priv,
|
|
|
|
(struct ieee80211_mgmt *)scan->data,
|
2010-05-12 18:33:12 +08:00
|
|
|
iwl_bcast_addr, NULL, 0,
|
2010-04-06 19:12:42 +08:00
|
|
|
IWL_MAX_SCAN_SIZE - sizeof(*scan));
|
2011-03-11 12:13:26 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
BUG();
|
2010-04-06 19:12:42 +08:00
|
|
|
}
|
|
|
|
scan->tx_cmd.len = cpu_to_le16(cmd_len);
|
|
|
|
|
|
|
|
scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK |
|
|
|
|
RXON_FILTER_BCON_AWARE_MSK);
|
|
|
|
|
2011-03-11 12:13:26 +08:00
|
|
|
switch (priv->scan_type) {
|
|
|
|
case IWL_SCAN_RADIO_RESET:
|
2010-04-06 19:12:42 +08:00
|
|
|
scan->channel_count =
|
2010-04-29 19:43:06 +08:00
|
|
|
iwl_get_single_channel_for_scan(priv, vif, band,
|
2011-03-11 12:13:26 +08:00
|
|
|
(void *)&scan->data[cmd_len]);
|
|
|
|
break;
|
|
|
|
case IWL_SCAN_NORMAL:
|
2010-04-06 19:12:42 +08:00
|
|
|
scan->channel_count =
|
2010-04-29 19:43:06 +08:00
|
|
|
iwl_get_channels_for_scan(priv, vif, band,
|
2010-04-06 19:12:42 +08:00
|
|
|
is_active, n_probes,
|
2011-03-11 12:13:26 +08:00
|
|
|
(void *)&scan->data[cmd_len]);
|
|
|
|
break;
|
2011-07-24 01:24:47 +08:00
|
|
|
case IWL_SCAN_ROC: {
|
2011-03-11 12:13:26 +08:00
|
|
|
struct iwl_scan_channel *scan_ch;
|
|
|
|
|
|
|
|
scan->channel_count = 1;
|
|
|
|
|
|
|
|
scan_ch = (void *)&scan->data[cmd_len];
|
2011-07-24 01:24:47 +08:00
|
|
|
scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
|
2011-03-11 12:13:26 +08:00
|
|
|
scan_ch->channel =
|
2011-07-24 01:24:47 +08:00
|
|
|
cpu_to_le16(priv->hw_roc_channel->hw_value);
|
2011-03-11 12:13:26 +08:00
|
|
|
scan_ch->active_dwell =
|
2011-07-24 01:24:47 +08:00
|
|
|
scan_ch->passive_dwell =
|
|
|
|
cpu_to_le16(priv->hw_roc_duration);
|
2011-03-11 12:13:26 +08:00
|
|
|
|
|
|
|
/* Set txpower levels to defaults */
|
|
|
|
scan_ch->dsp_atten = 110;
|
|
|
|
|
|
|
|
/* NOTE: if we were doing 6Mb OFDM for scans we'd use
|
|
|
|
* power level:
|
|
|
|
* scan_ch->tx_gain = ((1 << 5) | (2 << 3)) | 3;
|
|
|
|
*/
|
2011-07-24 01:24:47 +08:00
|
|
|
if (priv->hw_roc_channel->band == IEEE80211_BAND_5GHZ)
|
2011-03-11 12:13:26 +08:00
|
|
|
scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
|
|
|
|
else
|
|
|
|
scan_ch->tx_gain = ((1 << 5) | (5 << 3));
|
|
|
|
}
|
|
|
|
break;
|
2010-04-06 19:12:42 +08:00
|
|
|
}
|
2011-03-11 12:13:26 +08:00
|
|
|
|
2010-04-06 19:12:42 +08:00
|
|
|
if (scan->channel_count == 0) {
|
|
|
|
IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count);
|
2010-09-13 20:46:33 +08:00
|
|
|
return -EIO;
|
2010-04-06 19:12:42 +08:00
|
|
|
}
|
|
|
|
|
2011-05-04 22:50:38 +08:00
|
|
|
cmd.len[0] += le16_to_cpu(scan->tx_cmd.len) +
|
2010-04-06 19:12:42 +08:00
|
|
|
scan->channel_count * sizeof(struct iwl_scan_channel);
|
2011-05-04 22:50:38 +08:00
|
|
|
cmd.data[0] = scan;
|
2011-05-14 02:57:40 +08:00
|
|
|
cmd.dataflags[0] = IWL_HCMD_DFL_NOCOPY;
|
2011-05-04 22:50:38 +08:00
|
|
|
scan->len = cpu_to_le16(cmd.len[0]);
|
2010-04-06 19:12:42 +08:00
|
|
|
|
2010-09-22 22:32:13 +08:00
|
|
|
/* set scan bit here for PAN params */
|
2011-08-26 14:10:42 +08:00
|
|
|
set_bit(STATUS_SCAN_HW, &priv->shrd->status);
|
2010-09-22 22:32:13 +08:00
|
|
|
|
2011-07-01 22:59:26 +08:00
|
|
|
ret = iwlagn_set_pan_params(priv);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2010-04-06 19:12:42 +08:00
|
|
|
|
iwlagn: bus layer chooses its transport layer
Remove iwl_transport_register which was a W/A. The bus layer knows what
transport to use. So now, the bus layer gives the upper layer a pointer to the
iwl_trans_ops struct that it wants to use. The upper layer then, allocates the
desired transport layer using iwl_trans_ops->alloc function.
As a result of this, priv->trans, no longer exists, priv holds a pointer to
iwl_shared, which holds a pointer to iwl_trans. This required to change all the
calls to the transport layer from upper layer. While we were at it, trans_X
inlines have been renamed to iwl_trans_X to avoid confusions, which of course
required to rename the functions inside the transport layer because of
conflicts in names. So the static API functions inside the transport layer
implementation have been renamed to iwl_trans_pcie_X.
Until now, the IRQ / Tasklet were initialized in iwl_transport_layer. This is
confusing since the registration doesn't mean to request IRQ, so I added a
handler for that.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-26 14:10:48 +08:00
|
|
|
ret = iwl_trans_send_cmd(trans(priv), &cmd);
|
2010-09-13 20:46:33 +08:00
|
|
|
if (ret) {
|
2011-08-26 14:10:42 +08:00
|
|
|
clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
|
2011-07-01 22:59:26 +08:00
|
|
|
iwlagn_set_pan_params(priv);
|
2010-09-13 20:46:33 +08:00
|
|
|
}
|
2010-04-06 19:12:42 +08:00
|
|
|
|
2010-09-13 20:46:33 +08:00
|
|
|
return ret;
|
2010-04-06 19:12:42 +08:00
|
|
|
}
|
2010-04-28 23:44:52 +08:00
|
|
|
|
|
|
|
int iwlagn_manage_ibss_station(struct iwl_priv *priv,
|
|
|
|
struct ieee80211_vif *vif, bool add)
|
|
|
|
{
|
2010-05-01 02:30:43 +08:00
|
|
|
struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
|
|
|
|
|
2010-04-28 23:44:52 +08:00
|
|
|
if (add)
|
2010-09-23 00:02:01 +08:00
|
|
|
return iwlagn_add_bssid_station(priv, vif_priv->ctx,
|
|
|
|
vif->bss_conf.bssid,
|
|
|
|
&vif_priv->ibss_bssid_sta_id);
|
2010-05-01 02:30:43 +08:00
|
|
|
return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id,
|
|
|
|
vif->bss_conf.bssid);
|
2010-04-28 23:44:52 +08:00
|
|
|
}
|
2010-05-03 16:22:42 +08:00
|
|
|
|
|
|
|
void iwl_free_tfds_in_queue(struct iwl_priv *priv,
|
|
|
|
int sta_id, int tid, int freed)
|
|
|
|
{
|
2011-08-26 14:10:47 +08:00
|
|
|
lockdep_assert_held(&priv->shrd->sta_lock);
|
2010-05-05 17:26:06 +08:00
|
|
|
|
2010-05-03 16:22:42 +08:00
|
|
|
if (priv->stations[sta_id].tid[tid].tfds_in_queue >= freed)
|
|
|
|
priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
|
|
|
|
else {
|
|
|
|
IWL_DEBUG_TX(priv, "free more than tfds_in_queue (%u:%d)\n",
|
|
|
|
priv->stations[sta_id].tid[tid].tfds_in_queue,
|
|
|
|
freed);
|
|
|
|
priv->stations[sta_id].tid[tid].tfds_in_queue = 0;
|
|
|
|
}
|
|
|
|
}
|
2010-06-25 04:22:36 +08:00
|
|
|
|
|
|
|
#define IWL_FLUSH_WAIT_MS 2000
|
|
|
|
|
|
|
|
int iwlagn_wait_tx_queue_empty(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
struct iwl_tx_queue *txq;
|
|
|
|
struct iwl_queue *q;
|
|
|
|
int cnt;
|
|
|
|
unsigned long now = jiffies;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
/* waiting for all the tx frames complete might take a while */
|
2011-08-26 14:10:39 +08:00
|
|
|
for (cnt = 0; cnt < hw_params(priv).max_txq_num; cnt++) {
|
2011-08-26 14:10:40 +08:00
|
|
|
if (cnt == priv->shrd->cmd_queue)
|
2010-06-25 04:22:36 +08:00
|
|
|
continue;
|
|
|
|
txq = &priv->txq[cnt];
|
|
|
|
q = &txq->q;
|
|
|
|
while (q->read_ptr != q->write_ptr && !time_after(jiffies,
|
|
|
|
now + msecs_to_jiffies(IWL_FLUSH_WAIT_MS)))
|
|
|
|
msleep(1);
|
|
|
|
|
|
|
|
if (q->read_ptr != q->write_ptr) {
|
|
|
|
IWL_ERR(priv, "fail to flush all tx fifo queues\n");
|
|
|
|
ret = -ETIMEDOUT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define IWL_TX_QUEUE_MSK 0xfffff
|
|
|
|
|
|
|
|
/**
|
|
|
|
* iwlagn_txfifo_flush: send REPLY_TXFIFO_FLUSH command to uCode
|
|
|
|
*
|
|
|
|
* pre-requirements:
|
|
|
|
* 1. acquire mutex before calling
|
|
|
|
* 2. make sure rf is on and not in exit state
|
|
|
|
*/
|
|
|
|
int iwlagn_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
|
|
|
|
{
|
|
|
|
struct iwl_txfifo_flush_cmd flush_cmd;
|
|
|
|
struct iwl_host_cmd cmd = {
|
|
|
|
.id = REPLY_TXFIFO_FLUSH,
|
2011-05-04 22:50:38 +08:00
|
|
|
.len = { sizeof(struct iwl_txfifo_flush_cmd), },
|
2010-06-25 04:22:36 +08:00
|
|
|
.flags = CMD_SYNC,
|
2011-05-04 22:50:38 +08:00
|
|
|
.data = { &flush_cmd, },
|
2010-06-25 04:22:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
might_sleep();
|
|
|
|
|
|
|
|
memset(&flush_cmd, 0, sizeof(flush_cmd));
|
2011-06-09 00:57:26 +08:00
|
|
|
if (flush_control & BIT(IWL_RXON_CTX_BSS))
|
|
|
|
flush_cmd.fifo_control = IWL_SCD_VO_MSK | IWL_SCD_VI_MSK |
|
2011-06-09 00:57:25 +08:00
|
|
|
IWL_SCD_BE_MSK | IWL_SCD_BK_MSK |
|
|
|
|
IWL_SCD_MGMT_MSK;
|
2011-06-09 00:57:26 +08:00
|
|
|
if ((flush_control & BIT(IWL_RXON_CTX_PAN)) &&
|
|
|
|
(priv->valid_contexts != BIT(IWL_RXON_CTX_BSS)))
|
2011-06-09 00:57:25 +08:00
|
|
|
flush_cmd.fifo_control |= IWL_PAN_SCD_VO_MSK |
|
|
|
|
IWL_PAN_SCD_VI_MSK | IWL_PAN_SCD_BE_MSK |
|
|
|
|
IWL_PAN_SCD_BK_MSK | IWL_PAN_SCD_MGMT_MSK |
|
|
|
|
IWL_PAN_SCD_MULTICAST_MSK;
|
|
|
|
|
2011-06-07 03:05:46 +08:00
|
|
|
if (priv->cfg->sku & EEPROM_SKU_CAP_11N_ENABLE)
|
2010-06-25 04:22:36 +08:00
|
|
|
flush_cmd.fifo_control |= IWL_AGG_TX_QUEUE_MSK;
|
|
|
|
|
|
|
|
IWL_DEBUG_INFO(priv, "fifo queue control: 0X%x\n",
|
|
|
|
flush_cmd.fifo_control);
|
|
|
|
flush_cmd.flush_control = cpu_to_le16(flush_control);
|
|
|
|
|
iwlagn: bus layer chooses its transport layer
Remove iwl_transport_register which was a W/A. The bus layer knows what
transport to use. So now, the bus layer gives the upper layer a pointer to the
iwl_trans_ops struct that it wants to use. The upper layer then, allocates the
desired transport layer using iwl_trans_ops->alloc function.
As a result of this, priv->trans, no longer exists, priv holds a pointer to
iwl_shared, which holds a pointer to iwl_trans. This required to change all the
calls to the transport layer from upper layer. While we were at it, trans_X
inlines have been renamed to iwl_trans_X to avoid confusions, which of course
required to rename the functions inside the transport layer because of
conflicts in names. So the static API functions inside the transport layer
implementation have been renamed to iwl_trans_pcie_X.
Until now, the IRQ / Tasklet were initialized in iwl_transport_layer. This is
confusing since the registration doesn't mean to request IRQ, so I added a
handler for that.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-26 14:10:48 +08:00
|
|
|
return iwl_trans_send_cmd(trans(priv), &cmd);
|
2010-06-25 04:22:36 +08:00
|
|
|
}
|
2010-06-25 04:18:35 +08:00
|
|
|
|
|
|
|
void iwlagn_dev_txfifo_flush(struct iwl_priv *priv, u16 flush_control)
|
|
|
|
{
|
2011-08-26 14:10:44 +08:00
|
|
|
mutex_lock(&priv->shrd->mutex);
|
2010-06-25 04:18:35 +08:00
|
|
|
ieee80211_stop_queues(priv->hw);
|
2011-06-18 23:03:18 +08:00
|
|
|
if (iwlagn_txfifo_flush(priv, IWL_DROP_ALL)) {
|
2010-06-25 04:18:35 +08:00
|
|
|
IWL_ERR(priv, "flush request fail\n");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
IWL_DEBUG_INFO(priv, "wait transmit/flush all frames\n");
|
|
|
|
iwlagn_wait_tx_queue_empty(priv);
|
|
|
|
done:
|
|
|
|
ieee80211_wake_queues(priv->hw);
|
2011-08-26 14:10:44 +08:00
|
|
|
mutex_unlock(&priv->shrd->mutex);
|
2010-06-25 04:18:35 +08:00
|
|
|
}
|
2010-08-23 22:57:14 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* BT coex
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Macros to access the lookup table.
|
|
|
|
*
|
|
|
|
* The lookup table has 7 inputs: bt3_prio, bt3_txrx, bt_rf_act, wifi_req,
|
|
|
|
* wifi_prio, wifi_txrx and wifi_sh_ant_req.
|
|
|
|
*
|
|
|
|
* It has three outputs: WLAN_ACTIVE, WLAN_KILL and ANT_SWITCH
|
|
|
|
*
|
|
|
|
* The format is that "registers" 8 through 11 contain the WLAN_ACTIVE bits
|
|
|
|
* one after another in 32-bit registers, and "registers" 0 through 7 contain
|
|
|
|
* the WLAN_KILL and ANT_SWITCH bits interleaved (in that order).
|
|
|
|
*
|
|
|
|
* These macros encode that format.
|
|
|
|
*/
|
|
|
|
#define LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, wifi_req, wifi_prio, \
|
|
|
|
wifi_txrx, wifi_sh_ant_req) \
|
|
|
|
(bt3_prio | (bt3_txrx << 1) | (bt_rf_act << 2) | (wifi_req << 3) | \
|
|
|
|
(wifi_prio << 4) | (wifi_txrx << 5) | (wifi_sh_ant_req << 6))
|
|
|
|
|
|
|
|
#define LUT_PTA_WLAN_ACTIVE_OP(lut, op, val) \
|
|
|
|
lut[8 + ((val) >> 5)] op (cpu_to_le32(BIT((val) & 0x1f)))
|
|
|
|
#define LUT_TEST_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
|
|
|
|
wifi_prio, wifi_txrx, wifi_sh_ant_req) \
|
|
|
|
(!!(LUT_PTA_WLAN_ACTIVE_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, \
|
|
|
|
bt_rf_act, wifi_req, wifi_prio, wifi_txrx, \
|
|
|
|
wifi_sh_ant_req))))
|
|
|
|
#define LUT_SET_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
|
|
|
|
wifi_prio, wifi_txrx, wifi_sh_ant_req) \
|
|
|
|
LUT_PTA_WLAN_ACTIVE_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, \
|
|
|
|
bt_rf_act, wifi_req, wifi_prio, wifi_txrx, \
|
|
|
|
wifi_sh_ant_req))
|
|
|
|
#define LUT_CLEAR_PTA_WLAN_ACTIVE(lut, bt3_prio, bt3_txrx, bt_rf_act, \
|
|
|
|
wifi_req, wifi_prio, wifi_txrx, \
|
|
|
|
wifi_sh_ant_req) \
|
|
|
|
LUT_PTA_WLAN_ACTIVE_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, \
|
|
|
|
bt_rf_act, wifi_req, wifi_prio, wifi_txrx, \
|
|
|
|
wifi_sh_ant_req))
|
|
|
|
|
|
|
|
#define LUT_WLAN_KILL_OP(lut, op, val) \
|
|
|
|
lut[(val) >> 4] op (cpu_to_le32(BIT(((val) << 1) & 0x1e)))
|
|
|
|
#define LUT_TEST_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
|
|
|
|
wifi_prio, wifi_txrx, wifi_sh_ant_req) \
|
|
|
|
(!!(LUT_WLAN_KILL_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
|
|
|
|
wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))))
|
|
|
|
#define LUT_SET_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
|
|
|
|
wifi_prio, wifi_txrx, wifi_sh_ant_req) \
|
|
|
|
LUT_WLAN_KILL_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
|
|
|
|
wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
|
|
|
|
#define LUT_CLEAR_WLAN_KILL(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
|
|
|
|
wifi_prio, wifi_txrx, wifi_sh_ant_req) \
|
|
|
|
LUT_WLAN_KILL_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
|
|
|
|
wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
|
|
|
|
|
|
|
|
#define LUT_ANT_SWITCH_OP(lut, op, val) \
|
|
|
|
lut[(val) >> 4] op (cpu_to_le32(BIT((((val) << 1) & 0x1e) + 1)))
|
|
|
|
#define LUT_TEST_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
|
|
|
|
wifi_prio, wifi_txrx, wifi_sh_ant_req) \
|
|
|
|
(!!(LUT_ANT_SWITCH_OP(lut, &, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
|
|
|
|
wifi_req, wifi_prio, wifi_txrx, \
|
|
|
|
wifi_sh_ant_req))))
|
|
|
|
#define LUT_SET_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
|
|
|
|
wifi_prio, wifi_txrx, wifi_sh_ant_req) \
|
|
|
|
LUT_ANT_SWITCH_OP(lut, |=, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
|
|
|
|
wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
|
|
|
|
#define LUT_CLEAR_ANT_SWITCH(lut, bt3_prio, bt3_txrx, bt_rf_act, wifi_req, \
|
|
|
|
wifi_prio, wifi_txrx, wifi_sh_ant_req) \
|
|
|
|
LUT_ANT_SWITCH_OP(lut, &= ~, LUT_VALUE(bt3_prio, bt3_txrx, bt_rf_act, \
|
|
|
|
wifi_req, wifi_prio, wifi_txrx, wifi_sh_ant_req))
|
|
|
|
|
|
|
|
static const __le32 iwlagn_def_3w_lookup[12] = {
|
|
|
|
cpu_to_le32(0xaaaaaaaa),
|
|
|
|
cpu_to_le32(0xaaaaaaaa),
|
|
|
|
cpu_to_le32(0xaeaaaaaa),
|
|
|
|
cpu_to_le32(0xaaaaaaaa),
|
|
|
|
cpu_to_le32(0xcc00ff28),
|
|
|
|
cpu_to_le32(0x0000aaaa),
|
|
|
|
cpu_to_le32(0xcc00aaaa),
|
|
|
|
cpu_to_le32(0x0000aaaa),
|
|
|
|
cpu_to_le32(0xc0004000),
|
|
|
|
cpu_to_le32(0x00004000),
|
|
|
|
cpu_to_le32(0xf0005000),
|
2010-11-19 02:40:03 +08:00
|
|
|
cpu_to_le32(0xf0005000),
|
2010-08-23 22:57:14 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static const __le32 iwlagn_concurrent_lookup[12] = {
|
|
|
|
cpu_to_le32(0xaaaaaaaa),
|
|
|
|
cpu_to_le32(0xaaaaaaaa),
|
|
|
|
cpu_to_le32(0xaaaaaaaa),
|
|
|
|
cpu_to_le32(0xaaaaaaaa),
|
|
|
|
cpu_to_le32(0xaaaaaaaa),
|
|
|
|
cpu_to_le32(0xaaaaaaaa),
|
|
|
|
cpu_to_le32(0xaaaaaaaa),
|
|
|
|
cpu_to_le32(0xaaaaaaaa),
|
|
|
|
cpu_to_le32(0x00000000),
|
|
|
|
cpu_to_le32(0x00000000),
|
|
|
|
cpu_to_le32(0x00000000),
|
|
|
|
cpu_to_le32(0x00000000),
|
|
|
|
};
|
|
|
|
|
|
|
|
void iwlagn_send_advance_bt_config(struct iwl_priv *priv)
|
|
|
|
{
|
2011-02-19 09:23:54 +08:00
|
|
|
struct iwl_basic_bt_cmd basic = {
|
2010-08-23 22:57:14 +08:00
|
|
|
.max_kill = IWLAGN_BT_MAX_KILL_DEFAULT,
|
|
|
|
.bt3_timer_t7_value = IWLAGN_BT3_T7_DEFAULT,
|
|
|
|
.bt3_prio_sample_time = IWLAGN_BT3_PRIO_SAMPLE_DEFAULT,
|
|
|
|
.bt3_timer_t2_value = IWLAGN_BT3_T2_DEFAULT,
|
|
|
|
};
|
2011-02-19 09:23:54 +08:00
|
|
|
struct iwl6000_bt_cmd bt_cmd_6000;
|
|
|
|
struct iwl2000_bt_cmd bt_cmd_2000;
|
|
|
|
int ret;
|
2010-08-23 22:57:14 +08:00
|
|
|
|
|
|
|
BUILD_BUG_ON(sizeof(iwlagn_def_3w_lookup) !=
|
2011-02-19 09:23:54 +08:00
|
|
|
sizeof(basic.bt3_lookup_table));
|
|
|
|
|
|
|
|
if (priv->cfg->bt_params) {
|
|
|
|
if (priv->cfg->bt_params->bt_session_2) {
|
|
|
|
bt_cmd_2000.prio_boost = cpu_to_le32(
|
|
|
|
priv->cfg->bt_params->bt_prio_boost);
|
|
|
|
bt_cmd_2000.tx_prio_boost = 0;
|
|
|
|
bt_cmd_2000.rx_prio_boost = 0;
|
|
|
|
} else {
|
|
|
|
bt_cmd_6000.prio_boost =
|
|
|
|
priv->cfg->bt_params->bt_prio_boost;
|
|
|
|
bt_cmd_6000.tx_prio_boost = 0;
|
|
|
|
bt_cmd_6000.rx_prio_boost = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
IWL_ERR(priv, "failed to construct BT Coex Config\n");
|
|
|
|
return;
|
|
|
|
}
|
2010-11-25 09:25:03 +08:00
|
|
|
|
2011-02-19 09:23:54 +08:00
|
|
|
basic.kill_ack_mask = priv->kill_ack_mask;
|
|
|
|
basic.kill_cts_mask = priv->kill_cts_mask;
|
|
|
|
basic.valid = priv->bt_valid;
|
2010-08-23 22:57:14 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Configure BT coex mode to "no coexistence" when the
|
|
|
|
* user disabled BT coexistence, we have no interface
|
|
|
|
* (might be in monitor mode), or the interface is in
|
|
|
|
* IBSS mode (no proper uCode support for coex then).
|
|
|
|
*/
|
2011-06-04 04:52:38 +08:00
|
|
|
if (!iwlagn_mod_params.bt_coex_active ||
|
|
|
|
priv->iw_mode == NL80211_IFTYPE_ADHOC) {
|
2011-02-19 09:23:54 +08:00
|
|
|
basic.flags = IWLAGN_BT_FLAG_COEX_MODE_DISABLED;
|
2010-08-23 22:57:14 +08:00
|
|
|
} else {
|
2011-02-19 09:23:54 +08:00
|
|
|
basic.flags = IWLAGN_BT_FLAG_COEX_MODE_3W <<
|
2010-08-23 22:57:14 +08:00
|
|
|
IWLAGN_BT_FLAG_COEX_MODE_SHIFT;
|
2011-07-08 23:46:23 +08:00
|
|
|
|
|
|
|
if (!priv->bt_enable_pspoll)
|
2011-02-19 09:23:54 +08:00
|
|
|
basic.flags |= IWLAGN_BT_FLAG_SYNC_2_BT_DISABLE;
|
2011-07-08 23:46:23 +08:00
|
|
|
else
|
|
|
|
basic.flags &= ~IWLAGN_BT_FLAG_SYNC_2_BT_DISABLE;
|
2010-11-24 02:58:54 +08:00
|
|
|
|
2010-08-23 22:57:14 +08:00
|
|
|
if (priv->bt_ch_announce)
|
2011-02-19 09:23:54 +08:00
|
|
|
basic.flags |= IWLAGN_BT_FLAG_CHANNEL_INHIBITION;
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "BT coex flag: 0X%x\n", basic.flags);
|
2010-08-23 22:57:14 +08:00
|
|
|
}
|
2011-02-19 09:23:54 +08:00
|
|
|
priv->bt_enable_flag = basic.flags;
|
2010-08-23 22:57:14 +08:00
|
|
|
if (priv->bt_full_concurrent)
|
2011-02-19 09:23:54 +08:00
|
|
|
memcpy(basic.bt3_lookup_table, iwlagn_concurrent_lookup,
|
2010-08-23 22:57:14 +08:00
|
|
|
sizeof(iwlagn_concurrent_lookup));
|
|
|
|
else
|
2011-02-19 09:23:54 +08:00
|
|
|
memcpy(basic.bt3_lookup_table, iwlagn_def_3w_lookup,
|
2010-08-23 22:57:14 +08:00
|
|
|
sizeof(iwlagn_def_3w_lookup));
|
|
|
|
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "BT coex %s in %s mode\n",
|
2011-02-19 09:23:54 +08:00
|
|
|
basic.flags ? "active" : "disabled",
|
2010-08-23 22:57:14 +08:00
|
|
|
priv->bt_full_concurrent ?
|
|
|
|
"full concurrency" : "3-wire");
|
|
|
|
|
2011-02-19 09:23:54 +08:00
|
|
|
if (priv->cfg->bt_params->bt_session_2) {
|
|
|
|
memcpy(&bt_cmd_2000.basic, &basic,
|
|
|
|
sizeof(basic));
|
iwlagn: bus layer chooses its transport layer
Remove iwl_transport_register which was a W/A. The bus layer knows what
transport to use. So now, the bus layer gives the upper layer a pointer to the
iwl_trans_ops struct that it wants to use. The upper layer then, allocates the
desired transport layer using iwl_trans_ops->alloc function.
As a result of this, priv->trans, no longer exists, priv holds a pointer to
iwl_shared, which holds a pointer to iwl_trans. This required to change all the
calls to the transport layer from upper layer. While we were at it, trans_X
inlines have been renamed to iwl_trans_X to avoid confusions, which of course
required to rename the functions inside the transport layer because of
conflicts in names. So the static API functions inside the transport layer
implementation have been renamed to iwl_trans_pcie_X.
Until now, the IRQ / Tasklet were initialized in iwl_transport_layer. This is
confusing since the registration doesn't mean to request IRQ, so I added a
handler for that.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-26 14:10:48 +08:00
|
|
|
ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_BT_CONFIG,
|
2011-07-08 23:46:14 +08:00
|
|
|
CMD_SYNC, sizeof(bt_cmd_2000), &bt_cmd_2000);
|
2011-02-19 09:23:54 +08:00
|
|
|
} else {
|
|
|
|
memcpy(&bt_cmd_6000.basic, &basic,
|
|
|
|
sizeof(basic));
|
iwlagn: bus layer chooses its transport layer
Remove iwl_transport_register which was a W/A. The bus layer knows what
transport to use. So now, the bus layer gives the upper layer a pointer to the
iwl_trans_ops struct that it wants to use. The upper layer then, allocates the
desired transport layer using iwl_trans_ops->alloc function.
As a result of this, priv->trans, no longer exists, priv holds a pointer to
iwl_shared, which holds a pointer to iwl_trans. This required to change all the
calls to the transport layer from upper layer. While we were at it, trans_X
inlines have been renamed to iwl_trans_X to avoid confusions, which of course
required to rename the functions inside the transport layer because of
conflicts in names. So the static API functions inside the transport layer
implementation have been renamed to iwl_trans_pcie_X.
Until now, the IRQ / Tasklet were initialized in iwl_transport_layer. This is
confusing since the registration doesn't mean to request IRQ, so I added a
handler for that.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-26 14:10:48 +08:00
|
|
|
ret = iwl_trans_send_cmd_pdu(trans(priv), REPLY_BT_CONFIG,
|
2011-07-08 23:46:14 +08:00
|
|
|
CMD_SYNC, sizeof(bt_cmd_6000), &bt_cmd_6000);
|
2011-02-19 09:23:54 +08:00
|
|
|
}
|
|
|
|
if (ret)
|
2010-08-23 22:57:14 +08:00
|
|
|
IWL_ERR(priv, "failed to send BT Coex Config\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-07-08 23:46:23 +08:00
|
|
|
void iwlagn_bt_adjust_rssi_monitor(struct iwl_priv *priv, bool rssi_ena)
|
|
|
|
{
|
|
|
|
struct iwl_rxon_context *ctx, *found_ctx = NULL;
|
|
|
|
bool found_ap = false;
|
|
|
|
|
2011-08-26 14:10:44 +08:00
|
|
|
lockdep_assert_held(&priv->shrd->mutex);
|
2011-07-08 23:46:23 +08:00
|
|
|
|
|
|
|
/* Check whether AP or GO mode is active. */
|
|
|
|
if (rssi_ena) {
|
|
|
|
for_each_context(priv, ctx) {
|
|
|
|
if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_AP &&
|
|
|
|
iwl_is_associated_ctx(ctx)) {
|
|
|
|
found_ap = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If disable was received or If GO/AP mode, disable RSSI
|
|
|
|
* measurements.
|
|
|
|
*/
|
|
|
|
if (!rssi_ena || found_ap) {
|
|
|
|
if (priv->cur_rssi_ctx) {
|
|
|
|
ctx = priv->cur_rssi_ctx;
|
|
|
|
ieee80211_disable_rssi_reports(ctx->vif);
|
|
|
|
priv->cur_rssi_ctx = NULL;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If rssi measurements need to be enabled, consider all cases now.
|
|
|
|
* Figure out how many contexts are active.
|
|
|
|
*/
|
|
|
|
for_each_context(priv, ctx) {
|
|
|
|
if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION &&
|
|
|
|
iwl_is_associated_ctx(ctx)) {
|
|
|
|
found_ctx = ctx;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* rssi monitor already enabled for the correct interface...nothing
|
|
|
|
* to do.
|
|
|
|
*/
|
|
|
|
if (found_ctx == priv->cur_rssi_ctx)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Figure out if rssi monitor is currently enabled, and needs
|
|
|
|
* to be changed. If rssi monitor is already enabled, disable
|
|
|
|
* it first else just enable rssi measurements on the
|
|
|
|
* interface found above.
|
|
|
|
*/
|
|
|
|
if (priv->cur_rssi_ctx) {
|
|
|
|
ctx = priv->cur_rssi_ctx;
|
|
|
|
if (ctx->vif)
|
|
|
|
ieee80211_disable_rssi_reports(ctx->vif);
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->cur_rssi_ctx = found_ctx;
|
|
|
|
|
|
|
|
if (!found_ctx)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ieee80211_enable_rssi_reports(found_ctx->vif,
|
|
|
|
IWLAGN_BT_PSP_MIN_RSSI_THRESHOLD,
|
|
|
|
IWLAGN_BT_PSP_MAX_RSSI_THRESHOLD);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool iwlagn_bt_traffic_is_sco(struct iwl_bt_uart_msg *uart_msg)
|
|
|
|
{
|
|
|
|
return BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3 >>
|
|
|
|
BT_UART_MSG_FRAME3SCOESCO_POS;
|
|
|
|
}
|
|
|
|
|
2010-08-23 22:57:14 +08:00
|
|
|
static void iwlagn_bt_traffic_change_work(struct work_struct *work)
|
|
|
|
{
|
|
|
|
struct iwl_priv *priv =
|
|
|
|
container_of(work, struct iwl_priv, bt_traffic_change_work);
|
2010-08-23 16:46:40 +08:00
|
|
|
struct iwl_rxon_context *ctx;
|
2010-08-23 22:57:14 +08:00
|
|
|
int smps_request = -1;
|
|
|
|
|
2011-02-07 00:56:35 +08:00
|
|
|
if (priv->bt_enable_flag == IWLAGN_BT_FLAG_COEX_MODE_DISABLED) {
|
|
|
|
/* bt coex disabled */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-10-22 23:04:28 +08:00
|
|
|
/*
|
|
|
|
* Note: bt_traffic_load can be overridden by scan complete and
|
|
|
|
* coex profile notifications. Ignore that since only bad consequence
|
|
|
|
* can be not matching debug print with actual state.
|
|
|
|
*/
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "BT traffic load changes: %d\n",
|
2010-08-23 22:57:14 +08:00
|
|
|
priv->bt_traffic_load);
|
|
|
|
|
|
|
|
switch (priv->bt_traffic_load) {
|
|
|
|
case IWL_BT_COEX_TRAFFIC_LOAD_NONE:
|
2010-10-24 00:15:44 +08:00
|
|
|
if (priv->bt_status)
|
|
|
|
smps_request = IEEE80211_SMPS_DYNAMIC;
|
|
|
|
else
|
|
|
|
smps_request = IEEE80211_SMPS_AUTOMATIC;
|
2010-08-23 22:57:14 +08:00
|
|
|
break;
|
|
|
|
case IWL_BT_COEX_TRAFFIC_LOAD_LOW:
|
|
|
|
smps_request = IEEE80211_SMPS_DYNAMIC;
|
|
|
|
break;
|
|
|
|
case IWL_BT_COEX_TRAFFIC_LOAD_HIGH:
|
|
|
|
case IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS:
|
|
|
|
smps_request = IEEE80211_SMPS_STATIC;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
IWL_ERR(priv, "Invalid BT traffic load: %d\n",
|
|
|
|
priv->bt_traffic_load);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-08-26 14:10:44 +08:00
|
|
|
mutex_lock(&priv->shrd->mutex);
|
2010-08-23 22:57:14 +08:00
|
|
|
|
2010-10-22 23:04:28 +08:00
|
|
|
/*
|
|
|
|
* We can not send command to firmware while scanning. When the scan
|
|
|
|
* complete we will schedule this work again. We do check with mutex
|
|
|
|
* locked to prevent new scan request to arrive. We do not check
|
|
|
|
* STATUS_SCANNING to avoid race when queue_work two times from
|
|
|
|
* different notifications, but quit and not perform any work at all.
|
|
|
|
*/
|
2011-08-26 14:10:42 +08:00
|
|
|
if (test_bit(STATUS_SCAN_HW, &priv->shrd->status))
|
2010-10-22 23:04:28 +08:00
|
|
|
goto out;
|
|
|
|
|
2011-07-08 23:46:17 +08:00
|
|
|
iwl_update_chain_flags(priv);
|
2010-08-23 22:57:14 +08:00
|
|
|
|
2010-08-23 16:46:40 +08:00
|
|
|
if (smps_request != -1) {
|
2011-06-03 22:54:12 +08:00
|
|
|
priv->current_ht_config.smps = smps_request;
|
2010-08-23 16:46:40 +08:00
|
|
|
for_each_context(priv, ctx) {
|
|
|
|
if (ctx->vif && ctx->vif->type == NL80211_IFTYPE_STATION)
|
|
|
|
ieee80211_request_smps(ctx->vif, smps_request);
|
|
|
|
}
|
|
|
|
}
|
2011-07-08 23:46:23 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Dynamic PS poll related functionality. Adjust RSSI measurements if
|
|
|
|
* necessary.
|
|
|
|
*/
|
|
|
|
iwlagn_bt_coex_rssi_monitor(priv);
|
2010-10-22 23:04:28 +08:00
|
|
|
out:
|
2011-08-26 14:10:44 +08:00
|
|
|
mutex_unlock(&priv->shrd->mutex);
|
2010-08-23 22:57:14 +08:00
|
|
|
}
|
|
|
|
|
2011-07-08 23:46:23 +08:00
|
|
|
/*
|
|
|
|
* If BT sco traffic, and RSSI monitor is enabled, move measurements to the
|
|
|
|
* correct interface or disable it if this is the last interface to be
|
|
|
|
* removed.
|
|
|
|
*/
|
|
|
|
void iwlagn_bt_coex_rssi_monitor(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
if (priv->bt_is_sco &&
|
|
|
|
priv->bt_traffic_load == IWL_BT_COEX_TRAFFIC_LOAD_CONTINUOUS)
|
|
|
|
iwlagn_bt_adjust_rssi_monitor(priv, true);
|
|
|
|
else
|
|
|
|
iwlagn_bt_adjust_rssi_monitor(priv, false);
|
|
|
|
}
|
|
|
|
|
2010-08-23 22:57:14 +08:00
|
|
|
static void iwlagn_print_uartmsg(struct iwl_priv *priv,
|
|
|
|
struct iwl_bt_uart_msg *uart_msg)
|
|
|
|
{
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "Message Type = 0x%X, SSN = 0x%X, "
|
2010-08-23 22:57:14 +08:00
|
|
|
"Update Req = 0x%X",
|
|
|
|
(BT_UART_MSG_FRAME1MSGTYPE_MSK & uart_msg->frame1) >>
|
|
|
|
BT_UART_MSG_FRAME1MSGTYPE_POS,
|
|
|
|
(BT_UART_MSG_FRAME1SSN_MSK & uart_msg->frame1) >>
|
|
|
|
BT_UART_MSG_FRAME1SSN_POS,
|
|
|
|
(BT_UART_MSG_FRAME1UPDATEREQ_MSK & uart_msg->frame1) >>
|
|
|
|
BT_UART_MSG_FRAME1UPDATEREQ_POS);
|
|
|
|
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "Open connections = 0x%X, Traffic load = 0x%X, "
|
2010-08-23 22:57:14 +08:00
|
|
|
"Chl_SeqN = 0x%X, In band = 0x%X",
|
|
|
|
(BT_UART_MSG_FRAME2OPENCONNECTIONS_MSK & uart_msg->frame2) >>
|
|
|
|
BT_UART_MSG_FRAME2OPENCONNECTIONS_POS,
|
|
|
|
(BT_UART_MSG_FRAME2TRAFFICLOAD_MSK & uart_msg->frame2) >>
|
|
|
|
BT_UART_MSG_FRAME2TRAFFICLOAD_POS,
|
|
|
|
(BT_UART_MSG_FRAME2CHLSEQN_MSK & uart_msg->frame2) >>
|
|
|
|
BT_UART_MSG_FRAME2CHLSEQN_POS,
|
|
|
|
(BT_UART_MSG_FRAME2INBAND_MSK & uart_msg->frame2) >>
|
|
|
|
BT_UART_MSG_FRAME2INBAND_POS);
|
|
|
|
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "SCO/eSCO = 0x%X, Sniff = 0x%X, A2DP = 0x%X, "
|
2010-08-23 22:57:14 +08:00
|
|
|
"ACL = 0x%X, Master = 0x%X, OBEX = 0x%X",
|
|
|
|
(BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3) >>
|
|
|
|
BT_UART_MSG_FRAME3SCOESCO_POS,
|
|
|
|
(BT_UART_MSG_FRAME3SNIFF_MSK & uart_msg->frame3) >>
|
|
|
|
BT_UART_MSG_FRAME3SNIFF_POS,
|
|
|
|
(BT_UART_MSG_FRAME3A2DP_MSK & uart_msg->frame3) >>
|
|
|
|
BT_UART_MSG_FRAME3A2DP_POS,
|
|
|
|
(BT_UART_MSG_FRAME3ACL_MSK & uart_msg->frame3) >>
|
|
|
|
BT_UART_MSG_FRAME3ACL_POS,
|
|
|
|
(BT_UART_MSG_FRAME3MASTER_MSK & uart_msg->frame3) >>
|
|
|
|
BT_UART_MSG_FRAME3MASTER_POS,
|
|
|
|
(BT_UART_MSG_FRAME3OBEX_MSK & uart_msg->frame3) >>
|
|
|
|
BT_UART_MSG_FRAME3OBEX_POS);
|
|
|
|
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "Idle duration = 0x%X",
|
2010-08-23 22:57:14 +08:00
|
|
|
(BT_UART_MSG_FRAME4IDLEDURATION_MSK & uart_msg->frame4) >>
|
|
|
|
BT_UART_MSG_FRAME4IDLEDURATION_POS);
|
|
|
|
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "Tx Activity = 0x%X, Rx Activity = 0x%X, "
|
2010-08-23 22:57:14 +08:00
|
|
|
"eSCO Retransmissions = 0x%X",
|
|
|
|
(BT_UART_MSG_FRAME5TXACTIVITY_MSK & uart_msg->frame5) >>
|
|
|
|
BT_UART_MSG_FRAME5TXACTIVITY_POS,
|
|
|
|
(BT_UART_MSG_FRAME5RXACTIVITY_MSK & uart_msg->frame5) >>
|
|
|
|
BT_UART_MSG_FRAME5RXACTIVITY_POS,
|
|
|
|
(BT_UART_MSG_FRAME5ESCORETRANSMIT_MSK & uart_msg->frame5) >>
|
|
|
|
BT_UART_MSG_FRAME5ESCORETRANSMIT_POS);
|
|
|
|
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "Sniff Interval = 0x%X, Discoverable = 0x%X",
|
2010-08-23 22:57:14 +08:00
|
|
|
(BT_UART_MSG_FRAME6SNIFFINTERVAL_MSK & uart_msg->frame6) >>
|
|
|
|
BT_UART_MSG_FRAME6SNIFFINTERVAL_POS,
|
|
|
|
(BT_UART_MSG_FRAME6DISCOVERABLE_MSK & uart_msg->frame6) >>
|
|
|
|
BT_UART_MSG_FRAME6DISCOVERABLE_POS);
|
|
|
|
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "Sniff Activity = 0x%X, Page = "
|
2011-02-23 00:24:22 +08:00
|
|
|
"0x%X, Inquiry = 0x%X, Connectable = 0x%X",
|
2010-08-23 22:57:14 +08:00
|
|
|
(BT_UART_MSG_FRAME7SNIFFACTIVITY_MSK & uart_msg->frame7) >>
|
|
|
|
BT_UART_MSG_FRAME7SNIFFACTIVITY_POS,
|
2011-02-23 00:24:22 +08:00
|
|
|
(BT_UART_MSG_FRAME7PAGE_MSK & uart_msg->frame7) >>
|
|
|
|
BT_UART_MSG_FRAME7PAGE_POS,
|
|
|
|
(BT_UART_MSG_FRAME7INQUIRY_MSK & uart_msg->frame7) >>
|
|
|
|
BT_UART_MSG_FRAME7INQUIRY_POS,
|
2010-08-23 22:57:14 +08:00
|
|
|
(BT_UART_MSG_FRAME7CONNECTABLE_MSK & uart_msg->frame7) >>
|
|
|
|
BT_UART_MSG_FRAME7CONNECTABLE_POS);
|
|
|
|
}
|
|
|
|
|
2010-11-25 09:25:03 +08:00
|
|
|
static void iwlagn_set_kill_msk(struct iwl_priv *priv,
|
|
|
|
struct iwl_bt_uart_msg *uart_msg)
|
2010-08-23 22:57:14 +08:00
|
|
|
{
|
2010-11-25 09:25:03 +08:00
|
|
|
u8 kill_msk;
|
2010-11-21 10:38:57 +08:00
|
|
|
static const __le32 bt_kill_ack_msg[2] = {
|
2010-11-25 09:25:03 +08:00
|
|
|
IWLAGN_BT_KILL_ACK_MASK_DEFAULT,
|
|
|
|
IWLAGN_BT_KILL_ACK_CTS_MASK_SCO };
|
|
|
|
static const __le32 bt_kill_cts_msg[2] = {
|
|
|
|
IWLAGN_BT_KILL_CTS_MASK_DEFAULT,
|
|
|
|
IWLAGN_BT_KILL_ACK_CTS_MASK_SCO };
|
|
|
|
|
|
|
|
kill_msk = (BT_UART_MSG_FRAME3SCOESCO_MSK & uart_msg->frame3)
|
|
|
|
? 1 : 0;
|
|
|
|
if (priv->kill_ack_mask != bt_kill_ack_msg[kill_msk] ||
|
|
|
|
priv->kill_cts_mask != bt_kill_cts_msg[kill_msk]) {
|
2010-08-23 22:57:14 +08:00
|
|
|
priv->bt_valid |= IWLAGN_BT_VALID_KILL_ACK_MASK;
|
2010-11-25 09:25:03 +08:00
|
|
|
priv->kill_ack_mask = bt_kill_ack_msg[kill_msk];
|
|
|
|
priv->bt_valid |= IWLAGN_BT_VALID_KILL_CTS_MASK;
|
|
|
|
priv->kill_cts_mask = bt_kill_cts_msg[kill_msk];
|
|
|
|
|
2010-08-23 22:57:14 +08:00
|
|
|
/* schedule to send runtime bt_config */
|
2011-08-26 14:10:41 +08:00
|
|
|
queue_work(priv->shrd->workqueue, &priv->bt_runtime_config);
|
2010-08-23 22:57:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void iwlagn_bt_coex_profile_notif(struct iwl_priv *priv,
|
|
|
|
struct iwl_rx_mem_buffer *rxb)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
struct iwl_rx_packet *pkt = rxb_addr(rxb);
|
|
|
|
struct iwl_bt_coex_profile_notif *coex = &pkt->u.bt_coex_profile_notif;
|
|
|
|
struct iwl_bt_uart_msg *uart_msg = &coex->last_bt_uart_msg;
|
|
|
|
|
2011-02-07 00:56:35 +08:00
|
|
|
if (priv->bt_enable_flag == IWLAGN_BT_FLAG_COEX_MODE_DISABLED) {
|
|
|
|
/* bt coex disabled */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-06-07 03:49:25 +08:00
|
|
|
IWL_DEBUG_COEX(priv, "BT Coex notification:\n");
|
|
|
|
IWL_DEBUG_COEX(priv, " status: %d\n", coex->bt_status);
|
|
|
|
IWL_DEBUG_COEX(priv, " traffic load: %d\n", coex->bt_traffic_load);
|
|
|
|
IWL_DEBUG_COEX(priv, " CI compliance: %d\n",
|
2010-08-23 22:57:14 +08:00
|
|
|
coex->bt_ci_compliance);
|
|
|
|
iwlagn_print_uartmsg(priv, uart_msg);
|
|
|
|
|
2010-11-09 06:54:37 +08:00
|
|
|
priv->last_bt_traffic_load = priv->bt_traffic_load;
|
2011-07-08 23:46:23 +08:00
|
|
|
priv->bt_is_sco = iwlagn_bt_traffic_is_sco(uart_msg);
|
|
|
|
|
2010-08-23 22:57:14 +08:00
|
|
|
if (priv->iw_mode != NL80211_IFTYPE_ADHOC) {
|
|
|
|
if (priv->bt_status != coex->bt_status ||
|
2010-11-09 06:54:37 +08:00
|
|
|
priv->last_bt_traffic_load != coex->bt_traffic_load) {
|
2010-08-23 22:57:14 +08:00
|
|
|
if (coex->bt_status) {
|
|
|
|
/* BT on */
|
|
|
|
if (!priv->bt_ch_announce)
|
|
|
|
priv->bt_traffic_load =
|
|
|
|
IWL_BT_COEX_TRAFFIC_LOAD_HIGH;
|
|
|
|
else
|
|
|
|
priv->bt_traffic_load =
|
|
|
|
coex->bt_traffic_load;
|
|
|
|
} else {
|
|
|
|
/* BT off */
|
|
|
|
priv->bt_traffic_load =
|
|
|
|
IWL_BT_COEX_TRAFFIC_LOAD_NONE;
|
|
|
|
}
|
|
|
|
priv->bt_status = coex->bt_status;
|
2011-08-26 14:10:41 +08:00
|
|
|
queue_work(priv->shrd->workqueue,
|
2010-08-23 22:57:14 +08:00
|
|
|
&priv->bt_traffic_change_work);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-25 09:25:03 +08:00
|
|
|
iwlagn_set_kill_msk(priv, uart_msg);
|
2010-08-23 22:57:14 +08:00
|
|
|
|
|
|
|
/* FIXME: based on notification, adjust the prio_boost */
|
|
|
|
|
2011-08-26 14:10:43 +08:00
|
|
|
spin_lock_irqsave(&priv->shrd->lock, flags);
|
2010-08-23 22:57:14 +08:00
|
|
|
priv->bt_ci_compliance = coex->bt_ci_compliance;
|
2011-08-26 14:10:43 +08:00
|
|
|
spin_unlock_irqrestore(&priv->shrd->lock, flags);
|
2010-08-23 22:57:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void iwlagn_bt_rx_handler_setup(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
priv->rx_handlers[REPLY_BT_COEX_PROFILE_NOTIF] =
|
|
|
|
iwlagn_bt_coex_profile_notif;
|
|
|
|
}
|
|
|
|
|
|
|
|
void iwlagn_bt_setup_deferred_work(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
INIT_WORK(&priv->bt_traffic_change_work,
|
|
|
|
iwlagn_bt_traffic_change_work);
|
|
|
|
}
|
|
|
|
|
|
|
|
void iwlagn_bt_cancel_deferred_work(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
cancel_work_sync(&priv->bt_traffic_change_work);
|
|
|
|
}
|
2010-09-23 00:01:58 +08:00
|
|
|
|
|
|
|
static bool is_single_rx_stream(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
return priv->current_ht_config.smps == IEEE80211_SMPS_STATIC ||
|
|
|
|
priv->current_ht_config.single_chain_sufficient;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define IWL_NUM_RX_CHAINS_MULTIPLE 3
|
|
|
|
#define IWL_NUM_RX_CHAINS_SINGLE 2
|
|
|
|
#define IWL_NUM_IDLE_CHAINS_DUAL 2
|
|
|
|
#define IWL_NUM_IDLE_CHAINS_SINGLE 1
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Determine how many receiver/antenna chains to use.
|
|
|
|
*
|
|
|
|
* More provides better reception via diversity. Fewer saves power
|
|
|
|
* at the expense of throughput, but only when not in powersave to
|
|
|
|
* start with.
|
|
|
|
*
|
|
|
|
* MIMO (dual stream) requires at least 2, but works better with 3.
|
|
|
|
* This does not determine *which* chains to use, just how many.
|
|
|
|
*/
|
|
|
|
static int iwl_get_active_rx_chain_count(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
if (priv->cfg->bt_params &&
|
|
|
|
priv->cfg->bt_params->advanced_bt_coexist &&
|
|
|
|
(priv->bt_full_concurrent ||
|
|
|
|
priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) {
|
|
|
|
/*
|
|
|
|
* only use chain 'A' in bt high traffic load or
|
|
|
|
* full concurrency mode
|
|
|
|
*/
|
|
|
|
return IWL_NUM_RX_CHAINS_SINGLE;
|
|
|
|
}
|
|
|
|
/* # of Rx chains to use when expecting MIMO. */
|
|
|
|
if (is_single_rx_stream(priv))
|
|
|
|
return IWL_NUM_RX_CHAINS_SINGLE;
|
|
|
|
else
|
|
|
|
return IWL_NUM_RX_CHAINS_MULTIPLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* When we are in power saving mode, unless device support spatial
|
|
|
|
* multiplexing power save, use the active count for rx chain count.
|
|
|
|
*/
|
|
|
|
static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt)
|
|
|
|
{
|
|
|
|
/* # Rx chains when idling, depending on SMPS mode */
|
|
|
|
switch (priv->current_ht_config.smps) {
|
|
|
|
case IEEE80211_SMPS_STATIC:
|
|
|
|
case IEEE80211_SMPS_DYNAMIC:
|
|
|
|
return IWL_NUM_IDLE_CHAINS_SINGLE;
|
|
|
|
case IEEE80211_SMPS_OFF:
|
|
|
|
return active_cnt;
|
|
|
|
default:
|
|
|
|
WARN(1, "invalid SMPS mode %d",
|
|
|
|
priv->current_ht_config.smps);
|
|
|
|
return active_cnt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* up to 4 chains */
|
|
|
|
static u8 iwl_count_chain_bitmap(u32 chain_bitmap)
|
|
|
|
{
|
|
|
|
u8 res;
|
|
|
|
res = (chain_bitmap & BIT(0)) >> 0;
|
|
|
|
res += (chain_bitmap & BIT(1)) >> 1;
|
|
|
|
res += (chain_bitmap & BIT(2)) >> 2;
|
|
|
|
res += (chain_bitmap & BIT(3)) >> 3;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* iwlagn_set_rxon_chain - Set up Rx chain usage in "staging" RXON image
|
|
|
|
*
|
|
|
|
* Selects how many and which Rx receivers/antennas/chains to use.
|
|
|
|
* This should not be used for scan command ... it puts data in wrong place.
|
|
|
|
*/
|
|
|
|
void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
|
|
|
|
{
|
|
|
|
bool is_single = is_single_rx_stream(priv);
|
2011-08-26 14:10:42 +08:00
|
|
|
bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->shrd->status);
|
2010-09-23 00:01:58 +08:00
|
|
|
u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt;
|
|
|
|
u32 active_chains;
|
|
|
|
u16 rx_chain;
|
|
|
|
|
|
|
|
/* Tell uCode which antennas are actually connected.
|
|
|
|
* Before first association, we assume all antennas are connected.
|
|
|
|
* Just after first association, iwl_chain_noise_calibration()
|
|
|
|
* checks which antennas actually *are* connected. */
|
|
|
|
if (priv->chain_noise_data.active_chains)
|
|
|
|
active_chains = priv->chain_noise_data.active_chains;
|
|
|
|
else
|
2011-08-26 14:10:39 +08:00
|
|
|
active_chains = hw_params(priv).valid_rx_ant;
|
2010-09-23 00:01:58 +08:00
|
|
|
|
|
|
|
if (priv->cfg->bt_params &&
|
|
|
|
priv->cfg->bt_params->advanced_bt_coexist &&
|
|
|
|
(priv->bt_full_concurrent ||
|
|
|
|
priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)) {
|
|
|
|
/*
|
|
|
|
* only use chain 'A' in bt high traffic load or
|
|
|
|
* full concurrency mode
|
|
|
|
*/
|
|
|
|
active_chains = first_antenna(active_chains);
|
|
|
|
}
|
|
|
|
|
|
|
|
rx_chain = active_chains << RXON_RX_CHAIN_VALID_POS;
|
|
|
|
|
|
|
|
/* How many receivers should we use? */
|
|
|
|
active_rx_cnt = iwl_get_active_rx_chain_count(priv);
|
|
|
|
idle_rx_cnt = iwl_get_idle_rx_chain_count(priv, active_rx_cnt);
|
|
|
|
|
|
|
|
|
|
|
|
/* correct rx chain count according hw settings
|
|
|
|
* and chain noise calibration
|
|
|
|
*/
|
|
|
|
valid_rx_cnt = iwl_count_chain_bitmap(active_chains);
|
|
|
|
if (valid_rx_cnt < active_rx_cnt)
|
|
|
|
active_rx_cnt = valid_rx_cnt;
|
|
|
|
|
|
|
|
if (valid_rx_cnt < idle_rx_cnt)
|
|
|
|
idle_rx_cnt = valid_rx_cnt;
|
|
|
|
|
|
|
|
rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS;
|
|
|
|
rx_chain |= idle_rx_cnt << RXON_RX_CHAIN_CNT_POS;
|
|
|
|
|
|
|
|
ctx->staging.rx_chain = cpu_to_le16(rx_chain);
|
|
|
|
|
|
|
|
if (!is_single && (active_rx_cnt >= IWL_NUM_RX_CHAINS_SINGLE) && is_cam)
|
|
|
|
ctx->staging.rx_chain |= RXON_RX_CHAIN_MIMO_FORCE_MSK;
|
|
|
|
else
|
|
|
|
ctx->staging.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK;
|
|
|
|
|
|
|
|
IWL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n",
|
|
|
|
ctx->staging.rx_chain,
|
|
|
|
active_rx_cnt, idle_rx_cnt);
|
|
|
|
|
|
|
|
WARN_ON(active_rx_cnt == 0 || idle_rx_cnt == 0 ||
|
|
|
|
active_rx_cnt < idle_rx_cnt);
|
|
|
|
}
|
2010-09-23 00:02:05 +08:00
|
|
|
|
|
|
|
u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant, u8 valid)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
u8 ind = ant;
|
|
|
|
|
|
|
|
if (priv->band == IEEE80211_BAND_2GHZ &&
|
|
|
|
priv->bt_traffic_load >= IWL_BT_COEX_TRAFFIC_LOAD_HIGH)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
for (i = 0; i < RATE_ANT_NUM - 1; i++) {
|
|
|
|
ind = (ind + 1) < RATE_ANT_NUM ? ind + 1 : 0;
|
|
|
|
if (valid & BIT(ind))
|
|
|
|
return ind;
|
|
|
|
}
|
|
|
|
return ant;
|
|
|
|
}
|
2010-09-23 00:02:06 +08:00
|
|
|
|
|
|
|
static const char *get_csr_string(int cmd)
|
|
|
|
{
|
|
|
|
switch (cmd) {
|
|
|
|
IWL_CMD(CSR_HW_IF_CONFIG_REG);
|
|
|
|
IWL_CMD(CSR_INT_COALESCING);
|
|
|
|
IWL_CMD(CSR_INT);
|
|
|
|
IWL_CMD(CSR_INT_MASK);
|
|
|
|
IWL_CMD(CSR_FH_INT_STATUS);
|
|
|
|
IWL_CMD(CSR_GPIO_IN);
|
|
|
|
IWL_CMD(CSR_RESET);
|
|
|
|
IWL_CMD(CSR_GP_CNTRL);
|
|
|
|
IWL_CMD(CSR_HW_REV);
|
|
|
|
IWL_CMD(CSR_EEPROM_REG);
|
|
|
|
IWL_CMD(CSR_EEPROM_GP);
|
|
|
|
IWL_CMD(CSR_OTP_GP_REG);
|
|
|
|
IWL_CMD(CSR_GIO_REG);
|
|
|
|
IWL_CMD(CSR_GP_UCODE_REG);
|
|
|
|
IWL_CMD(CSR_GP_DRIVER_REG);
|
|
|
|
IWL_CMD(CSR_UCODE_DRV_GP1);
|
|
|
|
IWL_CMD(CSR_UCODE_DRV_GP2);
|
|
|
|
IWL_CMD(CSR_LED_REG);
|
|
|
|
IWL_CMD(CSR_DRAM_INT_TBL_REG);
|
|
|
|
IWL_CMD(CSR_GIO_CHICKEN_BITS);
|
|
|
|
IWL_CMD(CSR_ANA_PLL_CFG);
|
|
|
|
IWL_CMD(CSR_HW_REV_WA_REG);
|
|
|
|
IWL_CMD(CSR_DBG_HPET_MEM_REG);
|
|
|
|
default:
|
|
|
|
return "UNKNOWN";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void iwl_dump_csr(struct iwl_priv *priv)
|
|
|
|
{
|
|
|
|
int i;
|
2010-11-21 10:38:57 +08:00
|
|
|
static const u32 csr_tbl[] = {
|
2010-09-23 00:02:06 +08:00
|
|
|
CSR_HW_IF_CONFIG_REG,
|
|
|
|
CSR_INT_COALESCING,
|
|
|
|
CSR_INT,
|
|
|
|
CSR_INT_MASK,
|
|
|
|
CSR_FH_INT_STATUS,
|
|
|
|
CSR_GPIO_IN,
|
|
|
|
CSR_RESET,
|
|
|
|
CSR_GP_CNTRL,
|
|
|
|
CSR_HW_REV,
|
|
|
|
CSR_EEPROM_REG,
|
|
|
|
CSR_EEPROM_GP,
|
|
|
|
CSR_OTP_GP_REG,
|
|
|
|
CSR_GIO_REG,
|
|
|
|
CSR_GP_UCODE_REG,
|
|
|
|
CSR_GP_DRIVER_REG,
|
|
|
|
CSR_UCODE_DRV_GP1,
|
|
|
|
CSR_UCODE_DRV_GP2,
|
|
|
|
CSR_LED_REG,
|
|
|
|
CSR_DRAM_INT_TBL_REG,
|
|
|
|
CSR_GIO_CHICKEN_BITS,
|
|
|
|
CSR_ANA_PLL_CFG,
|
|
|
|
CSR_HW_REV_WA_REG,
|
|
|
|
CSR_DBG_HPET_MEM_REG
|
|
|
|
};
|
|
|
|
IWL_ERR(priv, "CSR values:\n");
|
|
|
|
IWL_ERR(priv, "(2nd byte of CSR_INT_COALESCING is "
|
|
|
|
"CSR_INT_PERIODIC_REG)\n");
|
|
|
|
for (i = 0; i < ARRAY_SIZE(csr_tbl); i++) {
|
|
|
|
IWL_ERR(priv, " %25s: 0X%08x\n",
|
|
|
|
get_csr_string(csr_tbl[i]),
|
|
|
|
iwl_read32(priv, csr_tbl[i]));
|
|
|
|
}
|
|
|
|
}
|
2010-09-23 00:02:07 +08:00
|
|
|
|
|
|
|
static const char *get_fh_string(int cmd)
|
|
|
|
{
|
|
|
|
switch (cmd) {
|
|
|
|
IWL_CMD(FH_RSCSR_CHNL0_STTS_WPTR_REG);
|
|
|
|
IWL_CMD(FH_RSCSR_CHNL0_RBDCB_BASE_REG);
|
|
|
|
IWL_CMD(FH_RSCSR_CHNL0_WPTR);
|
|
|
|
IWL_CMD(FH_MEM_RCSR_CHNL0_CONFIG_REG);
|
|
|
|
IWL_CMD(FH_MEM_RSSR_SHARED_CTRL_REG);
|
|
|
|
IWL_CMD(FH_MEM_RSSR_RX_STATUS_REG);
|
|
|
|
IWL_CMD(FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV);
|
|
|
|
IWL_CMD(FH_TSSR_TX_STATUS_REG);
|
|
|
|
IWL_CMD(FH_TSSR_TX_ERROR_REG);
|
|
|
|
default:
|
|
|
|
return "UNKNOWN";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int iwl_dump_fh(struct iwl_priv *priv, char **buf, bool display)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
#ifdef CONFIG_IWLWIFI_DEBUG
|
|
|
|
int pos = 0;
|
|
|
|
size_t bufsz = 0;
|
|
|
|
#endif
|
2010-11-21 10:38:57 +08:00
|
|
|
static const u32 fh_tbl[] = {
|
2010-09-23 00:02:07 +08:00
|
|
|
FH_RSCSR_CHNL0_STTS_WPTR_REG,
|
|
|
|
FH_RSCSR_CHNL0_RBDCB_BASE_REG,
|
|
|
|
FH_RSCSR_CHNL0_WPTR,
|
|
|
|
FH_MEM_RCSR_CHNL0_CONFIG_REG,
|
|
|
|
FH_MEM_RSSR_SHARED_CTRL_REG,
|
|
|
|
FH_MEM_RSSR_RX_STATUS_REG,
|
|
|
|
FH_MEM_RSSR_RX_ENABLE_ERR_IRQ2DRV,
|
|
|
|
FH_TSSR_TX_STATUS_REG,
|
|
|
|
FH_TSSR_TX_ERROR_REG
|
|
|
|
};
|
|
|
|
#ifdef CONFIG_IWLWIFI_DEBUG
|
|
|
|
if (display) {
|
|
|
|
bufsz = ARRAY_SIZE(fh_tbl) * 48 + 40;
|
|
|
|
*buf = kmalloc(bufsz, GFP_KERNEL);
|
|
|
|
if (!*buf)
|
|
|
|
return -ENOMEM;
|
|
|
|
pos += scnprintf(*buf + pos, bufsz - pos,
|
|
|
|
"FH register values:\n");
|
|
|
|
for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
|
|
|
|
pos += scnprintf(*buf + pos, bufsz - pos,
|
|
|
|
" %34s: 0X%08x\n",
|
|
|
|
get_fh_string(fh_tbl[i]),
|
|
|
|
iwl_read_direct32(priv, fh_tbl[i]));
|
|
|
|
}
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
IWL_ERR(priv, "FH register values:\n");
|
|
|
|
for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
|
|
|
|
IWL_ERR(priv, " %34s: 0X%08x\n",
|
|
|
|
get_fh_string(fh_tbl[i]),
|
|
|
|
iwl_read_direct32(priv, fh_tbl[i]));
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2011-01-05 08:22:00 +08:00
|
|
|
|
|
|
|
/* notification wait support */
|
|
|
|
void iwlagn_init_notification_wait(struct iwl_priv *priv,
|
|
|
|
struct iwl_notification_wait *wait_entry,
|
2011-04-13 18:14:47 +08:00
|
|
|
u8 cmd,
|
2011-01-05 08:22:00 +08:00
|
|
|
void (*fn)(struct iwl_priv *priv,
|
2011-04-13 18:14:47 +08:00
|
|
|
struct iwl_rx_packet *pkt,
|
|
|
|
void *data),
|
|
|
|
void *fn_data)
|
2011-01-05 08:22:00 +08:00
|
|
|
{
|
|
|
|
wait_entry->fn = fn;
|
2011-04-13 18:14:47 +08:00
|
|
|
wait_entry->fn_data = fn_data;
|
2011-01-05 08:22:00 +08:00
|
|
|
wait_entry->cmd = cmd;
|
|
|
|
wait_entry->triggered = false;
|
2011-04-13 18:14:49 +08:00
|
|
|
wait_entry->aborted = false;
|
2011-01-05 08:22:00 +08:00
|
|
|
|
2011-07-13 23:38:57 +08:00
|
|
|
spin_lock_bh(&priv->notif_wait_lock);
|
|
|
|
list_add(&wait_entry->list, &priv->notif_waits);
|
|
|
|
spin_unlock_bh(&priv->notif_wait_lock);
|
2011-01-05 08:22:00 +08:00
|
|
|
}
|
|
|
|
|
2011-04-13 18:14:48 +08:00
|
|
|
int iwlagn_wait_notification(struct iwl_priv *priv,
|
|
|
|
struct iwl_notification_wait *wait_entry,
|
|
|
|
unsigned long timeout)
|
2011-01-05 08:22:00 +08:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2011-07-13 23:38:57 +08:00
|
|
|
ret = wait_event_timeout(priv->notif_waitq,
|
2011-04-13 18:14:49 +08:00
|
|
|
wait_entry->triggered || wait_entry->aborted,
|
2011-01-05 08:22:00 +08:00
|
|
|
timeout);
|
|
|
|
|
2011-07-13 23:38:57 +08:00
|
|
|
spin_lock_bh(&priv->notif_wait_lock);
|
2011-01-05 08:22:00 +08:00
|
|
|
list_del(&wait_entry->list);
|
2011-07-13 23:38:57 +08:00
|
|
|
spin_unlock_bh(&priv->notif_wait_lock);
|
2011-01-05 08:22:00 +08:00
|
|
|
|
2011-04-13 18:14:49 +08:00
|
|
|
if (wait_entry->aborted)
|
|
|
|
return -EIO;
|
|
|
|
|
2011-04-13 18:14:48 +08:00
|
|
|
/* return value is always >= 0 */
|
|
|
|
if (ret <= 0)
|
|
|
|
return -ETIMEDOUT;
|
|
|
|
return 0;
|
2011-01-05 08:22:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void iwlagn_remove_notification(struct iwl_priv *priv,
|
|
|
|
struct iwl_notification_wait *wait_entry)
|
|
|
|
{
|
2011-07-13 23:38:57 +08:00
|
|
|
spin_lock_bh(&priv->notif_wait_lock);
|
2011-01-05 08:22:00 +08:00
|
|
|
list_del(&wait_entry->list);
|
2011-07-13 23:38:57 +08:00
|
|
|
spin_unlock_bh(&priv->notif_wait_lock);
|
2011-01-05 08:22:00 +08:00
|
|
|
}
|