From patchwork Wed Feb 10 11:07:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shay Bar X-Patchwork-Id: 1438919 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=jv8DGpIZ; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=celeno.com header.i=@celeno.com header.a=rsa-sha256 header.s=selector2 header.b=cGg6HB2m; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DbH7f6x1wz9sS8 for ; Wed, 10 Feb 2021 22:08:46 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:To:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TEzy/vKbtbzdOM0IEDZajiQQ5ERsgP8CMXbzZWvIQYs=; b=jv8DGpIZv9VZZUnGCDG27NMJCZ go3Z/L5uQ1lUA+YHtEKE9h7sWwwSFOA8zzw25me5s+58aPTUWPNmAIphGNqRpEdC5BTNKBlgQg9yv 4p+t6jztPQ0in+yjXHTZ9Qlg+KX9PmTwcjRYEFWqhXrF5s7t+LzFuKanbkoX7fLM+hD5FvrGVvm2T MXro6x9vHS8RAHd1CJExoUL1qQkQJ94gpVb3TnHAbUHzYStDckbbZyLNI8GZPJdb0TIwThrN3/zUX Rsi6uF867A2ohJckqye1jcQo40JKpMislAYx0D/IRLaXDGX0p+j6g6InXW+mtRgNmYgVJAnTizN1i tvRRcHjw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9nLY-0000hM-N6; Wed, 10 Feb 2021 11:07:48 +0000 Received: from mail-eopbgr30072.outbound.protection.outlook.com ([40.107.3.72] helo=EUR03-AM5-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9nLU-0000em-MS for hostap@lists.infradead.org; Wed, 10 Feb 2021 11:07:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g7+qzNFd3UJrEJgh4NlWZ3tCV1VwzscDJ1VhE3R0U+bAnSLB4f1T+I5J+Tc8E0ZOoajo9ThqZ1VhCMP1m8Q9Iwdxq4WeOCbmkQnsO+JEm+3cnFhS6PIDMOFPXbNGz7akHzMYFG1Mnlm5vMKSQC1tphgoqqlsLhTccI9YfjQcFPjyUpATcqeqniltMPy9rBYRATDH6QlyHezq2npZ3PlSl+GjcnxF3AhfltjkG4+gmgIlPWvoH9XuoV1PR3G8ZPbUWK+wGkf/5LJZbQwfroH9Il8SpTYMyNouE7n0ng8mC89Vy4U4MjijDmn8sbnvTt14TtgHL0Eam2c1cZOAsPkUrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6meq/dJ841jMdaF3p9P7AynMFysa9K86H6eWujJC5Ys=; b=ZeJaLInU/n/+0Wpz4IbMz42NE2yIsZfwIIX9pInFqLwrvQQXweJ8vVylyO4+gg3GISaK4thgfYCPLC0cc41hY8MyRZ78niqnwYsJHTSgNH3/1VT1ER3hruXAUG2UGC9+mrGb6cBhOeTyg25K5Tw1vkcCEn1EKteFhnKycPQAZCmeiUYc5WoBU+vDJUtuDJribD31SvmMKib0dOaCG0tYXJ+nOEo1VCwSQOpchh/y2EOGP/kSCdvrNtD2cqoNN+6QvMaZZIcOdo2iwc82OEFi1h+FjIzkvc7v4xJHEAjOicCodN+bw95sQ61iY8UEkdsPTlZHcc+4o6wYcNO6no9nzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=celeno.com; dmarc=pass action=none header.from=celeno.com; dkim=pass header.d=celeno.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=celeno.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6meq/dJ841jMdaF3p9P7AynMFysa9K86H6eWujJC5Ys=; b=cGg6HB2mizXTuePUDwaj3p5OFPDGlrPYY4xyx9TfzdMyONcmocILLv5RSZJ6SOdp20gT1pc4o4erCdeZk08uXUpwQLiAMHlC+qsqKDM+qtBstTOXnVnlohj7vOoD2RcsMoTPfg2MiylnM42BjxWkVLJD+/JEyh4o7g7H7bD04Hs= Authentication-Results: w1.fi; dkim=none (message not signed) header.d=none;w1.fi; dmarc=none action=none header.from=celeno.com; Received: from AM0P192MB0468.EURP192.PROD.OUTLOOK.COM (2603:10a6:208:45::15) by AM9P192MB1000.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:1fa::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Wed, 10 Feb 2021 11:07:33 +0000 Received: from AM0P192MB0468.EURP192.PROD.OUTLOOK.COM ([fe80::f46c:536b:3238:a27f]) by AM0P192MB0468.EURP192.PROD.OUTLOOK.COM ([fe80::f46c:536b:3238:a27f%5]) with mapi id 15.20.3825.030; Wed, 10 Feb 2021 11:07:33 +0000 From: Shay Bar To: Jouni Malinen , hostap@lists.infradead.org Subject: [PATCH 1/3] hostap: Remove the VHT naming from the element Date: Wed, 10 Feb 2021 13:07:17 +0200 Message-Id: <20210210110719.6007-2-shay.bar@celeno.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210210110719.6007-1-shay.bar@celeno.com> References: <20210210110719.6007-1-shay.bar@celeno.com> X-Originating-IP: [87.71.34.224] X-ClientProxiedBy: AM0PR02CA0025.eurprd02.prod.outlook.com (2603:10a6:208:3e::38) To AM0P192MB0468.EURP192.PROD.OUTLOOK.COM (2603:10a6:208:45::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (87.71.34.224) by AM0PR02CA0025.eurprd02.prod.outlook.com (2603:10a6:208:3e::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Wed, 10 Feb 2021 11:07:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62858f0a-adf4-48d8-45db-08d8cdb41083 X-MS-TrafficTypeDiagnostic: AM9P192MB1000: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wp3UrNmNx/LXFu90dW53VxkXKXuUYv8Uu6SUPqGoqQ8jw0Ydt3lVZS+QEI2tI5phaKJkJK/bkYBgxaRXzNcQNr/DPkq6oFLu2ii1Dz9SJ0fLeuWQQz+90BL6yFadp9CFruMUxevadNCPtbXe18aKhRIiKrEBPtrNebthZXVIdaS9/9fTrg409+ah9xFQ7T7YC6cCyOpgYMcxOK9OGAbvx7T2rwQbkUKwV0shrCOWMsQTv9xraA1YGqtTb+vErL0A4YEGgT70gbnV3V2Jd5lddqD3mSiLCbfC7TjnRqR1BPwf4+WqSCgT1ZCBAXBUFmny3X96GTSkXF1pyoZRKZZmr8fBo6UyKQpT385UjsOUEwva35g4CbF7ndMPvPUgqh38YLyA59TbrXMAIlH/r9ki5Dq7gquUljb4GV1qD7afvvsMlzADhTkkTOADwIB3igZqMqTCMaw3p4AKuL46bl+zFBJjYEQuak4Dya9svMwjLXx4l7dV5QrgBq4EOOMnZ4EeQWJ8frsD2DiJdF8Pk0sOlQHgDJ9wzIL/cINE2U6ALPQCmbL8FRIP4RYpnfEEa4J4NarPvnKlGuRYvSYal4IMEn/uTFkaBm/aud4dEFSu3KY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0P192MB0468.EURP192.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(366004)(2906002)(86362001)(44832011)(8676002)(1076003)(52116002)(6512007)(2616005)(956004)(186003)(16526019)(6486002)(5660300002)(83380400001)(26005)(6506007)(69590400011)(6666004)(66556008)(66476007)(66946007)(8936002)(36756003)(498600001)(781001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 3nQAnqCaREyNijK39YB8EJxMm2TsIi+EmvRJK4Of3V4RewBjq15wjgXBVyWKJ4Ig3RQ2yGY47toOd6MXVaXhyLHVy9fgXBRDbCVqj6RyawemeZCmEJIATCGljk7t03pnLohcKzOwixm/uuHhUJuRp6I+Jg3zI/pmUX7iGCBZcStpjwGtEq3/1dudJoJpZoHas0wmiPj9rLVU0er2Tsu1b/xI5IlY7GpxU1R39cnm2ffeQUOJQkb5wddDRiUbV5SzYKYic7HRZdO/0xKlrB2/b0HOnajZy93o4adonj+VukaL6fx60Ay5Kg90gXiSK2AXirSUfdaUyy2XG5koZbCziRzYd3z3UX+qXxxSHhHHCLztOSR3CD3DVaDyXFTGhIy459FxqWES/rYzAKHkMrqxutogzoiyzINFExJjYymQDa+EMqaV5GaE3GrAGR8e69ii1rqoMEf8/PZpA+P9Z9y0PtxvhGmtBkXoMbuuWyX/W+T5iqXn/hFjcLH6UWulSPYAxwJYMlKe3nKhn0eznDK5hPfZ8Q0I9J4/Dj4Oa62uDZKY6rCcgip0nF0YQWktkSY6L5WEPDI2PXdK85caJWzHLaEBWHj969O6pinRHcX8Rh8IpfldykURC+Ze7JmsSaObhNNjMo3Xq4vmeASHZxDrHWncWI5Fz++s++f1kP7KmrkgKyoGQQsz+cOL36MpDLalIBs8pg9U70rPanb43p1BQPLG81WSTPzSyU9GgkCnCuo5yWeaQgOZoTBsoL9iEd8F2bdhD2nTQEjO9WWjAsXqFXyvbXx2JvlXrgT0GWaRpKJORS80MMkxQcvn2PPnzFmvUFg6LTVmQsVQG8u0q9HyYXU6AF1Yxmkpm4iR6oWHB6N8Av03gY1tQQ+nORNNP0DtCTMCB363hnVOyaWhWUq1LIpzGZ6L9IDKpivDskq9jPDUrZXRRduuGBVHYaL+3FxpiCeRSRFQtAkhKGEzFcyaAKwKl80zlhIRJkzy4YQRv7IpCxswXs0kGQj/XDnJUqck7X6QW5z5hEQfqPu8yXsOieOoGW0KpPpgTitKcn/slbUaJ8J/NDpfwr+9hGFHPg+8L6GHD8Fz1mryV+3Q+VvgnIjJGLNmZWtm0ok1Ir1jtyrJsADPEkcUkZl/MOFWrWAtiKRKLIAMoK6cYvYFGTymlv0AIxp915XUxct9YeCsyHoLkAaNfniQACM1Rckdj1lyX21Wq1Gs7jSZFciiaDX81GBd9exDQij+jHxW9bNyQf68hoOGAHpaYMn2V7G5Oq5AmJBLt7SnF+Jw1ngQrCHOFeGv095ca2a2EY4ZCLHwKXHBMUmUQfPKpiMqkXNdXVwU X-OriginatorOrg: celeno.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62858f0a-adf4-48d8-45db-08d8cdb41083 X-MS-Exchange-CrossTenant-AuthSource: AM0P192MB0468.EURP192.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2021 11:07:32.9929 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f313103b-4c9f-4fd3-b5cf-b97f91c4afa8 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Z4dH4K2l397JkLRiuEc89PUCuTHpxGwFj0LlVGwguSs9uRr7xY1nBYRDzw6WQEI3J3mlDq7DZTkbXPW8DBox2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9P192MB1000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210210_060744_752772_9BC9FC90 X-CRM114-Status: GOOD ( 21.44 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [40.107.3.72 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.3.72 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org According to latest IEEE802.11 spec, Transmit Power Envelope element is also relevant to 11ax and is no longer called VHT Transmit Power Envelope. Remove the VHT naming from the element. move hostapd_eid_txpower_envelope() from ieee802_11_vht.c to ieee802_11.c. Signed-off-by: Shay Bar --- src/ap/ieee802_11.c | 112 +++++++++++++++++++++++++++++++++++ src/ap/ieee802_11_vht.c | 112 ----------------------------------- src/common/ieee802_11_defs.h | 2 +- 3 files changed, 113 insertions(+), 113 deletions(-) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 76a7ffa9e..13fa450df 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -6766,6 +6766,118 @@ void ieee802_11_rx_from_unknown(struct hostapd_data *hapd, const u8 *src, } +u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid) +{ + struct hostapd_iface *iface = hapd->iface; + struct hostapd_config *iconf = iface->conf; + struct hostapd_hw_modes *mode = iface->current_mode; + struct hostapd_channel_data *chan; + int dfs, i; + u8 channel, tx_pwr_count, local_pwr_constraint; + int max_tx_power; + u8 tx_pwr; + + if (!mode) + return eid; + + if (ieee80211_freq_to_chan(iface->freq, &channel) == NUM_HOSTAPD_MODES) + return eid; + + for (i = 0; i < mode->num_channels; i++) { + if (mode->channels[i].freq == iface->freq) + break; + } + if (i == mode->num_channels) + return eid; + + switch (iface->conf->vht_oper_chwidth) { + case CHANWIDTH_USE_HT: + if (iconf->secondary_channel == 0) { + /* Max Transmit Power count = 0 (20 MHz) */ + tx_pwr_count = 0; + } else { + /* Max Transmit Power count = 1 (20, 40 MHz) */ + tx_pwr_count = 1; + } + break; + case CHANWIDTH_80MHZ: + /* Max Transmit Power count = 2 (20, 40, and 80 MHz) */ + tx_pwr_count = 2; + break; + case CHANWIDTH_80P80MHZ: + case CHANWIDTH_160MHZ: + /* Max Transmit Power count = 3 (20, 40, 80, 160/80+80 MHz) */ + tx_pwr_count = 3; + break; + default: + return eid; + } + + /* + * Below local_pwr_constraint logic is referred from + * hostapd_eid_pwr_constraint. + * + * Check if DFS is required by regulatory. + */ + dfs = hostapd_is_dfs_required(hapd->iface); + if (dfs < 0) + dfs = 0; + + /* + * In order to meet regulations when TPC is not implemented using + * a transmit power that is below the legal maximum (including any + * mitigation factor) should help. In this case, indicate 3 dB below + * maximum allowed transmit power. + */ + if (hapd->iconf->local_pwr_constraint == -1) + local_pwr_constraint = (dfs == 0) ? 0 : 3; + else + local_pwr_constraint = hapd->iconf->local_pwr_constraint; + + /* + * A STA that is not an AP shall use a transmit power less than or + * equal to the local maximum transmit power level for the channel. + * The local maximum transmit power can be calculated from the formula: + * local max TX pwr = max TX pwr - local pwr constraint + * Where max TX pwr is maximum transmit power level specified for + * channel in Country element and local pwr constraint is specified + * for channel in this Power Constraint element. + */ + chan = &mode->channels[i]; + max_tx_power = chan->max_tx_power - local_pwr_constraint; + + /* + * Local Maximum Transmit power is encoded as two's complement + * with a 0.5 dB step. + */ + max_tx_power *= 2; /* in 0.5 dB steps */ + if (max_tx_power > 127) { + /* 63.5 has special meaning of 63.5 dBm or higher */ + max_tx_power = 127; + } + if (max_tx_power < -128) + max_tx_power = -128; + if (max_tx_power < 0) + tx_pwr = 0x80 + max_tx_power + 128; + else + tx_pwr = max_tx_power; + + *eid++ = WLAN_EID_TRANSMIT_POWER_ENVELOPE; + *eid++ = 2 + tx_pwr_count; + + /* + * Max Transmit Power count and + * Max Transmit Power units = 0 (EIRP) + */ + *eid++ = tx_pwr_count; + + for (i = 0; i <= tx_pwr_count; i++) + *eid++ = tx_pwr; + + return eid; +} + + u8 * hostapd_eid_wb_chsw_wrapper(struct hostapd_data *hapd, u8 *eid) { u8 bw, chan1, chan2 = 0; diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c index c925bf12c..d0370229c 100644 --- a/src/ap/ieee802_11_vht.c +++ b/src/ap/ieee802_11_vht.c @@ -167,118 +167,6 @@ static int check_valid_vht_mcs(struct hostapd_hw_modes *mode, } -u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid) -{ - struct hostapd_iface *iface = hapd->iface; - struct hostapd_config *iconf = iface->conf; - struct hostapd_hw_modes *mode = iface->current_mode; - struct hostapd_channel_data *chan; - int dfs, i; - u8 channel, tx_pwr_count, local_pwr_constraint; - int max_tx_power; - u8 tx_pwr; - - if (!mode) - return eid; - - if (ieee80211_freq_to_chan(iface->freq, &channel) == NUM_HOSTAPD_MODES) - return eid; - - for (i = 0; i < mode->num_channels; i++) { - if (mode->channels[i].freq == iface->freq) - break; - } - if (i == mode->num_channels) - return eid; - - switch (iface->conf->vht_oper_chwidth) { - case CHANWIDTH_USE_HT: - if (iconf->secondary_channel == 0) { - /* Max Transmit Power count = 0 (20 MHz) */ - tx_pwr_count = 0; - } else { - /* Max Transmit Power count = 1 (20, 40 MHz) */ - tx_pwr_count = 1; - } - break; - case CHANWIDTH_80MHZ: - /* Max Transmit Power count = 2 (20, 40, and 80 MHz) */ - tx_pwr_count = 2; - break; - case CHANWIDTH_80P80MHZ: - case CHANWIDTH_160MHZ: - /* Max Transmit Power count = 3 (20, 40, 80, 160/80+80 MHz) */ - tx_pwr_count = 3; - break; - default: - return eid; - } - - /* - * Below local_pwr_constraint logic is referred from - * hostapd_eid_pwr_constraint. - * - * Check if DFS is required by regulatory. - */ - dfs = hostapd_is_dfs_required(hapd->iface); - if (dfs < 0) - dfs = 0; - - /* - * In order to meet regulations when TPC is not implemented using - * a transmit power that is below the legal maximum (including any - * mitigation factor) should help. In this case, indicate 3 dB below - * maximum allowed transmit power. - */ - if (hapd->iconf->local_pwr_constraint == -1) - local_pwr_constraint = (dfs == 0) ? 0 : 3; - else - local_pwr_constraint = hapd->iconf->local_pwr_constraint; - - /* - * A STA that is not an AP shall use a transmit power less than or - * equal to the local maximum transmit power level for the channel. - * The local maximum transmit power can be calculated from the formula: - * local max TX pwr = max TX pwr - local pwr constraint - * Where max TX pwr is maximum transmit power level specified for - * channel in Country element and local pwr constraint is specified - * for channel in this Power Constraint element. - */ - chan = &mode->channels[i]; - max_tx_power = chan->max_tx_power - local_pwr_constraint; - - /* - * Local Maximum Transmit power is encoded as two's complement - * with a 0.5 dB step. - */ - max_tx_power *= 2; /* in 0.5 dB steps */ - if (max_tx_power > 127) { - /* 63.5 has special meaning of 63.5 dBm or higher */ - max_tx_power = 127; - } - if (max_tx_power < -128) - max_tx_power = -128; - if (max_tx_power < 0) - tx_pwr = 0x80 + max_tx_power + 128; - else - tx_pwr = max_tx_power; - - *eid++ = WLAN_EID_VHT_TRANSMIT_POWER_ENVELOPE; - *eid++ = 2 + tx_pwr_count; - - /* - * Max Transmit Power count and - * Max Transmit Power units = 0 (EIRP) - */ - *eid++ = tx_pwr_count; - - for (i = 0; i <= tx_pwr_count; i++) - *eid++ = tx_pwr; - - return eid; -} - - u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta, const u8 *vht_capab) { diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 4fdc3b2d9..87d01d58a 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -434,7 +434,7 @@ #define WLAN_EID_VHT_OPERATION 192 #define WLAN_EID_VHT_EXTENDED_BSS_LOAD 193 #define WLAN_EID_VHT_WIDE_BW_CHSWITCH 194 -#define WLAN_EID_VHT_TRANSMIT_POWER_ENVELOPE 195 +#define WLAN_EID_TRANSMIT_POWER_ENVELOPE 195 #define WLAN_EID_VHT_CHANNEL_SWITCH_WRAPPER 196 #define WLAN_EID_VHT_AID 197 #define WLAN_EID_VHT_QUIET_CHANNEL 198