Linux-Wireless Archive on lore.kernel.org
 help / color / Atom feed
From: Sriram R <srirrama@codeaurora.org>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, Sriram R <srirrama@codeaurora.org>
Subject: [RFC] cfg80211: Allow self managed devices to update global regulatory
Date: Fri,  6 Sep 2019 08:45:33 +0530
Message-ID: <1567739733-18852-1-git-send-email-srirrama@codeaurora.org> (raw)

Currently, self managed drivers cannot update the global regulatory
using a regulatory hint from driver if the wiphy regd is already set
from other sources.
Due to this, when a regulatory hint is provided to cfg80211 from
self managed devices, the request gets ignored and global reg is
always at default, i.e World reg, DFS-UNSET.
Hence in such systems, the result of 'iw reg get' does not indicate a
valid global regd.

Hence, Allow setting the cfg80211 global regulatory when it is unset
and the requestor is a self managed device. At the same time, do not
propagate these hints to other devices in the system.

Signed-off-by: Sriram R <srirrama@codeaurora.org>
---
 net/wireless/reg.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 646107a..86c4460 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -3550,6 +3550,20 @@ static int reg_set_rd_driver(const struct ieee80211_regdomain *rd,
 	if (!request_wiphy)
 		return -ENODEV;
 
+	/* Update cfg80211 regdomain only if it's unset, in case a hint
+	 * is received from self managed wiphy. Ignore all other
+	 * processing from self managed wiphy's. Return EALREADY to avoid
+	 * updating other drivers.
+	 */
+	if (request_wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) {
+		regd = get_cfg80211_regdom();
+
+		if (regd == cfg80211_world_regdom) {
+			reset_regdomains(false, rd);
+		}
+		return -EALREADY;
+	}
+
 	if (!driver_request->intersect) {
 		if (request_wiphy->regd)
 			return -EALREADY;
-- 
2.7.4


             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06  3:15 Sriram R [this message]
2019-09-06  7:44 ` Johannes Berg

Reply instructions:

You may reply publically 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=1567739733-18852-1-git-send-email-srirrama@codeaurora.org \
    --to=srirrama@codeaurora.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org linux-wireless@archiver.kernel.org
	public-inbox-index linux-wireless

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/ public-inbox