From nobody Mon Oct 09 23:16:13 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S4FJs6PWGz4wh4h; Mon, 9 Oct 2023 23:16:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S4FJs5qgpz3QCd; Mon, 9 Oct 2023 23:16:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696893373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FvpyRGlFLArjQaeldvrg0t0+dNcnA0DuKIlGFW0K4is=; b=BuTmH3d+fmgWEbdWYGkC3Gteu8Nx1XUy/I6oi8d4co750BhFOutaCn/0f5cj/HVUvwBi84 ryONbhQ3d0xkAVJR4drO37C+6wyjRshVgbxy8USs4YD1K2Whuav1ehqMIarqDi7p1/7n3v lW49pkVIt/UF07WSzKeBvQcJEtksOlZ6Iu11T+v1pALW5xMyejsaMHCIHYVI4qdf7oONJg O8sSXaVhwedbJZdm/OuaeXn6blfqTQ7q5TJh3qM3E1lUiED0B+uL7kJAm6xYuq3sjyD+BM BWfZ9M5VCLMQ39ojFhlg7su3G3dhVV/ERGudjxcIaOSgSobPamYh/DWnW1yYNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696893373; a=rsa-sha256; cv=none; b=J0wcpApzFEHdvLiaosVjyaKjcfkxZP3r3rj8VLbBG+kgPumP7RpXtRzOkPVMuqO7a9jxHV 5W1wbN61IGIxeRxUc0QmD0/JoIIU4ylwilKuXJezfEAHq16Z0ocMKTaDz1JOz9p0u0/p5v JEhvKGzCQ1Mjh2fMahA6RZyk7fZ71zF0eSR2Y7bvSuCkEmVDnqBJpTMeVhlmhxSp+/PK8a GdF9UwP/IAxQn8oooOdWeFBlnCsfsV0tOeB459GHDOIpbGYgLbg0X1H403lD+dss/Dyvq3 b3BFwit4QRf/362CppXG/kTLO4nrko2rQHo9OcYsSIBsUeSwPUsUbmGWf8lNLw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696893373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FvpyRGlFLArjQaeldvrg0t0+dNcnA0DuKIlGFW0K4is=; b=p4BZljLh+szrvvbN4RY9gtOmcpWy4gsEKi5DOMEOzkoTWZsUxW9NHBdj/F+rVGVd1t6t63 wGg6mRdEJGeIntGaecpDGXOyZG/l1xPvjehOgUGOzuvYv7Ukn/S4OkLFQba5nZ+L4PEqNV 0iKok29ZmfysisxXXQa/gPM+ejxU5VjMj9Ei8ZAMXWQVem6rSinX+NvxcUuoNOsW0b8NXG CKY8LQjnz6FZuj0pW/ljdjfnUibgaU5hVj/u0NpdvZwE7jYrUD9plvzGF3aEMp3MCK1eMl XNk5vw/AvF0RqVbND4L8TVdUn9iNWwKbqhrT8CAUAm5KQ3uN0y8cRY1VV82Q4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S4FJs4RSQzh6; Mon, 9 Oct 2023 23:16:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 399NGDUh071197; Mon, 9 Oct 2023 23:16:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 399NGDPX071195; Mon, 9 Oct 2023 23:16:13 GMT (envelope-from git) Date: Mon, 9 Oct 2023 23:16:13 GMT Message-Id: <202310092316.399NGDPX071195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: a99e7db072de - releng/14.0 - LinuxKPI: 802.11: fill regulatory_hint() with some life List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/releng/14.0 X-Git-Reftype: branch X-Git-Commit: a99e7db072de1d50ba13ef917bf8f501eaf63834 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a99e7db072de1d50ba13ef917bf8f501eaf63834 commit a99e7db072de1d50ba13ef917bf8f501eaf63834 Author: Bjoern A. Zeeb AuthorDate: 2023-09-25 17:54:20 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-09 23:14:53 +0000 LinuxKPI: 802.11: fill regulatory_hint() with some life Start implementing regulatory_hint() using a .c file based allocation helper function so we could change structures in the future with better chances to keep compatibility. This sets wiphy->regd needed by various LinuxKPI based WiFi drivers. Sponsored by: The FreeBSD Foundation Approved by: re (gjb) (cherry picked from commit 673d62fc359b0cb7a70af42c36d2fa54fb29452a) (cherry picked from commit a3e10c2b141879a68cff691f0176a2f6ac8ea04e) --- sys/compat/linuxkpi/common/include/net/cfg80211.h | 20 ++++++++++++++++++-- sys/compat/linuxkpi/common/src/linux_80211.c | 10 ++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h index 56ca9a231d2d..7e57ce67cc26 100644 --- a/sys/compat/linuxkpi/common/include/net/cfg80211.h +++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h @@ -1260,6 +1260,8 @@ struct cfg80211_bss *linuxkpi_cfg80211_get_bss(struct wiphy *, const uint8_t *, size_t, enum ieee80211_bss_type, enum ieee80211_privacy); void linuxkpi_cfg80211_put_bss(struct wiphy *, struct cfg80211_bss *); void linuxkpi_cfg80211_bss_flush(struct wiphy *); +struct linuxkpi_ieee80211_regdomain * + lkpi_get_linuxkpi_ieee80211_regdomain(size_t); /* -------------------------------------------------------------------------- */ @@ -1587,8 +1589,22 @@ regulatory_set_wiphy_regd(struct wiphy *wiphy, static __inline int regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2) { - TODO(); - return (-ENXIO); + struct linuxkpi_ieee80211_regdomain *regd; + + if (wiphy->regd != NULL) + return (-EBUSY); + + regd = lkpi_get_linuxkpi_ieee80211_regdomain(0); + if (regd == NULL) + return (-ENOMEM); + + regd->alpha2[0] = alpha2[0]; + regd->alpha2[1] = alpha2[1]; + wiphy->regd = regd; + + IMPROVE("are there flags who is managing? update net8011?"); + + return (0); } static __inline const char * diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index c8232e6f33cc..978a82ad2ceb 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -3954,6 +3954,16 @@ linuxkpi_ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw, LKPI_80211_LHW_LVIF_UNLOCK(lhw); } +struct linuxkpi_ieee80211_regdomain * +lkpi_get_linuxkpi_ieee80211_regdomain(size_t n) +{ + struct linuxkpi_ieee80211_regdomain *regd; + + regd = kzalloc(sizeof(*regd) + n * sizeof(struct ieee80211_reg_rule), + GFP_KERNEL); + return (regd); +} + int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, struct linuxkpi_ieee80211_regdomain *regd)