linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Guy, Wey-Yi" <wey-yi.w.guy@intel.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: "Chatre, Reinette" <reinette.chatre@intel.com>,
	"linville@tuxdriver.com" <linville@tuxdriver.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"ipw3945-devel@lists.sourceforge.net"
	<ipw3945-devel@lists.sourceforge.net>,
	"stable@kernel.org" <stable@kernel.org>
Subject: Re: [PATCH 2/3] iwlwifi: sanity check before counting number of tfds can be free
Date: Fri, 19 Feb 2010 09:57:01 -0800	[thread overview]
Message-ID: <1266602221.16888.14.camel@wwguy-ubuntu> (raw)
In-Reply-To: <20100219164041.GA3995@dhcp-lab-161.englab.brq.redhat.com>

Hi Stanislaw,

Thanks for the feedback.

On Fri, 2010-02-19 at 08:40 -0800, Stanislaw Gruszka wrote:
> Hi Reinette 
> On Thu, Feb 18, 2010 at 10:01:40PM -0800, Reinette Chatre wrote:
> > This fix starts to address
> > http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2160 . There are
> > more situations in which this problem (freed tfds below zero) can occur so
> > this bug is not closed yet.
> 
> Only starts ... ,hmm so these two patches does not fix any issue.
> 
> > diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
> > index 87ce2bd..9196d3f 100644
> > --- a/drivers/net/wireless/iwlwifi/iwl-tx.c
> > +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
> > @@ -1131,6 +1131,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
> >  	struct iwl_queue *q = &txq->q;
> >  	struct iwl_tx_info *tx_info;
> >  	int nfreed = 0;
> > +	struct ieee80211_hdr *hdr;
> >  
> >  	if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) {
> >  		IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, "
> > @@ -1145,13 +1146,19 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
> >  
> >  		tx_info = &txq->txb[txq->q.read_ptr];
> >  		iwl_tx_status(priv, tx_info->skb[0]);
> > +
> > +		if (tx_info->skb[0]) {
> > +			hdr = (struct ieee80211_hdr *)
> > +				((struct sk_buff *)tx_info->skb[0])->data;
> 
> Not needed cast.
> 
you are right, no need to cast.

> > +			if (hdr && ieee80211_is_data_qos(hdr->frame_control))
> > +				nfreed++;
> > +		}
> 
> I think additional line is needed to make things work. Something like below
> should work, but I have no time to test it today.
> 
> diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
> index de45f30..6b516c4 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-5000.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
> @@ -1153,8 +1153,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
>  				   tx_resp->failure_frame);
>  
>  		freed = iwl_tx_queue_reclaim(priv, txq_id, index);
> -		if (ieee80211_is_data_qos(tx_resp->frame_ctrl))
> -			priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
> +		priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;

Correct, I miss this place, there is no need to check tx_resp here, and
I will prefer to do sanity check before decrement the tfds_in_queue to
prevent it go into negative range.

>  
>  		if (priv->mac80211_registered &&
>  		    (iwl_queue_space(&txq->q) > txq->q.low_mark))
> diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
> index 281d318..c051f9f 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-tx.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
> @@ -1132,6 +1132,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
>  	struct iwl_queue *q = &txq->q;
>  	struct iwl_tx_info *tx_info;
>  	int nfreed = 0;
> +	struct ieee80211_hdr *hdr;
>  
>  	if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) {
>  		IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, "
> @@ -1146,13 +1147,18 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
>  
>  		tx_info = &txq->txb[txq->q.read_ptr];
>  		iwl_tx_status(priv, tx_info->skb[0]);
> +
> +		if (tx_info->skb[0]) {
> +			hdr = (struct ieee80211_hdr *) tx_info->skb[0]->data;
> +			if (hdr && ieee80211_is_data_qos(hdr->frame_control))
> +				nfreed++;
> +		}
>  		tx_info->skb[0] = NULL;
>  
>  		if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl)
>  			priv->cfg->ops->lib->txq_inval_byte_cnt_tbl(priv, txq);
>  
>  		priv->cfg->ops->lib->txq_free_tfd(priv, txq);
> -		nfreed++;
>  	}
>  	return nfreed;
>  }
> 
Thanks very much for checking, I will re-submit the patch to fix the
issues.

Wey



  reply	other threads:[~2010-02-19 18:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-19  6:01 [PATCH 0/3] fixes for 2.6.33 and stable Reinette Chatre
2010-02-19  6:01 ` [PATCH 1/3] iwlwifi: set HT flags after channel in rxon Reinette Chatre
2010-02-19  6:01 ` [PATCH 2/3] iwlwifi: sanity check before counting number of tfds can be free Reinette Chatre
2010-02-19 16:40   ` Stanislaw Gruszka
2010-02-19 17:57     ` Guy, Wey-Yi [this message]
2010-02-19  6:01 ` [PATCH 3/3] iwlwifi: error checking for number of tfds in queue Reinette Chatre
2010-02-19 20:34   ` John W. Linville
2010-02-19 20:59     ` reinette chatre
2010-02-19 23:24       ` [PATCH v2 " reinette chatre
2010-02-19 23:32         ` reinette chatre

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=1266602221.16888.14.camel@wwguy-ubuntu \
    --to=wey-yi.w.guy@intel.com \
    --cc=ipw3945-devel@lists.sourceforge.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=reinette.chatre@intel.com \
    --cc=sgruszka@redhat.com \
    --cc=stable@kernel.org \
    /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).