qcacld-2.0: Fix invalid peer local id in sap start bss

Currently when cac ends, it will trigger eSAP_START_BSS_EVENT
with peer local id 0. If there is no peer with local id 0, sap
starts fails.
Actually valid peer local id should be found based on self mac
address of the sap.

Change-Id: I3779cb181390650844475b1a2f18768cb5784cf2
CRs-Fixed: 1096534
This commit is contained in:
bings 2016-12-02 10:55:41 +08:00 committed by syphyr
parent c2a2f18a1b
commit 7f9393fd9c
3 changed files with 52 additions and 2 deletions

View file

@ -2034,6 +2034,42 @@ VOS_STATUS tl_shim_get_vdevid(struct ol_txrx_peer_t *peer, u_int8_t *vdev_id)
return VOS_STATUS_SUCCESS;
}
#ifdef QCA_SUPPORT_TXRX_LOCAL_PEER_ID
/**
* tl_shim_get_sta_id_by_addr() - get peer local id given the MAC address.
* @vos_context: pointer to vos context
* @mac_addr: pointer to mac address
*
* Return: local id of the peer given the MAC address.
*/
uint16_t tl_shim_get_sta_id_by_addr(void *vos_context, uint8_t *mac_addr)
{
struct ol_txrx_peer_t *peer;
ol_txrx_pdev_handle pdev;
uint8_t peer_id;
if (vos_context == NULL || mac_addr == NULL) {
TLSHIM_LOGE("Invalid argument %p, %p", vos_context, mac_addr);
return 0;
}
pdev = vos_get_context(VOS_MODULE_ID_TXRX, vos_context);
if (!pdev) {
TLSHIM_LOGE("PDEV [%pM] not found", mac_addr);
return 0;
}
peer = ol_txrx_find_peer_by_addr(pdev, mac_addr, &peer_id);
if (!peer) {
TLSHIM_LOGW("PEER [%pM] not found", mac_addr);
return 0;
}
return peer->local_id;
}
#endif
/*
* Function to get vdev(tl_context) given the MAC address.
*/

View file

@ -2761,7 +2761,9 @@ sapSignalHDDevent
}
else
{
sapApAppEvent.sapevt.sapStartBssCompleteEvent.staId = 0;
sapApAppEvent.sapevt.sapStartBssCompleteEvent.staId =
tl_shim_get_sta_id_by_addr(sapContext->pvosGCtx,
sapContext->self_mac_addr);
}
VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s(eSAP_START_BSS_EVENT): staId = %d",

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, 2016 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2014, 2016-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@ -2942,4 +2942,16 @@ VOS_STATUS WLANTL_RegisterOCBPeer(void *vos_ctx, uint8_t *mac_addr,
void WLANTL_display_datapath_stats(void *vos_ctx, uint16_t bitmap);
void WLANTL_clear_datapath_stats(void *vos_ctx, uint16_t bitmap);
#ifdef QCA_SUPPORT_TXRX_LOCAL_PEER_ID
/**
* tl_shim_get_sta_id_by_addr() - get peer local id given the MAC address.
* @vos_context: pointer to vos context
* @mac_addr: pointer to mac address
*
* Return: local id of the peer given the MAC address.
*/
uint16_t tl_shim_get_sta_id_by_addr(void *vos_context, uint8_t *mac_addr);
#else
#define tl_shim_get_sta_id_by_addr(vos_context,mac_addr) 0
#endif
#endif /* #ifndef WLAN_QCT_WLANTL_H */