فهرست منبع

Merge "qca-wifi: Create framework for RNR 6Ghz operations"

Linux Build Service Account 4 سال پیش
والد
کامیت
51bd15af71
2فایلهای تغییر یافته به همراه259 افزوده شده و 0 حذف شده
  1. 157 0
      umac/rnr/inc/wlan_rnr.h
  2. 102 0
      umac/rnr/src/wlan_rnr.c

+ 157 - 0
umac/rnr/inc/wlan_rnr.h

@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2020 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 above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _WLAN_RNR_H_
+#define _WLAN_RNR_H_
+#include <qdf_atomic.h>
+#include <wlan_objmgr_pdev_obj.h>
+
+/**
+ * struct rnr_global_info - Global context for RNR
+ * @vdev_lower_band_cnt:    5ghz/2ghz vdev count
+ * @vdev_6ghz_band_cnt:     6ghz vdev count
+ * @pdev_6ghz_ctx:          6Ghz pdev context
+ */
+struct rnr_global_info {
+	qdf_atomic_t vdev_lower_band_cnt;
+	qdf_atomic_t vdev_6ghz_band_cnt;
+	uint32_t rnr_mbss_idx_map;
+	struct wlan_objmgr_pdev *pdev_6ghz_ctx;
+};
+
+/**
+ * wlan_rnr_lower_band_vdev_inc - Atomic increment of
+ *				  global lower band vdev counter
+ *
+ * API to increment global lower band vdev counter
+ *
+ * Return:void
+ */
+void wlan_rnr_lower_band_vdev_inc(void);
+
+/**
+ * wlan_rnr_lower_band_vdev_dec - Atomic decrement of
+ *				  global lower band vdev counter
+ *
+ * API to decrement global lower band vdev counter
+ *
+ * Return:void
+ */
+void wlan_rnr_lower_band_vdev_dec(void);
+
+/**
+ * wlan_rnr_6ghz_vdev_inc - Atomic increment of
+ *			    6ghz vdev counter
+ *
+ * API to increment of 6Ghz vdev counter
+ *
+ * Return:void
+ */
+void wlan_rnr_6ghz_vdev_inc(void);
+
+/**
+ * wlan_rnr_6ghz_vdev_dec - Atomic decrement of
+ *			    6ghz vdev counter
+ *
+ * API to decrement of 6Ghz vdev counter
+ *
+ * Return:void
+ */
+void wlan_rnr_6ghz_vdev_dec(void);
+
+/**
+ * wlan_global_6ghz_pdev_set - Store 6Ghz pdev in
+ *			       global context
+ *
+ * API to save 6Ghz pdev in global context for
+ * faster access
+ *
+ * Return:void
+ */
+void wlan_global_6ghz_pdev_set(struct wlan_objmgr_pdev *pdev);
+
+/**
+ * wlan_global_6ghz_pdev_destroy - Delete 6Ghz pdev in
+ *				   global context
+ *
+ * API to delete 6Ghz pdev in global context for
+ * faster access
+ *
+ * Return:void
+ */
+void wlan_global_6ghz_pdev_destroy(void);
+
+/**
+ * wlan_lower_band_ap_cnt_get - Get lower band AP count
+ *
+ * API to get lower band vdev from global context for
+ * faster access
+ *
+ * Return: int32_t
+ */
+int32_t wlan_lower_band_ap_cnt_get(void);
+
+/**
+ * wlan_rnr_init_cnt - Initialize counters for
+ *			6Ghz vdev and lower band vdev
+ *
+ * API to initialize atomic counters used for 6Ghz vdev
+ * and lower band vdev
+ *
+ * Return: void
+ */
+void wlan_rnr_init_cnt(void);
+
+/**
+ * wlan_gbl_6ghz_pdev_get - Retrieve 6Ghz pdev pointer
+ *
+ * API to get 6Ghz pdev pointer
+ *
+ * Return: struct wlan_objmgr_pdev
+ */
+struct wlan_objmgr_pdev *wlan_gbl_6ghz_pdev_get(void);
+
+/**
+ * wlan_rnr_set_bss_idx - Set bit corresponding to bss index
+ *
+ * API to set bss index bitmap for adding Non Tx APs
+ * not included in Mbss IE in the RNR IE
+ *
+ * Return: void
+ */
+void wlan_rnr_set_bss_idx(uint32_t bss_idx);
+
+/**
+ * wlan_rnr_get_bss_idx - Get bit corresponding to bss index
+ *
+ * API to Get bss index bitmap for adding Non Tx APs
+ * not included in Mbss IE in the RNR IE
+ *
+ * Return: void
+ */
+uint32_t wlan_rnr_get_bss_idx(void);
+
+/**
+ * wlan_rnr_clear_bss_idx - Clear bits corresponding to bss index map
+ *
+ * API to clear bss index bitmap for adding Non Tx APs
+ * not included in Mbss IE in the RNR IE
+ *
+ * Return: void
+ */
+void wlan_rnr_clear_bss_idx(void);
+
+#endif /* End of _WLAN_RNR_H_ */

+ 102 - 0
umac/rnr/src/wlan_rnr.c

@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2020 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 above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <wlan_rnr.h>
+#include <qdf_module.h>
+#include <qdf_status.h>
+#include <qdf_types.h>
+
+struct rnr_global_info g_rnr_info;
+
+void wlan_rnr_init_cnt(void)
+{
+	qdf_atomic_init(&(g_rnr_info.vdev_lower_band_cnt));
+	qdf_atomic_init(&(g_rnr_info.vdev_6ghz_band_cnt));
+}
+
+qdf_export_symbol(wlan_rnr_init_cnt);
+
+void wlan_rnr_lower_band_vdev_inc(void)
+{
+	qdf_atomic_inc(&(g_rnr_info.vdev_lower_band_cnt));
+}
+
+qdf_export_symbol(wlan_rnr_lower_band_vdev_inc);
+
+void wlan_rnr_lower_band_vdev_dec(void)
+{
+	qdf_atomic_dec(&(g_rnr_info.vdev_lower_band_cnt));
+}
+
+qdf_export_symbol(wlan_rnr_lower_band_vdev_dec);
+
+void wlan_rnr_6ghz_vdev_inc(void)
+{
+	qdf_atomic_inc(&(g_rnr_info.vdev_6ghz_band_cnt));
+}
+
+qdf_export_symbol(wlan_rnr_6ghz_vdev_inc);
+
+void wlan_rnr_6ghz_vdev_dec(void)
+{
+	qdf_atomic_dec(&(g_rnr_info.vdev_6ghz_band_cnt));
+}
+
+qdf_export_symbol(wlan_rnr_6ghz_vdev_dec);
+
+void wlan_global_6ghz_pdev_set(struct wlan_objmgr_pdev *pdev)
+{
+	if (pdev)
+		g_rnr_info.pdev_6ghz_ctx = pdev;
+}
+
+qdf_export_symbol(wlan_global_6ghz_pdev_set);
+
+void wlan_global_6ghz_pdev_destroy(void)
+{
+	g_rnr_info.pdev_6ghz_ctx = NULL;
+}
+
+qdf_export_symbol(wlan_global_6ghz_pdev_destroy);
+
+int32_t wlan_lower_band_ap_cnt_get(void)
+{
+	return qdf_atomic_read(&(g_rnr_info.vdev_lower_band_cnt));
+}
+
+qdf_export_symbol(wlan_lower_band_ap_cnt_get);
+
+struct wlan_objmgr_pdev *wlan_gbl_6ghz_pdev_get(void)
+{
+	return g_rnr_info.pdev_6ghz_ctx;
+}
+
+qdf_export_symbol(wlan_gbl_6ghz_pdev_get);
+
+void wlan_rnr_set_bss_idx(uint32_t bss_idx)
+{
+	g_rnr_info.rnr_mbss_idx_map |= (1 << (bss_idx-1));
+}
+
+uint32_t wlan_rnr_get_bss_idx(void)
+{
+	return g_rnr_info.rnr_mbss_idx_map;
+}
+
+void  wlan_rnr_clear_bss_idx(void)
+{
+	g_rnr_info.rnr_mbss_idx_map = 0;
+}