qcacmn: Choose second highest bw link as primary link

This change selects psoc with second highest bw link as primary link
for first ML STA.

Change-Id: I1b60f83f695b04d533e4851b3751b8e1dfd9790c
CRs-Fixed: 3521765
This commit is contained in:
Srinivas Pitla
2023-06-06 22:53:11 -07:00
committed by Rahul Choudhary
parent 3975e97067
commit a238a3e04b

View File

@@ -129,11 +129,11 @@ mld_get_best_primary_umac_w_rssi(struct wlan_mlo_peer_context *ml_peer,
bool mld_sta_links[WLAN_OBJMGR_MAX_DEVICES] = {0}; bool mld_sta_links[WLAN_OBJMGR_MAX_DEVICES] = {0};
bool mld_no_sta[WLAN_OBJMGR_MAX_DEVICES] = {0}; bool mld_no_sta[WLAN_OBJMGR_MAX_DEVICES] = {0};
struct wlan_objmgr_peer *assoc_peer = NULL; struct wlan_objmgr_peer *assoc_peer = NULL;
uint8_t prim_link, id; uint8_t prim_link, id, prim_link_hi;
uint8_t num_psocs; uint8_t num_psocs;
struct mlpeer_data *tqm_params = NULL; struct mlpeer_data *tqm_params = NULL;
struct wlan_channel *channel; struct wlan_channel *channel;
enum phy_ch_width chwidth; enum phy_ch_width sec_hi_bw, hi_bw;
uint8_t cong = ML_PRIMARY_TQM_CONGESTION; uint8_t cong = ML_PRIMARY_TQM_CONGESTION;
uint16_t mld_ml_sta_count[WLAN_OBJMGR_MAX_DEVICES] = {0}; uint16_t mld_ml_sta_count[WLAN_OBJMGR_MAX_DEVICES] = {0};
enum phy_ch_width mld_ch_width[WLAN_OBJMGR_MAX_DEVICES]; enum phy_ch_width mld_ch_width[WLAN_OBJMGR_MAX_DEVICES];
@@ -226,30 +226,42 @@ mld_get_best_primary_umac_w_rssi(struct wlan_mlo_peer_context *ml_peer,
} }
} }
} else if (psoc_w_nosta > 1) { } else if (psoc_w_nosta > 1) {
chwidth = CH_WIDTH_INVALID; hi_bw = CH_WIDTH_INVALID;
sec_hi_bw = CH_WIDTH_INVALID;
for (i = 0; i < WLAN_OBJMGR_MAX_DEVICES; i++) { for (i = 0; i < WLAN_OBJMGR_MAX_DEVICES; i++) {
if (!mld_no_sta[i]) if (!mld_no_sta[i])
continue; continue;
if (chwidth == CH_WIDTH_INVALID) { if (hi_bw == CH_WIDTH_INVALID) {
prim_link = i; prim_link_hi = i;
chwidth = mld_ch_width[i]; hi_bw = mld_ch_width[i];
continue; continue;
} }
/* if bw is 320MHZ mark that link as primary link */ /* if bw is 320MHZ mark it as highest ch width */
if (mld_ch_width[i] == CH_WIDTH_320MHZ) { if (mld_ch_width[i] == CH_WIDTH_320MHZ) {
prim_link = i; prim_link = prim_link_hi;
chwidth = mld_ch_width[i]; sec_hi_bw = hi_bw;
break; hi_bw = mld_ch_width[i];
prim_link_hi = i;
} }
/* If bw is less than or equal to 160 MHZ /* If bw is less than or equal to 160 MHZ
* and chwidth is greater than than other link * and chwidth is greater than than other link
* Mark this link as primary link * Mark this link as primary link
*/ */
if ((mld_ch_width[i] <= CH_WIDTH_160MHZ) && if (mld_ch_width[i] <= CH_WIDTH_160MHZ) {
(chwidth < mld_ch_width[i])) { if (hi_bw < mld_ch_width[i]) {
prim_link = i; /* move high bw to second high bw */
chwidth = mld_ch_width[i]; prim_link = prim_link_hi;
sec_hi_bw = hi_bw;
hi_bw = mld_ch_width[i];
prim_link_hi = i;
} else if ((sec_hi_bw == CH_WIDTH_INVALID) ||
(sec_hi_bw < mld_ch_width[i])) {
/* update sec high bw */
sec_hi_bw = mld_ch_width[i];
prim_link = i;
}
} }
} }
} else { } else {