qcacld-3.0: Don't create wifi-aware0 interface if NAN is not supported

Currently, NAN discovery interface(wifi-aware0) is created if both
host and firmware support NAN separate vdev feature. But NAN
feature capability(gEnableNanSupport) is the master of these
capabilities. Don't create wifi-aware0 if gEnableNanSupport is
disabled.
Also, don't allow NAN iface creation for the kernels less
than 4.14 as NAN interface is allowed by kernel only from 4.14.

Change-Id: Iaf10974c373b2a77d2c24a78540910f78a3dc768
CRs-Fixed: 2706997
This commit is contained in:
Srinivas Dasari 2020-06-10 14:32:21 +05:30 committed by nshrivas
parent 160fab39e1
commit 662a62841c
3 changed files with 26 additions and 5 deletions

View File

@ -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) {

View File

@ -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,

View File

@ -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;