From 987f6b13dcc5b1865fe733bfa4c7f41e9f42e77e Mon Sep 17 00:00:00 2001 From: nakul kachhwaha Date: Fri, 26 Jul 2019 11:41:23 +0530 Subject: [PATCH] qcacld-3.0: Properly configuring OpClass into TDLS Peer OpClass in TDLS peer is configured using gTDLSPrefOffChanNum and gTDLSPrefOffChanBandwidth INIs. Values of OffChanBandwidth INI can't distinguish 40+ and 40- BW which is required to fetch the correct Opclass for a given channel from regdb. Adding function which will convert OffChanBandwidth value into required value before fetching opclass. This is required for TDLS 5.9 Cert Test Case. Change-Id: Iba27034335309472d16a6aeef819995504674fc5 CRs-Fixed: 2457369 --- components/tdls/core/src/wlan_tdls_peer.c | 38 +++++++++++++++++++---- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/components/tdls/core/src/wlan_tdls_peer.c b/components/tdls/core/src/wlan_tdls_peer.c index 78dcf8f30435..6ba81500b547 100644 --- a/components/tdls/core/src/wlan_tdls_peer.c +++ b/components/tdls/core/src/wlan_tdls_peer.c @@ -144,6 +144,35 @@ uint8_t tdls_find_opclass(struct wlan_objmgr_psoc *psoc, uint8_t channel, bw_offset); } +static uint8_t +tdls_get_opclass_from_bandwidth(struct tdls_soc_priv_obj *soc_obj, + struct tdls_peer *peer) +{ + uint8_t opclass; + uint8_t bw_offset = soc_obj->tdls_configs.tdls_pre_off_chan_bw; + uint8_t channel = peer->pref_off_chan_num; + + if (bw_offset & (1 << BW_80_OFFSET_BIT)) { + opclass = tdls_find_opclass(soc_obj->soc, + channel, BW80); + } else if (bw_offset & (1 << BW_40_OFFSET_BIT)) { + opclass = tdls_find_opclass(soc_obj->soc, + channel, BW40_LOW_PRIMARY); + if (!opclass) { + opclass = tdls_find_opclass(soc_obj->soc, + channel, BW40_HIGH_PRIMARY); + } + } else if (bw_offset & (1 << BW_20_OFFSET_BIT)) { + opclass = tdls_find_opclass(soc_obj->soc, + channel, BW20); + } else { + opclass = tdls_find_opclass(soc_obj->soc, + channel, BWALL); + } + + return opclass; +} + /** * tdls_add_peer() - add TDLS peer in TDLS vdev object * @vdev_obj: TDLS vdev object @@ -182,9 +211,8 @@ static struct tdls_peer *tdls_add_peer(struct tdls_vdev_priv_obj *vdev_obj, peer->pref_off_chan_num = soc_obj->tdls_configs.tdls_pre_off_chan_num; peer->op_class_for_pref_off_chan = - tdls_find_opclass(soc_obj->soc, - peer->pref_off_chan_num, - soc_obj->tdls_configs.tdls_pre_off_chan_bw); + tdls_get_opclass_from_bandwidth(soc_obj, peer); + peer->sta_id = INVALID_TDLS_PEER_ID; qdf_list_insert_back(head, &peer->node); @@ -750,9 +778,7 @@ QDF_STATUS tdls_reset_peer(struct tdls_vdev_priv_obj *vdev_obj, config = &soc_obj->tdls_configs; curr_peer->pref_off_chan_num = config->tdls_pre_off_chan_num; curr_peer->op_class_for_pref_off_chan = - tdls_find_opclass(soc_obj->soc, - curr_peer->pref_off_chan_num, - config->tdls_pre_off_chan_bw); + tdls_get_opclass_from_bandwidth(soc_obj, curr_peer); } tdls_set_peer_link_status(curr_peer, TDLS_LINK_IDLE,