linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Andryuk <jandryuk@gmail.com>
To: reinette chatre <reinette.chatre@intel.com>
Cc: Samuel Ortiz <samuel@sortiz.org>,
	Tomas Winkler <tomasw@gmail.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: kernel BUG at drivers/net/wireless/iwlwifi/iwl3945-base.c:3127!
Date: Wed, 18 Mar 2009 21:52:48 -0400	[thread overview]
Message-ID: <1237427568.6943.13.camel@rainbow> (raw)
In-Reply-To: <1237254243.13077.33.camel@rainbow>

On Mon, 2009-03-16 at 21:44 -0400, Jason Andryuk wrote:
> I believe there may be some incorrect use of the DMA API.
> 
> My tree is as follows:
> git checkout -f ff5010c3e12f1d0da27a5f871c2e3d5333dfbe2f
> git cherry-pick -x fadd267e5f9c2319ad62edad30f7af07b6b368ef
> patch -p1 < iwl3945-rb_stts_and_BUG_to_WARN.patch (attached)
> plus patch from below.

Slightly updated patch attached.  len value for SCAN command is
corrected and attach_len saves the correct len value.

Still does not work.  No Microcode SW errors though.

Another potential problem with the SWIOTLB is that pci_unmap_addr_set
writes to out_cmd->meta.  Memory which the driver no longer owns.  This
will probably be a problem when unmapping pages as the address will not
necessarily be present.

I wonder if it is a problem now as pci_map_single is repeatedly called
on the same memory.  The return value is not checked.

The driver doesn't show any calls to iwl3945_rx_reply_tx, either
successful or invalid.  Does that mean the hardware is not updating the
queue pointers?

Have any of the Intel folks make any progress on this?

Jason

diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 3b39aef..11c5f4d 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -510,16 +510,9 @@ static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 	if (out_cmd->meta.flags & CMD_SIZE_HUGE)
 		out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
 
-	len = (idx == TFD_CMD_SLOTS) ?
-			IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd);
-
-	phys_addr = pci_map_single(priv->pci_dev, out_cmd,
-					len, PCI_DMA_TODEVICE);
-	pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr);
-	pci_unmap_len_set(&out_cmd->meta, len, len);
-	phys_addr += offsetof(struct iwl_cmd, hdr);
-
-	iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);
+	len = sizeof(struct iwl_cmd);
+	if (idx == TFD_CMD_SLOTS)
+		len += IWL_MAX_SCAN_SIZE;
 
 	pad = U32_PAD(cmd->len);
 	tfd->control_flags |= cpu_to_le32(TFD_CTL_PAD_SET(pad));
@@ -532,6 +525,13 @@ static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 
 	txq->need_update = 1;
 
+	phys_addr = pci_map_single(priv->pci_dev, out_cmd,
+					len, PCI_DMA_TODEVICE);
+	pci_unmap_addr_set(&out_cmd->meta, mapping, phys_addr);
+	pci_unmap_len_set(&out_cmd->meta, len, len);
+	phys_addr += offsetof(struct iwl_cmd, hdr);
+
+	iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);
 	/* Increment and update queue's write index */
 	q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
 	ret = iwl3945_tx_queue_update_write_ptr(priv, txq);
@@ -2263,7 +2263,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 	dma_addr_t phys_addr;
 	dma_addr_t txcmd_phys;
 	int txq_id = skb_get_queue_mapping(skb);
-	u16 len, idx, len_org, hdr_len;
+	u16 len, idx, len_org, hdr_len, attach_len;
 	u8 id;
 	u8 unicast;
 	u8 sta_id;
@@ -2390,42 +2390,11 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 	else
 		len_org = 0;
 
-	/* Physical address of this Tx command's header (not MAC header!),
-	 * within command buffer array. */
-	txcmd_phys = pci_map_single(priv->pci_dev,
-				    out_cmd, sizeof(struct iwl_cmd),
-				    PCI_DMA_TODEVICE);
-	pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys);
-	pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd));
-	/* Add buffer containing Tx command and MAC(!) header to TFD's
-	 * first entry */
-	txcmd_phys += offsetof(struct iwl_cmd, hdr);
-
-	/* Add buffer containing Tx command and MAC(!) header to TFD's
-	 * first entry */
-	iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
+	attach_len = len;
 
 	if (info->control.hw_key)
 		iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, 0);
 
-	/* Set up TFD's 2nd entry to point directly to remainder of skb,
-	 * if any (802.11 null frames have no payload). */
-	len = skb->len - hdr_len;
-	if (len) {
-		phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len,
-					   len, PCI_DMA_TODEVICE);
-		iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len);
-	}
-
-	if (!len)
-		/* If there is no payload, then we use only one Tx buffer */
-		tfd->control_flags = cpu_to_le32(TFD_CTL_COUNT_SET(1));
-	else
-		/* Else use 2 buffers.
-		 * Tell 3945 about any padding after MAC header */
-		tfd->control_flags = cpu_to_le32(TFD_CTL_COUNT_SET(2) |
-			TFD_CTL_PAD_SET(U32_PAD(len)));
-
 	/* Total # bytes to be transmitted */
 	len = (u16)skb->len;
 	tx->len = cpu_to_le16(len);
@@ -2453,6 +2422,39 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 	iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr,
 			   ieee80211_hdrlen(fc));
 
+	/* Set up TFD's 2nd entry to point directly to remainder of skb,
+	 * if any (802.11 null frames have no payload). */
+	len = skb->len - hdr_len;
+	if (!len)
+		/* If there is no payload, then we use only one Tx buffer */
+		tfd->control_flags = cpu_to_le32(TFD_CTL_COUNT_SET(1));
+	else
+		/* Else use 2 buffers.
+		 * Tell 3945 about any padding after MAC header */
+		tfd->control_flags = cpu_to_le32(TFD_CTL_COUNT_SET(2) |
+			TFD_CTL_PAD_SET(U32_PAD(len)));
+
+	/* Physical address of this Tx command's header (not MAC header!),
+	 * within command buffer array. */
+	txcmd_phys = pci_map_single(priv->pci_dev,
+				    out_cmd, sizeof(struct iwl_cmd),
+				    PCI_DMA_TODEVICE);
+	pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys);
+	pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd));
+	/* Add buffer containing Tx command and MAC(!) header to TFD's
+	 * first entry */
+	txcmd_phys += offsetof(struct iwl_cmd, hdr);
+
+	/* Add buffer containing Tx command and MAC(!) header to TFD's
+	 * first entry */
+	iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, attach_len);
+
+	if (len) {
+		phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len,
+					   len, PCI_DMA_TODEVICE);
+		iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len);
+	}
+
 	/* Tell device the write index *just past* this latest filled TFD */
 	q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
 	rc = iwl3945_tx_queue_update_write_ptr(priv, txq);


  reply	other threads:[~2009-03-19  1:53 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-18  0:06 kernel BUG at drivers/net/wireless/iwlwifi/iwl3945-base.c:3127! Deuce
2009-01-18 17:41 ` Deuce
2009-01-26 11:44 ` Samuel Ortiz
2009-01-27  3:13   ` Jason Andryuk
2009-01-27  3:35     ` Jason Andryuk
2009-01-27 16:24       ` Samuel Ortiz
2009-01-27 23:31         ` Jason Andryuk
2009-01-28  7:12           ` Tomas Winkler
2009-01-28 11:37             ` Samuel Ortiz
2009-01-28 11:52               ` Tomas Winkler
2009-01-28 12:12                 ` Samuel Ortiz
2009-02-20  4:17                   ` Jason Andryuk
2009-02-20 19:49                     ` reinette chatre
2009-02-23  0:10                       ` Jason Andryuk
2009-02-23  4:37                         ` Jason Andryuk
2009-02-23 19:21                           ` reinette chatre
2009-02-23 22:28                           ` reinette chatre
2009-02-24  3:02                             ` Jason Andryuk
2009-02-24  0:15                           ` reinette chatre
2009-02-24  2:47                             ` Jason Andryuk
2009-03-02  3:37               ` Jason Andryuk
2009-03-04  4:32                 ` Jason Andryuk
2009-03-04 19:19                   ` reinette chatre
2009-03-04 19:47                     ` Jason Andryuk
2009-03-05  0:04                       ` reinette chatre
2009-03-05 23:50                         ` Jason Andryuk
2009-03-06  0:24                           ` reinette chatre
2009-03-06  4:12                             ` Jason Andryuk
2009-03-06  5:39                               ` reinette chatre
2009-03-10  1:40                                 ` Jason Andryuk
2009-03-10  3:32                                   ` Jason Andryuk
2009-03-10  5:04                                   ` reinette chatre
2009-03-10 13:10                                     ` Jason Andryuk
2009-03-10 18:22                                       ` Abhijeet Kolekar
2009-03-11  3:11                                         ` Jason Andryuk
2009-03-11  2:57                                       ` Jason Andryuk
2009-03-11  3:40                                     ` Jason Andryuk
2009-03-13  3:31                                       ` Jason Andryuk
2009-03-16 12:10                                         ` Jason Andryuk
2009-03-17  1:44                                           ` Jason Andryuk
2009-03-19  1:52                                             ` Jason Andryuk [this message]
2009-03-20  1:22                                               ` Jason Andryuk
2009-03-20 20:39                                                 ` Abhijeet Kolekar
2009-03-22 17:29                                                   ` Jason Andryuk
2009-03-23  0:37                                                     ` Jason Andryuk
2009-03-27 16:28                                                       ` reinette chatre
2009-03-31 22:22                                                       ` reinette chatre
2009-04-01  1:28                                                         ` Jason Andryuk
2009-04-21  1:41                                                         ` Jason Andryuk
2009-04-21 15:42                                                           ` reinette chatre
  -- strict thread matches above, loose matches on Subject: below --
2009-01-09  3:28 Deuce
2009-01-09 19:12 ` reinette chatre
2009-01-09 23:07   ` Deuce
2009-01-12 18:38     ` Samuel Ortiz
2009-01-13  3:12       ` Deuce
2009-01-13  4:37         ` Deuce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1237427568.6943.13.camel@rainbow \
    --to=jandryuk@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=samuel@sortiz.org \
    --cc=tomasw@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).