From patchwork Fri Apr 13 20:32:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amar Singhal X-Patchwork-Id: 10340745 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A6B5A60153 for ; Fri, 13 Apr 2018 20:32:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D7F5288A7 for ; Fri, 13 Apr 2018 20:32:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 714B728A02; Fri, 13 Apr 2018 20:32:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0E77288A7 for ; Fri, 13 Apr 2018 20:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751042AbeDMUcJ (ORCPT ); Fri, 13 Apr 2018 16:32:09 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:56412 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750864AbeDMUcI (ORCPT ); Fri, 13 Apr 2018 16:32:08 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2C08360BFA; Fri, 13 Apr 2018 20:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523651528; bh=mVSho/GSXgd1zNPIntsv6WML2Q7+Sem9W++o0JOXLt0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YiYz5WvNwkElvlgjfkrEJKZqWMV8npAGzY/HZZanW2uPf5HlgpOqEaau+gpqmFTAF /erhl3Xk82IB7UIy0gb9ydnNBitjMr4DDik3EryDOctWyjPyDcYa53YE38vD1+xuHD 84mX6tb++4kq9b3jzXbTUhv4N2v7pB2R3/cBidXc= Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 2528F60807; Fri, 13 Apr 2018 20:32:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523651525; bh=mVSho/GSXgd1zNPIntsv6WML2Q7+Sem9W++o0JOXLt0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MdTF6Dw1anW2IE84tv9Tldv0fLiKxKBJQ80tFTLe/KjiRzVRsFY5m7c/bz3JLsP75 J2z/WN3kfo/uY96XxHuwyeeABVmci/KTfsm8hspxtO7fIICZleIcndZXyXuP0u6NQh pXSSDaOGqTIdbNfbwCbnU7uI6Tqe/PLA5pFaKJrw= MIME-Version: 1.0 Date: Fri, 13 Apr 2018 13:32:05 -0700 From: asinghal@codeaurora.org To: Johannes Berg Cc: Jouni Malinen , linux-wireless@vger.kernel.org, Kiran Kumar Lokere , jjohnson@codeaurora.org Subject: Re: [PATCH 2/2] cfg80211: Modify wiphy registration semantics for self managed hints In-Reply-To: <1521627352.2645.27.camel@sipsolutions.net> References: <1520106021-16836-1-git-send-email-jouni@codeaurora.org> <1520106021-16836-2-git-send-email-jouni@codeaurora.org> <1521627352.2645.27.camel@sipsolutions.net> Message-ID: <5f8caab7e7cfb88072c2e221ea45063e@codeaurora.org> X-Sender: asinghal@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP hi Johannes, please fine some replies inline: On 2018-03-21 03:15, Johannes Berg wrote: > So I really think this should just be one patch - it's not about > "registration semantics" but about which types of requests get passed > to reg_notifier(), and if you do it in one place you'd better also do > it in the other. Sure, I have combined the two patches in one patch now: From: Amar Singhal Call the regulatory notifier for self managed hints only if initiator is NL80211_REGDOM_SET_BY_USER and hint type is NL80211_USER_REG_HINT_CELL_BASE. Also call regulatory notifier when wiphy is registered under similar conditions. Signed-off-by: Amar Singhal Signed-off-by: Kiran Kumar Lokere Signed-off-by: Jouni Malinen --- net/wireless/reg.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) /* make sure at least one self-managed wiphy exists */ @@ -2819,7 +2824,7 @@ static void reg_process_pending_hints(void) spin_unlock(®_requests_lock); - if (reg_only_self_managed_wiphys()) { + if (reg_only_self_managed_wiphys(reg_request)) { reg_free_request(reg_request); return; } @@ -3700,15 +3705,21 @@ void wiphy_regulatory_register(struct wiphy *wiphy) { struct regulatory_request *lr; - /* self-managed devices ignore external hints */ - if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) + lr = get_last_request(); + + /* self-managed devices ignore beacon hints and 11d IE */ + if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) { wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS | - REGULATORY_COUNTRY_IE_IGNORE; + REGULATORY_COUNTRY_IE_IGNORE; + + if (lr->initiator == NL80211_REGDOM_SET_BY_USER && + lr->user_reg_hint_type == NL80211_USER_REG_HINT_CELL_BASE) + reg_call_notifier(wiphy, lr); + } if (!reg_dev_ignore_cell_hint(wiphy)) reg_num_devs_support_basehint++; - lr = get_last_request(); wiphy_update_regulatory(wiphy, lr->initiator); wiphy_all_share_dfs_chan_state(wiphy); } diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 16c7e4e..d74de76 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2768,20 +2768,25 @@ static void reg_process_hint(struct regulatory_request *reg_request) reg_free_request(reg_request); } -static bool reg_only_self_managed_wiphys(void) +static bool reg_only_self_managed_wiphys(struct regulatory_request *request) { struct cfg80211_registered_device *rdev; struct wiphy *wiphy; - bool self_managed_found = false; + bool self_managed_found = true; ASSERT_RTNL(); list_for_each_entry(rdev, &cfg80211_rdev_list, list) { wiphy = &rdev->wiphy; - if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) + if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) { self_managed_found = true; - else - return false; + if (request->initiator == NL80211_REGDOM_SET_BY_USER && + request->user_reg_hint_type == + NL80211_USER_REG_HINT_CELL_BASE) + reg_call_notifier(wiphy, request); + } else { + self_managed_found = false; + } }