diff --git a/hif/src/ce/ce_assignment.h b/hif/src/ce/ce_assignment.h index bb75091eea..006e127f5e 100644 --- a/hif/src/ce/ce_assignment.h +++ b/hif/src/ce/ce_assignment.h @@ -231,6 +231,50 @@ static struct CE_attr host_ce_config_wlan_epping_poll[] = { { /* CE7 */ CE_ATTR_DIAG_FLAGS, 0, 2, DIAG_TRANSFER_LIMIT, 2, NULL,}, }; +#ifdef QCN7605_SUPPORT +static struct CE_attr host_ce_config_wlan_epping_irq[] = { + /* host->target HTC control and raw streams */ + { /* CE0 */ CE_ATTR_FLAGS, 0, 16, 2048, 0, NULL,}, + /* target->host EP-ping */ + { /* CE1 */ CE_ATTR_FLAGS, 0, 0, 2048, 32, NULL,}, + /* target->host EP-ping */ + { /* CE2 */ CE_ATTR_FLAGS, 0, 0, 2048, 32, NULL,}, + /* host->target EP-ping */ + { /* CE3 */ CE_ATTR_FLAGS, 0, 32, 2048, 0, NULL,}, + /* host->target EP-ping */ + { /* CE4 */ CE_ATTR_FLAGS, 0, 32, 2048, 0, NULL,}, + /* EP-ping heartbeat */ + { /* CE5 */ CE_ATTR_FLAGS, 0, 0, 2048, 16, NULL,}, + /* unused */ + { /* CE6 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL,}, + /* ce_diag, the Diagnostic Window */ + { /* CE7 */ CE_ATTR_DIAG_FLAGS, 0, 2, DIAG_TRANSFER_LIMIT, 2, NULL,}, +}; + +/* + * EP-ping firmware's CE configuration + */ +static struct CE_pipe_config target_ce_config_wlan_epping[] = { + /* host->target HTC control and raw streams */ + { /* CE0 */ 0, PIPEDIR_OUT, 16, 2048, CE_ATTR_FLAGS, 0,}, + /* target->host EP-ping */ + { /* CE1 */ 1, PIPEDIR_IN, 32, 2048, CE_ATTR_FLAGS, 0,}, + /* target->host EP-ping */ + { /* CE2 */ 2, PIPEDIR_IN, 32, 2048, CE_ATTR_FLAGS, 0,}, + /* host->target EP-ping */ + { /* CE3 */ 3, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0,}, + /* host->target EP-ping */ + { /* CE4 */ 4, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0,}, + /* EP-ping heartbeat */ + { /* CE5 */ 5, PIPEDIR_IN, 16, 2048, CE_ATTR_FLAGS, 0,}, + /* unused */ + { /* CE6 */ 6, PIPEDIR_INOUT, 0, 0, CE_ATTR_FLAGS, 0,}, + /* CE7 used only by Host */ + { /* CE7 */ 7, PIPEDIR_INOUT_H2H, 0, 0, 0, 0,}, + /* CE8 used only by IPA */ + { /* CE8 */ 8, PIPEDIR_IN, 4, 2048, CE_ATTR_FLAGS, 0,} +}; +#else static struct CE_attr host_ce_config_wlan_epping_irq[] = { /* host->target HTC control and raw streams */ { /* CE0 */ CE_ATTR_FLAGS, 0, 16, 2048, 0, NULL,}, @@ -273,6 +317,7 @@ static struct CE_pipe_config target_ce_config_wlan_epping[] = { { /* CE8 */ 8, PIPEDIR_IN, 32, 2048, CE_ATTR_FLAGS, 0,} }; #endif +#endif #else static struct CE_attr host_ce_config_wlan[] = { /* host->target HTC control and raw streams */ diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c index be818967d8..2ee20dd177 100644 --- a/hif/src/ce/ce_main.c +++ b/hif/src/ce/ce_main.c @@ -2669,46 +2669,15 @@ void hif_ce_stop(struct hif_softc *scn) hif_state->started = false; } -#ifdef QCN7605_SUPPORT -static inline -void hif_get_shadow_reg_cfg_qcn7605(struct shadow_reg_cfg - **target_shadow_reg_cfg_ret, - uint32_t *shadow_cfg_sz_ret) -{ - if (target_shadow_reg_cfg_ret) - *target_shadow_reg_cfg_ret = target_shadow_reg_cfg_map_qcn7605; - if (shadow_cfg_sz_ret) - *shadow_cfg_sz_ret = sizeof(target_shadow_reg_cfg_map_qcn7605); -} -#else -static inline -void hif_get_shadow_reg_cfg_qcn7605(struct shadow_reg_cfg - **target_shadow_reg_cfg_ret, - uint32_t *shadow_cfg_sz_ret) -{ - HIF_ERROR("QCN7605 not supported"); -} -#endif - static void hif_get_shadow_reg_cfg(struct hif_softc *scn, struct shadow_reg_cfg **target_shadow_reg_cfg_ret, uint32_t *shadow_cfg_sz_ret) { - struct hif_opaque_softc *hif_hdl = GET_HIF_OPAQUE_HDL(scn); - struct hif_target_info *tgt_info = hif_get_target_info_handle(hif_hdl); - - switch (tgt_info->target_type) { - case TARGET_TYPE_QCN7605: - hif_get_shadow_reg_cfg_qcn7605(target_shadow_reg_cfg_ret, - shadow_cfg_sz_ret); - break; - default: - if (target_shadow_reg_cfg_ret) - *target_shadow_reg_cfg_ret = target_shadow_reg_cfg; - if (shadow_cfg_sz_ret) - *shadow_cfg_sz_ret = shadow_cfg_sz; - } + if (target_shadow_reg_cfg_ret) + *target_shadow_reg_cfg_ret = target_shadow_reg_cfg; + if (shadow_cfg_sz_ret) + *shadow_cfg_sz_ret = shadow_cfg_sz; } /** @@ -3011,6 +2980,8 @@ void hif_set_ce_config_qcn7605(struct hif_softc *scn, hif_state->target_ce_config = target_ce_config_wlan_qcn7605; hif_state->target_ce_config_sz = sizeof(target_ce_config_wlan_qcn7605); + target_shadow_reg_cfg = target_shadow_reg_cfg_map_qcn7605; + shadow_cfg_sz = sizeof(target_shadow_reg_cfg_map_qcn7605); scn->ce_count = QCN7605_CE_COUNT; } #else @@ -3061,6 +3032,7 @@ void hif_ce_prepare_config(struct hif_softc *scn) /* if epping is enabled we need to use the epping configuration. */ if (QDF_IS_EPPING_ENABLED(mode)) { hif_ce_prepare_epping_config(hif_state); + return; } switch (tgt_info->target_type) { diff --git a/utils/epping/inc/epping_internal.h b/utils/epping/inc/epping_internal.h index bf058fe3c1..7b1e6e89de 100644 --- a/utils/epping/inc/epping_internal.h +++ b/utils/epping/inc/epping_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2019 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 @@ -177,7 +177,8 @@ void epping_refill(void *ctx, HTC_ENDPOINT_ID Endpoint); /* epping_txrx signatures */ epping_adapter_t *epping_add_adapter(epping_context_t *pEpping_ctx, tSirMacAddr macAddr, - enum QDF_OPMODE device_mode); + enum QDF_OPMODE device_mode, + bool rtnl_held); void epping_destroy_adapter(epping_adapter_t *adapter); int epping_connect_service(epping_context_t *pEpping_ctx); #ifdef HIF_PCI diff --git a/utils/epping/inc/epping_main.h b/utils/epping/inc/epping_main.h index ca631b8bc1..3c0f67da21 100644 --- a/utils/epping/inc/epping_main.h +++ b/utils/epping/inc/epping_main.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2019 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 @@ -37,19 +37,21 @@ int epping_open(void); void epping_close(void); void epping_disable(void); -int epping_enable(struct device *parent_dev); +int epping_enable(struct device *parent_dev, bool rtnl_held); +void epping_enable_adapter(void); #else static inline int epping_open(void) { return QDF_STATUS_E_INVAL; } -static inline int epping_enable(struct device *parent_dev) +static inline int epping_enable(struct device *parent_dev, bool rtnl_held) { return QDF_STATUS_E_INVAL; } static inline void epping_close(void) {} static inline void epping_disable(void) {} +static inline void epping_enable_adapter(void) {} #endif #endif /* end #ifndef EPPING_MAIN_H */ diff --git a/utils/epping/src/epping_main.c b/utils/epping/src/epping_main.c index cb73d633a9..ecd9a511e0 100644 --- a/utils/epping/src/epping_main.c +++ b/utils/epping/src/epping_main.c @@ -98,22 +98,17 @@ int epping_open(void) */ void epping_disable(void) { - epping_context_t *pEpping_ctx; + epping_context_t *epping_ctx; struct hif_opaque_softc *hif_ctx; HTC_HANDLE htc_handle; - pEpping_ctx = g_epping_ctx; - if (pEpping_ctx == NULL) { + epping_ctx = g_epping_ctx; + if (!epping_ctx) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, - "%s: error: pEpping_ctx = NULL", __func__); + "%s: error: epping_ctx = NULL", __func__); return; } - if (pEpping_ctx->epping_adapter) { - epping_destroy_adapter(pEpping_ctx->epping_adapter); - pEpping_ctx->epping_adapter = NULL; - } - hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); if (hif_ctx == NULL) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, @@ -130,8 +125,13 @@ void epping_disable(void) return; } htc_stop(htc_handle); - epping_cookie_cleanup(pEpping_ctx); + epping_cookie_cleanup(epping_ctx); htc_destroy(htc_handle); + + if (epping_ctx->epping_adapter) { + epping_destroy_adapter(epping_ctx->epping_adapter); + epping_ctx->epping_adapter = NULL; + } } /** @@ -145,7 +145,6 @@ void epping_close(void) { epping_context_t *to_free; - if (g_epping_ctx == NULL) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: error: g_epping_ctx = NULL", __func__); @@ -173,6 +172,7 @@ static void epping_target_suspend_acknowledge(void *context, bool wow_nack) g_epping_ctx->wow_nack = wow_nack; } +#ifdef WLAN_FEATURE_BMI /** * epping_update_ol_config - API to update ol configuration parameters * @@ -194,6 +194,39 @@ static void epping_update_ol_config(void) ol_init_ini_config(ol_ctx, &cfg); } + +static +QDF_STATUS epping_bmi_download_fw(struct ol_context *ol_ctx) +{ + ol_ctx = cds_get_context(QDF_MODULE_ID_BMI); + if (!ol_ctx) { + QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, + "%s: ol_ctx is NULL", __func__); + return QDF_STATUS_E_INVAL; + } + + epping_update_ol_config(); + + /* Initialize BMI and Download firmware */ + if (bmi_download_firmware(ol_ctx)) { + QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, + "%s: BMI failed to download target", __func__); + bmi_cleanup(ol_ctx); + return QDF_STATUS_E_INVAL; + } + + EPPING_LOG(QDF_TRACE_LEVEL_INFO_HIGH, + "%s: bmi_download_firmware done", __func__); + return QDF_STATUS_SUCCESS; +} +#else +static +QDF_STATUS epping_bmi_download_fw(struct ol_context *ol_ctx) +{ + return QDF_STATUS_SUCCESS; +} +#endif + /** * epping_enable(): End point ping driver enable Function * @@ -202,17 +235,17 @@ static void epping_update_ol_config(void) * * return - 0 : success, negative: error */ -int epping_enable(struct device *parent_dev) +int epping_enable(struct device *parent_dev, bool rtnl_held) { int ret = 0; - epping_context_t *pEpping_ctx = NULL; + epping_context_t *epping_ctx = NULL; struct cds_context *p_cds_context = NULL; qdf_device_t qdf_ctx; - struct htc_init_info htcInfo; + struct htc_init_info htc_info; struct hif_opaque_softc *scn; tSirMacAddr adapter_macAddr; + struct ol_context *ol_ctx = NULL; struct hif_target_info *tgt_info; - struct ol_context *ol_ctx; EPPING_LOG(QDF_TRACE_LEVEL_INFO_HIGH, "%s: Enter", __func__); @@ -225,14 +258,14 @@ int epping_enable(struct device *parent_dev) return ret; } - pEpping_ctx = g_epping_ctx; - if (pEpping_ctx == NULL) { + epping_ctx = g_epping_ctx; + if (!epping_ctx) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, - "%s: Failed to get pEpping_ctx", __func__); + "%s: Failed to get epping_ctx", __func__); ret = -1; return ret; } - pEpping_ctx->parent_dev = (void *)parent_dev; + epping_ctx->parent_dev = (void *)parent_dev; epping_get_dummy_mac_addr(adapter_macAddr); /* Initialize the timer module */ @@ -247,36 +280,19 @@ int epping_enable(struct device *parent_dev) tgt_info = hif_get_target_info_handle(scn); + if (epping_bmi_download_fw(ol_ctx) != QDF_STATUS_SUCCESS) + return A_ERROR; + /* store target type and target version info in hdd ctx */ - pEpping_ctx->target_type = tgt_info->target_type; + epping_ctx->target_type = tgt_info->target_type; - ol_ctx = cds_get_context(QDF_MODULE_ID_BMI); - if (!ol_ctx) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, - "%s: ol_ctx is NULL", __func__); - return A_ERROR; - } - - epping_update_ol_config(); -#ifndef FEATURE_BMI_2 - /* Initialize BMI and Download firmware */ - if (bmi_download_firmware(ol_ctx)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, - "%s: BMI failed to download target", __func__); - bmi_cleanup(ol_ctx); - return A_ERROR; - } -#endif - EPPING_LOG(QDF_TRACE_LEVEL_INFO_HIGH, - "%s: bmi_download_firmware done", __func__); - - htcInfo.pContext = ol_ctx; - htcInfo.TargetFailure = ol_target_failure; - htcInfo.TargetSendSuspendComplete = epping_target_suspend_acknowledge; + htc_info.pContext = NULL; + htc_info.TargetFailure = ol_target_failure; + htc_info.TargetSendSuspendComplete = epping_target_suspend_acknowledge; qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); /* Create HTC */ - p_cds_context->htc_ctx = htc_create(scn, &htcInfo, qdf_ctx, + p_cds_context->htc_ctx = htc_create(scn, &htc_info, qdf_ctx, cds_get_conparam()); if (!p_cds_context->htc_ctx) { QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, @@ -284,9 +300,9 @@ int epping_enable(struct device *parent_dev) bmi_cleanup(ol_ctx); return A_ERROR; } - pEpping_ctx->HTCHandle = + epping_ctx->HTCHandle = cds_get_context(QDF_MODULE_ID_HTC); - if (pEpping_ctx->HTCHandle == NULL) { + if (!epping_ctx->HTCHandle) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: HTCHandle is NULL", __func__); return A_ERROR; @@ -299,36 +315,31 @@ int epping_enable(struct device *parent_dev) } /* start HIF */ - if (htc_wait_target(pEpping_ctx->HTCHandle) != QDF_STATUS_SUCCESS) { + if (htc_wait_target(epping_ctx->HTCHandle) != QDF_STATUS_SUCCESS) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: htc_wait_target error", __func__); goto error_end; } EPPING_LOG(QDF_TRACE_LEVEL_INFO_HIGH, "%s: HTC ready", __func__); - ret = epping_connect_service(pEpping_ctx); + ret = epping_connect_service(epping_ctx); if (ret != 0) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: htc_wait_targetdone", __func__); goto error_end; } - if (htc_start(pEpping_ctx->HTCHandle) != QDF_STATUS_SUCCESS) { + if (htc_start(epping_ctx->HTCHandle) != QDF_STATUS_SUCCESS) goto error_end; - } + EPPING_LOG(QDF_TRACE_LEVEL_INFO_HIGH, "%s: HTC started", __func__); /* init the tx cookie resource */ - ret = epping_cookie_init(pEpping_ctx); - if (ret == 0) { - pEpping_ctx->epping_adapter = epping_add_adapter(pEpping_ctx, - adapter_macAddr, - QDF_STA_MODE); - } - if (ret < 0 || pEpping_ctx->epping_adapter == NULL) { + ret = epping_cookie_init(epping_ctx); + if (ret < 0) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, - "%s: epping_add_adaptererror error", __func__); - htc_stop(pEpping_ctx->HTCHandle); - epping_cookie_cleanup(pEpping_ctx); + "%s: cookie init failed", __func__); + htc_stop(epping_ctx->HTCHandle); + epping_cookie_cleanup(epping_ctx); goto error_end; } @@ -341,4 +352,22 @@ error_end: bmi_cleanup(ol_ctx); return A_ERROR; } + +void epping_enable_adapter(void) +{ + epping_context_t *epping_ctx = g_epping_ctx; + tSirMacAddr adapter_macaddr; + + if (!epping_ctx) { + EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "epping context is NULL"); + return; + } + + epping_get_dummy_mac_addr(adapter_macaddr); + epping_ctx->epping_adapter = epping_add_adapter(epping_ctx, + adapter_macaddr, + QDF_STA_MODE, true); + if (!epping_ctx->epping_adapter) + EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "epping add adapter failed"); +} #endif diff --git a/utils/epping/src/epping_txrx.c b/utils/epping/src/epping_txrx.c index fd71a433e0..b72350f60f 100644 --- a/utils/epping/src/epping_txrx.c +++ b/utils/epping/src/epping_txrx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2019 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 @@ -149,6 +149,7 @@ static netdev_tx_t epping_hard_start_xmit(struct sk_buff *skb, ret = -ENODEV; goto end; } + qdf_net_buf_debug_acquire_skb(skb, __FILE__, __LINE__); ret = epping_tx_send(skb, adapter); end: return NETDEV_TX_OK; @@ -268,11 +269,14 @@ static int epping_start_adapter(epping_adapter_t *adapter) return 0; } -static int epping_register_adapter(epping_adapter_t *adapter) +static int epping_register_adapter(epping_adapter_t *adapter, bool rtnl_held) { int ret = 0; - ret = register_netdev(adapter->dev); + if (!rtnl_held) + ret = register_netdev(adapter->dev); + else + ret = register_netdevice(adapter->dev); if (ret != 0) { EPPING_LOG(QDF_TRACE_LEVEL_FATAL, "%s: unable to register device\n", @@ -348,7 +352,8 @@ static struct net_device_ops epping_drv_ops = { epping_adapter_t *epping_add_adapter(epping_context_t *pEpping_ctx, tSirMacAddr macAddr, - enum QDF_OPMODE device_mode) + enum QDF_OPMODE device_mode, + bool rtnl_held) { struct net_device *dev; epping_adapter_t *adapter; @@ -378,10 +383,11 @@ epping_adapter_t *epping_add_adapter(epping_context_t *pEpping_ctx, qdf_timer_init(epping_get_qdf_ctx(), &adapter->epping_timer, epping_timer_expire, dev, QDF_TIMER_TYPE_SW); dev->type = ARPHRD_IEEE80211; + dev->needed_headroom += 24; dev->netdev_ops = &epping_drv_ops; dev->watchdog_timeo = 5 * HZ; /* XXX */ dev->tx_queue_len = EPPING_TXBUF - 1; /* 1 for mgmt frame */ - if (epping_register_adapter(adapter) == 0) { + if (epping_register_adapter(adapter, rtnl_held) == 0) { EPPING_LOG(LOG1, FL("Disabling queues")); netif_tx_disable(dev); netif_carrier_off(dev); @@ -413,7 +419,7 @@ int epping_connect_service(epping_context_t *pEpping_ctx) connect.EpCallbacks.EpRecvRefill = epping_refill; connect.EpCallbacks.EpSendFull = epping_tx_queue_full /* ar6000_tx_queue_full */; -#elif defined(HIF_USB) || defined(HIF_PCI) +#elif defined(HIF_USB) || defined(HIF_PCI) || defined(HIF_SNOC) connect.EpCallbacks.EpRecvRefill = NULL /* provided by HIF */; connect.EpCallbacks.EpSendFull = NULL /* provided by HIF */; /* disable flow control for hw flow control */ @@ -434,7 +440,7 @@ int epping_connect_service(epping_context_t *pEpping_ctx) } pEpping_ctx->EppingEndpoint[0] = response.Endpoint; -#if defined(HIF_PCI) || defined(HIF_USB) +#if defined(HIF_PCI) || defined(HIF_USB) || defined(HIF_SNOC) connect.service_id = WMI_DATA_BK_SVC; status = htc_connect_service(pEpping_ctx->HTCHandle, &connect, &response); if (status != EOK) {