Skip to contentSkip to conversation

update for 3.2

PATCH In review Wey-Yi Guy 3 participants 36 messages Sep 15, 2011 Networking drivers (wireless)

lore
Share & tools
lore

Wey-Yi Guy

author
#0 lore raw

cover update for 3.2

We adding more documents for the transport layer work We continue the transport layer work to make it better and cleaner We also continue doing the cleanup work after driver split

Don Fry (1):
iwlagn: replace beacon_time_fsf_bits variable with #define

Emmanuel Grumbach (9):
iwlagn: warn about buggy fw that doesn't set SEQ_RX_FRAME
iwlagn: unmap cmd queue's tfds as BIDI
iwlagn: free the Tx cmd when a non empty Tx queue is freed
iwlagn: move iwl_stop / wake_queue to the upper layer
iwlagn: use enum iwl_rxon_context_id instead of u8
iwlagn: document the bus layer API
iwlagn: add documentation to the transport layer
iwlagn: beautify the code - remove uneeded line break
iwlagn: provide data after WARN_ON

Fry, Donald H (2):
iwlagn: fix modinfo display for 135 ucode.
iwlagn: simplify chain_noise_num_beacons indirection

Johannes Berg (9):
iwlagn: move PCI-E transport files
iwlagn: generically provide iwl_trans_send_cmd_pdu
iwlagn: Makefile whitespace cleanup
iwlagn: clean up PM code
iwlagn: rename iwl-pci.h to iwl-cfg.h
iwlagn: remove unused function declarations
iwlagn: move sysfs files to debugfs
iwlagn: remove drvdata support from bus layer
iwlagn: do not use interruptible waits

Wey-Yi Guy (6):
iwlagn: New SKU for 6005 SFF
iwlagn: merge eeprom access into single file
iwlagn: add support for v2 of temperature offset calibration
iwlagn: use iwl_eeprom_calib_hdr structure
iwlagn: fix stack corruption for temperature offset v2
iwlagn: signedness bug

these patches are also available from wireless-next-2.6 branch on
git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi.git

Because the file system problem, all the patches are not push into git.kernel.org yet. I will push as soon as the file system issue addressed

 drivers/net/wireless/iwlwifi/Makefile             |   23 +-
 drivers/net/wireless/iwlwifi/iwl-1000.c           |    5 +-
 drivers/net/wireless/iwlwifi/iwl-2000.c           |   12 +-
 drivers/net/wireless/iwlwifi/iwl-5000-hw.h        |    4 +-
 drivers/net/wireless/iwlwifi/iwl-5000.c           |    7 +-
 drivers/net/wireless/iwlwifi/iwl-6000.c           |    7 +-
 drivers/net/wireless/iwlwifi/iwl-agn-calib.c      |   21 +-
 drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c     |  299 ---
 drivers/net/wireless/iwlwifi/iwl-agn-lib.c        |    6 +-
 drivers/net/wireless/iwlwifi/iwl-agn-tt.c         |    4 +-
 drivers/net/wireless/iwlwifi/iwl-agn-tx.c         |    2 +-
 drivers/net/wireless/iwlwifi/iwl-agn-ucode.c      |   55 +-
 drivers/net/wireless/iwlwifi/iwl-agn.c            |  148 +--
 drivers/net/wireless/iwlwifi/iwl-bus.h            |   72 +-
 drivers/net/wireless/iwlwifi/iwl-cfg.h            |  115 ++
 drivers/net/wireless/iwlwifi/iwl-commands.h       |    8 +
 drivers/net/wireless/iwlwifi/iwl-core.c           |   53 +-
 drivers/net/wireless/iwlwifi/iwl-core.h           |    3 +-
 drivers/net/wireless/iwlwifi/iwl-debugfs.c        |   72 +-
 drivers/net/wireless/iwlwifi/iwl-dev.h            |    2 +
 drivers/net/wireless/iwlwifi/iwl-eeprom.c         |  239 +++-
 drivers/net/wireless/iwlwifi/iwl-eeprom.h         |   10 +-
 drivers/net/wireless/iwlwifi/iwl-pci.c            |   22 +-
 drivers/net/wireless/iwlwifi/iwl-pci.h            |  116 --
 drivers/net/wireless/iwlwifi/iwl-rx.c             |    2 +-
 drivers/net/wireless/iwlwifi/iwl-shared.h         |  140 +-
 drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h |  454 -----
 drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h |  448 +++++
 drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c  | 1424 +++++++++++++++
 drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c  | 1153 ++++++++++++
 drivers/net/wireless/iwlwifi/iwl-trans-pcie.c     | 1988 +++++++++++++++++++++
 drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c  | 1412 ---------------
 drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c  | 1158 ------------
 drivers/net/wireless/iwlwifi/iwl-trans.c          | 1926 +--------------------
 drivers/net/wireless/iwlwifi/iwl-trans.h          |   27 +-
 35 files changed, 5762 insertions(+), 5675 deletions(-)
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-cfg.h
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-pci.h
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
author
#1 lore raw

PATCH 1/27 iwlagn: warn about buggy fw that doesn't set SEQ_RX_FRAME

From: Emmanuel Grumbach <[email protected]>

The way we check if there is host command that should be reclaimed is way too complicated. We should have a clear indication from the fw. The fw is expected to set the SEQ_RX_FRAME bit if the frame was originated by the fw which indicates to the driver that there is no host command to free.
Somehow, there seem to have been buggy fw out there, hence the very old comment.

This code checks if we have still buggy fw out there.

---
 drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c +12 -0
index 126e5a4..2308177 100644
@@ -398,6 +398,7 @@ static void iwl_rx_handle(struct iwl_trans *trans)
 
 	while (i != r) {
 		int len;
+		u16 txq_id, sequence;
 
 		rxb = rxq->queue[i];
 
@@ -437,6 +438,17 @@ static void iwl_rx_handle(struct iwl_trans *trans)
 			(pkt->hdr.cmd != STATISTICS_NOTIFICATION) &&
 			(pkt->hdr.cmd != REPLY_TX);
 
+		sequence = le16_to_cpu(pkt->hdr.sequence);
+		txq_id = SEQ_TO_QUEUE(le16_to_cpu(pkt->hdr.sequence));
+
+		/* warn if this is cmd response / notification and the uCode
+		 * didn't set the SEQ_RX_FRAME for a frame that is
+		 * uCode-originated*/
+		WARN(txq_id == trans->shrd->cmd_queue && reclaim == false &&
+		     (!(pkt->hdr.sequence & SEQ_RX_FRAME)),
+		     "reclaim is false, SEQ_RX_FRAME unset: %s\n",
+		     get_cmd_string(pkt->hdr.cmd));
+
 		iwl_rx_dispatch(priv(trans), rxb);
 
 		/*
Signature · 1 line
1.7.0.4
author
#2 lore raw

PATCH 2/27 iwlagn: unmap cmd queue's tfds as BIDI

In reply to Wey-Yi Guy

From: Emmanuel Grumbach <[email protected]>

If the driver is unloaded while there is still a host command in flight, its tfd will be freed by iwl_tx_queue_free.
This function is called for both types of queues: Tx queues and cmd queue. This didn't take in count the fact that in Tx queues, tfds are mapped as TO_DEVICE (besides the first TB), whereas in cmd queue, all TBs are mapped as BIDI.

Hence, tx_queue_free unmapped the second (and higher) TB of each tfd in the cmd queue as TO_DEVICE, whereas they must be freed as BIDI. This means that if a multi TFD is in flight while we unload the driver (which is quite unlikely but can happen), we will get the warning below.

This patch fixes this.

[  445.234060] ------------[ cut here ]------------
[  445.236273] WARNING: at lib/dma-debug.c:861 check_unmap+0x337/0x780()
[  445.236654] iwlagn 0000:02:00.0: DMA-API: device driver frees DMA memory with different direction [device address=0x0000000126950540] [size=8 bytes] [mapped with DMA_BIDIRECTIONAL] [unmapped with DMA_TO_DEVICE]
[  445.236654] Modules linked in: ...
[  445.236654] Pid: 1415, comm: modprobe Not tainted 3.1.0-rc4-wl-65912-g5215ff1-dirty #79
[  445.236654] Call Trace:
[  445.236654]  [<ffffffff81043a51>] warn_slowpath_common+0x71/0xa0
[  445.236654]  [<ffffffff81043b37>] warn_slowpath_fmt+0x47/0x50
[  445.236654]  [<ffffffff8121e687>] check_unmap+0x337/0x780
[  445.236654]  [<ffffffff810e9136>] ? free_one_page+0x156/0x320
[  445.236654]  [<ffffffff8121ec5a>] debug_dma_unmap_page+0x5a/0x60
[  445.236654]  [<ffffffffa021d701>] iwlagn_unmap_tfd.isra.11+0x121/0x1c0 [iwlagn]
[  445.236654]  [<ffffffffa021ddf2>] iwlagn_txq_free_tfd+0x42/0x70 [iwlagn]
[  445.236654]  [<ffffffffa02121de>] iwl_tx_queue_unmap+0x4e/0x70 [iwlagn]
[  445.236654]  [<ffffffffa0212fad>] iwl_trans_pcie_tx_free+0x10d/0x440 [iwlagn]
[  445.236654]  [<ffffffff81064959>] ? destroy_workqueue+0xb9/0x1e0
[  445.236654]  [<ffffffffa021330a>] iwl_trans_pcie_free+0x2a/0x2c0 [iwlagn]
[  445.236654]  [<ffffffffa022f4f2>] iwl_remove+0x149/0x17e [iwlagn]
[  445.236654]  [<ffffffffa022f546>] iwl_pci_remove+0x1f/0x65 [iwlagn]
[  445.236654]  [<ffffffff81228337>] pci_device_remove+0x47/0x120
[  445.236654]  [<ffffffff8134566c>] __device_release_driver+0x7c/0xe0
[  445.236654]  [<ffffffff81345dc8>] driver_detach+0xc8/0xd0
[  445.236654]  [<ffffffff813454c8>] bus_remove_driver+0x88/0xe0
[  445.236654]  [<ffffffff81346572>] driver_unregister+0x62/0xa0
[  445.236654]  [<ffffffff812271d4>] pci_unregister_driver+0x44/0xc0
[  445.236654]  [<ffffffffa0211ce5>] iwl_pci_unregister_driver+0x15/0x20 [iwlagn]
[  445.236654]  [<ffffffffa022f595>] iwl_exit+0x9/0xa74 [iwlagn]
[  445.236654]  [<ffffffff810918f4>] sys_delete_module+0x184/0x240
[  445.236654]  [<ffffffff81452ece>] ? retint_swapgs+0xe/0x13
[  445.236654]  [<ffffffff8121098e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[  445.236654]  [<ffffffff81459e2b>] system_call_fastpath+0x16/0x1b
[  445.236654] ---[ end trace 1fbc362b7dbe5d74 ]---
[  445.236654] Mapped at:
[  445.236654]  [<ffffffff8121d7cb>] debug_dma_map_page+0x8b/0x150
[  445.236654]  [<ffffffffa021e7b7>] iwl_enqueue_hcmd+0x837/0xa40 [iwlagn]
[  445.236654]  [<ffffffffa021f92d>] iwl_trans_pcie_send_cmd+0x8d/0x580 [iwlagn]
[  445.236654]  [<ffffffffa01f7c75>] iwl_send_calib_results+0x75/0xd0 [iwlagn]
[  445.236654]  [<ffffffffa01f21f6>] iwlagn_alive_notify+0x196/0x1f0 [iwlagn]
[  445.386500] iwlagn 0000:02:00.0: PCI INT A disabled
---
 drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h |    2 +-
 drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c  |   12 ++++++++----
 drivers/net/wireless/iwlwifi/iwl-trans.c          |   12 +++++++++++-
 3 files changed, 20 insertions(+), 6 deletions(-)
drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h +1 -1
index 8047e95..fc33754 100644
@@ -307,7 +307,7 @@ void iwl_trans_pcie_tx_agg_setup(struct iwl_trans *trans,
 				 enum iwl_rxon_context_id ctx,
 				 int sta_id, int tid, int frame_limit);
 void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
-	int index);
+	int index, enum dma_data_direction dma_dir);
 int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
 			 struct sk_buff_head *skbs);
 int iwl_queue_space(const struct iwl_queue *q);
drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c +8 -4
index ca686db..c7ddb22 100644
@@ -207,17 +207,17 @@ static void iwlagn_unmap_tfd(struct iwl_trans *trans, struct iwl_cmd_meta *meta,
  * @trans - transport private data
  * @txq - tx queue
  * @index - the index of the TFD to be freed
+ *@dma_dir - the direction of the DMA mapping
  *
  * Does NOT advance any TFD circular buffer read/write indexes
  * Does NOT free the TFD itself (which is within circular buffer)
  */
 void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
-	int index)
+	int index, enum dma_data_direction dma_dir)
 {
 	struct iwl_tfd *tfd_tmp = txq->tfds;
 
-	iwlagn_unmap_tfd(trans, &txq->meta[index], &tfd_tmp[index],
-			 DMA_TO_DEVICE);
+	iwlagn_unmap_tfd(trans, &txq->meta[index], &tfd_tmp[index], dma_dir);
 
 	/* free SKB */
 	if (txq->skbs) {
@@ -1119,6 +1119,10 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
 	int last_to_free;
 	int freed = 0;
 
+	/* This function is not meant to release cmd queue*/
+	if (WARN_ON(txq_id == trans->shrd->cmd_queue))
+		return 0;
+
 	/*Since we free until index _not_ inclusive, the one before index is
 	 * the last we will free. This one must be used */
 	last_to_free = iwl_queue_dec_wrap(index, q->n_bd);
@@ -1151,7 +1155,7 @@ int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
 
 		iwlagn_txq_inval_byte_cnt_tbl(trans, txq);
 
-		iwlagn_txq_free_tfd(trans, txq, txq->q.read_ptr);
+		iwlagn_txq_free_tfd(trans, txq, txq->q.read_ptr, DMA_TO_DEVICE);
 		freed++;
 	}
 	return freed;
drivers/net/wireless/iwlwifi/iwl-trans.c +11 -1
index b2e8907..228c861 100644
@@ -411,13 +411,23 @@ static void iwl_tx_queue_unmap(struct iwl_trans *trans, int txq_id)
 	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 	struct iwl_tx_queue *txq = &trans_pcie->txq[txq_id];
 	struct iwl_queue *q = &txq->q;
+	enum dma_data_direction dma_dir;
 
 	if (!q->n_bd)
 		return;
 
+	/* In the command queue, all the TBs are mapped as BIDI
+	 * so unmap them as such.
+	 */
+	if (txq_id == trans->shrd->cmd_queue)
+		dma_dir = DMA_BIDIRECTIONAL;
+	else
+		dma_dir = DMA_TO_DEVICE;
+
 	while (q->write_ptr != q->read_ptr) {
 		/* The read_ptr needs to bound by q->n_window */
-		iwlagn_txq_free_tfd(trans, txq, get_cmd_index(q, q->read_ptr));
+		iwlagn_txq_free_tfd(trans, txq, get_cmd_index(q, q->read_ptr),
+				    dma_dir);
 		q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd);
 	}
 }
Signature · 1 line
1.7.0.4
author
#3 lore raw

PATCH 3/27 iwlagn: free the Tx cmd when a non empty Tx queue is freed

In reply to Wey-Yi Guy

From: Emmanuel Grumbach <[email protected]>

When a non-empty Tx queueis freed, the buffer it contains must be freed too. Since the Tx cmd are now allocated from a pool, the Tx cmd must be freed too.

This patch avoids to destroy a non-empty pool of Tx cmd.

---
 drivers/net/wireless/iwlwifi/iwl-agn.c           |    4 ++--
 drivers/net/wireless/iwlwifi/iwl-core.c          |    9 +++++++++
 drivers/net/wireless/iwlwifi/iwl-shared.h        |    1 +
 drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c |    7 +++++--
 4 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +2 -2
index 7f6c58e..1142d85 100644
@@ -1522,6 +1522,8 @@ static void __iwl_down(struct iwl_priv *priv)
 	if (priv->shrd->mac80211_registered)
 		ieee80211_stop_queues(priv->hw);
 
+	iwl_trans_stop_device(trans(priv));
+
 	/* Clear out all status bits but a few that are stable across reset */
 	priv->shrd->status &=
 			test_bit(STATUS_RF_KILL_HW, &priv->shrd->status) <<
@@ -1533,8 +1535,6 @@ static void __iwl_down(struct iwl_priv *priv)
 			test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) <<
 				STATUS_EXIT_PENDING;
 
-	iwl_trans_stop_device(trans(priv));
-
 	dev_kfree_skb(priv->beacon_skb);
 	priv->beacon_skb = NULL;
 }
drivers/net/wireless/iwlwifi/iwl-core.c +9 -0
index 9270f99..5e490db 100644
@@ -1876,3 +1876,12 @@ void iwl_nic_config(struct iwl_priv *priv)
 	priv->cfg->lib->nic_config(priv);
 
 }
+
+void iwl_free_skb(struct iwl_priv *priv, struct sk_buff *skb)
+{
+	struct ieee80211_tx_info *info;
+
+	info = IEEE80211_SKB_CB(skb);
+	kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
+	dev_kfree_skb_any(skb);
+}
drivers/net/wireless/iwlwifi/iwl-shared.h +1 -0
index d987bee..bdfbc60 100644
@@ -390,6 +390,7 @@ void iwl_stop_tx_ba_trans_ready(struct iwl_priv *priv,
 				u8 sta_id, u8 tid);
 void iwl_set_hw_rfkill_state(struct iwl_priv *priv, bool state);
 void iwl_nic_config(struct iwl_priv *priv);
+void iwl_free_skb(struct iwl_priv *priv, struct sk_buff *skb);
 void iwl_apm_stop(struct iwl_priv *priv);
 int iwl_apm_init(struct iwl_priv *priv);
 void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand);
drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c +5 -2
index c7ddb22..15cb0ff 100644
@@ -225,9 +225,12 @@ void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
 
 		skb = txq->skbs[index];
 
-		/* can be called from irqs-disabled context */
+		/* Can be called from irqs-disabled context
+		 * If skb is not NULL, it means that the whole queue is being
+		 * freed and that the queue is not empty - free the skb
+		 */
 		if (skb) {
-			dev_kfree_skb_any(skb);
+			iwl_free_skb(priv(trans), skb);
 			txq->skbs[index] = NULL;
 		}
 	}
Signature · 1 line
1.7.0.4
author
#4 lore raw

PATCH 4/27 iwlagn: move iwl_stop / wake_queue to the upper layer

In reply to Wey-Yi Guy

From: Emmanuel Grumbach <[email protected]>

Add a wrapper in the upper layer to call the mac80211's function. This allows not to have the transport layer call mac80211 directly.

---
 drivers/net/wireless/iwlwifi/iwl-agn-tt.c         |    4 ++--
 drivers/net/wireless/iwlwifi/iwl-agn.c            |    9 ++++-----
 drivers/net/wireless/iwlwifi/iwl-core.c           |   10 ++++++++++
 drivers/net/wireless/iwlwifi/iwl-dev.h            |    2 ++
 drivers/net/wireless/iwlwifi/iwl-shared.h         |    9 +++------
 drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h |   10 ++--------
 6 files changed, 23 insertions(+), 21 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn-tt.c +2 -2
index 92ba8cd..495f936 100644
@@ -209,7 +209,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
 {
 	if (stop) {
 		IWL_DEBUG_TEMP(priv, "Stop all queues\n");
-		if (priv->shrd->mac80211_registered)
+		if (priv->mac80211_registered)
 			ieee80211_stop_queues(priv->hw);
 		IWL_DEBUG_TEMP(priv,
 				"Schedule 5 seconds CT_KILL Timer\n");
@@ -217,7 +217,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
 			  jiffies + CT_KILL_EXIT_DURATION * HZ);
 	} else {
 		IWL_DEBUG_TEMP(priv, "Wake all queues\n");
-		if (priv->shrd->mac80211_registered)
+		if (priv->mac80211_registered)
 			ieee80211_wake_queues(priv->hw);
 	}
 }
drivers/net/wireless/iwlwifi/iwl-agn.c +4 -5
index 1142d85..61f8ea6 100644
@@ -1519,7 +1519,7 @@ static void __iwl_down(struct iwl_priv *priv)
 	if (!exit_pending)
 		clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
 
-	if (priv->shrd->mac80211_registered)
+	if (priv->mac80211_registered)
 		ieee80211_stop_queues(priv->hw);
 
 	iwl_trans_stop_device(trans(priv));
@@ -1863,7 +1863,7 @@ static int iwl_mac_setup_register(struct iwl_priv *priv,
 		IWL_ERR(priv, "Failed to register hw (error %d)\n", ret);
 		return ret;
 	}
-	priv->shrd->mac80211_registered = 1;
+	priv->mac80211_registered = 1;
 
 	return 0;
 }
@@ -3311,7 +3311,6 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
 	priv->shrd = &priv->_shrd;
 	priv->shrd->bus = bus;
 	priv->shrd->priv = priv;
-	priv->shrd->hw = hw;
 	bus_set_drv_data(priv->bus, priv->shrd);
 
 	priv->shrd->trans = trans_ops->alloc(priv->shrd);
@@ -3487,9 +3486,9 @@ void __devexit iwl_remove(struct iwl_priv * priv)
 	iwl_testmode_cleanup(priv);
 	iwl_leds_exit(priv);
 
-	if (priv->shrd->mac80211_registered) {
+	if (priv->mac80211_registered) {
 		ieee80211_unregister_hw(priv->hw);
-		priv->shrd->mac80211_registered = 0;
+		priv->mac80211_registered = 0;
 	}
 
 	iwl_tt_exit(priv);
drivers/net/wireless/iwlwifi/iwl-core.c +10 -0
index 5e490db..208ca21 100644
@@ -1885,3 +1885,13 @@ void iwl_free_skb(struct iwl_priv *priv, struct sk_buff *skb)
 	kmem_cache_free(priv->tx_cmd_pool, (info->driver_data[1]));
 	dev_kfree_skb_any(skb);
 }
+
+void iwl_stop_sw_queue(struct iwl_priv *priv, u8 ac)
+{
+	ieee80211_stop_queue(priv->hw, ac);
+}
+
+void iwl_wake_sw_queue(struct iwl_priv *priv, u8 ac)
+{
+	ieee80211_wake_queue(priv->hw, ac);
+}
drivers/net/wireless/iwlwifi/iwl-dev.h +2 -0
index 8438a33..f69e556 100644
@@ -958,6 +958,8 @@ struct iwl_priv {
 	struct iwl_station_entry stations[IWLAGN_STATION_COUNT];
 	unsigned long ucode_key_table;
 
+	u8 mac80211_registered;
+
 	/* Indication if ieee80211_ops->open has been called */
 	u8 is_open;
 
drivers/net/wireless/iwlwifi/iwl-shared.h +3 -6
index bdfbc60..0f15d58 100644
@@ -246,12 +246,6 @@ struct iwl_shared {
 	spinlock_t sta_lock;
 	struct mutex mutex;
 
-	/*these 2 shouldn't really be here, but they are needed for
-	 * iwl_queue_stop, which is called from the upper layer too
-	 */
-	u8 mac80211_registered;
-	struct ieee80211_hw *hw;
-
 	struct iwl_tid_data tid_data[IWLAGN_STATION_COUNT][IWL_MAX_TID_COUNT];
 
 	wait_queue_head_t wait_command_queue;
@@ -397,6 +391,9 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand);
 const char *get_cmd_string(u8 cmd);
 bool iwl_check_for_ct_kill(struct iwl_priv *priv);
 
+void iwl_stop_sw_queue(struct iwl_priv *priv, u8 ac);
+void iwl_wake_sw_queue(struct iwl_priv *priv, u8 ac);
+
 #ifdef CONFIG_IWLWIFI_DEBUGFS
 void iwl_reset_traffic_log(struct iwl_priv *priv);
 #endif /* CONFIG_IWLWIFI_DEBUGFS */
drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h +2 -8
index fc33754..49cd5a7 100644
@@ -375,12 +375,9 @@ static inline void iwl_wake_queue(struct iwl_trans *trans,
 	struct iwl_trans_pcie *trans_pcie =
 		IWL_TRANS_GET_PCIE_TRANS(trans);
 
-	if (unlikely(!trans->shrd->mac80211_registered))
-		return;
-
 	if (test_and_clear_bit(hwq, trans_pcie->queue_stopped))
 		if (atomic_dec_return(&trans_pcie->queue_stop_count[ac]) <= 0)
-			ieee80211_wake_queue(trans->shrd->hw, ac);
+			iwl_wake_sw_queue(priv(trans), ac);
 }
 
 static inline void iwl_stop_queue(struct iwl_trans *trans,
@@ -392,12 +389,9 @@ static inline void iwl_stop_queue(struct iwl_trans *trans,
 	struct iwl_trans_pcie *trans_pcie =
 		IWL_TRANS_GET_PCIE_TRANS(trans);
 
-	if (unlikely(!trans->shrd->mac80211_registered))
-		return;
-
 	if (!test_and_set_bit(hwq, trans_pcie->queue_stopped))
 		if (atomic_inc_return(&trans_pcie->queue_stop_count[ac]) > 0)
-			ieee80211_stop_queue(trans->shrd->hw, ac);
+			iwl_stop_sw_queue(priv(trans), ac);
 }
 
 #ifdef ieee80211_stop_queue
Signature · 1 line
1.7.0.4
author
#5 lore raw

PATCH 5/27 iwlagn: use enum iwl_rxon_context_id instead of u8

In reply to Wey-Yi Guy

From: Emmanuel Grumbach <[email protected]>

enum iwl_rxon_context_id is the right type to use when we need a rxon_context_id.

---
 drivers/net/wireless/iwlwifi/iwl-core.c   |    3 ++-
 drivers/net/wireless/iwlwifi/iwl-shared.h |    6 ++++--
 drivers/net/wireless/iwlwifi/iwl-trans.c  |    5 +++--
 drivers/net/wireless/iwlwifi/iwl-trans.h  |   12 ++++++++----
 4 files changed, 17 insertions(+), 9 deletions(-)
drivers/net/wireless/iwlwifi/iwl-core.c +2 -1
index 208ca21..90ab27e 100644
@@ -817,7 +817,8 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)
 }
 
 #ifdef CONFIG_IWLWIFI_DEBUG
-void iwl_print_rx_config_cmd(struct iwl_priv *priv, u8 ctxid)
+void iwl_print_rx_config_cmd(struct iwl_priv *priv,
+			     enum iwl_rxon_context_id ctxid)
 {
 	struct iwl_rxon_context *ctx = &priv->contexts[ctxid];
 	struct iwl_rxon_cmd *rxon = &ctx->staging;
drivers/net/wireless/iwlwifi/iwl-shared.h +4 -2
index 0f15d58..36872f0 100644
@@ -399,9 +399,11 @@ void iwl_reset_traffic_log(struct iwl_priv *priv);
 #endif /* CONFIG_IWLWIFI_DEBUGFS */
 
 #ifdef CONFIG_IWLWIFI_DEBUG
-void iwl_print_rx_config_cmd(struct iwl_priv *priv, u8 ctxid);
+void iwl_print_rx_config_cmd(struct iwl_priv *priv,
+			     enum iwl_rxon_context_id ctxid);
 #else
-static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv, u8 ctxid)
+static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv,
+					   enum iwl_rxon_context_id ctxid)
 {
 }
 #endif
drivers/net/wireless/iwlwifi/iwl-trans.c +3 -2
index 228c861..209dd7e 100644
@@ -1041,7 +1041,8 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans)
 }
 
 static int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
-		struct iwl_device_cmd *dev_cmd, u8 ctx, u8 sta_id)
+		struct iwl_device_cmd *dev_cmd, enum iwl_rxon_context_id ctx,
+		u8 sta_id)
 {
 	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
@@ -1413,7 +1414,7 @@ static int iwl_trans_pcie_resume(struct iwl_trans *trans)
 #endif /* CONFIG_PM */
 
 static void iwl_trans_pcie_wake_any_queue(struct iwl_trans *trans,
-					  u8 ctx)
+					  enum iwl_rxon_context_id ctx)
 {
 	u8 ac, txq_id;
 	struct iwl_trans_pcie *trans_pcie =
drivers/net/wireless/iwlwifi/iwl-trans.h +8 -4
index 71a6fb0..f067408 100644
@@ -178,14 +178,16 @@ struct iwl_trans_ops {
 	void (*stop_device)(struct iwl_trans *trans);
 	void (*tx_start)(struct iwl_trans *trans);
 
-	void (*wake_any_queue)(struct iwl_trans *trans, u8 ctx);
+	void (*wake_any_queue)(struct iwl_trans *trans,
+			       enum iwl_rxon_context_id ctx);
 
 	int (*send_cmd)(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
 
 	int (*send_cmd_pdu)(struct iwl_trans *trans, u8 id, u32 flags, u16 len,
 		     const void *data);
 	int (*tx)(struct iwl_trans *trans, struct sk_buff *skb,
-		struct iwl_device_cmd *dev_cmd, u8 ctx, u8 sta_id);
+		struct iwl_device_cmd *dev_cmd, enum iwl_rxon_context_id ctx,
+		u8 sta_id);
 	void (*reclaim)(struct iwl_trans *trans, int sta_id, int tid,
 			int txq_id, int ssn, u32 status,
 			struct sk_buff_head *skbs);
@@ -255,7 +257,8 @@ static inline void iwl_trans_tx_start(struct iwl_trans *trans)
 	trans->ops->tx_start(trans);
 }
 
-static inline void iwl_trans_wake_any_queue(struct iwl_trans *trans, u8 ctx)
+static inline void iwl_trans_wake_any_queue(struct iwl_trans *trans,
+					    enum iwl_rxon_context_id ctx)
 {
 	trans->ops->wake_any_queue(trans, ctx);
 }
@@ -274,7 +277,8 @@ static inline int iwl_trans_send_cmd_pdu(struct iwl_trans *trans, u8 id,
 }
 
 static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
-		struct iwl_device_cmd *dev_cmd, u8 ctx, u8 sta_id)
+		struct iwl_device_cmd *dev_cmd, enum iwl_rxon_context_id ctx,
+		u8 sta_id)
 {
 	return trans->ops->tx(trans, skb, dev_cmd, ctx, sta_id);
 }
Signature · 1 line
1.7.0.4
author
#6 lore raw

PATCH 6/27 iwlagn: document the bus layer API

In reply to Wey-Yi Guy

From: Emmanuel Grumbach <[email protected]>

Add documentation to the bus layer API - iwl-bus.h

---
 drivers/net/wireless/iwlwifi/iwl-bus.h |   62 +++++++++++++++++++++++++++++---
 1 files changed, 57 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlwifi/iwl-bus.h +57 -5
index 83aed46..98535df 100644
@@ -63,18 +63,65 @@
 #ifndef __iwl_bus_h__
 #define __iwl_bus_h__
 
-/*This file includes the declaration that are exported from the bus layer */
-
 #include <linux/types.h>
 #include <linux/spinlock.h>
 
+/**
+ * DOC: Bus layer - role and goal
+ *
+ * iwl-bus.h defines the API to the bus layer of the iwlwifi driver.
+ * The bus layer is responsible for doing very basic bus operations that are
+ * listed in the iwl_bus_ops structure.
+ * The bus layer registers to the bus driver, advertises the supported HW and
+ * gets notifications about enumeration, suspend, resume.
+ * For the moment, the bus layer is not a linux kernel module as itself, and
+ * the module_init function of the driver must call the bus specific
+ * registration functions. These functions are listed at the end of this file.
+ * For the moment, there is only one implementation of this interface: PCI-e.
+ * This implementation is iwl-pci.c
+ */
+
+/**
+ * DOC: encapsulation and type safety
+ *
+ * The iwl_bus describes the data that is shared amongst all the bus layer
+ * implementations. This data is visible to other layers. Data in the bus
+ * specific area is not visible outside the bus specific implementation.
+ * iwl_bus holds a pointer to iwl_shared which holds pointer to all the other
+ * layers of the driver (iwl_priv, iwl_trans). In fact, this is the way to go
+ * when the transport layer needs to call a function of another layer.
+ *
+ * In order to achieve encapsulation, iwl_priv cannot be dereferenced from the
+ * bus layer. Type safety is still kept since functions that gets iwl_priv gets
+ * a typed pointer (as opposed to void *).
+ */
+
+/**
+ * DOC: probe flow
+ *
+ * The module_init calls the bus specific registration function. The
+ * registration to the bus layer will trigger an enumeration of the bus which
+ * will call the bus specific probe function.
+ * The first thing this function must do is to allocate the memory needed by
+ * iwl_bus + the bus_specific data.
+ * Once the bus specific probe function has configured the hardware, it
+ * chooses the appropriate transport layer and calls iwl_probe that will run
+ * the bus independent probe flow.
+ *
+ * Note: The bus specific code must set the following data in iwl_bus before it
+ *       calls iwl_probe:
+ *	* bus->dev
+ *	* bus->irq
+ *	* bus->ops
+ */
+
 struct iwl_shared;
 struct iwl_bus;
 
 /**
  * struct iwl_bus_ops - bus specific operations
  * @get_pm_support: must returns true if the bus can go to sleep
- * @apm_config: will be called during the config of the APM configuration
+ * @apm_config: will be called during the config of the APM
  * @set_drv_data: set the shared data pointer to the bus layer
  * @get_hw_id: prints the hw_id in the provided buffer
  * @write8: write a byte to register at offset ofs
@@ -93,14 +140,16 @@ struct iwl_bus_ops {
 
 /**
  * struct iwl_bus - bus common data
- * @dev - pointer to struct device * that represent the device
+ *
+ * This data is common to all bus layer implementations.
+ *
+ * @dev - pointer to struct device * that represents the device
  * @ops - pointer to iwl_bus_ops
  * @shrd - pointer to iwl_shared which holds shared data from the upper layer
  * @irq - the irq number for the device
  * @reg_lock - protect hw register access
  */
 struct iwl_bus {
-	/* Common data to all buses */
 	struct device *dev;
 	const struct iwl_bus_ops *ops;
 	struct iwl_shared *shrd;
@@ -149,6 +198,9 @@ static inline u32 bus_read32(struct iwl_bus *bus, u32 ofs)
 	return bus->ops->read32(bus, ofs);
 }
 
+/*****************************************************
+* Bus layer registration functions
+******************************************************/
 int __must_check iwl_pci_register_driver(void);
 void iwl_pci_unregister_driver(void);
 
Signature · 1 line
1.7.0.4
author
#7 lore raw

PATCH 7/27 iwlagn: add documentation to the transport layer

In reply to Wey-Yi Guy

From: Emmanuel Grumbach <[email protected]>

and do a few clean up fixes on the way

---
 drivers/net/wireless/iwlwifi/iwl-agn-tx.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-shared.h |  117 +++++++++++++++++++++--------
 drivers/net/wireless/iwlwifi/iwl-trans.c  |    4 +-
 3 files changed, 91 insertions(+), 32 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn-tx.c +1 -1
index ba5c514..459b82b 100644
@@ -901,7 +901,7 @@ void iwlagn_rx_reply_compressed_ba(struct iwl_priv *priv,
 			   ba_resp->scd_ssn);
 
 	/* Mark that the expected block-ack response arrived */
-	agg->wait_for_ba = 0;
+	agg->wait_for_ba = false;
 
 	/* Sanity check values reported by uCode */
 	if (ba_resp->txed_2_done > ba_resp->txed) {
drivers/net/wireless/iwlwifi/iwl-shared.h +87 -30

158 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-trans.c +3 -1
index 209dd7e..d4f6281 100644
@@ -1300,6 +1300,8 @@ static int iwlagn_txq_check_empty(struct iwl_trans *trans,
 						    sta_id, tid);
 		}
 		break;
+	default:
+		break;
 	}
 
 	return 0;
@@ -1326,10 +1328,10 @@ static void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid,
 {
 	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 	struct iwl_tx_queue *txq = &trans_pcie->txq[txq_id];
+	enum iwl_agg_state agg_state;
 	/* n_bd is usually 256 => n_bd - 1 = 0xff */
 	int tfd_num = ssn & (txq->q.n_bd - 1);
 	int freed = 0;
-	u8 agg_state;
 	bool cond;
 
 	txq->time_stamp = jiffies;
Signature · 1 line
1.7.0.4
author
#8 lore raw

PATCH 8/27 iwlagn: beautify the code - remove uneeded line break

In reply to Wey-Yi Guy

From: Emmanuel Grumbach <[email protected]>

Two lines could be concatenated without exceeding the 80 char limit.

---
 drivers/net/wireless/iwlwifi/iwl-trans.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/iwlwifi/iwl-trans.c +2 -4
index d4f6281..498e006 100644
@@ -308,10 +308,8 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
 
 	txq->q.n_window = slots_num;
 
-	txq->meta = kzalloc(sizeof(txq->meta[0]) * slots_num,
-			    GFP_KERNEL);
-	txq->cmd = kzalloc(sizeof(txq->cmd[0]) * slots_num,
-			   GFP_KERNEL);
+	txq->meta = kzalloc(sizeof(txq->meta[0]) * slots_num, GFP_KERNEL);
+	txq->cmd = kzalloc(sizeof(txq->cmd[0]) * slots_num, GFP_KERNEL);
 
 	if (!txq->meta || !txq->cmd)
 		goto error;
Signature · 1 line
1.7.0.4
#9 lore raw

Re: [PATCH 08/27] iwlagn: beautify the code - remove uneeded line break

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

Quoted 3 lines · Wey-Yi Guy

From: Emmanuel Grumbach <[email protected]>
Two lines could be concatenated without exceeding the 80 char limit.

drivers/net/wireless/iwlwifi/iwl-trans.c +0 -0

[]

drivers/net/wireless/iwlwifi/iwl-trans.c static int iwl_trans_txq_alloc(struct iwl_trans *trans, · line 312

Quoted 10 lines
drivers/net/wireless/iwlwifi/iwl-trans.c +2 -4
@@ -308,10 +308,8 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
 
 	txq->q.n_window = slots_num;
 
-	txq->meta = kzalloc(sizeof(txq->meta[0]) * slots_num,
-			    GFP_KERNEL);
-	txq->cmd = kzalloc(sizeof(txq->cmd[0]) * slots_num,
-			   GFP_KERNEL);
+	txq->meta = kzalloc(sizeof(txq->meta[0]) * slots_num, GFP_KERNEL);
+	txq->cmd = kzalloc(sizeof(txq->cmd[0]) * slots_num, GFP_KERNEL);

kcalloc would be even prettier...

#10 lore raw

Re: [PATCH 08/27] iwlagn: beautify the code - remove uneeded line break

Quoted 9 lines · Joe Perches

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

Quoted 3 lines · Wey-Yi Guy

From: Emmanuel Grumbach <[email protected]>
Two lines could be concatenated without exceeding the 80 char limit.

drivers/net/wireless/iwlwifi/iwl-trans.c +0 -0

[]

Quoted 4 lines
drivers/net/wireless/iwlwifi/iwl-trans.c +0 -0
@@ -308,10 +308,8 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
 
 	txq->q.n_window = slots_num;
 
Quoted 10 lines

drivers/net/wireless/iwlwifi/iwl-trans.c static int iwl_trans_txq_alloc(struct iwl_trans *trans, · line 312

Quoted 6 lines
drivers/net/wireless/iwlwifi/iwl-trans.c +2 -4
-	txq->meta = kzalloc(sizeof(txq->meta[0]) * slots_num,
-			    GFP_KERNEL);
-	txq->cmd = kzalloc(sizeof(txq->cmd[0]) * slots_num,
-			   GFP_KERNEL);
+	txq->meta = kzalloc(sizeof(txq->meta[0]) * slots_num, GFP_KERNEL);
+	txq->cmd = kzalloc(sizeof(txq->cmd[0]) * slots_num, GFP_KERNEL);

kcalloc would be even prettier...

agree, would you mind submit a patch to changes it

Thanks
Wey

#11 lore raw

PATCH 1/1 iwlagn: Convert kzalloc to kcalloc

Convert kzalloc to kcalloc, coalesce multiple lines too.

---

Quoted 3 lines · Wey-Yi
Quoted 1 line · Joe Perches

kcalloc would be even prettier...

agree, would you mind submit a patch to changes it

Just converted your original patch inline.

 drivers/net/wireless/iwlwifi/iwl-trans.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/iwlwifi/iwl-trans.c +2 -4
index d4f6281..498e006 100644
@@ -308,10 +308,8 @@ static int iwl_trans_txq_alloc(struct iwl_trans *trans,
 
 	txq->q.n_window = slots_num;
 
-	txq->meta = kzalloc(sizeof(txq->meta[0]) * slots_num,
-			    GFP_KERNEL);
-	txq->cmd = kzalloc(sizeof(txq->cmd[0]) * slots_num,
-			   GFP_KERNEL);
+	txq->meta = kcalloc(slots_num, sizeof(txq->meta[0]), GFP_KERNEL);
+	txq->cmd = kcalloc(slots_num, sizeof(txq->cmd[0]), GFP_KERNEL);
 
 	if (!txq->meta || !txq->cmd)
 		goto error;
author
#12 lore raw

Re: [PATCH] iwlagn: Convert kzalloc to kcalloc

Quoted 3 lines · Joe Perches

Convert kzalloc to kcalloc, coalesce multiple lines too.

Quoted 1 line

---

IIRC, there is no real different between kcalloc and kzalloc, I think kcalloc will call kzalloc; both zero out the memory before return.

Wey

#13 lore raw

Re: [PATCH] iwlagn: Convert kzalloc to kcalloc

Quoted 4 lines · wwguy
Quoted 1 line · Joe Perches

Convert kzalloc to kcalloc, coalesce multiple lines too.

IIRC, there is no real different between kcalloc and kzalloc, I think kcalloc will call kzalloc; both zero out the memory before return.

Multiplication overflow protection.

#14 lore raw

Re: [PATCH] iwlagn: Convert kzalloc to kcalloc

Quoted 7 lines · Joe Perches
Quoted 4 lines · wwguy
Quoted 1 line · Joe Perches

Convert kzalloc to kcalloc, coalesce multiple lines too.

IIRC, there is no real different between kcalloc and kzalloc, I think kcalloc will call kzalloc; both zero out the memory before return.

Multiplication overflow protection.

Then the patch should explain that, no?

Luis

#15 lore raw

Re: [PATCH] iwlagn: Convert kzalloc to kcalloc

Quoted 8 lines · Luis R. Rodriguez
Quoted 6 lines · Joe Perches
Quoted 4 lines · wwguy
Quoted 1 line · Joe Perches

Convert kzalloc to kcalloc, coalesce multiple lines too.

IIRC, there is no real different between kcalloc and kzalloc, I think kcalloc will call kzalloc; both zero out the memory before return.

Multiplication overflow protection.

Then the patch should explain that, no?

Egads. I think not. It's trivially obvious.

#16 lore raw

Re: [PATCH] iwlagn: Convert kzalloc to kcalloc

Quoted 11 lines · Joe Perches
Quoted 8 lines · Luis R. Rodriguez
Quoted 6 lines · Joe Perches
Quoted 4 lines · wwguy
Quoted 1 line · Joe Perches

Convert kzalloc to kcalloc, coalesce multiple lines too.

IIRC, there is no real different between kcalloc and kzalloc, I think kcalloc will call kzalloc; both zero out the memory before return.

Multiplication overflow protection.

Then the patch should explain that, no?

Egads.  I think not.  It's trivially obvious.

So obvious the maintainer had to ask.

Luis

author
#17 lore raw

PATCH 9/27 iwlagn: New SKU for 6005 SFF

In reply to Wey-Yi Guy

Adding another SKU for 6005 series devices.

---
 drivers/net/wireless/iwlwifi/iwl-pci.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/iwlwifi/iwl-pci.c +1 -0
index 78a3f8d..1be0bc4 100644
@@ -260,6 +260,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = {
 	{IWL_PCI_DEVICE(0x0085, 0x1311, iwl6005_2agn_cfg)},
 	{IWL_PCI_DEVICE(0x0085, 0x1316, iwl6005_2abg_cfg)},
 	{IWL_PCI_DEVICE(0x0082, 0xC020, iwl6005_2agn_sff_cfg)},
+	{IWL_PCI_DEVICE(0x0085, 0xC220, iwl6005_2agn_sff_cfg)},
 
 /* 6x30 Series */
 	{IWL_PCI_DEVICE(0x008A, 0x5305, iwl1030_bgn_cfg)},
Signature · 1 line
1.7.0.4
author
#18 lore raw

PATCH 10/27 iwlagn: fix modinfo display for 135 ucode.

In reply to Wey-Yi Guy

From: Fry, Donald H <[email protected]>

The modinfo report for 135 ucode is iwlwifi-135-IWL135_UCODE_API_MAX.ucode Change to show the value of the define: iwlwifi-135-6.ucode

---
 drivers/net/wireless/iwlwifi/iwl-2000.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/iwlwifi/iwl-2000.c +1 -1
index 913f2a2..0579398 100644
@@ -75,7 +75,7 @@
 #define IWL105_MODULE_FIRMWARE(api) IWL105_FW_PRE __stringify(api) ".ucode"
 
 #define IWL135_FW_PRE "iwlwifi-135-"
-#define IWL135_MODULE_FIRMWARE(api) IWL135_FW_PRE #api ".ucode"
+#define IWL135_MODULE_FIRMWARE(api) IWL135_FW_PRE __stringify(api) ".ucode"
 
 static void iwl2000_set_ct_threshold(struct iwl_priv *priv)
 {
Signature · 1 line
1.7.0.4
author
#19 lore raw

PATCH 11/27 iwlagn: simplify chain_noise_num_beacons indirection

In reply to Wey-Yi Guy

From: Fry, Donald H <[email protected]>

chain_noise_num_beacons is set and never changes. Use the #define rather than 3 levels of indirection.

---
 drivers/net/wireless/iwlwifi/iwl-1000.c      |    1 -
 drivers/net/wireless/iwlwifi/iwl-2000.c      |    2 --
 drivers/net/wireless/iwlwifi/iwl-5000.c      |    1 -
 drivers/net/wireless/iwlwifi/iwl-6000.c      |    3 ---
 drivers/net/wireless/iwlwifi/iwl-agn-calib.c |   21 +++++++--------------
 drivers/net/wireless/iwlwifi/iwl-core.h      |    1 -
 6 files changed, 7 insertions(+), 22 deletions(-)
drivers/net/wireless/iwlwifi/iwl-1000.c +0 -1
index 4766c3a..5eba5d9 100644
@@ -191,7 +191,6 @@ static struct iwl_base_params iwl1000_base_params = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_1000,
 	.shadow_ram_support = false,
 	.led_compensation = 51,
-	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
drivers/net/wireless/iwlwifi/iwl-2000.c +0 -2
index 0579398..ba138a5 100644
@@ -211,7 +211,6 @@ static struct iwl_base_params iwl2000_base_params = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_2x00,
 	.shadow_ram_support = true,
 	.led_compensation = 51,
-	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.adv_thermal_throttle = true,
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
@@ -231,7 +230,6 @@ static struct iwl_base_params iwl2030_base_params = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_2x00,
 	.shadow_ram_support = true,
 	.led_compensation = 57,
-	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.adv_thermal_throttle = true,
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
drivers/net/wireless/iwlwifi/iwl-5000.c +0 -1
index 7cb4d69..327ebf6 100644
@@ -353,7 +353,6 @@ static struct iwl_base_params iwl5000_base_params = {
 	.num_of_ampdu_queues = IWLAGN_NUM_AMPDU_QUEUES,
 	.pll_cfg_val = CSR50_ANA_PLL_CFG_VAL,
 	.led_compensation = 51,
-	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF,
 	.chain_noise_scale = 1000,
 	.wd_timeout = IWL_LONG_WD_TIMEOUT,
drivers/net/wireless/iwlwifi/iwl-6000.c +0 -3
index 2a98e65..d443785 100644
@@ -305,7 +305,6 @@ static struct iwl_base_params iwl6000_base_params = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
 	.shadow_ram_support = true,
 	.led_compensation = 51,
-	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.adv_thermal_throttle = true,
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
@@ -323,7 +322,6 @@ static struct iwl_base_params iwl6050_base_params = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_6x50,
 	.shadow_ram_support = true,
 	.led_compensation = 51,
-	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.adv_thermal_throttle = true,
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
@@ -340,7 +338,6 @@ static struct iwl_base_params iwl6000_g2_base_params = {
 	.max_ll_items = OTP_MAX_LL_ITEMS_6x00,
 	.shadow_ram_support = true,
 	.led_compensation = 57,
-	.chain_noise_num_beacons = IWL_CAL_NUM_BEACONS,
 	.adv_thermal_throttle = true,
 	.support_ct_kill_exit = true,
 	.plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF,
drivers/net/wireless/iwlwifi/iwl-agn-calib.c +7 -14
index b725f69..03bac48 100644
@@ -766,12 +766,9 @@ static void iwl_find_disconn_antenna(struct iwl_priv *priv, u32* average_sig,
 	u8 first_chain;
 	u16 i = 0;
 
-	average_sig[0] = data->chain_signal_a /
-			 priv->cfg->base_params->chain_noise_num_beacons;
-	average_sig[1] = data->chain_signal_b /
-			 priv->cfg->base_params->chain_noise_num_beacons;
-	average_sig[2] = data->chain_signal_c /
-			 priv->cfg->base_params->chain_noise_num_beacons;
+	average_sig[0] = data->chain_signal_a / IWL_CAL_NUM_BEACONS;
+	average_sig[1] = data->chain_signal_b / IWL_CAL_NUM_BEACONS;
+	average_sig[2] = data->chain_signal_c / IWL_CAL_NUM_BEACONS;
 
 	if (average_sig[0] >= average_sig[1]) {
 		max_average_sig = average_sig[0];
@@ -1038,8 +1035,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
 	/* If this is the "chain_noise_num_beacons", determine:
 	 * 1)  Disconnected antennas (using signal strengths)
 	 * 2)  Differential gain (using silence noise) to balance receivers */
-	if (data->beacon_count !=
-		priv->cfg->base_params->chain_noise_num_beacons)
+	if (data->beacon_count != IWL_CAL_NUM_BEACONS)
 		return;
 
 	/* Analyze signal for disconnected antenna */
@@ -1055,12 +1051,9 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv)
 		iwl_find_disconn_antenna(priv, average_sig, data);
 
 	/* Analyze noise for rx balance */
-	average_noise[0] = data->chain_noise_a /
-			   priv->cfg->base_params->chain_noise_num_beacons;
-	average_noise[1] = data->chain_noise_b /
-			   priv->cfg->base_params->chain_noise_num_beacons;
-	average_noise[2] = data->chain_noise_c /
-			   priv->cfg->base_params->chain_noise_num_beacons;
+	average_noise[0] = data->chain_noise_a / IWL_CAL_NUM_BEACONS;
+	average_noise[1] = data->chain_noise_b / IWL_CAL_NUM_BEACONS;
+	average_noise[2] = data->chain_noise_c / IWL_CAL_NUM_BEACONS;
 
 	for (i = 0; i < NUM_RX_CHAINS; i++) {
 		if (!(data->disconn_array[i]) &&
drivers/net/wireless/iwlwifi/iwl-core.h +0 -1
index 56b554c..549dc46 100644
@@ -124,7 +124,6 @@ struct iwl_base_params {
 	const u16 max_ll_items;
 	const bool shadow_ram_support;
 	u16 led_compensation;
-	int chain_noise_num_beacons;
 	bool adv_thermal_throttle;
 	bool support_ct_kill_exit;
 	const bool support_wimax_coexist;
Signature · 1 line
1.7.0.4
author
#20 lore raw

PATCH 12/27 iwlagn: replace beacon_time_fsf_bits variable with #define

In reply to Wey-Yi Guy

From: Don Fry <[email protected]>

All devices use the same value for beacon_time_tsf_bits. Use the #define

---
 drivers/net/wireless/iwlwifi/iwl-1000.c   |    2 --
 drivers/net/wireless/iwlwifi/iwl-2000.c   |    2 --
 drivers/net/wireless/iwlwifi/iwl-5000.c   |    4 ----
 drivers/net/wireless/iwlwifi/iwl-6000.c   |    2 --
 drivers/net/wireless/iwlwifi/iwl-core.c   |   21 ++++++++++-----------
 drivers/net/wireless/iwlwifi/iwl-shared.h |    2 --
 6 files changed, 10 insertions(+), 23 deletions(-)
drivers/net/wireless/iwlwifi/iwl-1000.c +0 -2
index 5eba5d9..dacbe3a 100644
@@ -161,8 +161,6 @@ static int iwl1000_hw_set_hw_params(struct iwl_priv *priv)
 	if (priv->cfg->need_dc_calib)
 		hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_DC);
 
-	hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
-
 	return 0;
 }
 
drivers/net/wireless/iwlwifi/iwl-2000.c +0 -2
index ba138a5..82719b7 100644
@@ -159,8 +159,6 @@ static int iwl2000_hw_set_hw_params(struct iwl_priv *priv)
 	if (priv->cfg->need_temp_offset_calib)
 		hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
 
-	hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
-
 	return 0;
 }
 
drivers/net/wireless/iwlwifi/iwl-5000.c +0 -4
index 327ebf6..de7f7f2 100644
@@ -184,8 +184,6 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
 		BIT(IWL_CALIB_TX_IQ_PERD)	|
 		BIT(IWL_CALIB_BASE_BAND);
 
-	hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
-
 	return 0;
 }
 
@@ -223,8 +221,6 @@ static int iwl5150_hw_set_hw_params(struct iwl_priv *priv)
 	if (priv->cfg->need_dc_calib)
 		hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_DC);
 
-	hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
-
 	return 0;
 }
 
drivers/net/wireless/iwlwifi/iwl-6000.c +0 -2
index d443785..5c1a8b8 100644
@@ -180,8 +180,6 @@ static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
 	if (priv->cfg->need_temp_offset_calib)
 		hw_params(priv).calib_init_cfg |= BIT(IWL_CALIB_TEMP_OFFSET);
 
-	hw_params(priv).beacon_time_tsf_bits = IWLAGN_EXT_BEACON_TIME_POS;
-
 	return 0;
 }
 
drivers/net/wireless/iwlwifi/iwl-core.c +10 -11
index 90ab27e..0a426cb 100644
@@ -1803,13 +1803,12 @@ u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval)
 		return 0;
 
 	quot = (usec / interval) &
-		(iwl_beacon_time_mask_high(priv,
-		hw_params(priv).beacon_time_tsf_bits) >>
-		hw_params(priv).beacon_time_tsf_bits);
+		(iwl_beacon_time_mask_high(priv, IWLAGN_EXT_BEACON_TIME_POS) >>
+		IWLAGN_EXT_BEACON_TIME_POS);
 	rem = (usec % interval) & iwl_beacon_time_mask_low(priv,
-				   hw_params(priv).beacon_time_tsf_bits);
+				   IWLAGN_EXT_BEACON_TIME_POS);
 
-	return (quot << hw_params(priv).beacon_time_tsf_bits) + rem;
+	return (quot << IWLAGN_EXT_BEACON_TIME_POS) + rem;
 }
 
 /* base is usually what we get from ucode with each received frame,
@@ -1819,22 +1818,22 @@ __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
 			   u32 addon, u32 beacon_interval)
 {
 	u32 base_low = base & iwl_beacon_time_mask_low(priv,
-				hw_params(priv).beacon_time_tsf_bits);
+				IWLAGN_EXT_BEACON_TIME_POS);
 	u32 addon_low = addon & iwl_beacon_time_mask_low(priv,
-				hw_params(priv).beacon_time_tsf_bits);
+				IWLAGN_EXT_BEACON_TIME_POS);
 	u32 interval = beacon_interval * TIME_UNIT;
 	u32 res = (base & iwl_beacon_time_mask_high(priv,
-				hw_params(priv).beacon_time_tsf_bits)) +
+				IWLAGN_EXT_BEACON_TIME_POS)) +
 				(addon & iwl_beacon_time_mask_high(priv,
-				hw_params(priv).beacon_time_tsf_bits));
+				IWLAGN_EXT_BEACON_TIME_POS));
 
 	if (base_low > addon_low)
 		res += base_low - addon_low;
 	else if (base_low < addon_low) {
 		res += interval + base_low - addon_low;
-		res += (1 << hw_params(priv).beacon_time_tsf_bits);
+		res += (1 << IWLAGN_EXT_BEACON_TIME_POS);
 	} else
-		res += (1 << hw_params(priv).beacon_time_tsf_bits);
+		res += (1 << IWLAGN_EXT_BEACON_TIME_POS);
 
 	return cpu_to_le32(res);
 }
drivers/net/wireless/iwlwifi/iwl-shared.h +0 -2
index 810b3e1..8272a94 100644
@@ -167,7 +167,6 @@ struct iwl_mod_params {
  * @valid_rx_ant: usable antennas for RX
  * @max_stations: the maximal number of stations
  * @ht40_channel: is 40MHz width possible: BIT(IEEE80211_BAND_XXX)
- * @beacon_time_tsf_bits: number of valid tsf bits for beacon time
  * @sku: sku read from EEPROM
  * @rx_page_order: Rx buffer page order
  * @max_inst_size: for ucode use
@@ -190,7 +189,6 @@ struct iwl_hw_params {
 	u8  max_stations;
 	u8  ht40_channel;
 	bool shadow_reg_enable;
-	u16 beacon_time_tsf_bits;
 	u16 sku;
 	u32 rx_page_order;
 	u32 max_inst_size;
Signature · 1 line
1.7.0.4
author
#21 lore raw

PATCH 13/27 iwlagn: provide data after WARN_ON

In reply to Wey-Yi Guy

From: Emmanuel Grumbach <[email protected]>

Quoted 1 line

From time to time, we hit a WARN_ON in iwl_mac_remove_interface.

This basically means that we got out of sync with mac80211: the vif we hold differs from the vif 80211 passes as parameter. Try to get some data that will help to debug this.

---
 drivers/net/wireless/iwlwifi/iwl-core.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/net/wireless/iwlwifi/iwl-core.c +7 -1
index 0a426cb..ce8a015 100644
@@ -1328,7 +1328,13 @@ void iwl_mac_remove_interface(struct ieee80211_hw *hw,
 
 	mutex_lock(&priv->shrd->mutex);
 
-	WARN_ON(ctx->vif != vif);
+	if (WARN_ON(ctx->vif != vif)) {
+		struct iwl_rxon_context *tmp;
+		IWL_ERR(priv, "ctx->vif = %p, vif = %p\n", ctx->vif, vif);
+		for_each_context(priv, tmp)
+			IWL_ERR(priv, "\tID = %d:\tctx = %p\tctx->vif = %p\n",
+				tmp->ctxid, tmp, tmp->vif);
+	}
 	ctx->vif = NULL;
 
 	iwl_teardown_interface(priv, vif, false);
Signature · 1 line
1.7.0.4
author
#22 lore raw

PATCH 14/27 iwlagn: merge eeprom access into single file

In reply to Wey-Yi Guy

After driver split and no need to support legacy devices, there is no reason we need to separate the NVM access into different files, merge those.

---
 drivers/net/wireless/iwlwifi/Makefile         |    2 +-
 drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c |  299 -------------------------
 drivers/net/wireless/iwlwifi/iwl-eeprom.c     |  239 +++++++++++++++++++-
 3 files changed, 235 insertions(+), 305 deletions(-)
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
drivers/net/wireless/iwlwifi/Makefile +1 -1
index 48ab914..ae1d816 100644
@@ -3,7 +3,7 @@ obj-$(CONFIG_IWLAGN)	+= iwlagn.o
 iwlagn-objs		:= iwl-agn.o iwl-agn-rs.o
 iwlagn-objs		+= iwl-agn-ucode.o iwl-agn-tx.o
 iwlagn-objs		+= iwl-agn-lib.o iwl-agn-calib.o iwl-io.o
-iwlagn-objs		+= iwl-agn-tt.o iwl-agn-sta.o iwl-agn-eeprom.o
+iwlagn-objs		+= iwl-agn-tt.o iwl-agn-sta.o
 
 iwlagn-objs 		+= iwl-core.o iwl-eeprom.o iwl-power.o
 iwlagn-objs 		+= iwl-rx.o iwl-sta.o
drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c deleted +0 -299

299 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-eeprom.c +234 -5

264 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author
#23 lore raw

PATCH 15/27 iwlagn: move PCI-E transport files

In reply to Wey-Yi Guy

From: Johannes Berg <[email protected]>

Move all the PCI-E specific transport files to
be iwl-trans-pcie*; specifically iwl-trans.c
which is really iwl-trans-pcie.c.

---
 drivers/net/wireless/iwlwifi/Makefile             |    2 +-
 drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h |  448 -----
 drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h |  448 +++++
 drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c  | 1424 +++++++++++++++
 drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c  | 1166 ++++++++++++
 drivers/net/wireless/iwlwifi/iwl-trans-pcie.c     | 1996 ++++++++++++++++++++
 drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c  | 1424 ---------------
 drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c  | 1165 ------------
 drivers/net/wireless/iwlwifi/iwl-trans.c          | 1998 ---------------------
 9 files changed, 5035 insertions(+), 5036 deletions(-)
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-pcie.c
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-trans.c
drivers/net/wireless/iwlwifi/Makefile +1 -1
index ae1d816..6104f19 100644
@@ -14,7 +14,7 @@ iwlagn-objs             += iwl-6000.o
 iwlagn-objs             += iwl-1000.o
 iwlagn-objs             += iwl-2000.o
 iwlagn-objs             += iwl-pci.o
-iwlagn-objs             += iwl-trans.o iwl-trans-rx-pcie.o iwl-trans-tx-pcie.o
+iwlagn-objs             += iwl-trans-pcie.o iwl-trans-pcie-rx.o iwl-trans-pcie-tx.o
 
 iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
 iwlagn-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o
drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h deleted +0 -448

448 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h new file +448 -0

448 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c new file +1424 -0

1,424 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c new file +1166 -0

672 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-trans-pcie.c new file +1996 -0

1,996 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c deleted +0 -1424

1,424 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c deleted +0 -1165

1,165 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-trans.c deleted +0 -1998

1,998 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.0.4

Part of the diff is not shown here. View the raw message.

author
#24 lore raw

PATCH 16/27 iwlagn: generically provide iwl_trans_send_cmd_pdu

In reply to Wey-Yi Guy

From: Johannes Berg <[email protected]>

There's no need to have the transport layer have a callback for iwl_trans_send_cmd_pdu() since it is just a generic wrapper around iwl_trans_send_cmd().

---
 drivers/net/wireless/iwlwifi/Makefile            |    1 +
 drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c |   13 ----
 drivers/net/wireless/iwlwifi/iwl-trans-pcie.c    |    1 -
 drivers/net/wireless/iwlwifi/iwl-trans.c         |   77 ++++++++++++++++++++++
 drivers/net/wireless/iwlwifi/iwl-trans.h         |   10 +--
 5 files changed, 80 insertions(+), 22 deletions(-)
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-trans.c
drivers/net/wireless/iwlwifi/Makefile +1 -0
index 6104f19..a7e954b 100644
@@ -14,6 +14,7 @@ iwlagn-objs             += iwl-6000.o
 iwlagn-objs             += iwl-1000.o
 iwlagn-objs             += iwl-2000.o
 iwlagn-objs             += iwl-pci.o
+iwlagn-objs		+= iwl-trans.o
 iwlagn-objs             += iwl-trans-pcie.o iwl-trans-pcie-rx.o iwl-trans-pcie-tx.o
 
 iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c +0 -13
index 305c072..c0def8e 100644
@@ -1099,19 +1099,6 @@ int iwl_trans_pcie_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
 	return iwl_send_cmd_sync(trans, cmd);
 }
 
-int iwl_trans_pcie_send_cmd_pdu(struct iwl_trans *trans, u8 id, u32 flags,
-		u16 len, const void *data)
-{
-	struct iwl_host_cmd cmd = {
-		.id = id,
-		.len = { len, },
-		.data = { data, },
-		.flags = flags,
-	};
-
-	return iwl_trans_pcie_send_cmd(trans, &cmd);
-}
-
 /* Frees buffers until index _not_ inclusive */
 int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
 			 struct sk_buff_head *skbs)
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +0 -1
index 1c931b7..9a414b2 100644
@@ -1971,7 +1971,6 @@ const struct iwl_trans_ops trans_ops_pcie = {
 	.wake_any_queue = iwl_trans_pcie_wake_any_queue,
 
 	.send_cmd = iwl_trans_pcie_send_cmd,
-	.send_cmd_pdu = iwl_trans_pcie_send_cmd_pdu,
 
 	.tx = iwl_trans_pcie_tx,
 	.reclaim = iwl_trans_pcie_reclaim,
drivers/net/wireless/iwlwifi/iwl-trans.c new file +77 -0

77 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-trans.h +2 -8
index f067408..8fba516 100644
@@ -151,7 +151,6 @@ struct iwl_host_cmd {
  * @wake_any_queue: wake all the queues of a specfic context IWL_RXON_CTX_*
  * @stop_device:stops the whole device (embedded CPU put to reset)
  * @send_cmd:send a host command
- * @send_cmd_pdu:send a host command: flags can be CMD_*
  * @tx: send an skb
  * @reclaim: free packet until ssn. Returns a list of freed packets.
  * @tx_agg_alloc: allocate resources for a TX BA session
@@ -183,8 +182,6 @@ struct iwl_trans_ops {
 
 	int (*send_cmd)(struct iwl_trans *trans, struct iwl_host_cmd *cmd);
 
-	int (*send_cmd_pdu)(struct iwl_trans *trans, u8 id, u32 flags, u16 len,
-		     const void *data);
 	int (*tx)(struct iwl_trans *trans, struct sk_buff *skb,
 		struct iwl_device_cmd *dev_cmd, enum iwl_rxon_context_id ctx,
 		u8 sta_id);
@@ -270,11 +267,8 @@ static inline int iwl_trans_send_cmd(struct iwl_trans *trans,
 	return trans->ops->send_cmd(trans, cmd);
 }
 
-static inline int iwl_trans_send_cmd_pdu(struct iwl_trans *trans, u8 id,
-					u32 flags, u16 len, const void *data)
-{
-	return trans->ops->send_cmd_pdu(trans, id, flags, len, data);
-}
+int iwl_trans_send_cmd_pdu(struct iwl_trans *trans, u8 id,
+			   u32 flags, u16 len, const void *data);
 
 static inline int iwl_trans_tx(struct iwl_trans *trans, struct sk_buff *skb,
 		struct iwl_device_cmd *dev_cmd, enum iwl_rxon_context_id ctx,
Signature · 1 line
1.7.0.4
author
#25 lore raw

PATCH 17/27 iwlagn: Makefile whitespace cleanup

In reply to Wey-Yi Guy

From: Johannes Berg <[email protected]>

---
 drivers/net/wireless/iwlwifi/Makefile |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
drivers/net/wireless/iwlwifi/Makefile +10 -10
index a7e954b..8fa59cd 100644
@@ -5,17 +5,17 @@ iwlagn-objs		+= iwl-agn-ucode.o iwl-agn-tx.o
 iwlagn-objs		+= iwl-agn-lib.o iwl-agn-calib.o iwl-io.o
 iwlagn-objs		+= iwl-agn-tt.o iwl-agn-sta.o
 
-iwlagn-objs 		+= iwl-core.o iwl-eeprom.o iwl-power.o
-iwlagn-objs 		+= iwl-rx.o iwl-sta.o
-iwlagn-objs 		+= iwl-scan.o iwl-led.o
-iwlagn-objs             += iwl-agn-rxon.o
-iwlagn-objs             += iwl-5000.o
-iwlagn-objs             += iwl-6000.o
-iwlagn-objs             += iwl-1000.o
-iwlagn-objs             += iwl-2000.o
-iwlagn-objs             += iwl-pci.o
+iwlagn-objs		+= iwl-core.o iwl-eeprom.o iwl-power.o
+iwlagn-objs		+= iwl-rx.o iwl-sta.o
+iwlagn-objs		+= iwl-scan.o iwl-led.o
+iwlagn-objs		+= iwl-agn-rxon.o
+iwlagn-objs		+= iwl-5000.o
+iwlagn-objs		+= iwl-6000.o
+iwlagn-objs		+= iwl-1000.o
+iwlagn-objs		+= iwl-2000.o
+iwlagn-objs		+= iwl-pci.o
 iwlagn-objs		+= iwl-trans.o
-iwlagn-objs             += iwl-trans-pcie.o iwl-trans-pcie-rx.o iwl-trans-pcie-tx.o
+iwlagn-objs		+= iwl-trans-pcie.o iwl-trans-pcie-rx.o iwl-trans-pcie-tx.o
 
 iwlagn-$(CONFIG_IWLWIFI_DEBUGFS) += iwl-debugfs.o
 iwlagn-$(CONFIG_IWLWIFI_DEVICE_TRACING) += iwl-devtrace.o
Signature · 1 line
1.7.0.4
author
#26 lore raw

PATCH 18/27 iwlagn: clean up PM code

In reply to Wey-Yi Guy

From: Johannes Berg <[email protected]>

The transport callbacks might as well be undefined when CONFIG_PM_SLEEP is not set, so ifdef all of it out and make everything available for PM_SLEEP only.

---
 drivers/net/wireless/iwlwifi/iwl-agn.c        |    6 +++---
 drivers/net/wireless/iwlwifi/iwl-trans-pcie.c |   15 ++++-----------
 drivers/net/wireless/iwlwifi/iwl-trans.h      |    5 ++++-
 3 files changed, 11 insertions(+), 15 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +3 -3
index 61f8ea6..5c85133 100644
@@ -1919,7 +1919,7 @@ static void iwlagn_mac_stop(struct ieee80211_hw *hw)
 	IWL_DEBUG_MAC80211(priv, "leave\n");
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int iwlagn_send_patterns(struct iwl_priv *priv,
 				struct cfg80211_wowlan *wowlan)
 {
@@ -1994,7 +1994,7 @@ struct wowlan_key_data {
 	bool error, use_rsc_tsc, use_tkip;
 };
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static void iwlagn_convert_p1k(u16 *p1k, __le16 *out)
 {
 	int i;
@@ -3203,7 +3203,7 @@ struct ieee80211_ops iwlagn_hw_ops = {
 	.tx = iwlagn_mac_tx,
 	.start = iwlagn_mac_start,
 	.stop = iwlagn_mac_stop,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.suspend = iwlagn_mac_suspend,
 	.resume = iwlagn_mac_resume,
 #endif
drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +4 -11
index 9a414b2..ca13eeb 100644
@@ -1363,8 +1363,7 @@ static void iwl_trans_pcie_free(struct iwl_trans *trans)
 	kfree(trans);
 }
 
-#ifdef CONFIG_PM
-
+#ifdef CONFIG_PM_SLEEP
 static int iwl_trans_pcie_suspend(struct iwl_trans *trans)
 {
 	/*
@@ -1402,14 +1401,7 @@ static int iwl_trans_pcie_resume(struct iwl_trans *trans)
 
 	return 0;
 }
-#else /* CONFIG_PM */
-static int iwl_trans_pcie_suspend(struct iwl_trans *trans)
-{ return 0; }
-
-static int iwl_trans_pcie_resume(struct iwl_trans *trans)
-{ return 0; }
-
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM_SLEEP */
 
 static void iwl_trans_pcie_wake_any_queue(struct iwl_trans *trans,
 					  enum iwl_rxon_context_id ctx)
@@ -1989,7 +1981,8 @@ const struct iwl_trans_ops trans_ops_pcie = {
 	.wait_tx_queue_empty = iwl_trans_pcie_wait_tx_queue_empty,
 	.check_stuck_queue = iwl_trans_pcie_check_stuck_queue,
 
+#ifdef CONFIG_PM_SLEEP
 	.suspend = iwl_trans_pcie_suspend,
 	.resume = iwl_trans_pcie_resume,
+#endif
 };
-
drivers/net/wireless/iwlwifi/iwl-trans.h +4 -1
index 8fba516..5b6e684 100644
@@ -208,9 +208,10 @@ struct iwl_trans_ops {
 	int (*dbgfs_register)(struct iwl_trans *trans, struct dentry* dir);
 	int (*check_stuck_queue)(struct iwl_trans *trans, int q);
 	int (*wait_tx_queue_empty)(struct iwl_trans *trans);
-
+#ifdef CONFIG_PM_SLEEP
 	int (*suspend)(struct iwl_trans *trans);
 	int (*resume)(struct iwl_trans *trans);
+#endif
 };
 
 /**
@@ -337,6 +338,7 @@ static inline int iwl_trans_dbgfs_register(struct iwl_trans *trans,
 	return trans->ops->dbgfs_register(trans, dir);
 }
 
+#ifdef CONFIG_PM_SLEEP
 static inline int iwl_trans_suspend(struct iwl_trans *trans)
 {
 	return trans->ops->suspend(trans);
@@ -346,6 +348,7 @@ static inline int iwl_trans_resume(struct iwl_trans *trans)
 {
 	return trans->ops->resume(trans);
 }
+#endif
 
 /*****************************************************
 * Transport layers implementations
Signature · 1 line
1.7.0.4
author
#27 lore raw

PATCH 19/27 iwlagn: rename iwl-pci.h to iwl-cfg.h

In reply to Wey-Yi Guy

From: Johannes Berg <[email protected]>

There's nothing PCI(E) specific in this file.

---
 drivers/net/wireless/iwlwifi/iwl-1000.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-2000.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-5000.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-6000.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-cfg.h  |  115 ++++++++++++++++++++++++++++++
 drivers/net/wireless/iwlwifi/iwl-pci.c  |    2 +-
 drivers/net/wireless/iwlwifi/iwl-pci.h  |  116 -------------------------------
 7 files changed, 120 insertions(+), 121 deletions(-)
 create mode 100644 drivers/net/wireless/iwlwifi/iwl-cfg.h
 delete mode 100644 drivers/net/wireless/iwlwifi/iwl-pci.h
drivers/net/wireless/iwlwifi/iwl-1000.c +1 -1
index dacbe3a..887f9ac 100644
@@ -44,7 +44,7 @@
 #include "iwl-helpers.h"
 #include "iwl-agn-hw.h"
 #include "iwl-shared.h"
-#include "iwl-pci.h"
+#include "iwl-cfg.h"
 
 /* Highest firmware API version supported */
 #define IWL1000_UCODE_API_MAX 6
drivers/net/wireless/iwlwifi/iwl-2000.c +1 -1
index 82719b7..5a87010 100644
@@ -45,7 +45,7 @@
 #include "iwl-agn-hw.h"
 #include "iwl-6000-hw.h"
 #include "iwl-shared.h"
-#include "iwl-pci.h"
+#include "iwl-cfg.h"
 
 /* Highest firmware API version supported */
 #define IWL2030_UCODE_API_MAX 6
drivers/net/wireless/iwlwifi/iwl-5000.c +1 -1
index de7f7f2..2907016 100644
@@ -47,7 +47,7 @@
 #include "iwl-5000-hw.h"
 #include "iwl-trans.h"
 #include "iwl-shared.h"
-#include "iwl-pci.h"
+#include "iwl-cfg.h"
 
 /* Highest firmware API version supported */
 #define IWL5000_UCODE_API_MAX 5
drivers/net/wireless/iwlwifi/iwl-6000.c +1 -1
index 5c1a8b8..37837f7 100644
@@ -46,7 +46,7 @@
 #include "iwl-6000-hw.h"
 #include "iwl-trans.h"
 #include "iwl-shared.h"
-#include "iwl-pci.h"
+#include "iwl-cfg.h"
 
 /* Highest firmware API version supported */
 #define IWL6000_UCODE_API_MAX 4
drivers/net/wireless/iwlwifi/iwl-cfg.h new file +115 -0

115 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-pci.c +1 -1
index 1be0bc4..849b5ef 100644
@@ -68,7 +68,7 @@
 #include "iwl-shared.h"
 #include "iwl-trans.h"
 #include "iwl-csr.h"
-#include "iwl-pci.h"
+#include "iwl-cfg.h"
 
 /* PCI registers */
 #define PCI_CFG_RETRY_TIMEOUT	0x041
drivers/net/wireless/iwlwifi/iwl-pci.h deleted +0 -116

116 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author
#28 lore raw

PATCH 20/27 iwlagn: remove unused function declarations

In reply to Wey-Yi Guy

From: Johannes Berg <[email protected]>

iwl_suspend and iwl_resume don't exist.

---
 drivers/net/wireless/iwlwifi/iwl-shared.h |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlwifi/iwl-shared.h +0 -5
index 8272a94..40186a6 100644
@@ -420,11 +420,6 @@ enum iwl_rxon_context_id {
 	NUM_IWL_RXON_CTX
 };
 
-#ifdef CONFIG_PM
-int iwl_suspend(struct iwl_priv *priv);
-int iwl_resume(struct iwl_priv *priv);
-#endif /* !CONFIG_PM */
-
 int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
 		struct iwl_cfg *cfg);
 void __devexit iwl_remove(struct iwl_priv * priv);
Signature · 1 line
1.7.0.4
author
#29 lore raw

PATCH 21/27 iwlagn: move sysfs files to debugfs

In reply to Wey-Yi Guy

From: Johannes Berg <[email protected]>

The debug_level and temperature files should be in debugfs, the txpower file is completely unneeded since TX power can be set with iw/iwconfig.

---
 drivers/net/wireless/iwlwifi/iwl-agn.c     |  125 ----------------------------
 drivers/net/wireless/iwlwifi/iwl-debugfs.c |   72 ++++++++++++++--
 2 files changed, 64 insertions(+), 133 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +0 -125
index 5c85133..84ba428 100644
@@ -453,122 +453,6 @@ static void iwl_bg_tx_flush(struct work_struct *work)
 	iwlagn_dev_txfifo_flush(priv, IWL_DROP_ALL);
 }
 
-/*****************************************************************************
- *
- * sysfs attributes
- *
- *****************************************************************************/
-
-#ifdef CONFIG_IWLWIFI_DEBUG
-
-/*
- * The following adds a new attribute to the sysfs representation
- * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/)
- * used for controlling the debug level.
- *
- * See the level definitions in iwl for details.
- *
- * The debug_level being managed using sysfs below is a per device debug
- * level that is used instead of the global debug level if it (the per
- * device debug level) is set.
- */
-static ssize_t show_debug_level(struct device *d,
-				struct device_attribute *attr, char *buf)
-{
-	struct iwl_shared *shrd = dev_get_drvdata(d);
-	return sprintf(buf, "0x%08X\n", iwl_get_debug_level(shrd));
-}
-static ssize_t store_debug_level(struct device *d,
-				struct device_attribute *attr,
-				 const char *buf, size_t count)
-{
-	struct iwl_shared *shrd = dev_get_drvdata(d);
-	struct iwl_priv *priv = shrd->priv;
-	unsigned long val;
-	int ret;
-
-	ret = strict_strtoul(buf, 0, &val);
-	if (ret)
-		IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf);
-	else {
-		shrd->dbg_level_dev = val;
-		if (iwl_alloc_traffic_mem(priv))
-			IWL_ERR(shrd->priv,
-				"Not enough memory to generate traffic log\n");
-	}
-	return strnlen(buf, count);
-}
-
-static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
-			show_debug_level, store_debug_level);
-
-
-#endif /* CONFIG_IWLWIFI_DEBUG */
-
-
-static ssize_t show_temperature(struct device *d,
-				struct device_attribute *attr, char *buf)
-{
-	struct iwl_shared *shrd = dev_get_drvdata(d);
-	struct iwl_priv *priv = shrd->priv;
-
-	if (!iwl_is_alive(priv->shrd))
-		return -EAGAIN;
-
-	return sprintf(buf, "%d\n", priv->temperature);
-}
-
-static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);
-
-static ssize_t show_tx_power(struct device *d,
-			     struct device_attribute *attr, char *buf)
-{
-	struct iwl_priv *priv = dev_get_drvdata(d);
-
-	if (!iwl_is_ready_rf(priv->shrd))
-		return sprintf(buf, "off\n");
-	else
-		return sprintf(buf, "%d\n", priv->tx_power_user_lmt);
-}
-
-static ssize_t store_tx_power(struct device *d,
-			      struct device_attribute *attr,
-			      const char *buf, size_t count)
-{
-	struct iwl_priv *priv = dev_get_drvdata(d);
-	unsigned long val;
-	int ret;
-
-	ret = strict_strtoul(buf, 10, &val);
-	if (ret)
-		IWL_INFO(priv, "%s is not in decimal form.\n", buf);
-	else {
-		ret = iwl_set_tx_power(priv, val, false);
-		if (ret)
-			IWL_ERR(priv, "failed setting tx power (0x%d).\n",
-				ret);
-		else
-			ret = count;
-	}
-	return ret;
-}
-
-static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);
-
-static struct attribute *iwl_sysfs_entries[] = {
-	&dev_attr_temperature.attr,
-	&dev_attr_tx_power.attr,
-#ifdef CONFIG_IWLWIFI_DEBUG
-	&dev_attr_debug_level.attr,
-#endif
-	NULL
-};
-
-static struct attribute_group iwl_attribute_group = {
-	.name = NULL,		/* put in device directory */
-	.attrs = iwl_sysfs_entries,
-};
-
 /******************************************************************************
  *
  * uCode download functions
@@ -1259,13 +1143,6 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
 	if (err)
 		IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);
 
-	err = sysfs_create_group(&(priv->bus->dev->kobj),
-					&iwl_attribute_group);
-	if (err) {
-		IWL_ERR(priv, "failed to create sysfs device attributes\n");
-		goto out_unbind;
-	}
-
 	/* We have our copies now, allow OS release its copies */
 	release_firmware(ucode_raw);
 	complete(&priv->firmware_loading_complete);
@@ -3474,8 +3351,6 @@ void __devexit iwl_remove(struct iwl_priv * priv)
 	IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n");
 
 	iwl_dbgfs_unregister(priv);
-	sysfs_remove_group(&priv->bus->dev->kobj,
-			   &iwl_attribute_group);
 
 	/* ieee80211_unregister_hw call wil cause iwl_mac_stop to
 	 * to be called and iwl_down since we are removing the device
drivers/net/wireless/iwlwifi/iwl-debugfs.c +64 -8

117 lines not on this page · raw message

Signature · 1 line
1.7.0.4
author
#30 lore raw

PATCH 22/27 iwlagn: remove drvdata support from bus layer

In reply to Wey-Yi Guy

From: Johannes Berg <[email protected]>

Since the removal of the sysfs files, it is no longer necessary to have upper layers control the drvdata, so let the PCI driver have it for itself completely.

---
 drivers/net/wireless/iwlwifi/iwl-agn.c |    4 +---
 drivers/net/wireless/iwlwifi/iwl-bus.h |   10 ++--------
 drivers/net/wireless/iwlwifi/iwl-pci.c |   19 ++++++++-----------
 3 files changed, 11 insertions(+), 22 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn.c +1 -3
index 84ba428..1d53eb8 100644
@@ -3186,9 +3186,9 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
 	priv = hw->priv;
 	priv->bus = bus;
 	priv->shrd = &priv->_shrd;
+	bus->shrd = priv->shrd;
 	priv->shrd->bus = bus;
 	priv->shrd->priv = priv;
-	bus_set_drv_data(priv->bus, priv->shrd);
 
 	priv->shrd->trans = trans_ops->alloc(priv->shrd);
 	if (priv->shrd->trans == NULL) {
@@ -3387,8 +3387,6 @@ void __devexit iwl_remove(struct iwl_priv * priv)
 
 	iwl_trans_free(trans(priv));
 
-	bus_set_drv_data(priv->bus, NULL);
-
 	iwl_uninit_drv(priv);
 
 	dev_kfree_skb(priv->beacon_skb);
drivers/net/wireless/iwlwifi/iwl-bus.h +2 -8
index 98535df..08b9759 100644
@@ -122,7 +122,6 @@ struct iwl_bus;
  * struct iwl_bus_ops - bus specific operations
  * @get_pm_support: must returns true if the bus can go to sleep
  * @apm_config: will be called during the config of the APM
- * @set_drv_data: set the shared data pointer to the bus layer
  * @get_hw_id: prints the hw_id in the provided buffer
  * @write8: write a byte to register at offset ofs
  * @write32: write a dword to register at offset ofs
@@ -131,7 +130,6 @@ struct iwl_bus;
 struct iwl_bus_ops {
 	bool (*get_pm_support)(struct iwl_bus *bus);
 	void (*apm_config)(struct iwl_bus *bus);
-	void (*set_drv_data)(struct iwl_bus *bus, struct iwl_shared *shrd);
 	void (*get_hw_id)(struct iwl_bus *bus, char buf[], int buf_len);
 	void (*write8)(struct iwl_bus *bus, u32 ofs, u8 val);
 	void (*write32)(struct iwl_bus *bus, u32 ofs, u32 val);
@@ -146,6 +144,8 @@ struct iwl_bus_ops {
  * @dev - pointer to struct device * that represents the device
  * @ops - pointer to iwl_bus_ops
  * @shrd - pointer to iwl_shared which holds shared data from the upper layer
+ *	NB: for the time being this needs to be set by the upper layer since
+ *	it allocates the shared data
  * @irq - the irq number for the device
  * @reg_lock - protect hw register access
  */
@@ -172,12 +172,6 @@ static inline void bus_apm_config(struct iwl_bus *bus)
 	bus->ops->apm_config(bus);
 }
 
-static inline void bus_set_drv_data(struct iwl_bus *bus,
-				struct iwl_shared *shrd)
-{
-	bus->ops->set_drv_data(bus, shrd);
-}
-
 static inline void bus_get_hw_id(struct iwl_bus *bus, char buf[], int buf_len)
 {
 	bus->ops->get_hw_id(bus, buf, buf_len);
drivers/net/wireless/iwlwifi/iwl-pci.c +8 -11
index 849b5ef..23b5f78 100644
@@ -134,12 +134,6 @@ static void iwl_pci_apm_config(struct iwl_bus *bus)
 	}
 }
 
-static void iwl_pci_set_drv_data(struct iwl_bus *bus, struct iwl_shared *shrd)
-{
-	bus->shrd = shrd;
-	pci_set_drvdata(IWL_BUS_GET_PCI_DEV(bus), shrd);
-}
-
 static void iwl_pci_get_hw_id(struct iwl_bus *bus, char buf[],
 			      int buf_len)
 {
@@ -168,7 +162,6 @@ static u32 iwl_pci_read32(struct iwl_bus *bus, u32 ofs)
 static const struct iwl_bus_ops bus_ops_pci = {
 	.get_pm_support = iwl_pci_is_pm_supported,
 	.apm_config = iwl_pci_apm_config,
-	.set_drv_data = iwl_pci_set_drv_data,
 	.get_hw_id = iwl_pci_get_hw_id,
 	.write8 = iwl_pci_write8,
 	.write32 = iwl_pci_write32,
@@ -393,6 +386,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	pci_bus = IWL_BUS_GET_PCI_BUS(bus);
 	pci_bus->pci_dev = pdev;
 
+	pci_set_drvdata(pdev, bus);
+
 	/* W/A - seems to solve weird behavior. We need to remove this if we
 	 * don't want to stay in L1 all the time. This wastes a lot of power */
 	pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
@@ -486,9 +481,9 @@ out_no_pci:
 
 static void __devexit iwl_pci_remove(struct pci_dev *pdev)
 {
-	struct iwl_shared *shrd = pci_get_drvdata(pdev);
-	struct iwl_bus *bus = shrd->bus;
+	struct iwl_bus *bus = pci_get_drvdata(pdev);
 	struct iwl_pci_bus *pci_bus = IWL_BUS_GET_PCI_BUS(bus);
+	struct iwl_shared *shrd = bus->shrd;
 
 	iwl_remove(shrd->priv);
 
@@ -506,7 +501,8 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
 static int iwl_pci_suspend(struct device *device)
 {
 	struct pci_dev *pdev = to_pci_dev(device);
-	struct iwl_shared *shrd = pci_get_drvdata(pdev);
+	struct iwl_bus *bus = pci_get_drvdata(pdev);
+	struct iwl_shared *shrd = bus->shrd;
 
 	/* Before you put code here, think about WoWLAN. You cannot check here
 	 * whether WoWLAN is enabled or not, and your code will run even if
@@ -519,7 +515,8 @@ static int iwl_pci_suspend(struct device *device)
 static int iwl_pci_resume(struct device *device)
 {
 	struct pci_dev *pdev = to_pci_dev(device);
-	struct iwl_shared *shrd = pci_get_drvdata(pdev);
+	struct iwl_bus *bus = pci_get_drvdata(pdev);
+	struct iwl_shared *shrd = bus->shrd;
 
 	/* Before you put code here, think about WoWLAN. You cannot check here
 	 * whether WoWLAN is enabled or not, and your code will run even if
Signature · 1 line
1.7.0.4
author
#31 lore raw

PATCH 23/27 iwlagn: add support for v2 of temperature offset calibration

In reply to Wey-Yi Guy

For 2000 series of NICs, version 2 of temperature offset calibration should be used.

---
 drivers/net/wireless/iwlwifi/iwl-2000.c      |    4 ++
 drivers/net/wireless/iwlwifi/iwl-5000-hw.h   |    4 +-
 drivers/net/wireless/iwlwifi/iwl-agn-ucode.c |   45 ++++++++++++++++++++++++--
 drivers/net/wireless/iwlwifi/iwl-commands.h  |    8 ++++
 drivers/net/wireless/iwlwifi/iwl-core.h      |    2 +
 drivers/net/wireless/iwlwifi/iwl-eeprom.h    |    5 ++-
 6 files changed, 62 insertions(+), 6 deletions(-)
drivers/net/wireless/iwlwifi/iwl-2000.c +4 -0
index 5a87010..db88958 100644
@@ -264,6 +264,7 @@ static struct iwl_bt_params iwl2030_bt_params = {
 	.base_params = &iwl2000_base_params,			\
 	.need_dc_calib = true,					\
 	.need_temp_offset_calib = true,				\
+	.temp_offset_v2 = true,					\
 	.led_mode = IWL_LED_RF_STATE,				\
 	.iq_invert = true					\
 
@@ -296,6 +297,7 @@ struct iwl_cfg iwl2000_2bgn_d_cfg = {
 	.bt_params = &iwl2030_bt_params,			\
 	.need_dc_calib = true,					\
 	.need_temp_offset_calib = true,				\
+	.temp_offset_v2 = true,					\
 	.led_mode = IWL_LED_RF_STATE,				\
 	.adv_pm = true,						\
 	.iq_invert = true					\
@@ -322,6 +324,7 @@ struct iwl_cfg iwl2030_2bg_cfg = {
 	.base_params = &iwl2000_base_params,			\
 	.need_dc_calib = true,					\
 	.need_temp_offset_calib = true,				\
+	.temp_offset_v2 = true,					\
 	.led_mode = IWL_LED_RF_STATE,				\
 	.adv_pm = true,						\
 	.rx_with_siso_diversity = true,				\
@@ -350,6 +353,7 @@ struct iwl_cfg iwl105_bgn_cfg = {
 	.bt_params = &iwl2030_bt_params,			\
 	.need_dc_calib = true,					\
 	.need_temp_offset_calib = true,				\
+	.temp_offset_v2 = true,					\
 	.led_mode = IWL_LED_RF_STATE,				\
 	.adv_pm = true,						\
 	.rx_with_siso_diversity = true,				\
drivers/net/wireless/iwlwifi/iwl-5000-hw.h +2 -2
index f9630a3..c013598 100644
@@ -74,8 +74,8 @@
 static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv)
 {
 	u16 temperature, voltage;
-	__le16 *temp_calib =
-		(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_TEMPERATURE);
+	__le16 *temp_calib = (__le16 *)iwl_eeprom_query_addr(priv,
+				EEPROM_KELVIN_TEMPERATURE);
 
 	temperature = le16_to_cpu(temp_calib[0]);
 	voltage = le16_to_cpu(temp_calib[1]);
drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +42 -3

63 lines not on this page · raw message

drivers/net/wireless/iwlwifi/iwl-commands.h +8 -0
index 82bfef4..64593aa 100644
@@ -3263,6 +3263,14 @@ struct iwl_calib_temperature_offset_cmd {
 	__le16 reserved;
 } __packed;
 
+struct iwl_calib_temperature_offset_v2_cmd {
+	struct iwl_calib_hdr hdr;
+	__le16 radio_sensor_offset_high;
+	__le16 radio_sensor_offset_low;
+	__le16 burntVoltageRef;
+	__le16 reserved;
+} __packed;
+
 /* IWL_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */
 struct iwl_calib_chain_noise_reset_cmd {
 	struct iwl_calib_hdr hdr;
drivers/net/wireless/iwlwifi/iwl-core.h +2 -0
index 549dc46..6d7ad45 100644
@@ -193,6 +193,7 @@ struct iwl_ht_params {
  * @rx_with_siso_diversity: 1x1 device with rx antenna diversity
  * @internal_wimax_coex: internal wifi/wimax combo device
  * @iq_invert: I/Q inversion
+ * @temp_offset_v2: support v2 of temperature offset calibration
  *
  * We enable the driver to be backward compatible wrt API version. The
  * driver specifies which APIs it supports (with @ucode_api_max being the
@@ -230,6 +231,7 @@ struct iwl_cfg {
 	const bool rx_with_siso_diversity;
 	const bool internal_wimax_coex;
 	const bool iq_invert;
+	const bool temp_offset_v2;
 };
 
 /***************************
drivers/net/wireless/iwlwifi/iwl-eeprom.h +4 -1
index e2b5e0e..325753e 100644
@@ -167,7 +167,10 @@ struct iwl_eeprom_enhanced_txpwr {
 #define EEPROM_XTAL		((2*0x128) | EEPROM_CALIB_ALL)
 
 /* temperature */
-#define EEPROM_TEMPERATURE ((2*0x12A) | EEPROM_CALIB_ALL)
+#define EEPROM_VOLTAGE_READING		((2*0x1) | EEPROM_CALIB_ALL)
+#define EEPROM_KELVIN_TEMPERATURE	((2*0x12A) | EEPROM_CALIB_ALL)
+#define EEPROM_RAW_TEMPERATURE		((2*0x12B) | EEPROM_CALIB_ALL)
+
 
 /* agn links */
 #define EEPROM_LINK_HOST             (2*0x64)
Signature · 1 line
1.7.0.4
author
#32 lore raw

PATCH 24/27 iwlagn: use iwl_eeprom_calib_hdr structure

In reply to Wey-Yi Guy

For retrieve calibration hdr related information, instead of using structure in one place and #define in other place, unify the method to use data structure.

---
 drivers/net/wireless/iwlwifi/iwl-agn-lib.c   |    6 +-----
 drivers/net/wireless/iwlwifi/iwl-agn-ucode.c |    9 +++++----
 drivers/net/wireless/iwlwifi/iwl-eeprom.h    |    7 ++++++-
 3 files changed, 12 insertions(+), 10 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn-lib.c +1 -5
index 1301887..e8b324c 100644
@@ -96,11 +96,7 @@ void iwlagn_temperature(struct iwl_priv *priv)
 
 u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv)
 {
-	struct iwl_eeprom_calib_hdr {
-		u8 version;
-		u8 pa_type;
-		u16 voltage;
-	} *hdr;
+	struct iwl_eeprom_calib_hdr *hdr;
 
 	hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv,
 							EEPROM_CALIB_ALL);
drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +5 -4
index 564d1fc..5f8d7b6 100644
@@ -185,11 +185,12 @@ static int iwlagn_set_temperature_offset_calib_v2(struct iwl_priv *priv)
 				     EEPROM_KELVIN_TEMPERATURE);
 	__le16 *offset_calib_low =
 		(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_RAW_TEMPERATURE);
-	__le16 *voltage_reading =
-		(__le16 *)iwl_eeprom_query_addr(priv, EEPROM_VOLTAGE_READING);
+	struct iwl_eeprom_calib_hdr *hdr;
 
 	memset(&cmd, 0, sizeof(cmd));
 	iwl_set_calib_hdr(&cmd.hdr, IWL_PHY_CALIBRATE_TEMP_OFFSET_CMD);
+	hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv,
+							EEPROM_CALIB_ALL);
 	memcpy(&cmd.radio_sensor_offset_high, offset_calib_high,
 		sizeof(offset_calib_high));
 	memcpy(&cmd.radio_sensor_offset_low, offset_calib_low,
@@ -199,8 +200,8 @@ static int iwlagn_set_temperature_offset_calib_v2(struct iwl_priv *priv)
 		cmd.radio_sensor_offset_low = DEFAULT_RADIO_SENSOR_OFFSET;
 		cmd.radio_sensor_offset_high = DEFAULT_RADIO_SENSOR_OFFSET;
 	}
-	memcpy(&cmd.burntVoltageRef, voltage_reading,
-		sizeof(voltage_reading));
+	memcpy(&cmd.burntVoltageRef, &hdr->voltage,
+		sizeof(hdr->voltage));
 
 	IWL_DEBUG_CALIB(priv, "Radio sensor offset high: %d\n",
 			le16_to_cpu(cmd.radio_sensor_offset_high));
drivers/net/wireless/iwlwifi/iwl-eeprom.h +6 -1
index 325753e..c94747e 100644
@@ -163,11 +163,16 @@ struct iwl_eeprom_enhanced_txpwr {
 } __packed;
 
 /* calibration */
+struct iwl_eeprom_calib_hdr {
+	u8 version;
+	u8 pa_type;
+	__le16 voltage;
+} __packed;
+
 #define EEPROM_CALIB_ALL	(INDIRECT_ADDRESS | INDIRECT_CALIBRATION)
 #define EEPROM_XTAL		((2*0x128) | EEPROM_CALIB_ALL)
 
 /* temperature */
-#define EEPROM_VOLTAGE_READING		((2*0x1) | EEPROM_CALIB_ALL)
 #define EEPROM_KELVIN_TEMPERATURE	((2*0x12A) | EEPROM_CALIB_ALL)
 #define EEPROM_RAW_TEMPERATURE		((2*0x12B) | EEPROM_CALIB_ALL)
 
Signature · 1 line
1.7.0.4
author
#33 lore raw

PATCH 25/27 iwlagn: do not use interruptible waits

In reply to Wey-Yi Guy

From: Johannes Berg <[email protected]>

Since the dawn of its time, iwlwifi has used interruptible waits to wait for synchronous commands and firmware loading.

This leads to "interesting" bugs, because it can't actually handle the interruptions; for example when a command sending is interrupted it will assume the command completed fully, and then leave it pending, which leads to all kinds of trouble when the command finishes later.

Since there's no easy way to gracefully deal with interruptions, fix the driver to not use interruptible waits.

This at least fixes the error
iwlagn 0000:02:00.0: Error: Response NULL in 'REPLY_SCAN_ABORT_CMD'

I have seen in P2P testing, but it is likely that there are other errors caused by this.

---
 drivers/net/wireless/iwlwifi/iwl-agn-ucode.c     |    9 ++-------
 drivers/net/wireless/iwlwifi/iwl-core.c          |    2 +-
 drivers/net/wireless/iwlwifi/iwl-rx.c            |    2 +-
 drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c |    4 ++--
 drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c |    4 ++--
 5 files changed, 8 insertions(+), 13 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +2 -7
index 5f8d7b6..b5bae38 100644
@@ -114,13 +114,8 @@ static int iwlagn_load_section(struct iwl_priv *priv, const char *name,
 		FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_ENDTFD);
 
 	IWL_DEBUG_FW(priv, "%s uCode section being loaded...\n", name);
-	ret = wait_event_interruptible_timeout(priv->shrd->wait_command_queue,
-					priv->ucode_write_complete, 5 * HZ);
-	if (ret == -ERESTARTSYS) {
-		IWL_ERR(priv, "Could not load the %s uCode section due "
-			"to interrupt\n", name);
-		return ret;
-	}
+	ret = wait_event_timeout(priv->shrd->wait_command_queue,
+				 priv->ucode_write_complete, 5 * HZ);
 	if (!ret) {
 		IWL_ERR(priv, "Could not load the %s uCode section\n",
 			name);
drivers/net/wireless/iwlwifi/iwl-core.c +1 -1
index ce8a015..cea6520 100644
@@ -869,7 +869,7 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
 	 * commands by clearing the ready bit */
 	clear_bit(STATUS_READY, &priv->shrd->status);
 
-	wake_up_interruptible(&priv->shrd->wait_command_queue);
+	wake_up(&priv->shrd->wait_command_queue);
 
 	if (!ondemand) {
 		/*
drivers/net/wireless/iwlwifi/iwl-rx.c +1 -1
index c7e6a74..2ee6103 100644
@@ -644,7 +644,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
 		wiphy_rfkill_set_hw_state(priv->hw->wiphy,
 			test_bit(STATUS_RF_KILL_HW, &priv->shrd->status));
 	else
-		wake_up_interruptible(&priv->shrd->wait_command_queue);
+		wake_up(&priv->shrd->wait_command_queue);
 }
 
 static void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +2 -2
index 458a6fb..6f3f07d 100644
@@ -657,7 +657,7 @@ static void iwl_irq_handle_error(struct iwl_trans *trans)
 		 */
 		clear_bit(STATUS_READY, &trans->shrd->status);
 		clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status);
-		wake_up_interruptible(&priv->shrd->wait_command_queue);
+		wake_up(&priv->shrd->wait_command_queue);
 		IWL_ERR(trans, "RF is used by WiMAX\n");
 		return;
 	}
@@ -1098,7 +1098,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
 		handled |= CSR_INT_BIT_FH_TX;
 		/* Wake up uCode load routine, now that load is complete */
 		priv(trans)->ucode_write_complete = 1;
-		wake_up_interruptible(&trans->shrd->wait_command_queue);
+		wake_up(&trans->shrd->wait_command_queue);
 	}
 
 	if (inta & ~handled) {
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c +2 -2
index c0def8e..d299cd9 100644
@@ -946,7 +946,7 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_mem_buffer *rxb)
 		clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status);
 		IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n",
 			       get_cmd_string(cmd->hdr.cmd));
-		wake_up_interruptible(&trans->shrd->wait_command_queue);
+		wake_up(&trans->shrd->wait_command_queue);
 	}
 
 	meta->flags = 0;
@@ -1032,7 +1032,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
 		return ret;
 	}
 
-	ret = wait_event_interruptible_timeout(trans->shrd->wait_command_queue,
+	ret = wait_event_timeout(trans->shrd->wait_command_queue,
 			!test_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status),
 			HOST_COMPLETE_TIMEOUT);
 	if (!ret) {
Signature · 1 line
1.7.0.4
author
#34 lore raw

PATCH 26/27 iwlagn: fix stack corruption for temperature offset v2

In reply to Wey-Yi Guy

Same stack corruption problem as temperature offset

---
 drivers/net/wireless/iwlwifi/iwl-agn-ucode.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/iwl-agn-ucode.c +2 -2
index b5bae38..3e40429 100644
@@ -187,9 +187,9 @@ static int iwlagn_set_temperature_offset_calib_v2(struct iwl_priv *priv)
 	hdr = (struct iwl_eeprom_calib_hdr *)iwl_eeprom_query_addr(priv,
 							EEPROM_CALIB_ALL);
 	memcpy(&cmd.radio_sensor_offset_high, offset_calib_high,
-		sizeof(offset_calib_high));
+		sizeof(*offset_calib_high));
 	memcpy(&cmd.radio_sensor_offset_low, offset_calib_low,
-		sizeof(offset_calib_low));
+		sizeof(*offset_calib_low));
 	if (!(cmd.radio_sensor_offset_low)) {
 		IWL_DEBUG_CALIB(priv, "no info in EEPROM, use default\n");
 		cmd.radio_sensor_offset_low = DEFAULT_RADIO_SENSOR_OFFSET;
Signature · 1 line
1.7.0.4
author
#35 lore raw

PATCH 27/27 iwlagn: signedness bug

In reply to Wey-Yi Guy

re-apply the unsigned shorts bug fixed by Dan Carpenter but get lost after the file move.

---
 drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c +1 -1
index d299cd9..f5bc81a 100644
@@ -544,7 +544,7 @@ int iwl_trans_pcie_tx_agg_alloc(struct iwl_trans *trans,
 	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 	struct iwl_tid_data *tid_data;
 	unsigned long flags;
-	u16 txq_id;
+	int txq_id;
 
 	txq_id = iwlagn_txq_ctx_activate_free(trans);
 	if (txq_id == -1) {
Signature · 1 line
1.7.0.4