Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4306542rwd; Sun, 4 Jun 2023 02:18:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5cw0cgiLIoxvJ+8TCMQKYsinJjyJZOErsEP7b452gSC0pRc2VzX4xK/YAd9wfdkkL/J7em X-Received: by 2002:a17:902:c40e:b0:1b0:25ab:a9eb with SMTP id k14-20020a170902c40e00b001b025aba9ebmr7230159plk.8.1685870326230; Sun, 04 Jun 2023 02:18:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685870326; cv=none; d=google.com; s=arc-20160816; b=t5ErqBEaZVUrFnMEE7KwoJtg/2nXSnFl8guT0QRFHZan3iQdS5umX0zkLao4zS3M7K Wyp4RH0Z7qQbpH8tVohpqkvY87rBSzvPxhVjSjB1ZBbFO3rlaPDp98pGbjMWS/ngfeNS qCcjI8w1bav9dD1xUwoEO4XjolAJ8xjqBgl/0W0ridBDBxxsuWDRxNHxEO6Bo5s/3H78 SqAA44Ah9kuyBxdsJH0QAOQ+5QnKjwQNdWK0QGsn56sOigr0OdBmTcUHWYiwuAYT/tP7 jm4mG8anyetwKVVqThGgNNuuAvNUv6rvnld12DusuhazCkElYdzQF1S446GCFw7EmQbw uBaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ufWjGGwssTXvoH4OEosmKtYuRTK3MSWI+QvGg2a1gHo=; b=cSNugYMgoie/1VxCh2G97PzcVm4Dp0OCiPaiLKOODYssK2c/Mmj/UYX/1Dp2MdSlDS T+tIcAwUrps3IzKMYOvPdP3q2aHRPCUmRe9b7C8UMMSaAQIrT91Qe83Uhg88A11KA/U2 3/QELFQyR9RORn22cAT14qD1dQXuiUOkm0eEeovCiib0c1zNHgsnBJMPLAyd4OjD7liG y9EFSZVKgor7p0CtTlS9Diw7qwEURyouvZbSNC3MLHrDBNDU9X8ij7D6s4atQMLqr5AM 2LlNfnLg9XrsUbmUtv52jzf5i1A3kT7Fqdf+AyeTZmv7qwDOH4MO6p5nNI0TOWYf+a7A EAqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nbh3XYoz; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a637d4e000000b005347d6bd7edsi3793069pgn.400.2023.06.04.02.18.37; Sun, 04 Jun 2023 02:18:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nbh3XYoz; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231162AbjFDJMA (ORCPT + 63 others); Sun, 4 Jun 2023 05:12:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231158AbjFDJL6 (ORCPT ); Sun, 4 Jun 2023 05:11:58 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CBF3E3 for ; Sun, 4 Jun 2023 02:11:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685869917; x=1717405917; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UtiKfALdwL26rTrCrAFSEV1TF56KhOcEbmoI8kUW3Fw=; b=nbh3XYozBzCoDBmA+R/o2MeFTfKrdsgu4W+Iut5Roo8UoSvoOKjkcT7I HwxFyaMTxZMlqgL/QFWCEXUdv/dHf/6F2K4XWPiXhHWh8thUUC40HKTzc 6Y9YBa1FjqezohfeID4+MTh9xpxtzSVGg7bQGNW8htRBvu2eqNXHrAN2o phtQkXe6+yqEfVNxtTWw8bUW4ulZjPFevPwy/KAJWvKzG/ZKwWS5E+LZS PjG81g4CZ6gfSWMdQwm6P4tsEV04PtrWAOZAYkaBKRXNRvt2bzImxjSG+ dgfFfzNhdnUtH28R12yp73ftD6nFTyFBHs4dtW3DqABWh5FUQS55cP74o A==; X-IronPort-AV: E=McAfee;i="6600,9927,10730"; a="336526501" X-IronPort-AV: E=Sophos;i="6.00,217,1681196400"; d="scan'208";a="336526501" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2023 02:11:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10730"; a="820804481" X-IronPort-AV: E=Sophos;i="6.00,217,1681196400"; d="scan'208";a="820804481" Received: from yfruchte-mobl3.ger.corp.intel.com (HELO ggreenma-mobl2.intel.com) ([10.214.219.60]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2023 02:11:55 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Emmanuel Grumbach , Gregory Greenman Subject: [PATCH 05/16] wifi: mac80211: provide a helper to fetch the medium synchronization delay Date: Sun, 4 Jun 2023 12:11:17 +0300 Message-Id: <20230604120651.b1043f3126e2.Iad3806f8bf8df07f52ef0a02cc3d0373c44a8c93@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230604091128.609335-1-gregory.greenman@intel.com> References: <20230604091128.609335-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Emmanuel Grumbach There are drivers which need this information. Signed-off-by: Emmanuel Grumbach Signed-off-by: Gregory Greenman --- include/linux/ieee80211.h | 35 +++++++++++++++++++++++++++++++++++ include/net/mac80211.h | 3 +++ net/mac80211/mlme.c | 5 ++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index fba4c44da832..516cd32d6196 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -4635,6 +4635,41 @@ static inline u8 ieee80211_mle_common_size(const u8 *data) return sizeof(*mle) + common + mle->variable[0]; } +/** + * ieee80211_mle_get_eml_sync_delay - returns the medium sync delay + * @data: pointer to the multi link EHT IE + * + * The element is assumed to be big enough. This must be checked by + * ieee80211_mle_size_ok(). + * If the medium synchronization can't be found (the type is not basic, or + * the medium sync presence bit is clear), 0 will be returned. + */ +static inline u16 ieee80211_mle_get_eml_med_sync_delay(const u8 *data) +{ + const struct ieee80211_multi_link_elem *mle = (const void *)data; + u16 control = le16_to_cpu(mle->control); + const u8 *common = mle->variable; + + if (u16_get_bits(control, IEEE80211_ML_CONTROL_TYPE) != + IEEE80211_ML_CONTROL_TYPE_BASIC) + return 0; + + /* common points now at the beginning of + * ieee80211_mle_basic_common_info + */ + common += sizeof(struct ieee80211_mle_basic_common_info); + + if (!(control & IEEE80211_MLC_BASIC_PRES_MED_SYNC_DELAY)) + return 0; + + if (control & IEEE80211_MLC_BASIC_PRES_LINK_ID) + common += 1; + if (control & IEEE80211_MLC_BASIC_PRES_BSS_PARAM_CH_CNT) + common += 1; + + return get_unaligned_le16(common); +} + /** * ieee80211_mle_get_eml_cap - returns the EML capability * @data: pointer to the multi link EHT IE diff --git a/include/net/mac80211.h b/include/net/mac80211.h index f75d941eece8..f4516c034da2 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -1791,6 +1791,8 @@ enum ieee80211_offload_flags { * offchannel/dynamic_ps operations. * @aid: association ID number, valid only when @assoc is true * @eml_cap: EML capabilities as described in P802.11be_D2.2 Figure 9-1002k. + * @eml_med_sync_delay: Medium Synchronization delay as described in + * P802.11be_D2.2 Figure 9-1002j. * @arp_addr_list: List of IPv4 addresses for hardware ARP filtering. The * may filter ARP queries targeted for other addresses than listed here. * The driver must allow ARP queries targeted for all address listed here @@ -1814,6 +1816,7 @@ struct ieee80211_vif_cfg { bool ps; u16 aid; u16 eml_cap; + u16 eml_med_sync_delay; __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; int arp_addr_cnt; diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 97671734427c..a404448eb84e 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -4862,9 +4862,12 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, /* data + 1 / datalen - 1 since it's an extended element */ if (eht_ml_elem && ieee80211_mle_size_ok(eht_ml_elem->data + 1, - eht_ml_elem->datalen - 1)) + eht_ml_elem->datalen - 1)) { sdata->vif.cfg.eml_cap = ieee80211_mle_get_eml_cap(eht_ml_elem->data + 1); + sdata->vif.cfg.eml_med_sync_delay = + ieee80211_mle_get_eml_med_sync_delay(eht_ml_elem->data + 1); + } } /* Allow VHT if at least one channel on the sband supports 80 MHz */ -- 2.38.1