diff --git a/components/tdls/dispatcher/inc/wlan_tdls_cfg.h b/components/tdls/dispatcher/inc/wlan_tdls_cfg.h index da57d3551f..7d1044ff1b 100644 --- a/components/tdls/dispatcher/inc/wlan_tdls_cfg.h +++ b/components/tdls/dispatcher/inc/wlan_tdls_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020 The Linux Foundation. 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 @@ -272,6 +272,30 @@ CFG_VALUE_OR_DEFAULT, \ "Attempts for sending TDLS discovery requests") +/* + * gTDLSMaxPeerCount - Max TDLS connected peer count + * @Min: 1 + * @Max: 8 + * @Default: 8 + * + * This ini is used to configure the max connected TDLS peer count. + * + * Related: gEnableTDLSSupport. + * + * Supported Feature: TDLS + * + * Usage: External + * + * + */ +#define CFG_TDLS_MAX_PEER_COUNT CFG_INI_UINT( \ + "gTDLSMaxPeerCount", \ + 1, \ + 8, \ + 8, \ + CFG_VALUE_OR_DEFAULT, \ + "Max TDLS peer count") + /* * * gTDLSIdleTimeout - Duration within which number of TX / RX frames meet the @@ -690,6 +714,7 @@ CFG(CFG_TDLS_TX_STATS_PERIOD) \ CFG(CFG_TDLS_TX_PACKET_THRESHOLD) \ CFG(CFG_TDLS_MAX_DISCOVERY_ATTEMPT) \ + CFG(CFG_TDLS_MAX_PEER_COUNT) \ CFG(CFG_TDLS_IDLE_TIMEOUT) \ CFG(CFG_TDLS_IDLE_PACKET_THRESHOLD) \ CFG(CFG_TDLS_RSSI_TRIGGER_THRESHOLD) \ diff --git a/components/tdls/dispatcher/inc/wlan_tdls_cfg_api.h b/components/tdls/dispatcher/inc/wlan_tdls_cfg_api.h index f56d6d5fc7..cd85ceb4d2 100644 --- a/components/tdls/dispatcher/inc/wlan_tdls_cfg_api.h +++ b/components/tdls/dispatcher/inc/wlan_tdls_cfg_api.h @@ -27,6 +27,7 @@ struct wlan_objmgr_psoc; +#ifdef FEATURE_WLAN_TDLS /** * cfg_tdls_get_support_enable() - get tdls support enable * @psoc: pointer to psoc object @@ -243,4 +244,176 @@ QDF_STATUS cfg_tdls_set_scan_enable(struct wlan_objmgr_psoc *psoc, bool val); +/** + * cfg_tdls_get_max_peer_count() - get tdls max peer count + * @psoc: pointer to psoc object + * + * This function gets tdls max peer count + */ +uint16_t cfg_tdls_get_max_peer_count(struct wlan_objmgr_psoc *psoc); +#else +static inline QDF_STATUS +cfg_tdls_get_support_enable(struct wlan_objmgr_psoc *psoc, + bool *val) +{ + *val = false; + + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_set_support_enable(struct wlan_objmgr_psoc *psoc, + bool val) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_get_external_control(struct wlan_objmgr_psoc *psoc, + bool *val) +{ + *val = false; + + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_get_uapsd_mask(struct wlan_objmgr_psoc *psoc, + uint32_t *val) +{ + *val = 0; + + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_get_buffer_sta_enable(struct wlan_objmgr_psoc *psoc, + bool *val) +{ + *val = false; + + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_set_buffer_sta_enable(struct wlan_objmgr_psoc *psoc, + bool val) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_get_uapsd_inactivity_time(struct wlan_objmgr_psoc *psoc, + uint32_t *val) +{ + *val = 0; + + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_get_rx_pkt_threshold(struct wlan_objmgr_psoc *psoc, + uint32_t *val) +{ + *val = 0; + + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_get_off_channel_enable(struct wlan_objmgr_psoc *psoc, + bool *val) +{ + *val = false; + + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_set_off_channel_enable(struct wlan_objmgr_psoc *psoc, + bool val) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_get_off_channel_enable_orig(struct wlan_objmgr_psoc *psoc, + bool *val) +{ + *val = false; + + return QDF_STATUS_SUCCESS; +} + +static inline void +cfg_tdls_restore_off_channel_enable(struct wlan_objmgr_psoc *psoc) +{ +} + +static inline void +cfg_tdls_store_off_channel_enable(struct wlan_objmgr_psoc *psoc) +{ +} + +static inline QDF_STATUS +cfg_tdls_get_wmm_mode_enable(struct wlan_objmgr_psoc *psoc, + bool *val) +{ + *val = false; + + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_set_vdev_nss_2g(struct wlan_objmgr_psoc *psoc, + uint8_t val) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_set_vdev_nss_5g(struct wlan_objmgr_psoc *psoc, + uint8_t val) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_get_sleep_sta_enable(struct wlan_objmgr_psoc *psoc, + bool *val) +{ + *val = false; + + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_set_sleep_sta_enable(struct wlan_objmgr_psoc *psoc, + bool val) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_get_scan_enable(struct wlan_objmgr_psoc *psoc, + bool *val) +{ + *val = false; + + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +cfg_tdls_set_scan_enable(struct wlan_objmgr_psoc *psoc, + bool val) +{ + return QDF_STATUS_SUCCESS; +} + +static inline uint16_t +cfg_tdls_get_max_peer_count(struct wlan_objmgr_psoc *psoc) +{ + return 0; +} +#endif /* FEATURE_WLAN_TDLS */ #endif /* _WLAN_TDLS_CFG_API_H_ */ diff --git a/components/tdls/dispatcher/src/wlan_tdls_cfg.c b/components/tdls/dispatcher/src/wlan_tdls_cfg.c index fe5e50df43..413ebc24cc 100644 --- a/components/tdls/dispatcher/src/wlan_tdls_cfg.c +++ b/components/tdls/dispatcher/src/wlan_tdls_cfg.c @@ -369,3 +369,17 @@ cfg_tdls_set_scan_enable(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } + +uint16_t +cfg_tdls_get_max_peer_count(struct wlan_objmgr_psoc *psoc) +{ + struct tdls_soc_priv_obj *soc_obj; + + soc_obj = wlan_psoc_get_tdls_soc_obj(psoc); + if (!soc_obj) { + tdls_err("tdls soc null"); + return 1; + } + + return soc_obj->max_num_tdls_sta; +} diff --git a/components/tdls/dispatcher/src/wlan_tdls_ucfg_api.c b/components/tdls/dispatcher/src/wlan_tdls_ucfg_api.c index 07b5d06c3c..64075269d0 100644 --- a/components/tdls/dispatcher/src/wlan_tdls_ucfg_api.c +++ b/components/tdls/dispatcher/src/wlan_tdls_ucfg_api.c @@ -218,6 +218,8 @@ static QDF_STATUS tdls_object_init_params( cfg_get(psoc, CFG_TDLS_IMPLICIT_TRIGGER); tdls_soc_obj->tdls_configs.tdls_external_control = cfg_get(psoc, CFG_TDLS_EXTERNAL_CONTROL); + tdls_soc_obj->max_num_tdls_sta = + cfg_get(psoc, CFG_TDLS_MAX_PEER_COUNT); tdls_update_feature_flag(tdls_soc_obj); @@ -381,8 +383,6 @@ QDF_STATUS ucfg_tdls_update_config(struct wlan_objmgr_psoc *psoc, TDLS_IS_OFF_CHANNEL_ENABLED(tdls_feature_flags)) soc_obj->max_num_tdls_sta = WLAN_TDLS_STA_P_UAPSD_OFFCHAN_MAX_NUM; - else - soc_obj->max_num_tdls_sta = WLAN_TDLS_STA_MAX_NUM; for (sta_idx = 0; sta_idx < soc_obj->max_num_tdls_sta; sta_idx++) { soc_obj->tdls_conn_info[sta_idx].valid_entry = false; diff --git a/core/hdd/inc/wlan_hdd_assoc.h b/core/hdd/inc/wlan_hdd_assoc.h index 7bd4668e6a..99e0473543 100644 --- a/core/hdd/inc/wlan_hdd_assoc.h +++ b/core/hdd/inc/wlan_hdd_assoc.h @@ -33,14 +33,6 @@ #define HDD_TIME_STRING_LEN 24 -/* Preprocessor Definitions and Constants */ -#ifdef FEATURE_WLAN_TDLS -#define HDD_MAX_NUM_TDLS_STA 8 -#define HDD_MAX_NUM_TDLS_STA_P_UAPSD_OFFCHAN 1 -#else -#define HDD_MAX_NUM_TDLS_STA 0 - -#endif /* Timeout (in ms) for Link to Up before Registering Station */ #define ASSOC_LINKUP_TIMEOUT 60 diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index ca5acac4d4..eaa3a95ba8 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -888,11 +888,7 @@ static int __wlan_hdd_cfg80211_get_tdls_capabilities(struct wiphy *wiphy, WIFI_TDLS_EXTERNAL_CONTROL_SUPPORT : 0); set = set | (tdls_off_channel ? WIIF_TDLS_OFFCHANNEL_SUPPORT : 0); - if (tdls_sleep_sta_enable || tdls_buffer_sta || - tdls_off_channel) - max_num_tdls_sta = HDD_MAX_NUM_TDLS_STA_P_UAPSD_OFFCHAN; - else - max_num_tdls_sta = HDD_MAX_NUM_TDLS_STA; + max_num_tdls_sta = cfg_tdls_get_max_peer_count(hdd_ctx->psoc); hdd_debug("TDLS Feature supported value %x", set); if (nla_put_u32(skb, PARAM_MAX_TDLS_SESSION, diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 0e46e5bbec..4153bc1569 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -271,8 +271,6 @@ static qdf_wake_lock_t wlan_wake_lock; #define WOW_MIN_PATTERN_SIZE 6 #define WOW_MAX_PATTERN_SIZE 64 -/* max peer can be tdls peers + self peer + bss peer */ -#define HDD_MAX_VDEV_PEER_COUNT (HDD_MAX_NUM_TDLS_STA + 2) #define IS_IDLE_STOP (!cds_is_driver_unloading() && \ !cds_is_driver_recovering() && !cds_is_driver_loading()) @@ -5180,6 +5178,7 @@ int hdd_vdev_create(struct hdd_adapter *adapter) struct vdev_osif_priv *osif_priv; struct wlan_vdev_create_params vdev_params = {0}; bool target_bigtk_support = false; + uint16_t max_peer_count; hdd_nofl_debug("creating new vdev"); @@ -5259,7 +5258,12 @@ int hdd_vdev_create(struct hdd_adapter *adapter) vdev = hdd_objmgr_get_vdev(adapter); if (!vdev) goto hdd_vdev_destroy_procedure; - wlan_vdev_set_max_peer_count(vdev, HDD_MAX_VDEV_PEER_COUNT); + + /* Max peer can be tdls peers + self peer + bss peer */ + max_peer_count = cfg_tdls_get_max_peer_count(hdd_ctx->psoc); + max_peer_count += 2; + wlan_vdev_set_max_peer_count(vdev, max_peer_count); + ucfg_mlme_get_bigtk_support(hdd_ctx->psoc, &target_bigtk_support); if (target_bigtk_support) mlme_set_bigtk_support(vdev, true); diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index cd22f54cb2..b3d9ba28fe 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -102,6 +102,7 @@ #include "nan_ucfg_api.h" #include "wma_coex.h" #include "target_if_vdev_mgr_rx_ops.h" +#include "wlan_tdls_cfg_api.h" #include "wlan_policy_mgr_i.h" #include "target_if_psoc_timer_tx_ops.h" #include @@ -326,7 +327,8 @@ static void wma_set_default_tgt_config(tp_wma_handle wma_handle, tgt_cfg->max_frag_entries = CFG_TGT_MAX_FRAG_TABLE_ENTRIES; tgt_cfg->num_tdls_vdevs = CFG_TGT_NUM_TDLS_VDEVS; tgt_cfg->num_tdls_conn_table_entries = - CFG_TGT_NUM_TDLS_CONN_TABLE_ENTRIES; + QDF_MIN(CFG_TGT_NUM_TDLS_CONN_TABLE_ENTRIES, + cfg_tdls_get_max_peer_count(wma_handle->psoc)); tgt_cfg->beacon_tx_offload_max_vdev = CFG_TGT_DEFAULT_BEACON_TX_OFFLOAD_MAX_VDEV; tgt_cfg->num_multicast_filter_entries =