diff --git a/components/nan/dispatcher/src/nan_ucfg_api.c b/components/nan/dispatcher/src/nan_ucfg_api.c index 257fd7a9fc..b4025f70a6 100644 --- a/components/nan/dispatcher/src/nan_ucfg_api.c +++ b/components/nan/dispatcher/src/nan_ucfg_api.c @@ -1101,6 +1101,12 @@ ucfg_nan_is_sta_nan_ndi_4_port_allowed(struct wlan_objmgr_psoc *psoc) return psoc_nan_obj->nan_caps.sta_nan_ndi_ndi_allowed; } +static inline bool +ucfg_is_nan_enabled(struct nan_psoc_priv_obj *psoc_nan_obj) +{ + return psoc_nan_obj->cfg_param.enable; +} + static inline bool ucfg_nan_is_vdev_creation_supp_by_fw(struct nan_psoc_priv_obj *psoc_nan_obj) { @@ -1153,6 +1159,11 @@ bool ucfg_nan_is_vdev_creation_allowed(struct wlan_objmgr_psoc *psoc) return false; } + if (!ucfg_is_nan_enabled(psoc_nan_obj)) { + nan_debug("NAN is not enabled"); + return false; + } + host_support = ucfg_nan_is_vdev_creation_supp_by_host(psoc_nan_obj); fw_support = ucfg_nan_is_vdev_creation_supp_by_fw(psoc_nan_obj); if (!host_support || !fw_support) { diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 3c2da7166e..3867b10142 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -15300,7 +15300,7 @@ wlan_hdd_iftype_data_mem_free(struct hdd_context *hdd_ctx) #endif #if defined(WLAN_FEATURE_NAN) && \ - (KERNEL_VERSION(4, 19, 0) <= LINUX_VERSION_CODE) + (KERNEL_VERSION(4, 14, 0) <= LINUX_VERSION_CODE) static void wlan_hdd_set_nan_if_mode(struct wiphy *wiphy) { wiphy->interface_modes |= BIT(NL80211_IFTYPE_NAN); @@ -22969,7 +22969,7 @@ wlan_hdd_cfg80211_external_auth(struct wiphy *wiphy, #endif #if defined(WLAN_FEATURE_NAN) && \ - (KERNEL_VERSION(4, 19, 0) <= LINUX_VERSION_CODE) + (KERNEL_VERSION(4, 14, 0) <= LINUX_VERSION_CODE) static int wlan_hdd_cfg80211_start_nan(struct wiphy *wiphy, struct wireless_dev *wdev, struct cfg80211_nan_conf *conf) @@ -23464,7 +23464,7 @@ static struct cfg80211_ops wlan_hdd_cfg80211_ops = { .external_auth = wlan_hdd_cfg80211_external_auth, #endif #if defined(WLAN_FEATURE_NAN) && \ - (KERNEL_VERSION(4, 19, 0) <= LINUX_VERSION_CODE) + (KERNEL_VERSION(4, 14, 0) <= LINUX_VERSION_CODE) .start_nan = wlan_hdd_cfg80211_start_nan, .stop_nan = wlan_hdd_cfg80211_stop_nan, .add_nan_func = wlan_hdd_cfg80211_add_nan_func, diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 6566b22821..be7a1ae588 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1110,7 +1110,7 @@ enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width) } #if defined(WLAN_FEATURE_NAN) && \ - (KERNEL_VERSION(4, 19, 0) <= LINUX_VERSION_CODE) + (KERNEL_VERSION(4, 14, 0) <= LINUX_VERSION_CODE) /** * wlan_hdd_convert_nan_type() - Convert nl type to qdf type * @nl_type: NL80211 interface type @@ -1142,6 +1142,11 @@ static void wlan_hdd_set_nan_if_type(struct hdd_adapter *adapter) { adapter->wdev.iftype = NL80211_IFTYPE_NAN; } + +static bool wlan_hdd_is_vdev_creation_allowed(struct wlan_objmgr_psoc *psoc) +{ + return ucfg_nan_is_vdev_creation_allowed(psoc); +} #else static QDF_STATUS wlan_hdd_convert_nan_type(enum nl80211_iftype nl_type, enum QDF_OPMODE *out_qdf_type) @@ -1152,6 +1157,11 @@ static QDF_STATUS wlan_hdd_convert_nan_type(enum nl80211_iftype nl_type, static void wlan_hdd_set_nan_if_type(struct hdd_adapter *adapter) { } + +static bool wlan_hdd_is_vdev_creation_allowed(struct wlan_objmgr_psoc *psoc) +{ + return false; +} #endif QDF_STATUS hdd_nl_to_qdf_iface_type(enum nl80211_iftype nl_type, @@ -13565,7 +13575,7 @@ hdd_open_adapters_for_mission_mode(struct hdd_context *hdd_ctx) * Create separate interface (wifi-aware0) for NAN. All NAN commands * should go on this new interface. */ - if (ucfg_nan_is_vdev_creation_allowed(hdd_ctx->psoc)) { + if (wlan_hdd_is_vdev_creation_allowed(hdd_ctx->psoc)) { mac_addr = wlan_hdd_get_intf_addr(hdd_ctx, QDF_NAN_DISC_MODE); if (!mac_addr) goto err_close_adapters;