From c31d10199c1898ebd171ad6dba3d9907ddfe1684 Mon Sep 17 00:00:00 2001 From: Ajit Pal Singh Date: Thu, 7 Jun 2018 19:47:22 +0530 Subject: [PATCH] qcacld-3.0: Credit Management changes for Genoa 1) Genoa FW by default enables HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET. When this flag is enabled, credits are reported through HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND and not through HTT_T2H_MSG_TYPE_TX_COMPL_IND. However when TSF and PTP features are enabled we need to get TX Completions from FW. Since credits can also be updated through TX Completions we need to disable updation of credits through TX Completion for Genoa. 2) Enable flag : cfg_ctx->tx_free_at_download to free ol tx descriptors at download. Change-Id: I176dc8391ded9fc57f8be2b465effd8ae84eda49 CRs-fixed: 2268757 --- core/dp/htt/htt.c | 13 ++++++++++++- core/dp/htt/htt_t2h.c | 3 ++- core/dp/htt/htt_types.h | 9 +++++++++ core/dp/ol/inc/ol_cfg.h | 19 ++++++++++++++++++- core/dp/txrx/ol_cfg.c | 25 ++++++++++++++++++++++++- core/dp/txrx/ol_tx.c | 6 ++++-- core/dp/txrx/ol_tx_send.c | 9 ++++++++- core/dp/txrx/ol_txrx.c | 11 +++++++++++ core/dp/txrx/ol_txrx_types.h | 2 ++ 9 files changed, 90 insertions(+), 7 deletions(-) diff --git a/core/dp/htt/htt.c b/core/dp/htt/htt.c index d3cf4607430f..7ade27d8ee01 100644 --- a/core/dp/htt/htt.c +++ b/core/dp/htt/htt.c @@ -422,6 +422,16 @@ htt_pdev_alloc(ol_txrx_pdev_handle txrx_pdev, /* for efficiency, store a local copy of the is_high_latency flag */ pdev->cfg.is_high_latency = ol_cfg_is_high_latency(pdev->ctrl_pdev); + /* + * Credit reporting through HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND + * enabled or not. + */ + pdev->cfg.credit_update_enabled = + ol_cfg_is_credit_update_enabled(pdev->ctrl_pdev); + + pdev->cfg.request_tx_comp = cds_is_ptp_rx_opt_enabled() || + cds_is_packet_log_enabled(); + pdev->cfg.default_tx_comp_req = !ol_cfg_tx_free_at_download(pdev->ctrl_pdev); @@ -522,7 +532,8 @@ htt_attach(struct htt_pdev_t *pdev, int desc_pool_size) */ pdev->download_len = 5000; - if (ol_cfg_tx_free_at_download(pdev->ctrl_pdev)) + if (ol_cfg_tx_free_at_download(pdev->ctrl_pdev) && + !pdev->cfg.request_tx_comp) pdev->tx_send_complete_part2 = ol_tx_download_done_hl_free; else diff --git a/core/dp/htt/htt_t2h.c b/core/dp/htt/htt_t2h.c index 9884674157aa..68414356b8dd 100644 --- a/core/dp/htt/htt_t2h.c +++ b/core/dp/htt/htt_t2h.c @@ -817,7 +817,8 @@ void htt_t2h_msg_handler(void *context, HTC_PACKET *pkt) } } - if (pdev->cfg.is_high_latency) { + if (pdev->cfg.is_high_latency && + !pdev->cfg.credit_update_enabled) { old_credit = qdf_atomic_read( &pdev->htt_tx_credit.target_delta); if (((old_credit + num_msdus) > MAX_TARGET_TX_CREDIT) || diff --git a/core/dp/htt/htt_types.h b/core/dp/htt/htt_types.h index 7d17d3116b35..da04fad77114 100644 --- a/core/dp/htt/htt_types.h +++ b/core/dp/htt/htt_types.h @@ -245,6 +245,15 @@ struct htt_pdev_t { int default_tx_comp_req; int ce_classify_enabled; uint8_t is_first_wakeup_packet; + /* + * To track if credit reporting through + * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND is enabled/disabled. + * In Genoa(QCN7605) credits are reported through + * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND only. + */ + u8 credit_update_enabled; + /* Explicitly request TX completions. */ + u8 request_tx_comp; } cfg; struct { uint8_t major; diff --git a/core/dp/ol/inc/ol_cfg.h b/core/dp/ol/inc/ol_cfg.h index 39342b0c137a..31438b62fc61 100644 --- a/core/dp/ol/inc/ol_cfg.h +++ b/core/dp/ol/inc/ol_cfg.h @@ -89,7 +89,13 @@ struct txrx_pdev_cfg_t { uint32_t tx_flow_start_queue_offset; #endif bool flow_steering_enabled; - + /* + * To track if credit reporting through + * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND is enabled/disabled. + * In Genoa(QCN7605) credits are reported through + * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND only. + */ + u8 credit_update_enabled; struct ol_tx_sched_wrr_ac_specs_t ac_specs[TX_WMM_AC_NUM]; }; @@ -137,6 +143,17 @@ struct cdp_cfg *ol_pdev_cfg_attach(qdf_device_t osdev, void *pcfg_param); */ int ol_cfg_is_high_latency(struct cdp_cfg *cfg_pdev); +/** + * @brief Specify whether credit reporting through + * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND is enabled by default. + * In Genoa credits are reported only through + * HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND + * @details + * @param pdev - handle to the physical device + * @return 1 -> enabled -OR- 0 -> disabled + */ +int ol_cfg_is_credit_update_enabled(struct cdp_cfg *cfg_pdev); + /** * @brief Specify the range of peer IDs. * @details diff --git a/core/dp/txrx/ol_cfg.c b/core/dp/txrx/ol_cfg.c index 9e2fce9ab146..6d798aa22a91 100644 --- a/core/dp/txrx/ol_cfg.c +++ b/core/dp/txrx/ol_cfg.c @@ -45,6 +45,22 @@ void ol_tx_set_flow_control_parameters(struct cdp_cfg *cfg_pdev, #ifdef CONFIG_HL_SUPPORT +#ifdef CONFIG_CREDIT_REP_THROUGH_CREDIT_UPDATE +static inline +void ol_pdev_cfg_credit_update(struct txrx_pdev_cfg_t *cfg_ctx) +{ + cfg_ctx->tx_free_at_download = 1; + cfg_ctx->credit_update_enabled = 1; +} +#else +static inline +void ol_pdev_cfg_credit_update(struct txrx_pdev_cfg_t *cfg_ctx) +{ + cfg_ctx->tx_free_at_download = 0; + cfg_ctx->credit_update_enabled = 0; +} +#endif /* CONFIG_CREDIT_REP_THROUGH_CREDIT_UPDATE */ + /** * ol_pdev_cfg_param_update() - assign download size of tx frame for txrx * pdev that will be used across datapath @@ -58,7 +74,7 @@ void ol_pdev_cfg_param_update(struct txrx_pdev_cfg_t *cfg_ctx) cfg_ctx->is_high_latency = 1; /* 802.1Q and SNAP / LLC headers are accounted for elsewhere */ cfg_ctx->tx_download_size = 1500; - cfg_ctx->tx_free_at_download = 0; + ol_pdev_cfg_credit_update(cfg_ctx); } #else @@ -165,6 +181,13 @@ int ol_cfg_is_high_latency(struct cdp_cfg *cfg_pdev) return cfg->is_high_latency; } +int ol_cfg_is_credit_update_enabled(struct cdp_cfg *cfg_pdev) +{ + struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev; + + return cfg->credit_update_enabled; +} + int ol_cfg_max_peer_id(struct cdp_cfg *cfg_pdev) { struct txrx_pdev_cfg_t *cfg = (struct txrx_pdev_cfg_t *)cfg_pdev; diff --git a/core/dp/txrx/ol_tx.c b/core/dp/txrx/ol_tx.c index 0c436953d3a3..e20a1954c118 100644 --- a/core/dp/txrx/ol_tx.c +++ b/core/dp/txrx/ol_tx.c @@ -1018,7 +1018,8 @@ qdf_nbuf_t ol_tx_hl(ol_txrx_vdev_handle vdev, qdf_nbuf_t msdu_list) { struct ol_txrx_pdev_t *pdev = vdev->pdev; - int tx_comp_req = pdev->cfg.default_tx_comp_req; + int tx_comp_req = pdev->cfg.default_tx_comp_req || + pdev->cfg.request_tx_comp; return ol_tx_hl_base(vdev, OL_TX_SPEC_STD, msdu_list, tx_comp_req); } @@ -1029,7 +1030,8 @@ ol_tx_non_std_hl(struct ol_txrx_vdev_t *vdev, qdf_nbuf_t msdu_list) { struct ol_txrx_pdev_t *pdev = vdev->pdev; - int tx_comp_req = pdev->cfg.default_tx_comp_req; + int tx_comp_req = pdev->cfg.default_tx_comp_req || + pdev->cfg.request_tx_comp; if (!tx_comp_req) { if ((tx_spec == OL_TX_SPEC_NO_FREE) && diff --git a/core/dp/txrx/ol_tx_send.c b/core/dp/txrx/ol_tx_send.c index c8e1b5b509a7..72fe7b078259 100644 --- a/core/dp/txrx/ol_tx_send.c +++ b/core/dp/txrx/ol_tx_send.c @@ -811,7 +811,14 @@ ol_tx_completion_handler(ol_txrx_pdev_handle pdev, qdf_nbuf_data_addr(netbuf), sizeof(qdf_nbuf_data(netbuf)), tx_desc->id, status)); htc_pm_runtime_put(pdev->htt_pdev->htc_pdev); - ol_tx_desc_update_group_credit(pdev, tx_desc_id, 1, 0, status); + /* + * If credits are reported through credit_update_ind then do not + * update group credits on tx_complete_ind. + */ + if (!pdev->cfg.credit_update_enabled) + ol_tx_desc_update_group_credit(pdev, + tx_desc_id, + 1, 0, status); /* Per SDU update of byte count */ byte_cnt += qdf_nbuf_len(netbuf); if (OL_TX_DESC_NO_REFS(tx_desc)) { diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index a554bd5cf999..12054d27b412 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/core/dp/txrx/ol_txrx.c @@ -1421,6 +1421,17 @@ ol_txrx_pdev_attach(ol_txrx_soc_handle soc, struct cdp_cfg *ctrl_pdev, /* init LL/HL cfg here */ pdev->cfg.is_high_latency = ol_cfg_is_high_latency(ctrl_pdev); + /* + * Credit reporting through HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND + * enabled or not. + */ + pdev->cfg.credit_update_enabled = + ol_cfg_is_credit_update_enabled(ctrl_pdev); + + /* Explicitly request TX Completions from FW */ + pdev->cfg.request_tx_comp = cds_is_ptp_rx_opt_enabled() || + cds_is_packet_log_enabled(); + pdev->cfg.default_tx_comp_req = !ol_cfg_tx_free_at_download(ctrl_pdev); /* store provided params */ diff --git a/core/dp/txrx/ol_txrx_types.h b/core/dp/txrx/ol_txrx_types.h index 96162572e687..ff038bde9ac4 100644 --- a/core/dp/txrx/ol_txrx_types.h +++ b/core/dp/txrx/ol_txrx_types.h @@ -608,6 +608,8 @@ struct ol_txrx_pdev_t { int host_addba; int ll_pause_txq_limit; int default_tx_comp_req; + u8 credit_update_enabled; + u8 request_tx_comp; } cfg; /* WDI subscriber's event list */