From patchwork Wed Nov 9 00:37:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Itzkovitch X-Patchwork-Id: 623317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 436A1C433FE for ; Wed, 9 Nov 2022 00:38:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229503AbiKIAiR (ORCPT ); Tue, 8 Nov 2022 19:38:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiKIAiQ (ORCPT ); Tue, 8 Nov 2022 19:38:16 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80837627D1 for ; Tue, 8 Nov 2022 16:38:15 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id l22-20020a17090a3f1600b00212fbbcfb78so383981pjc.3 for ; Tue, 08 Nov 2022 16:38:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=morsemicro-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LGnKSAb0utOTqpbE10ROhaV2F0LRtl+HSL1xxabD1nM=; b=7yWawy2nxYrfsV4XADQriB8jLIQdqpIboaHxp/f0UkJrEQY0wxWZyHODLtySulsmnJ Ncg9svONxE1+Q7yW7WIo/KK52Y4mG8BXxFPbjFsAJVNDc8E4sTl46xHB9+/5d6FbyLNm k6sCG6KdyjOqQ1vTLBaOREZordeN+n4oBLl0SteIZD3n9FxzZBK2icx6c4b3tOyY1OTI 9fPk3isS05nfN0hV/d6guFBYCDfJvo5nb3OadPRpmMW37ieDqdlROyyL5bL4vAYpl8VY l2n5jUJmSx3h7ew/+Zbf0APzVcv6RA4bnMuUpjZzDvQvXr6F6nyQWltUEbmcpOwyTmcm PO1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LGnKSAb0utOTqpbE10ROhaV2F0LRtl+HSL1xxabD1nM=; b=y30YtPhYi/xuO9m1r7wK4IFpY+oReanAoUKtlOyItdwq5RayxWud5Nehg61ewvSVaw eRPmhP7lmSHdBBBTZALA4x1hRVYNX0WvbfF8oTZ5I1gfTSAuTR3Zk6wA01EzzbaShUeP tJir3LKkA11f3NinY94uQ5RLo2R9S2V8WJkWVlfYLVOqJXjXR5zOInSziKZ8YZAkC2DU V1zXrBUaQd6V8cA4hSr0i0PIKQeg4H/3Z4q4SeLd/3rY4qFh3upyiHyPFLGpY5BAzjGJ ZOv2ivzxACeyPuXsOjraVE2yBQcYzOhu7C9/gjHeQ17+HHttm49v6S7IYmI79rgw28PA BOSQ== X-Gm-Message-State: ACrzQf1zPnFhwwN3xL7a8TB0iSs0vuEi881v9/r6nuEyshz/myQm3xVH fQ/36CSjln1gjDKwYCSIYyLMLg== X-Google-Smtp-Source: AMsMyM5C0A1hJjb8z0uTHRg1Q6+G3/ycDca+m2eJXEOjNnUXeUJwNlpExygbtdQKOhBkZVPHdbsIZw== X-Received: by 2002:a17:902:8ecc:b0:188:5f4b:260e with SMTP id x12-20020a1709028ecc00b001885f4b260emr29638120plo.111.1667954295025; Tue, 08 Nov 2022 16:38:15 -0800 (PST) Received: from virs-pc-014.intranet.virscient.com (124-248-138-161.static.lightwire.co.nz. [124.248.138.161]) by smtp.gmail.com with ESMTPSA id n15-20020a170902e54f00b001714c36a6e7sm7502726plf.284.2022.11.08.16.38.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 16:38:14 -0800 (PST) From: Gilad Itzkovitch To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, quic_jjohnson@quicinc.com, Kieran Frewen , Gilad Itzkovitch Subject: [PATCH v2 1/4] wifi: cfg80211: Add long_beacon_interval and short_beacon_tail Date: Wed, 9 Nov 2022 13:37:24 +1300 Message-Id: <20221109003727.614882-1-gilad.itzkovitch@morsemicro.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Kieran Frewen Support variables to handle short beacon period and adding a separate tail for them. Signed-off-by: Kieran Frewen Co-developed-by: Gilad Itzkovitch Signed-off-by: Gilad Itzkovitch --- include/net/cfg80211.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) base-commit: 5c111ec204d15d1c7d00428b0afdda62ff118565 diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 11a370e64143..7f785b81b8e3 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1179,8 +1179,11 @@ struct cfg80211_mbssid_elems { * or %NULL if not changed * @tail: tail portion of beacon (after TIM IE) * or %NULL if not changed + * @short_tail: short tail portion of beacon (after TIM IE) + or %NULL if not changed * @head_len: length of @head * @tail_len: length of @tail + * @short_tail_len: length of @short_tail * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL * @beacon_ies_len: length of beacon_ies in octets * @proberesp_ies: extra information element(s) to add into Probe Response @@ -1207,7 +1210,7 @@ struct cfg80211_mbssid_elems { struct cfg80211_beacon_data { unsigned int link_id; - const u8 *head, *tail; + const u8 *head, *tail, *short_tail; const u8 *beacon_ies; const u8 *proberesp_ies; const u8 *assocresp_ies; @@ -1217,7 +1220,7 @@ struct cfg80211_beacon_data { struct cfg80211_mbssid_elems *mbssid_ies; s8 ftm_responder; - size_t head_len, tail_len; + size_t head_len, tail_len, short_tail_len; size_t beacon_ies_len; size_t proberesp_ies_len; size_t assocresp_ies_len; @@ -1328,7 +1331,7 @@ struct cfg80211_ap_settings { struct cfg80211_beacon_data beacon; - int beacon_interval, dtim_period; + int beacon_interval, dtim_period, short_beacon_period; const u8 *ssid; size_t ssid_len; enum nl80211_hidden_ssid hidden_ssid; From patchwork Wed Nov 9 00:37:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Itzkovitch X-Patchwork-Id: 624802 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42CCDC433FE for ; Wed, 9 Nov 2022 00:38:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229554AbiKIAiV (ORCPT ); Tue, 8 Nov 2022 19:38:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiKIAiT (ORCPT ); Tue, 8 Nov 2022 19:38:19 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B20B463159 for ; Tue, 8 Nov 2022 16:38:18 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id 4so15696145pli.0 for ; Tue, 08 Nov 2022 16:38:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=morsemicro-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s8fLhB7N3J1r4mUp3lzjhF1u0CrSA6Q2JXjotTecwRE=; b=OufF/yojHVARO+dLFRtys9JkIz3ukmHqpUlhGZhxgCLrmEbpIU3vmgFABuWxtt8aVO NuMmSPOKuHeZq+8x+rwtCW0edCc7dF8Laca1PsN3LlosEfHIOsgLjl19nh0lmxVOR7j1 f7Ua4BWsEVtY0hm7CXtGvtWdSVawVmM140Jgnb/LNGagrrBKD95XLB0iKWrAkfrFp4NZ kzbBhggsS7mzNev0tEYNTibOLW9MWbTpKnly8F/byjcjOGcDKZTfSjJYcmWf0fhs/JHN AogdCsMhlKIg0xfrZStJNwGEA1OP3olXHGwGlmNgTxyPjeO8gn65v6xicKDLdVch94Ml rgAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s8fLhB7N3J1r4mUp3lzjhF1u0CrSA6Q2JXjotTecwRE=; b=lV87XaRhknjbNBwxH4dOhYuAJshmfehEtRilKEbi0abWgul+I47IvtYwUt/pJuelIR /NCACTVEGV40lM4O5K6E2xDhdPy9wydyCtG0JYWmo5QKi90hsAjT1+oC0CSTqrvpBnZU il89Ozne1E2AoI9u8qbXr6tYLOh2GXPP3pTOtsutdxxd7DgTxXdcg0Ib/clCIeOk1QtL a3g90GOocsk3St2OSZ6RI763nbBeJuaeDrDoVS8LVSd8HDiPM0UwFZJCqrnJ3eJrdv6j J8kLu5C5h4nv6ARPdH3Ku/Y8VSlGI4HOKozDsuEbjlr1J/hIYSrNTbSw6a/9qxy6anxk pzGw== X-Gm-Message-State: ACrzQf1SEBCidDxJUOJHUlQstO2rXw5VTW6ZdTmmMVmt5hcU67qDspLm oW+FVdE1n8gjUQZ1fLu30zaC1A== X-Google-Smtp-Source: AMsMyM7gUoGlEGJV6d4fz0GlUNWVfsSADE3EKI5j6b0+b963qI5UvsFUK89A5hBmcB61ikxZeFUdnw== X-Received: by 2002:a17:902:c94b:b0:187:3da6:37ab with SMTP id i11-20020a170902c94b00b001873da637abmr39722840pla.50.1667954298245; Tue, 08 Nov 2022 16:38:18 -0800 (PST) Received: from virs-pc-014.intranet.virscient.com (124-248-138-161.static.lightwire.co.nz. [124.248.138.161]) by smtp.gmail.com with ESMTPSA id n15-20020a170902e54f00b001714c36a6e7sm7502726plf.284.2022.11.08.16.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 16:38:17 -0800 (PST) From: Gilad Itzkovitch To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, quic_jjohnson@quicinc.com, Kieran Frewen , Gilad Itzkovitch Subject: [PATCH v2 2/4] wifi: mac80211: S1G beacon/short beacon support Date: Wed, 9 Nov 2022 13:37:25 +1300 Message-Id: <20221109003727.614882-2-gilad.itzkovitch@morsemicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221109003727.614882-1-gilad.itzkovitch@morsemicro.com> References: <20221109003727.614882-1-gilad.itzkovitch@morsemicro.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Kieran Frewen If configured, use the S1G short beacon format. The S1G short beacon format includes a limited set of information elements. Signed-off-by: Kieran Frewen Co-developed-by: Gilad Itzkovitch Signed-off-by: Gilad Itzkovitch --- include/net/mac80211.h | 1 + net/mac80211/cfg.c | 1 + net/mac80211/ieee80211_i.h | 1 + net/mac80211/tx.c | 14 +++++++++++++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 721c450a9ccd..39faafde109a 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -674,6 +674,7 @@ struct ieee80211_bss_conf { bool enable_beacon; u8 dtim_period; u16 beacon_int; + u8 short_beacon_period; u16 assoc_capability; u64 sync_tsf; u32 sync_device_ts; diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index c848fe04dd44..a42abaa25273 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1308,6 +1308,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, } link_conf->dtim_period = params->dtim_period; + link_conf->short_beacon_period = params->short_beacon_period; link_conf->enable_beacon = true; link_conf->allow_p2p_go_ps = sdata->vif.p2p; link_conf->twt_responder = params->twt_responder; diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 63ff0d2524b6..2e1d829c548a 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -268,6 +268,7 @@ struct beacon_data { struct ieee80211_meshconf_ie *meshconf; u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM]; u8 cntdwn_current_counter; + u8 long_beacon_count; struct cfg80211_mbssid_elems *mbssid_ies; struct rcu_head rcu_head; }; diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index bb2e54610101..a12b32544a3a 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -5116,6 +5116,18 @@ ieee80211_beacon_get_ap(struct ieee80211_hw *hw, struct sk_buff *skb = NULL; u16 csa_off_base = 0; int mbssid_len; + bool is_short = false; + + if (vif->cfg.s1g) { + if (beacon->long_beacon_count == 0) { + is_short = false; + beacon->long_beacon_count = + vif->bss_conf.short_beacon_period - 1; + } else { + is_short = true; + beacon->long_beacon_count--; + } + } if (beacon->cntdwn_counter_offsets[0]) { if (!is_template) @@ -5153,7 +5165,7 @@ ieee80211_beacon_get_ap(struct ieee80211_hw *hw, csa_off_base = skb->len; } - if (beacon->tail) + if (beacon->tail && !is_short) skb_put_data(skb, beacon->tail, beacon->tail_len); if (ieee80211_beacon_protect(skb, local, sdata, link) < 0) From patchwork Wed Nov 9 00:37:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Itzkovitch X-Patchwork-Id: 623316 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F34CC4332F for ; Wed, 9 Nov 2022 00:38:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229564AbiKIAiX (ORCPT ); Tue, 8 Nov 2022 19:38:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbiKIAiW (ORCPT ); Tue, 8 Nov 2022 19:38:22 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E89DF327 for ; Tue, 8 Nov 2022 16:38:21 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id y13so15254502pfp.7 for ; Tue, 08 Nov 2022 16:38:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=morsemicro-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4qOLqzDQ0leWDK0S599u/0XvplBF43BD27gReNL8w/k=; b=R3cKBsfFh3KrVU3SYxB4tcpFsxBLfSRemjgV6+JL3gLUprCseBipvq3GlLE+V9DdWU S0xOmLarqge686WvPVDEHAtZRilVRxmaru2eHRJxzarT0dbcaL0M5O/NqGrYUN8jxten T2F5UTDO7Uif/DAlQZcTiti2fvw8thciq1aWs7AefykE2hcGU/kIbXGfEOQZ/X+PVu39 kDajZrOuafCy7wzGhp+hSX51Nl0/PWMfj1KhUujZYdxV0x179wkgc3gisAMuDE/Ml0NM U0TkhUCoDnhXB5SD3ltK9kPwcoShByH6Nrhk1q+/g2NYsaGY3hqE1FSTqXxS7j1a7tOJ qGlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4qOLqzDQ0leWDK0S599u/0XvplBF43BD27gReNL8w/k=; b=4RI9oolwScS08Rh9cVgPQoqp1cucHFEpNindFzk9QsWR4T8DV6FtpP+ukjJJS6bGzQ Dy67JvHD5AA6uoOhYdAyzl5NXKrOW3YC4YXU1+zXLPEX1wAMdysS0hPJHsU+x8T4E8Iv Cwf3IRJWzfFXoA53i5R3D9WoACB02/aDYUd0DD4nsK8roLNsQhqfeYt6TT6y97urkncx O8fxb5hJcCD6kvHuj69OMqSp19Yk6MgTgwMv98WRVtLQgJ1iaaI/Vvt9lV66w63F6wWU xAZlspELM7sWuq+2lyBYC1uLct+RE+CMnGDmNqYrYQMdotmQRcTPqKTR73jXhk40Yy07 UZAw== X-Gm-Message-State: ACrzQf3GgDDTBs1bwKS2jwzh4iDzL4Sy2PpM1fEf78DkswAT7tUCuh4r +Ii2y2g+d8T60/yDC+clJ5ERmXIx4QKW1w== X-Google-Smtp-Source: AMsMyM7tjPyoFAsAhI+DUXzLnZdTZyXme2wIXHi2gjrgRcx4sQCqPTuDGhaDgOx/LbqcJqMV8VM04A== X-Received: by 2002:a63:2364:0:b0:46f:5de2:30d1 with SMTP id u36-20020a632364000000b0046f5de230d1mr49421855pgm.304.1667954301435; Tue, 08 Nov 2022 16:38:21 -0800 (PST) Received: from virs-pc-014.intranet.virscient.com (124-248-138-161.static.lightwire.co.nz. [124.248.138.161]) by smtp.gmail.com with ESMTPSA id n15-20020a170902e54f00b001714c36a6e7sm7502726plf.284.2022.11.08.16.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 16:38:20 -0800 (PST) From: Gilad Itzkovitch To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, quic_jjohnson@quicinc.com, Kieran Frewen , Gilad Itzkovitch Subject: [PATCH v2 3/4] wifi: nl80211: update attributes netlink for S1G short beacon Date: Wed, 9 Nov 2022 13:37:26 +1300 Message-Id: <20221109003727.614882-3-gilad.itzkovitch@morsemicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221109003727.614882-1-gilad.itzkovitch@morsemicro.com> References: <20221109003727.614882-1-gilad.itzkovitch@morsemicro.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Kieran Frewen Add short beacon period and tail attributes for user configuration Signed-off-by: Kieran Frewen Co-developed-by: Gilad Itzkovitch Signed-off-by: Gilad Itzkovitch --- include/uapi/linux/nl80211.h | 9 +++++++++ net/wireless/nl80211.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index c14a91bbca7c..ef6318012965 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2751,6 +2751,10 @@ enum nl80211_commands { * the incoming frame RX timestamp. * @NL80211_ATTR_TD_BITMAP: Transition Disable bitmap, for subsequent * (re)associations. + * + * @NL80211_ATTR_SHORT_BEACON_PERIOD: S1G short beacon period in TUs. + * @NL80211_ATTR_SHORT_BEACON_TAIL: portion of the short beacon after the TIM. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -3280,6 +3284,9 @@ enum nl80211_attrs { NL80211_ATTR_RX_HW_TIMESTAMP, NL80211_ATTR_TD_BITMAP, + NL80211_ATTR_SHORT_BEACON_PERIOD, + NL80211_ATTR_SHORT_BEACON_TAIL, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -4963,6 +4970,7 @@ enum nl80211_bss_scan_width { * @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz * @NL80211_BSS_MLO_LINK_ID: MLO link ID of the BSS (u8). * @NL80211_BSS_MLD_ADDR: MLD address of this BSS if connected to it. + * @NL80211_BSS_SHORT_BEACON_PERIOD: S1G short beacon period in TUs * @__NL80211_BSS_AFTER_LAST: internal * @NL80211_BSS_MAX: highest BSS attribute */ @@ -4990,6 +4998,7 @@ enum nl80211_bss { NL80211_BSS_FREQUENCY_OFFSET, NL80211_BSS_MLO_LINK_ID, NL80211_BSS_MLD_ADDR, + NL80211_BSS_SHORT_BEACON_PERIOD, /* keep last */ __NL80211_BSS_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 148f66edb015..6a8b1e935d58 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -805,6 +805,11 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN), [NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG }, [NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT }, + [NL80211_ATTR_SHORT_BEACON_PERIOD] = { .type = NLA_U16 }, + [NL80211_ATTR_SHORT_BEACON_TAIL] = + NLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_ie_attr, + IEEE80211_MAX_DATA_LEN), + }; /* policy for the key attributes */ @@ -5440,6 +5445,12 @@ static int nl80211_parse_beacon(struct cfg80211_registered_device *rdev, haveinfo = true; } + if (attrs[NL80211_ATTR_SHORT_BEACON_TAIL]) { + bcn->short_tail = nla_data(attrs[NL80211_ATTR_SHORT_BEACON_TAIL]); + bcn->short_tail_len = nla_len(attrs[NL80211_ATTR_SHORT_BEACON_TAIL]); + haveinfo = true; + } + if (!haveinfo) return -EINVAL; @@ -5804,6 +5815,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]); params->dtim_period = nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]); + if (info->attrs[NL80211_ATTR_SHORT_BEACON_PERIOD]) + params->short_beacon_period = + nla_get_u32(info->attrs[NL80211_ATTR_SHORT_BEACON_PERIOD]) == 0 ? + 1 : nla_get_u32(info->attrs[NL80211_ATTR_SHORT_BEACON_PERIOD]); err = cfg80211_validate_beacon_int(rdev, dev->ieee80211_ptr->iftype, params->beacon_interval); From patchwork Wed Nov 9 00:37:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Itzkovitch X-Patchwork-Id: 624801 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41A46C4332F for ; Wed, 9 Nov 2022 00:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229691AbiKIAi3 (ORCPT ); Tue, 8 Nov 2022 19:38:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbiKIAi1 (ORCPT ); Tue, 8 Nov 2022 19:38:27 -0500 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 217FC21A5 for ; Tue, 8 Nov 2022 16:38:25 -0800 (PST) Received: by mail-pg1-x529.google.com with SMTP id s196so14837855pgs.3 for ; Tue, 08 Nov 2022 16:38:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=morsemicro-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fWr7+FtXB0DpYZhfjg0/57m9qZMBht3duwcWNgFxQfs=; b=6AguqwjG/j8PPqApZaF4IPjsuuLTj4V+AqmNgWx3X9u4bA36tKcNr5Fy0xt79S48sH z/HPfPwA22RW+tFhZmZe+jaO8C3kVUR8QN25jWN9msA++ep4STg6pmtOVWLxAwv4aTW2 93ZEe7kBtRLruQ+1siD1c2Q1GxJg3A+6l3Rks85LVOTucUjb5Dm0nIc3ZstNASHRmu1d e51RbYVH4YOkbg/YUlI/AXcEgkcXblLvzrbs4JMWSM11ylsL6yQQxyZMG09JwVYbAj83 5XzOzjSie4ANE455uSyIX+VFZkHMsygfA2Epa3bTiYrDVmORhehiMpqSIlZOGI/nmSOH zT/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fWr7+FtXB0DpYZhfjg0/57m9qZMBht3duwcWNgFxQfs=; b=E9yXSV9U2Na/M2hqVq4M0bdha4aQsroroYhL7/EI3ud+w2TsH9yegGl1oavPBgMw7L pcUUr/N/VmVCdKC/axT9ucYEkn5ENtFU2Q5O++XMeHxypg0S+SdA/jv6gLx70EjfSv7f kNnWGtbZieQQzr3yV430vIYa3wmg5xWo/4dgOXoVrOpjUXhTfKbbT6FK1mUQnOOSPK7c WL5lVI0NmGf4aUrm+77SzZA0na4xj77gVjoxMSBWTS3UsKLjpYLk3w6orD9EI1j9y3MR 3Z5l69kOE1QFqdiTaymVuujcgx7u/NiBqBKSw3PDP7z8pk3IGfQfzefr9lt3QNAE/6a+ MU4g== X-Gm-Message-State: ACrzQf0C9jy82uEo72pjm62hTwQb29JK58dG519K7m2ck2fXE0r1xxN4 hyeFNEZ84Anh0Oo+frpcu4dL7g== X-Google-Smtp-Source: AMsMyM5LlgceTu1In9hrmgEaIWgvoggkWneZPXQAHoDlfmURC6/0RMdzWcEFxukcSStuOZz+AUKoJw== X-Received: by 2002:a63:106:0:b0:460:64ce:51c4 with SMTP id 6-20020a630106000000b0046064ce51c4mr49533704pgb.17.1667954304669; Tue, 08 Nov 2022 16:38:24 -0800 (PST) Received: from virs-pc-014.intranet.virscient.com (124-248-138-161.static.lightwire.co.nz. [124.248.138.161]) by smtp.gmail.com with ESMTPSA id n15-20020a170902e54f00b001714c36a6e7sm7502726plf.284.2022.11.08.16.38.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 16:38:24 -0800 (PST) From: Gilad Itzkovitch To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, quic_jjohnson@quicinc.com, Kieran Frewen , Gilad Itzkovitch Subject: [PATCH v2 4/4] wifi: mac80211: support setting S1G short beacon period and tail Date: Wed, 9 Nov 2022 13:37:27 +1300 Message-Id: <20221109003727.614882-4-gilad.itzkovitch@morsemicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221109003727.614882-1-gilad.itzkovitch@morsemicro.com> References: <20221109003727.614882-1-gilad.itzkovitch@morsemicro.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Kieran Frewen With the kernel able to send both short and long S1G beacons, include the ability for setting the short beacon period. It also adds the support for distinguish short beacon tail. Signed-off-by: Kieran Frewen Co-developed-by: Gilad Itzkovitch Signed-off-by: Gilad Itzkovitch --- net/mac80211/cfg.c | 22 +++++++++++++++++++--- net/mac80211/ieee80211_i.h | 4 ++-- net/mac80211/tx.c | 4 +++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index a42abaa25273..09905f827b29 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1091,7 +1091,7 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, { struct cfg80211_mbssid_elems *mbssid = NULL; struct beacon_data *new, *old; - int new_head_len, new_tail_len; + int new_head_len, new_tail_len, new_short_tail_len; int size, err; u32 changed = BSS_CHANGED_BEACON; struct ieee80211_bss_conf *link_conf = link->conf; @@ -1115,7 +1115,13 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, else new_tail_len = old->tail_len; - size = sizeof(*new) + new_head_len + new_tail_len; + if (params->short_tail || !old) + /* params->tail_len will be zero for !params->tail */ + new_short_tail_len = params->short_tail_len; + else + new_short_tail_len = old->short_tail_len; + + size = sizeof(*new) + new_head_len + new_tail_len + new_short_tail_len; /* new or old multiple BSSID elements? */ if (params->mbssid_ies) { @@ -1142,9 +1148,12 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, new->tail = new->head + new_head_len; new->head_len = new_head_len; new->tail_len = new_tail_len; + new->short_tail = new->tail + new->tail_len; + new->short_tail_len = new_short_tail_len; + /* copy in optional mbssid_ies */ if (mbssid) { - u8 *pos = new->tail + new->tail_len; + u8 *pos = new->short_tail + new->short_tail_len; new->mbssid_ies = (void *)pos; pos += struct_size(new->mbssid_ies, elem, mbssid->cnt); @@ -1177,6 +1186,13 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, if (old) memcpy(new->tail, old->tail, new_tail_len); + /* copy in optional short tail */ + if (params->short_tail) + memcpy(new->short_tail, params->short_tail, new_short_tail_len); + else + if (old) + memcpy(new->short_tail, old->short_tail, new_short_tail_len); + err = ieee80211_set_probe_resp(sdata, params->probe_resp, params->probe_resp_len, csa, cca, link); if (err < 0) { diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 2e1d829c548a..ef58e6f74b52 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -263,8 +263,8 @@ struct ieee80211_color_change_settings { }; struct beacon_data { - u8 *head, *tail; - int head_len, tail_len; + u8 *head, *tail, *short_tail; + int head_len, tail_len, short_tail_len; struct ieee80211_meshconf_ie *meshconf; u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM]; u8 cntdwn_current_counter; diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index a12b32544a3a..b75817915def 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -5165,7 +5165,9 @@ ieee80211_beacon_get_ap(struct ieee80211_hw *hw, csa_off_base = skb->len; } - if (beacon->tail && !is_short) + if (beacon->short_tail && is_short) + skb_put_data(skb, beacon->short_tail, beacon->short_tail_len); + else if (beacon->tail && !is_short) skb_put_data(skb, beacon->tail, beacon->tail_len); if (ieee80211_beacon_protect(skb, local, sdata, link) < 0)