From nobody Wed Oct 04 15:23:51 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 4S0z483RLFz4w6Gw; Wed, 4 Oct 2023 15:23:52 +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 4S0z4813Svz4NSD; Wed, 4 Oct 2023 15:23:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696433032; 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=rODIo4cBUhvoG8vx3ifnbpIzWm0HiGlTv5sI4c0UdaA=; b=qEqp6FfCYZSFJ7Nk732tukyirUWqStgz8P//9xm/wq22JqJWCSNoMpmGo5O9VrF+e/BxlK IEb4bbmWx4nGTBZOIEUNnZokdxM9bjMF0IkC0ivxzboaKS4f4KaOk7hr7zvXpoPQ+upbQL n3FxAKspFmloEKkv0QG46SQLyQa2/ZTmqNb/d7/siGKWBTo0sakFtv3uY9nn8PqoGXJK2l 3kwML8GDywoXIlUDZ5cLFHs/MD6msRYfm70WjgsHyiOFb4J4rOgyp1ajm7Qm802/BpBoTU pwZzZPWCS2+4ExlfTzwubcGLkT48eYftrXIFXJEIC4+Irw0GoJsrtE24nBNJRw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696433032; a=rsa-sha256; cv=none; b=U10fDGHFGZtht/LH1ECv5PPRv0RPBOk327SYrOxMCHhZfh55QouvZnclXJUl4WxwlUz/p7 sN7kyd9ibPbWegxgU1tIE1AqWbvhGXqaYjd5/5KUtRCEdJYgiCmikydUuf19PRZfPy3CGX MaJnp285JaWkSwtRVByWqfb1R5r/EhUYbMyaTJ12XHGhonDlt6SVZVOih5b8Y0FJzzLodw UC2jrVXIrwLkmG/ox+x3+wZ8Y7ZrC5Wn3Vd6ADrKNkTtiFBT5DSW/lZ5yM3+v6xPo2T5uF vLpx0jEjB5vlLV8K35cafqXieIbW9cMLB44M0DrzQb0jmkmRyJMV0jnMcUBblw== 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=1696433032; 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=rODIo4cBUhvoG8vx3ifnbpIzWm0HiGlTv5sI4c0UdaA=; b=oDlgjB+MIIyMpDCwrHUrI+iSl5jYlwEj/bRgyJYaMNpP9Y/f1nV82XG8AAcW7Iy/6LOqOM QIg123vFJ+BwpX3C7GG04L8YAILa2vzzqhiSmBCvWfYZVfgAnku+ZtVoweXNOiDCx8NcFl N0gjSnBl2hFA0KJKOuSXz5qo7WKXYAIlK2peXqqJySUzjpKGrfj+9lNqyTFQwKIjRcM80M OFEiEEh37QgF8iFy+4nmF5jtOrNf+8f2LGCOMn8Sz/On3gHPs/M0JyzK3qtwGdpXtyvb9i M68f9naiZ/Cwdhkew5nBlL+akp/BxgrMsMxlwHsaaVOzaTPrn2yRzHj5Ir7g2A== 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 4S0z480985zjZd; Wed, 4 Oct 2023 15:23:52 +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 394FNpCt087285; Wed, 4 Oct 2023 15:23:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394FNpMn087282; Wed, 4 Oct 2023 15:23:51 GMT (envelope-from git) Date: Wed, 4 Oct 2023 15:23:51 GMT Message-Id: <202310041523.394FNpMn087282@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: a3e10c2b1418 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: a3e10c2b141879a68cff691f0176a2f6ac8ea04e Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a3e10c2b141879a68cff691f0176a2f6ac8ea04e commit a3e10c2b141879a68cff691f0176a2f6ac8ea04e Author: Bjoern A. Zeeb AuthorDate: 2023-09-25 17:54:20 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-04 15:19:19 +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 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)