linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] cfg80211: avoid restoring the regulatory during disconnect
@ 2014-05-09 10:28 Rajkumar Manoharan
  2014-05-12 14:00 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Rajkumar Manoharan @ 2014-05-09 10:28 UTC (permalink / raw)
  To: johannes; +Cc: linville, linux-wireless, Sachin Ahuja, Rajkumar Manoharan

From: Sachin Ahuja <sahuja@codeaurora.org>

When STA disconnects, cfg80211 restores the regulatory setting
to world domain. For the drivers that ignore country ie, cfg80211
should remain in the default country code which is configured
at driver load and should do not be restored to world reg domain.

Signed-off-by: Sachin Ahuja <sahuja@codeaurora.org>
Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
---
v2: Removed is_all_countryie_ignore
 net/wireless/sme.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 4bc21a2..1b771a8 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -558,10 +558,30 @@ static bool cfg80211_is_all_idle(void)
 	return is_all_idle;
 }
 
+static bool cfg80211_is_all_countryie_ignore(void)
+{
+	struct cfg80211_registered_device *rdev;
+	struct wireless_dev *wdev;
+
+	list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
+		list_for_each_entry(wdev, &rdev->wdev_list, list) {
+			wdev_lock(wdev);
+			if (!(wdev->wiphy->regulatory_flags &
+			      REGULATORY_COUNTRY_IE_IGNORE)) {
+				wdev_unlock(wdev);
+				return false;
+			}
+			wdev_unlock(wdev);
+		}
+	}
+	return true;
+}
+
 static void disconnect_work(struct work_struct *work)
 {
 	rtnl_lock();
-	if (cfg80211_is_all_idle())
+	if (cfg80211_is_all_idle() &&
+	    !cfg80211_is_all_countryie_ignore())
 		regulatory_hint_disconnect();
 	rtnl_unlock();
 }
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] cfg80211: avoid restoring the regulatory during disconnect
  2014-05-09 10:28 [PATCH v2] cfg80211: avoid restoring the regulatory during disconnect Rajkumar Manoharan
@ 2014-05-12 14:00 ` Johannes Berg
  2014-05-12 17:21   ` Rajkumar Manoharan
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2014-05-12 14:00 UTC (permalink / raw)
  To: Rajkumar Manoharan
  Cc: linville, linux-wireless, Sachin Ahuja, Luis R. Rodriguez

On Fri, 2014-05-09 at 15:58 +0530, Rajkumar Manoharan wrote:

> +static bool cfg80211_is_all_countryie_ignore(void)
> +{
> +	struct cfg80211_registered_device *rdev;
> +	struct wireless_dev *wdev;
> +
> +	list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
> +		list_for_each_entry(wdev, &rdev->wdev_list, list) {
> +			wdev_lock(wdev);
> +			if (!(wdev->wiphy->regulatory_flags &
> +			      REGULATORY_COUNTRY_IE_IGNORE)) {
> +				wdev_unlock(wdev);

The locking here seems completely pointless.

Also, maybe you can do something about the long lines, maybe with a
temporary variable?

johannes



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] cfg80211: avoid restoring the regulatory during disconnect
  2014-05-12 14:00 ` Johannes Berg
@ 2014-05-12 17:21   ` Rajkumar Manoharan
  2014-05-12 18:36     ` Rajkumar Manoharan
  0 siblings, 1 reply; 4+ messages in thread
From: Rajkumar Manoharan @ 2014-05-12 17:21 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless, Sachin Ahuja, Luis R. Rodriguez

On Mon, May 12, 2014 at 04:00:03PM +0200, Johannes Berg wrote:
> On Fri, 2014-05-09 at 15:58 +0530, Rajkumar Manoharan wrote:
> 
> > +static bool cfg80211_is_all_countryie_ignore(void)
> > +{
> > +	struct cfg80211_registered_device *rdev;
> > +	struct wireless_dev *wdev;
> > +
> > +	list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
> > +		list_for_each_entry(wdev, &rdev->wdev_list, list) {
> > +			wdev_lock(wdev);
> > +			if (!(wdev->wiphy->regulatory_flags &
> > +			      REGULATORY_COUNTRY_IE_IGNORE)) {
> > +				wdev_unlock(wdev);
> 
> The locking here seems completely pointless.
>
locking is handled in same way of cfg80211_is_all_idle. Still
want to remove locks?

> Also, maybe you can do something about the long lines, maybe with a
> temporary variable?
>

-Rajkumar

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] cfg80211: avoid restoring the regulatory during disconnect
  2014-05-12 17:21   ` Rajkumar Manoharan
@ 2014-05-12 18:36     ` Rajkumar Manoharan
  0 siblings, 0 replies; 4+ messages in thread
From: Rajkumar Manoharan @ 2014-05-12 18:36 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless, Sachin Ahuja, Luis R. Rodriguez

On Mon, May 12, 2014 at 10:51:37PM +0530, Rajkumar Manoharan wrote:
> On Mon, May 12, 2014 at 04:00:03PM +0200, Johannes Berg wrote:
> > On Fri, 2014-05-09 at 15:58 +0530, Rajkumar Manoharan wrote:
> > 
> > > +static bool cfg80211_is_all_countryie_ignore(void)
> > > +{
> > > +	struct cfg80211_registered_device *rdev;
> > > +	struct wireless_dev *wdev;
> > > +
> > > +	list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
> > > +		list_for_each_entry(wdev, &rdev->wdev_list, list) {
> > > +			wdev_lock(wdev);
> > > +			if (!(wdev->wiphy->regulatory_flags &
> > > +			      REGULATORY_COUNTRY_IE_IGNORE)) {
> > > +				wdev_unlock(wdev);
> > 
> > The locking here seems completely pointless.
> >
> locking is handled in same way of cfg80211_is_all_idle. Still
> want to remove locks?
> 
> > Also, maybe you can do something about the long lines, maybe with a
> > temporary variable?
> >
sorry for the noise. sent v3 patch.

-Rajkumar

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-12 18:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-09 10:28 [PATCH v2] cfg80211: avoid restoring the regulatory during disconnect Rajkumar Manoharan
2014-05-12 14:00 ` Johannes Berg
2014-05-12 17:21   ` Rajkumar Manoharan
2014-05-12 18:36     ` Rajkumar Manoharan

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).