qcacld-3.0: Update nan policy to allow SAP+NDP
Allow NDP if there is SAP, and remove duplicate codes.
Change-Id: Ibb59ad8bc9a2eb8638a0f11e78e8f0994422dfb7
CRs-Fixed: 2508265
diff --git a/Kbuild b/Kbuild
index d9bcd08..03b4ac2 100644
--- a/Kbuild
+++ b/Kbuild
@@ -2271,6 +2271,7 @@
cppflags-$(WLAN_OPEN_SOURCE) += -DWLAN_OPEN_SOURCE
cppflags-$(CONFIG_FEATURE_STATS_EXT) += -DWLAN_FEATURE_STATS_EXT
cppflags-$(CONFIG_QCACLD_FEATURE_NAN) += -DWLAN_FEATURE_NAN
+cppflags-$(CONFIG_NDP_SAP_CONCURRENCY_ENABLE) += -DNDP_SAP_CONCURRENCY_ENABLE
cppflags-$(CONFIG_QCA_IBSS_SUPPORT) += -DQCA_IBSS_SUPPORT
cppflags-$(CONFIG_WLAN_SYSFS) += -DWLAN_SYSFS
cppflags-$(CONFIG_FEATURE_WLAN_RMC) += -DFEATURE_WLAN_RMC
diff --git a/configs/qca6390_defconfig b/configs/qca6390_defconfig
index 5fe7ac5..808e920 100644
--- a/configs/qca6390_defconfig
+++ b/configs/qca6390_defconfig
@@ -178,6 +178,7 @@
ifneq ($(CONFIG_MOBILE_ROUTER), y)
#Flag to enable NAN
CONFIG_QCACLD_FEATURE_NAN := y
+ CONFIG_NDP_SAP_CONCURRENCY_ENABLE := y
endif
ifneq ($(CONFIG_MOBILE_ROUTER), y)
diff --git a/core/hdd/src/wlan_hdd_nan_datapath.c b/core/hdd/src/wlan_hdd_nan_datapath.c
index bed7123..3878a6b 100644
--- a/core/hdd/src/wlan_hdd_nan_datapath.c
+++ b/core/hdd/src/wlan_hdd_nan_datapath.c
@@ -119,6 +119,34 @@
*
* Return: true if allowed, false otherwise
*/
+#ifdef NDP_SAP_CONCURRENCY_ENABLE
+static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
+{
+ struct hdd_adapter *adapter;
+ struct hdd_station_ctx *sta_ctx;
+
+ hdd_for_each_adapter(hdd_ctx, adapter) {
+ switch (adapter->device_mode) {
+ case QDF_P2P_GO_MODE:
+ if (test_bit(SOFTAP_BSS_STARTED,
+ &adapter->event_flags))
+ return false;
+ break;
+ case QDF_P2P_CLIENT_MODE:
+ case QDF_IBSS_MODE:
+ sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+ if (hdd_conn_is_connected(sta_ctx) ||
+ hdd_is_connecting(sta_ctx))
+ return false;
+ break;
+ default:
+ break;
+ }
+ }
+
+ return true;
+}
+#else
static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
{
struct hdd_adapter *adapter;
@@ -129,14 +157,14 @@
case QDF_P2P_GO_MODE:
case QDF_SAP_MODE:
if (test_bit(SOFTAP_BSS_STARTED,
- &adapter->event_flags))
+ &adapter->event_flags))
return false;
break;
case QDF_P2P_CLIENT_MODE:
case QDF_IBSS_MODE:
sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
if (hdd_conn_is_connected(sta_ctx) ||
- hdd_is_connecting(sta_ctx))
+ hdd_is_connecting(sta_ctx))
return false;
break;
default:
@@ -146,6 +174,7 @@
return true;
}
+#endif /* NDP_SAP_CONCURRENCY_ENABLE */
/**
* hdd_ndi_start_bss() - Start BSS on NAN data interface
@@ -388,12 +417,6 @@
return -EPERM;
}
- /* NAN data path coexists only with STA interface */
- if (false == hdd_is_ndp_allowed(hdd_ctx)) {
- hdd_err_rl("Unsupported concurrency for NAN datapath");
- return -EPERM;
- }
-
return os_if_nan_process_ndp_cmd(hdd_ctx->psoc,
data, data_len);
}