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,