From patchwork Mon Nov 7 21:23:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Itzkovitch X-Patchwork-Id: 13035302 X-Patchwork-Delegate: johannes@sipsolutions.net 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 AD5CFC433FE for ; Mon, 7 Nov 2022 21:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233137AbiKGVY4 (ORCPT ); Mon, 7 Nov 2022 16:24:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233424AbiKGVYf (ORCPT ); Mon, 7 Nov 2022 16:24:35 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B0B22F03E for ; Mon, 7 Nov 2022 13:24:05 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id h193so11574059pgc.10 for ; Mon, 07 Nov 2022 13:24:05 -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=/o5FCsZjB0k9oSFt888W97IJmFuVYvzneNfFQvShUoA=; b=Kg3XOtH86d4ACLOqR2y77ImlCLN6Is4VxnK63nK/vS59XKoCEMXPwhluJwKxW6Wt7i BXErj+1sW05WQ5sKOAKi+eoM1uIQ9BTo4+x/wSORPLnk54gScdpZLWgbb4OxqomR85JK Fi4vR9tvrzUn+SgypwJzKnP9HAGxyj6VaN0mHznmY13tuXBtaqINtcXajx9DgO0xGSFv Wj90H3ddvCgcN2GCZ2PNLlm4KJBrR+DzCdbDS++Izi2tXPodELny0T4ItkfS6x10ZaJD Mte5HovV6dScRribgHjaukSyPVXv+Rt3o1VV21hCthUlsz1P/qtXF4FkPIIjV1/O7Ajv Ljsw== 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=/o5FCsZjB0k9oSFt888W97IJmFuVYvzneNfFQvShUoA=; b=kC0cXeReBZWhzCBvDFX9sMisP8RsHteCXWM0l8HX6c3tXvewdmjGaOEcv+/fEYTEa8 e3Aoi9fgSk7ah5ygiX5zYeU7m7wBNsvsZ90PsRgvRbnbSYw0ERHd4IkNr8FhtgBeGUdA MoVwVknTZn+y/zFwqj4nkCy8bcnpxmJQR90TVUhnMlkmuFHmtoHF+PKQ8oW/qp5Ggg/W 5ilGyl7lh6ePxgJiSc17G9fGbmqefGObL33BtY7i4Pm+LhpUoDEB2PQPk29Kr1sH8UHG H1k+ezoUdeM6WvTV07ko/bysNOo7CSRsxdM6r7SCZkBnpG2gjEPs18lvMvz1N5TNn9WG Locg== X-Gm-Message-State: ACrzQf0W5kV3j8Mdt9X9ekeEPhQgoeNQDHbpcE47PKJBiX9vAYED/y+R eqPU8av2Om7UA1x+tjTMZwFXGw== X-Google-Smtp-Source: AMsMyM7pzOjgmF81XL/VVXARbU8uineQQsAShp96yqyDwwBpNk3OqbepyknoTQ9FTK8u5HVTWcvx5A== X-Received: by 2002:a62:5e06:0:b0:56b:e3f8:824f with SMTP id s6-20020a625e06000000b0056be3f8824fmr52843127pfb.84.1667856244934; Mon, 07 Nov 2022 13:24:04 -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 z10-20020aa79f8a000000b00560bb4a57f7sm5102356pfr.179.2022.11.07.13.24.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 13:24:04 -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 1/4] wifi: cfg80211: Add long_beacon_interval and short_beacon_tail Date: Tue, 8 Nov 2022 10:23:55 +1300 Message-Id: <20221107212358.272070-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(-) 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 Mon Nov 7 21:23:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Itzkovitch X-Patchwork-Id: 13035303 X-Patchwork-Delegate: johannes@sipsolutions.net 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 BD2D2C433FE for ; Mon, 7 Nov 2022 21:25:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232211AbiKGVZB (ORCPT ); Mon, 7 Nov 2022 16:25:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233220AbiKGVYk (ORCPT ); Mon, 7 Nov 2022 16:24:40 -0500 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7A422F66F for ; Mon, 7 Nov 2022 13:24:08 -0800 (PST) Received: by mail-pg1-x52d.google.com with SMTP id s196so11608517pgs.3 for ; Mon, 07 Nov 2022 13:24:08 -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=RM0lG+fj9X9NdzLvFBZpi+eiE8A7unHNU+MJkajS6is=; b=LTE6w12NwcenpNfXEb/h4ANwTdEzlgHhDcqQTle1FA5aKFsVaKvkOUcl2lsq0hEkRT 3UaVTXLtzeLeD0SQEpucI069xNGhO1/QkpXdaLSe9t3czGbdqXvM9GbceaD3XBe+Bzjt P6DBNN1pTIkBeXQwigXiPfN+PhsM2pg9v4zH1FWbokxHrpWms8ufCOe01xypKaWctBKr MftSiP7jR+cS5b8igKc0p5lIh6uC5cDtIlDhQLSl7BRDfifLvULfrKePMY/49ALik7/8 TL9eL/EyeD+Bcc4w8MDrHp7m3WYf+C18OHsHbdDDpeg7hzTCHkzjA0UXixVHnJ6ollOv i6jg== 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=RM0lG+fj9X9NdzLvFBZpi+eiE8A7unHNU+MJkajS6is=; b=hyJPHhv1eYYEUG12diiBHbTaCXSNv+3ofQnDV0L5dRl4QQzDTxzC9eXxSZiJq6GFPw InODZfMT37a9uAMyh3Q8Cn/PGkyprgYYOmk4VKKv4eUipfOkXG/QMA8r0nMBYlYKSwUW pI44Ahxv0QxqfrL9V0WOnU6KHYo/Qs1aGRYT1VOi65FecmJOJeo6aa+ptCqNWL7p+GQS HaZCUqnV0IDZutXbwEemPIicKhBP3+P0CyhYjbNSoB0Tgibc4EZ4AQVNnxQdBmRFae6m rbf/98b/ZrlDqjwmZDFYPVp5PguLlgA4ujCqEd0dCPNmvnFNbXzDvGIMxpasoSVEQq7A NrJA== X-Gm-Message-State: ACrzQf0VNmL4RlbLrGtB4H6cTBgq+0HylBpDxZG4YqZgaDv6SVoTjGZN RP7hsbsAaubb8R31RS47nIkM6g== X-Google-Smtp-Source: AMsMyM4TUpJldZzymfR8O2K2LJG/LzDQiXK8C7orgciqZzgmt2OqXGiYe7EHbNPCVWhYdD7Vod+Hiw== X-Received: by 2002:a05:6a00:2193:b0:56c:ea4c:6947 with SMTP id h19-20020a056a00219300b0056cea4c6947mr52646696pfi.27.1667856248206; Mon, 07 Nov 2022 13:24:08 -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 z10-20020aa79f8a000000b00560bb4a57f7sm5102356pfr.179.2022.11.07.13.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 13:24:07 -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 2/4] wifi: mac80211: S1G beacon/short beacon support Date: Tue, 8 Nov 2022 10:23:56 +1300 Message-Id: <20221107212358.272070-2-gilad.itzkovitch@morsemicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107212358.272070-1-gilad.itzkovitch@morsemicro.com> References: <20221107212358.272070-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 383e0242e95f..ff5ea7ab271b 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -5121,6 +5121,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) @@ -5158,7 +5170,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 Mon Nov 7 21:23:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Itzkovitch X-Patchwork-Id: 13035304 X-Patchwork-Delegate: johannes@sipsolutions.net 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 91CF7C4332F for ; Mon, 7 Nov 2022 21:25:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233167AbiKGVZF (ORCPT ); Mon, 7 Nov 2022 16:25:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233328AbiKGVYn (ORCPT ); Mon, 7 Nov 2022 16:24:43 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7A9EAE4D for ; Mon, 7 Nov 2022 13:24:11 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id v28so11857298pfi.12 for ; Mon, 07 Nov 2022 13:24:11 -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=eVy9tN1mditTF7Lve1iz7Hf+79NFNNEcVf6Ykvm6+8RmZupOX0jIaOzyq2Cw4WlMoU n0kYvkThuSO1qwEKqwyDzOZW4zOrVM+ftJOQRKU3EloDd8mTawgL09jrdypY2NaTmGTz It6ZZOfBl3bW5gB/GIBwa5J/Fo1XGMZZFBup40gKoGYuOjNKvAZKqYZv7aLMGMvaVARX kK8nJbOsxXq2S9qHpIPiFL3KNNF3t0Fjglo8tuoEq8sYOTV4vqPgIIu5bgq8t6lJTPTN /DY5R8GPTo1Tm6NBqKb0QS8yU6JffsY96a7Iy0t4Vy+vfaxzA3r2HMjIu7nVAB+9xSuq SC/g== 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=VyI+zpjrXSYZWG03tff2rFkmTVCHKCYZcvtGBSbk18NeJpPNzWWg8dmEuaB9iM+JUR gifHpDyFdowbvnRoiWrzvvSYYyNWCZEzcnr4wj4hC9PJxyw1/eWnSlAnDS4L4rOKtkod Oz9cz9cN/tf3MING2nYy5+hUHRynlBViILf8V69N6brrCyWlTImWBkWYLYgCvCyibBqH RUULME1F1tH3/QsURyzFiZoj6Wuxi6y8PV14MMcv857kf4BhqYWjaw3aBY5EymUPY1zL cGvetL2PZZEF7RAs9Q/7kMyS+/yJhBRyD88eGKx16PxqgBDVeMv83qVXV+n3f41sZDxr SS/A== X-Gm-Message-State: ACrzQf08Q9Ch1o2gyfqCBSSrhXsi8hsk0v7b77cVhNmMezQ4hq32eAzi fALB8wAw6un0XQYLCKYvi5wMLA== X-Google-Smtp-Source: AMsMyM5yI8gzGSz9QQYsCZcYzkHasuI2MZSlTS18aYp9v1YwoBouabEOOrb/QLlJPhluGEx9RxQR/Q== X-Received: by 2002:a65:6b8f:0:b0:46f:c6e0:e259 with SMTP id d15-20020a656b8f000000b0046fc6e0e259mr35518288pgw.521.1667856251451; Mon, 07 Nov 2022 13:24:11 -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 z10-20020aa79f8a000000b00560bb4a57f7sm5102356pfr.179.2022.11.07.13.24.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 13:24:10 -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 3/4] wifi: nl80211: update attributes netlink for S1G short beacon Date: Tue, 8 Nov 2022 10:23:57 +1300 Message-Id: <20221107212358.272070-3-gilad.itzkovitch@morsemicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107212358.272070-1-gilad.itzkovitch@morsemicro.com> References: <20221107212358.272070-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 Mon Nov 7 21:23:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Itzkovitch X-Patchwork-Id: 13035305 X-Patchwork-Delegate: johannes@sipsolutions.net 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 27D1FC43217 for ; Mon, 7 Nov 2022 21:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233299AbiKGVZI (ORCPT ); Mon, 7 Nov 2022 16:25:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232943AbiKGVYt (ORCPT ); Mon, 7 Nov 2022 16:24:49 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35FF4CE02 for ; Mon, 7 Nov 2022 13:24:15 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id m6so11914960pfb.0 for ; Mon, 07 Nov 2022 13:24: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:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0lk4Pp0Fz5Mba6FhFVSZeNtxpH20vTyuYMMbZGtqe5s=; b=LZ47W8Xh5mrhsYA+EDxxkMHYsz4bLd49jvOzhCMIF7UvlwUenHc6zATa9riZVqSA8d R9r81wZd6fKSUvn1RevZeDU0mJKqjggfCQf8EojXQsuWLlggnNJI7IDxHuvnM+Q54yqu ORMFwraSPnhFgHhxvEEE46DtEXOWDNWHdz0IulG2/RqEY1eAL+5onjVoOY4WRKgkX5HU gwREDWpKYUrl7jkrKhkeU8gpBec8CHdEEF7mGAnJ+LOUECclKmQp3hQZni91+4H34uJL BBCeeNCCu0AL+iGyPTcJ8qt0AqVQr0mllttf0+mvcI2VYgKLf4jLak7echDHBVR6XjHE p62w== 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=0lk4Pp0Fz5Mba6FhFVSZeNtxpH20vTyuYMMbZGtqe5s=; b=2DVXPPmgeUPPcErZ9uAbmY1lMr/oCf+UGUrytP7P1PnoOFJ9PMduCzJJ7cPSM9MOHZ bY49/EV7pzDUSczos9MV/rUROKwbRL4hV3FBxT9+POxKuw7rBdYij4qEivE7NiA6bSbj DDWoTkDF0Nt6J9rbLxybJLrlEnlpvibmP7feK5W4HrgmYqA3ou1Rqt2EN37Y7iNJ6liw Huaye/xB0qrlxMPvSIoPK619K3TdBge5rz3T+ZQ1Knw5nMZS7u+dtwXzjRw/JLREVZJk iK10MoeLC9jK6POgyMwnxr4zau+NaqkGaOLIfagjv9OFves3Xo8kPPZXDNdIt7OJ5vtl t+WQ== X-Gm-Message-State: ACrzQf23pUXOY1XULq/hkVC2SRhmLA0/kqH7MMLHUdkQIeCGYFDAsZMb ah3WSHtgy+lQxTNdK9xSa0Th6g== X-Google-Smtp-Source: AMsMyM61c4S4Skew9WKrKK69PLG7+A5Kqo3KEt+WJpepDrxOSAaCwPja6HiXPhRGAaGL4SuqZpaYhA== X-Received: by 2002:a63:cf48:0:b0:439:7d1c:fedc with SMTP id b8-20020a63cf48000000b004397d1cfedcmr44923490pgj.281.1667856254683; Mon, 07 Nov 2022 13:24:14 -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 z10-20020aa79f8a000000b00560bb4a57f7sm5102356pfr.179.2022.11.07.13.24.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 13:24: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 4/4] wifi: mac80211: support setting S1G short beacon period and tail Date: Tue, 8 Nov 2022 10:23:58 +1300 Message-Id: <20221107212358.272070-4-gilad.itzkovitch@morsemicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221107212358.272070-1-gilad.itzkovitch@morsemicro.com> References: <20221107212358.272070-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 | 24 ++++++++++++++++++++---- net/mac80211/ieee80211_i.h | 4 ++-- net/mac80211/tx.c | 4 +++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index a42abaa25273..acc8c881bd7b 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1091,8 +1091,8 @@ 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 size, err; + int new_head_len, new_tail_len, new_short_tail_len; + int size, size_short, 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 ff5ea7ab271b..f33e62d24151 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -5170,7 +5170,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)