From nobody Wed Nov 29 16:38:36 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 4SgQ4X3nRfz52x0x; Wed, 29 Nov 2023 16:38:36 +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 4SgQ4X3KVGz3Jx8; Wed, 29 Nov 2023 16:38:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701275916; 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=cq4zTGhQt8whzVi6JwxLsn9uNdkERri36v0L4y/S73M=; b=rBUfTxobnTxboUcusb5XTVbus2i8WFKCTVTYEz10RhM8J0NxWJG8zFyw76vahpL/Iu9Wfn v5UX/nRX8PuP+qGwiFp1UbvmYDEe9MYuzBePmlKg77JrJ1d41nK4WIHYyLqd9OYSrzCmon ve9ZwBBk3yOC9RgcIfJHi3FKa0OLH09KMU7w6b8uj9+WsRDBfHimMOxBV3acy9xaNjW/hz 7boocnGKj3FbJchVgrelhF0XjjM0yZxou+tLB2gH6v6ZR1nt8+yZowHxcUjUhj+/ZWOrty eKYi1EAFT3JFMxj3cs3A8RkoEaLJdAVK5u9vAF38cVnLdmGuLGo1Ie7rqdspoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701275916; 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=cq4zTGhQt8whzVi6JwxLsn9uNdkERri36v0L4y/S73M=; b=HonVEJE+8IZxfPVbsqAzv0H7p/SMJ6Edm4Vxvltl+EJCsVDr8t45zLDClzeXqYybvkl6HY Jlv8yFXgvgEStlX3vylP4aycvUxo1aAh/nqKCl7Mw7zUB1Ee6gQzbzIPnw9a3lH/0G8En8 takppTIesguuh+Wl3Hsyz5dgsIvvz56C48KdI+oxx5O64wioUoPAv7OACd9LQv6Cpd0/GU /3mLpKcLqsDgg1D2HBIp3NpUfUZ7FRLlKLZkEae3KEdrE2dOve0Cm0lHe+faP8fO9510/3 dE5QhGw34A02LqssPXWJ3ZtkBhvkg+mqrkjeg4KtTPd2Z5ewWHwqNLOnEXEKsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701275916; a=rsa-sha256; cv=none; b=YML5teQTq1tBmkRkcybv7n0DsRPrqWDbIJKyVqDqgY97BN+HG9s9HGX5y1EpDrSlLSXAu4 bxL7PlcoAAMJJn/X7BPfVxs2+PBKE+GMw/ycZ4FmLnnek8QTVQpNWo5kEntQ8LY4YV9QNe Wm6t72ziNgXbpJfkO581RPIwgm6l8Lh5ztcDxBbImpyoJsSKtttkoaIhU5cgYcn0glL4v/ /XJczTyjYviWcfzWa1jjkxFBh6lfgmnpmfaeYzu5qSEaot+BE2r5WYnvOwrgTFTVteERFH h9gQ7sDaqlPIKkvoLpzGSG9lnnjdwfqW2Mk1t9ElnrefqD+LqN4wAnINhH2H5A== 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 4SgQ4X2PCxz1Bwp; Wed, 29 Nov 2023 16:38:36 +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 3ATGcacv046289; Wed, 29 Nov 2023 16:38:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ATGcaIe046286; Wed, 29 Nov 2023 16:38:36 GMT (envelope-from git) Date: Wed, 29 Nov 2023 16:38:36 GMT Message-Id: <202311291638.3ATGcaIe046286@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: 38fff4bd9433 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 38fff4bd94338441d77446c05e3ef11111915297 Auto-Submitted: auto-generated The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=38fff4bd94338441d77446c05e3ef11111915297 commit 38fff4bd94338441d77446c05e3ef11111915297 Author: Bjoern A. Zeeb AuthorDate: 2023-09-25 17:54:20 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-11-29 16:36:09 +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 (cherry picked from commit 673d62fc359b0cb7a70af42c36d2fa54fb29452a) --- 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 a16aa42ba2a3..85ee4f22434c 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -4028,6 +4028,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)