From patchwork Wed Apr 26 10:45:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 1774024 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=tIJnYFTv; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=infineon.com header.i=@infineon.com header.a=rsa-sha256 header.s=IFXMAIL header.b=go/XtUbW; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wb553QFz23vH for ; Wed, 26 Apr 2023 20:48:49 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=2T3f19ZWDU7KtrDs7HLif5ZZO9HUFvU7AQP6VHsxe+0=; b=tIJnYFTvKKclS7 0suftClCtPamw+LIb23E6hp+bc6k5dMmIjgNoQlP7uvTwncJrzeLiQPDRc0jHy3zfFgviRp9Qprst UjOXhtokxG1CWlMUsPMrYk7X0s8M87pB28uKPdi9oBDR+PC5DJWi/IcZOkUoJDvKAGuhQ2IpTHvXB 40eTpTo/H8l7+f3EVE1WE4ETBwtr3vvkHHrGS6QxXIlTdyLKIzHjhaRwlSrYbr2GSKZhfm+Kcmbvi utlEuh9wlthJ1Hlgz2vNQi89Uzhaq8dp8WFlzhvpTv150+4/Ju4q3qlYBuz7DWLEX0Dpxit5HRxCQ q7hCNIOeS6nHkWLvH1iw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1prcfz-003dlO-2E; Wed, 26 Apr 2023 10:47:07 +0000 Received: from smtp2.infineon.com ([2a00:18f0:1e00:4::4]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1prcfv-003dkW-0H for hostap@lists.infradead.org; Wed, 26 Apr 2023 10:47:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1682506023; x=1714042023; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=kSC7nb/BcE1dNCUJaMHp4nvY3mAAxx/ZkPHs2gwRpv8=; b=go/XtUbWvmnQjOXZmoAkLYJ+zTHXq+3vjivRpvlGazciDnLVy7ukuldh cRBYwOigX34x67xPWdCP4uLOEYSpsNHs2YNvJ+mV8biprgxvZrvx3yo35 LAMReF9eX+PXn7LCRmbj4lG952rmwWeywV2awZBSAdLlr1woUsvPTxWcF w=; X-IronPort-AV: E=McAfee;i="6600,9927,10691"; a="35646205" X-IronPort-AV: E=Sophos;i="5.99,227,1677538800"; d="scan'208";a="35646205" Received: from unknown (HELO MUCSE819.infineon.com) ([172.23.29.45]) by smtp2.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2023 12:46:54 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE819.infineon.com (172.23.29.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:46:53 +0200 Received: from ISCN5CG14747PP.blc.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:46:52 +0200 From: Gokul Sivakumar To: CC: Gokul Sivakumar , Vinoth Sampath , Double Lo , Ian Lin Subject: [PATCH v2 1/7] hostapd_cli: wpa_cli: introduce a CMD to dump the driver capability flags2 Date: Wed, 26 Apr 2023 16:15:56 +0530 Message-ID: <20230426104602.29853-1-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.161.6.196] X-ClientProxiedBy: MUCSE821.infineon.com (172.23.29.47) To MUCSE827.infineon.com (172.23.29.20) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230426_034703_448690_FEEF7CB6 X-CRM114-Status: GOOD ( 15.85 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Leverage the already available control socket cmd "DRIVER_FLAGS2" and dump the driver capab "flags2" bitmask on triggering the new CLI CMD "driver_flags2", similar to the already existing CLI CMD "dri [...] Content analysis details: (-5.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [2a00:18f0:1e00:4:0:0:0:4 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 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 Leverage the already available control socket cmd "DRIVER_FLAGS2" and dump the driver capab "flags2" bitmask on triggering the new CLI CMD "driver_flags2", similar to the already existing CLI CMD "driver_flags". $ hostapd_cli -i wlan0 driver_flags2 (OR) $ wpa_cli -i wlan0 driver_flags2 0000000000000020: BEACON_RATE_HE Also added driver capab "flags2" bitmask to the "status driver" CLI CMD result and other debug messages wherever only "flags" bitmask is printed. $ hostapd_cli -i wlan0 status driver (OR) $ wpa_cli -i wlan0 status driver ... capa.key_mgmt=0xf6f capa.enc=0xfef capa.auth=0x7 capa.flags=0x3a00fac4 capa.flags2=0x20 capa.rrm_flags=0x0 ... Populated the switch case in the driver_flag2_to_string() function with the full list of feature MACROs represented with the "flags2" bitmask. And renamed WPA_DRIVER_RADAR_DETECTED MACRO by including "FLAGS2" string in the name, as this common prefix is expected in all the driver flags. Doing this helps to return the FLAG2 name as a result for the CLI CMD "driver_flags2". Signed-off-by: Gokul Sivakumar --- hostapd/hostapd_cli.c | 7 +++++++ src/ap/dfs.c | 2 +- src/drivers/driver.h | 2 +- src/drivers/driver_common.c | 13 +++++++++++++ src/drivers/driver_nl80211.c | 2 ++ src/drivers/driver_nl80211_capa.c | 8 +++++--- src/drivers/driver_wext.c | 5 +++-- wpa_supplicant/wpa_cli.c | 8 ++++++++ 8 files changed, 40 insertions(+), 7 deletions(-) diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c index 95edea876..f9db9974e 100644 --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c @@ -1385,6 +1385,11 @@ static int hostapd_cli_cmd_driver_flags(struct wpa_ctrl *ctrl, int argc, return wpa_ctrl_command(ctrl, "DRIVER_FLAGS"); } +static int hostapd_cli_cmd_driver_flags2(struct wpa_ctrl *ctrl, int argc, + char *argv[]) +{ + return wpa_ctrl_command(ctrl, "DRIVER_FLAGS2"); +} #ifdef CONFIG_DPP @@ -1719,6 +1724,8 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = { " = send FTM range request"}, { "driver_flags", hostapd_cli_cmd_driver_flags, NULL, " = show supported driver flags"}, + { "driver_flags2", hostapd_cli_cmd_driver_flags2, NULL, + " = show supported driver flags2"}, #ifdef CONFIG_DPP { "dpp_qr_code", hostapd_cli_cmd_dpp_qr_code, NULL, "report a scanned DPP URI from a QR Code" }, diff --git a/src/ap/dfs.c b/src/ap/dfs.c index e8c5ec9ac..bfcbc1f09 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -34,7 +34,7 @@ dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel, static bool dfs_use_radar_background(struct hostapd_iface *iface) { - return (iface->drv_flags2 & WPA_DRIVER_RADAR_BACKGROUND) && + return (iface->drv_flags2 & WPA_DRIVER_FLAGS2_RADAR_BACKGROUND) && iface->conf->enable_background_radar; } diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 101f98a72..2932eff80 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2214,7 +2214,7 @@ struct wpa_driver_capa { /** Driver handles SA Query procedures in AP mode */ #define WPA_DRIVER_FLAGS2_SA_QUERY_OFFLOAD_AP 0x0000000000000200ULL /** Driver supports background radar/CAC detection */ -#define WPA_DRIVER_RADAR_BACKGROUND 0x0000000000000400ULL +#define WPA_DRIVER_FLAGS2_RADAR_BACKGROUND 0x0000000000000400ULL /** Driver supports secure LTF in STA mode */ #define WPA_DRIVER_FLAGS2_SEC_LTF_STA 0x0000000000000800ULL /** Driver supports secure RTT measurement exchange in STA mode */ diff --git a/src/drivers/driver_common.c b/src/drivers/driver_common.c index bbd1a7cef..ba28a6b27 100644 --- a/src/drivers/driver_common.c +++ b/src/drivers/driver_common.c @@ -356,6 +356,19 @@ const char * driver_flag2_to_string(u64 flag2) switch (flag2) { DF2S(CONTROL_PORT_RX); DF2S(CONTROL_PORT_TX_STATUS); + DF2S(SEC_LTF_AP); + DF2S(SEC_RTT_AP); + DF2S(PROT_RANGE_NEG_AP); + DF2S(BEACON_RATE_HE); + DF2S(BEACON_PROTECTION_CLIENT); + DF2S(OCV); + DF2S(AP_SME); + DF2S(SA_QUERY_OFFLOAD_AP); + DF2S(RADAR_BACKGROUND); + DF2S(SEC_LTF_STA); + DF2S(SEC_RTT_STA); + DF2S(PROT_RANGE_NEG_STA); + DF2S(MLO); } return "UNKNOWN"; #undef DF2S diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index eb25730c5..a6b842f85 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -10621,6 +10621,7 @@ static int wpa_driver_nl80211_status(void *priv, char *buf, size_t buflen) "capa.enc=0x%x\n" "capa.auth=0x%x\n" "capa.flags=0x%llx\n" + "capa.flags2=0x%llx\n" "capa.rrm_flags=0x%x\n" "capa.max_scan_ssids=%d\n" "capa.max_sched_scan_ssids=%d\n" @@ -10645,6 +10646,7 @@ static int wpa_driver_nl80211_status(void *priv, char *buf, size_t buflen) drv->capa.enc, drv->capa.auth, (unsigned long long) drv->capa.flags, + (unsigned long long) drv->capa.flags2, drv->capa.rrm_flags, drv->capa.max_scan_ssids, drv->capa.max_sched_scan_ssids, diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index b904398ca..59f45989e 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -677,7 +677,7 @@ static void wiphy_info_ext_feature_flags(struct wiphy_info_data *info, if (ext_feature_isset(ext_features, len, NL80211_EXT_FEATURE_RADAR_BACKGROUND)) - capa->flags2 |= WPA_DRIVER_RADAR_BACKGROUND; + capa->flags2 |= WPA_DRIVER_FLAGS2_RADAR_BACKGROUND; if (ext_feature_isset(ext_features, len, NL80211_EXT_FEATURE_SECURE_LTF)) { @@ -1551,9 +1551,11 @@ int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv) #endif /* CONFIG_DRIVER_NL80211_QCA */ wpa_printf(MSG_DEBUG, - "nl80211: key_mgmt=0x%x enc=0x%x auth=0x%x flags=0x%llx rrm_flags=0x%x probe_resp_offloads=0x%x max_stations=%u max_remain_on_chan=%u max_scan_ssids=%d", + "nl80211: key_mgmt=0x%x enc=0x%x auth=0x%x flags=0x%llx flags2=0x%llx rrm_flags=0x%x " + "probe_resp_offloads=0x%x max_stations=%u max_remain_on_chan=%u max_scan_ssids=%d", drv->capa.key_mgmt, drv->capa.enc, drv->capa.auth, - (unsigned long long) drv->capa.flags, drv->capa.rrm_flags, + (unsigned long long) drv->capa.flags, + (unsigned long long) drv->capa.flags2, drv->capa.rrm_flags, drv->capa.probe_resp_offloads, drv->capa.max_stations, drv->capa.max_remain_on_chan, drv->capa.max_scan_ssids); return 0; diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c index cf201fe86..b72c1f8c2 100644 --- a/src/drivers/driver_wext.c +++ b/src/drivers/driver_wext.c @@ -1660,9 +1660,10 @@ static int wpa_driver_wext_get_range(void *priv) drv->capa.max_scan_ssids = 1; wpa_printf(MSG_DEBUG, " capabilities: key_mgmt 0x%x enc 0x%x " - "flags 0x%llx", + "flags 0x%llx flags2 0x%llx", drv->capa.key_mgmt, drv->capa.enc, - (unsigned long long) drv->capa.flags); + (unsigned long long) drv->capa.flags, + (unsigned long long) drv->capa.flags2); } else { wpa_printf(MSG_DEBUG, "SIOCGIWRANGE: too old (short) data - " "assuming WPA is not supported"); diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index effc7b3bc..3dc1d779e 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -550,6 +550,11 @@ static int wpa_cli_cmd_driver_flags(struct wpa_ctrl *ctrl, int argc, return wpa_ctrl_command(ctrl, "DRIVER_FLAGS"); } +static int wpa_cli_cmd_driver_flags2(struct wpa_ctrl *ctrl, int argc, + char *argv[]) +{ + return wpa_ctrl_command(ctrl, "DRIVER_FLAGS2"); +} static int wpa_cli_cmd_get(struct wpa_ctrl *ctrl, int argc, char *argv[]) { @@ -3375,6 +3380,9 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = { { "driver_flags", wpa_cli_cmd_driver_flags, NULL, cli_cmd_flag_none, "= list driver flags" }, + { "driver_flags2", wpa_cli_cmd_driver_flags2, NULL, + cli_cmd_flag_none, + "= list driver flags2" }, { "logon", wpa_cli_cmd_logon, NULL, cli_cmd_flag_none, "= IEEE 802.1X EAPOL state machine logon" }, From patchwork Wed Apr 26 10:45:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 1774030 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=MotwNSbt; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=infineon.com header.i=@infineon.com header.a=rsa-sha256 header.s=IFXMAIL header.b=AFC7SnH8; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wcB2Hy4z23td for ; Wed, 26 Apr 2023 20:49:46 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3FX7Q1aSCd3OP0l/cpfh5zDCMGj37sHXvPYnzfnCUWc=; b=MotwNSbtPqy0lG q3f8VKd0nJ79mEtH/rdC0EYUwmDOiPrJYPlsh83+kSNbHFlBZ/c2VIz6/shtDlF0XtDkhThFmBabf K7Dxx741mgZjUsmVHlO0GFTJg9RXy7jSRt0PJXSKqkOElkLN+mqRBOrs8bL8ZbzC8N87tfc5BJuTi js2wmObIqJrYIuo8lfq6M4Pcjgs5LxdEkTVHTNUzvFx8Wgop3s6FiFty15yBKHVbZuIOQBubbUKgl xz9rS7WwjCyNvLGXF4PIzqk8Q4nU3Gup9cmbmd/Rbn8MMncVvqCIk+1/zR/82sw2kSzo4dEr0tYmR n6DkgHGsOF8TekjhJrww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1prch6-003dyV-0A; Wed, 26 Apr 2023 10:48:16 +0000 Received: from smtp14.infineon.com ([2a00:18f0:1e00:4::6]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1prch1-003dvL-1p for hostap@lists.infradead.org; Wed, 26 Apr 2023 10:48:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1682506092; x=1714042092; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=326Y+OqJGiiqXrUQr5iSIYXtvzLEXUqDkHQi/Nbrdp4=; b=AFC7SnH8H5sqTtqxGtYxstCwGPUnEvpbOzLkWFdQwCLOiy4zz3Dh61mo i5tpdZ2aTJbfYgBb8WWdfOBVn8ozK8kVsCL0YEBTSKKvQDY93VB4LxOhK 6mPLrKDqRF7EWjbQShSpA9/G6i5eGYCSiMtgi/4yCMAF9fPlkzO45WWsh c=; X-IronPort-AV: E=McAfee;i="6600,9927,10691"; a="10937020" X-IronPort-AV: E=Sophos;i="5.99,227,1677538800"; d="scan'208";a="10937020" Received: from unknown (HELO MUCSE814.infineon.com) ([172.23.29.40]) by smtp14.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2023 12:47:01 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE814.infineon.com (172.23.29.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:47:00 +0200 Received: from ISCN5CG14747PP.blc.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:46:59 +0200 From: Gokul Sivakumar To: CC: Gokul Sivakumar , Vinoth Sampath , Double Lo , Ian Lin Subject: [PATCH v2 2/7] TWT: Add support to offload TWT Session setup handling work to the driver Date: Wed, 26 Apr 2023 16:15:57 +0530 Message-ID: <20230426104602.29853-2-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426104602.29853-1-gokulkumar.sivakumar@infineon.com> References: <20230426104602.29853-1-gokulkumar.sivakumar@infineon.com> MIME-Version: 1.0 X-Originating-IP: [10.161.6.196] X-ClientProxiedBy: MUCSE821.infineon.com (172.23.29.47) To MUCSE827.infineon.com (172.23.29.20) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230426_034812_137441_8F777A7E X-CRM114-Status: GOOD ( 29.82 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: With "TWT_SETUP" control SOCK CMD interface currently available in the wpa_supplicant, it is currently possible to generate the TWT Setup Action frame with the desired TWT session params like SP, SI, [...] Content analysis details: (-5.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [2a00:18f0:1e00:4:0:0:0:6 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 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 With "TWT_SETUP" control SOCK CMD interface currently available in the wpa_supplicant, it is currently possible to generate the TWT Setup Action frame with the desired TWT session params like SP, SI, TWT Setup CMD type, Flow ID, Trigger/Non-Trigger based, Un-Announced/Announced session types, etc, without informing the TWT state machine in the low layer. Now introduce a new TWT Offload code path and then when the TWT Setup is triggered either through the "$ wpa_cli twt_setup" or directly though the control SOCK CMD "TWT_SETUP", fillup the generic TWT Setup param struct and pass it to the NL80211 driver interface file driver_nl80211.c, where the request could be passed down to the low layer. And the low layer can initiate a TWT Setup request while updating the TWT session negotiation handshake state machine as needed. Also introduce a driver capability flag "TWT_OFFLOAD" to inform about the capability of the low layer to handle the TWT related operations. For backward compatibility, as per current behaviour when wpa_suppicant is compiled with the build flag CONFIG_TESTING_OPTIONS=y, it continues to trigger the existing code path where TWT Setup Action frame is constructed by wpa_supplicant instead of offloading that work to the low layer. Example: To Initiate an Individual TWT Setup of type "Request" with service period 20.48 ms, Service interval 64 ms and session type "Trigger based", "Implicit", "Announced", run the following wpa_cli cmd, $ wpa_cli -i wlan0 twt_setup setup_cmd=0 min_twt=80 mantissa=8000 \ exponent=3 trigger=1 implicit=1 flow_type=0 control=0 Signed-off-by: Gokul Sivakumar --- src/drivers/driver.h | 29 +++++ src/drivers/driver_common.c | 1 + src/drivers/driver_nl80211.c | 35 ++++++ wpa_supplicant/ctrl_iface.c | 7 +- wpa_supplicant/driver_i.h | 10 ++ wpa_supplicant/twt.c | 187 +++++++++++++++++++++++++++++- wpa_supplicant/wpa_supplicant_i.h | 13 +++ 7 files changed, 275 insertions(+), 7 deletions(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 2932eff80..a7c6490f6 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2226,6 +2226,8 @@ struct wpa_driver_capa { #define WPA_DRIVER_FLAGS2_PROT_RANGE_NEG_STA 0x0000000000002000ULL /** Driver supports MLO in station/AP mode */ #define WPA_DRIVER_FLAGS2_MLO 0x0000000000004000ULL +/** Driver supports TWT offload */ +#define WPA_DRIVER_FLAGS2_TWT_OFFLOAD 0x0000000000008000ULL u64 flags2; #define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \ @@ -2922,6 +2924,27 @@ struct driver_sta_mlo_info { } links[MAX_NUM_MLD_LINKS]; }; +struct drv_setup_twt_params { + u8 dtok; + u64 twt; + u8 min_twt; + u8 exponent; + u16 mantissa; + u8 setup_cmd; + u8 requestor; + u8 trigger; + u8 implicit; + u8 flow_type; + u8 flow_id; + u8 bcast_twt_id; + u8 protection; + u8 twt_channel; + u8 control; + u8 negotiation_type; + u8 twt_info_frame_disabled; + u8 min_twt_unit; /* true - in TUs, false - in 256us */ +}; + /** * struct wpa_driver_ops - Driver interface API definition * @@ -5028,6 +5051,12 @@ struct wpa_driver_ops { const u8 *match, size_t match_len, bool multicast); #endif /* CONFIG_TESTING_OPTIONS */ + + /** + * setup_twt - Setup a TWT session + * @params: Setup TWT params + */ + int (*setup_twt)(void *priv, struct drv_setup_twt_params *params); }; /** diff --git a/src/drivers/driver_common.c b/src/drivers/driver_common.c index ba28a6b27..a1f0bd924 100644 --- a/src/drivers/driver_common.c +++ b/src/drivers/driver_common.c @@ -369,6 +369,7 @@ const char * driver_flag2_to_string(u64 flag2) DF2S(SEC_RTT_STA); DF2S(PROT_RANGE_NEG_STA); DF2S(MLO); + DF2S(TWT_OFFLOAD); } return "UNKNOWN"; #undef DF2S diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index a6b842f85..03b0ae606 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -13457,6 +13457,40 @@ static int testing_nl80211_radio_disable(void *priv, int disabled) #endif /* CONFIG_TESTING_OPTIONS */ +static int wpa_driver_nl80211_setup_twt(void *priv, struct drv_setup_twt_params *params) +{ + struct i802_bss *bss = priv; + struct wpa_driver_nl80211_data *drv = bss->drv; + int ret = -1; + + if (!(drv->capa.flags2 & WPA_DRIVER_FLAGS2_TWT_OFFLOAD)) + return ret; + + /* + * Call the Vendor implementation for initiating + * TWT Setup Request to the Vendor Driver + */ + + if (ret < 0) { + wpa_printf(MSG_DEBUG, + "nl80211: TWT Setup: Failed to invoke driver TWT setup function: %s", + strerror(-ret)); + } else { + wpa_printf(MSG_DEBUG, + "nl80211: TWT Setup: Neg Type: %d REQ Type: %d TWT: %lu min_twt: %d " + "exponent: %d mantissa: %d requestor: %d trigger: %d implicit: %d " + "flow_type: %d flow_id: %d bcast_twt_id: %d protection: %d " + "twt_channel: %d twt_info_frame_disabled: %d min_twt_unit: %d", + params->negotiation_type, params->setup_cmd, params->twt, + params->min_twt, params->exponent, params->mantissa, + params->requestor, params->trigger, params->implicit, + params->flow_type, params->flow_id, params->bcast_twt_id, + params->protection, params->twt_channel, + params->twt_info_frame_disabled, params->min_twt_unit); + } + + return ret; +} const struct wpa_driver_ops wpa_driver_nl80211_ops = { .name = "nl80211", @@ -13610,4 +13644,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = { .register_frame = testing_nl80211_register_frame, .radio_disable = testing_nl80211_radio_disable, #endif /* CONFIG_TESTING_OPTIONS */ + .setup_twt = wpa_driver_nl80211_setup_twt, }; diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 9abfeb216..7b8bd75c2 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -10319,6 +10319,8 @@ static int wpas_ctrl_resend_assoc(struct wpa_supplicant *wpa_s) #endif /* CONFIG_SME */ } +#endif /* CONFIG_TESTING_OPTIONS */ + static int wpas_ctrl_iface_send_twt_setup(struct wpa_supplicant *wpa_s, const char *cmd) @@ -10333,7 +10335,7 @@ static int wpas_ctrl_iface_send_twt_setup(struct wpa_supplicant *wpa_s, bool trigger = true; bool implicit = true; bool flow_type = true; - int flow_id = 0; + int flow_id = 0xFF; bool protection = false; u8 twt_channel = 0; u8 control = BIT(4); /* Control field (IEEE Std 802.11ax-2021, @@ -10404,6 +10406,7 @@ static int wpas_ctrl_iface_send_twt_setup(struct wpa_supplicant *wpa_s, control); } +#ifdef CONFIG_TESTING_OPTIONS static int wpas_ctrl_iface_send_twt_teardown(struct wpa_supplicant *wpa_s, const char *cmd) @@ -12706,12 +12709,14 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, sme_event_unprot_disconnect( wpa_s, wpa_s->bssid, NULL, WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA); +#endif /* CONFIG_TESTING_OPTIONS */ } else if (os_strncmp(buf, "TWT_SETUP ", 10) == 0) { if (wpas_ctrl_iface_send_twt_setup(wpa_s, buf + 9)) reply_len = -1; } else if (os_strcmp(buf, "TWT_SETUP") == 0) { if (wpas_ctrl_iface_send_twt_setup(wpa_s, "")) reply_len = -1; +#ifdef CONFIG_TESTING_OPTIONS } else if (os_strncmp(buf, "TWT_TEARDOWN ", 13) == 0) { if (wpas_ctrl_iface_send_twt_teardown(wpa_s, buf + 12)) reply_len = -1; diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index d707cf556..17530ac4d 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -1172,4 +1172,14 @@ wpas_drv_get_sta_mlo_info(struct wpa_supplicant *wpa_s, return wpa_s->driver->get_sta_mlo_info(wpa_s->drv_priv, mlo_info); } +static inline int +wpa_drv_setup_twt(struct wpa_supplicant *wpa_s, + struct drv_setup_twt_params *params) +{ + if (!wpa_s->driver->setup_twt) + return -1; + + return wpa_s->driver->setup_twt(wpa_s->drv_priv, params); +} + #endif /* DRIVER_I_H */ diff --git a/wpa_supplicant/twt.c b/wpa_supplicant/twt.c index 8ec2c85ac..3c126d455 100644 --- a/wpa_supplicant/twt.c +++ b/wpa_supplicant/twt.c @@ -16,7 +16,8 @@ #ifdef CONFIG_TESTING_OPTIONS /** - * wpas_twt_send_setup - Send TWT Setup frame (Request) to our AP + * wpas_twt_test_send_setup - Send TWT Setup frame (Request) to our AP + * by initiatng an Action frame constructed by the wpa_supplicant. * @wpa_s: Pointer to wpa_supplicant * @dtok: Dialog token * @exponent: Wake-interval exponent @@ -26,11 +27,11 @@ * Returns: 0 in case of success, negative error code otherwise * */ -int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, - int mantissa, u8 min_twt, int setup_cmd, u64 twt, - bool requestor, bool trigger, bool implicit, - bool flow_type, u8 flow_id, bool protection, - u8 twt_channel, u8 control) +int wpas_twt_test_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, + int mantissa, u8 min_twt, int setup_cmd, u64 twt, + bool requestor, bool trigger, bool implicit, + bool flow_type, u8 flow_id, bool protection, + u8 twt_channel, u8 control) { struct wpabuf *buf; u16 req_type = 0; @@ -95,6 +96,180 @@ int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, return ret; } +#endif /* CONFIG_TESTING_OPTIONS */ + + +/** + * wpas_twt_offload_send_setup - Send TWT Setup frame to our AP + * by offloading the responsibility of initiating TWT Teardown to the driver + * @wpa_s: Pointer to wpa_supplicant + * @dtok: Dialog token + * @exponent: Wake-interval exponent + * @mantissa: Wake-interval mantissa + * @min_twt: Minimum TWT wake duration in units of 256 usec + * @setup_cmd: 0 == request, 1 == suggest, etc. Table 9-297 + * @twt: Target Wake Time + * @requestor: Specify this is a TWT Requesting / Responding STA + * @trigger: Specify Trigger based / Non-Trigger based TWT Session + * @implicit: Specify Implicit / Explicit TWT session + * @flow_type: Specify Un-Announced / Announced TWT session + * @flow_id: Flow ID / Broacast TWT ID to be used in the TWT session + * @protection: Specifies whether Tx within SP is protected by RTS & CTS + * @twt_channel: Set by the HE SST non-AP STA + * @control: Control Field in the TWT Setup Action frame + * Returns: 0 in case of success, negative error code otherwise + * + */ +int wpas_twt_offload_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, + int mantissa, u8 min_twt, int setup_cmd, u64 twt, + bool requestor, bool trigger, bool implicit, + bool flow_type, u8 flow_id, bool protection, + u8 twt_channel, u8 control) +{ + int ret = 0; + struct drv_setup_twt_params params; + u8 negotiation_type, twt_info_frame_disabled, min_twt_unit; + + params.dtok = dtok; + params.min_twt = min_twt; + params.twt = twt; + params.requestor = requestor ? 1 : 0; + params.trigger = trigger ? 1 : 0; + params.implicit = implicit ? 1 : 0; + params.flow_type = flow_type ? 1 : 0; + params.protection = protection ? 1 : 0; + params.twt_channel = twt_channel; + + /* Initialize with an invalid TWT session ID - 0xFF */ + params.flow_id = 0xFF; + params.bcast_twt_id = 0xFF; + + if (wpa_s->wpa_state != WPA_COMPLETED || !wpa_s->current_ssid) { + wpa_printf(MSG_DEBUG, + "TWT offload: No connection - cannot send TWT Setup Request"); + return -ENOTCONN; + } + + /* exponent range - 0 to 31 */ + if (exponent >= 0 && exponent <= 0x1F) { + params.exponent = (u8)exponent; + } else { + wpa_printf(MSG_ERROR, + "TWT offload: setup cmd exponent %d not supported", + exponent); + ret = -EOPNOTSUPP; + goto fail; + } + + /* mantissa range - 1 to 65535 */ + if ((mantissa > 0) && (mantissa <= 0xFFFF)) { + params.mantissa = (u16)mantissa; + } else { + wpa_printf(MSG_ERROR, + "TWT offload: setup cmd mantissa %d not supported", + mantissa); + ret = -EOPNOTSUPP; + goto fail; + } + + /* Setup Command Field - IEEE 802.11ax-2021 Table 9-297 */ + if ((setup_cmd >= 0) && (setup_cmd <= 7)) { + params.setup_cmd = setup_cmd; + } else { + wpa_printf(MSG_ERROR, + "TWT offload: specified Setup cmd type not supported"); + ret = -EOPNOTSUPP; + goto fail; + } + + /* Control Field - IEEE 802.11ax-2021 Figure 9-687 */ + params.control = control; + /* NDP Paging Indicator : Bit 0 */ + /* Responder PM Mode : Bit 1 */ + negotiation_type = (control & 0xc) >> 2; /* Negotiation type : Bit 2-3 */ + twt_info_frame_disabled = (control & 0x10) >> 4;/* TWT Information Frame Disabled: Bit 4 */ + min_twt_unit = (control & 0x20) >> 5; /* Wake Duration Unit : Bit 5 */ + /* Reserved : Bit 6-7 */ + + /* Negotiation Type Field - IEEE 802.11ax-2021 Table 9.296a */ + switch (negotiation_type) { + case 0: /* Individual TWT */ + params.negotiation_type = negotiation_type; + params.flow_id = flow_id; + break; + case 1: /* Wake TBTT Negotiation */ + params.negotiation_type = negotiation_type; + break; + case 2: /* Broadcast TWT IE in Beacon */ + params.negotiation_type = negotiation_type; + break; + case 3: /* Broadcast TWT membership */ + params.negotiation_type = negotiation_type; + params.bcast_twt_id = flow_id; + break; + default: + wpa_printf(MSG_ERROR, + "TWT offload: specified Nego type not supported"); + ret = -EOPNOTSUPP; + goto fail; + } + + params.twt_info_frame_disabled = twt_info_frame_disabled; + params.min_twt_unit = min_twt_unit; /* 1 - in TUs, 0 - in 256us */ + + if (wpa_drv_setup_twt(wpa_s, ¶ms)) { + wpa_printf(MSG_ERROR, "TWT offload: Failed to send TWT Setup Request"); + ret = -ECANCELED; + goto fail; + } + +fail: + return ret; +} + + +/** + * wpas_twt_send_setup - Send TWT Setup frame to our AP + * @wpa_s: Pointer to wpa_supplicant + * @dtok: Dialog token + * @exponent: Wake-interval exponent + * @mantissa: Wake-interval mantissa + * @min_twt: Minimum TWT wake duration in units of 256 usec + * @setup_cmd: 0 == request, 1 == suggest, etc. Table 9-297 + * @twt: Target Wake Time + * @requestor: Specify this is a TWT Requesting / Responding STA + * @trigger: Specify Trigger based / Non-Trigger based TWT Session + * @implicit: Specify Implicit / Explicit TWT session + * @flow_type: Specify Un-Announced / Announced TWT session + * @flow_id: Flow ID / Broacast TWT ID to be used in the TWT session + * @protection: Specifies whether Tx within SP is protected by RTS & CTS + * @twt_channel: Set by the HE SST non-AP STA + * @control: Control Field in the TWT Setup Action frame + * Returns: 0 in case of success, negative error code otherwise + * + */ +int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, + int mantissa, u8 min_twt, int setup_cmd, u64 twt, + bool requestor, bool trigger, bool implicit, + bool flow_type, u8 flow_id, bool protection, + u8 twt_channel, u8 control) +{ +#ifdef CONFIG_TESTING_OPTIONS + return wpas_twt_test_send_setup(wpa_s, dtok, exponent, mantissa, + min_twt, setup_cmd, twt, requestor, + trigger, implicit, flow_type, + flow_id, protection, twt_channel, + control); +#endif /* CONFIG_TESTING_OPTIONS */ + + return wpas_twt_offload_send_setup(wpa_s, dtok, exponent, mantissa, + min_twt, setup_cmd, twt, requestor, + trigger, implicit, flow_type, + flow_id, protection, twt_channel, + control); +} + +#ifdef CONFIG_TESTING_OPTIONS /** * wpas_twt_send_teardown - Send TWT teardown request to our AP diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index d5b3dab67..6226c8725 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1658,6 +1658,19 @@ void add_freq(int *freqs, int *num_freqs, int freq); int wpas_get_op_chan_phy(int freq, const u8 *ies, size_t ies_len, u8 *op_class, u8 *chan, u8 *phy_type); +/* TWT functions */ +#ifdef CONFIG_TESTING_OPTIONS +int wpas_twt_test_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, + int mantissa, u8 min_twt, int setup_cmd, u64 twt, + bool requestor, bool trigger, bool implicit, + bool flow_type, u8 flow_id, bool protection, + u8 twt_channel, u8 control); +#endif /* CONFIG_TESTING_OPTIONS */ +int wpas_twt_offload_setup_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, + int mantissa, u8 min_twt, int setup_cmd, u64 twt, + bool requestor, bool trigger, bool implicit, + bool flow_type, u8 flow_id, bool protection, + u8 twt_channel, u8 control); int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, int mantissa, u8 min_twt, int setup_cmd, u64 twt, bool requestor, bool trigger, bool implicit, From patchwork Wed Apr 26 10:45:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 1774027 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=jAV6KL46; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=infineon.com header.i=@infineon.com header.a=rsa-sha256 header.s=IFXMAIL header.b=GsFCcpVf; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wc45mpXz23td for ; Wed, 26 Apr 2023 20:49:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8JqB/+Xx42tKRw3N1WjroXorBvt+bVuyxXHbfilfqzo=; b=jAV6KL46eH9Ejh sqoXgfKsaMyjKENb80UkCZEzglkB09OGO0K2ROxQkxGoqw5HOV3s/aqk+HSXzThsYmw7DW9CBhh4s l/01Pgm3gaAGJVLaYwn/0wXxzyDeqVsrka3dHaQmXKpyc0U53ea3o5VpYIdJnz54NfgyhN1QPyArw DZele03cEYdRjkrwCheFeQopiy394fku/SHTh27TcvLHiikJ4PB4xAn7GRL/M/+u0lG8yRWC/i4QZ hbDbBpNWAaldiSqDhZeAtkmtNlQaWCtC4v/5VDvOvGCwu/DC0iuFinBPP2Dcs33MjmfJBfnj4vstx b1ymCGhVOHTQwaK9djtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1prch4-003dxv-2U; Wed, 26 Apr 2023 10:48:14 +0000 Received: from smtp14.infineon.com ([2a00:18f0:1e00:4::6]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1prch1-003dvP-1p for hostap@lists.infradead.org; Wed, 26 Apr 2023 10:48:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1682506092; x=1714042092; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rqXFJLsVBEdZu5nU5+KI/B0G8corXB5orRNSOcTfGuo=; b=GsFCcpVfIjHmffJ8yZS06uOA5NdCdqoAzH1T0T5+rZzrKboKGZ26Jyuh EfGB3mDx0jdgubCxZdoXjuOG52bywtYLqncmWrSRuRIdJpateJVvb9g9N g+e6HJEs7W83PFyqmUfh5rJupDF3jXAdS3Pk9b9TZ8ivnGEaNA7QMwb3n o=; X-IronPort-AV: E=McAfee;i="6600,9927,10691"; a="10937025" X-IronPort-AV: E=Sophos;i="5.99,227,1677538800"; d="scan'208";a="10937025" Received: from unknown (HELO MUCSE812.infineon.com) ([172.23.29.38]) by smtp14.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2023 12:47:04 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE812.infineon.com (172.23.29.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:47:04 +0200 Received: from ISCN5CG14747PP.blc.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:47:02 +0200 From: Gokul Sivakumar To: CC: Gokul Sivakumar , Vinoth Sampath , Double Lo , Ian Lin Subject: [PATCH v2 3/7] TWT: Add support to offload TWT Session Teardown handling work to the driver Date: Wed, 26 Apr 2023 16:15:58 +0530 Message-ID: <20230426104602.29853-3-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426104602.29853-1-gokulkumar.sivakumar@infineon.com> References: <20230426104602.29853-1-gokulkumar.sivakumar@infineon.com> MIME-Version: 1.0 X-Originating-IP: [10.161.6.196] X-ClientProxiedBy: MUCSE821.infineon.com (172.23.29.47) To MUCSE827.infineon.com (172.23.29.20) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230426_034811_979468_02AC69F6 X-CRM114-Status: GOOD ( 25.74 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: With "TWT_TEARDOWN" control SOCK CMD interface currently available in the wpa_supplicant,it is currently possible to generate the TWT Teardown Action frame with the desired TWT session params like Neg [...] Content analysis details: (-5.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [2a00:18f0:1e00:4:0:0:0:6 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 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 With "TWT_TEARDOWN" control SOCK CMD interface currently available in the wpa_supplicant,it is currently possible to generate the TWT Teardown Action frame with the desired TWT session params like Negotiation Type, Flow ID, Bcast TWT ID,etc, without informing the TWT state machine in the low layer. Now introduce a new TWT Offload code path and then when the TWT Teardown is triggered either through the "$ wpa_cli twt_teardown" or directly though the control SOCK CMD "TWT_TEARDOWN", fillup the generic TWT Teardown param struct and pass it to the NL80211 driver interface file driver_nl80211.c, where the request could be passed down to the low layer. And the low layer can initiate a TWT Teardown while updating the TWT session negotiation handshake state machine as needed. For backward compatibility, as per current behaviour when wpa_suppicant is compiled with the build flag CONFIG_TESTING_OPTIONS=y, it triggers the existing code path where TWT Teardown Action frame is constructed by wpa_supplicant instead of offloading that work to the low layer. Example: To initiate an Individual TWT Teardown with flow ID "5", run the following wpa_cli cmd, $ wpa_cli -i wlan0 twt_teardown flags=5 control=0 Signed-off-by: Gokul Sivakumar --- src/drivers/driver.h | 13 +++++ src/drivers/driver_nl80211.c | 33 ++++++++++++ wpa_supplicant/ctrl_iface.c | 5 -- wpa_supplicant/driver_i.h | 10 ++++ wpa_supplicant/twt.c | 83 ++++++++++++++++++++++++++++++- wpa_supplicant/wpa_supplicant_i.h | 4 ++ 6 files changed, 141 insertions(+), 7 deletions(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index a7c6490f6..9edd3ba97 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2945,6 +2945,13 @@ struct drv_setup_twt_params { u8 min_twt_unit; /* true - in TUs, false - in 256us */ }; +struct drv_teardown_twt_params { + u8 negotiation_type; + u8 flow_id; + u8 bcast_twt_id; + u8 teardown_all_twt; +}; + /** * struct wpa_driver_ops - Driver interface API definition * @@ -5057,6 +5064,12 @@ struct wpa_driver_ops { * @params: Setup TWT params */ int (*setup_twt)(void *priv, struct drv_setup_twt_params *params); + + /** + * teardown_twt - Teardown the already negotiated TWT session + * @params: Teardown TWT params + */ + int (*teardown_twt)(void *priv, struct drv_teardown_twt_params *params); }; /** diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 03b0ae606..25ff98978 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -13492,6 +13492,38 @@ static int wpa_driver_nl80211_setup_twt(void *priv, struct drv_setup_twt_params return ret; } + +static int wpa_driver_nl80211_teardown_twt(void *priv, struct drv_teardown_twt_params *params) +{ + struct i802_bss *bss = priv; + struct wpa_driver_nl80211_data *drv = bss->drv; + int ret = -1; + + if (!(drv->capa.flags2 & WPA_DRIVER_FLAGS2_TWT_OFFLOAD)) + return ret; + + /* + * Call the Vendor implementation for initiating + * TWT Teardown Request to the Vendor Driver + */ + + if (ret) { + wpa_printf(MSG_DEBUG, + "nl80211: TWT Teardown: Failed to invoke driver " + "TWT teardown function: %s", + strerror(-ret)); + } else { + wpa_printf(MSG_DEBUG, + "nl80211: TWT Teardown: Neg Type: %d teardown_all_twt: %d " + "flow_id: %d bcast_twt_id: %d", + params->negotiation_type, params->teardown_all_twt, + params->flow_id, params->bcast_twt_id); + } + + return ret; +} + + const struct wpa_driver_ops wpa_driver_nl80211_ops = { .name = "nl80211", .desc = "Linux nl80211/cfg80211", @@ -13645,4 +13677,5 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = { .radio_disable = testing_nl80211_radio_disable, #endif /* CONFIG_TESTING_OPTIONS */ .setup_twt = wpa_driver_nl80211_setup_twt, + .teardown_twt = wpa_driver_nl80211_teardown_twt, }; diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 7b8bd75c2..06daea723 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -10406,7 +10406,6 @@ static int wpas_ctrl_iface_send_twt_setup(struct wpa_supplicant *wpa_s, control); } -#ifdef CONFIG_TESTING_OPTIONS static int wpas_ctrl_iface_send_twt_teardown(struct wpa_supplicant *wpa_s, const char *cmd) @@ -10421,8 +10420,6 @@ static int wpas_ctrl_iface_send_twt_teardown(struct wpa_supplicant *wpa_s, return wpas_twt_send_teardown(wpa_s, flags); } -#endif /* CONFIG_TESTING_OPTIONS */ - static int wpas_ctrl_vendor_elem_add(struct wpa_supplicant *wpa_s, char *cmd) { @@ -12716,14 +12713,12 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, } else if (os_strcmp(buf, "TWT_SETUP") == 0) { if (wpas_ctrl_iface_send_twt_setup(wpa_s, "")) reply_len = -1; -#ifdef CONFIG_TESTING_OPTIONS } else if (os_strncmp(buf, "TWT_TEARDOWN ", 13) == 0) { if (wpas_ctrl_iface_send_twt_teardown(wpa_s, buf + 12)) reply_len = -1; } else if (os_strcmp(buf, "TWT_TEARDOWN") == 0) { if (wpas_ctrl_iface_send_twt_teardown(wpa_s, "")) reply_len = -1; -#endif /* CONFIG_TESTING_OPTIONS */ } else if (os_strncmp(buf, "VENDOR_ELEM_ADD ", 16) == 0) { if (wpas_ctrl_vendor_elem_add(wpa_s, buf + 16) < 0) reply_len = -1; diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index 17530ac4d..587733395 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -1182,4 +1182,14 @@ wpa_drv_setup_twt(struct wpa_supplicant *wpa_s, return wpa_s->driver->setup_twt(wpa_s->drv_priv, params); } +static inline int +wpa_drv_teardown_twt(struct wpa_supplicant *wpa_s, + struct drv_teardown_twt_params *params) +{ + if (!wpa_s->driver->teardown_twt) + return -1; + + return wpa_s->driver->teardown_twt(wpa_s->drv_priv, params); +} + #endif /* DRIVER_I_H */ diff --git a/wpa_supplicant/twt.c b/wpa_supplicant/twt.c index 3c126d455..75ebfe56f 100644 --- a/wpa_supplicant/twt.c +++ b/wpa_supplicant/twt.c @@ -272,13 +272,14 @@ int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, #ifdef CONFIG_TESTING_OPTIONS /** - * wpas_twt_send_teardown - Send TWT teardown request to our AP + * wpas_twt_test_send_teardown - Send TWT teardown request to our AP + * by initiating an Action from constructed by wpa_supplicant * @wpa_s: Pointer to wpa_supplicant * @flags: The byte that goes inside the TWT Teardown element * Returns: 0 in case of success, negative error code otherwise * */ -int wpas_twt_send_teardown(struct wpa_supplicant *wpa_s, u8 flags) +int wpas_twt_test_send_teardown(struct wpa_supplicant *wpa_s, u8 flags) { struct wpabuf *buf; int ret = 0; @@ -315,3 +316,81 @@ int wpas_twt_send_teardown(struct wpa_supplicant *wpa_s, u8 flags) } #endif /* CONFIG_TESTING_OPTIONS */ + + +/** + * wpas_twt_offload_send_teardown - send TWT teardown request to our AP + * by offloading the responsibility of initiating TWT Teardown to the driver + * @wpa_s: pointer to wpa_supplicant + * @flags: the byte that goes inside the twt teardown element + * returns: 0 in case of success, negative error code otherwise + * + */ +int wpas_twt_offload_send_teardown(struct wpa_supplicant *wpa_s, u8 flags) +{ + int ret = 0; + struct drv_teardown_twt_params params; + u8 negotiation_type, flow_id, teardown_all_twt; + + if (wpa_s->wpa_state != WPA_COMPLETED || !wpa_s->current_ssid) { + wpa_printf(MSG_DEBUG, + "TWT offload: No connection - cannot send TWT Teardown Request"); + return -ENOTCONN; + } + + /* TWT Flow Field - IEEE 802.11ax-2021 Figure 9-965 */ + flow_id = flags & 0x07; /* Flow ID : Bit 0-2 */ + /* Reserved : Bit 3-4 */ + negotiation_type = (flags & 0x60) >> 5; /* Negotiation type : Bit 5-6 */ + teardown_all_twt = (flags & 0x80) >> 7; /* Teardown all TWT : Bit 7 */ + + /* Negotiation Type Field - IEEE 802.11ax-2021 Table 9.296a */ + switch (negotiation_type) { + case 0: /* Individual TWT */ + params.negotiation_type = negotiation_type; + params.flow_id = flow_id; + break; + case 1: /* Wake TBTT Negotiation */ + params.negotiation_type = negotiation_type; + break; + case 2: /* Broadcast TWT IE in Beacon */ + params.negotiation_type = negotiation_type; + break; + case 3: /* Broadcast TWT membership */ + params.negotiation_type = negotiation_type; + params.bcast_twt_id = flow_id; + break; + default: + wpa_printf(MSG_ERROR, + "TWT offload: specified Nego Type Not supported"); + ret = -EOPNOTSUPP; + goto fail; + } + + params.teardown_all_twt = teardown_all_twt; + + if (wpa_drv_teardown_twt(wpa_s, ¶ms)) { + wpa_printf(MSG_ERROR, "TWT offload: Failed to send TWT Teardown Request"); + ret = -ECANCELED; + goto fail; + } + +fail: + return ret; +} + +/** + * wpas_twt_send_teardown - send TWT teardown request to our AP + * @wpa_s: pointer to wpa_supplicant + * @flags: the byte that goes inside the twt teardown element + * returns: 0 in case of success, negative error code otherwise + * + */ +int wpas_twt_send_teardown(struct wpa_supplicant *wpa_s, u8 flags) +{ +#ifdef CONFIG_TESTING_OPTIONS + return wpas_twt_test_send_teardown(wpa_s, flags); +#endif /* CONFIG_TESTING_OPTIONS */ + + return wpas_twt_offload_send_teardown(wpa_s, flags); +} diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 6226c8725..9da15f7a2 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1676,6 +1676,10 @@ int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, bool requestor, bool trigger, bool implicit, bool flow_type, u8 flow_id, bool protection, u8 twt_channel, u8 control); +#ifdef CONFIG_TESTING_OPTIONS +int wpas_twt_test_send_teardown(struct wpa_supplicant *wpa_s, u8 flags); +#endif /* CONFIG_TESTING_OPTIONS */ +int wpas_twt_offload_send_teardown(struct wpa_supplicant *wpa_s, u8 flags); int wpas_twt_send_teardown(struct wpa_supplicant *wpa_s, u8 flags); void wpas_rrm_reset(struct wpa_supplicant *wpa_s); From patchwork Wed Apr 26 10:45:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 1774025 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=eXTSukxf; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=infineon.com header.i=@infineon.com header.a=rsa-sha256 header.s=IFXMAIL header.b=V7LNck4a; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wb54wG7z23vG for ; Wed, 26 Apr 2023 20:48:49 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C+4muAHaF8fGHpypmFGg6j9NFxb8eQK3RkOKNlTX5Dk=; b=eXTSukxfzM+8tq IcvvUMjwmXjlazf7f6M+tatNnLLfL/IIWf1uXrnkXi/zgGN+ku20LLl7EFWTSTCU39OlWUu/4IVHY F41AqAPaPXW2ocTMekdemp0f16Rl5KxVj/PnCtjCNcswYB4Izb9i97VcEi3fX0gcsWOb/7YMDFCRV TauJnL4+MeGBlr0NisjhNsY4AdcijNk9y9lpZl21mQ7gG477+7nkaNBT5y1jlWVDFvf60o4BOtObf mnoxG3nFpIIJUp1D2llE5NFOUdwzVQrcmn/iDc2S4xmtpjuyjmo3FCJLEMugkXhh/TBMpbtwbRXCL yrxKTw0U2tprg6T3uXbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1prcg3-003dmG-1H; Wed, 26 Apr 2023 10:47:11 +0000 Received: from smtp2.infineon.com ([2a00:18f0:1e00:4::4]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1prcfz-003dkW-1M for hostap@lists.infradead.org; Wed, 26 Apr 2023 10:47:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1682506028; x=1714042028; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RfPgdeWET8wqWeHzfV2zYOUjKCUdE1vHz+SuFSEi20Y=; b=V7LNck4ajf0EHlqVLJ5Xgf/z1mctkcgrZnCew5hVdBZEZWkjo29Q4mb5 mLR//s6DBXzZI2nTF4+oHkJ7Qn9FYU6zih9rjVgTyJ56NIAhf67I8A7W6 dvpoRC1OMOVz95VJ4XDibv0mNXdcw2BFUmxQEkHy21yeyVLXeRuIcB/cS s=; X-IronPort-AV: E=McAfee;i="6600,9927,10691"; a="35646254" X-IronPort-AV: E=Sophos;i="5.99,227,1677538800"; d="scan'208";a="35646254" Received: from unknown (HELO MUCSE805.infineon.com) ([172.23.29.31]) by smtp2.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2023 12:47:07 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE805.infineon.com (172.23.29.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:47:06 +0200 Received: from ISCN5CG14747PP.blc.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:47:05 +0200 From: Gokul Sivakumar To: CC: Gokul Sivakumar , Vinoth Sampath , Double Lo , Ian Lin Subject: [PATCH v2 4/7] nl80211: Introduce new Vendor header file for driver interface with IFX OUI Date: Wed, 26 Apr 2023 16:15:59 +0530 Message-ID: <20230426104602.29853-4-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426104602.29853-1-gokulkumar.sivakumar@infineon.com> References: <20230426104602.29853-1-gokulkumar.sivakumar@infineon.com> MIME-Version: 1.0 X-Originating-IP: [10.161.6.196] X-ClientProxiedBy: MUCSE821.infineon.com (172.23.29.47) To MUCSE827.infineon.com (172.23.29.20) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230426_034707_922005_BC3D7733 X-CRM114-Status: GOOD ( 21.21 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Use a new Vendor header file to maintain Infineon specific vendor subcmds, attributes and events. And the vendor subcmds and event NL80211 messages are nested under NL80211_CMD_VENDOR with IFX OUI. IFX OUI: 00:03:19 (Refer "Infineon AG" in https://standards-oui.ieee.org/) Content analysis details: (-5.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [2a00:18f0:1e00:4:0:0:0:4 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 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 Use a new Vendor header file to maintain Infineon specific vendor subcmds, attributes and events. And the vendor subcmds and event NL80211 messages are nested under NL80211_CMD_VENDOR with IFX OUI. IFX OUI: 00:03:19 (Refer "Infineon AG" in https://standards-oui.ieee.org/) And introduce a new build flag CONFIG_DRIVER_NL80211_IFX for Infineon WiFi. Signed-off-by: Gokul Sivakumar --- hostapd/defconfig | 3 + src/common/ifx_vendor.h | 118 +++++++++++++++++++++++++++++++++++++++ src/drivers/drivers.mak | 3 + src/drivers/drivers.mk | 3 + wpa_supplicant/defconfig | 3 + 5 files changed, 130 insertions(+) create mode 100644 src/common/ifx_vendor.h diff --git a/hostapd/defconfig b/hostapd/defconfig index a9eab4d9c..37499b4ee 100644 --- a/hostapd/defconfig +++ b/hostapd/defconfig @@ -21,6 +21,9 @@ CONFIG_DRIVER_NL80211=y # QCA vendor extensions to nl80211 #CONFIG_DRIVER_NL80211_QCA=y +# IFX vendor extensions to nl80211 +#CONFIG_DRIVER_NL80211_IFX=y + # driver_nl80211.c requires libnl. If you are compiling it yourself # you may need to point hostapd to your version of libnl. # diff --git a/src/common/ifx_vendor.h b/src/common/ifx_vendor.h new file mode 100644 index 000000000..729c01901 --- /dev/null +++ b/src/common/ifx_vendor.h @@ -0,0 +1,118 @@ +/* + * Infineon OUI and vendor specific assignments + * Copyright (c) 2023, Cypress Semiconductor Corporation (an Infineon company) + * + * This software may be distributed under the terms of the BSD license. + * See README for more details. + */ + +#ifndef IFX_VENDOR_H +#define IFX_VENDOR_H + +/* + * This file is a registry of identifier assignments from the Infineon + * OUI 00:03:19 for purposes other than MAC address assignment. New identifiers + * can be assigned through normal review process for changes to the upstream + * hostap.git repository. + */ +#define OUI_IFX 0x000319 + +/* + * enum ifx_nl80211_vendor_subcmds - IFX nl80211 vendor command identifiers + * + * @IFX_VENDOR_SCMD_UNSPEC: Reserved value 0 + * + * @IFX_VENDOR_SCMD_DCMD: Handle the Dongle commands triggered from the userspace utilities. + * These commands will be passed to the Dongle for processing. + * + * @IFX_VENDOR_SCMD_FRAMEBURST: Control the Frameburst feature. This feature allows more + * efficient use of the airtime between the transmitting and receiving WLAN devices. + * + * @IFX_VENDOR_SCMD_ACS: Configure the Automatic Channel Selection (ACS) feature. + * + * @IFX_VENDOR_SCMD_SET_MAC_P2P_DEV: Set MAC address for a P2P Discovery device. + * Uses Vendor attribute IFX_VENDOR_ATTR_MAC_ADDR to pass the MAC address. + * + * @IFX_VENDOR_SCMD_MUEDCA: Configure Multi User Enhanced Distrubuted Channel Access (MU-EDCA). + * + * @IFX_VENDOR_SCMD_LDPC: Enable support for handling Low Density Parity Check (LDPC) Coding + * in received payload. + * + * @IFX_VENDOR_SCMD_AMSDU: Control AMSDU aggregation for both TX & RX on all the TID queues. + * + * @IFX_VENDOR_SCMD_TWT: Configure Target Wake Time (TWT) Session with the needed parameters. + * + * @IFX_VENDOR_SCMD_OCE: Configure the Optimized Connectivity Experience (OCE) functionality + * related parameters. + * + * @IFX_VENDOR_SCMD_BSSCOLOR: Set BSS Color (1-63) for AP Mode operation in HE. + * + * @IFX_VENDOR_SCMD_RAND_MAC: Configure the Random MAC module. + * + * @IFX_VENDOR_SCMD_MBO: Configure Multi Band Operation (MBO) functionality related parameters. + * + * @IFX_VENDOR_SCMD_MPC: Control the Minimum Power Consumption (MPC) feature. + * This is a STA-only power saving feature and not related to 802.11 power save. + * + * @IFX_VENDOR_SCMD_GIANTRX: Allow handling RX MGMT Packts of size 1840 bytes. + * + * @IFX_VENDOR_SCMD_PFN_CONFIG: Send the Preferred Network (PFN) information to the Dongle + * + * @IFX_VENDOR_SCMD_PFN_STATUS: Fetch the Preferred Network (PFN) information from the Dongle + * through the driver. + * + * @IFX_VENDOR_SCMD_WNM: Configure the Wireless Network Management (WNM) 802.11v functionaltiy + * related parameters. + * + * @IFX_VENDOR_SCMD_MAX: This acts as a the tail of cmds list. + * Make sure it located at the end of the list. + */ +enum ifx_nl80211_vendor_subcmds { + IFX_VENDOR_SCMD_UNSPEC = 0, + IFX_VENDOR_SCMD_DCMD = 1, + /* Reserved 2-5 */ + IFX_VENDOR_SCMD_FRAMEBURST = 6, + /* Reserved 7-8 */ + IFX_VENDOR_SCMD_ACS = 9, + IFX_VENDOR_SCMD_SET_MAC_P2P_DEV = 10, + IFX_VENDOR_SCMD_MUEDCA = 11, + IFX_VENDOR_SCMD_LDPC = 12, + IFX_VENDOR_SCMD_AMSDU = 13, + IFX_VENDOR_SCMD_TWT = 14, + IFX_VENDOR_SCMD_OCE = 15, + IFX_VENDOR_SCMD_BSSCOLOR = 16, + IFX_VENDOR_SCMD_RAND_MAC = 17, + IFX_VENDOR_SCMD_MBO = 18, + IFX_VENDOR_SCMD_MPC = 19, + IFX_VENDOR_SCMD_GIANTRX = 20, + IFX_VENDOR_SCMD_PFN_CONFIG = 21, + IFX_VENDOR_SCMD_PFN_STATUS = 22, + /* Reserved 23-24 */ + IFX_VENDOR_SCMD_WNM = 25, + IFX_VENDOR_SCMD_MAX +}; + +/* + * enum ifx_vendor_attr - IFX nl80211 vendor attributes + * + * @IFX_VENDOR_ATTR_UNSPEC: Reserved value 0 + * + * @IFX_VENDOR_ATTR_LEN: Dongle Command Message Body Length. + * + * @IFX_VENDOR_ATTR_DATA: Dongle Commend Message Body. + * + * @IFX_VENDOR_ATTR_MAC_ADDR: Medium Access Control (MAC) address. + * + * @IFX_VENDOR_ATTR_MAX: This acts as a the tail of attrs list. + * Make sure it located at the end of the list. + */ +enum ifx_vendor_attr { + IFX_VENDOR_ATTR_UNSPEC = 0, + IFX_VENDOR_ATTR_LEN = 1, + IFX_VENDOR_ATTR_DATA = 2, + IFX_VENDOR_ATTR_MAC_ADDR = 3, + /* Reserved 4-10 */ + IFX_VENDOR_ATTR_MAX +}; + +#endif /* IFX_VENDOR_H */ diff --git a/src/drivers/drivers.mak b/src/drivers/drivers.mak index a03d4a034..fe2c5554f 100644 --- a/src/drivers/drivers.mak +++ b/src/drivers/drivers.mak @@ -50,6 +50,9 @@ DRV_OBJS += ../src/drivers/driver_nl80211_scan.o ifdef CONFIG_DRIVER_NL80211_QCA DRV_CFLAGS += -DCONFIG_DRIVER_NL80211_QCA endif +ifdef CONFIG_DRIVER_NL80211_IFX +DRV_CFLAGS += -DCONFIG_DRIVER_NL80211_IFX +endif NEED_SME=y NEED_AP_MLME=y NEED_NETLINK=y diff --git a/src/drivers/drivers.mk b/src/drivers/drivers.mk index 10eab6a92..03ec32da3 100644 --- a/src/drivers/drivers.mk +++ b/src/drivers/drivers.mk @@ -44,6 +44,9 @@ endif ifdef CONFIG_DRIVER_NL80211_BRCM DRV_CFLAGS += -DCONFIG_DRIVER_NL80211_BRCM endif +ifdef CONFIG_DRIVER_NL80211_IFX +DRV_CFLAGS += -DCONFIG_DRIVER_NL80211_IFX +endif NEED_SME=y NEED_AP_MLME=y NEED_NETLINK=y diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig index a4f20d439..03dba3465 100644 --- a/wpa_supplicant/defconfig +++ b/wpa_supplicant/defconfig @@ -34,6 +34,9 @@ CONFIG_DRIVER_NL80211=y # QCA vendor extensions to nl80211 #CONFIG_DRIVER_NL80211_QCA=y +# IFX vendor extensions to nl80211 +#CONFIG_DRIVER_NL80211_IFX=y + # driver_nl80211.c requires libnl. If you are compiling it yourself # you may need to point hostapd to your version of libnl. # From patchwork Wed Apr 26 10:46:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 1774028 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=wQxnPWck; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=infineon.com header.i=@infineon.com header.a=rsa-sha256 header.s=IFXMAIL header.b=VVxq1sNI; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wc46H34z23vG for ; Wed, 26 Apr 2023 20:49:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/yfU6cHw/bmUgGRkaX/T0bCH7X49DO10PDQdSl0XmCQ=; b=wQxnPWckjTHTnL 7wSJgt7Vs+nARLyE/qXv6+5PETcCsL3BX33iGZcxi7ewpZ3xXH9f1ABSwEyL7fKcQgJj5RWBfmNzr JSU7pujwHMhI25qA0Pftqo4HxO/lK+k7d5sdvNAltiZUu+vO+otJEk4DmcTFqZQ/GnejqIpBwxWss 2o+hLqCfWHt4IbMuYC//5/wWA+Zv1Rdi1s0xoUKX7vO7O/AZsS9dSFzi5tBWio8lN+3WfTakiyoB/ JN+S1lKx3WmUexfzpyPNVVNrnP3nQhAuFF/W/f4txpSbP13CDVd/xgghfzM1PC6kRJOutXUkzz2Gd onuLbvG4hnbwVatwaUHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1prch2-003dx6-2y; Wed, 26 Apr 2023 10:48:12 +0000 Received: from smtp11.infineon.com ([2a00:18f0:1e00:4::5]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1prcgy-003duw-20 for hostap@lists.infradead.org; Wed, 26 Apr 2023 10:48:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1682506088; x=1714042088; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TWV77CqCLEUP4gGsYek72yqaGTLm7jF6wJ5SZylYU4w=; b=VVxq1sNIphRj29W+pXBXfdL1WJk+32tivWVa7nq8BI3p6X7to5a4C2k5 IdGwfe4XO9pEUVYQL0SAGmRp+EErmGHua8D9vD3EctVX4SPL/zYFF7cf6 d2tKOnRVZ4JSintS3xkXUHe8t2tOwjJnyC0uJHRAYqsfDU/VcrwJFW/14 E=; X-IronPort-AV: E=McAfee;i="6600,9927,10691"; a="11849428" X-IronPort-AV: E=Sophos;i="5.99,227,1677538800"; d="scan'208";a="11849428" Received: from unknown (HELO MUCSE803.infineon.com) ([172.23.29.29]) by smtp11.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2023 12:47:09 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE803.infineon.com (172.23.29.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:47:09 +0200 Received: from ISCN5CG14747PP.blc.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:47:07 +0200 From: Gokul Sivakumar To: CC: Gokul Sivakumar , Vinoth Sampath , Double Lo , Ian Lin Subject: [PATCH v2 5/7] TWT: Use IFX Vendor path to offload TWT session setup to the low layer Date: Wed, 26 Apr 2023 16:16:00 +0530 Message-ID: <20230426104602.29853-5-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426104602.29853-1-gokulkumar.sivakumar@infineon.com> References: <20230426104602.29853-1-gokulkumar.sivakumar@infineon.com> MIME-Version: 1.0 X-Originating-IP: [10.161.6.196] X-ClientProxiedBy: MUCSE821.infineon.com (172.23.29.47) To MUCSE827.infineon.com (172.23.29.20) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230426_034809_127039_5F9D11FA X-CRM114-Status: GOOD ( 27.88 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Once the driver support for the TWT Vendor subcmd is identified, enable TWT Offload bit in the driver capability flag2, so that user space can offload the TWT session management responsibility to the [...] Content analysis details: (-5.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [2a00:18f0:1e00:4:0:0:0:5 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 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 Once the driver support for the TWT Vendor subcmd is identified, enable TWT Offload bit in the driver capability flag2, so that user space can offload the TWT session management responsibility to the driver. If the TWT Vendor path is enabled with CONFIG_DRIVER_NL80211_IFX=y, then in the generic WPA driver NL80211 setup TWT handler, construct the TWT Vendor subcmd, fill the parameters using the TWT vendor attributes and pass it down to the driver layer to offload TWT setup negotiation work to the driver. Signed-off-by: Gokul Sivakumar --- Changes in v2: - Moved the IFX_VENDOR_ATTR_TWT_PARAM_WAKE_TIME_OFFSET netlink attr declaration from the [PATCH 7/7] to here. This would with help with retaining the current enum ID number (5) for the WAKE_TIME_OFFSET attribute used by the driver, while not showing any enum re-numbering across commits in this patch series. - Updated the description of some of the netlink attributes in the enums. src/common/ifx_vendor.h | 226 ++++++++++++++++++++++++++++++ src/drivers/driver_nl80211.c | 93 ++++++++++++ src/drivers/driver_nl80211_capa.c | 13 ++ 3 files changed, 332 insertions(+) diff --git a/src/common/ifx_vendor.h b/src/common/ifx_vendor.h index 729c01901..69120bc2f 100644 --- a/src/common/ifx_vendor.h +++ b/src/common/ifx_vendor.h @@ -41,6 +41,7 @@ * @IFX_VENDOR_SCMD_AMSDU: Control AMSDU aggregation for both TX & RX on all the TID queues. * * @IFX_VENDOR_SCMD_TWT: Configure Target Wake Time (TWT) Session with the needed parameters. + * Uses Vendor attributes defined in the enum ifx_vendor_attr_twt. * * @IFX_VENDOR_SCMD_OCE: Configure the Optimized Connectivity Experience (OCE) functionality * related parameters. @@ -115,4 +116,229 @@ enum ifx_vendor_attr { IFX_VENDOR_ATTR_MAX }; +/* + * enum ifx_vendor_attr_twt - Attributes for the TWT vendor command + * + * @IFX_VENDOR_ATTR_TWT_UNSPEC: Reserved value 0 + * + * @IFX_VENDOR_ATTR_TWT_OPER: To specify the type of TWT operation + * to be performed. Uses attributes defined in enum ifx_twt_oper. + * + * @IFX_VENDOR_ATTR_TWT_PARAMS: Nester attributes representing the + * parameters configured for TWT. These parameters are defined in + * the enum ifx_vendor_attr_twt_param. + * + * @IFX_VENDOR_ATTR_TWT_MAX: This acts as a the tail of cmds list. + * Make sure it located at the end of the list. + */ +enum ifx_vendor_attr_twt { + IFX_VENDOR_ATTR_TWT_UNSPEC, + IFX_VENDOR_ATTR_TWT_OPER, + IFX_VENDOR_ATTR_TWT_PARAMS, + IFX_VENDOR_ATTR_TWT_MAX +}; + +/* + * enum ifx_twt_oper - TWT operation to be specified using the vendor + * attribute IFX_VENDOR_ATTR_TWT_OPER + * + * @IFX_TWT_OPER_UNSPEC: Reserved value 0 + * + * @IFX_TWT_OPER_SETUP: Setup a TWT session. Required parameters are + * obtained through the nested attrs under %IFX_VENDOR_ATTR_TWT_PARAMS. + * + * @IFX_TWT_OPER_MAX: This acts as a the tail of the list. + * Make sure it located at the end of the list. + */ +enum ifx_twt_oper { + IFX_TWT_OPER_UNSPEC, + IFX_TWT_OPER_SETUP, + IFX_TWT_OPER_MAX +}; + +/* + * enum ifx_vendor_attr_twt_param - TWT parameters + * + * @IFX_VENDOR_ATTR_TWT_PARAM_UNSPEC: Reserved value 0 + * + * @IFX_VENDOR_ATTR_TWT_PARAM_NEGO_TYPE: Specifies the type of Negotiation to be + * done during Setup. The four possible types are + * 0 - Individual TWT Negotiation + * 1 - Wake TBTT Negotiation + * 2 - Broadcast TWT in Beacon + * 3 - Broadcast TWT Membership Negotiation + * + * The possible values are defined in the enum ifx_twt_param_nego_type + * + * @IFX_VENDOR_ATTR_TWT_PARAM_SETUP_CMD_TYPE: Specifies the type of TWT Setup frame + * when sent by the TWT Requesting STA + * 0 - Request + * 1 - Suggest + * 2 - Demand + * + * when sent by the TWT Responding STA. + * 3 - Grouping + * 4 - Accept + * 5 - Alternate + * 6 - Dictate + * 7 - Reject + * + * The possible values are defined in the enum ifx_twt_oper_setup_cmd_type. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_DIALOG_TOKEN: Dialog Token used by the TWT Requesting STA to + * identify the TWT Setup request/response transaction. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_WAKE_TIME: Target Wake Time TSF at which the STA has to wake up. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_WAKE_TIME_OFFSET: Target Wake Time TSF Offset from current TSF + * in microseconds. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_MIN_WAKE_DURATION: Nominal Minimum TWT Wake Duration. + * Used along with %IFX_VENDOR_ATTR_TWT_PARAM_MIN_WAKE_DURATION_UNIT to derive Wake Duration. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_WAKE_INTVL_EXPONENT: TWT Wake Interval Exponent. + * Used along with %IFX_VENDOR_ATTR_TWT_PARAM_WAKE_INTVL_MANTISSA to derive Wake Interval. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_WAKE_INTVL_MANTISSA: TWT Wake Interval Mantissa. + * Used along with %IFX_VENDOR_ATTR_TWT_PARAM_WAKE_INTVL_EXPONENT to derive Wake Interval. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_REQUESTOR: Specify this is a TWT Requesting / Responding STA. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_TRIGGER: Specify Trigger based / Non-Trigger based TWT Session. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_IMPLICIT: Specify Implicit / Explicit TWT session. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_FLOW_TYPE: Specify Un-Announced / Announced TWT session. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_FLOW_ID: Flow ID is the unique identifier of an iTWT session. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_BCAST_TWT_ID: Broadcast TWT ID is the unique identifier of a + * bTWT session. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_PROTECTION: Specifies whether Tx within SP is protected. + * Set to 1 to indicate that TXOPs within the TWT SPs shall be initiated + * with a NAV protection mechanism, such as (MU) RTS/CTS or CTS-to-self frame; + * otherwise, it shall set it to 0. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_CHANNEL: TWT channel field which is set to 0, unless + * the HE STA sets up a subchannel selective transmission operation. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_TWT_INFO_FRAME_DISABLED: TWT Information frame RX handing + * disabled / enabled. + * + * @IFX_VENDOR_ATTR_TWT_PARAM_MIN_WAKE_DURATION_UNIT: Nominal Minimum TWT Wake Duration + * Unit. 0 represents unit in "256 usecs" and 1 represents unit in "TUs". + * + * @IFX_VENDOR_ATTR_TWT_PARAM_MAX: This acts as a the tail of the list. + * Make sure it located at the end of the list. + */ +enum ifx_vendor_attr_twt_param { + IFX_VENDOR_ATTR_TWT_PARAM_UNSPEC, + IFX_VENDOR_ATTR_TWT_PARAM_NEGO_TYPE, + IFX_VENDOR_ATTR_TWT_PARAM_SETUP_CMD_TYPE, + IFX_VENDOR_ATTR_TWT_PARAM_DIALOG_TOKEN, + IFX_VENDOR_ATTR_TWT_PARAM_WAKE_TIME, + IFX_VENDOR_ATTR_TWT_PARAM_WAKE_TIME_OFFSET, + IFX_VENDOR_ATTR_TWT_PARAM_MIN_WAKE_DURATION, + IFX_VENDOR_ATTR_TWT_PARAM_WAKE_INTVL_EXPONENT, + IFX_VENDOR_ATTR_TWT_PARAM_WAKE_INTVL_MANTISSA, + IFX_VENDOR_ATTR_TWT_PARAM_REQUESTOR, + IFX_VENDOR_ATTR_TWT_PARAM_TRIGGER, + IFX_VENDOR_ATTR_TWT_PARAM_IMPLICIT, + IFX_VENDOR_ATTR_TWT_PARAM_FLOW_TYPE, + IFX_VENDOR_ATTR_TWT_PARAM_FLOW_ID, + IFX_VENDOR_ATTR_TWT_PARAM_BCAST_TWT_ID, + IFX_VENDOR_ATTR_TWT_PARAM_PROTECTION, + IFX_VENDOR_ATTR_TWT_PARAM_CHANNEL, + IFX_VENDOR_ATTR_TWT_PARAM_TWT_INFO_FRAME_DISABLED, + IFX_VENDOR_ATTR_TWT_PARAM_MIN_WAKE_DURATION_UNIT, + IFX_VENDOR_ATTR_TWT_PARAM_MAX +}; + +/* + * enum ifx_twt_param_nego_type - TWT Session Negotiation Type Parameters + * + * @IFX_TWT_PARAM_NEGO_TYPE_ITWT: Individual TWT negotiation between TWT requesting STA + * and TWT responding STA or individual TWT announcement by TWT Responder + * + * @IFX_TWT_PARAM_NEGO_TYPE_WAKE_TBTT: Wake TBTT and Wake interval negotiation between + * TWT scheduled STA and TWT scheduling AP. + * + * @IFX_TWT_PARAM_NEGO_TYPE_BTWT_IE_BCN: Provide Broadcast TWT schedules to TWT scheduled + * STAs by including the TWT element in broadcast Managemnet frames sent by TWT + * scheduling AP. + * + * @IFX_TWT_PARAM_NEGO_TYPE_BTWT: Broadcast TWT negotiation between TWT requesting STA + * and TWT responding STA. Manage Memberships in broadcast TWT schedules by including + * the TWT element in individually addressed Management frames sent by either a TWT + * scheduled STA or a TWT scheduling AP. + * + * @IFX_TWT_PARAM_NEGO_TYPE_MAX: This acts as a the tail of the list. + * Make sure it located at the end of the list. + */ +enum ifx_twt_param_nego_type { + IFX_TWT_PARAM_NEGO_TYPE_INVALID = -1, + IFX_TWT_PARAM_NEGO_TYPE_ITWT = 0, + IFX_TWT_PARAM_NEGO_TYPE_WAKE_TBTT = 1, + IFX_TWT_PARAM_NEGO_TYPE_BTWT_IE_BCN = 2, + IFX_TWT_PARAM_NEGO_TYPE_BTWT = 3, + IFX_TWT_PARAM_NEGO_TYPE_MAX = 4 +}; + +/* + * enum ifx_vendor_attr_twt_param - TWT Session setup command types + * + * @IFX_TWT_OPER_SETUP_CMD_TYPE_REQUEST: A TWT requesting or TWT scheduled STA + * requests to join a TWT without specifying a target wake time. This type needs to + * be used only by the TWT requesting STA. + * + * @IFX_TWT_OPER_SETUP_CMD_TYPE_SUGGEST: A TWT requesting or TWT scheduled STA requests to + * join a TWT without specifying a target wake time. This type needs to be used only + * by the TWT requesting STA. + * + * @IFX_TWT_OPER_SETUP_CMD_TYPE_DEMAND: A TWT requesting or TWT scheduled STA requests to + * join a TWT and specifies a demanded set of TWT parameters. If the demanded set of + * TWT parameters is not accommodated by the responding STA or TWT scheduling AP, then + * the TWT requesting STA or TWT scheduled STA will reject the TWT setup. This type + * needs to be used only by the TWT requesting STA. + * + * @IFX_TWT_OPER_SETUP_CMD_TYPE_GROUPING: The TWT responding STA suggests TWT group + * parameters that are different from the suggested or demanded TWT parameters of the + * TWT requesting STA. This type needs to be used only by the S1G TWT Responding STA in + * case of ITWT Setup Negotiation. + * + * @IFX_TWT_OPER_SETUP_CMD_TYPE_ACCEPT: A TWT responding STA or TWT scheduling AP accepts + * the TWT request with the TWT parameters (see NOTE) indicated in the TWT element + * transmitted by the TWT requesting STA or TWT scheduled STA. This value is also used + * in unsolicited TWT responses. This needs type needs to be used only by the TWT + * responding STA. + * + * @IFX_TWT_OPER_SETUP_CMD_TYPE_ALTERNATE: A TWT responding STA or TWT scheduling AP suggests + * TWT parameters that are different from those suggested by the TWT requesting STA or + * TWT scheduled STA. This needs type needs to be used only by the TWT reponding STA. + * + * @IFX_TWT_OPER_SETUP_CMD_TYPE_DICTATE: A TWT responding STA or TWT scheduling AP indicates + * TWT parameters that are different from those suggested by the TWT requesting STA or + * TWT scheduled STA. This needs type needs to be used only by the TWT responding STA. + * + * @IFX_TWT_OPER_SETUP_CMD_TYPE_REJECT: A TWT responding STA or TWT scheduling AP rejects + * setup, or a TWT scheduling AP terminates an existing broadcast TWT, or a TWT + * scheduled STA terminates its membership in a broadcast TWT. + * + * @IFX_TWT_OPER_SETUP_CMD_TYPE_MAX: This acts as a the tail of the list. + * Make sure it located at the end of the list. + */ +enum ifx_twt_oper_setup_cmd_type { + IFX_TWT_OPER_SETUP_CMD_TYPE_INVALID = -1, + IFX_TWT_OPER_SETUP_CMD_TYPE_REQUEST = 0, + IFX_TWT_OPER_SETUP_CMD_TYPE_SUGGEST = 1, + IFX_TWT_OPER_SETUP_CMD_TYPE_DEMAND = 2, + IFX_TWT_OPER_SETUP_CMD_TYPE_GROUPING = 3, + IFX_TWT_OPER_SETUP_CMD_TYPE_ACCEPT = 4, + IFX_TWT_OPER_SETUP_CMD_TYPE_ALTERNATE = 5, + IFX_TWT_OPER_SETUP_CMD_TYPE_DICTATE = 6, + IFX_TWT_OPER_SETUP_CMD_TYPE_REJECT = 7, + IFX_TWT_OPER_SETUP_CMD_TYPE_MAX = 8 +}; + #endif /* IFX_VENDOR_H */ diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 25ff98978..f3da21177 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -28,6 +28,7 @@ #include "common/qca-vendor.h" #include "common/qca-vendor-attr.h" #include "common/brcm_vendor.h" +#include "common/ifx_vendor.h" #include "common/ieee802_11_defs.h" #include "common/ieee802_11_common.h" #include "common/wpa_common.h" @@ -13457,6 +13458,95 @@ static int testing_nl80211_radio_disable(void *priv, int disabled) #endif /* CONFIG_TESTING_OPTIONS */ +#ifdef CONFIG_DRIVER_NL80211_IFX +static int nl80211_ifx_setup_twt(struct wpa_driver_nl80211_data *drv, + struct drv_setup_twt_params *params) +{ + struct nl_msg *msg = NULL; + struct nlattr *data, *twt_param_attrs; + int ret = -1; + + if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) || + nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_IFX) || + nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, IFX_VENDOR_SCMD_TWT)) + goto fail; + + data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA); + if (!data) + goto fail; + + if (nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_OPER, IFX_TWT_OPER_SETUP)) + goto fail; + + twt_param_attrs = nla_nest_start(msg, IFX_VENDOR_ATTR_TWT_PARAMS); + if (!twt_param_attrs) + goto fail; + + if (nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_NEGO_TYPE, + params->negotiation_type) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_SETUP_CMD_TYPE, + params->setup_cmd) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_DIALOG_TOKEN, + params->dtok) || + + (params->twt && + nla_put_u64(msg, IFX_VENDOR_ATTR_TWT_PARAM_WAKE_TIME, + params->twt)) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_MIN_WAKE_DURATION, + params->min_twt) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_WAKE_INTVL_EXPONENT, + params->exponent) || + + nla_put_u16(msg, IFX_VENDOR_ATTR_TWT_PARAM_WAKE_INTVL_MANTISSA, + params->mantissa) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_REQUESTOR, + params->requestor) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_TRIGGER, + params->trigger) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_IMPLICIT, + params->implicit) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_FLOW_TYPE, + params->flow_type) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_FLOW_ID, + params->flow_id) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_BCAST_TWT_ID, + params->bcast_twt_id) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_PROTECTION, + params->protection) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_CHANNEL, + params->twt_channel) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_TWT_INFO_FRAME_DISABLED, + params->twt_info_frame_disabled) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_MIN_WAKE_DURATION_UNIT, + params->min_twt_unit)) + goto fail; + + nla_nest_end(msg, twt_param_attrs); + nla_nest_end(msg, data); + + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return ret; +fail: + nl80211_nlmsg_clear(msg); + nlmsg_free(msg); + return ret; +} +#endif /* CONFIG_DRIVER_NL80211_IFX */ + static int wpa_driver_nl80211_setup_twt(void *priv, struct drv_setup_twt_params *params) { struct i802_bss *bss = priv; @@ -13470,6 +13560,9 @@ static int wpa_driver_nl80211_setup_twt(void *priv, struct drv_setup_twt_params * Call the Vendor implementation for initiating * TWT Setup Request to the Vendor Driver */ +#ifdef CONFIG_DRIVER_NL80211_IFX + ret = nl80211_ifx_setup_twt(drv, params); +#endif if (ret < 0) { wpa_printf(MSG_DEBUG, diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 59f45989e..a53f0b9b3 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -17,6 +17,7 @@ #include "common/qca-vendor.h" #include "common/qca-vendor-attr.h" #include "common/brcm_vendor.h" +#include "common/ifx_vendor.h" #include "driver_nl80211.h" @@ -1099,6 +1100,18 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg) break; } #endif /* CONFIG_DRIVER_NL80211_BRCM */ + +#ifdef CONFIG_DRIVER_NL80211_IFX + } else if (vinfo->vendor_id == OUI_IFX) { + switch (vinfo->subcmd) { + case IFX_VENDOR_SCMD_TWT: + drv->capa.flags2 |= + WPA_DRIVER_FLAGS2_TWT_OFFLOAD; + wpa_printf(MSG_DEBUG, + "Enabled IFX TWT"); + break; + } +#endif /* CONFIG_DRIVER_NL80211_IFX */ } wpa_printf(MSG_DEBUG, "nl80211: Supported vendor command: vendor_id=0x%x subcmd=%u", From patchwork Wed Apr 26 10:50:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 1774033 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Q69FFcsN; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=infineon.com header.i=@infineon.com header.a=rsa-sha256 header.s=IFXMAIL header.b=iham10fi; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wf56tcTz23vF for ; Wed, 26 Apr 2023 20:51:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=AyBodjGQhp/V6TQrNPz3/fJDXfyDZDq8Jt173HK+UBY=; b=Q69FFcsNUNLyFL GKnwyFzKIHgK/i20/q/Oa9W1w8Imryo2pEezNS7wpe50L7VVmd9N4nlIzIqoyEcx3JxecTEkpdsdM QGhyD2eL/Etmhejoc/V0WTfVU3/Tm5wETrHlrCACrMn+OuXYAb7VWbTFUg75DaiOt5LcFjsHNV+N2 nmaGdAVwR5J//q4QVjWl1gL1oeeCns9mR77LA5hLoKZv41xDDD5ki+8rznJWNmRIlotkc44igJiMc xslemdAWIARYxBRaiMGTXj3TXZ6FRMSUg8Ya8uHogftMG9O5fI3/xGvm3ccMvlBzbVhIHcvJ4GzMv ney133uoitKk8/XfMGqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1prcjX-003f1x-26; Wed, 26 Apr 2023 10:50:47 +0000 Received: from smtp11.infineon.com ([2a00:18f0:1e00:4::5]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1prcjR-003ex4-33 for hostap@lists.infradead.org; Wed, 26 Apr 2023 10:50:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1682506242; x=1714042242; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=SJNb55VZjCXgqu7gjXvxrkL/reIAocTIGJtKFiL2lHw=; b=iham10ficXs5kVSlCGiDeQZhJRdyjwMRp0k/xD4sUgNog5NqXrIAz1Hk 2LQCHk7UAwqsiKRte1qFq01r94QoYue7Wu0aM0kwYqcXzZiCa8SQuaEFv xQCHC5lwqMofIN69D1UcexWL0aLz02vfuvlXjJnUsORimAB2wx7t1b9QQ 8=; X-IronPort-AV: E=McAfee;i="6600,9927,10691"; a="11849879" X-IronPort-AV: E=Sophos;i="5.99,227,1677538800"; d="scan'208";a="11849879" Received: from unknown (HELO MUCSE812.infineon.com) ([172.23.29.38]) by smtp11.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2023 12:50:39 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE812.infineon.com (172.23.29.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:50:38 +0200 Received: from ISCN5CG14747PP.blc.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:50:37 +0200 From: Gokul Sivakumar To: CC: Gokul Sivakumar , Vinoth Sampath , Double Lo , Ian Lin Subject: [PATCH v2 6/7] TWT: Use IFX Vendor path to offload TWT session Teardown to the low layer Date: Wed, 26 Apr 2023 16:20:23 +0530 Message-ID: <20230426105023.29969-1-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.161.6.196] X-ClientProxiedBy: MUCSE803.infineon.com (172.23.29.29) To MUCSE827.infineon.com (172.23.29.20) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230426_035042_437804_83E7E164 X-CRM114-Status: GOOD ( 15.76 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: If the IFX Vendor path is enabled with CONFIG_DRIVER_NL80211_IFX=y, then in the generic WPA driver NL80211 Teardown TWT handler, construct the TWT Vendor subcmd, fill the parameters using the TWT vend [...] Content analysis details: (-5.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [2a00:18f0:1e00:4:0:0:0:5 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 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 If the IFX Vendor path is enabled with CONFIG_DRIVER_NL80211_IFX=y, then in the generic WPA driver NL80211 Teardown TWT handler, construct the TWT Vendor subcmd, fill the parameters using the TWT vendor attributes and pass it down to the driver layer to offload TWT session teardown work to the driver. Signed-off-by: Gokul Sivakumar --- src/common/ifx_vendor.h | 8 ++++++ src/drivers/driver_nl80211.c | 53 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/src/common/ifx_vendor.h b/src/common/ifx_vendor.h index 69120bc2f..7cf127b39 100644 --- a/src/common/ifx_vendor.h +++ b/src/common/ifx_vendor.h @@ -147,12 +147,17 @@ enum ifx_vendor_attr_twt { * @IFX_TWT_OPER_SETUP: Setup a TWT session. Required parameters are * obtained through the nested attrs under %IFX_VENDOR_ATTR_TWT_PARAMS. * + * @IFX_TWT_OPER_TEARDOWN: Teardown the already negotiated TWT session. + * Required parameters are obtained through the nested attrs under + * IFX_VENDOR_ATTR_TWT_PARAMS. + * * @IFX_TWT_OPER_MAX: This acts as a the tail of the list. * Make sure it located at the end of the list. */ enum ifx_twt_oper { IFX_TWT_OPER_UNSPEC, IFX_TWT_OPER_SETUP, + IFX_TWT_OPER_TEARDOWN, IFX_TWT_OPER_MAX }; @@ -229,6 +234,8 @@ enum ifx_twt_oper { * @IFX_VENDOR_ATTR_TWT_PARAM_MIN_WAKE_DURATION_UNIT: Nominal Minimum TWT Wake Duration * Unit. 0 represents unit in "256 usecs" and 1 represents unit in "TUs". * + * @IFX_VENDOR_ATTR_TWT_PARAM_TEARDOWN_ALL_TWT: Teardown all negotiated TWT sessions. + * * @IFX_VENDOR_ATTR_TWT_PARAM_MAX: This acts as a the tail of the list. * Make sure it located at the end of the list. */ @@ -252,6 +259,7 @@ enum ifx_vendor_attr_twt_param { IFX_VENDOR_ATTR_TWT_PARAM_CHANNEL, IFX_VENDOR_ATTR_TWT_PARAM_TWT_INFO_FRAME_DISABLED, IFX_VENDOR_ATTR_TWT_PARAM_MIN_WAKE_DURATION_UNIT, + IFX_VENDOR_ATTR_TWT_PARAM_TEARDOWN_ALL_TWT, IFX_VENDOR_ATTR_TWT_PARAM_MAX }; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index f3da21177..5249035a8 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -13586,6 +13586,56 @@ static int wpa_driver_nl80211_setup_twt(void *priv, struct drv_setup_twt_params } +#ifdef CONFIG_DRIVER_NL80211_IFX +static int nl80211_ifx_teardown_twt(struct wpa_driver_nl80211_data *drv, + struct drv_teardown_twt_params *params) +{ + struct nl_msg *msg = NULL; + struct nlattr *data, *twt_param_attrs; + int ret = -1; + + if (!(msg = nl80211_drv_msg(drv, 0, NL80211_CMD_VENDOR)) || + nla_put_u32(msg, NL80211_ATTR_VENDOR_ID, OUI_IFX) || + nla_put_u32(msg, NL80211_ATTR_VENDOR_SUBCMD, IFX_VENDOR_SCMD_TWT)) + goto fail; + + data = nla_nest_start(msg, NL80211_ATTR_VENDOR_DATA); + if (!data) + goto fail; + + if (nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_OPER, IFX_TWT_OPER_TEARDOWN)) + goto fail; + + twt_param_attrs = nla_nest_start(msg, IFX_VENDOR_ATTR_TWT_PARAMS); + if (!twt_param_attrs) + goto fail; + + if (nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_NEGO_TYPE, + params->negotiation_type) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_TEARDOWN_ALL_TWT, + params->teardown_all_twt) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_FLOW_ID, + params->flow_id) || + + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_BCAST_TWT_ID, + params->bcast_twt_id)) + goto fail; + + nla_nest_end(msg, twt_param_attrs); + nla_nest_end(msg, data); + + ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); + return ret; +fail: + nl80211_nlmsg_clear(msg); + nlmsg_free(msg); + return ret; +} +#endif /* CONFIG_DRIVER_NL80211_IFX */ + + static int wpa_driver_nl80211_teardown_twt(void *priv, struct drv_teardown_twt_params *params) { struct i802_bss *bss = priv; @@ -13599,6 +13649,9 @@ static int wpa_driver_nl80211_teardown_twt(void *priv, struct drv_teardown_twt_p * Call the Vendor implementation for initiating * TWT Teardown Request to the Vendor Driver */ +#ifdef CONFIG_DRIVER_NL80211_IFX + ret = nl80211_ifx_teardown_twt(drv, params); +#endif if (ret) { wpa_printf(MSG_DEBUG, From patchwork Wed Apr 26 10:50:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gokul Sivakumar X-Patchwork-Id: 1774034 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=GtkOkXOt; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=infineon.com header.i=@infineon.com header.a=rsa-sha256 header.s=IFXMAIL header.b=h/azqXsb; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q5wfy0xnkz23vF for ; Wed, 26 Apr 2023 20:52:10 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=8ZNHkahTbc1K+jUwF6HkFDMgxgyLt9Etcxc3xbJ7t0c=; b=GtkOkXOtx1Z8yn MqAMbxWh3X8/CytuEc51F0r7bbWJUYP/SbuAAEdagStVckynKE6/TmNPdoXCWgczUUYY1cRVXpuf1 M0TIC2qDHtY1eBOiLf8PKdF3pQ+SZwtiSsLJ2x7KfATr4Fw3pCHY7oxxJ6LmqZt1ivHAM4tuImQ17 1JkeFgM3FdmAV35itQtWw7IV2FyOZV9oeiWeqT8dJFbL+sqRDmKd5KIV61P38bGxkl5A9c4pS7qh6 D26Efyf4D0rdMZSywIiwfs0tLecNNa5xADhhE8/lX98OzKsUoSDE1lpJRiWEPPeyCosLt3Flra35M YIR7APMIE9gUmQSTTEcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1prckG-003fV2-2d; Wed, 26 Apr 2023 10:51:32 +0000 Received: from smtp2.infineon.com ([2a00:18f0:1e00:4::4]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1prckD-003fRY-2l for hostap@lists.infradead.org; Wed, 26 Apr 2023 10:51:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1682506290; x=1714042290; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=jQzDyxxT/Qo5FHcR1BZUW9w/qI1/d+JS/RCmeYabhp8=; b=h/azqXsbRGGTuzCwThVuM/iL3+KW6Nzcdcvp/8Y77tHPUSWR7P9xr8fq jVwyUkhWPyxbcFsi5uF4lKNyIlVOCZrQi5Vd2hHpd2Xig8piIgW11Ejlq 7/zJE+0+e9jZ5QriAw2kcu1CEGfLXQzGkRg7J5y2Mst3b7B9Y45RcKd8Z A=; X-IronPort-AV: E=McAfee;i="6600,9927,10691"; a="35646856" X-IronPort-AV: E=Sophos;i="5.99,227,1677538800"; d="scan'208";a="35646856" Received: from unknown (HELO MUCSE805.infineon.com) ([172.23.29.31]) by smtp2.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2023 12:51:05 +0200 Received: from MUCSE827.infineon.com (172.23.29.20) by MUCSE805.infineon.com (172.23.29.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:51:04 +0200 Received: from ISCN5CG14747PP.blc.infineon.com (10.161.6.196) by MUCSE827.infineon.com (172.23.29.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 26 Apr 2023 12:51:02 +0200 From: Gokul Sivakumar To: CC: Gokul Sivakumar , Vinoth Sampath , Double Lo , Ian Lin Subject: [PATCH v2 7/7] TWT: Add support to configure TWT of a session using offset in microseconds Date: Wed, 26 Apr 2023 16:20:49 +0530 Message-ID: <20230426105049.30021-1-gokulkumar.sivakumar@infineon.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.161.6.196] X-ClientProxiedBy: MUCSE823.infineon.com (172.23.29.54) To MUCSE827.infineon.com (172.23.29.20) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230426_035130_235203_F912101D X-CRM114-Status: GOOD ( 15.73 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Introduce a new CMD line argument "twt_offset=" in the existing list of arguments supported in "$ wpa_cli twt_setup " CMD to set the TWT in terms of offset from the current remote TSF. Example: To set a Target Wake Time of 102.4ms from the current remote TSF Content analysis details: (-5.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [2a00:18f0:1e00:4:0:0:0:4 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 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 Introduce a new CMD line argument "twt_offset=" in the existing list of arguments supported in "$ wpa_cli twt_setup " CMD to set the TWT in terms of offset from the current remote TSF. Example: To set a Target Wake Time of 102.4ms from the current remote TSF $ wpa_cli -i wlan0 twt_setup setup_cmd=0 min_twt=80 mantissa=38400 \ exponent=3 twt_offset=102400 trigger=1 implicit=1 flow_type=0 \ control=0 Signed-off-by: Gokul Sivakumar --- Changes in v2: - Moved the IFX_VENDOR_ATTR_TWT_PARAM_WAKE_TIME_OFFSET netlink attr declaration from here to [PATCH 5/7]. This would with help with retaining the current enum ID number (5) for the WAKE_TIME_OFFSET attribute used by the driver, while not showing any enum re-numbering across commits in this patch series. src/drivers/driver.h | 1 + src/drivers/driver_nl80211.c | 4 ++++ wpa_supplicant/ctrl_iface.c | 11 ++++++++--- wpa_supplicant/twt.c | 22 ++++++++++++---------- wpa_supplicant/wpa_cli.c | 2 +- wpa_supplicant/wpa_supplicant_i.h | 12 ++++++------ 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 9edd3ba97..dbf3ea79b 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2927,6 +2927,7 @@ struct driver_sta_mlo_info { struct drv_setup_twt_params { u8 dtok; u64 twt; + u64 twt_offset; u8 min_twt; u8 exponent; u16 mantissa; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 5249035a8..2bfb46f29 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -13495,6 +13495,10 @@ static int nl80211_ifx_setup_twt(struct wpa_driver_nl80211_data *drv, nla_put_u64(msg, IFX_VENDOR_ATTR_TWT_PARAM_WAKE_TIME, params->twt)) || + (params->twt_offset && + nla_put_u64(msg, IFX_VENDOR_ATTR_TWT_PARAM_WAKE_TIME_OFFSET, + params->twt_offset)) || + nla_put_u8(msg, IFX_VENDOR_ATTR_TWT_PARAM_MIN_WAKE_DURATION, params->min_twt) || diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 06daea723..a2c02798b 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -10330,6 +10330,7 @@ static int wpas_ctrl_iface_send_twt_setup(struct wpa_supplicant *wpa_s, int mantissa = 8192; u8 min_twt = 255; unsigned long long twt = 0; + unsigned long long twt_offset = 0; bool requestor = true; int setup_cmd = 0; bool trigger = true; @@ -10368,6 +10369,10 @@ static int wpas_ctrl_iface_send_twt_setup(struct wpa_supplicant *wpa_s, sscanf(tok_s + os_strlen(" twt="), "%llu", &twt) != 1) return -1; + tok_s = os_strstr(cmd, " twt_offset="); + if (tok_s) + sscanf(tok_s + os_strlen(" twt_offset="), "%llu", &twt_offset); + tok_s = os_strstr(cmd, " requestor="); if (tok_s) requestor = atoi(tok_s + os_strlen(" requestor=")); @@ -10401,9 +10406,9 @@ static int wpas_ctrl_iface_send_twt_setup(struct wpa_supplicant *wpa_s, control = atoi(tok_s + os_strlen(" control=")); return wpas_twt_send_setup(wpa_s, dtok, exponent, mantissa, min_twt, - setup_cmd, twt, requestor, trigger, implicit, - flow_type, flow_id, protection, twt_channel, - control); + setup_cmd, twt, twt_offset, requestor, + trigger, implicit, flow_type, flow_id, + protection, twt_channel, control); } diff --git a/wpa_supplicant/twt.c b/wpa_supplicant/twt.c index 75ebfe56f..c5b88e353 100644 --- a/wpa_supplicant/twt.c +++ b/wpa_supplicant/twt.c @@ -109,6 +109,7 @@ int wpas_twt_test_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent * @min_twt: Minimum TWT wake duration in units of 256 usec * @setup_cmd: 0 == request, 1 == suggest, etc. Table 9-297 * @twt: Target Wake Time + * @twt_offset: Target Wake Time TSF offset * @requestor: Specify this is a TWT Requesting / Responding STA * @trigger: Specify Trigger based / Non-Trigger based TWT Session * @implicit: Specify Implicit / Explicit TWT session @@ -122,9 +123,9 @@ int wpas_twt_test_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent */ int wpas_twt_offload_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, int mantissa, u8 min_twt, int setup_cmd, u64 twt, - bool requestor, bool trigger, bool implicit, - bool flow_type, u8 flow_id, bool protection, - u8 twt_channel, u8 control) + u64 twt_offset, bool requestor, bool trigger, + bool implicit, bool flow_type, u8 flow_id, + bool protection, u8 twt_channel, u8 control) { int ret = 0; struct drv_setup_twt_params params; @@ -237,6 +238,7 @@ fail: * @min_twt: Minimum TWT wake duration in units of 256 usec * @setup_cmd: 0 == request, 1 == suggest, etc. Table 9-297 * @twt: Target Wake Time + * @twt_offset: Target Wake Time TSF offset * @requestor: Specify this is a TWT Requesting / Responding STA * @trigger: Specify Trigger based / Non-Trigger based TWT Session * @implicit: Specify Implicit / Explicit TWT session @@ -250,9 +252,9 @@ fail: */ int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, int mantissa, u8 min_twt, int setup_cmd, u64 twt, - bool requestor, bool trigger, bool implicit, - bool flow_type, u8 flow_id, bool protection, - u8 twt_channel, u8 control) + u64 twt_offset, bool requestor, bool trigger, + bool implicit, bool flow_type, u8 flow_id, + bool protection, u8 twt_channel, u8 control) { #ifdef CONFIG_TESTING_OPTIONS return wpas_twt_test_send_setup(wpa_s, dtok, exponent, mantissa, @@ -263,10 +265,10 @@ int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, #endif /* CONFIG_TESTING_OPTIONS */ return wpas_twt_offload_send_setup(wpa_s, dtok, exponent, mantissa, - min_twt, setup_cmd, twt, requestor, - trigger, implicit, flow_type, - flow_id, protection, twt_channel, - control); + min_twt, setup_cmd, twt, twt_offset, + requestor, trigger, implicit, + flow_type, flow_id, protection, + twt_channel, control); } #ifdef CONFIG_TESTING_OPTIONS diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index 3dc1d779e..7f6cc46f2 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -3946,7 +3946,7 @@ static const struct wpa_cli_cmd wpa_cli_commands[] = { }, { "twt_setup", wpa_cli_cmd_twt_setup, NULL, cli_cmd_flag_none, - "[dialog=] [exponent=] [mantissa=] [min_twt=] [setup_cmd=] [twt=] [requestor=0|1] [trigger=0|1] [implicit=0|1] [flow_type=0|1] [flow_id=<3-bit-id>] [protection=0|1] [twt_channel=] [control=] = Send TWT Setup frame" + "[dialog=] [exponent=] [mantissa=] [min_twt=] [setup_cmd=] [twt=] [twt_offset=] [requestor=0|1] [trigger=0|1] [implicit=0|1] [flow_type=0|1] [flow_id=<3-bit-id>] [protection=0|1] [twt_channel=] [control=] = Send TWT Setup frame" }, { "twt_teardown", wpa_cli_cmd_twt_teardown, NULL, cli_cmd_flag_none, diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 9da15f7a2..44840cbb3 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1668,14 +1668,14 @@ int wpas_twt_test_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent #endif /* CONFIG_TESTING_OPTIONS */ int wpas_twt_offload_setup_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, int mantissa, u8 min_twt, int setup_cmd, u64 twt, - bool requestor, bool trigger, bool implicit, - bool flow_type, u8 flow_id, bool protection, - u8 twt_channel, u8 control); + u64 twt_offset, bool requestor, bool trigger, + bool implicit, bool flow_type, u8 flow_id, + bool protection, u8 twt_channel, u8 control); int wpas_twt_send_setup(struct wpa_supplicant *wpa_s, u8 dtok, int exponent, int mantissa, u8 min_twt, int setup_cmd, u64 twt, - bool requestor, bool trigger, bool implicit, - bool flow_type, u8 flow_id, bool protection, - u8 twt_channel, u8 control); + u64 twt_offset, bool requestor, bool trigger, + bool implicit, bool flow_type, u8 flow_id, + bool protection, u8 twt_channel, u8 control); #ifdef CONFIG_TESTING_OPTIONS int wpas_twt_test_send_teardown(struct wpa_supplicant *wpa_s, u8 flags); #endif /* CONFIG_TESTING_OPTIONS */