summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeepak Dhamdhere <ddhamdhe@codeaurora.org>2016-06-04 00:24:52 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-07-06 13:31:29 -0700
commita6d2f4cec42eaef7d4e18ac8ab73a79714ccee51 (patch)
tree6af20d7baadbcdcca03b1822a0044d36d0bb1fca
parentf28315cd66a2034baab3484f3be21c37f0adc13b (diff)
qcacld-3.0: Process NDP data end indication
qcacld-2.0 to qcacld-3.0 propagation Firmware sends an array of: {ndp instance id, vdev id, active ndp num, peer mac address} for the NDP instances that are to be terminated. Host driver deletes the peers that have 0 active ndp instances and sends the entire list of ndp instance id's to the service layer. Change-Id: I325843ce7fb8198466cb66ce66710cef999d4581 CRs-Fixed: 962367
-rw-r--r--core/hdd/inc/wlan_hdd_assoc.h4
-rw-r--r--core/hdd/src/wlan_hdd_assoc.c24
-rw-r--r--core/hdd/src/wlan_hdd_nan_datapath.c111
-rw-r--r--core/mac/inc/sir_api.h42
-rw-r--r--core/mac/src/pe/lim/lim_process_message_queue.c1
-rw-r--r--core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c4
-rw-r--r--core/mac/src/pe/nan/nan_datapath.c190
-rw-r--r--core/mac/src/pe/nan/nan_datapath.h7
-rw-r--r--core/sme/inc/csr_api.h2
-rw-r--r--core/sme/src/common/sme_api.c2
-rw-r--r--core/sme/src/nan/nan_datapath_api.c23
-rw-r--r--core/wma/src/wma_dev_if.c5
-rw-r--r--core/wma/src/wma_nan_datapath.c108
-rw-r--r--core/wma/src/wma_nan_datapath.h6
14 files changed, 507 insertions, 22 deletions
diff --git a/core/hdd/inc/wlan_hdd_assoc.h b/core/hdd/inc/wlan_hdd_assoc.h
index 577aa3218528..7dac14b13d02 100644
--- a/core/hdd/inc/wlan_hdd_assoc.h
+++ b/core/hdd/inc/wlan_hdd_assoc.h
@@ -278,4 +278,8 @@ QDF_STATUS hdd_roam_register_sta(struct hdd_adapter_s *adapter,
bool hdd_save_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id,
struct qdf_mac_addr *peer_mac_addr);
+void hdd_delete_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id);
+int hdd_get_peer_idx(hdd_station_ctx_t *sta_ctx, struct qdf_mac_addr *addr);
+QDF_STATUS hdd_roam_deregister_sta(hdd_adapter_t *adapter, uint8_t sta_id);
+
#endif
diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c
index 731c6109c10c..c6a68e795eee 100644
--- a/core/hdd/src/wlan_hdd_assoc.c
+++ b/core/hdd/src/wlan_hdd_assoc.c
@@ -991,8 +991,7 @@ static void hdd_conn_remove_connect_info(hdd_station_ctx_t *pHddStaCtx)
*
* Return: QDF_STATUS enumeration
*/
-static QDF_STATUS
-hdd_roam_deregister_sta(hdd_adapter_t *pAdapter, uint8_t staId)
+QDF_STATUS hdd_roam_deregister_sta(hdd_adapter_t *pAdapter, uint8_t staId)
{
QDF_STATUS qdf_status;
hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
@@ -2581,6 +2580,27 @@ bool hdd_save_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id,
}
/**
+ * hdd_delete_peer() - removes peer from hdd station context peer table
+ * @sta_ctx: pointer to hdd station context
+ * @sta_id: station ID
+ *
+ * Return: None
+ */
+void hdd_delete_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id)
+{
+ int i;
+
+ for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) {
+ if (sta_id == sta_ctx->conn_info.staId[i]) {
+ sta_ctx->conn_info.staId[i] = 0;
+ return;
+ }
+ }
+
+ hdd_err(FL("sta_id %d is not present in peer table"), sta_id);
+}
+
+/**
* roam_remove_ibss_station() - Remove the IBSS peer MAC address in the adapter
* @pAdapter: pointer to adapter
* @staId: station id
diff --git a/core/hdd/src/wlan_hdd_nan_datapath.c b/core/hdd/src/wlan_hdd_nan_datapath.c
index d2a71b75db8e..cd01b6806019 100644
--- a/core/hdd/src/wlan_hdd_nan_datapath.c
+++ b/core/hdd/src/wlan_hdd_nan_datapath.c
@@ -1151,16 +1151,33 @@ static void hdd_ndp_new_peer_ind_handler(hdd_adapter_t *adapter,
}
/**
- * hdd_ndp_peer_departed_ind_handler() - NDP peer departed indication handler
+ * hdd_ndp_peer_departed_ind_handler() - Handle NDP peer departed indication
* @adapter: pointer to adapter context
* @ind_params: indication parameters
*
* Return: none
*/
-static void hdd_ndp_peer_departed_ind_handler(
- hdd_adapter_t *adapter, void *ind_params)
+static void hdd_ndp_peer_departed_ind_handler(hdd_adapter_t *adapter,
+ void *ind_params)
{
- return;
+ hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+ struct sme_ndp_peer_ind *peer_ind = ind_params;
+ struct nan_datapath_ctx *ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
+ hdd_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+
+ hdd_roam_deregister_sta(adapter, peer_ind->sta_id);
+ hdd_delete_peer(sta_ctx, peer_ind->sta_id);
+ hdd_ctx->sta_to_adapter[peer_ind->sta_id] = 0;
+
+ if (--ndp_ctx->active_ndp_peers == 0) {
+ hddLog(LOG1, FL("No more ndp peers."));
+ sta_ctx->conn_info.connState = eConnectionState_NdiDisconnected;
+ hdd_conn_set_connection_state(adapter,
+ eConnectionState_NdiDisconnected);
+ hddLog(LOG1, FL("Stop netif tx queues."));
+ wlan_hdd_netif_queue_control(adapter, WLAN_STOP_ALL_NETIF_QUEUE,
+ WLAN_CONTROL_PATH);
+ }
}
/**
@@ -1595,12 +1612,96 @@ ndp_end_rsp_nla_failed:
* @adapter: pointer to adapter context
* @ind_params: indication parameters
*
+ * Following vendor event is sent to cfg80211:
+ * QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD =
+ * QCA_WLAN_VENDOR_ATTR_NDP_END_IND (4 bytes)
+ * QCA_WLAN_VENDOR_ATTR_NDP_NUM_INSTANCE_ID (1 byte)
+ * QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY (4 * num of NDP Instances)
+ *
* Return: none
*/
static void hdd_ndp_end_ind_handler(hdd_adapter_t *adapter,
void *ind_params)
{
+ struct sk_buff *vendor_event;
+ hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+ struct ndp_end_indication_event *end_ind = ind_params;
+ uint32_t data_len, i;
+ struct nan_datapath_ctx *ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
+ hdd_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+ uint32_t *ndp_instance_array;
+
+ ENTER();
+
+ if (!end_ind) {
+ hdd_err(FL("Invalid ndp end indication"));
+ return;
+ }
+
+ if (0 != wlan_hdd_validate_context(hdd_ctx))
+ return;
+
+ ndp_instance_array = qdf_mem_malloc(end_ind->num_ndp_ids *
+ sizeof(*ndp_instance_array));
+ if (!ndp_instance_array) {
+ hdd_err("Failed to allocate ndp_instance_array");
+ return;
+ }
+ for (i = 0; i < end_ind->num_ndp_ids; i++) {
+ int idx;
+
+ ndp_instance_array[i] = end_ind->ndp_map[i].ndp_instance_id;
+ ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(
+ hdd_get_adapter_by_vdev(hdd_ctx,
+ end_ind->ndp_map[i].vdev_id));
+ idx = hdd_get_peer_idx(sta_ctx,
+ &end_ind->ndp_map[i].peer_ndi_mac_addr);
+ if (idx == INVALID_PEER_IDX) {
+ hddLog(LOGE,
+ FL("can't find addr: %pM in sta_ctx."),
+ &end_ind->ndp_map[i].peer_ndi_mac_addr);
+ continue;
+ }
+ /* save the value of active sessions on each peer */
+ ndp_ctx->active_ndp_sessions[idx] =
+ end_ind->ndp_map[i].num_active_ndp_sessions;
+ }
+
+ data_len = (sizeof(uint32_t)) +
+ sizeof(uint8_t) + NLMSG_HDRLEN + (2 * NLA_HDRLEN) +
+ end_ind->num_ndp_ids * sizeof(*ndp_instance_array);
+
+ vendor_event = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, NULL,
+ data_len, QCA_NL80211_VENDOR_SUBCMD_NDP_INDEX,
+ GFP_KERNEL);
+ if (!vendor_event) {
+ hdd_err(FL("cfg80211_vendor_event_alloc failed"));
+ return;
+ }
+
+ if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD,
+ QCA_WLAN_VENDOR_ATTR_NDP_END_IND))
+ goto ndp_end_ind_nla_failed;
+
+ if (nla_put_u8(vendor_event, QCA_WLAN_VENDOR_ATTR_NDP_NUM_INSTANCE_ID,
+ end_ind->num_ndp_ids))
+ goto ndp_end_ind_nla_failed;
+
+ if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY,
+ end_ind->num_ndp_ids * sizeof(*ndp_instance_array),
+ ndp_instance_array))
+ goto ndp_end_ind_nla_failed;
+
+ cfg80211_vendor_event(vendor_event, GFP_KERNEL);
+ qdf_mem_free(ndp_instance_array);
+ EXIT();
return;
+
+ndp_end_ind_nla_failed:
+ hdd_err(FL("nla_put api failed"));
+ kfree_skb(vendor_event);
+ qdf_mem_free(ndp_instance_array);
+ EXIT();
}
/**
@@ -1674,7 +1775,7 @@ void hdd_ndp_event_handler(hdd_adapter_t *adapter,
break;
case eCSR_ROAM_RESULT_NDP_END_IND:
hdd_ndp_end_ind_handler(adapter,
- &roam_info->ndp.ndp_end_ind_params);
+ roam_info->ndp.ndp_end_ind_params);
break;
default:
hdd_err(FL("Unknown NDP response event from SME %d"),
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 4f5f13ff98fb..6812cb602e6d 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -5918,6 +5918,32 @@ enum ndp_response_code {
};
/**
+ * enum ndp_end_type - NDP end type
+ * @NDP_END_TYPE_UNSPECIFIED: type is unspecified
+ * @NDP_END_TYPE_PEER_UNAVAILABLE: type is peer unavailable
+ * @NDP_END_TYPE_OTA_FRAME: NDP end frame received from peer
+ *
+ */
+enum ndp_end_type {
+ NDP_END_TYPE_UNSPECIFIED = 0x00,
+ NDP_END_TYPE_PEER_UNAVAILABLE = 0x01,
+ NDP_END_TYPE_OTA_FRAME = 0x02,
+};
+
+/**
+ * enum ndp_end_reason_code - NDP end reason code
+ * @NDP_END_REASON_UNSPECIFIED: reason is unspecified
+ * @NDP_END_REASON_INACTIVITY: reason is peer inactivity
+ * @NDP_END_REASON_PEER_DATA_END: data end indication received from peer
+ *
+ */
+enum ndp_end_reason_code {
+ NDP_END_REASON_UNSPECIFIED = 0x00,
+ NDP_END_REASON_INACTIVITY = 0x01,
+ NDP_END_REASON_PEER_DATA_END = 0x02,
+};
+
+/**
* struct ndp_cfg - ndp configuration
* @tag: unique identifier
* @ndp_cfg_len: ndp configuration length
@@ -6142,12 +6168,18 @@ struct ndp_end_req {
* @vdev_id: session id of the interface over which ndp is being created
* @peer_ndi_mac_addr: peer NDI mac address
* @num_active_ndp_sessions: number of active NDP sessions on the peer
+ * @type: NDP end indication type
+ * @reason_code: NDP end indication reason code
+ * @ndp_instance_id: NDP instance ID
*
*/
struct peer_ndp_map {
uint32_t vdev_id;
struct qdf_mac_addr peer_ndi_mac_addr;
uint32_t num_active_ndp_sessions;
+ enum ndp_end_type type;
+ enum ndp_end_reason_code reason_code;
+ uint32_t ndp_instance_id;
};
/**
@@ -6171,16 +6203,12 @@ struct ndp_end_rsp_event {
/**
* struct ndp_end_indication_event - ndp termination notification from FW
- * @vdev_id: session id of the interface over which ndp is being created
- * @reason: reason code for failure if any
- * @status: status of the request
- * @ndp_map: mapping of NDP instances to peer to VDEV
+ * @num_ndp_ids: number of NDP ids
+ * @ndp_map: mapping of NDP instances to peer and vdev
*
*/
struct ndp_end_indication_event {
- uint32_t vdev_id;
- uint32_t status;
- uint32_t reason;
+ uint32_t num_ndp_ids;
struct peer_ndp_map ndp_map[];
};
diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c
index 0868993e5b76..5aa94b0df17e 100644
--- a/core/mac/src/pe/lim/lim_process_message_queue.c
+++ b/core/mac/src/pe/lim/lim_process_message_queue.c
@@ -1932,7 +1932,6 @@ void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg)
qdf_mem_free((void *)msg->bodyptr);
msg->bodyptr = NULL;
/* Unwanted messages */
- /* Log error */
lim_log(mac_ctx, LOGE,
FL("Discarding unexpected message received %X"),
msg->type);
diff --git a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c
index 58391607579d..5637496c2519 100644
--- a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c
+++ b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c
@@ -1849,6 +1849,10 @@ void lim_process_mlm_del_sta_rsp(tpAniSirGlobal mac_ctx,
session_entry);
return;
}
+ if (LIM_IS_NDI_ROLE(session_entry)) {
+ lim_process_ndi_del_sta_rsp(mac_ctx, msg, session_entry);
+ return;
+ }
lim_process_sta_mlm_del_sta_rsp(mac_ctx, msg, session_entry);
}
diff --git a/core/mac/src/pe/nan/nan_datapath.c b/core/mac/src/pe/nan/nan_datapath.c
index 1f1faad6102b..511e633e4439 100644
--- a/core/mac/src/pe/nan/nan_datapath.c
+++ b/core/mac/src/pe/nan/nan_datapath.c
@@ -217,18 +217,195 @@ responder_rsp:
}
/**
- * lim_ndp_delete_peers() - Delete peers if needed
+ * lim_ndp_delete_peers() - Delete NAN data peers
* @mac_ctx: handle to mac context
- * @ndp_map: peer map of returning ndp end rsp
- * @num_peers: number of peers remaining after ndp end
+ * @ndp_map: NDP instance/peer map
+ * @num_peers: number of peers entries in peer_map
* This function deletes a peer if there are no active NDPs left with that peer
*
* Return: None
*/
static void lim_ndp_delete_peers(tpAniSirGlobal mac_ctx,
- struct peer_ndp_map *ndp_map,
- uint8_t num_peers)
+ struct peer_ndp_map *ndp_map, uint8_t num_peers)
{
+ tpDphHashNode sta_ds = NULL;
+ uint16_t deleted_num = 0;
+ int i, j;
+ tpPESession session;
+ struct qdf_mac_addr *deleted_peers;
+ uint16_t peer_idx;
+ bool found;
+
+ deleted_peers = qdf_mem_malloc(num_peers * sizeof(*deleted_peers));
+ if (!deleted_peers) {
+ lim_log(mac_ctx, LOGE, FL("Memory allocation failed"));
+ return;
+ }
+
+ qdf_mem_zero(deleted_peers, num_peers * sizeof(*deleted_peers));
+ for (i = 0; i < num_peers; i++) {
+ lim_log(mac_ctx, LOG1,
+ FL("ndp_map[%d]: MAC: " MAC_ADDRESS_STR " num_active %d"),
+ i,
+ MAC_ADDR_ARRAY(ndp_map[i].peer_ndi_mac_addr.bytes),
+ ndp_map[i].num_active_ndp_sessions);
+
+ /* Do not delete a peer with active NDPs */
+ if (ndp_map[i].num_active_ndp_sessions > 0)
+ continue;
+
+ session = pe_find_session_by_sme_session_id(mac_ctx,
+ ndp_map[i].vdev_id);
+ if (!session || (session->bssType != eSIR_NDI_MODE)) {
+ lim_log(mac_ctx, LOGE,
+ FL("PE session is NULL or non-NDI for sme session %d"),
+ ndp_map[i].vdev_id);
+ continue;
+ }
+
+ /* Check if this peer is already in the deleted list */
+ found = false;
+ for (j = 0; j < deleted_num && !found; j++) {
+ if (qdf_mem_cmp(
+ &deleted_peers[j].bytes,
+ &ndp_map[i].peer_ndi_mac_addr.bytes,
+ QDF_MAC_ADDR_SIZE)) {
+ found = true;
+ break;
+ }
+ }
+ if (found)
+ continue;
+
+ sta_ds = dph_lookup_hash_entry(mac_ctx,
+ ndp_map[i].peer_ndi_mac_addr.bytes,
+ &peer_idx, &session->dph.dphHashTable);
+ if (!sta_ds) {
+ lim_log(mac_ctx, LOGE, FL("Unknown NDI Peer"));
+ continue;
+ }
+ if (sta_ds->staType != STA_ENTRY_NDI_PEER) {
+ lim_log(mac_ctx, LOGE,
+ FL("Non-NDI Peer ignored"));
+ continue;
+ }
+ /*
+ * Call lim_del_sta() with response required set true.
+ * Hence DphHashEntry will be deleted after receiving
+ * that response.
+ */
+ lim_del_sta(mac_ctx, sta_ds, true, session);
+ qdf_copy_macaddr(&deleted_peers[deleted_num++],
+ &ndp_map[i].peer_ndi_mac_addr);
+ }
+ qdf_mem_free(deleted_peers);
+}
+
+/**
+ * lim_ndp_end_indication_handler() - Handler for NDP end indication
+ * @mac_ctx: handle to mac context
+ * @ind_buf: pointer to indication buffer
+ *
+ * It deletes peers from ndp_map. Response of that operation goes
+ * to LIM and HDD. But peer information does not go to service layer.
+ * ndp_id_list is sent to service layer; it is not interpreted by the
+ * driver.
+ *
+ * Return: QDF_STATUS_SUCCESS on success; error number otherwise
+ */
+static QDF_STATUS lim_ndp_end_indication_handler(tpAniSirGlobal mac_ctx,
+ uint32_t *ind_buf)
+{
+
+ struct ndp_end_indication_event *ndp_event_buf =
+ (struct ndp_end_indication_event *)ind_buf;
+ int buf_size;
+
+ if (!ind_buf) {
+ lim_log(mac_ctx, LOGE, FL("NDP end indication buffer is NULL"));
+ return QDF_STATUS_E_INVAL;
+ }
+ lim_ndp_delete_peers(mac_ctx, ndp_event_buf->ndp_map,
+ ndp_event_buf->num_ndp_ids);
+
+ buf_size = sizeof(*ndp_event_buf) + ndp_event_buf->num_ndp_ids *
+ sizeof(ndp_event_buf->ndp_map[0]);
+ lim_send_ndp_event_to_sme(mac_ctx, eWNI_SME_NDP_END_IND,
+ ndp_event_buf, buf_size, false);
+
+ return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * lim_process_ndi_del_sta_rsp() - Handle WDA_DELETE_STA_RSP in eLIM_NDI_ROLE
+ * @mac_ctx: Global MAC context
+ * @lim_msg: LIM message
+ * @pe_session: PE session
+ *
+ * Return: None
+ */
+void lim_process_ndi_del_sta_rsp(tpAniSirGlobal mac_ctx, tpSirMsgQ lim_msg,
+ tpPESession pe_session)
+{
+ tpDeleteStaParams del_sta_params = (tpDeleteStaParams) lim_msg->bodyptr;
+ tpDphHashNode sta_ds;
+ tSirResultCodes status = eSIR_SME_SUCCESS;
+ struct sme_ndp_peer_ind peer_ind;
+
+ if (!del_sta_params) {
+ lim_log(mac_ctx, LOGE,
+ FL("del_sta_params is NULL"));
+ return;
+ }
+ if (!LIM_IS_NDI_ROLE(pe_session)) {
+ lim_log(mac_ctx, LOGE,
+ FL("Session %d is not NDI role"), del_sta_params->assocId);
+ status = eSIR_SME_REFUSED;
+ goto skip_event;
+ }
+
+ sta_ds = dph_get_hash_entry(mac_ctx, del_sta_params->assocId,
+ &pe_session->dph.dphHashTable);
+ if (!sta_ds) {
+ lim_log(mac_ctx, LOGE,
+ FL("DPH Entry for STA %X is missing."),
+ del_sta_params->assocId);
+ status = eSIR_SME_REFUSED;
+ goto skip_event;
+ }
+
+ if (QDF_STATUS_SUCCESS != del_sta_params->status) {
+ lim_log(mac_ctx, LOGE, FL("DEL STA failed!"));
+ status = eSIR_SME_REFUSED;
+ goto skip_event;
+ }
+ lim_log(mac_ctx, LOG1,
+ FL("Deleted STA AssocID %d staId %d MAC " MAC_ADDRESS_STR),
+ sta_ds->assocId, sta_ds->staIndex,
+ MAC_ADDR_ARRAY(sta_ds->staAddr));
+
+ /*
+ * Copy peer info in del peer indication before
+ * lim_delete_dph_hash_entry is called as this will be lost.
+ */
+ peer_ind.msg_len = sizeof(peer_ind);
+ peer_ind.msg_type = eWNI_SME_NDP_PEER_DEPARTED_IND;
+ peer_ind.session_id = pe_session->smeSessionId;
+ peer_ind.sta_id = sta_ds->staIndex;
+ qdf_mem_copy(&peer_ind.peer_mac_addr.bytes,
+ sta_ds->staAddr, sizeof(tSirMacAddr));
+
+ lim_release_peer_idx(mac_ctx, sta_ds->assocId, pe_session);
+ lim_delete_dph_hash_entry(mac_ctx, sta_ds->staAddr, sta_ds->assocId,
+ pe_session);
+ pe_session->limMlmState = eLIM_MLM_IDLE_STATE;
+
+ lim_send_ndp_event_to_sme(mac_ctx, eWNI_SME_NDP_PEER_DEPARTED_IND,
+ &peer_ind, sizeof(peer_ind), false);
+
+skip_event:
+ qdf_mem_free(del_sta_params);
+ lim_msg->bodyptr = NULL;
}
/**
@@ -278,6 +455,9 @@ QDF_STATUS lim_handle_ndp_event_message(tpAniSirGlobal mac_ctx, cds_msg_t *msg)
msg->bodyptr, rsp_len, msg->bodyval);
break;
}
+ case SIR_HAL_NDP_END_IND:
+ status = lim_ndp_end_indication_handler(mac_ctx, msg->bodyptr);
+ break;
default:
lim_log(mac_ctx, LOGE,
FL("Unhandled NDP event: %d"), msg->type);
diff --git a/core/mac/src/pe/nan/nan_datapath.h b/core/mac/src/pe/nan/nan_datapath.h
index 556de8d5a732..360a3e90dece 100644
--- a/core/mac/src/pe/nan/nan_datapath.h
+++ b/core/mac/src/pe/nan/nan_datapath.h
@@ -115,6 +115,9 @@ void lim_ndi_del_bss_rsp(tpAniSirGlobal mac_ctx,
void lim_ndp_add_sta_rsp(tpAniSirGlobal mac_ctx, tpPESession session_entry,
tAddStaParams *add_sta_rsp);
+void lim_process_ndi_del_sta_rsp(tpAniSirGlobal mac_ctx, tpSirMsgQ lim_msg,
+ tpPESession pe_session);
+
#else
/* Function to process NDP requests */
@@ -141,6 +144,10 @@ static inline void lim_ndi_del_bss_rsp(tpAniSirGlobal mac_ctx,
void *msg, tpPESession session_entry)
{
}
+static inline void lim_process_ndi_del_sta_rsp(tpAniSirGlobal mac_ctx,
+ tpSirMsgQ lim_msg, tpPESession pe_session)
+{
+}
static inline void lim_ndp_add_sta_rsp(tpAniSirGlobal mac_ctx,
tpPESession session_entry,
diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h
index c72d8aca3632..b59650daa613 100644
--- a/core/sme/inc/csr_api.h
+++ b/core/sme/inc/csr_api.h
@@ -1383,7 +1383,7 @@ typedef struct tagCsrRoamInfo {
union {
struct sme_ndp_peer_ind ndp_peer_ind_params;
struct ndp_schedule_update_rsp ndp_sched_upd_rsp_params;
- struct ndp_end_indication_event ndp_end_ind_params;
+ struct ndp_end_indication_event *ndp_end_ind_params;
struct ndp_end_rsp_event *ndp_end_rsp_params;
struct ndp_confirm_event ndp_confirm_params;
struct ndp_responder_rsp_event ndp_responder_rsp_params;
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index 7cced88f04c4..d8b9a56bf803 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -3019,6 +3019,8 @@ QDF_STATUS sme_process_msg(tHalHandle hHal, cds_msg_t *pMsg)
case eWNI_SME_NDP_INDICATION:
case eWNI_SME_NDP_RESPONDER_RSP:
case eWNI_SME_NDP_END_RSP:
+ case eWNI_SME_NDP_END_IND:
+ case eWNI_SME_NDP_PEER_DEPARTED_IND:
sme_ndp_msg_processor(pMac, pMsg);
break;
default:
diff --git a/core/sme/src/nan/nan_datapath_api.c b/core/sme/src/nan/nan_datapath_api.c
index 4648d56f72a1..828d809f9053 100644
--- a/core/sme/src/nan/nan_datapath_api.c
+++ b/core/sme/src/nan/nan_datapath_api.c
@@ -688,6 +688,27 @@ void sme_ndp_msg_processor(tpAniSirGlobal mac_ctx, cds_msg_t *msg)
cmd->u.data_end_req->num_ndp_instances;
break;
}
+ case eWNI_SME_NDP_END_IND:
+ result = eCSR_ROAM_RESULT_NDP_END_IND;
+ roam_info.ndp.ndp_end_ind_params = msg->bodyptr;
+ /*
+ * NDP_END_IND is independent of session, but session_id is
+ * needed for csr_roam_call_callback(). Set it to vdev_id of
+ * first entry which is a valid session. vdev_id is likely to
+ * be same for all.
+ */
+ session_id =
+ roam_info.ndp.ndp_end_ind_params->ndp_map[0].vdev_id;
+ break;
+ case eWNI_SME_NDP_PEER_DEPARTED_IND:
+ result = eCSR_ROAM_RESULT_NDP_PEER_DEPARTED_IND;
+ /* copy msg from msg body to roam info passed to callback */
+ qdf_mem_copy(&roam_info.ndp.ndp_peer_ind_params,
+ msg->bodyptr,
+ sizeof(roam_info.ndp.ndp_peer_ind_params));
+ session_id =
+ ((struct sme_ndp_peer_ind *)msg->bodyptr)->session_id;
+ break;
default:
sms_log(mac_ctx, LOGE, FL("Unhandled NDP rsp"));
qdf_mem_free(msg->bodyptr);
@@ -725,6 +746,8 @@ void sme_ndp_msg_processor(tpAniSirGlobal mac_ctx, cds_msg_t *msg)
cmd->u.data_end_req = NULL;
}
break;
+ case eWNI_SME_NDP_END_IND:
+ break;
default:
break;
}
diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c
index e785e2b1fc7e..f43ead6a6b5e 100644
--- a/core/wma/src/wma_dev_if.c
+++ b/core/wma/src/wma_dev_if.c
@@ -4112,6 +4112,8 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta)
oper_mode = BSS_OPERATIONAL_MODE_IBSS;
WMA_LOGD("%s: to delete sta for IBSS mode", __func__);
}
+ if (del_sta->staType == STA_ENTRY_NDI_PEER)
+ oper_mode = BSS_OPERATIONAL_MODE_NDI;
switch (oper_mode) {
case BSS_OPERATIONAL_MODE_STA:
@@ -4138,6 +4140,9 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta)
qdf_mem_free(del_sta);
}
break;
+ case BSS_OPERATIONAL_MODE_NDI:
+ wma_delete_sta_req_ndi_mode(wma, del_sta);
+ break;
}
#ifdef QCA_IBSS_SUPPORT
diff --git a/core/wma/src/wma_nan_datapath.c b/core/wma/src/wma_nan_datapath.c
index 811736802852..22c3b5209ea7 100644
--- a/core/wma/src/wma_nan_datapath.c
+++ b/core/wma/src/wma_nan_datapath.c
@@ -654,7 +654,69 @@ send_ndp_end_rsp:
static int wma_ndp_end_indication_event_handler(void *handle,
uint8_t *event_info, uint32_t len)
{
- return 0;
+ tp_wma_handle wma_handle = handle;
+ WMI_NDP_END_INDICATION_EVENTID_param_tlvs *event;
+ wmi_ndp_end_indication *ind;
+ cds_msg_t pe_msg;
+ struct ndp_end_indication_event *ndp_event_buf;
+ int i, ret, buf_size;
+ struct qdf_mac_addr peer_addr;
+
+ event = (WMI_NDP_END_INDICATION_EVENTID_param_tlvs *) event_info;
+
+ if (event->num_ndp_end_indication_list == 0) {
+ WMA_LOGE(
+ FL("Error: Event ignored, 0 ndp instances"));
+ return -EINVAL;
+ }
+
+ WMA_LOGD(FL("number of ndp instances = %d"),
+ event->num_ndp_end_indication_list);
+
+ buf_size = sizeof(*ndp_event_buf) + event->num_ndp_end_indication_list *
+ sizeof(ndp_event_buf->ndp_map[0]);
+ ndp_event_buf = qdf_mem_malloc(buf_size);
+ if (!ndp_event_buf) {
+ WMA_LOGP(FL("Failed to allocate memory"));
+ return -ENOMEM;
+ }
+ qdf_mem_zero(ndp_event_buf, buf_size);
+ ndp_event_buf->num_ndp_ids = event->num_ndp_end_indication_list;
+
+ ind = event->ndp_end_indication_list;
+ for (i = 0; i < ndp_event_buf->num_ndp_ids; i++) {
+ WMI_MAC_ADDR_TO_CHAR_ARRAY(
+ &ind[i].peer_ndi_mac_addr,
+ peer_addr.bytes);
+ WMA_LOGD(
+ FL("ind[%d]: type %d, reason_code %d, instance_id %d num_active %d MAC: " MAC_ADDRESS_STR),
+ i,
+ ind[i].type,
+ ind[i].reason_code,
+ ind[i].ndp_instance_id,
+ ind[i].num_active_ndps_on_peer,
+ MAC_ADDR_ARRAY(peer_addr.bytes));
+
+ /* Add each instance entry to the list */
+ ndp_event_buf->ndp_map[i].ndp_instance_id =
+ ind[i].ndp_instance_id;
+ ndp_event_buf->ndp_map[i].vdev_id = ind[i].vdev_id;
+ WMI_MAC_ADDR_TO_CHAR_ARRAY(&ind[i].peer_ndi_mac_addr,
+ ndp_event_buf->ndp_map[i].peer_ndi_mac_addr.bytes);
+ ndp_event_buf->ndp_map[i].num_active_ndp_sessions =
+ ind[i].num_active_ndps_on_peer;
+ ndp_event_buf->ndp_map[i].type = ind[i].type;
+ ndp_event_buf->ndp_map[i].reason_code =
+ ind[i].reason_code;
+ }
+
+ pe_msg.type = SIR_HAL_NDP_END_IND;
+ pe_msg.bodyptr = ndp_event_buf;
+ pe_msg.bodyval = 0;
+ ret = wma_handle->pe_ndp_event_handler(wma_handle->mac_context,
+ &pe_msg);
+ qdf_mem_free(ndp_event_buf);
+ return ret;
}
/**
@@ -1173,3 +1235,47 @@ send_rsp:
add_sta->staMac, add_sta->status);
wma_send_msg(wma, WMA_ADD_STA_RSP, (void *)add_sta, 0);
}
+
+/**
+ * wma_delete_sta_req_ndi_mode() - Process DEL_STA request for NDI data peer
+ * @wma: WMA context
+ * @del_sta: DEL_STA parameters from LIM
+ *
+ * Removes wma/txrx peer entry for the NDI STA
+ *
+ * Return: None
+ */
+void wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
+ tpDeleteStaParams del_sta)
+{
+ ol_txrx_pdev_handle pdev;
+ struct ol_txrx_peer_t *peer;
+
+ pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+
+ if (!pdev) {
+ WMA_LOGE(FL("Failed to get pdev"));
+ del_sta->status = QDF_STATUS_E_FAILURE;
+ goto send_del_rsp;
+ }
+
+ peer = ol_txrx_peer_find_by_local_id(pdev, del_sta->staIdx);
+ if (!peer) {
+ WMA_LOGE(FL("Failed to get peer handle using peer id %d"),
+ del_sta->staIdx);
+ del_sta->status = QDF_STATUS_E_FAILURE;
+ goto send_del_rsp;
+ }
+
+ wma_remove_peer(wma, peer->mac_addr.raw, del_sta->smesessionId, peer,
+ false);
+ del_sta->status = QDF_STATUS_SUCCESS;
+
+send_del_rsp:
+ if (del_sta->respReqd) {
+ WMA_LOGD(FL("Sending del rsp to umac (status: %d)"),
+ del_sta->status);
+ wma_send_msg(wma, WMA_DELETE_STA_RSP, del_sta, 0);
+ }
+}
+
diff --git a/core/wma/src/wma_nan_datapath.h b/core/wma/src/wma_nan_datapath.h
index 553cb60af54c..ace8e31bd80b 100644
--- a/core/wma/src/wma_nan_datapath.h
+++ b/core/wma/src/wma_nan_datapath.h
@@ -60,6 +60,8 @@ void wma_add_bss_ndi_mode(tp_wma_handle wma, tpAddBssParams add_bss);
void wma_add_sta_ndi_mode(tp_wma_handle wma, tpAddStaParams add_sta);
QDF_STATUS wma_handle_ndp_initiator_req(tp_wma_handle wma_handle, void *req);
QDF_STATUS wma_handle_ndp_end_req(tp_wma_handle wma_handle, void *req);
+void wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
+ tpDeleteStaParams del_sta);
#else
#define WMA_IS_VDEV_IN_NDI_MODE(intf, vdev_id) (false)
static inline void wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,
@@ -102,6 +104,10 @@ static inline QDF_STATUS wma_handle_ndp_end_req(tp_wma_handle wma_handle,
{
return QDF_STATUS_SUCCESS;
}
+static inline void wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
+ tpDeleteStaParams del_sta)
+{
+}
#endif /* WLAN_FEATURE_NAN_DATAPATH */
#endif /* __WMA_NAN_DATAPATH_H */