Browse Source

qcacld-3.0: Add TWT resume support to componentization

Add TWT resume support to componentization.

Change-Id: I3e6d81591e9a7739050445e4a67d81626febf68f
CRs-Fixed: 3085995
Srinivas Girigowda 3 years ago
parent
commit
82b323d139

+ 9 - 1
components/target_if/twt/src/target_if_ext_twt_cmd.c

@@ -73,7 +73,15 @@ QDF_STATUS
 target_if_twt_resume_req(struct wlan_objmgr_psoc *psoc,
 			 struct twt_resume_dialog_cmd_param *req)
 {
-	return QDF_STATUS_SUCCESS;
+	struct wmi_unified *wmi_handle;
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("wmi_handle is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	return wmi_unified_twt_resume_dialog_cmd(wmi_handle, req);
 }
 
 QDF_STATUS

+ 52 - 1
components/target_if/twt/src/target_if_ext_twt_evt.c

@@ -190,11 +190,62 @@ done:
 	return qdf_status_to_os_return(qdf_status);
 }
 
+/**
+ * target_if_twt_resume_dialog_complete_event_handler - TWT resume dlg
+ * complete evt handler
+ * @scn: scn
+ * @event: buffer with event
+ * @len: buffer length
+ *
+ * Return: 0 on success, negative value on failure
+ */
 static int
 target_if_twt_resume_complete_event_handler(ol_scn_t scn, uint8_t *event,
 					    uint32_t len)
 {
-	return 0;
+	QDF_STATUS qdf_status;
+	struct wmi_unified *wmi_handle;
+	struct wlan_objmgr_psoc *psoc;
+	struct twt_resume_dialog_complete_event_param *param;
+	struct wlan_lmac_if_twt_rx_ops *twt_rx_ops;
+
+	TARGET_IF_ENTER();
+
+	psoc = target_if_get_psoc_from_scn_hdl(scn);
+	if (!psoc) {
+		target_if_err("psoc is null");
+		return -EINVAL;
+	}
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("wmi_handle is null");
+		return -EINVAL;
+	}
+
+	twt_rx_ops = wlan_twt_get_rx_ops(psoc);
+	if (!twt_rx_ops || !twt_rx_ops->twt_resume_comp_cb) {
+		target_if_err("No valid twt resume complete rx ops");
+		return -EINVAL;
+	}
+
+	param = qdf_mem_malloc(sizeof(*param));
+	if (!param)
+		return -ENOMEM;
+
+	qdf_status = wmi_extract_twt_resume_dialog_comp_event(wmi_handle,
+							      event, param);
+	if (QDF_IS_STATUS_ERROR(qdf_status)) {
+		target_if_err("extract twt resume event failed (status=%d)",
+			      qdf_status);
+		goto done;
+	}
+
+	qdf_status = twt_rx_ops->twt_resume_comp_cb(psoc, param);
+
+done:
+	qdf_mem_free(param);
+	return qdf_status_to_os_return(qdf_status);
 }
 
 static int

+ 91 - 1
components/umac/twt/core/src/wlan_twt_main.c

@@ -1272,6 +1272,53 @@ QDF_STATUS wlan_twt_pause_req(struct wlan_objmgr_psoc *psoc,
 	return status;
 }
 
+QDF_STATUS wlan_twt_resume_req(struct wlan_objmgr_psoc *psoc,
+			       struct twt_resume_dialog_cmd_param *req,
+			       void *context)
+{
+	QDF_STATUS status;
+	bool cmd_in_progress;
+	bool is_twt_setup_done;
+	enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
+
+	status = wlan_twt_check_all_twt_support(psoc, req->dialog_id);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		twt_err("All TWT sessions not supported by target");
+		return status;
+	}
+
+	is_twt_setup_done = wlan_twt_is_setup_done(psoc, &req->peer_macaddr,
+						   req->dialog_id);
+	if (!is_twt_setup_done) {
+		twt_err("TWT setup is not complete for dialog_id:%d",
+			req->dialog_id);
+		return QDF_STATUS_E_AGAIN;
+	}
+
+	cmd_in_progress = wlan_twt_is_command_in_progress(psoc,
+					&req->peer_macaddr,
+					req->dialog_id, WLAN_TWT_ANY,
+					&active_cmd);
+	if (cmd_in_progress) {
+		twt_debug("Already TWT command:%d is in progress", active_cmd);
+		return QDF_STATUS_E_PENDING;
+	}
+
+	wlan_twt_set_command_in_progress(psoc, &req->peer_macaddr,
+					 req->dialog_id, WLAN_TWT_RESUME);
+	wlan_twt_set_ack_context(psoc, &req->peer_macaddr,
+				 req->dialog_id, context);
+
+	status = tgt_twt_resume_req_send(psoc, req);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		twt_err("tgt_twt_resume_req_send failed (status=%d)", status);
+		wlan_twt_set_command_in_progress(psoc, &req->peer_macaddr,
+						 req->dialog_id, WLAN_TWT_NONE);
+	}
+
+	return status;
+}
+
 /**
  * wlan_twt_sap_teardown_req() - sap TWT teardown request
  * @psoc: Pointer to psoc object
@@ -1811,7 +1858,50 @@ QDF_STATUS
 wlan_twt_resume_complete_event_handler(struct wlan_objmgr_psoc *psoc,
 			   struct twt_resume_dialog_complete_event_param *event)
 {
-	return QDF_STATUS_SUCCESS;
+	enum QDF_OPMODE opmode;
+	QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE;
+	uint32_t pdev_id, vdev_id;
+	struct wlan_objmgr_pdev *pdev;
+
+	vdev_id = event->vdev_id;
+	pdev_id = wlan_get_pdev_id_from_vdev_id(psoc, vdev_id, WLAN_TWT_ID);
+	if (pdev_id == WLAN_INVALID_PDEV_ID) {
+		twt_err("Invalid pdev id");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id, WLAN_TWT_ID);
+	if (!pdev) {
+		twt_err("Invalid pdev");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	opmode = wlan_get_opmode_from_vdev_id(pdev, vdev_id);
+
+	switch (opmode) {
+	case QDF_SAP_MODE:
+		qdf_status = mlme_twt_osif_resume_complete_ind(psoc, event);
+		break;
+	case QDF_STA_MODE:
+		qdf_status = mlme_twt_osif_resume_complete_ind(psoc, event);
+
+		wlan_twt_set_session_state(psoc, &event->peer_macaddr,
+					   event->dialog_id,
+					   WLAN_TWT_SETUP_STATE_ACTIVE);
+
+		qdf_status = wlan_twt_set_command_in_progress(psoc,
+						&event->peer_macaddr,
+						event->dialog_id,
+						WLAN_TWT_NONE);
+		break;
+	default:
+		twt_debug("TWT Resume is not supported on %s",
+			  qdf_opmode_str(opmode));
+		break;
+	}
+
+	wlan_objmgr_pdev_release_ref(pdev, WLAN_TWT_ID);
+	return qdf_status;
 }
 
 QDF_STATUS

+ 13 - 0
components/umac/twt/core/src/wlan_twt_main.h

@@ -90,6 +90,19 @@ wlan_twt_pause_req(struct wlan_objmgr_psoc *psoc,
 		   struct twt_pause_dialog_cmd_param *req,
 		   void *context);
 
+/**
+ * wlan_twt_resume_req() - Process TWT resume req
+ * @psoc: psoc
+ * @req: resume dialog cmd param
+ * @context: context
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wlan_twt_resume_req(struct wlan_objmgr_psoc *psoc,
+		    struct twt_resume_dialog_cmd_param *req,
+		    void *context);
+
 /**
  * wlan_twt_is_setup_in_progress() - Get if TWT setup command is in progress
  * for given dialog id

+ 23 - 0
components/umac/twt/dispatcher/inc/wlan_twt_ucfg_ext_api.h

@@ -96,6 +96,21 @@ QDF_STATUS ucfg_twt_pause_req(struct wlan_objmgr_psoc *psoc,
 			      struct twt_pause_dialog_cmd_param *params,
 			      void *context);
 
+/**
+ * ucfg_twt_resume_req() - Process TWT resume req
+ * @psoc: psoc
+ * @params: resume dialog cmd param
+ * @context: context
+ *
+ * Perform validations and set WLAN_TWT_RESUME
+ * in progress
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS ucfg_twt_resume_req(struct wlan_objmgr_psoc *psoc,
+			      struct twt_resume_dialog_cmd_param *params,
+			      void *context);
+
 /**
  * ucfg_twt_is_max_sessions_reached() - Check if the maximum number of
  * TWT sessions reached or not excluding the given dialog_id
@@ -239,6 +254,14 @@ QDF_STATUS ucfg_twt_pause_req(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+static inline
+QDF_STATUS ucfg_twt_resume_req(struct wlan_objmgr_psoc *psoc,
+			      struct twt_resume_dialog_cmd_param *params,
+			      void *context)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
 static inline QDF_STATUS
 ucfg_twt_init_context(struct wlan_objmgr_psoc *psoc,
 		      struct qdf_mac_addr *peer_mac,

+ 1 - 1
components/umac/twt/dispatcher/src/wlan_twt_tgt_if_ext_rx_api.c

@@ -51,7 +51,7 @@ static QDF_STATUS
 tgt_twt_resume_complete_resp_handler(struct wlan_objmgr_psoc *psoc,
 			   struct twt_resume_dialog_complete_event_param *event)
 {
-	return QDF_STATUS_SUCCESS;
+	return wlan_twt_resume_complete_event_handler(psoc, event);
 }
 
 static QDF_STATUS

+ 23 - 1
components/umac/twt/dispatcher/src/wlan_twt_tgt_if_ext_tx_api.c

@@ -119,7 +119,29 @@ QDF_STATUS
 tgt_twt_resume_req_send(struct wlan_objmgr_psoc *psoc,
 			struct twt_resume_dialog_cmd_param *req)
 {
-	return QDF_STATUS_SUCCESS;
+	struct wlan_lmac_if_twt_tx_ops *tx_ops;
+	QDF_STATUS status;
+
+	if (!psoc) {
+		twt_err("psoc is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	if (!req) {
+		twt_err("Invalid input");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	tx_ops = wlan_twt_get_tx_ops(psoc);
+	if (!tx_ops || !tx_ops->resume_req) {
+		twt_err("resume tx_ops is null");
+		status = QDF_STATUS_E_NULL_VALUE;
+		return status;
+	}
+
+	status = tx_ops->resume_req(psoc, req);
+
+	return status;
 }
 
 QDF_STATUS

+ 8 - 0
components/umac/twt/dispatcher/src/wlan_twt_ucfg_ext_api.c

@@ -70,6 +70,14 @@ ucfg_twt_pause_req(struct wlan_objmgr_psoc *psoc,
 	return wlan_twt_pause_req(psoc, params, context);
 }
 
+QDF_STATUS
+ucfg_twt_resume_req(struct wlan_objmgr_psoc *psoc,
+		    struct twt_resume_dialog_cmd_param *params,
+		    void *context)
+{
+	return wlan_twt_resume_req(psoc, params, context);
+}
+
 bool ucfg_twt_is_max_sessions_reached(struct wlan_objmgr_psoc *psoc,
 				      struct qdf_mac_addr *peer_mac,
 				      uint8_t dialog_id)

+ 1 - 0
core/hdd/src/wlan_hdd_twt.c

@@ -239,6 +239,7 @@ static int hdd_twt_configure(struct hdd_adapter *adapter,
 		ret = osif_twt_pause_req(vdev, twt_param_attr);
 		break;
 	case QCA_WLAN_TWT_RESUME:
+		ret = osif_twt_resume_req(vdev, twt_param_attr);
 		break;
 	case QCA_WLAN_TWT_NUDGE:
 		break;

+ 23 - 0
os_if/twt/inc/osif_twt_ext_req.h

@@ -109,6 +109,22 @@ osif_twt_handle_renego_failure(struct wlan_objmgr_psoc *psoc,
 int osif_twt_pause_req(struct wlan_objmgr_vdev *vdev,
 		       struct nlattr *twt_param_attr);
 
+/**
+ * osif_twt_resume_req() - Process TWT resume operation
+ * in the received vendor command and send it to firmware
+ * @vdev: vdev
+ * @twt_param_attr: nl attributes
+ *
+ * sets up TWT resume request from HDD. request is passed
+ * to TWT core
+ *
+ * Handles QCA_WLAN_TWT_RESUME
+ *
+ * Return: success on 0, failure on non-zero
+ */
+int osif_twt_resume_req(struct wlan_objmgr_vdev *vdev,
+		       struct nlattr *twt_param_attr);
+
 /**
  * osif_twt_get_capabilities() - Process TWT get capabilities
  * in the received vendor command.
@@ -178,6 +194,13 @@ int osif_twt_pause_req(struct wlan_objmgr_vdev *vdev,
 	return 0;
 }
 
+static inline
+int osif_twt_resume_req(struct wlan_objmgr_vdev *vdev,
+		       struct nlattr *twt_param_attr)
+{
+	return 0;
+}
+
 #endif
 #endif /* _OSIF_TWT_EXT_REQ_H_ */
 

+ 154 - 0
os_if/twt/src/osif_twt_ext_req.c

@@ -66,6 +66,14 @@ qca_wlan_vendor_twt_add_dialog_policy[QCA_WLAN_VENDOR_ATTR_TWT_SETUP_MAX + 1] =
 	[QCA_WLAN_VENDOR_ATTR_TWT_SETUP_WAKE_TIME_TSF] = {.type = NLA_U64 },
 };
 
+static const struct nla_policy
+qca_wlan_vendor_twt_resume_dialog_policy[QCA_WLAN_VENDOR_ATTR_TWT_RESUME_MAX + 1] = {
+	[QCA_WLAN_VENDOR_ATTR_TWT_RESUME_FLOW_ID] = {.type = NLA_U8 },
+	[QCA_WLAN_VENDOR_ATTR_TWT_RESUME_NEXT_TWT] = {.type = NLA_U8 },
+	[QCA_WLAN_VENDOR_ATTR_TWT_RESUME_NEXT_TWT_SIZE] = {.type = NLA_U32 },
+	[QCA_WLAN_VENDOR_ATTR_TWT_RESUME_NEXT2_TWT] = {.type = NLA_U32 },
+};
+
 static int osif_is_twt_command_allowed(struct wlan_objmgr_vdev *vdev,
 				       uint8_t vdev_id,
 				       struct wlan_objmgr_psoc *psoc)
@@ -662,6 +670,87 @@ cleanup:
 	return ret;
 }
 
+/**
+ * osif_send_twt_resume_req() - Send TWT resume dialog command to target
+ * @vdev: vdev
+ * @psoc: psoc
+ * @twt_params: Pointer to resume dialog cmd params structure
+ *
+ * Return: 0 on success, negative value on failure
+ */
+static int
+osif_send_twt_resume_req(struct wlan_objmgr_vdev *vdev,
+			struct wlan_objmgr_psoc *psoc,
+			struct twt_resume_dialog_cmd_param *twt_params)
+{
+	QDF_STATUS status;
+	int ret = 0, twt_cmd;
+	struct osif_request *request;
+	struct twt_ack_context *ack_priv;
+	void *context;
+	static const struct osif_request_params params = {
+				.priv_size = sizeof(*ack_priv),
+				.timeout_ms = TWT_ACK_COMPLETE_TIMEOUT,
+	};
+
+	request = osif_request_alloc(&params);
+	if (!request) {
+		osif_err("Request allocation failure");
+		return -ENOMEM;
+	}
+
+	context = osif_request_cookie(request);
+
+	status = ucfg_twt_resume_req(psoc, twt_params, context);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		osif_err("Failed to send resume dialog command");
+		ret = qdf_status_to_os_return(status);
+		goto cleanup;
+	}
+
+	twt_cmd = HOST_TWT_RESUME_DIALOG_CMDID;
+	status = osif_twt_ack_wait_response(psoc, request, twt_cmd);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		ret = qdf_status_to_os_return(status);
+		goto cleanup;
+	}
+
+	ack_priv = osif_request_priv(request);
+	if (ack_priv->status != HOST_TWT_RESUME_STATUS_OK) {
+		osif_err("Received TWT ack error:%d. Reset twt command",
+			 ack_priv->status);
+
+		switch (ack_priv->status) {
+		case HOST_TWT_RESUME_STATUS_INVALID_PARAM:
+		case HOST_TWT_RESUME_STATUS_UNKNOWN_ERROR:
+			ret = -EINVAL;
+			break;
+		case HOST_TWT_RESUME_STATUS_DIALOG_ID_NOT_EXIST:
+		case HOST_TWT_RESUME_STATUS_NOT_PAUSED:
+			ret = -EAGAIN;
+			break;
+		case HOST_TWT_RESUME_STATUS_DIALOG_ID_BUSY:
+			ret = -EINPROGRESS;
+			break;
+		case HOST_TWT_RESUME_STATUS_NO_RESOURCE:
+			ret = -ENOMEM;
+			break;
+		case HOST_TWT_RESUME_STATUS_CHAN_SW_IN_PROGRESS:
+		case HOST_TWT_RESUME_STATUS_ROAM_IN_PROGRESS:
+		case HOST_TWT_RESUME_STATUS_SCAN_IN_PROGRESS:
+			ret = -EBUSY;
+			break;
+		default:
+			ret = -EINVAL;
+			break;
+		}
+	}
+
+cleanup:
+	osif_request_put(request);
+	return ret;
+}
+
 int osif_twt_send_requestor_enable_cmd(struct wlan_objmgr_psoc *psoc,
 				       uint8_t pdev_id)
 {
@@ -1166,3 +1255,68 @@ int osif_twt_pause_req(struct wlan_objmgr_vdev *vdev,
 	return osif_send_twt_pause_req(vdev, psoc, &params);
 }
 
+int osif_twt_resume_req(struct wlan_objmgr_vdev *vdev,
+		       struct nlattr *twt_param_attr)
+{
+	struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TWT_SETUP_MAX + 1];
+	struct wlan_objmgr_psoc *psoc;
+	int ret = 0;
+	uint32_t vdev_id;
+	int id, id2;
+	struct  twt_resume_dialog_cmd_param params = {0};
+
+	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		osif_err("NULL psoc");
+		return -EINVAL;
+	}
+
+	vdev_id = wlan_vdev_get_id(vdev);
+
+	ret = osif_is_twt_command_allowed(vdev, vdev_id, psoc);
+	if (ret)
+		return ret;
+
+	ret = osif_fill_peer_macaddr(vdev, params.peer_macaddr.bytes);
+	if (ret)
+		return ret;
+
+	ret = wlan_cfg80211_nla_parse_nested(tb,
+				QCA_WLAN_VENDOR_ATTR_TWT_RESUME_MAX,
+				twt_param_attr,
+				qca_wlan_vendor_twt_resume_dialog_policy);
+	if (ret)
+		return ret;
+
+	id = QCA_WLAN_VENDOR_ATTR_TWT_RESUME_FLOW_ID;
+	if (tb[id])
+		params.dialog_id = nla_get_u8(tb[id]);
+	else
+		osif_debug("TWT_RESUME_FLOW_ID not specified. set to zero");
+
+	id = QCA_WLAN_VENDOR_ATTR_TWT_RESUME_NEXT_TWT;
+	id2 = QCA_WLAN_VENDOR_ATTR_TWT_RESUME_NEXT2_TWT;
+	if (tb[id2])
+		params.sp_offset_us = nla_get_u32(tb[id2]);
+	else if (tb[id])
+		params.sp_offset_us = nla_get_u8(tb[id]);
+	else
+		params.sp_offset_us = 0;
+
+	id = QCA_WLAN_VENDOR_ATTR_TWT_RESUME_NEXT_TWT_SIZE;
+	if (tb[id]) {
+		params.next_twt_size = nla_get_u32(tb[id]);
+	} else {
+		osif_err_rl("TWT_RESUME NEXT_TWT_SIZE is must");
+		return -EINVAL;
+	}
+	if (params.next_twt_size > TWT_MAX_NEXT_TWT_SIZE)
+		return -EINVAL;
+
+	osif_debug("twt_resume: vdev_id %d dialog_id %d peer mac_addr "
+		   QDF_MAC_ADDR_FMT, vdev_id, params.dialog_id,
+		   QDF_MAC_ADDR_REF(params.peer_macaddr.bytes));
+
+	return osif_send_twt_resume_req(vdev, psoc, &params);
+}
+

+ 147 - 1
os_if/twt/src/osif_twt_ext_rsp.c

@@ -202,6 +202,45 @@ twt_del_status_to_vendor_twt_status(enum HOST_TWT_DEL_STATUS status)
 	}
 }
 
+/**
+ * twt_resume_status_to_vendor_twt_status() - convert from
+ * HOST_TWT_RESUME_STATUS to qca_wlan_vendor_twt_status
+ * @status: HOST_TWT_RESUME_STATUS value from firmware
+ *
+ * Return: qca_wlan_vendor_twt_status values corresponding
+ * to the firmware failure status
+ */
+static int
+twt_resume_status_to_vendor_twt_status(enum HOST_TWT_RESUME_STATUS status)
+{
+	switch (status) {
+	case HOST_TWT_RESUME_STATUS_OK:
+		return QCA_WLAN_VENDOR_TWT_STATUS_OK;
+	case HOST_TWT_RESUME_STATUS_DIALOG_ID_NOT_EXIST:
+		return QCA_WLAN_VENDOR_TWT_STATUS_SESSION_NOT_EXIST;
+	case HOST_TWT_RESUME_STATUS_INVALID_PARAM:
+		return QCA_WLAN_VENDOR_TWT_STATUS_INVALID_PARAM;
+	case HOST_TWT_RESUME_STATUS_DIALOG_ID_BUSY:
+		return QCA_WLAN_VENDOR_TWT_STATUS_SESSION_BUSY;
+	case HOST_TWT_RESUME_STATUS_NOT_PAUSED:
+		return QCA_WLAN_VENDOR_TWT_STATUS_NOT_SUSPENDED;
+	case HOST_TWT_RESUME_STATUS_NO_RESOURCE:
+		return QCA_WLAN_VENDOR_TWT_STATUS_NO_RESOURCE;
+	case HOST_TWT_RESUME_STATUS_NO_ACK:
+		return QCA_WLAN_VENDOR_TWT_STATUS_NO_ACK;
+	case HOST_TWT_RESUME_STATUS_UNKNOWN_ERROR:
+		return QCA_WLAN_VENDOR_TWT_STATUS_UNKNOWN_ERROR;
+	case HOST_TWT_RESUME_STATUS_CHAN_SW_IN_PROGRESS:
+		return QCA_WLAN_VENDOR_TWT_STATUS_CHANNEL_SWITCH_IN_PROGRESS;
+	case HOST_TWT_RESUME_STATUS_ROAM_IN_PROGRESS:
+		return QCA_WLAN_VENDOR_TWT_STATUS_ROAMING_IN_PROGRESS;
+	case HOST_TWT_RESUME_STATUS_SCAN_IN_PROGRESS:
+		return QCA_WLAN_VENDOR_TWT_STATUS_SCAN_IN_PROGRESS;
+	default:
+		return QCA_WLAN_VENDOR_TWT_STATUS_UNKNOWN_ERROR;
+	}
+}
+
 /**
  * twt_add_cmd_to_vendor_twt_resp_type() - convert from
  * HOST_TWT_COMMAND to qca_wlan_vendor_twt_setup_resp_type
@@ -469,6 +508,59 @@ osif_twt_teardown_pack_resp_nlmsg(struct sk_buff *reply_skb,
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * osif_twt_resume_pack_resp_nlmsg() - pack the skb with
+ * firmware response for twt resume command
+ * @reply_skb: skb to store the response
+ * @event: Pointer to resume dialog complete event buffer
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+osif_twt_resume_pack_resp_nlmsg(struct sk_buff *reply_skb,
+			   struct twt_resume_dialog_complete_event_param *event)
+{
+	struct nlattr *config_attr;
+	int vendor_status, attr;
+
+	if (nla_put_u8(reply_skb, QCA_WLAN_VENDOR_ATTR_CONFIG_TWT_OPERATION,
+		       QCA_WLAN_TWT_RESUME)) {
+		osif_err("Failed to put TWT operation");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	config_attr = nla_nest_start(reply_skb,
+				     QCA_WLAN_VENDOR_ATTR_CONFIG_TWT_PARAMS);
+	if (!config_attr) {
+		osif_err("nla_nest_start error");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	attr = QCA_WLAN_VENDOR_ATTR_TWT_RESUME_FLOW_ID;
+	if (nla_put_u8(reply_skb, attr, event->dialog_id)) {
+		osif_debug("Failed to put dialog_id");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	attr = QCA_WLAN_VENDOR_ATTR_TWT_SETUP_STATUS;
+	vendor_status = twt_resume_status_to_vendor_twt_status(event->status);
+	if (nla_put_u8(reply_skb, attr, vendor_status)) {
+		osif_err("Failed to put QCA_WLAN_TWT_RESUME status");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	attr = QCA_WLAN_VENDOR_ATTR_TWT_RESUME_MAC_ADDR;
+	if (nla_put(reply_skb, attr, QDF_MAC_ADDR_SIZE,
+		    event->peer_macaddr.bytes)) {
+		osif_err("Failed to put mac_addr");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	nla_nest_end(reply_skb, config_attr);
+
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS
 osif_twt_send_get_capabilities_response(struct wlan_objmgr_psoc *psoc,
 					struct wlan_objmgr_vdev *vdev)
@@ -724,7 +816,61 @@ QDF_STATUS
 osif_twt_resume_complete_cb(struct wlan_objmgr_psoc *psoc,
 			   struct twt_resume_dialog_complete_event_param *event)
 {
-	return QDF_STATUS_SUCCESS;
+	struct wireless_dev *wdev;
+	struct vdev_osif_priv *osif_priv;
+	struct wlan_objmgr_vdev *vdev;
+	uint32_t vdev_id = event->vdev_id;
+	struct sk_buff *twt_vendor_event;
+	size_t data_len;
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, event->vdev_id,
+						    WLAN_TWT_ID);
+	if (!vdev) {
+		osif_err("vdev is null");
+		return status;
+	}
+
+	osif_priv = wlan_vdev_get_ospriv(vdev);
+	if (!osif_priv) {
+		osif_err("osif_priv is null");
+		goto fail;
+	}
+
+	wdev = osif_priv->wdev;
+	if (!wdev) {
+		osif_err("wireless dev is null");
+		goto fail;
+	}
+
+	osif_debug("TWT: resume dialog_id:%d status:%d vdev_id:%d peer macaddr "
+		   QDF_MAC_ADDR_FMT, event->dialog_id,
+		   event->status, vdev_id,
+		   QDF_MAC_ADDR_REF(event->peer_macaddr.bytes));
+
+	data_len = osif_twt_get_event_len() + nla_total_size(sizeof(u8));
+	data_len += NLA_HDRLEN;
+
+	twt_vendor_event = wlan_cfg80211_vendor_event_alloc(
+				wdev->wiphy, wdev, data_len,
+				QCA_NL80211_VENDOR_SUBCMD_CONFIG_TWT_INDEX,
+				GFP_KERNEL);
+	if (!twt_vendor_event) {
+		osif_err("TWT: Alloc resume resp skb fail");
+		goto fail;
+	}
+
+	status = osif_twt_resume_pack_resp_nlmsg(twt_vendor_event, event);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		osif_err("Failed to pack nl resume dialog response");
+		wlan_cfg80211_vendor_free_skb(twt_vendor_event);
+		goto fail;
+	}
+	wlan_cfg80211_vendor_event(twt_vendor_event, GFP_KERNEL);
+
+fail:
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_TWT_ID);
+	return status;
 }
 
 QDF_STATUS