|
@@ -1161,4 +1161,94 @@ void mlo_update_tsf_sync_support(struct wlan_objmgr_psoc *psoc,
|
|
|
}
|
|
|
|
|
|
qdf_export_symbol(mlo_update_tsf_sync_support);
|
|
|
+
|
|
|
+bool mlo_pdev_derive_bridge_link_pdevs(struct wlan_objmgr_pdev *pdev,
|
|
|
+ struct wlan_objmgr_pdev **pdev_list)
|
|
|
+{
|
|
|
+ struct wlan_objmgr_psoc *psoc;
|
|
|
+ struct wlan_objmgr_psoc *grp_soc_list[MAX_MLO_CHIPS];
|
|
|
+ struct wlan_objmgr_pdev *tmp_pdev;
|
|
|
+ uint8_t tot_grp_socs;
|
|
|
+ uint8_t grp_id;
|
|
|
+ uint8_t psoc_id, tmp_psoc_id;
|
|
|
+ uint8_t idx;
|
|
|
+ uint8_t is_adjacent;
|
|
|
+ QDF_STATUS status;
|
|
|
+
|
|
|
+ psoc = wlan_pdev_get_psoc(pdev);
|
|
|
+
|
|
|
+ /* Initialize pdev list to NULL by default */
|
|
|
+ for (idx = 0; idx < MLO_MAX_BRIDGE_LINKS_PER_MLD; idx++)
|
|
|
+ pdev_list[idx] = NULL;
|
|
|
+
|
|
|
+ if (!mlo_psoc_get_grp_id(psoc, &grp_id)) {
|
|
|
+ qdf_err("Unable to get group id");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Get the total SOCs in the MLO group */
|
|
|
+ tot_grp_socs = mlo_setup_get_total_socs(grp_id);
|
|
|
+ if (!tot_grp_socs || tot_grp_socs > MAX_MLO_CHIPS) {
|
|
|
+ qdf_err("Unable to get total SOCs");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ qdf_info("Total SOCs in MLO group%d: %d", grp_id, tot_grp_socs);
|
|
|
+
|
|
|
+ /* Get the SOC list in the MLO group */
|
|
|
+ mlo_get_soc_list(grp_soc_list, grp_id, tot_grp_socs,
|
|
|
+ WLAN_MLO_GROUP_DEFAULT_SOC_LIST);
|
|
|
+
|
|
|
+ psoc_id = wlan_psoc_get_id(psoc);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Check the current pdev for num bridge links created and
|
|
|
+ * add to the pdev list if possible otherwise find opposite pdev
|
|
|
+ */
|
|
|
+ if (wlan_pdev_get_mlo_bridge_vdev_count(pdev)
|
|
|
+ < MLO_MAX_BRIDGE_LINKS_PER_RADIO)
|
|
|
+ pdev_list[0] = pdev;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Iterate over the MLO group SOC list
|
|
|
+ * and get the pdevs for bridge links
|
|
|
+ */
|
|
|
+ for (idx = 0; idx < tot_grp_socs; idx++) {
|
|
|
+ if (!grp_soc_list[idx])
|
|
|
+ continue;
|
|
|
+
|
|
|
+ if (grp_soc_list[idx] == psoc)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ /* Skip the pdev if bridge link quota is over */
|
|
|
+ tmp_pdev = grp_soc_list[idx]->soc_objmgr.wlan_pdev_list[0];
|
|
|
+
|
|
|
+ if (wlan_pdev_get_mlo_bridge_vdev_count(tmp_pdev)
|
|
|
+ >= MLO_MAX_BRIDGE_LINKS_PER_RADIO)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ tmp_psoc_id = wlan_psoc_get_id(grp_soc_list[idx]);
|
|
|
+
|
|
|
+ qdf_info("Checking adjacency of soc %d and %d",
|
|
|
+ psoc_id, tmp_psoc_id);
|
|
|
+ status = mlo_chip_adjacent(psoc_id, tmp_psoc_id, &is_adjacent);
|
|
|
+ if (status != QDF_STATUS_SUCCESS) {
|
|
|
+ qdf_info("Check adjacency failed");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (is_adjacent) {
|
|
|
+ if (!pdev_list[1])
|
|
|
+ pdev_list[1] = tmp_pdev;
|
|
|
+ } else if (!pdev_list[0]) {
|
|
|
+ pdev_list[0] = tmp_pdev;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pdev_list[0] && pdev_list[1])
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
+qdf_export_symbol(mlo_pdev_derive_bridge_link_pdevs);
|
|
|
#endif /*WLAN_MLO_MULTI_CHIP*/
|