[PATCH v3 6/7] TWT: Use IFX Vendor path to offload TWT session Teardown to the low layer
Gokul Sivakumar
gokulkumar.sivakumar at infineon.com
Tue Aug 22 07:53:49 PDT 2023
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 <gokulkumar.sivakumar at infineon.com>
---
Changes in v3:
- Renamed the IFX vendor specific enum member subcmd from "TWT" to "TWT_OFFLOAD",
to highlight that this API is used in offloading the TWT Session configuration
work to the IFX Dongle Firmware.
src/common/ifx_vendor.h | 8 ++++++
src/drivers/driver_nl80211.c | 54 ++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
diff --git a/src/common/ifx_vendor.h b/src/common/ifx_vendor.h
index 87cc0ee1a..bee72b339 100644
--- a/src/common/ifx_vendor.h
+++ b/src/common/ifx_vendor.h
@@ -123,12 +123,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
};
@@ -205,6 +210,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.
*/
@@ -228,6 +235,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 a6d23f366..6ab012b85 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -13777,6 +13777,57 @@ 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_OFFLOAD))
+ 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;
@@ -13790,6 +13841,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,
--
2.25.1
More information about the Hostap
mailing list