diff options
| author | Srinivas Girigowda <sgirigow@qca.qualcomm.com> | 2016-07-18 13:53:55 -0700 |
|---|---|---|
| committer | Anjaneedevi Kapparapu <akappa@codeaurora.org> | 2016-07-19 15:35:03 +0530 |
| commit | ba1c3e7bd366b0cfa8e8aeb4d263ce5b0cb02351 (patch) | |
| tree | 0a382e3fbb321ecef2b1bed0f61ffe4603d92cfc | |
| parent | 497513fd6b8c86319da105f64a66988a3f16d833 (diff) | |
qcacld-2.0: Active mode offload support
Propagation from qcacld-3.0 to qcacld-2.0.
- Add INI item to enable/disable active mode offload
- By default enable active mode offload as it helps to save more
power in static display usecase(APPS stand alone power collapse)
- If active mode offload is enabled then all applicable data
offload/filtering is enabled immediately once config is available
in WLAN driver and FW caches it accross suspend/resume
- If active mode offload is disabled then all applicable data
offload/filtering is enabled during cfg80211 suspend and disabled
during cfg80211 resume
Change-Id: Ib0207cee6a1812a81354f638e6bf55441d52c6e1
CRs-Fixed: 880416
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_cfg.h | 23 | ||||
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_power.h | 2 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg.c | 12 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg80211.c | 10 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_early_suspend.c | 202 |
5 files changed, 154 insertions, 95 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_cfg.h b/CORE/HDD/inc/wlan_hdd_cfg.h index bab5442a5877..194cd253b406 100644 --- a/CORE/HDD/inc/wlan_hdd_cfg.h +++ b/CORE/HDD/inc/wlan_hdd_cfg.h @@ -3959,6 +3959,28 @@ enum dot11p_mode { #define CFG_SAP_MAX_INACTIVITY_OVERRIDE_MIN (0) #define CFG_SAP_MAX_INACTIVITY_OVERRIDE_MAX (1) +/* + * In static display use case when APPS is in stand alone power save mode enable + * active offload mode which helps FW to filter out MC/BC data packets to avoid + * APPS wake up and save more power. + * + * By default enable active mode offload as it helps to save more power in + * static display usecase(APPS stand alone power collapse). + * + * If active mode offload(gActiveModeOffload=1) is enabled then all applicable + * data offload/filtering is enabled immediately in FW once config is available + * in WLAN driver and FW caches this configuration accross suspend/resume + * + * If active mode offload is disabled(gActiveModeOffload=0) then all applicable + * data offload/filtering is enabled during cfg80211 suspend and disabled + * during cfg80211 resume + */ +#define CFG_ACTIVE_MODE_OFFLOAD "gActiveModeOffload" +#define CFG_ACTIVE_MODE_OFFLOAD_MIN (0) +#define CFG_ACTIVE_MODE_OFFLOAD_MAX (1) +#define CFG_ACTIVE_MODE_OFFLOAD_DEFAULT (0) + + /*--------------------------------------------------------------------------- Type declarations -------------------------------------------------------------------------*/ @@ -4739,6 +4761,7 @@ struct hdd_config { /* parameter to force sap into 11n */ bool sap_force_11n_for_11ac; uint8_t sap_max_inactivity_override; + bool active_mode_offload; }; typedef struct hdd_config hdd_config_t; diff --git a/CORE/HDD/inc/wlan_hdd_power.h b/CORE/HDD/inc/wlan_hdd_power.h index 0605504c1c50..c1f4bf6aa8a1 100644 --- a/CORE/HDD/inc/wlan_hdd_power.h +++ b/CORE/HDD/inc/wlan_hdd_power.h @@ -120,6 +120,8 @@ int wlan_hdd_ipv4_changed(struct notifier_block *nb, int wlan_hdd_ipv6_changed(struct notifier_block *nb, unsigned long data, void *arg); +void hdd_conf_ns_offload(hdd_adapter_t *pAdapter, int fenable); + #ifdef FEATURE_WLAN_DIAG_SUPPORT void hdd_wlan_suspend_resume_event(uint8_t state); #else diff --git a/CORE/HDD/src/wlan_hdd_cfg.c b/CORE/HDD/src/wlan_hdd_cfg.c index 6c7627b72b87..b7562ad986d6 100644 --- a/CORE/HDD/src/wlan_hdd_cfg.c +++ b/CORE/HDD/src/wlan_hdd_cfg.c @@ -4666,8 +4666,14 @@ REG_TABLE_ENTRY g_registry_table[] = VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, CFG_SAP_MAX_INACTIVITY_OVERRIDE_DEFAULT, CFG_SAP_MAX_INACTIVITY_OVERRIDE_MIN, - CFG_SAP_MAX_INACTIVITY_OVERRIDE_MAX) + CFG_SAP_MAX_INACTIVITY_OVERRIDE_MAX), + REG_VARIABLE(CFG_ACTIVE_MODE_OFFLOAD, WLAN_PARAM_Integer, + hdd_config_t, active_mode_offload, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_ACTIVE_MODE_OFFLOAD_DEFAULT, + CFG_ACTIVE_MODE_OFFLOAD_MIN, + CFG_ACTIVE_MODE_OFFLOAD_MAX), }; @@ -5511,7 +5517,9 @@ void print_hdd_cfg(hdd_context_t *pHddCtx) hddLog(LOG2, "Name = [%s] Value = [%u]", CFG_SAP_MAX_INACTIVITY_OVERRIDE_NAME, pHddCtx->cfg_ini->sap_max_inactivity_override); - + hddLog(LOG2, "Name = [%s] Value = [%u]", + CFG_ACTIVE_MODE_OFFLOAD, + pHddCtx->cfg_ini->active_mode_offload); hdd_ndp_print_ini_config(pHddCtx); } diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index d2793dee52a6..1fac6622a739 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -9831,6 +9831,8 @@ __wlan_hdd_cfg80211_set_ns_offload(struct wiphy *wiphy, int status; struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_MAX + 1]; hdd_context_t *pHddCtx = wiphy_priv(wiphy); + struct net_device *dev = wdev->netdev; + hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); ENTER(); @@ -9857,6 +9859,14 @@ __wlan_hdd_cfg80211_set_ns_offload(struct wiphy *wiphy, pHddCtx->ns_offload_enable = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_ND_OFFLOAD_FLAG]); + /* Disable NS offload if active mode offload is enabled */ + if (!(pHddCtx->ns_offload_enable) && + pHddCtx->cfg_ini->active_mode_offload) { + hddLog(LOG1, + FL("Disable NS offload : active offload is enabled")); + hdd_conf_ns_offload(pAdapter, 0); + } + return 0; } diff --git a/CORE/HDD/src/wlan_hdd_early_suspend.c b/CORE/HDD/src/wlan_hdd_early_suspend.c index 7de428e2a081..19fec59f94da 100644 --- a/CORE/HDD/src/wlan_hdd_early_suspend.c +++ b/CORE/HDD/src/wlan_hdd_early_suspend.c @@ -737,7 +737,7 @@ static int hdd_fill_ipv6_ac_addr(struct inet6_dev *idev, \return - void ---------------------------------------------------------------------------*/ -static void hdd_conf_ns_offload(hdd_adapter_t *pAdapter, int fenable) +void hdd_conf_ns_offload(hdd_adapter_t *pAdapter, int fenable) { struct inet6_dev *in6_dev; uint8_t ipv6_addr[SIR_MAC_NUM_TARGET_IPV6_NS_OFFLOAD_NA] @@ -774,9 +774,13 @@ static void hdd_conf_ns_offload(hdd_adapter_t *pAdapter, int fenable) ipv6_addr_type, &count); if (0 > ret) { - hddLog(LOG1, - FL("Reached max supported addresses and not enabling NS offload")); - return; + if (pHddCtx->cfg_ini->active_mode_offload) + goto disable_ns; + else { + hddLog(LOG1, + FL("Reached max supported addresses and not enabling NS offload")); + return; + } } /* Anycast Addresses */ @@ -784,9 +788,13 @@ static void hdd_conf_ns_offload(hdd_adapter_t *pAdapter, int fenable) ipv6_addr_type, &count); if (0 > ret) { - hddLog(LOG1, - FL("Reached max supported addresses and not enabling NS offload")); - return; + if (pHddCtx->cfg_ini->active_mode_offload) + goto disable_ns; + else { + hddLog(LOG1, + FL("Reached max supported addresses and not enabling NS offload")); + return; + } } vos_mem_zero(&offLoadRequest, sizeof(offLoadRequest)); @@ -857,7 +865,9 @@ static void hdd_conf_ns_offload(hdd_adapter_t *pAdapter, int fenable) return; } } else { +disable_ns: /* Disable NSOffload */ + hddLog(LOG1, FL("Disable NS Offload")); vos_mem_zero((void *)&offLoadRequest, sizeof(tSirHostOffloadReq)); offLoadRequest.enableOrDisable = SIR_OFFLOAD_DISABLE; offLoadRequest.offloadType = SIR_IPV6_NS_OFFLOAD; @@ -895,6 +905,11 @@ static void __hdd_ipv6_notifier_work_queue(struct work_struct *work) if (0 != status) return; + if (!pHddCtx->cfg_ini->active_mode_offload) { + hddLog(LOG1, FL("Active mode offload is disabled")); + return; + } + if ( VOS_FALSE == pHddCtx->sus_res_mcastbcast_filter_valid) { pHddCtx->sus_res_mcastbcast_filter = @@ -908,9 +923,7 @@ static void __hdd_ipv6_notifier_work_queue(struct work_struct *work) if ((eConnectionState_Associated == (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState || - ndi_connected) && - pHddCtx->hdd_wlan_suspended) - { + ndi_connected)) { /* * This invocation being part of the IPv6 registration callback, * we are passing second parameter as 2 to avoid registration @@ -956,8 +969,7 @@ void hdd_conf_hostoffload(hdd_adapter_t *pAdapter, v_BOOL_t fenable) pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); - if (NULL == pVosContext) - { + if (NULL == pVosContext) { hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Global VOS context is Null")); return; } @@ -965,8 +977,7 @@ void hdd_conf_hostoffload(hdd_adapter_t *pAdapter, v_BOOL_t fenable) //Get the HDD context. pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); - if (NULL == pHddCtx) - { + if (NULL == pHddCtx) { hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HDD context is Null", __func__); return; } @@ -976,100 +987,100 @@ void hdd_conf_hostoffload(hdd_adapter_t *pAdapter, v_BOOL_t fenable) (WLAN_HDD_SOFTAP == pAdapter->device_mode) || (WLAN_HDD_P2P_GO == pAdapter->device_mode)) { - if (fenable) - { + if (fenable) { if ((eConnectionState_Associated == - (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) || + (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) || (WLAN_HDD_SOFTAP == pAdapter->device_mode) || - (WLAN_HDD_P2P_GO == pAdapter->device_mode)) - { - if ((pHddCtx->cfg_ini->fhostArpOffload)) - { - /* - * Configure the ARP Offload. - * Even if it fails we have to reconfigure the MC/BC - * filter flag as we want RIVA not to drop BroadCast - * Packets - */ - hddLog(VOS_TRACE_LEVEL_INFO, - FL("Calling ARP Offload with flag: %d"), fenable); - vstatus = hdd_conf_arp_offload(pAdapter, fenable); - pHddCtx->configuredMcastBcastFilter &= - ~(HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST); - - if (!VOS_IS_STATUS_SUCCESS(vstatus)) - { - hddLog(VOS_TRACE_LEVEL_ERROR, - "Failed to enable ARPOFfloadFeature %d", - vstatus); + (WLAN_HDD_P2P_GO == pAdapter->device_mode)) { + if (!pHddCtx->cfg_ini->active_mode_offload) { + if ((pHddCtx->cfg_ini->fhostArpOffload)) { + /* + * Configure the ARP Offload. + * Even if it fails we have to reconfigure the MC/BC + * filter flag as we want RIVA not to drop BroadCast + * Packets + */ + hddLog(VOS_TRACE_LEVEL_INFO, + FL("Calling ARP Offload with flag: %d"), + fenable); + vstatus = hdd_conf_arp_offload(pAdapter, fenable); + pHddCtx->configuredMcastBcastFilter &= + ~(HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST); + + if (!VOS_IS_STATUS_SUCCESS(vstatus)) { + hddLog(VOS_TRACE_LEVEL_ERROR, + "Failed to enable ARPOFfloadFeature %d", + vstatus); + } + } +#ifdef WLAN_NS_OFFLOAD + if (pHddCtx->cfg_ini->fhostNSOffload && + pHddCtx->ns_offload_enable) { + /* + * Configure the NS Offload. + * Even if it fails we have to reconfigure the + * MC/BC filter flag as we want RIVA not to + * drop Multicast Packets + */ + + hddLog(VOS_TRACE_LEVEL_INFO, + FL("Calling NS Offload with flag: %d"), + fenable); + hdd_conf_ns_offload(pAdapter, fenable); + pHddCtx->configuredMcastBcastFilter &= + ~(HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST); + } +#endif } - } - //Configure GTK_OFFLOAD + + /* Configure GTK_OFFLOAD */ #ifdef WLAN_FEATURE_GTK_OFFLOAD - hdd_conf_gtk_offload(pAdapter, fenable); + hdd_conf_gtk_offload(pAdapter, fenable); #endif -#ifdef WLAN_NS_OFFLOAD - if (pHddCtx->cfg_ini->fhostNSOffload && - pHddCtx->ns_offload_enable) - { /* - * Configure the NS Offload. - * Even if it fails we have to reconfigure the MC/BC filter flag - * as we want RIVA not to drop Multicast Packets + * This variable saves the state if offload were configured + * or not. helps in recovering when pcie fails to suspend + * because of ongoing scan and state is no longer + * associated. */ - - hddLog(VOS_TRACE_LEVEL_INFO, - FL("Calling NS Offload with flag: %d"), fenable); - hdd_conf_ns_offload(pAdapter, fenable); - pHddCtx->configuredMcastBcastFilter &= - ~(HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST); - } - -#endif - /* - * This variable saves the state if offload were configured - * or not. helps in recovering when pcie fails to suspend - * because of ongoing scan and state is no longer associated. - */ - pAdapter->offloads_configured = TRUE; + pAdapter->offloads_configured = TRUE; } - } - else - { - //Disable ARPOFFLOAD - if ( (eConnectionState_Associated == + } else { + /* Disable offlaod features */ + if ((eConnectionState_Associated == (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) || - (pAdapter->offloads_configured == TRUE) - ) - { - pAdapter->offloads_configured = FALSE; + (pAdapter->offloads_configured == TRUE)) { - if (pHddCtx->cfg_ini->fhostArpOffload) - { - vstatus = hdd_conf_arp_offload(pAdapter, fenable); - if (!VOS_IS_STATUS_SUCCESS(vstatus)) - { - hddLog(VOS_TRACE_LEVEL_ERROR, - "Failed to disable ARPOffload Feature %d", vstatus); - } - } - //Disable GTK_OFFLOAD -#ifdef WLAN_FEATURE_GTK_OFFLOAD - hdd_conf_gtk_offload(pAdapter, fenable); -#endif + pAdapter->offloads_configured = FALSE; + + /* Disable ARPOFFLOAD */ + if (!pHddCtx->cfg_ini->active_mode_offload) { + if (pHddCtx->cfg_ini->fhostArpOffload) { + vstatus = hdd_conf_arp_offload(pAdapter, fenable); + if (!VOS_IS_STATUS_SUCCESS(vstatus)) { + hddLog(VOS_TRACE_LEVEL_ERROR, + "Failed to disable ARPOffload Feature %d", + vstatus); + } + } #ifdef WLAN_NS_OFFLOAD - //Disable NSOFFLOAD - if (pHddCtx->cfg_ini->fhostNSOffload && - pHddCtx->ns_offload_enable) - { - hdd_conf_ns_offload(pAdapter, fenable); - } + /* Disable NSOFFLOAD */ + if (pHddCtx->cfg_ini->fhostNSOffload && + pHddCtx->ns_offload_enable) { + hdd_conf_ns_offload(pAdapter, fenable); + } +#endif + } + /* Disable GTK_OFFLOAD*/ +#ifdef WLAN_FEATURE_GTK_OFFLOAD + hdd_conf_gtk_offload(pAdapter, fenable); #endif } } } + EXIT(); return; } @@ -1094,6 +1105,11 @@ static void __hdd_ipv4_notifier_work_queue(struct work_struct *work) if (0 != status) return; + if (!pHddCtx->cfg_ini->active_mode_offload) { + hddLog(LOG1, FL("Active mode offload is disabled")); + return; + } + if (VOS_FALSE == pHddCtx->sus_res_mcastbcast_filter_valid) { pHddCtx->sus_res_mcastbcast_filter = pHddCtx->configuredMcastBcastFilter; @@ -1106,8 +1122,7 @@ static void __hdd_ipv4_notifier_work_queue(struct work_struct *work) if ((eConnectionState_Associated == (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState || - ndi_connected) && - pHddCtx->hdd_wlan_suspended) { + ndi_connected)) { /* * This invocation being part of the IPv4 registration callback, * we are passing second parameter as 2 to avoid registration @@ -1234,6 +1249,7 @@ VOS_STATUS hdd_conf_arp_offload(hdd_adapter_t *pAdapter, int fenable) hddLog(LOG1, FL("fenable = %d"), fenable); + /* In SAP/P2PGo mode, ARP/NS offload feature capability * is controlled by one bit. */ |
