From nobody Sun Dec 01 22:03:28 2024 X-Original-To: dev-commits-src-main@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 4Y1gsX5gJcz5f2Tn; Sun, 01 Dec 2024 22:03:28 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y1gsX57Fkz4Ryv; Sun, 1 Dec 2024 22:03:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733090608; 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=qFkgSOQNLl9YsoibXz3jr0ASdhpzqPAmrnlhsM8TNXM=; b=EWTKnanVgci7vzuDJgz4K9wVLz767CPvp68Cprib39LNsbR1i6O33i0g5ex5rwrQ4DkyZN 4afgmKdfrikdMDWQNN8EoD0GCVrrRu/vkpye6/itEvC9k2VvHpM1EhxYynsT0TNBuCoYz+ JinCZQ3larizaXZ3exl925AII6+r79aARN4TLdFPtcgX4TtCeYyjP3Ecwuir+hR5TBe+zs cXlrYMqxAYEGuzWFhUCLxyYZiFcvUqBPbYAXfDu7A3soxkt+BVN3No+flHIRDcsr/YScPH U7+BEqXxeTkvwj5LXJRz3kb7J45lT0DwNRoJ6mygpqdTtTGLW9yLCWUoKvaevg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733090608; 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=qFkgSOQNLl9YsoibXz3jr0ASdhpzqPAmrnlhsM8TNXM=; b=ToPvIFj39B02BOG9R54JL2Tn76ly8xoCArAw4CBYdB25Ld1qv9XNS56Ad/iohr7AsWnP7x 4xYS+4Dljtj0adsqzUPcD61Bu0DYhEhEIJwHlaX0r6syHcEqDDPDLeX5DvT1ST45VEX0DW F6Br3+mRPk98BRm22XDfqSS7CB3/tWw69FWzdbkzriSt0iRz54azlkYP0x3VpjoB2u1uS2 6cEPmJFFYvbzHfEADDJP6tuntyKFlle+ZkQaqApB5MmVj/qA65s5W9fMnUtcbcvOuApUlG ZcGvACmR5JyL2u3wvUi8Emua+65uoSpNUYBFm3ZsEG0QO0ePyQKywgM47sij1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733090608; a=rsa-sha256; cv=none; b=MkIjGiZpxBPk8mkeEh4nltjfYrNyFomLh751FvUeWs80RL08RQb79DM5FDe5VF5xkdQ7zq +1ipc3J8XHIe4yPs5Tr9a8WpH3JABsteOaV+nWuU+0I36GYAUFQdVMnQrTH5V9mCGhx/97 GOErsltZDa1auWzixKTUxuom7ZCDSAt3liQjuaWbl/bWPcWxM5X3JuHNzLAdq50xSjBj4u cZ7CPDGJQZgai8TopJGBTS7ARRuNkuvbpFS67BW8cwiHn01cdoUOieRllAvwE/atWMeEm/ EnuLiu+eERpfwLHuf+5GIn0D4uX20G5HcSuVeuEPMRkcJull2CXpnEg24IWRtw== 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 4Y1gsX4jyxz19pJ; Sun, 1 Dec 2024 22:03:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B1M3SoT019498; Sun, 1 Dec 2024 22:03:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B1M3SOs019495; Sun, 1 Dec 2024 22:03:28 GMT (envelope-from git) Date: Sun, 1 Dec 2024 22:03:28 GMT Message-Id: <202412012203.4B1M3SOs019495@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: 243f6925bf81 - main - net80211: 11ac: add options to manage VHT STBC List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 243f6925bf818a64f3c996c6a89fec6c8a6ff058 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=243f6925bf818a64f3c996c6a89fec6c8a6ff058 commit 243f6925bf818a64f3c996c6a89fec6c8a6ff058 Author: Bjoern A. Zeeb AuthorDate: 2024-11-28 23:54:17 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-12-01 22:02:08 +0000 net80211: 11ac: add options to manage VHT STBC Add IEEE80211_FVHT_STBC_(TX|RX) flags to allow userspace to manage if STBC will be allowed for VHT RX/TX. For RX this will only allow us to turn it off but no fine grained control of the number of supported spatial streams. Introduce IEEE80211_FVHT_CHANWIDTH_MASK as a helper to make the spelling out of the IEEE80211_FVHT_MASK more readable. Update ifconfig to allow setting of these flags. Sponsored by: The FreeBSD Foundation MFC atfer: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D47838 --- sbin/ifconfig/ifieee80211.c | 8 ++++++++ sys/net80211/ieee80211.c | 4 ++++ sys/net80211/ieee80211_ioctl.c | 20 ++++++++++++++++++++ sys/net80211/ieee80211_var.h | 12 ++++++++++-- sys/net80211/ieee80211_vht.c | 6 ++---- 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index c6875785f8f5..25de7fb13632 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -135,6 +135,8 @@ #define IEEE80211_FVHT_USEVHT80 0x000000004 /* CONF: Use VHT80 */ #define IEEE80211_FVHT_USEVHT160 0x000000008 /* CONF: Use VHT160 */ #define IEEE80211_FVHT_USEVHT80P80 0x000000010 /* CONF: Use VHT 80+80 */ +#define IEEE80211_FVHT_STBC_TX 0x00000020 /* CONF: STBC tx enabled */ +#define IEEE80211_FVHT_STBC_RX 0x00000040 /* CONF: STBC rx enabled */ #endif /* Helper macros unified. */ @@ -6038,6 +6040,12 @@ static struct cmd ieee80211_cmds[] = { DEF_CMD("-vht160", -IEEE80211_FVHT_USEVHT160, set80211vhtconf), DEF_CMD("vht80p80", IEEE80211_FVHT_USEVHT80P80, set80211vhtconf), DEF_CMD("-vht80p80", -IEEE80211_FVHT_USEVHT80P80, set80211vhtconf), + DEF_CMD("vhtstbctx", IEEE80211_FVHT_STBC_TX, set80211vhtconf), + DEF_CMD("-vhtstbctx", -IEEE80211_FVHT_STBC_TX, set80211vhtconf), + DEF_CMD("vhtstbcrx", IEEE80211_FVHT_STBC_RX, set80211vhtconf), + DEF_CMD("-vhtstbcrx", -IEEE80211_FVHT_STBC_RX, set80211vhtconf), + DEF_CMD("vhtstbc", (IEEE80211_FVHT_STBC_TX|IEEE80211_FVHT_STBC_RX), set80211vhtconf), + DEF_CMD("-vhtstbc", -(IEEE80211_FVHT_STBC_TX|IEEE80211_FVHT_STBC_RX), set80211vhtconf), DEF_CMD("rifs", 1, set80211rifs), DEF_CMD("-rifs", 0, set80211rifs), DEF_CMD("smps", IEEE80211_HTCAP_SMPS_ENA, set80211smps), diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index ecf87020b066..ccb7efaa4df5 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -744,6 +744,8 @@ ieee80211_vap_attach(struct ieee80211vap *vap, ifm_change_cb_t media_change, ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80); ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160); ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_STBC_TX); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_STBC_RX); IEEE80211_UNLOCK(ic); return 1; @@ -801,6 +803,8 @@ ieee80211_vap_detach(struct ieee80211vap *vap) ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80); ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160); ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_STBC_TX); + ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_STBC_RX); /* NB: this handles the bpfdetach done below */ ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF); diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index c0ba19b5db89..3b57e7d8cd8e 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -3506,6 +3506,26 @@ ieee80211_ioctl_set80211(struct ieee80211vap *vap, u_long cmd, struct ieee80211r else ieee80211_syncflag_vht(vap, -IEEE80211_FVHT_USEVHT80P80); + /* Check if we can do STBC TX/RX before changing the setting. */ + if ((ireq->i_val & IEEE80211_FVHT_STBC_TX) && + ((vap->iv_vht_cap.vht_cap_info & IEEE80211_VHTCAP_TXSTBC) == 0)) + return EOPNOTSUPP; + if ((ireq->i_val & IEEE80211_FVHT_STBC_RX) && + ((vap->iv_vht_cap.vht_cap_info & IEEE80211_VHTCAP_RXSTBC_MASK) == 0)) + return EOPNOTSUPP; + + /* TX */ + if (ireq->i_val & IEEE80211_FVHT_STBC_TX) + ieee80211_syncflag_vht(vap, IEEE80211_FVHT_STBC_TX); + else + ieee80211_syncflag_vht(vap, -IEEE80211_FVHT_STBC_TX); + + /* RX */ + if (ireq->i_val & IEEE80211_FVHT_STBC_RX) + ieee80211_syncflag_vht(vap, IEEE80211_FVHT_STBC_RX); + else + ieee80211_syncflag_vht(vap, -IEEE80211_FVHT_STBC_RX); + error = ENETRESET; break; diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 53139a3852b8..94e8a05846e7 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -737,12 +737,20 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FVHT_USEVHT80 0x000000004 /* CONF: Use VHT80 */ #define IEEE80211_FVHT_USEVHT160 0x000000008 /* CONF: Use VHT160 */ #define IEEE80211_FVHT_USEVHT80P80 0x000000010 /* CONF: Use VHT 80+80 */ -#define IEEE80211_FVHT_MASK \ +#define IEEE80211_FVHT_STBC_TX 0x00000020 /* CONF: STBC tx enabled */ +#define IEEE80211_FVHT_STBC_RX 0x00000040 /* CONF: STBC rx enabled */ + +#define IEEE80211_FVHT_CHANWIDTH_MASK \ (IEEE80211_FVHT_VHT | IEEE80211_FVHT_USEVHT40 | \ IEEE80211_FVHT_USEVHT80 | IEEE80211_FVHT_USEVHT160 | \ IEEE80211_FVHT_USEVHT80P80) + +#define IEEE80211_FVHT_MASK \ + (IEEE80211_FVHT_CHANWIDTH_MASK | \ + IEEE80211_FVHT_STBC_TX | IEEE80211_FVHT_STBC_RX) + #define IEEE80211_VFHT_BITS \ - "\20\1VHT\2VHT40\3VHT80\4VHT160\5VHT80P80" + "\20\1VHT\2VHT40\3VHT80\4VHT160\5VHT80P80\6STBC_TX\7STBC_RX" #define IEEE80211_COM_DETACHED 0x00000001 /* ieee80211_ifdetach called */ #define IEEE80211_COM_REF_ADD 0x00000002 /* add / remove reference */ diff --git a/sys/net80211/ieee80211_vht.c b/sys/net80211/ieee80211_vht.c index 0839f426e09c..a05beb91216f 100644 --- a/sys/net80211/ieee80211_vht.c +++ b/sys/net80211/ieee80211_vht.c @@ -439,8 +439,7 @@ ieee80211_vht_get_vhtcap_ie(struct ieee80211_node *ni, IEEE80211_VHTCAP_RXSTBC_MASK); } val = MIN(val1, val2); - /* XXX For now, use the 11n config flag */ - if ((vap->iv_flags_ht & IEEE80211_FHT_STBC_TX) == 0) + if ((vap->iv_vht_flags & IEEE80211_FVHT_STBC_TX) == 0) val = 0; new_vhtcap |= _IEEE80211_SHIFTMASK(val, IEEE80211_VHTCAP_TXSTBC); @@ -453,8 +452,7 @@ ieee80211_vht_get_vhtcap_ie(struct ieee80211_node *ni, IEEE80211_VHTCAP_TXSTBC); } val = MIN(val1, val2); - /* XXX For now, use the 11n config flag */ - if ((vap->iv_flags_ht & IEEE80211_FHT_STBC_RX) == 0) + if ((vap->iv_vht_flags & IEEE80211_FVHT_STBC_RX) == 0) val = 0; new_vhtcap |= _IEEE80211_SHIFTMASK(val, IEEE80211_VHTCAP_RXSTBC_MASK);