Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a0fe29c authored by Prashanth Bhatta's avatar Prashanth Bhatta
Browse files

cnss: Add Set/Get DFS NOL APIs



According to 802.11h spec, once the radar detection is done, AP
shouldn't try to use the No Occupancy List (NOL). Since WLAN
driver is a module, there is no way for WLAN driver to store the
DFS NOL info. So adding Set and Get APIs so that DFS NOL info is
stored in CNSS driver before unloading WLAN driver and info is
queried back once the driver is brought-up again.

CRs-fixed: 661350
Change-Id: I9b99df7c351a45593a3febbbdda731771475b6d4
Signed-off-by: default avatarPrashanth Bhatta <bhattap@codeaurora.org>
parent b53e80fb
Loading
Loading
Loading
Loading
+50 −0
Original line number Diff line number Diff line
@@ -132,6 +132,8 @@ static struct cnss_data {
	struct wakeup_source ws;
	uint32_t recovery_count;
	enum cnss_driver_status driver_status;
	void *dfs_nol_info;
	u16 dfs_nol_info_len;
} *penv;


@@ -868,6 +870,52 @@ int cnss_get_wlan_unsafe_channel(u16 *unsafe_ch_list,
}
EXPORT_SYMBOL(cnss_get_wlan_unsafe_channel);

int cnss_wlan_set_dfs_nol(void *info, u16 info_len)
{
	void *temp;

	if (!penv)
		return -ENODEV;

	if (!info || !info_len)
		return -EINVAL;

	temp = kmalloc(info_len, GFP_KERNEL);
	if (!temp)
		return -ENOMEM;

	memcpy(temp, info, info_len);

	kfree(penv->dfs_nol_info);

	penv->dfs_nol_info = temp;
	penv->dfs_nol_info_len = info_len;

	return 0;
}
EXPORT_SYMBOL(cnss_wlan_set_dfs_nol);

int cnss_wlan_get_dfs_nol(void *info, u16 info_len)
{
	int len;

	if (!penv)
		return -ENODEV;

	if (!info || !info_len)
		return -EINVAL;

	if (penv->dfs_nol_info == NULL || penv->dfs_nol_info_len == 0)
		return -ENOENT;

	len = min(info_len, penv->dfs_nol_info_len);

	memcpy(info, penv->dfs_nol_info, len);

	return len;
}
EXPORT_SYMBOL(cnss_wlan_get_dfs_nol);

void cnss_pm_wake_lock_init(struct wakeup_source *ws, const char *name)
{
	wakeup_source_init(ws, name);
@@ -1367,6 +1415,8 @@ static int cnss_remove(struct platform_device *pdev)

	cnss_pm_wake_lock_destroy(&penv->ws);

	kfree(penv->dfs_nol_info);

	if (penv->bus_client)
		msm_bus_scale_unregister_client(penv->bus_client);

+3 −1
Original line number Diff line number Diff line
@@ -75,6 +75,8 @@ extern int cnss_get_ramdump_mem(unsigned long *address, unsigned long *size);
extern int cnss_set_wlan_unsafe_channel(u16 *unsafe_ch_list, u16 ch_count);
extern int cnss_get_wlan_unsafe_channel(u16 *unsafe_ch_list,
		u16 *ch_count, u16 buf_len);
extern int cnss_wlan_set_dfs_nol(void *info, u16 info_len);
extern int cnss_wlan_get_dfs_nol(void *info, u16 info_len);
extern int cnss_wlan_register_driver(struct cnss_wlan_driver *driver);
extern void cnss_wlan_unregister_driver(struct cnss_wlan_driver *driver);
extern int cnss_get_fw_files(struct cnss_fw_files *pfw_files);