[PATCH v2 6/7] TWT: Use IFX Vendor path to offload TWT session Teardown to the low layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 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,
-- 
2.25.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux