qcacld-3.0: Fix failure of NDP peer save

Invocation of wrong api hdd_is_valid_mac_address() makes hdd_save_peer()
always return false due to which hdd_roam_register_sta() is skipped in
hdd_ndp_new_peer_handler() and can cause ping failure.

To fix this, use api qdf_is_macaddr_zero() instead of
hdd_is_valid_mac_address() in hdd_save_peer() to get the unused
entry in NDP peer mac table.

Change-Id: Id9aa6bcebb7fd168ee281065ebffe7227f9bc10f
CRs-Fixed: 2554502
This commit is contained in:
Rajeev Kumar Sirasanagandla 2019-11-11 10:49:18 -08:00 committed by nshrivas
parent c34d97c26f
commit d320ac4d17
3 changed files with 43 additions and 16 deletions

View File

@ -424,9 +424,29 @@ QDF_STATUS hdd_roam_register_sta(struct hdd_adapter *adapter,
struct csr_roam_info *roam_info,
struct bss_description *bss_desc);
/**
* hdd_save_peer() - Save peer MAC address in adapter peer table.
* @sta_ctx: pointer to hdd station context
* @peer_mac_addr: mac address of new peer
*
* This information is passed to iwconfig later. The peer that joined
* last is passed as information to iwconfig.
* Return: true if success, false otherwise
*/
bool hdd_save_peer(struct hdd_station_ctx *sta_ctx,
struct qdf_mac_addr *peer_mac_addr);
/**
* hdd_delete_peer() - removes peer from hdd station context peer table
* @sta_ctx: pointer to hdd station context
* @peer_mac_addr: mac address of peer to be deleted
*
* Return: None
*/
void hdd_delete_peer(struct hdd_station_ctx *sta_ctx,
struct qdf_mac_addr *peer_mac_addr);
/**
* hdd_roam_deregister_sta() - deregister station
* @adapter: pointer to adapter

View File

@ -3699,36 +3699,40 @@ hdd_association_completion_handler(struct hdd_adapter *adapter,
return QDF_STATUS_SUCCESS;
}
/**
* hdd_save_peer() - Save peer MAC address in adapter peer table.
* @sta_ctx: pointer to hdd station context
* @sta_id: station ID
* @peer_mac_addr: mac address of new peer
*
* This information is passed to iwconfig later. The peer that joined
* last is passed as information to iwconfig.
* Return: true if success, false otherwise
*/
bool hdd_save_peer(struct hdd_station_ctx *sta_ctx,
struct qdf_mac_addr *peer_mac_addr)
{
int idx;
struct qdf_mac_addr *mac_addr;
for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) {
if (hdd_is_valid_mac_address(
sta_ctx->conn_info.peer_macaddr[idx].bytes)) {
mac_addr = &sta_ctx->conn_info.peer_macaddr[idx];
if (qdf_is_macaddr_zero(mac_addr)) {
hdd_debug("adding peer: %pM at idx: %d",
peer_mac_addr, idx);
qdf_copy_macaddr(
&sta_ctx->conn_info.peer_macaddr[idx],
peer_mac_addr);
qdf_copy_macaddr(mac_addr, peer_mac_addr);
return true;
}
}
return false;
}
void hdd_delete_peer(struct hdd_station_ctx *sta_ctx,
struct qdf_mac_addr *peer_mac_addr)
{
int i;
struct qdf_mac_addr *mac_addr;
for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) {
mac_addr = &sta_ctx->conn_info.peer_macaddr[i];
if (qdf_is_macaddr_equal(mac_addr, peer_mac_addr)) {
qdf_zero_macaddr(mac_addr);
return;
}
}
}
/**
* roam_remove_ibss_station() - Remove the IBSS peer MAC address in the adapter
* @adapter: pointer to adapter

View File

@ -777,6 +777,7 @@ void hdd_ndi_drv_ndi_delete_rsp_handler(uint8_t vdev_id)
struct hdd_context *hdd_ctx;
struct hdd_adapter *adapter;
struct hdd_station_ctx *sta_ctx;
struct qdf_mac_addr bc_mac_addr = QDF_MAC_ADDR_BCAST_INIT;
hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
if (!hdd_ctx) {
@ -797,6 +798,7 @@ void hdd_ndi_drv_ndi_delete_rsp_handler(uint8_t vdev_id)
}
hdd_roam_deregister_sta(adapter, adapter->mac_addr);
hdd_delete_peer(sta_ctx, &bc_mac_addr);
wlan_hdd_netif_queue_control(adapter,
WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
@ -922,6 +924,7 @@ void hdd_ndp_peer_departed_handler(uint8_t vdev_id, uint16_t sta_id,
}
hdd_roam_deregister_sta(adapter, *peer_mac_addr);
hdd_delete_peer(sta_ctx, peer_mac_addr);
if (last_peer) {
hdd_info("No more ndp peers.");