From patchwork Thu Dec 19 20:53:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 3384411 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B7D389F314 for ; Thu, 19 Dec 2013 20:53:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4DBD206B3 for ; Thu, 19 Dec 2013 20:53:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E9CB7206AD for ; Thu, 19 Dec 2013 20:53:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756537Ab3LSUxk (ORCPT ); Thu, 19 Dec 2013 15:53:40 -0500 Received: from mail-pd0-f176.google.com ([209.85.192.176]:46289 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756534Ab3LSUxj (ORCPT ); Thu, 19 Dec 2013 15:53:39 -0500 Received: by mail-pd0-f176.google.com with SMTP id w10so1604319pde.35 for ; Thu, 19 Dec 2013 12:53:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=z4z6g84c8rYlNyK2V5QhwakcGfU+x73cwTcjoltVVLo=; b=fsN+N3q+yQM4M8xp5sMF5M7ZvWdnuMSSX0cTMgtynokuCrKbtIKk9KfOYMzuDajVcb hXzgl3Zpqil0bE3BuqF6xSjdcPvwr2CIWXcbW92nhxKdOpbzLs4RJCMBLndh0SVAzfG5 KZPdPa3loyEGwbimZtff84JQg59zzRpKo3GckIqcghHhjeh9mIukVaN6ebSDw5Sr6YOS YLq/uV8vKDBxGr6Q9XIR733BqV0PFCVIfb2LXnYgKAIgSQueAOjbZ79S/TEaobd9jemB XhyUOq+eLc6hfA9dtn8cFp2EbTXa/xtNdWERT6mr8JZfQOlreJMveXPMuMsu5OKsS0TT SH6A== X-Received: by 10.66.144.102 with SMTP id sl6mr4045642pab.96.1387486419507; Thu, 19 Dec 2013 12:53:39 -0800 (PST) Received: from mcgrof@gmail.com (c-98-234-148-242.hsd1.ca.comcast.net. [98.234.148.242]) by mx.google.com with ESMTPSA id z10sm12230438pas.6.2013.12.19.12.53.36 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 19 Dec 2013 12:53:37 -0800 (PST) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Thu, 19 Dec 2013 12:53:34 -0800 From: "Luis R. Rodriguez" To: johannes@sipsolutions.net Cc: linux@eikelenboom.it, linux-wireless@vger.kernel.org, "Luis R. Rodriguez" Subject: [PATCH 3/3] cfg80211: processing regulatory requests on netdev notifier Date: Thu, 19 Dec 2013 12:53:19 -0800 Message-Id: <1387486399-4053-4-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1387486399-4053-1-git-send-email-mcgrof@do-not-panic.com> References: <1387486399-4053-1-git-send-email-mcgrof@do-not-panic.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds a trigger to review any pending regulatory requests whenever an 802.11 device interface is brought down or up. We use this as an opportunistic trigger for checking the regulatory work queues as otherwise they they're only checked upon an initial regulatory request or when beacon hints are found. This opportunistic mechanism can be used to trigger kicking the queues regulatory queues at any time from userspace without having to change the regulatory state. Reported-by: Sander Eikelenboom Signed-off-by: Luis R. Rodriguez --- net/wireless/core.c | 2 ++ net/wireless/reg.c | 5 +++++ net/wireless/reg.h | 1 + 3 files changed, 8 insertions(+) diff --git a/net/wireless/core.c b/net/wireless/core.c index d89dee2..bc0f518 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -812,6 +812,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, SET_NETDEV_DEVTYPE(dev, &wiphy_type); break; case NETDEV_REGISTER: + reg_process_pending_work(); /* * NB: cannot take rdev->mtx here because this may be * called within code protected by it when interfaces @@ -871,6 +872,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb, wake_up(&rdev->dev_wait); break; case NETDEV_UP: + reg_process_pending_work(); cfg80211_update_iface_num(rdev, wdev->iftype, 1); wdev_lock(wdev); switch (wdev->iftype) { diff --git a/net/wireless/reg.c b/net/wireless/reg.c index ecf364e..1a049b3 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -196,6 +196,11 @@ static DECLARE_WORK(reg_work, reg_todo); static void reg_timeout_work(struct work_struct *work); static DECLARE_DELAYED_WORK(reg_timeout, reg_timeout_work); +void reg_process_pending_work(void) +{ + schedule_work(®_work); +} + /* We keep a static world regulatory domain in case of the absence of CRDA */ static const struct ieee80211_regdomain world_regdom = { .n_reg_rules = 6, diff --git a/net/wireless/reg.h b/net/wireless/reg.h index 02bd8f4..063fb7a 100644 --- a/net/wireless/reg.h +++ b/net/wireless/reg.h @@ -36,6 +36,7 @@ void regulatory_exit(void); int set_regdom(const struct ieee80211_regdomain *rd); bool reg_last_request_cell_base(void); +void reg_process_pending_work(void); /** * regulatory_hint_found_beacon - hints a beacon was found on a channel