diff --git a/core/cds/inc/cds_config.h b/core/cds/inc/cds_config.h index 8a39c098ac28..b59f20757ca1 100644 --- a/core/cds/inc/cds_config.h +++ b/core/cds/inc/cds_config.h @@ -109,6 +109,7 @@ enum active_bpf_mode { * @ito_repeat_count: Indicates ito repeated count * @force_target_assert_enabled: Indicate whether target assert enabled or not * @bandcapability: Configured band by user + * @rps_enabled: RPS enabled in SAP mode * Structure for holding cds ini parameters. */ @@ -169,6 +170,7 @@ struct cds_config_info { uint8_t ito_repeat_count; bool force_target_assert_enabled; uint8_t bandcapability; + bool rps_enabled; }; #ifdef WLAN_FEATURE_FILS_SK diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 67c8587b88f5..36913efd3442 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -2825,6 +2825,7 @@ hdd_nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head, * Return: NONE */ void hdd_dp_trace_init(struct hdd_config *config); +void hdd_set_rx_mode_rps(bool enable); /** * hdd_set_limit_off_chan_for_tos() - set limit off-chan command parameters diff --git a/core/hdd/inc/wlan_hdd_tx_rx.h b/core/hdd/inc/wlan_hdd_tx_rx.h index 21e045bb5a24..21fcf084d2b2 100644 --- a/core/hdd/inc/wlan_hdd_tx_rx.h +++ b/core/hdd/inc/wlan_hdd_tx_rx.h @@ -130,6 +130,7 @@ void wlan_hdd_netif_queue_control(struct hdd_adapter *adapter, enum netif_action_type action, enum netif_reason_type reason); int hdd_set_mon_rx_cb(struct net_device *dev); void hdd_send_rps_ind(struct hdd_adapter *adapter); +void hdd_send_rps_disable_ind(struct hdd_adapter *adapter); void wlan_hdd_classify_pkt(struct sk_buff *skb); #ifdef MSM_PLATFORM diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 2c94a4ee1d15..d85c10de4cdf 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -9313,7 +9313,7 @@ int hdd_configure_cds(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter) uint32_t num_abg_tx_chains = 0; uint32_t num_11b_tx_chains = 0; uint32_t num_11ag_tx_chains = 0; - struct policy_mgr_dp_cbacks dp_cbs = {0}; + struct policy_mgr_dp_cbacks dp_cbs; if (hdd_ctx->config->sifs_burst_duration) { set_value = (SIFS_BURST_DUR_MULTIPLIER) * @@ -9408,9 +9408,10 @@ int hdd_configure_cds(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter) goto cds_disable; dp_cbs.hdd_disable_lro_in_concurrency = hdd_disable_lro_in_concurrency; + dp_cbs.hdd_set_rx_mode_rps_cb = hdd_set_rx_mode_rps; status = policy_mgr_register_dp_cb(hdd_ctx->hdd_psoc, &dp_cbs); if (!QDF_IS_STATUS_SUCCESS(status)) { - hdd_debug("LRO disbaled, failed to register with policy mgr"); + hdd_debug("Failed to register DP cb with Policy Manager"); goto cds_disable; } @@ -12854,6 +12855,29 @@ void hdd_pld_ipa_uc_shutdown_pipes(void) hdd_ipa_uc_force_pipe_shutdown(hdd_ctx); } +/** + * hdd_set_rx_mode_rps() - Enable/disable RPS in SAP mode + * @struct hdd_context *hdd_ctx + * @struct hdd_adapter *padapter + * @bool enble + * + * Return: none + */ +void hdd_set_rx_mode_rps(bool enable) +{ + struct cds_config_info *cds_cfg = cds_get_ini_config(); + struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + struct hdd_adapter *adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE); + + if (adapter && hdd_ctx && + !hdd_ctx->rps && cds_cfg->uc_offload_enabled) { + if (enable && !cds_cfg->rps_enabled) + hdd_send_rps_ind(adapter); + else if (!enable && cds_cfg->rps_enabled) + hdd_send_rps_disable_ind(adapter); + } +} + /* Register the module init/exit functions */ module_init(hdd_module_init); module_exit(hdd_module_exit); diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c index 13627fdf5ee8..e040f63da7db 100644 --- a/core/hdd/src/wlan_hdd_tx_rx.c +++ b/core/hdd/src/wlan_hdd_tx_rx.c @@ -1781,12 +1781,20 @@ void hdd_send_rps_ind(struct hdd_adapter *adapter) uint8_t cpu_map_list_len = 0; struct hdd_context *hdd_ctxt = NULL; struct wlan_rps_data rps_data; + struct cds_config_info *cds_cfg; + + cds_cfg = cds_get_ini_config(); if (!adapter) { hdd_err("adapter is NULL"); return; } + if (!cds_cfg) { + hdd_err("cds_cfg is NULL"); + return; + } + hdd_ctxt = WLAN_HDD_GET_CTX(adapter); rps_data.num_queues = NUM_TX_QUEUES; @@ -1822,10 +1830,57 @@ void hdd_send_rps_ind(struct hdd_adapter *adapter) WLAN_SVC_RPS_ENABLE_IND, &rps_data, sizeof(rps_data)); + cds_cfg->rps_enabled = true; + + return; + err: hdd_err("Wrong RPS configuration. enabling rx_thread"); - hdd_ctxt->rps = false; - hdd_ctxt->enableRxThread = true; + cds_cfg->rps_enabled = false; +} + +/** + * hdd_send_rps_disable_ind() - send rps disable indication to daemon + * @adapter: adapter context + * + * Return: none + */ +void hdd_send_rps_disable_ind(struct hdd_adapter *adapter) +{ + uint8_t cpu_map_list_len = 0; + struct hdd_context *hdd_ctxt = NULL; + struct wlan_rps_data rps_data; + struct cds_config_info *cds_cfg; + + cds_cfg = cds_get_ini_config(); + + if (!adapter) { + hdd_err("adapter is NULL"); + return; + } + + if (!cds_cfg) { + hdd_err("cds_cfg is NULL"); + return; + } + + hdd_ctxt = WLAN_HDD_GET_CTX(adapter); + rps_data.num_queues = NUM_TX_QUEUES; + + hdd_info("Set cpu_map_list 0"); + + qdf_mem_zero(&rps_data.cpu_map_list, sizeof(rps_data.cpu_map_list)); + cpu_map_list_len = 0; + rps_data.num_queues = + (cpu_map_list_len < rps_data.num_queues) ? + cpu_map_list_len : rps_data.num_queues; + + strlcpy(rps_data.ifname, adapter->dev->name, sizeof(rps_data.ifname)); + wlan_hdd_send_svc_nlink_msg(hdd_ctxt->radio_index, + WLAN_SVC_RPS_ENABLE_IND, + &rps_data, sizeof(rps_data)); + + cds_cfg->rps_enabled = false; } #ifdef MSM_PLATFORM