From 5a02b1f0531ec5b5bf68ea7566c8143097c1a9c2 Mon Sep 17 00:00:00 2001 From: Venkata Sharath Chandra Manchala Date: Mon, 10 Jul 2017 11:59:54 -0700 Subject: [PATCH] qcacmn: Propagate config parameters to datapath Provide an API to accept the config parameters from the upper layer and store them in wlan_cfg_ctx. Enable/Disable the datapath features based on these parameters. Change-Id: I9336cac686bfb875cea242685a122ec98acdf8c2 CRs-Fixed: 2097229 --- dp/inc/cdp_txrx_cmn.h | 22 +++++- dp/inc/cdp_txrx_cmn_struct.h | 22 ++++++ dp/inc/cdp_txrx_ops.h | 2 + dp/wifi3.0/dp_main.c | 139 +++++++++++++++++++++++++++-------- wlan_cfg/wlan_cfg.c | 20 +---- wlan_cfg/wlan_cfg.h | 13 +++- 6 files changed, 163 insertions(+), 55 deletions(-) diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index 58f96d8bdb..95aa5416d4 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -100,7 +100,7 @@ static inline struct cdp_pdev *cdp_pdev_attach { if (soc->ops->cmn_drv_ops->txrx_pdev_attach) return soc->ops->cmn_drv_ops->txrx_pdev_attach(soc, ctrl_pdev, - htc_pdev, osdev, pdev_id); + htc_pdev, osdev, pdev_id); return NULL; } @@ -559,4 +559,24 @@ static inline int cdp_set_pn_check(ol_txrx_soc_handle soc, return 0; } +/** + * cdp_update_config_parameters(): function to propagate configuration + * parameters to datapath + * @soc: opaque soc handle + * @cfg: configuration handle + * + * Return: status: 0 - Success, non-zero: Failure + */ +static inline +QDF_STATUS cdp_update_config_parameters(ol_txrx_soc_handle soc, + struct cdp_config_params *cfg) +{ + struct cdp_soc *psoc = (struct cdp_soc *)soc; + + if (soc->ops->cmn_drv_ops->update_config_parameters) + return soc->ops->cmn_drv_ops->update_config_parameters(psoc, + cfg); + + return QDF_STATUS_SUCCESS; +} #endif /* _CDP_TXRX_CMN_H_ */ diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index 358dbd0fce..3a6efe49c8 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -1166,4 +1166,26 @@ struct cdp_rx_indication_msdu { resvd1:19; struct cdp_rate_stats extd; }; + +/** + * struct cdp_config_params - Propagate configuration parameters to datapath + * @tso_enable: Enable/Disable TSO + * @lro_enable: Enable/Disable LRO + * @flow_steering_enable: Enable/Disable Rx Hash + * @tcp_Udp_ChecksumOffload: Enable/Disable tcp-Udp checksum Offload + * @napi_enable: Enable/Disable Napi + * @tx_flow_stop_queue_threshold: Value to Pause tx queues + * @tx_flow_start_queue_offset: Available Tx descriptors to unpause + * tx queue + */ +struct cdp_config_params { + unsigned int tso_enable:1; + unsigned int lro_enable:1; + unsigned int flow_steering_enable:1; + unsigned int tcp_udp_checksumoffload:1; + unsigned int napi_enable:1; + /* Set when QCA_LL_TX_FLOW_CONTROL_V2 is enabled */ + uint8_t tx_flow_stop_queue_threshold; + uint8_t tx_flow_start_queue_offset; +}; #endif diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 6d3ac355af..e78b05d0a7 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -213,6 +213,8 @@ struct cdp_cmn_ops { void (*set_pn_check)(struct cdp_vdev *vdev, struct cdp_peer *peer_handle, enum cdp_sec_type sec_type, uint32_t *rx_pn); + QDF_STATUS (*update_config_parameters)(struct cdp_soc *psoc, + struct cdp_config_params *params); }; struct cdp_ctrl_ops { diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 0c81a74e69..851d79b0ca 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -961,38 +961,6 @@ static QDF_STATUS dp_soc_interrupt_attach_poll(void *txrx_soc) return QDF_STATUS_SUCCESS; } - -#ifdef CONFIG_MCL -extern int con_mode_monitor; -static QDF_STATUS dp_soc_interrupt_attach(void *txrx_soc); - -/* - * dp_soc_interrupt_attach_wrapper() - Register handlers for DP interrupts - * @txrx_soc: DP SOC handle - * - * Call the appropriate attach function based on the mode of operation. - * This is a WAR for enabling monitor mode. - * - * Return: 0 for success. nonzero for failure. - */ -static QDF_STATUS dp_soc_interrupt_attach_wrapper(void *txrx_soc) -{ - if (con_mode_monitor == QDF_GLOBAL_MONITOR_MODE) { - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, - FL("Attach interrupts in Poll mode")); - return dp_soc_interrupt_attach_poll(txrx_soc); - } else { - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, - FL("Attach interrupts in MSI mode")); - return dp_soc_interrupt_attach(txrx_soc); - } -} -#else -static QDF_STATUS dp_soc_interrupt_attach_wrapper(void *txrx_soc) -{ - return dp_soc_interrupt_attach_poll(txrx_soc); -} -#endif #endif static void dp_soc_interrupt_map_calculate_integrated(struct dp_soc *soc, @@ -1167,6 +1135,42 @@ static QDF_STATUS dp_soc_interrupt_attach(void *txrx_soc) return QDF_STATUS_SUCCESS; } + +#ifdef CONFIG_MCL +extern int con_mode_monitor; + +/* + * dp_soc_interrupt_attach_wrapper() - Register handlers for DP interrupts + * @txrx_soc: DP SOC handle + * + * Call the appropriate attach function based on the mode of operation. + * This is a WAR for enabling monitor mode. + * + * Return: 0 for success. nonzero for failure. + */ +static QDF_STATUS dp_soc_interrupt_attach_wrapper(void *txrx_soc) +{ + struct dp_soc *soc = (struct dp_soc *)txrx_soc; + + if (!(soc->wlan_cfg_ctx->napi_enabled) || + con_mode_monitor == QDF_GLOBAL_MONITOR_MODE) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, + "%s: Poll mode", __func__); + return dp_soc_interrupt_attach_poll(txrx_soc); + } else { + + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, + "%s: Interrupt mode", __func__); + return dp_soc_interrupt_attach(txrx_soc); + } +} +#else +static QDF_STATUS dp_soc_interrupt_attach_wrapper(void *txrx_soc) +{ + return dp_soc_interrupt_attach_poll(txrx_soc); +} +#endif + /* * dp_soc_interrupt_detach() - Deregister any allocations done for interrupts * @txrx_soc: DP SOC handle @@ -3741,6 +3745,7 @@ void dp_aggregate_vdev_stats(struct dp_vdev *vdev) if (soc->cdp_soc.ol_ops->update_dp_stats) soc->cdp_soc.ol_ops->update_dp_stats(vdev->pdev->osif_pdev, &vdev->stats, vdev->vdev_id, UPDATE_VDEV_STATS); + } /** @@ -5029,6 +5034,17 @@ static void dp_txrx_path_stats(struct dp_soc *soc) pdev->stats.rx_ind_histogram.pkts_101_200); DP_TRACE(FATAL, " 201+ Packets: %u", pdev->stats.rx_ind_histogram.pkts_201_plus); + + DP_TRACE_STATS(ERROR, "%s: tso_enable: %u lro_enable: %u rx_hash: %u napi_enable: %u", + __func__, + pdev->soc->wlan_cfg_ctx->tso_enabled, + pdev->soc->wlan_cfg_ctx->lro_enabled, + pdev->soc->wlan_cfg_ctx->rx_hash, + pdev->soc->wlan_cfg_ctx->napi_enabled); + DP_TRACE_STATS(ERROR, "%s: Tx flow stop queue: %u tx flow start queue offset: %u", + __func__, + pdev->soc->wlan_cfg_ctx->tx_flow_stop_queue_threshold, + pdev->soc->wlan_cfg_ctx->tx_flow_start_queue_offset); } } @@ -5082,6 +5098,64 @@ static QDF_STATUS dp_txrx_dump_stats(void *psoc, uint16_t value) } +#ifdef QCA_LL_TX_FLOW_CONTROL_V2 +/** + * dp_update_flow_control_parameters() - API to store datapath + * config parameters + * @soc: soc handle + * @cfg: ini parameter handle + * + * Return: void + */ +static inline +void dp_update_flow_control_parameters(struct dp_soc *soc, + struct cdp_config_params *params) +{ + soc->wlan_cfg_ctx->tx_flow_stop_queue_threshold = + params->tx_flow_stop_queue_threshold; + soc->wlan_cfg_ctx->tx_flow_start_queue_offset = + params->tx_flow_start_queue_offset; +} +#else +static inline +void dp_update_flow_control_parameters(struct dp_soc *soc, + struct cdp_config_params *params) +{ +} +#endif + +/** + * dp_update_config_parameters() - API to store datapath + * config parameters + * @soc: soc handle + * @cfg: ini parameter handle + * + * Return: status + */ +static +QDF_STATUS dp_update_config_parameters(struct cdp_soc *psoc, + struct cdp_config_params *params) +{ + struct dp_soc *soc = (struct dp_soc *)psoc; + + if (!(soc)) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR, + "%s: Invalid handle", __func__); + return QDF_STATUS_E_INVAL; + } + + soc->wlan_cfg_ctx->tso_enabled = params->tso_enable; + soc->wlan_cfg_ctx->lro_enabled = params->lro_enable; + soc->wlan_cfg_ctx->rx_hash = params->flow_steering_enable; + soc->wlan_cfg_ctx->tcp_udp_checksumoffload = + params->tcp_udp_checksumoffload; + soc->wlan_cfg_ctx->napi_enabled = params->napi_enable; + + dp_update_flow_control_parameters(soc, params); + + return QDF_STATUS_SUCCESS; +} + static struct cdp_wds_ops dp_ops_wds = { .vdev_set_wds = dp_vdev_set_wds, }; @@ -5167,6 +5241,7 @@ static struct cdp_cmn_ops dp_ops_cmn = { #endif .txrx_intr_detach = dp_soc_interrupt_detach, .set_pn_check = dp_set_pn_check_wifi3, + .update_config_parameters = dp_update_config_parameters, /* TODO: Add other functions */ }; diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index 56b258a1b0..511945c604 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -181,11 +181,6 @@ #define WLAN_CFG_HTT_PKT_TYPE 2 #define WLAN_CFG_MAX_PEER_ID 64 -#ifdef WLAN_RX_HASH -#define WLAN_RX_HASH_ENABLE 1 -#else -#define WLAN_RX_HASH_ENABLE 0 -#endif #ifdef CONFIG_MCL static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { @@ -329,9 +324,6 @@ struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach() rxdma2host_ring_mask[i]; } - wlan_cfg_ctx->rx_hash = WLAN_RX_HASH_ENABLE; - wlan_cfg_ctx->lro_enabled = WLAN_LRO_ENABLE; - /* This is default mapping and can be overridden by HW config * received from FW */ wlan_cfg_set_hw_macid(wlan_cfg_ctx, 0, 1); @@ -675,12 +667,7 @@ int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg) */ int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg) { -#ifdef QCA_WIFI_NAPIER_EMULATION - /* TODO remove this hack when INI hookup is ready */ - return 15; -#else - return cfg->tx_flow_stop_queue_th; -#endif + return cfg->tx_flow_stop_queue_threshold; } /** @@ -692,11 +679,6 @@ int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg) */ int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg) { -#ifdef QCA_WIFI_NAPIER_EMULATION - /* TODO remove this hack when INI hookup is ready */ - return 10; -#else return cfg->tx_flow_start_queue_offset; -#endif } #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */ diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index 34c8baaf64..d28c301ff4 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -62,6 +62,7 @@ #define DP_NON_QOS_TID 16 struct wlan_cfg_dp_pdev_ctxt; + /** * struct wlan_cfg_dp_soc_ctxt - Configuration parameters for SoC (core TxRx) * @num_int_ctxts - Number of NAPI/Interrupt contexts to be registered for DP @@ -90,8 +91,11 @@ struct wlan_cfg_dp_pdev_ctxt; * @int_reo_status_ring_mask - Bitmap of reo status ring interrupts mapped to each * NAPI/Intr context * @int_ce_ring_mask - Bitmap of CE interrupts mapped to each NAPI/Intr context - * @lro_enabled - is LRO enabled + * @lro_enabled - enable/disable lro feature * @rx_hash - Enable hash based steering of rx packets + * @tso_enabled - enable/disable tso feature + * @napi_enabled - enable/disable interrupt mode for reaping tx and rx packets + * @tcp_Udp_Checksumoffload - enable/disable checksum offload * @nss_cfg - nss configuration */ struct wlan_cfg_dp_soc_ctxt { @@ -128,10 +132,13 @@ struct wlan_cfg_dp_soc_ctxt { int base_hw_macid; bool lro_enabled; bool rx_hash; + bool tso_enabled; + bool napi_enabled; + bool tcp_udp_checksumoffload; int nss_cfg; #ifdef QCA_LL_TX_FLOW_CONTROL_V2 - int tx_flow_stop_queue_th; - int tx_flow_start_queue_offset; + uint32_t tx_flow_stop_queue_threshold; + uint32_t tx_flow_start_queue_offset; #endif };