From nobody Mon Sep 25 17:58:25 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 4RvVwf0gTtz4trm2; Mon, 25 Sep 2023 17:58:26 +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 4RvVwd71Xlz3Fj2; Mon, 25 Sep 2023 17:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695664706; 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=quLlD6ufTVCGEHfQJDOk5BKVXmxP44WrJ4FXzUE4Do8=; b=W8m+wgIg2De3h9+xUeOqMJMKqNA6AnfNEqWUt6nVYn5pdLOAr0rNmzXjKdqgxyxEpO8xIt F3eJxA/dyah77VWkHx3ayF242nGWRsYJsI9OkS3xbB0+VBnwJD9V7QgWsAJXfi7ShaltFw fWx17pF/PHHR5Zd0Db/gUqpCu6l3/Kd8N/hYDKGcf74DuFh0Wnc68Y3Cn3tXLkgJztmryU /zQeW4Tv6z+FNzmqtanPdLakbGUhkxdfGgSOF/p2wJ7eswGEeVBcW4K+BnJiuDR9NoWCQj hfsMDwOBFLDAXDVMWcoZyG306ZAV5KTBznoOhi5GyY0Ro4EGSiIM3hiwmxVemA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695664706; a=rsa-sha256; cv=none; b=t5j+cvd/2BD3EytGF/JGd1vjPgRatLA2RI7mc37S0DCUt6gqvnb2N425EyR7xvsI8YmDXp P0KvIdEkhOQ6kR3DLlL/b729zddxfwdSyQIfxGQggumPt0fKWveVCx+47/DvJE3HKGET0W ok+qXqoWJODakJ+IS3CZGXG195UuUlN06lP8iu7lQuSNx/8tsMg27kiaG8SukAU3jyQB1O 69NNB/wgr21aNoh7hvQd0Bb6d6Rjl/EJhWiVxJHR6gUH1njQEiCVvf3BwhX4Bhthe0bOjI M7tfgUm86f5JuzgUDdJt2GkPFLSAYjxiClLSask6kTJWggt+IF5len9kLA4NtA== 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=1695664706; 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=quLlD6ufTVCGEHfQJDOk5BKVXmxP44WrJ4FXzUE4Do8=; b=JClUApJzPlVL7yZrtFsh3wkFKyaKEILLxFhSikFkK8opzw6wTmwadbLC5lje8Eq/H1QZgG GxoC8Vu4Jx0rFtUL8kD/TFhcsz6CDIFWKmK3Z9K11fRhJDFIrTVW/AyTQRRrr35luDPTki AW+NUwtm/c3vEKdHtsNQJcNreVYF1uk20PGlEisuYBwSihn5IQjfKPN05eneVUaEfev/wG W9rSBdD8zXRjJcpntQSihD9iWD/U8K5w3zi0/bYfVXCqDgB8cEfPhp9IYVwZgAzEjw7Zzj diOmyM5f+5GQi7vJbnLNQSGBkQSq7Zu1TMJc2ESdyGW1nzvia7eG8OeY7L4VEw== 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 4RvVwd5lMtz8KT; Mon, 25 Sep 2023 17:58:25 +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 38PHwPac045134; Mon, 25 Sep 2023 17:58:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38PHwPoV045131; Mon, 25 Sep 2023 17:58:25 GMT (envelope-from git) Date: Mon, 25 Sep 2023 17:58:25 GMT Message-Id: <202309251758.38PHwPoV045131@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 673d62fc359b - main - 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/main X-Git-Reftype: branch X-Git-Commit: 673d62fc359b0cb7a70af42c36d2fa54fb29452a Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=673d62fc359b0cb7a70af42c36d2fa54fb29452a commit 673d62fc359b0cb7a70af42c36d2fa54fb29452a Author: Bjoern A. Zeeb AuthorDate: 2023-09-25 17:54:20 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-09-25 17:57:40 +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 MFC after: 3 days --- 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 de35ab844c25..41b13fc9269f 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)