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

Commit 5862891f authored by Jianmin Zhu's avatar Jianmin Zhu
Browse files

qcacld-3.0: Check FTM mode in vendor cmds handlers

Vendor commands of wiphy aren't initialized when driver load as FTM mode,
if changed to mission mode later with following cli:
echo 0 > /sys/module/wlan/parameters/con_mode,
vendor commands of wiphy keep uninitialized, wpa supplicant can't get
roam offload status by QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES,
so PMK isn't sent to driver/firmware,  roam offload failed.

To fix it, remove QDF_GLOBAL_FTM_MODE check in wlan_hdd_cfg80211_init, let
vendor commands of wiphy initialized in FTM mode too when driver load.
But in each vendor cmd, check FTM mode when called, if FTM mode, return
-EPERM.
When driver is changed to mission mode, all interfaces are deleted and
re-added by driver, when interface added event is received by
wpa supplicant,  QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES is
called again to get roam offload enabled status, PMK will be sent to
driver and firmware when RSO start, roam offload will work.

Change-Id: Ie0c868ebd4b7e356d72a154206b13df94f378188
CRs-Fixed: 3213221
parent c3cc73bc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@@ -166,6 +167,11 @@ __wlan_hdd_cfg80211_set_limit_offchan_param(struct wiphy *wiphy,

	hdd_enter();

	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}

	ret = wlan_hdd_validate_context(hdd_ctx);
	if (ret < 0)
		return ret;
+6 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@@ -321,6 +322,11 @@ static int __wlan_hdd_cfg80211_bcn_rcv_op(struct wiphy *wiphy,

	hdd_enter_dev(dev);

	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}

	errno = hdd_validate_adapter(adapter);
	if (errno)
		return errno;
+6 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@@ -141,6 +142,11 @@ static int __wlan_hdd_cfg80211_set_btc_chain_mode(struct wiphy *wiphy,

	hdd_enter_dev(wdev->netdev);

	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}

	errno = wlan_hdd_validate_context(hdd_ctx);
	if (errno != 0)
		return errno;
+49 −8
Original line number Diff line number Diff line
@@ -6011,6 +6011,11 @@ static int __wlan_hdd_cfg80211_disable_dfs_chan_scan(struct wiphy *wiphy,
	bool enable_dfs_scan = true;
	hdd_enter_dev(dev);
	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}
	ret_val = wlan_hdd_validate_context(hdd_ctx);
	if (ret_val)
		return ret_val;
@@ -11390,6 +11395,11 @@ __wlan_hdd_cfg80211_set_ns_offload(struct wiphy *wiphy,
	hdd_enter_dev(wdev->netdev);
	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}
	status = wlan_hdd_validate_context(hdd_ctx);
	if (0 != status)
		return status;
@@ -11574,6 +11584,11 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy,
	hdd_enter_dev(wdev->netdev);
	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}
	ret = wlan_hdd_validate_context(hdd_ctx);
	if (ret)
		return -EINVAL;
@@ -11769,6 +11784,11 @@ static int __wlan_hdd_cfg80211_set_probable_oper_channel(struct wiphy *wiphy,
	hdd_enter_dev(ndev);
	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}
	ret = wlan_hdd_validate_context(hdd_ctx);
	if (ret)
		return ret;
@@ -12854,6 +12874,11 @@ static int __wlan_hdd_cfg80211_setband(struct wiphy *wiphy,
	hdd_enter();
	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}
	ret = wlan_hdd_validate_context(hdd_ctx);
	if (ret)
		return ret;
@@ -13548,6 +13573,11 @@ static int __wlan_hdd_cfg80211_getband(struct wiphy *wiphy,
	hdd_enter();
	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}
	ret = wlan_hdd_validate_context(hdd_ctx);
	if (ret)
		return ret;
@@ -15289,6 +15319,11 @@ static int __wlan_hdd_cfg80211_get_usable_channel(struct wiphy *wiphy,
	uint32_t count = 0;
	QDF_STATUS status;
	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}
	ret = wlan_hdd_validate_context(hdd_ctx);
	if (0 != ret)
		return ret;
@@ -15411,6 +15446,11 @@ static int __wlan_hdd_cfg80211_set_roam_events(struct wiphy *wiphy,
	int ret;
	uint8_t config, state, param = 0;
	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}
	ret = wlan_hdd_validate_context(hdd_ctx);
	if (ret != 0) {
		hdd_err("Invalid hdd_ctx");
@@ -15542,6 +15582,11 @@ static int __wlan_hdd_cfg80211_get_chain_rssi(struct wiphy *wiphy,
	hdd_enter();
	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}
	retval = wlan_hdd_validate_context(hdd_ctx);
	if (0 != retval)
		return retval;
@@ -17165,15 +17210,11 @@ int wlan_hdd_cfg80211_init(struct device *dev,
	wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
	wiphy->max_remain_on_channel_duration = MAX_REMAIN_ON_CHANNEL_DURATION;
	if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE) {
		wiphy->n_vendor_commands =
				ARRAY_SIZE(hdd_wiphy_vendor_commands);
	wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands);
	wiphy->vendor_commands = hdd_wiphy_vendor_commands;
	wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events;
		wiphy->n_vendor_events =
				ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events);
	}
	wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events);
#ifdef QCA_HT_2040_COEX
	wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE;
+6 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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
@@ -74,6 +75,11 @@ static int __wlan_hdd_cfg80211_set_coex_config(struct wiphy *wiphy,

	hdd_enter();

	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
		hdd_err("Command not allowed in FTM mode");
		return -EPERM;
	}

	errno = wlan_hdd_validate_context(hdd_ctx);
	if (errno != 0)
		return errno;
Loading