All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yogesh Ashok Powar <yogeshp@marvell.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"John W. Linville" <linville@tuxdriver.com>,
	Andreas Hartmann <andihartmann@01019freenet.de>
Subject: Re: [PATCH 2/2] mac80211: Fixing Races for skipping tailroom reservation
Date: Tue, 21 Jun 2011 22:03:52 +0530	[thread overview]
Message-ID: <20110621163351.GD32464@hertz.marvell.com> (raw)
In-Reply-To: <1308667215.4276.7.camel@jlt3.sipsolutions.net>

On Tue, Jun 21, 2011 at 07:40:15AM -0700, Johannes Berg wrote:
> On Tue, 2011-06-21 at 19:40 +0530, Yogesh Ashok Powar wrote:
> 
> > @@ -455,6 +496,8 @@ int ieee80211_key_link(struct ieee80211_key *key,
> >  	__ieee80211_key_replace(sdata, sta, pairwise, old_key, key);
> >  	__ieee80211_key_destroy(old_key);
> >  
> > +	increment_tailroom_need_count(key->local);
> > +
> 
> This doesn't seem right -- it links the key in first and then does the
> update, the mechanism I described relies on doing it the other way
> around.
In that case we should have something like this

@@ -493,11 +493,11 @@ int ieee80211_key_link(struct ieee80211_key *key,
 	else
 		old_key = key_mtx_dereference(sdata->local, sdata->keys[idx]);
 
+	increment_tailroom_need_count(key->local);
+
 	__ieee80211_key_replace(sdata, sta, pairwise, old_key, key);
 	__ieee80211_key_destroy(old_key);
 
-	increment_tailroom_need_count(key->local);
-
 	ieee80211_debugfs_key_add(key);
 
 	ret = ieee80211_key_enable_hw_accel(key);

> 
> > @@ -498,8 +541,12 @@ void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata)
> >  
> >  	mutex_lock(&sdata->local->key_mtx);
> >  
> > -	list_for_each_entry(key, &sdata->key_list, list)
> > +	sdata->local->crypto_tx_tailroom_needed_cnt = 0;
> > +
> 
> That doesn't seem right either -- only if you have a single sdata that
> will work, I think?
Right. For multiple sdata count will be over written to 0.

I think, following should fix this

Thanks
Yogesh

diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index edf9f40..0bf450d 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -541,8 +541,6 @@ void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata)
 
 	mutex_lock(&sdata->local->key_mtx);
 
-	sdata->local->crypto_tx_tailroom_needed_cnt = 0;
-
 	list_for_each_entry(key, &sdata->key_list, list) {
 		increment_tailroom_need_count(sdata->local);
 		ieee80211_key_enable_hw_accel(key);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 05e3fb8..bef3bdd 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1271,6 +1271,9 @@ int ieee80211_reconfig(struct ieee80211_local *local)
 		mutex_unlock(&local->sta_mtx);
 	}
 
+	/* Reset tailroom skip count */
+	local->crypto_tx_tailroom_needed_cnt = 0;
+
 	/* add back keys */
 	list_for_each_entry(sdata, &local->interfaces, list)
 		if (ieee80211_sdata_running(sdata))



  reply	other threads:[~2011-06-21 16:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-16 10:21 [PATCH 0/2] mac80211: Fixing races for hw crypto skipping tailroom Yogesh Ashok Powar
2011-06-16 10:25 ` [PATCH 1/2] Revert "Revert "mac80211: Skip tailroom reservation for full HW-crypto devices"" Yogesh Ashok Powar
2011-06-16 10:27 ` [PATCH 2/2] mac80211: Fixing Races for skipping tailroom reservation Yogesh Ashok Powar
2011-06-16 15:36   ` Johannes Berg
2011-06-17 13:25     ` Yogesh Ashok Powar
2011-06-17 17:24       ` Johannes Berg
2011-06-20 14:30         ` Yogesh Ashok Powar
2011-06-20 15:29           ` Johannes Berg
2011-06-20 16:49             ` Yogesh Powar
2011-06-20 17:29               ` Johannes Berg
2011-06-21 13:03                 ` Yogesh Ashok Powar
2011-06-21 13:43                   ` Johannes Berg
2011-06-21 14:10                     ` Yogesh Ashok Powar
2011-06-21 14:40                       ` Johannes Berg
2011-06-21 16:33                         ` Yogesh Ashok Powar [this message]
2011-06-21 17:44                           ` Andreas Hartmann
2011-06-22  7:17                           ` Yogesh Ashok Powar
2011-06-22 12:31                             ` Yogesh Ashok Powar
2011-06-22 12:49                               ` Johannes Berg
2011-06-22 12:58                                 ` Yogesh Ashok Powar
2011-06-22 13:12                                   ` Johannes Berg
2011-06-23 11:52                                     ` Yogesh Powar
2011-06-24  9:04                                     ` yogeshp
2011-06-25 13:07                                       ` Johannes Berg
2011-06-27  6:02                                         ` [PATCH] nl80211: use netlink consistent dump feature for BSS dumps Walter Goldens

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=20110621163351.GD32464@hertz.marvell.com \
    --to=yogeshp@marvell.com \
    --cc=andihartmann@01019freenet.de \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.