diff mbox

[v2,2/2] cfg80211: Schedule timeout for all CRDA calls

Message ID 1420519942-16109-2-git-send-email-ilan.peer@intel.com (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show

Commit Message

Ilan Peer Jan. 6, 2015, 4:52 a.m. UTC
Timeout was scheduled only in case CRDA was called due to user hints,
but was not scheduled for other cases. This can result in regulatory
hint processing getting stuck in case that there is no CRDA configured.

Change this by scheduling a timeout every time CRDA is called. In
addition, in restore_regulatory_settings() all pending requests are
restored (and not only the user ones).

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
 net/wireless/reg.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

Comments

Johannes Berg Jan. 6, 2015, 10:59 a.m. UTC | #1
On Mon, 2015-01-05 at 23:52 -0500, Ilan Peer wrote:
> Timeout was scheduled only in case CRDA was called due to user hints,
> but was not scheduled for other cases. This can result in regulatory
> hint processing getting stuck in case that there is no CRDA configured.

I can understand this part.

> Change this by scheduling a timeout every time CRDA is called. In
> addition, in restore_regulatory_settings() all pending requests are
> restored (and not only the user ones).

Care to explain why, and why this should be in the same patch?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ilan Peer Jan. 6, 2015, 11:28 a.m. UTC | #2
> -----Original Message-----

> From: Johannes Berg [mailto:johannes@sipsolutions.net]

> Sent: Tuesday, January 06, 2015 12:59

> To: Peer, Ilan

> Cc: linux-wireless@vger.kernel.org; mcgrof@suse.com

> Subject: Re: [PATCH v2 2/2] cfg80211: Schedule timeout for all CRDA calls

> 

> On Mon, 2015-01-05 at 23:52 -0500, Ilan Peer wrote:

> > Timeout was scheduled only in case CRDA was called due to user hints,

> > but was not scheduled for other cases. This can result in regulatory

> > hint processing getting stuck in case that there is no CRDA configured.

> 

> I can understand this part.

> 

> > Change this by scheduling a timeout every time CRDA is called. In

> > addition, in restore_regulatory_settings() all pending requests are

> > restored (and not only the user ones).

> 

> Care to explain why, and why this should be in the same patch?


Previously only the pending user hints were restored (not sure why, but maybe there was an assumption that the timeout was only scheduled for user hints?). Was not sure why all other hint types were not restored. I can move this to another patch it this is still reasonable.

Ilan.
diff mbox

Patch

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 6b0da81..fa71c34 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -552,6 +552,9 @@  reg_call_crda(struct regulatory_request *request)
 {
 	if (call_crda(request->alpha2))
 		return REG_REQ_IGNORE;
+
+	queue_delayed_work(system_power_efficient_wq,
+			   &reg_timeout, msecs_to_jiffies(3142));
 	return REG_REQ_OK;
 }
 
@@ -1773,8 +1776,7 @@  static void reg_set_request_processed(void)
 		need_more_processing = true;
 	spin_unlock(&reg_requests_lock);
 
-	if (lr->initiator == NL80211_REGDOM_SET_BY_USER)
-		cancel_delayed_work(&reg_timeout);
+	cancel_delayed_work(&reg_timeout);
 
 	if (need_more_processing)
 		schedule_work(&reg_work);
@@ -2053,8 +2055,6 @@  static void reg_process_hint(struct regulatory_request *reg_request)
 		if (treatment == REG_REQ_IGNORE ||
 		    treatment == REG_REQ_ALREADY_SET)
 			return;
-		queue_delayed_work(system_power_efficient_wq,
-				   &reg_timeout, msecs_to_jiffies(3142));
 		return;
 	case NL80211_REGDOM_SET_BY_DRIVER:
 		if (!wiphy)
@@ -2454,7 +2454,6 @@  static void restore_regulatory_settings(bool reset_user)
 	char alpha2[2];
 	char world_alpha2[2];
 	struct reg_beacon *reg_beacon, *btmp;
-	struct regulatory_request *reg_request, *tmp;
 	LIST_HEAD(tmp_reg_req_list);
 	struct cfg80211_registered_device *rdev;
 
@@ -2470,11 +2469,7 @@  static void restore_regulatory_settings(bool reset_user)
 	 * settings.
 	 */
 	spin_lock(&reg_requests_lock);
-	list_for_each_entry_safe(reg_request, tmp, &reg_requests_list, list) {
-		if (reg_request->initiator != NL80211_REGDOM_SET_BY_USER)
-			continue;
-		list_move_tail(&reg_request->list, &tmp_reg_req_list);
-	}
+	list_splice_tail_init(&reg_requests_list, &tmp_reg_req_list);
 	spin_unlock(&reg_requests_lock);
 
 	/* Clear beacon hints */