From 99f350f01dd80c0dc639b1436cb27da08a0db6dd Mon Sep 17 00:00:00 2001 From: hqu Date: Wed, 27 Feb 2019 17:40:03 +0800 Subject: qcacld-3.0: Drop the beacons from adjacent unsafe channel In platform that support dual wifi card, test 2.4G STA+SAP LTE coex case, when wlan tool receive lte coex event, it will make SAP switch to safe channel, then disconnects/reconnects STA, if STA is connected on unsafe channel and there is no reference AP on safe channel, design should be that STA won't connect again after disconnect because driver will remove unsafe channel from scan channel list during scanning. Although STA doesn't scan the unsafe channel, it still receives the unsafe channel AP's beacon from adjacent channel scan, STA will reconnect on unsafe channel and SAP will switch to unsafe channel again because SAP will follow STA's connected channel to SCC. Fix is to drop the beacons from adjacent unsafe channel. Change-Id: I80259d95b9a9b1a071e2c89d9d194131820d8205 CRs-Fixed: 2380491 --- core/mac/src/pe/lim/lim_scan_result_utils.c | 31 +++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/core/mac/src/pe/lim/lim_scan_result_utils.c b/core/mac/src/pe/lim/lim_scan_result_utils.c index 3d69a5e0096a..01979f416566 100644 --- a/core/mac/src/pe/lim/lim_scan_result_utils.c +++ b/core/mac/src/pe/lim/lim_scan_result_utils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -381,6 +381,12 @@ lim_check_and_add_bss_description(tpAniSirGlobal mac_ctx, tSirMacAddr bssid_zero = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; tpSirMacDataHdr3a hdr; + uint16_t unsafe_chan[NUM_CHANNELS]; + uint16_t unsafe_chan_cnt = 0; + uint16_t cnt = 0; + bool is_unsafe_chan = false; + qdf_device_t qdf_ctx; + hdr = WMA_GET_RX_MPDUHEADER3A((uint8_t *) rx_packet_info); /* Check For Null BSSID and Skip in case of P2P */ @@ -423,8 +429,29 @@ lim_check_and_add_bss_description(tpAniSirGlobal mac_ctx, if (freq_diff <= 10) drop_bcn_prb_rsp = false; } + + qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + if (!qdf_ctx) { + pe_err("qdf_ctx is NULL"); + return; + } + pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, + &unsafe_chan_cnt, + sizeof(unsafe_chan)); + if (mac_ctx->roam.configParam.sta_roam_policy. + skip_unsafe_channels && unsafe_chan_cnt) { + for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { + if (unsafe_chan[cnt] == + rx_chan_in_beacon) { + is_unsafe_chan = true; + break; + } + } + } + /* Drop beacon, if CH do not match, Drop */ - if (!fProbeRsp && drop_bcn_prb_rsp) { + if (!fProbeRsp && + (drop_bcn_prb_rsp || is_unsafe_chan)) { pe_debug("Beacon Rsp dropped. Channel in BD: %d Channel in beacon: %d", rx_chan_bd, rx_chan_in_beacon); return; -- cgit v1.2.3