From f5e306f78517823264b78f7feb016bb8384aee5e Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Thu, 25 Aug 2016 14:55:14 -0700 Subject: [PATCH 01/18] qcacmn: Fail PM suspend if target has sent initial wake up Host is not handling target initial wake up properly which is leading to resume failure. Fail PM suspend request if target has sent initial wake up message. Change-Id: I3797f1afa99ed9412b7ded3e1ea85c344bd0f435 CRs-Fixed: 1059543 --- htc/htc_api.h | 1 + htc/htc_recv.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htc/htc_api.h b/htc/htc_api.h index 835cc014ebae..4768c0aac663 100644 --- a/htc/htc_api.h +++ b/htc/htc_api.h @@ -57,6 +57,7 @@ typedef struct _HTC_INIT_INFO { void *pContext; /* context for target notifications */ void (*TargetFailure)(void *Instance, QDF_STATUS Status); void (*TargetSendSuspendComplete)(void *ctx, bool is_nack); + void (*target_initial_wakeup_cb)(void); } HTC_INIT_INFO; /* Struct for HTC layer packet stats*/ diff --git a/htc/htc_recv.c b/htc/htc_recv.c index 49e2fddebba0..cc466d514278 100644 --- a/htc/htc_recv.c +++ b/htc/htc_recv.c @@ -440,16 +440,21 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf, qdf_event_set(&target->ctrl_response_valid); break; -#ifdef CONFIG_MCL +#ifdef HTC_MSG_WAKEUP_FROM_SUSPEND_ID case HTC_MSG_WAKEUP_FROM_SUSPEND_ID: AR_DEBUG_PRINTF(ATH_DEBUG_ANY, - ("Received initial wake up\n")); + ("Received initial wake up")); LOCK_HTC_CREDIT(target); htc_credit_record(HTC_INITIAL_WAKE_UP, pEndpoint->TxCredits, HTC_PACKET_QUEUE_DEPTH( &pEndpoint->TxQueue)); UNLOCK_HTC_CREDIT(target); + if (target->HTCInitInfo.target_initial_wakeup_cb) + target->HTCInitInfo.target_initial_wakeup_cb(); + else + AR_DEBUG_PRINTF(ATH_DEBUG_ANY, + ("No initial wake up cb")); break; #endif case HTC_MSG_SEND_SUSPEND_COMPLETE: From ee8d0c1935793a25b6801fc67afaa15d210fd191 Mon Sep 17 00:00:00 2001 From: qcabuildsw Date: Sun, 28 Aug 2016 22:38:14 -0700 Subject: [PATCH 02/18] Release 5.1.0.22X Release 5.1.0.22X Change-Id: Ic4640efa52f7207e4f94edee04b497a15b34ca05 CRs-Fixed: 688141 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index b142a31e4f87..57a4f4dc1c23 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,2 +1,2 @@ -Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.22W +Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.22X Matches Component wlan-cld3.driver.lnx.1.1 version 5.1.0.22C From a0e147431b8f3068de70ffeb87a174d3db69692a Mon Sep 17 00:00:00 2001 From: Govind Singh Date: Fri, 8 Jul 2016 19:00:56 +0530 Subject: [PATCH 03/18] qcacmn: Fix compilation errors in WMI for Big Endian platform This change fixes the compilation issues faced due to WMI convergence changes on the big endian platform. Change-Id: I18bae4fb7884683d8621ce9a862dc1a51ef84f82 CRs-Fixed: 1039318 --- wmi/inc/wmi_unified_param.h | 8 +++++++ wmi/src/wmi_unified_non_tlv.c | 43 ++++++++++++++++++++++++----------- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index b846298f0f38..b42bdd3b0842 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -121,6 +121,14 @@ #define WMI_HOST_MAX_BUFFER_SIZE 1712 #define WMI_HAL_MAX_SANTENNA 4 +#ifdef CONFIG_WIN +#if ATH_SUPPORT_FIPS +#define FIPS_ALIGN 4 +#define FIPS_ALIGNTO(__addr, __to) ((((unsigned long int)(__addr)) + (__to) - 1) & ~((__to) - 1)) +#define FIPS_IS_ALIGNED(__addr, __to) (!(((unsigned long int)(__addr)) & ((__to)-1))) +#endif +#endif + #define WMI_HOST_F_MS(_v, _f) \ (((_v) & (_f)) >> (_f##_S)) diff --git a/wmi/src/wmi_unified_non_tlv.c b/wmi/src/wmi_unified_non_tlv.c index ae886ad25a82..0cb850ba577b 100644 --- a/wmi/src/wmi_unified_non_tlv.c +++ b/wmi/src/wmi_unified_non_tlv.c @@ -789,7 +789,7 @@ send_pdev_utf_cmd_non_tlv(wmi_unified_t wmi_handle, srcp = (uint32_t *)bufpos; for (i = 0; i < (roundup(chunkLen, sizeof(uint32_t)) / 4); i++) { - *destp = le32_to_cpu(*srcp); + *destp = qdf_le32_to_cpu(*srcp); destp++; srcp++; } } else { @@ -1513,7 +1513,7 @@ QDF_STATUS send_beacon_send_cmd_non_tlv(wmi_unified_t wmi_handle, srcp = (u_int32_t *)wmi_buf_data(param->wbuf); for (i = 0; i < (roundup(bcn_len, sizeof(u_int32_t))/4); i++) { - *destp = le32_to_cpu(*srcp); + *destp = qdf_le32_to_cpu(*srcp); destp++; srcp++; } } @@ -1625,6 +1625,9 @@ QDF_STATUS send_peer_assoc_cmd_non_tlv(wmi_unified_t wmi_handle, { wmi_peer_assoc_complete_cmd *cmd; int len = sizeof(wmi_peer_assoc_complete_cmd); +#ifdef BIG_ENDIAN_HOST + int i; +#endif wmi_buf_t buf; @@ -1732,12 +1735,11 @@ QDF_STATUS send_peer_assoc_cmd_non_tlv(wmi_unified_t wmi_handle, param->peer_legacy_rates.rates, param->peer_legacy_rates.num_rates); #ifdef BIG_ENDIAN_HOST - int i; for (i = 0; i < param->peer_legacy_rates.num_rates/sizeof(A_UINT32) + 1; i++) cmd->peer_legacy_rates.rates[i] = - le32_to_cpu(cmd->peer_legacy_rates.rates[i]); + qdf_le32_to_cpu(cmd->peer_legacy_rates.rates[i]); #endif cmd->peer_ht_rates.num_rates = param->peer_ht_rates.num_rates; @@ -1748,7 +1750,7 @@ QDF_STATUS send_peer_assoc_cmd_non_tlv(wmi_unified_t wmi_handle, for (i = 0; i < param->peer_ht_rates.num_rates/sizeof(A_UINT32) + 1; i++) cmd->peer_ht_rates.rates[i] = - le32_to_cpu(cmd->peer_ht_rates.rates[i]); + qdf_le32_to_cpu(cmd->peer_ht_rates.rates[i]); #endif if (param->ht_flag && @@ -2837,9 +2839,9 @@ send_mgmt_cmd_non_tlv(wmi_unified_t wmi_handle, u_int32_t *destp, *srcp; destp = (u_int32_t *)cmd->bufp; srcp = (u_int32_t *)wmi_buf_data(param->tx_frame); - for (i = 0; i < (roundup(param->buf_len, + for (i = 0; i < (roundup(param->frm_len, sizeof(u_int32_t))/4); i++) { - *destp = le32_to_cpu(*srcp); + *destp = qdf_le32_to_cpu(*srcp); destp++; srcp++; } } @@ -3311,6 +3313,21 @@ send_wlan_profile_trigger_cmd_non_tlv(wmi_unified_t wmi_handle, WMI_WLAN_PROFILE_TRIGGER_CMDID); } +#ifdef BIG_ENDIAN_HOST +void wmi_host_swap_bytes(void *pv, size_t n) +{ + int noWords; + int i; + A_UINT32 *wordPtr; + + noWords = n/sizeof(u_int32_t); + wordPtr = (u_int32_t *)pv; + for (i = 0; i < noWords; i++) + *(wordPtr + i) = __cpu_to_le32(*(wordPtr + i)); +} +#define WMI_HOST_SWAPME(x, len) wmi_host_swap_bytes(&x, len); +#endif + /** * send_set_ht_ie_cmd_non_tlv() - send ht ie command to fw * @wmi_handle: wmi handle @@ -3340,8 +3357,8 @@ send_set_ht_ie_cmd_non_tlv(wmi_unified_t wmi_handle, cmd->ie_len = param->ie_len; qdf_mem_copy(cmd->ie_data, param->ie_data, param->ie_len); #ifdef BIG_ENDIAN_HOST - SWAPME(cmd->ie_data, len-(offsetof(wmi_pdev_set_ht_ie_cmd, - param->ie_data))); + WMI_HOST_SWAPME(cmd->ie_data, len-(offsetof(wmi_pdev_set_ht_ie_cmd, + ie_data))); #endif return wmi_unified_cmd_send(wmi_handle, buf, len, WMI_PDEV_SET_HT_CAP_IE_CMDID); @@ -3376,8 +3393,8 @@ send_set_vht_ie_cmd_non_tlv(wmi_unified_t wmi_handle, cmd->ie_len = param->ie_len; qdf_mem_copy(cmd->ie_data, param->ie_data, param->ie_len); #ifdef BIG_ENDIAN_HOST - SWAPME(cmd->ie_data, len-(offsetof(wmi_pdev_set_vht_ie_cmd, - param->ie_data))); + WMI_HOST_SWAPME(cmd->ie_data, len-(offsetof(wmi_pdev_set_vht_ie_cmd, + ie_data))); #endif return wmi_unified_cmd_send(wmi_handle, buf, len, WMI_PDEV_SET_VHT_CAP_IE_CMDID); @@ -5325,7 +5342,7 @@ static QDF_STATUS extract_fips_event_data_non_tlv(wmi_unified_t wmi_handle, /*****************LE to BE conversion*************************/ /* Assigning unaligned space to copy the data */ - unsigned char *data_unaligned = qdf_mem_malloc(NULL, + unsigned char *data_unaligned = qdf_mem_malloc( (sizeof(u_int8_t)*event->data_len + FIPS_ALIGN)); u_int8_t *data_aligned = NULL; @@ -5350,7 +5367,7 @@ static QDF_STATUS extract_fips_event_data_non_tlv(wmi_unified_t wmi_handle, /* Endianness to LE */ for (c = 0; c < event->data_len/4; c++) { *((u_int32_t *)data_aligned+c) = - qdf_os_le32_to_cpu(*((u_int32_t *)data_aligned+c)); + qdf_le32_to_cpu(*((u_int32_t *)data_aligned+c)); } /* Copy content to event->data */ From ac535e07649d3655ea5ac2e98af5e26c260004e2 Mon Sep 17 00:00:00 2001 From: qcabuildsw Date: Tue, 30 Aug 2016 16:02:14 -0700 Subject: [PATCH 04/18] Release 5.1.0.22Y Release 5.1.0.22Y Change-Id: I1c48096d1e10f89ed7c87239f9dca92178b3b132 CRs-Fixed: 688141 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 57a4f4dc1c23..7132fab1889b 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,2 +1,2 @@ -Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.22X +Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.22Y Matches Component wlan-cld3.driver.lnx.1.1 version 5.1.0.22C From 4d9b0808dab82179ce1bba87e5e4a9e0f66bba0d Mon Sep 17 00:00:00 2001 From: Houston Hoffman Date: Wed, 20 Jul 2016 10:10:35 -0700 Subject: [PATCH 05/18] qcacmn: Add htc_pm_runtime put/get apis htc_runtime_pm apis are needed to deprecate the qdf_runtime_pm apis. The qdf_runtime_pm apis rely on cds_get_context which is not being converged and thus qdf_runtime_pm needs to be deprecated. Since the htc_handle wraps the hif context for most upper layers, htc_module is providing a wrapper functions. Change-Id: Ic66a0891db53b610fd4373e7528a08f2787f45fc CRs-Fixed: 1044150 --- htc/htc.c | 18 ++++++++++++++++++ htc/htc_api.h | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/htc/htc.c b/htc/htc.c index 5fd24fb9d8b3..7fddef41be06 100644 --- a/htc/htc.c +++ b/htc/htc.c @@ -992,3 +992,21 @@ bool htc_can_suspend_link(HTC_HANDLE htc_handle) return hif_can_suspend_link(target->hif_dev); } + +#ifdef FEATURE_RUNTIME_PM +int htc_pm_runtime_get(HTC_HANDLE htc_handle) +{ + HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_handle); + + HTC_INFO("%s: %pS\n", __func__, (void *)_RET_IP_); + return hif_pm_runtime_get(target->hif_dev); +} + +int htc_pm_runtime_put(HTC_HANDLE htc_handle) +{ + HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_handle); + + HTC_INFO("%s: %pS\n", __func__, (void *)_RET_IP_); + return hif_pm_runtime_put(target->hif_dev); +} +#endif diff --git a/htc/htc_api.h b/htc/htc_api.h index 4768c0aac663..5adc278bf87d 100644 --- a/htc/htc_api.h +++ b/htc/htc_api.h @@ -750,4 +750,11 @@ void htc_dump_bundle_stats(HTC_HANDLE HTCHandle); void htc_clear_bundle_stats(HTC_HANDLE HTCHandle); #endif +#ifdef FEATURE_RUNTIME_PM +int htc_pm_runtime_get(HTC_HANDLE htc_handle); +int htc_pm_runtime_put(HTC_HANDLE htc_handle); +#else +static inline int htc_pm_runtime_get(HTC_HANDLE htc_handle) { return 0; } +static inline int htc_pm_runtime_put(HTC_HANDLE htc_handle) { return 0; } +#endif #endif /* _HTC_API_H_ */ From cd0884a954041f22b6009d2e59bb2be6ddcd7a42 Mon Sep 17 00:00:00 2001 From: Houston Hoffman Date: Wed, 24 Aug 2016 15:30:09 -0700 Subject: [PATCH 06/18] qcacmn: Add WCN3990 to hw names Print out hw name WCN3990_V1 when soc version is 0x40000000. Change-Id: Ic76cd3ddc46cf9a2b142cc2d455b512e442f189e CRs-Fixed: 1059083 --- hif/src/hif_hw_version.h | 1 + hif/src/hif_main.c | 5 +++++ hif/src/snoc/if_snoc.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/hif/src/hif_hw_version.h b/hif/src/hif_hw_version.h index c5b56d861af5..7630776e260f 100644 --- a/hif/src/hif_hw_version.h +++ b/hif/src/hif_hw_version.h @@ -39,6 +39,7 @@ #define AR6320_REV3_2_VERSION 0x5030000 #define AR6320_DEV_VERSION 0x1000000 #define QCA9377_REV1_1_VERSION 0x5020001 +#define WCN3990_v1 0x40000000 struct qwlan_hw { u32 id; diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index abdb15864568..9b8dc1248f74 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -289,6 +289,11 @@ static const struct qwlan_hw qwlan_hw_list[] = { .id = AR6320_REV3_2_VERSION, .subid = 0xA, .name = "AR6320_REV3_2_VERSION", + }, + { + .id = WCN3990_v1, + .subid = 0x0, + .name = "WCN3990_V1", } }; diff --git a/hif/src/snoc/if_snoc.c b/hif/src/snoc/if_snoc.c index a414958d0082..77bc554936d7 100644 --- a/hif/src/snoc/if_snoc.c +++ b/hif/src/snoc/if_snoc.c @@ -145,6 +145,10 @@ static QDF_STATUS hif_snoc_get_soc_info(struct hif_softc *scn) scn->mem = soc_info.v_addr; scn->mem_pa = soc_info.p_addr; + + scn->target_info.soc_version = soc_info.soc_id; + scn->target_info.target_version = soc_info.soc_id; + scn->target_info.target_revision = 0; return QDF_STATUS_SUCCESS; } From af630c25c0aaaee4992fafe2352bb8966eadb78b Mon Sep 17 00:00:00 2001 From: qcabuildsw Date: Tue, 30 Aug 2016 23:28:36 -0700 Subject: [PATCH 07/18] Release 5.1.0.22Z Release 5.1.0.22Z Change-Id: I206d3008cf84d2d28050286b1f194ee9e22ac92e CRs-Fixed: 688141 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 7132fab1889b..b0156a3467be 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,2 +1,2 @@ -Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.22Y +Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.22Z Matches Component wlan-cld3.driver.lnx.1.1 version 5.1.0.22C From 4fcafd4990c0918300d392f61441fc22772c56b8 Mon Sep 17 00:00:00 2001 From: Govind Singh Date: Mon, 8 Aug 2016 12:37:31 +0530 Subject: [PATCH 08/18] qcacmn: unmap buffer for CE destination ring en-queue error Unmap a previously mapped buffer if host fails to en-queue buffer to CE destination ring. Propagation from qcacld-2.0 to qcacmn. Change-Id: If23398b01124638cfb266f5755fc9e45d3969ac9 CRs-Fixed: 1033307 --- hif/src/ce/ce_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c index 1a7d3a5a5123..1f5201d742e4 100644 --- a/hif/src/ce/ce_main.c +++ b/hif/src/ce/ce_main.c @@ -1647,6 +1647,8 @@ static int hif_post_recv_buffers_for_pipe(struct HIF_CE_pipe_info *pipe_info) __func__, pipe_info->pipe_num, atomic_read(&pipe_info->recv_bufs_needed), pipe_info->nbuf_ce_enqueue_err_count); + qdf_nbuf_unmap_single(scn->qdf_dev, nbuf, + QDF_DMA_FROM_DEVICE); atomic_inc(&pipe_info->recv_bufs_needed); qdf_nbuf_free(nbuf); return 1; From 2d9bcb1ade33e88379feca56fbaa8346c943fd09 Mon Sep 17 00:00:00 2001 From: qcabuildsw Date: Wed, 31 Aug 2016 05:14:43 -0700 Subject: [PATCH 09/18] Release 5.1.0.23 Release 5.1.0.23 Change-Id: Ic44825f4290c028337751a7773e4f8dbf4a79cba CRs-Fixed: 688141 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index b0156a3467be..7fddbef4ef4b 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,2 +1,2 @@ -Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.22Z +Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.23 Matches Component wlan-cld3.driver.lnx.1.1 version 5.1.0.22C From 7252e4304838b464329867e78c5be20bec30876b Mon Sep 17 00:00:00 2001 From: Sathish Kumar Date: Tue, 9 Aug 2016 16:50:46 +0530 Subject: [PATCH 10/18] qcacmn: Add WMI API for setting bandwidth fairness This change implements the Non-TLV WMI API for setting bandwidth fairness. This WMI command was implemented as part of the recent WIN SW release. This change ensures it is adapted to convergence code structure. Change-Id: Ib9984c43b91b105bfb4687a7591f4fab509febc4 CRs-Fixed: 1060577 --- wmi/inc/wmi_unified_api.h | 3 +++ wmi/inc/wmi_unified_param.h | 26 +++++++++++++++++++++ wmi/inc/wmi_unified_priv.h | 3 +++ wmi/src/wmi_unified_api.c | 18 ++++++++++++++ wmi/src/wmi_unified_non_tlv.c | 44 +++++++++++++++++++++++++++++++++++ 5 files changed, 94 insertions(+) diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 7108b298876c..5ef8b5a7325c 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -854,6 +854,9 @@ QDF_STATUS wmi_unified_stats_request_send(void *wmi_hdl, QDF_STATUS wmi_unified_pdev_get_tpc_config_cmd_send(void *wmi_hdl, uint32_t param); +QDF_STATUS wmi_unified_set_bwf_cmd_send(void *wmi_hdl, + struct set_bwf_params *param); + QDF_STATUS wmi_unified_set_atf_cmd_send(void *wmi_hdl, struct set_atf_params *param); diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index b42bdd3b0842..306aad6ed988 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -3725,6 +3725,32 @@ typedef struct { uint32_t percentage_peer; } atf_peer_info; +/** + * struct bwf_peer_info_t - BWF peer info params + * @peer_macaddr: peer mac addr + * @throughput: Throughput + * @max_airtime: Max airtime + * @priority: Priority level + * @reserved: Reserved array + */ +typedef struct { + struct wmi_macaddr_t peer_macaddr; + uint32_t throughput; + uint32_t max_airtime; + uint32_t priority; + uint32_t reserved[4]; +} bwf_peer_info; + +/** + * struct set_bwf_params - BWF params + * @num_peers: number of peers + * @atf_peer_info: BWF peer info + */ +struct set_bwf_params { + uint32_t num_peers; + bwf_peer_info peer_info[1]; +}; + /** * struct set_atf_params - ATF params * @num_peers: number of peers diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index f54202822980..d8b19b715cc3 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -708,6 +708,9 @@ QDF_STATUS (*send_get_buf_extscan_hotlist_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_pdev_get_tpc_config_cmd)(wmi_unified_t wmi_handle, uint32_t param); +QDF_STATUS (*send_set_bwf_cmd)(wmi_unified_t wmi_handle, + struct set_bwf_params *param); + QDF_STATUS (*send_set_atf_cmd)(wmi_unified_t wmi_handle, struct set_atf_params *param); diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 86a79f31f94f..3fd8618808df 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -3443,6 +3443,24 @@ QDF_STATUS wmi_unified_pdev_get_tpc_config_cmd_send(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } +/** + * wmi_unified_set_bwf_cmd_send() - WMI set bwf function + * @param wmi_handle : handle to WMI. + * @param param : pointer to set bwf param + * + * @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_set_bwf_cmd_send(void *wmi_hdl, + struct set_bwf_params *param) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->send_set_bwf_cmd) + return wmi_handle->ops->send_set_bwf_cmd(wmi_handle, param); + + return QDF_STATUS_E_FAILURE; +} + /** * wmi_unified_set_atf_cmd_send() - WMI set atf function * @param wmi_handle : handle to WMI. diff --git a/wmi/src/wmi_unified_non_tlv.c b/wmi/src/wmi_unified_non_tlv.c index 0cb850ba577b..499c39f32bd7 100644 --- a/wmi/src/wmi_unified_non_tlv.c +++ b/wmi/src/wmi_unified_non_tlv.c @@ -3140,6 +3140,49 @@ send_pdev_get_tpc_config_cmd_non_tlv(wmi_unified_t wmi_handle, WMI_PDEV_GET_TPC_CONFIG_CMDID); } +/** + * send_set_bwf_cmd_non_tlv() - send set bwf command to fw + * @wmi_handle: wmi handle + * @param: pointer to set bwf param + * + * Return: 0 for success or error code + */ +QDF_STATUS +send_set_bwf_cmd_non_tlv(wmi_unified_t wmi_handle, + struct set_bwf_params *param) +{ + struct wmi_bwf_peer_info *peer_info; + wmi_peer_bwf_request *cmd; + wmi_buf_t buf; + int len = sizeof(wmi_peer_bwf_request); + int i, retval = 0; + + len += param->num_peers * sizeof(struct wmi_bwf_peer_info); + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + qdf_print("%s:wmi_buf_alloc failed\n", __func__); + return QDF_STATUS_E_FAILURE; + } + cmd = (wmi_peer_bwf_request *)wmi_buf_data(buf); + qdf_mem_copy((void *)&(cmd->num_peers), + (void *)&(param->num_peers), + sizeof(u_int32_t)); + peer_info = (struct wmi_bwf_peer_info *)&(cmd->peer_info[0]); + for (i = 0; i < param->num_peers; i++) { + qdf_mem_copy((void *)&(peer_info[i]), + (void *)&(param->peer_info[i]), + sizeof(struct wmi_bwf_peer_info)); + } + + retval = wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_PEER_BWF_REQUEST_CMDID); + + if (retval) + wmi_buf_free(buf); + + return retval; +} + /** * send_set_atf_cmd_non_tlv() - send set atf command to fw * @wmi_handle: wmi handle @@ -7207,6 +7250,7 @@ struct wmi_ops non_tlv_ops = { .send_scan_chan_list_cmd = send_scan_chan_list_cmd_non_tlv, .send_pdev_get_tpc_config_cmd = send_pdev_get_tpc_config_cmd_non_tlv, .send_set_atf_cmd = send_set_atf_cmd_non_tlv, + .send_set_bwf_cmd = send_set_bwf_cmd_non_tlv, .send_pdev_fips_cmd = send_pdev_fips_cmd_non_tlv, .send_wlan_profile_enable_cmd = send_wlan_profile_enable_cmd_non_tlv, .send_wlan_profile_trigger_cmd = send_wlan_profile_trigger_cmd_non_tlv, From bcb90fbcfb04f9050d0abe5ae5726df90188b12a Mon Sep 17 00:00:00 2001 From: qcabuildsw Date: Wed, 31 Aug 2016 06:28:05 -0700 Subject: [PATCH 11/18] Release 5.1.0.23A Release 5.1.0.23A Change-Id: Ib952643aa117eee548bc3b4423cbf3d5e4d2e43d CRs-Fixed: 688141 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index 7fddbef4ef4b..fa01472f4e44 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,2 +1,2 @@ -Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.23 +Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.23A Matches Component wlan-cld3.driver.lnx.1.1 version 5.1.0.22C From cc277f9791fab6a04f01a49dad09ee94451f279b Mon Sep 17 00:00:00 2001 From: Govind Singh Date: Mon, 8 Aug 2016 19:07:00 +0530 Subject: [PATCH 12/18] qcacmn: Free WMI HB command buffer in case of errors WMI HB command buffer is not freed in case of tx error, Free WMI HB command buffer in case of errors. Propagation from qcacld-2.0 to qcacmn. Change-Id: I15577c50cefc0cc2e9129f175cf874f17acc430e CRs-Fixed: 1001068 --- wmi/src/wmi_unified_tlv.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index f709315bda70..a81d462398cc 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -6372,6 +6372,7 @@ QDF_STATUS send_lphb_config_tcp_params_cmd_tlv(wmi_unified_t wmi_handle, if (QDF_IS_STATUS_ERROR(status)) { WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_TCP_PARAMS returned Error %d", status); + wmi_buf_free(buf); } return status; @@ -6421,6 +6422,7 @@ QDF_STATUS send_lphb_config_tcp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, if (QDF_IS_STATUS_ERROR(status)) { WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_TCP_PKT_FILTER returned Error %d", status); + wmi_buf_free(buf); } return status; @@ -6470,9 +6472,11 @@ QDF_STATUS send_lphb_config_udp_params_cmd_tlv(wmi_unified_t wmi_handle, status = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_HB_SET_UDP_PARAMS_CMDID); - if (QDF_IS_STATUS_ERROR(status)) + if (QDF_IS_STATUS_ERROR(status)) { WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_UDP_PARAMS returned Error %d", status); + wmi_buf_free(buf); + } return status; } @@ -6518,9 +6522,11 @@ QDF_STATUS send_lphb_config_udp_pkt_filter_cmd_tlv(wmi_unified_t wmi_handle, status = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_HB_SET_UDP_PKT_FILTER_CMDID); - if (QDF_IS_STATUS_ERROR(status)) + if (QDF_IS_STATUS_ERROR(status)) { WMI_LOGE("wmi_unified_cmd_send WMI_HB_SET_UDP_PKT_FILTER returned Error %d", status); + wmi_buf_free(buf); + } return status; } @@ -6566,9 +6572,11 @@ QDF_STATUS send_process_dhcp_ind_cmd_tlv(wmi_unified_t wmi_handle, status = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_PEER_SET_PARAM_CMDID); - if (QDF_IS_STATUS_ERROR(status)) + if (QDF_IS_STATUS_ERROR(status)) { WMI_LOGE("%s: wmi_unified_cmd_send WMI_PEER_SET_PARAM_CMD" " returned Error %d", __func__, status); + wmi_buf_free(buf); + } return status; } From 6a9cf7bd168d2dc4ac17c0cdb55784ddc46134a7 Mon Sep 17 00:00:00 2001 From: qcabuildsw Date: Wed, 31 Aug 2016 07:06:48 -0700 Subject: [PATCH 13/18] Release 5.1.0.23B Release 5.1.0.23B Change-Id: I22928dea7a4756d49fc83310d58a0163665bf188 CRs-Fixed: 688141 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index fa01472f4e44..f4848d243291 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,2 +1,2 @@ -Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.23A +Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.23B Matches Component wlan-cld3.driver.lnx.1.1 version 5.1.0.22C From fa291a78517fb94e5397d755281693356603e950 Mon Sep 17 00:00:00 2001 From: Venkateswara Swamy Bandaru Date: Thu, 28 Jul 2016 18:55:23 +0530 Subject: [PATCH 14/18] qcacmn: Fix for kernel panic in wifi down path for peregrine Warm reset is done in wifi down path for peregrine Change-Id: Id187b8e60859f9936e4761bdce9ae7f744bd79d7 --- hif/src/hif_hw_version.h | 1 + hif/src/pcie/hif_io32_pci.h | 2 ++ hif/src/pcie/if_pci.c | 12 ++++++++++++ 3 files changed, 15 insertions(+) diff --git a/hif/src/hif_hw_version.h b/hif/src/hif_hw_version.h index 7630776e260f..c60db25aec79 100644 --- a/hif/src/hif_hw_version.h +++ b/hif/src/hif_hw_version.h @@ -31,6 +31,7 @@ #define AR6004_VERSION_REV1_3 0x31c8088a #define AR9888_REV2_VERSION 0x4100016c +#define AR9887_REV1_VERSION 0x4100016d #define AR6320_REV1_VERSION 0x5000000 #define AR6320_REV1_1_VERSION 0x5000001 #define AR6320_REV1_3_VERSION 0x5000003 diff --git a/hif/src/pcie/hif_io32_pci.h b/hif/src/pcie/hif_io32_pci.h index ce2c22faa246..d1bf2759acde 100644 --- a/hif/src/pcie/hif_io32_pci.h +++ b/hif/src/pcie/hif_io32_pci.h @@ -39,7 +39,9 @@ * For maximum performance and no power management, set this to 1. * For power management at the cost of performance, set this to 0. */ +#ifndef CONFIG_ATH_PCIE_MAX_PERF #define CONFIG_ATH_PCIE_MAX_PERF 0 +#endif /* * For keeping the target awake till the driver is diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index a37d5f3c66a7..1b124fdf99f1 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -2417,6 +2417,7 @@ void hif_pci_disable_bus(struct hif_softc *scn) struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn); struct pci_dev *pdev; void __iomem *mem; + struct hif_target_info *tgt_info = &scn->target_info; /* Attach did not succeed, all resources have been * freed in error handler @@ -2431,7 +2432,18 @@ void hif_pci_disable_bus(struct hif_softc *scn) HOST_GROUP0_MASK); } +#if defined(CPU_WARM_RESET_WAR) + /* Currently CPU warm reset sequence is tested only for AR9888_REV2 + * Need to enable for AR9888_REV1 once CPU warm reset sequence is + * verified for AR9888_REV1 + */ + if ((tgt_info->target_version == AR9888_REV2_VERSION) || (tgt_info->target_version == AR9887_REV1_VERSION)) + hif_pci_device_warm_reset(sc); + else + hif_pci_device_reset(sc); +#else hif_pci_device_reset(sc); +#endif mem = (void __iomem *)sc->mem; if (mem) { pci_disable_msi(pdev); From 50a5518cd64e959e5f1703d9cfa90219951b02b3 Mon Sep 17 00:00:00 2001 From: Sathish Kumar Date: Wed, 27 Jul 2016 12:13:02 +0530 Subject: [PATCH 15/18] qcacmn: Fixing incorrect qdf_mem_set API usage in wmi_unified_non_tlv.c The qdf_mem_set API is used incorrectly in a few instances inside wmi_unified_non_tlv.c The argument list is - However, some places, it is sent as - This change fixes such incorrect function calls to qdf_mem_set(). Change-Id: Id50136f630022b1fdeaddbdefcad9f637f917e9e CRs-Fixed: 1048504 --- wmi/src/wmi_unified_non_tlv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wmi/src/wmi_unified_non_tlv.c b/wmi/src/wmi_unified_non_tlv.c index 499c39f32bd7..aac8757571e3 100644 --- a/wmi/src/wmi_unified_non_tlv.c +++ b/wmi/src/wmi_unified_non_tlv.c @@ -4471,7 +4471,7 @@ send_rtt_meas_req_test_cmd_non_tlv(wmi_unified_t wmi_handle, } p = (u_int8_t *) wmi_buf_data(buf); - qdf_mem_set(p, 0, len); + qdf_mem_set(p, len, 0); head = (wmi_rtt_measreq_head *) p; WMI_RTT_REQ_ID_SET(head->req_id, param->req_id); @@ -4609,7 +4609,7 @@ send_rtt_meas_req_cmd_non_tlv(wmi_unified_t wmi_handle, } p = (uint8_t *) wmi_buf_data(buf); - qdf_mem_set(p, 0, len); + qdf_mem_set(p, len, 0); /* encode header */ head = (wmi_rtt_measreq_head *) p; @@ -4679,7 +4679,7 @@ send_rtt_meas_req_cmd_non_tlv(wmi_unified_t wmi_handle, WMI_SET_CHANNEL_FLAG(w_chan, WMI_CHAN_FLAG_DFS); WMI_CHAR_ARRAY_TO_MAC_ADDR(((uint8_t *)peer), &body->dest_mac); - qdf_mem_set(spoof, 0 , 6); + qdf_mem_set(spoof, IEEE80211_ADDR_LEN, 0); WMI_CHAR_ARRAY_TO_MAC_ADDR(((uint8_t *)param->spoof_mac_addr), &body->spoof_bssid); @@ -4777,7 +4777,7 @@ send_lci_set_cmd_non_tlv(wmi_unified_t wmi_handle, } p = (uint8_t *) wmi_buf_data(buf); - qdf_mem_set(p, 0, len); + qdf_mem_set(p, len, 0); head = (wmi_oem_measreq_head *)p; head->sub_type = TARGET_OEM_CONFIGURE_LCI; @@ -4847,7 +4847,7 @@ send_lcr_set_cmd_non_tlv(wmi_unified_t wmi_handle, } p = (uint8_t *) wmi_buf_data(buf); - qdf_mem_set(p, 0, len); + qdf_mem_set(p, len, 0); head = (wmi_oem_measreq_head *)p; head->sub_type = TARGET_OEM_CONFIGURE_LCR; From 59471382375e3d6f264c5180c9204f2365bf2eaa Mon Sep 17 00:00:00 2001 From: Sathish Kumar Date: Wed, 31 Aug 2016 16:01:57 +0530 Subject: [PATCH 16/18] qcacmn: Implement QDF API to get queue mapping and total ram size This change adds the following QDF APIs - qdf_nbuf_get_queue_mapping: To get the queue mapping set by linux kernel qdf_get_totalramsize: To get total ram size in Kb Change-Id: I86daffebba759c086d15951dfcc72ea626c74bb4 CRs-Fixed: 1055387 --- qdf/inc/qdf_nbuf.h | 6 ++++++ qdf/inc/qdf_util.h | 5 +++++ qdf/linux/src/i_qdf_nbuf.h | 12 ++++++++++++ qdf/linux/src/i_qdf_util.h | 16 ++++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/qdf/inc/qdf_nbuf.h b/qdf/inc/qdf_nbuf.h index 3221164012fc..505d084385bd 100644 --- a/qdf/inc/qdf_nbuf.h +++ b/qdf/inc/qdf_nbuf.h @@ -2041,6 +2041,12 @@ static inline void qdf_nbuf_set_priority(qdf_nbuf_t buf, uint32_t p) __qdf_nbuf_set_priority(buf, p); } +static inline uint16_t +qdf_nbuf_get_queue_mapping(qdf_nbuf_t buf) +{ + return __qdf_nbuf_get_queue_mapping(buf); +} + static inline uint8_t * qdf_nbuf_get_priv_ptr(qdf_nbuf_t buf) { diff --git a/qdf/inc/qdf_util.h b/qdf/inc/qdf_util.h index 44d0450264a4..a80df5bb44dc 100644 --- a/qdf/inc/qdf_util.h +++ b/qdf/inc/qdf_util.h @@ -433,5 +433,10 @@ static inline int qdf_device_init_wakeup(qdf_device_t qdf_dev, bool enable) return __qdf_device_init_wakeup(qdf_dev, enable); } +static inline +uint64_t qdf_get_totalramsize(void) +{ + return __qdf_get_totalramsize(); +} #endif /*_QDF_UTIL_H*/ diff --git a/qdf/linux/src/i_qdf_nbuf.h b/qdf/linux/src/i_qdf_nbuf.h index 050f73cc37ec..404275cda581 100644 --- a/qdf/linux/src/i_qdf_nbuf.h +++ b/qdf/linux/src/i_qdf_nbuf.h @@ -1670,4 +1670,16 @@ __qdf_nbuf_mark_wakeup_frame(__qdf_nbuf_t buf) buf->mark |= QDF_MARK_FIRST_WAKEUP_PACKET; } +/** + * __qdf_nbuf_get_queue_mapping() - get the queue mapping set by linux kernel + * + * @buf: sk buff + * + * Return: Queue mapping + */ +static inline uint16_t +__qdf_nbuf_get_queue_mapping(struct sk_buff *skb) +{ + return skb->queue_mapping; +} #endif /*_I_QDF_NET_BUF_H */ diff --git a/qdf/linux/src/i_qdf_util.h b/qdf/linux/src/i_qdf_util.h index 9894e1c2a368..a496573e46f9 100644 --- a/qdf/linux/src/i_qdf_util.h +++ b/qdf/linux/src/i_qdf_util.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -195,6 +196,8 @@ static inline bool __qdf_is_macaddr_equal(struct qdf_mac_addr *mac_addr1, #define __qdf_min(_a, _b) ((_a) < (_b) ? _a : _b) #define __qdf_max(_a, _b) ((_a) > (_b) ? _a : _b) +#define MEMINFO_KB(x) ((x) << (PAGE_SHIFT - 10)) /* In kilobytes */ + /** * @brief Assert */ @@ -276,4 +279,17 @@ static inline int __qdf_device_init_wakeup(__qdf_device_t qdf_dev, bool enable) return device_init_wakeup(qdf_dev->dev, enable); } +/** + * __qdf_get_totalramsize() - Get total ram size in Kb + * + * Return: Total ram size in Kb + */ +static inline uint64_t +__qdf_get_totalramsize(void) +{ + struct sysinfo meminfo; + si_meminfo(&meminfo); + return MEMINFO_KB(meminfo.totalram); +} + #endif /*_I_QDF_UTIL_H*/ From e28261fdb1d58257333033b7c56b7bdd562b0780 Mon Sep 17 00:00:00 2001 From: qcabuildsw Date: Thu, 1 Sep 2016 13:27:56 -0700 Subject: [PATCH 17/18] Release 5.1.0.23C Release 5.1.0.23C Change-Id: If129b9c75ac642a1bbd65ad58fda1ec051e509cb CRs-Fixed: 688141 --- VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION.txt b/VERSION.txt index f4848d243291..463a8da44682 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,2 +1,2 @@ -Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.23B +Current Component wlan-cmn.driver.lnx.1.0 version 5.1.0.23C Matches Component wlan-cld3.driver.lnx.1.1 version 5.1.0.22C From 7fdff0c52f98ce6b49fbf8b3b5572b5b2d5a91d5 Mon Sep 17 00:00:00 2001 From: Houston Hoffman Date: Mon, 29 Aug 2016 12:31:58 -0700 Subject: [PATCH 18/18] qcacmn: Use suspend_noirq callback instead of disabling irqs Disabling the interrupts and setting them as wakeup sources does not work as expected. The pending interrupt gets trapped in sw and kernel does not check for it before finishing the suspend. Instead, use the suspend_noirq callback to guarantee that wakeup messages don't get processed without rejecting the suspend. Change-Id: I5ec5ce2a7e1b14c3d8477fe7aa0372c9ffd4dc0d CRs-Fixed: 1060880 --- hif/inc/hif.h | 2 + hif/src/dispatcher/dummy.c | 28 ++++++++ hif/src/dispatcher/dummy.h | 2 + hif/src/dispatcher/multibus.c | 18 ++++- hif/src/dispatcher/multibus.h | 2 + hif/src/dispatcher/multibus_snoc.c | 3 + hif/src/dispatcher/snoc_api.h | 1 + hif/src/snoc/if_snoc.c | 107 +++++------------------------ 8 files changed, 72 insertions(+), 91 deletions(-) diff --git a/hif/inc/hif.h b/hif/inc/hif.h index 5b24ef8a64e6..9e6ddb439e0c 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -573,6 +573,8 @@ bool hif_can_suspend_link(struct hif_opaque_softc *); int hif_bus_resume(struct hif_opaque_softc *); int hif_bus_suspend(struct hif_opaque_softc *); +int hif_bus_resume_noirq(struct hif_opaque_softc *); +int hif_bus_suspend_noirq(struct hif_opaque_softc *); #ifdef FEATURE_RUNTIME_PM int hif_pre_runtime_suspend(struct hif_opaque_softc *hif_ctx); diff --git a/hif/src/dispatcher/dummy.c b/hif/src/dispatcher/dummy.c index e9362f96d5ef..1690e058d8de 100644 --- a/hif/src/dispatcher/dummy.c +++ b/hif/src/dispatcher/dummy.c @@ -83,6 +83,34 @@ int hif_dummy_bus_resume(struct hif_softc *hif_ctx) return 0; } +/** + * hif_dummy_suspend_noirq() - suspend the bus + * @hif_ctx: hif context + * + * dummy for busses that don't need to syncronize + * with interrupt disable. + * + * Return: 0 for success and non-zero for failure + */ +int hif_dummy_bus_suspend_noirq(struct hif_softc *hif_ctx) +{ + return 0; +} + +/** + * hif_dummy_resume_noirq() - resume the bus + * @hif_ctx: hif context + * + * dummy for busses that don't need to syncronize + * with interrupt disable. + * + * Return: 0 for success and non-zero for failure + */ +int hif_dummy_bus_resume_noirq(struct hif_softc *hif_ctx) +{ + return 0; +} + /** * hif_dummy_target_sleep_state_adjust() - api to adjust state of target * @scn: hif context diff --git a/hif/src/dispatcher/dummy.h b/hif/src/dispatcher/dummy.h index 049fa1a5333c..b531c1dd4e5b 100644 --- a/hif/src/dispatcher/dummy.h +++ b/hif/src/dispatcher/dummy.h @@ -30,6 +30,8 @@ void hif_dummy_bus_prevent_linkdown(struct hif_softc *scn, bool flag); void hif_dummy_reset_soc(struct hif_softc *scn); int hif_dummy_bus_suspend(struct hif_softc *hif_ctx); int hif_dummy_bus_resume(struct hif_softc *hif_ctx); +int hif_dummy_bus_suspend_noirq(struct hif_softc *hif_ctx); +int hif_dummy_bus_resume_noirq(struct hif_softc *hif_ctx); int hif_dummy_target_sleep_state_adjust(struct hif_softc *scn, bool sleep_ok, bool wait_for_it); void hif_dummy_enable_power_management(struct hif_softc *hif_ctx, diff --git a/hif/src/dispatcher/multibus.c b/hif/src/dispatcher/multibus.c index 416d997a5b4d..5643b6f05715 100644 --- a/hif/src/dispatcher/multibus.c +++ b/hif/src/dispatcher/multibus.c @@ -55,8 +55,10 @@ static void hif_intialize_default_ops(struct hif_softc *hif_sc) &hif_dummy_display_stats; bus_ops->hif_clear_stats = &hif_dummy_clear_stats; - bus_ops->hif_set_bundle_mode = hif_dummy_set_bundle_mode; - bus_ops->hif_bus_reset_resume = hif_dummy_bus_reset_resume; + bus_ops->hif_set_bundle_mode = &hif_dummy_set_bundle_mode; + bus_ops->hif_bus_reset_resume = &hif_dummy_bus_reset_resume; + bus_ops->hif_bus_suspend_noirq = &hif_dummy_bus_suspend_noirq; + bus_ops->hif_bus_resume_noirq = &hif_dummy_bus_resume_noirq; } #define NUM_OPS (sizeof(struct hif_bus_ops) / sizeof(void *)) @@ -195,6 +197,18 @@ int hif_bus_resume(struct hif_opaque_softc *hif_ctx) return hif_sc->bus_ops.hif_bus_resume(hif_sc); } +int hif_bus_suspend_noirq(struct hif_opaque_softc *hif_ctx) +{ + struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx); + return hif_sc->bus_ops.hif_bus_suspend_noirq(hif_sc); +} + +int hif_bus_resume_noirq(struct hif_opaque_softc *hif_ctx) +{ + struct hif_softc *hif_sc = HIF_GET_SOFTC(hif_ctx); + return hif_sc->bus_ops.hif_bus_resume_noirq(hif_sc); +} + int hif_target_sleep_state_adjust(struct hif_softc *hif_sc, bool sleep_ok, bool wait_for_it) { diff --git a/hif/src/dispatcher/multibus.h b/hif/src/dispatcher/multibus.h index 71b7a3c76bd7..63423630c1da 100644 --- a/hif/src/dispatcher/multibus.h +++ b/hif/src/dispatcher/multibus.h @@ -42,6 +42,8 @@ struct hif_bus_ops { void (*hif_reset_soc)(struct hif_softc *hif_sc); int (*hif_bus_suspend)(struct hif_softc *hif_ctx); int (*hif_bus_resume)(struct hif_softc *hif_ctx); + int (*hif_bus_suspend_noirq)(struct hif_softc *hif_ctx); + int (*hif_bus_resume_noirq)(struct hif_softc *hif_ctx); int (*hif_target_sleep_state_adjust)(struct hif_softc *scn, bool sleep_ok, bool wait_for_it); void (*hif_disable_isr)(struct hif_softc *hif_sc); diff --git a/hif/src/dispatcher/multibus_snoc.c b/hif/src/dispatcher/multibus_snoc.c index ae292709fecd..2dc80d62e6b4 100644 --- a/hif/src/dispatcher/multibus_snoc.c +++ b/hif/src/dispatcher/multibus_snoc.c @@ -47,6 +47,9 @@ QDF_STATUS hif_initialize_snoc_ops(struct hif_bus_ops *bus_ops) bus_ops->hif_reset_soc = &hif_dummy_reset_soc; bus_ops->hif_bus_suspend = &hif_snoc_bus_suspend; bus_ops->hif_bus_resume = &hif_snoc_bus_resume; + bus_ops->hif_bus_suspend_noirq = &hif_snoc_bus_suspend_noirq; + /* snoc_bus_resume_noirq had no side effects, use dummy resume_noirq */ + bus_ops->hif_bus_resume_noirq = &hif_dummy_bus_resume_noirq; bus_ops->hif_target_sleep_state_adjust = &hif_dummy_target_sleep_state_adjust; diff --git a/hif/src/dispatcher/snoc_api.h b/hif/src/dispatcher/snoc_api.h index 813171f119dd..06fc43d5aefd 100644 --- a/hif/src/dispatcher/snoc_api.h +++ b/hif/src/dispatcher/snoc_api.h @@ -32,6 +32,7 @@ QDF_STATUS hif_snoc_open(struct hif_softc *hif_ctx, void hif_snoc_close(struct hif_softc *hif_ctx); int hif_snoc_bus_suspend(struct hif_softc *hif_ctx); int hif_snoc_bus_resume(struct hif_softc *hif_ctx); +int hif_snoc_bus_suspend_noirq(struct hif_softc *scn); void hif_snoc_disable_isr(struct hif_softc *hif_ctx); void hif_snoc_nointrs(struct hif_softc *scn); QDF_STATUS hif_snoc_enable_bus(struct hif_softc *ol_sc, diff --git a/hif/src/snoc/if_snoc.c b/hif/src/snoc/if_snoc.c index 77bc554936d7..201eb7c8fd8d 100644 --- a/hif/src/snoc/if_snoc.c +++ b/hif/src/snoc/if_snoc.c @@ -380,75 +380,6 @@ QDF_STATUS hif_snoc_setup_wakeup_sources(struct hif_softc *scn, bool enable) return QDF_STATUS_SUCCESS; } -/** - * __hif_snoc_irq_state_vote() - enable/disable all the ce interrupts - * @scn: hif context pointer - * @enble: true to enable the interrupts false to disable - * - * takes care of unwinding partial successes. - * - * Return: QDF_STATUS_SUCCESS on success - */ - -static QDF_STATUS __hif_snoc_irq_state_vote(struct hif_softc *scn, bool enable) -{ - int num_ce = scn->ce_count; - int ce_id = 0; - int irq; - - while (ce_id < num_ce) { - irq = icnss_get_irq(ce_id); - if (irq < 0) - goto error; - - if (enable) - enable_irq(irq); - else - disable_irq(irq); - - ce_id++; - } - - return QDF_STATUS_SUCCESS; - -error: - HIF_ERROR("%s: failed to map ce to irq", __func__); - - while (--ce_id >= 0) { - irq = icnss_get_irq(ce_id); - if (irq < 0) - continue; - - if (enable) - disable_irq(irq); - else - enable_irq(irq); - } - return QDF_STATUS_E_FAULT; -} - -/** - * hif_snoc_enable_irqs() - enable the ce irqs - * @scn: hif context - * - * Return: QDF_STATUS_SUCCESS on success - */ -static QDF_STATUS hif_snoc_enable_irqs(struct hif_softc *scn) -{ - return __hif_snoc_irq_state_vote(scn, true); -} - -/** - * hif_snoc_enable_irqs() - enable the ce irqs - * @scn: hif context - * - * Return: QDF_STATUS_SUCCESS on success - */ -static QDF_STATUS hif_snoc_disable_irqs(struct hif_softc *scn) -{ - return __hif_snoc_irq_state_vote(scn, false); -} - /** * hif_snoc_bus_suspend() - prepare to suspend the bus * @scn: hif context @@ -463,24 +394,8 @@ static QDF_STATUS hif_snoc_disable_irqs(struct hif_softc *scn) int hif_snoc_bus_suspend(struct hif_softc *scn) { if (hif_snoc_setup_wakeup_sources(scn, true) != QDF_STATUS_SUCCESS) - goto error; - - if (hif_snoc_disable_irqs(scn) != QDF_STATUS_SUCCESS) - goto wakeup_sources; - - if (hif_drain_tasklets(scn) != 0) - goto enable_irqs; + return -EFAULT; return 0; - -enable_irqs: - if (hif_snoc_enable_irqs(scn) != QDF_STATUS_SUCCESS) - QDF_BUG(0); -wakeup_sources: - if (hif_snoc_setup_wakeup_sources(scn, false) != QDF_STATUS_SUCCESS) - QDF_BUG(0); -error: - return -EFAULT; - } /** @@ -497,8 +412,22 @@ int hif_snoc_bus_resume(struct hif_softc *scn) if (hif_snoc_setup_wakeup_sources(scn, false) != QDF_STATUS_SUCCESS) QDF_BUG(0); - if (hif_snoc_enable_irqs(scn) != QDF_STATUS_SUCCESS) - QDF_BUG(0); - return 0; } + +/** + * hif_snoc_bus_suspend_noirq() - ensure there are no pending transactions + * @scn: hif context + * + * Ensure that if we recieved the wakeup message before the irq + * was disabled that the message is pocessed before suspending. + * + * Return: -EBUSY if we fail to flush the tasklets. + */ +int hif_snoc_bus_suspend_noirq(struct hif_softc *scn) +{ + if (hif_drain_tasklets(scn) != 0) + return -EBUSY; + return 0; +} +