diff options
| author | Naveen Rawat <nrawat@qca.qualcomm.com> | 2016-05-03 11:01:19 -0700 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2016-05-04 12:12:56 +0530 |
| commit | 056171ef51b1c94e02451f7f533d3f95b7313255 (patch) | |
| tree | 645151ccd800ccf8c82735c38733ca57cbb23612 | |
| parent | d12d8614653163660f86a8502141321c610a5f8b (diff) | |
qcacld-2.0: Delete NAN data peer on confirm with reject
Delete NAN data peer if first NDP_CONFIRM for a peer is received
with REJECT and active ndp instances as 0.
Change-Id: I9d3ff7166fb437f8af79e5bd915022d452b16a35
CRs-Fixed: 962367
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_nan_datapath.c | 7 | ||||
| -rw-r--r-- | CORE/MAC/inc/sirApi.h | 4 | ||||
| -rw-r--r-- | CORE/MAC/src/pe/nan/nan_datapath.c | 67 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/wma_nan_datapath.c | 9 |
4 files changed, 80 insertions, 7 deletions
diff --git a/CORE/HDD/src/wlan_hdd_nan_datapath.c b/CORE/HDD/src/wlan_hdd_nan_datapath.c index 8635bfbd65cb..e41d9c0ae6b4 100644 --- a/CORE/HDD/src/wlan_hdd_nan_datapath.c +++ b/CORE/HDD/src/wlan_hdd_nan_datapath.c @@ -1198,7 +1198,7 @@ static void hdd_ndp_confirm_ind_handler(hdd_adapter_t *adapter, hddLog(LOGE, FL("can't find addr: %pM in vdev_id: %d, peer table."), &ndp_confirm->peer_ndi_mac_addr, adapter->sessionId); - else + else if (ndp_confirm->rsp_code == NDP_RESPONSE_ACCEPT) ndp_ctx->active_ndp_sessions[idx]++; data_len = (3 * sizeof(uint32_t)) + VOS_MAC_ADDR_SIZE + IFNAMSIZ + @@ -1241,10 +1241,11 @@ static void hdd_ndp_confirm_ind_handler(hdd_adapter_t *adapter, 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"), + 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, ndp_confirm->peer_ndi_mac_addr.bytes, - ndp_qos_config, ndp_confirm->rsp_code); + ndp_qos_config, ndp_confirm->rsp_code, + ndp_confirm->reason_code); hddLog(LOG1, FL("NDP confim, ndp app info dump")); VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_DEBUG, diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h index 86dea9d2dac1..bdbfe5d92cd2 100644 --- a/CORE/MAC/inc/sirApi.h +++ b/CORE/MAC/inc/sirApi.h @@ -7267,6 +7267,8 @@ struct ndp_responder_rsp_event { * struct ndp_confirm_event - ndp confirmation event from FW * @vdev_id: session id of the interface over which ndp is being created * @ndp_instance_id: ndp instance id for which confirm is being generated + * @reason_code : reason code(opaque to driver) + * @num_active_ndps_on_peer: number of ndp instances on peer * @peer_ndi_mac_addr: peer NDI mac address * @rsp_code: ndp response code * @ndp_info: ndp application info @@ -7275,6 +7277,8 @@ struct ndp_responder_rsp_event { struct ndp_confirm_event { uint32_t vdev_id; uint32_t ndp_instance_id; + uint32_t reason_code; + uint32_t num_active_ndps_on_peer; v_MACADDR_t peer_ndi_mac_addr; enum ndp_response_code rsp_code; struct ndp_app_info ndp_info; diff --git a/CORE/MAC/src/pe/nan/nan_datapath.c b/CORE/MAC/src/pe/nan/nan_datapath.c index 206140cb46da..a9a034b8b604 100644 --- a/CORE/MAC/src/pe/nan/nan_datapath.c +++ b/CORE/MAC/src/pe/nan/nan_datapath.c @@ -216,6 +216,52 @@ responder_rsp: } /** + * lim_ndp_delete_peer_by_addr() - Delete NAN data peer, given addr and vdev_id + * @mac_ctx: handle to mac context + * @vdev_id: vdev_id on which peer was added + * @peer_ndi_mac_addr: mac addr of peer + * This function deletes a peer if there was NDP_Confirm with REJECT + * + * Return: None + */ +void lim_ndp_delete_peer_by_addr(tpAniSirGlobal mac_ctx, uint8_t vdev_id, + v_MACADDR_t peer_ndi_mac_addr) +{ + tpPESession session; + tpDphHashNode sta_ds; + uint16_t peer_idx; + + limLog(mac_ctx, LOG1, + FL("deleting peer: "MAC_ADDRESS_STR" confirm rejected"), + MAC_ADDR_ARRAY(peer_ndi_mac_addr.bytes)); + + session = pe_find_session_by_sme_session_id(mac_ctx, vdev_id); + if (!session || (session->bssType != eSIR_NDI_MODE)) { + limLog(mac_ctx, LOGE, + FL("PE session is NULL or non-NDI for sme session %d"), + vdev_id); + return; + } + + sta_ds = dphLookupHashEntry(mac_ctx, peer_ndi_mac_addr.bytes, + &peer_idx, &session->dph.dphHashTable); + if (!sta_ds) { + limLog(mac_ctx, LOGE, FL("Unknown NDI Peer")); + return; + } + if (sta_ds->staType != STA_ENTRY_NDI_PEER) { + limLog(mac_ctx, LOGE, FL("Non-NDI Peer ignored")); + return; + } + /* + * Call limDelSta() with response required set true. Hence DphHashEntry + * will be deleted after receiving that response. + */ + + limDelSta(mac_ctx, sta_ds, true, session); +} + +/** * lim_ndp_delete_peers() - Delete NAN data peers * @mac_ctx: handle to mac context * @ndp_map: NDP instance/peer map @@ -419,11 +465,28 @@ VOS_STATUS lim_handle_ndp_event_message(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) VOS_STATUS status = VOS_STATUS_SUCCESS; switch (msg->type) { - case SIR_HAL_NDP_CONFIRM: + case SIR_HAL_NDP_CONFIRM: { + struct ndp_confirm_event *ndp_confirm = msg->bodyptr; + if (ndp_confirm->rsp_code != NDP_RESPONSE_ACCEPT && + ndp_confirm->num_active_ndps_on_peer == 0) { + /* + * This peer was created at ndp_indication but + * ndp_confirm failed, so it needs to be deleted + */ + limLog(mac_ctx, LOGE, + FL("NDP confirm with reject and no active ndp sessions. deleting peer: "MAC_ADDRESS_STR" on vdev_id: %d"), + MAC_ADDR_ARRAY( + ndp_confirm->peer_ndi_mac_addr.bytes), + ndp_confirm->vdev_id); + lim_ndp_delete_peer_by_addr(mac_ctx, + ndp_confirm->vdev_id, + ndp_confirm->peer_ndi_mac_addr); + } lim_send_ndp_event_to_sme(mac_ctx, eWNI_SME_NDP_CONFIRM_IND, - msg->bodyptr, sizeof(struct ndp_confirm_event), + msg->bodyptr, sizeof(*ndp_confirm), msg->bodyval); break; + } case SIR_HAL_NDP_INITIATOR_RSP: lim_send_ndp_event_to_sme(mac_ctx, eWNI_SME_NDP_INITIATOR_RSP, msg->bodyptr, sizeof(struct ndp_initiator_rsp), diff --git a/CORE/SERVICES/WMA/wma_nan_datapath.c b/CORE/SERVICES/WMA/wma_nan_datapath.c index a9d32137d2ca..a25c6f507731 100644 --- a/CORE/SERVICES/WMA/wma_nan_datapath.c +++ b/CORE/SERVICES/WMA/wma_nan_datapath.c @@ -576,9 +576,11 @@ static int wma_ndp_confirm_event_handler(void *handle, uint8_t *event_info, event = (WMI_NDP_CONFIRM_EVENTID_param_tlvs *) event_info; fixed_params = (wmi_ndp_confirm_event_fixed_param *)event->fixed_param; - WMA_LOGE(FL("WMI_NDP_CONFIRM_EVENTID(0x%X) recieved. vdev %d, ndp_instance %d, rsp_code %d"), + WMA_LOGE(FL("WMI_NDP_CONFIRM_EVENTID(0x%X) recieved. vdev %d, ndp_instance %d, rsp_code %d, reason_code: %d, num_active_ndps_on_peer: %d"), WMI_NDP_CONFIRM_EVENTID, fixed_params->vdev_id, - fixed_params->ndp_instance_id, fixed_params->rsp_code); + fixed_params->ndp_instance_id, fixed_params->rsp_code, + fixed_params->reason_code, + fixed_params->num_active_ndps_on_peer); WMA_LOGE(FL("ndp_cfg - %d bytes"), fixed_params->ndp_cfg_len); VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_DEBUG, @@ -598,6 +600,9 @@ static int wma_ndp_confirm_event_handler(void *handle, uint8_t *event_info, ndp_confirm->vdev_id = fixed_params->vdev_id; ndp_confirm->ndp_instance_id = fixed_params->ndp_instance_id; ndp_confirm->rsp_code = fixed_params->rsp_code; + ndp_confirm->reason_code = fixed_params->reason_code; + ndp_confirm->num_active_ndps_on_peer = + fixed_params->num_active_ndps_on_peer; WMI_MAC_ADDR_TO_CHAR_ARRAY(&fixed_params->peer_ndi_mac_addr, ndp_confirm->peer_ndi_mac_addr.bytes); |
