qcacld-3.0: Delete NAN data peer on confirm with reject

This is qcacld-2.0 to qcacld-3.0 propagation.

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
This commit is contained in:
Naveen Rawat
2016-06-29 18:26:22 -07:00
committed by Gerrit - the friendly Code Review server
vanhempi 64a9a1a5b3
commit 460be785ea
4 muutettua tiedostoa jossa 80 lisäystä ja 8 poistoa

Näytä tiedosto

@@ -1215,7 +1215,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 = (4 * sizeof(uint32_t)) + QDF_MAC_ADDR_SIZE + IFNAMSIZ +
@@ -1258,11 +1258,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"));
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG,

Näytä tiedosto

@@ -6135,6 +6135,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
@@ -6143,6 +6145,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;
struct qdf_mac_addr peer_ndi_mac_addr;
enum ndp_response_code rsp_code;
struct ndp_app_info ndp_info;

Näytä tiedosto

@@ -216,6 +216,52 @@ responder_rsp:
return ret_val;
}
/**
* 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,
struct qdf_mac_addr peer_ndi_mac_addr)
{
tpPESession session;
tpDphHashNode sta_ds;
uint16_t peer_idx;
lim_log(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)) {
lim_log(mac_ctx, LOGE,
FL("PE session is NULL or non-NDI for sme session %d"),
vdev_id);
return;
}
sta_ds = dph_lookup_hash_entry(mac_ctx, peer_ndi_mac_addr.bytes,
&peer_idx, &session->dph.dphHashTable);
if (!sta_ds) {
lim_log(mac_ctx, LOGE, FL("Unknown NDI Peer"));
return;
}
if (sta_ds->staType != STA_ENTRY_NDI_PEER) {
lim_log(mac_ctx, LOGE, FL("Non-NDI Peer ignored"));
return;
}
/*
* 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);
}
/**
* lim_ndp_delete_peers() - Delete NAN data peers
* @mac_ctx: handle to mac context
@@ -420,11 +466,28 @@ QDF_STATUS lim_handle_ndp_event_message(tpAniSirGlobal mac_ctx, cds_msg_t *msg)
QDF_STATUS status = QDF_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
*/
lim_log(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),

Näytä tiedosto

@@ -507,9 +507,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);
QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG,
@@ -522,6 +524,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);