Prechádzať zdrojové kódy

qcacld-3.0: Add NDP reason codes in deferred rsp sent for NDP commands

This is qcacld-2.0 to qcacld-3.0 propagation.

Add NDP reason codes in deferred response sent for NDP commands so that
failure during processing of NDP cmds can be notified to service layer.

Change-Id: I731b520fde226c351464d94033a1ced2888a4d18
CRs-Fixed: 962367
Naveen Rawat 8 rokov pred
rodič
commit
8d63a59f3b

+ 37 - 17
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -745,7 +745,7 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
 	struct nan_datapath_ctx *ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
 	bool create_fail = false;
 	uint8_t create_transaction_id = 0;
-	uint8_t create_status = 0;
+	uint32_t create_status = 0;
 
 	ENTER();
 
@@ -803,7 +803,8 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
 
 	/* Status return value */
 	if (nla_put_u32(vendor_event,
-			QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE, 0xA5)) {
+			QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
+			ndi_rsp->reason)) {
 		hdd_err(FL("VENDOR_ATTR_NDP_DRV_RETURN_VALUE put fail"));
 		goto nla_put_failure;
 	}
@@ -817,7 +818,8 @@ static void hdd_ndp_iface_create_rsp_handler(hdd_adapter_t *adapter,
 	hddLog(LOG2, FL("status code: %d, value: %d"),
 		QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE, create_status);
 	hddLog(LOG2, FL("Return value: %d, value: %d"),
-		QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE, 0xA5);
+		QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
+		ndi_rsp->reason);
 
 	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 
@@ -859,6 +861,7 @@ static void hdd_ndp_iface_delete_rsp_handler(hdd_adapter_t *adapter,
 {
 	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	struct ndi_delete_rsp *ndi_rsp = rsp_params;
+	struct nan_datapath_ctx *ndp_ctx;
 
 	if (wlan_hdd_validate_context(hdd_ctx))
 		return;
@@ -868,14 +871,19 @@ static void hdd_ndp_iface_delete_rsp_handler(hdd_adapter_t *adapter,
 		return;
 	}
 
-	if (ndi_rsp->status == QDF_STATUS_SUCCESS)
+	if (ndi_rsp->status == NDP_RSP_STATUS_SUCCESS)
 		hdd_err(FL("NDI BSS successfully stopped"));
 	else
 		hdd_err(FL("NDI BSS stop failed with reason %d"),
 			ndi_rsp->reason);
+
+	ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
+	ndp_ctx->ndi_delete_rsp_reason = ndi_rsp->reason;
+	ndp_ctx->ndi_delete_rsp_status = ndi_rsp->status;
 	wlan_hdd_netif_queue_control(adapter,
 				     WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
 				     WLAN_CONTROL_PATH);
+
 	complete(&adapter->disconnect_comp_var);
 	return;
 }
@@ -957,14 +965,16 @@ void hdd_ndp_session_end_handler(hdd_adapter_t *adapter)
 
 	/* Status code */
 	if (nla_put_u32(vendor_event,
-			QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE, 0x0)) {
+			QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE,
+			ndp_ctx->ndi_delete_rsp_status)) {
 		hdd_err(FL("VENDOR_ATTR_NDP_DRV_RETURN_TYPE put fail"));
 		goto failure;
 	}
 
 	/* Status return value */
 	if (nla_put_u32(vendor_event,
-			QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE, 0x0)) {
+			QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
+			ndp_ctx->ndi_delete_rsp_reason)) {
 		hdd_err(FL("VENDOR_ATTR_NDP_DRV_RETURN_VALUE put fail"));
 		goto failure;
 	}
@@ -977,9 +987,10 @@ void hdd_ndp_session_end_handler(hdd_adapter_t *adapter)
 		ndp_ctx->ndp_delete_transaction_id);
 	hddLog(LOG2, FL("status code: %d, value: %d"),
 		QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE,
-		true);
+		ndp_ctx->ndi_delete_rsp_status);
 	hddLog(LOG2, FL("Return value: %d, value: %d"),
-		QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE, 0x5A);
+		QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
+		ndp_ctx->ndi_delete_rsp_reason);
 
 	ndp_ctx->ndp_delete_transaction_id = 0;
 	ndp_ctx->state = NAN_DATA_NDI_DELETED_STATE;
@@ -1050,16 +1061,17 @@ static void hdd_ndp_initiator_rsp_handler(hdd_adapter_t *adapter,
 		goto ndp_initiator_rsp_nla_failed;
 
 	if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_TYPE,
-		rsp->status))
+			rsp->status))
 		goto ndp_initiator_rsp_nla_failed;
 
 	if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
-		0))
+			rsp->reason))
 		goto ndp_initiator_rsp_nla_failed;
 
 	hddLog(LOG1,
-	       FL("NDP Initiator rsp sent, tid:%d, instance id:%d, status:%d"),
-	       rsp->transaction_id, rsp->ndp_instance_id, rsp->status);
+	       FL("NDP Initiator rsp sent, tid:%d, instance id:%d, status:%d, reason: %d"),
+	       rsp->transaction_id, rsp->ndp_instance_id, rsp->status,
+	       rsp->reason);
 	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 	EXIT();
 	return;
@@ -1208,6 +1220,9 @@ static void hdd_ndp_confirm_ind_handler(hdd_adapter_t *adapter,
 			+ NLMSG_HDRLEN + (7 * NLA_HDRLEN) +
 			ndp_confirm->ndp_info.ndp_app_info_len;
 
+	if (ndp_confirm->ndp_info.ndp_app_info_len)
+		data_len += NLA_HDRLEN + ndp_confirm->ndp_info.ndp_app_info_len;
+
 	vendor_event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
 				data_len, QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
 				GFP_KERNEL);
@@ -1233,9 +1248,9 @@ static void hdd_ndp_confirm_ind_handler(hdd_adapter_t *adapter,
 		goto ndp_confirm_nla_failed;
 
 	if (ndp_confirm->ndp_info.ndp_app_info_len && nla_put(vendor_event,
-				QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO,
-				ndp_confirm->ndp_info.ndp_app_info_len,
-				ndp_confirm->ndp_info.ndp_app_info))
+			QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO,
+			ndp_confirm->ndp_info.ndp_app_info_len,
+			ndp_confirm->ndp_info.ndp_app_info))
 		goto ndp_confirm_nla_failed;
 
 	if (nla_put_u32(vendor_event,
@@ -1243,6 +1258,11 @@ static void hdd_ndp_confirm_ind_handler(hdd_adapter_t *adapter,
 			ndp_confirm->rsp_code))
 		goto ndp_confirm_nla_failed;
 
+	if (nla_put_u32(vendor_event,
+			QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
+			ndp_confirm->reason_code))
+		goto ndp_confirm_nla_failed;
+
 	cfg80211_vendor_event(vendor_event, GFP_KERNEL);
 	hddLog(LOG1, FL("NDP confim sent, ndp instance id: %d, peer addr: %pM, ndp_cfg: %d, rsp_code: %d, reason_code: %d"),
 		ndp_confirm->ndp_instance_id,
@@ -1678,11 +1698,11 @@ void hdd_ndp_event_handler(hdd_adapter_t *adapter,
 {
 	if (roam_status == eCSR_ROAM_NDP_STATUS_UPDATE) {
 		switch (roam_result) {
-		case eCSR_ROAM_RESULT_NDP_CREATE_RSP:
+		case eCSR_ROAM_RESULT_NDI_CREATE_RSP:
 			hdd_ndp_iface_create_rsp_handler(adapter,
 				&roam_info->ndp.ndi_create_params);
 			break;
-		case eCSR_ROAM_RESULT_NDP_DELETE_RSP:
+		case eCSR_ROAM_RESULT_NDI_DELETE_RSP:
 			hdd_ndp_iface_delete_rsp_handler(adapter,
 				&roam_info->ndp.ndi_delete_params);
 			break;

+ 4 - 0
core/hdd/src/wlan_hdd_nan_datapath.h

@@ -178,6 +178,8 @@ enum nan_datapath_state {
  * @ndp_key_installed: NDP security key installed
  * @ndp_enc_key: NDP encryption key info
  * @ndp_debug_state: debug state info
+ * @ndi_delete_rsp_reason: reason code for ndi_delete rsp
+ * @ndi_delete_rsp_status: status for ndi_delete rsp
  */
 struct nan_datapath_ctx {
 	enum nan_datapath_state state;
@@ -189,6 +191,8 @@ struct nan_datapath_ctx {
 	bool ndp_key_installed;
 	tCsrRoamSetKey ndp_enc_key;
 	uint32_t ndp_debug_state;
+	uint32_t ndi_delete_rsp_reason;
+	uint32_t ndi_delete_rsp_status;
 };
 
 #ifdef WLAN_FEATURE_NAN_DATAPATH

+ 48 - 15
core/mac/inc/sir_api.h

@@ -5943,6 +5943,53 @@ enum ndp_end_reason_code {
 	NDP_END_REASON_PEER_DATA_END = 0x02,
 };
 
+/**
+ * enum nan_status_type - NDP status type
+ * @NDP_RSP_STATUS_SUCCESS: request was successful
+ * @NDP_RSP_STATUS_ERROR: request failed
+ */
+enum nan_status_type {
+	NDP_RSP_STATUS_SUCCESS = 0x00,
+	NDP_RSP_STATUS_ERROR = 0x01,
+};
+
+/**
+ * enum nan_reason_code - NDP command rsp reason code value
+ * @NDP_UNSUPPORTED_CONCURRENCY: Will be used in unsupported concurrency cases
+ * @NDP_NAN_DATA_IFACE_CREATE_FAILED: ndi create failed
+ * @NDP_NAN_DATA_IFACE_DELETE_FAILED: ndi delete failed
+ * @NDP_DATA_INITIATOR_REQ_FAILED: data initiator request failed
+ * @NDP_DATA_RESPONDER_REQ_FAILED: data responder request failed
+ * @NDP_INVALID_SERVICE_INSTANCE_ID: invalid service instance id
+ * @NDP_INVALID_NDP_INSTANCE_ID: invalid ndp instance id
+ * @NDP_INVALID_RSP_CODE: invalid response code in ndp responder request
+ * @NDP_INVALID_APP_INFO_LEN: invalid app info length
+ * @NDP_NMF_REQ_FAIL: OTA nan mgmt frame failure for data request
+ * @NDP_NMF_RSP_FAIL: OTA nan mgmt frame failure for data response
+ * @NDP_NMF_CNF_FAIL: OTA nan mgmt frame failure for confirm
+ * @NDP_END_FAILED: ndp end failed
+ * @NDP_NMF_END_REQ_FAIL: OTA nan mgmt frame failure for data end
+ * @NDP_VENDOR_SPECIFIC_ERROR: other vendor specific failures
+ */
+enum nan_reason_code {
+	NDP_UNSUPPORTED_CONCURRENCY = 9000,
+	NDP_NAN_DATA_IFACE_CREATE_FAILED = 9001,
+	NDP_NAN_DATA_IFACE_DELETE_FAILED = 9002,
+	NDP_DATA_INITIATOR_REQ_FAILED = 9003,
+	NDP_DATA_RESPONDER_REQ_FAILED = 9004,
+	NDP_INVALID_SERVICE_INSTANCE_ID = 9005,
+	NDP_INVALID_NDP_INSTANCE_ID = 9006,
+	NDP_INVALID_RSP_CODE = 9007,
+	NDP_INVALID_APP_INFO_LEN = 9008,
+	NDP_NMF_REQ_FAIL = 9009,
+	NDP_NMF_RSP_FAIL = 9010,
+	NDP_NMF_CNF_FAIL = 9011,
+	NDP_END_FAILED = 9012,
+	NDP_NMF_END_REQ_FAIL = 9013,
+	/* 9500 onwards vendor specific error codes */
+	NDP_VENDOR_SPECIFIC_ERROR = 9500,
+};
+
 /**
  * struct ndp_cfg - ndp configuration
  * @tag: unique identifier
@@ -5995,37 +6042,22 @@ struct ndi_create_req {
 
 /**
  * struct ndi_create_rsp - ndi create response params
- * @transaction_id: unique identifier
  * @status: request status
  * @reason: reason if any
  *
  */
 struct ndi_create_rsp {
-	uint32_t transaction_id;
 	uint32_t status;
 	uint32_t reason;
 };
 
-/**
- * struct ndi_delete_req - ndi delete request params
- * @transaction_id: unique identifier
- * @iface_name: interface name
- *
- */
-struct ndi_delete_req {
-	uint32_t transaction_id;
-	char  iface_name[IFACE_NAME_SIZE];
-};
-
 /**
  * struct ndi_delete_rsp - ndi delete response params
- * @transaction_id: unique identifier
  * @status: request status
  * @reason: reason if any
  *
  */
 struct ndi_delete_rsp {
-	uint32_t transaction_id;
 	uint32_t status;
 	uint32_t reason;
 };
@@ -6067,6 +6099,7 @@ struct ndp_initiator_rsp {
 	uint32_t vdev_id;
 	uint32_t ndp_instance_id;
 	uint32_t status;
+	uint32_t reason;
 };
 
 /**

+ 2 - 2
core/sme/inc/csr_api.h

@@ -610,8 +610,8 @@ typedef enum {
 	eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_SUCCESS,
 	eCSR_ROAM_EXT_CHG_CHNL_UPDATE_IND,
 
-	eCSR_ROAM_RESULT_NDP_CREATE_RSP,
-	eCSR_ROAM_RESULT_NDP_DELETE_RSP,
+	eCSR_ROAM_RESULT_NDI_CREATE_RSP,
+	eCSR_ROAM_RESULT_NDI_DELETE_RSP,
 	eCSR_ROAM_RESULT_NDP_INITIATOR_RSP,
 	eCSR_ROAM_RESULT_NDP_NEW_PEER_IND,
 	eCSR_ROAM_RESULT_NDP_CONFIRM_IND,

+ 0 - 17
core/sme/inc/sme_nan_datapath.h

@@ -98,13 +98,6 @@ void sme_ndp_message_processor(tpAniSirGlobal mac_ctx, uint16_t msg_type,
 QDF_STATUS csr_roam_start_ndi(tpAniSirGlobal mac_ctx, uint32_t session_id,
 			      tCsrRoamProfile *profile);
 
-void csr_roam_fill_roaminfo_ndp(tpAniSirGlobal mac_ctx,
-				tCsrRoamInfo *roam_info,
-				eCsrRoamResult roam_result,
-				tSirResultCodes status_code,
-				uint32_t reason_code,
-				uint32_t transaction_id);
-
 void csr_roam_save_ndi_connected_info(tpAniSirGlobal mac_ctx,
 				      uint32_t session_id,
 				      tCsrRoamProfile *roam_profile,
@@ -139,16 +132,6 @@ static inline QDF_STATUS csr_roam_start_ndi(tpAniSirGlobal mac_ctx,
 	return QDF_STATUS_SUCCESS;
 }
 
-/* Fill in ndp information in roam_info */
-static inline void csr_roam_fill_roaminfo_ndp(tpAniSirGlobal mac_ctx,
-					      tCsrRoamInfo *roam_info,
-					      eCsrRoamResult roam_result,
-					      tSirResultCodes status_code,
-					      uint32_t reason_code,
-					      uint32_t transaction_id)
-{
-}
-
 static inline void csr_roam_save_ndi_connected_info(tpAniSirGlobal mac_ctx,
 					uint32_t session_id,
 					tCsrRoamProfile *roam_profile,

+ 0 - 9
core/sme/src/csr/csr_api_roam.c

@@ -6431,11 +6431,6 @@ static void csr_roam_process_start_bss_success(tpAniSirGlobal mac_ctx,
 							&roam_status,
 							&roam_result,
 							&roam_info);
-			csr_roam_fill_roaminfo_ndp(mac_ctx,
-						&roam_info,
-						roam_result,
-						start_bss_rsp->statusCode,
-						0, 0);
 		}
 		/*
 		 * Only tell upper layer is we start the BSS because Vista
@@ -6919,10 +6914,6 @@ static bool csr_roam_process_results(tpAniSirGlobal mac_ctx, tSmeCmd *cmd,
 			csr_roam_update_ndp_return_params(mac_ctx,
 				eCsrStartBssFailure,
 				&roam_status, &roam_result, &roam_info);
-			csr_roam_fill_roaminfo_ndp(mac_ctx, &roam_info,
-				roam_result,
-				(start_bss_rsp) ? start_bss_rsp->statusCode :
-				QDF_STATUS_E_FAILURE, 0, 0);
 		}
 
 		if (context) {

+ 33 - 36
core/sme/src/nan/nan_datapath_api.c

@@ -298,36 +298,6 @@ QDF_STATUS csr_roam_start_ndi(tpAniSirGlobal mac_ctx, uint32_t session,
 	return status;
 }
 
-/**
- * csr_roam_fill_roaminfo_ndp() - fill the ndi create struct inside roam info
- * @mac_ctx: Global MAC context
- * @roam_info: roam info to be updated with ndi create params
- * @roam_result: roam result to update
- * @status_code: status code to update
- * @reason_code: reason code to update
- * @transaction_id: transcation id to update
- *
- * Return: None
- */
-void csr_roam_fill_roaminfo_ndp(tpAniSirGlobal mac_ctx,
-		tCsrRoamInfo *roam_info,
-		eCsrRoamResult roam_result,
-		tSirResultCodes status_code,
-		uint32_t reason_code,
-		uint32_t transaction_id)
-{
-	struct ndi_create_rsp *rsp_params;
-
-	sms_log(mac_ctx, LOG1,
-		FL("reason 0x%x, status 0x%x, transaction_id %d"),
-		reason_code, status_code, transaction_id);
-	rsp_params = (struct ndi_create_rsp *)
-			&roam_info->ndp.ndi_create_params;
-	rsp_params->reason = reason_code;
-	rsp_params->status = status_code;
-	rsp_params->transaction_id = transaction_id;
-}
-
 /**
  * csr_roam_save_ndi_connected_info() - Save connected profile parameters
  * @mac_ctx: Global MAC context
@@ -400,19 +370,32 @@ void csr_roam_update_ndp_return_params(tpAniSirGlobal mac_ctx,
 
 	switch (result) {
 	case eCsrStartBssSuccess:
+		roam_info->ndp.ndi_create_params.reason = 0;
+		roam_info->ndp.ndi_create_params.status =
+					NDP_RSP_STATUS_SUCCESS;
+		*roam_status = eCSR_ROAM_NDP_STATUS_UPDATE;
+		*roam_result = eCSR_ROAM_RESULT_NDI_CREATE_RSP;
+		break;
 	case eCsrStartBssFailure:
+		roam_info->ndp.ndi_create_params.status = NDP_RSP_STATUS_ERROR;
+		roam_info->ndp.ndi_create_params.reason =
+					NDP_NAN_DATA_IFACE_CREATE_FAILED;
 		*roam_status = eCSR_ROAM_NDP_STATUS_UPDATE;
-		*roam_result = eCSR_ROAM_RESULT_NDP_CREATE_RSP;
+		*roam_result = eCSR_ROAM_RESULT_NDI_CREATE_RSP;
 		break;
 	case eCsrStopBssSuccess:
+		roam_info->ndp.ndi_delete_params.reason = 0;
+		roam_info->ndp.ndi_delete_params.status =
+						NDP_RSP_STATUS_SUCCESS;
 		*roam_status = eCSR_ROAM_NDP_STATUS_UPDATE;
-		*roam_result = eCSR_ROAM_RESULT_NDP_DELETE_RSP;
-		roam_info->ndp.ndi_delete_params.status = QDF_STATUS_SUCCESS;
+		*roam_result = eCSR_ROAM_RESULT_NDI_DELETE_RSP;
 		break;
 	case eCsrStopBssFailure:
+		roam_info->ndp.ndi_delete_params.status = NDP_RSP_STATUS_ERROR;
+		roam_info->ndp.ndi_delete_params.reason =
+					NDP_NAN_DATA_IFACE_DELETE_FAILED;
 		*roam_status = eCSR_ROAM_NDP_STATUS_UPDATE;
-		*roam_result = eCSR_ROAM_RESULT_NDP_DELETE_RSP;
-		roam_info->ndp.ndi_delete_params.status = QDF_STATUS_E_FAILURE;
+		*roam_result = eCSR_ROAM_RESULT_NDI_DELETE_RSP;
 		break;
 	default:
 		sms_log(mac_ctx, LOGE,
@@ -431,6 +414,7 @@ void csr_roam_update_ndp_return_params(tpAniSirGlobal mac_ctx,
 QDF_STATUS csr_process_ndp_initiator_request(tpAniSirGlobal mac_ctx,
 					     tSmeCmd *cmd)
 {
+	QDF_STATUS status;
 	struct sir_sme_ndp_initiator_req *lim_msg;
 	uint16_t msg_len;
 	uint8_t *self_mac_addr = NULL;
@@ -462,7 +446,20 @@ QDF_STATUS csr_process_ndp_initiator_request(tpAniSirGlobal mac_ctx,
 	sms_log(mac_ctx, LOG1, FL("selfMac = "MAC_ADDRESS_STR),
 		MAC_ADDR_ARRAY(self_mac_addr));
 
-	return cds_send_mb_message_to_mac(lim_msg);
+	status = cds_send_mb_message_to_mac(lim_msg);
+	if (status != QDF_STATUS_SUCCESS) {
+		/*
+		 * If fail, free up the ndp_cfg and ndp_app_info
+		 * allocated in sme.
+		 */
+		qdf_mem_free(cmd->u.initiator_req.ndp_info.ndp_app_info);
+		qdf_mem_free(cmd->u.initiator_req.ndp_config.ndp_cfg);
+		cmd->u.initiator_req.ndp_info.ndp_app_info_len = 0;
+		cmd->u.initiator_req.ndp_config.ndp_cfg_len = 0;
+		cmd->u.initiator_req.ndp_config.ndp_cfg = NULL;
+		cmd->u.initiator_req.ndp_info.ndp_app_info = NULL;
+	}
+	return status;
 }
 
 /**

+ 18 - 14
core/wma/src/wma_nan_datapath.c

@@ -56,18 +56,18 @@ QDF_STATUS wma_handle_ndp_initiator_req(tp_wma_handle wma_handle, void *req)
 
 	if (NULL == ndp_req) {
 		WMA_LOGE(FL("Invalid ndp_req."));
-		goto send_ndi_initiator_fail;
+		goto send_ndp_initiator_fail;
 	}
 	vdev_id = ndp_req->vdev_id;
 	vdev = wma_find_vdev_by_id(wma_handle, vdev_id);
 	if (!vdev) {
 		WMA_LOGE(FL("vdev not found for vdev id %d."), vdev_id);
-		goto send_ndi_initiator_fail;
+		goto send_ndp_initiator_fail;
 	}
 
 	if (!WMA_IS_VDEV_IN_NDI_MODE(wma_handle->interfaces, vdev_id)) {
 		WMA_LOGE(FL("vdev :%d, not in NDI mode"), vdev_id);
-		goto send_ndi_initiator_fail;
+		goto send_ndp_initiator_fail;
 	}
 
 	/*
@@ -82,7 +82,7 @@ QDF_STATUS wma_handle_ndp_initiator_req(tp_wma_handle wma_handle, void *req)
 	buf = wmi_buf_alloc(wma_handle->wmi_handle, len);
 	if (!buf) {
 		WMA_LOGE(FL("wmi_buf_alloc failed"));
-		goto send_ndi_initiator_fail;
+		goto send_ndp_initiator_fail;
 	}
 	cmd = (wmi_ndp_initiator_req_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -141,18 +141,18 @@ QDF_STATUS wma_handle_ndp_initiator_req(tp_wma_handle wma_handle, void *req)
 		WMA_LOGE(FL("WMI_NDP_INITIATOR_REQ_CMDID failed, ret: %d"),
 			ret);
 		wmi_buf_free(buf);
-		goto send_ndi_initiator_fail;
+		goto send_ndp_initiator_fail;
 	}
 
 	return QDF_STATUS_SUCCESS;
 
-send_ndi_initiator_fail:
+send_ndp_initiator_fail:
 	status = QDF_STATUS_E_FAILURE;
 	if (ndp_req) {
 		ndp_rsp.vdev_id = ndp_req->vdev_id;
 		ndp_rsp.transaction_id = ndp_req->transaction_id;
 		ndp_rsp.ndp_instance_id = ndp_req->service_instance_id;
-		ndp_rsp.status = NDP_CMD_RSP_STATUS_ERROR;
+		ndp_rsp.status = NDP_DATA_INITIATOR_REQ_FAILED;
 	} else {
 		/* unblock SME queue, but do not send rsp to HDD */
 		pe_msg.bodyval = true;
@@ -198,12 +198,12 @@ QDF_STATUS wma_handle_ndp_responder_req(tp_wma_handle wma_handle,
 	vdev = wma_find_vdev_by_id(wma_handle, vdev_id);
 	if (!vdev) {
 		WMA_LOGE(FL("vdev not found for vdev id %d."), vdev_id);
-		goto send_ndi_responder_fail;
+		goto send_ndp_responder_fail;
 	}
 
 	if (!WMA_IS_VDEV_IN_NDI_MODE(wma_handle->interfaces, vdev_id)) {
 		WMA_LOGE(FL("vdev :$%d, not in NDI mode"), vdev_id);
-		goto send_ndi_responder_fail;
+		goto send_ndp_responder_fail;
 	}
 
 	/*
@@ -219,7 +219,7 @@ QDF_STATUS wma_handle_ndp_responder_req(tp_wma_handle wma_handle,
 	buf = wmi_buf_alloc(wma_handle->wmi_handle, len);
 	if (!buf) {
 		WMA_LOGE(FL("wmi_buf_alloc failed"));
-		goto send_ndi_responder_fail;
+		goto send_ndp_responder_fail;
 	}
 	cmd = (wmi_ndp_responder_req_fixed_param *) wmi_buf_data(buf);
 	WMITLV_SET_HDR(&cmd->tlv_header,
@@ -265,14 +265,15 @@ QDF_STATUS wma_handle_ndp_responder_req(tp_wma_handle wma_handle,
 		WMA_LOGE(FL("WMI_NDP_RESPONDER_REQ_CMDID failed, ret: %d"),
 			ret);
 		wmi_buf_free(buf);
-		goto send_ndi_responder_fail;
+		goto send_ndp_responder_fail;
 	}
 	return QDF_STATUS_SUCCESS;
-send_ndi_responder_fail:
+send_ndp_responder_fail:
 	qdf_mem_zero(&rsp, sizeof(rsp));
 	rsp.vdev_id = req_params->vdev_id;
 	rsp.transaction_id = req_params->transaction_id;
-	rsp.status = QDF_STATUS_E_FAILURE;
+	rsp.status = NDP_RSP_STATUS_ERROR;
+	rsp.reason = NDP_DATA_RESPONDER_REQ_FAILED;
 
 	pe_msg.bodyptr = &rsp;
 	pe_msg.type = SIR_HAL_NDP_RESPONDER_RSP;
@@ -348,7 +349,8 @@ QDF_STATUS wma_handle_ndp_end_req(tp_wma_handle wma_handle, void *ptr)
 send_ndp_end_fail:
 	pe_msg.type = SIR_HAL_NDP_END_RSP;
 	if (req) {
-		end_rsp.status = NDP_CMD_RSP_STATUS_ERROR;
+		end_rsp.status = NDP_RSP_STATUS_ERROR;
+		end_rsp.reason = NDP_END_FAILED;
 		end_rsp.transaction_id = req->transaction_id;
 		pe_msg.bodyptr = &end_rsp;
 	} else {
@@ -601,6 +603,7 @@ static int wma_ndp_end_response_event_handler(void *handle,
 		if (end_rsp->num_peers == 0) {
 			WMA_LOGE(FL("num_peers in NDP rsp should not be 0."));
 			end_rsp->status = NDP_CMD_RSP_STATUS_ERROR;
+			end_rsp->reason = NDP_END_FAILED;
 			goto send_ndp_end_rsp;
 		}
 		/* copy per peer response to return path buffer */
@@ -732,6 +735,7 @@ static int wma_ndp_initiator_rsp_event_handler(void *handle,
 	ndp_rsp.transaction_id = fixed_params->transaction_id;
 	ndp_rsp.ndp_instance_id = fixed_params->ndp_instance_id;
 	ndp_rsp.status = fixed_params->rsp_status;
+	ndp_rsp.reason = fixed_params->reason_code;
 
 	pe_msg.type = SIR_HAL_NDP_INITIATOR_RSP;
 	pe_msg.bodyptr = &ndp_rsp;