From a4f6e173c1516f7cac4b3f523054e72f6ff125e1 Mon Sep 17 00:00:00 2001 From: Akshay Kosigi Date: Mon, 3 Sep 2018 21:42:27 +0530 Subject: [PATCH] qcacmn: Replace target related feature values with INI parameters Introduce INI parameters to fetch feature related values based on target type and add CDP interface to get dp INI parameters to control path Change-Id: Id6a3f409106eb7dc01b08a3f1ec00dbe7efc359f --- dp/inc/cdp_txrx_cmn.h | 16 +++++++++++++++ dp/inc/cdp_txrx_cmn_struct.h | 14 +++++++++++++ dp/inc/cdp_txrx_ops.h | 3 +++ dp/wifi3.0/dp_main.c | 17 +++++++++++++++ wlan_cfg/cfg_dp.h | 40 +++++++++++++++++++++++++++++++----- wlan_cfg/wlan_cfg.c | 36 +++++++++++++++++++++++++++++++- wlan_cfg/wlan_cfg.h | 19 ++++++++++++++++- 7 files changed, 138 insertions(+), 7 deletions(-) diff --git a/dp/inc/cdp_txrx_cmn.h b/dp/inc/cdp_txrx_cmn.h index a448e230b6ea..1cc7e45c5fcc 100644 --- a/dp/inc/cdp_txrx_cmn.h +++ b/dp/inc/cdp_txrx_cmn.h @@ -1853,6 +1853,22 @@ cdp_txrx_classify_and_update(ol_txrx_soc_handle soc, dir, nbuf_class); } +/** + * cdp_get_dp_capabilities() - get DP capabilities + * @soc: opaque soc handle + * @dp_cap: enum of DP capabilities + * + * Return: bool + */ +static inline bool +cdp_get_dp_capabilities(struct cdp_soc_t *soc, enum cdp_capabilities dp_caps) +{ + if (soc && soc->ops && soc->ops->cmn_drv_ops && + soc->ops->cmn_drv_ops->get_dp_capabilities) + return soc->ops->cmn_drv_ops->get_dp_capabilities(soc, dp_caps); + return false; +} + #ifdef RECEIVE_OFFLOAD /** * cdp_register_rx_offld_flush_cb() - register LRO/GRO flush cb function pointer diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index c532b8a447d1..5c170d3f86ce 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -371,6 +371,20 @@ enum txrx_direction { tx_direction = 0, }; +/** + * cdp_capabilities- DP capabilities + */ +enum cdp_capabilities { + CDP_CFG_DP_TSO, + CDP_CFG_DP_LRO, + CDP_CFG_DP_SG, + CDP_CFG_DP_GRO, + CDP_CFG_DP_OL_TX_CSUM, + CDP_CFG_DP_OL_RX_CSUM, + CDP_CFG_DP_RAWMODE, + CDP_CFG_DP_PEER_FLOW_CTRL, +}; + /** * ol_txrx_nbuf_classify - Packet classification object * @peer_id: unique peer identifier from fw diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 6a4a77cf2a6a..4edd627bb399 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -366,6 +366,9 @@ struct cdp_cmn_ops { int (*txrx_classify_update) (struct cdp_vdev *vdev, qdf_nbuf_t skb, enum txrx_direction, struct ol_txrx_nbuf_classify *nbuf_class); + + bool (*get_dp_capabilities)(struct cdp_soc_t *soc, + enum cdp_capabilities dp_caps); }; struct cdp_ctrl_ops { diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 715ecc4b80dc..c0ff288f43c5 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -7670,6 +7670,22 @@ dp_soc_set_dp_txrx_handle(struct cdp_soc *soc_handle, void *txrx_handle) soc->external_txrx_handle = txrx_handle; } +/** + * dp_get_cfg_capabilities() - get dp capabilities + * @soc_handle: datapath soc handle + * @dp_caps: enum for dp capabilities + * + * Return: bool to determine if dp caps is enabled + */ +static bool +dp_get_cfg_capabilities(struct cdp_soc_t *soc_handle, + enum cdp_capabilities dp_caps) +{ + struct dp_soc *soc = (struct dp_soc *)soc_handle; + + return wlan_cfg_get_dp_caps(soc->wlan_cfg_ctx, dp_caps); +} + #ifdef FEATURE_AST static void dp_peer_teardown_wifi3(struct cdp_vdev *vdev_hdl, void *peer_hdl) { @@ -7868,6 +7884,7 @@ static struct cdp_cmn_ops dp_ops_cmn = { .txrx_get_os_rx_handles_from_vdev = dp_get_os_rx_handles_from_vdev_wifi3, .delba_tx_completion = dp_delba_tx_completion_wifi3, + .get_dp_capabilities = dp_get_cfg_capabilities, }; static struct cdp_ctrl_ops dp_ops_ctrl = { diff --git a/wlan_cfg/cfg_dp.h b/wlan_cfg/cfg_dp.h index 325409890d58..f0c97ebc0fdc 100644 --- a/wlan_cfg/cfg_dp.h +++ b/wlan_cfg/cfg_dp.h @@ -426,10 +426,6 @@ 0, 1, 1, \ CFG_VALUE_OR_DEFAULT, "DP Base HW Mac ID") -#define CFG_DP_LRO \ - CFG_INI_BOOL("LROEnable", WLAN_LRO_ENABLE, \ - "DP LRO Enable") - #define CFG_DP_RX_HASH \ CFG_INI_BOOL("dp_rx_hash", true, \ "DP Rx Hash") @@ -438,6 +434,34 @@ CFG_INI_BOOL("TSOEnable", false, \ "DP TSO Enabled") +#define CFG_DP_LRO \ + CFG_INI_BOOL("LROEnable", WLAN_LRO_ENABLE, \ + "DP LRO Enable") + +#define CFG_DP_SG \ + CFG_INI_BOOL("dp_sg_support", false, \ + "DP SG Enable") + +#define CFG_DP_GRO \ + CFG_INI_BOOL("GROEnable", false, \ + "DP GRO Enable") + +#define CFG_DP_OL_TX_CSUM \ + CFG_INI_BOOL("dp_offload_tx_csum_support", false, \ + "DP tx csum Enable") + +#define CFG_DP_OL_RX_CSUM \ + CFG_INI_BOOL("dp_offload_rx_csum_support", false, \ + "DP rx csum Enable") + +#define CFG_DP_RAWMODE \ + CFG_INI_BOOL("dp_rawmode_support", false, \ + "DP rawmode Enable") + +#define CFG_DP_PEER_FLOW_CTRL \ + CFG_INI_BOOL("dp_peer_flow_control_support", false, \ + "DP peer flow ctrl Enable") + #define CFG_DP_NAPI \ CFG_INI_BOOL("dp_napi_enabled", MCL_OR_WIN_VALUE(true, false), \ "DP Napi Enabled") @@ -579,9 +603,15 @@ CFG(CFG_DP_NSS_COMP_RING_SIZE) \ CFG(CFG_DP_PDEV_LMAC_RING) \ CFG(CFG_DP_BASE_HW_MAC_ID) \ - CFG(CFG_DP_LRO) \ CFG(CFG_DP_RX_HASH) \ CFG(CFG_DP_TSO) \ + CFG(CFG_DP_LRO) \ + CFG(CFG_DP_SG) \ + CFG(CFG_DP_GRO) \ + CFG(CFG_DP_OL_TX_CSUM) \ + CFG(CFG_DP_OL_RX_CSUM) \ + CFG(CFG_DP_RAWMODE) \ + CFG(CFG_DP_PEER_FLOW_CTRL) \ CFG(CFG_DP_NAPI) \ CFG(CFG_DP_TCP_UDP_CKSUM_OFFLOAD) \ CFG(CFG_DP_DEFRAG_TIMEOUT_CHECK) \ diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index 2fdcb206631b..d4aa81ac2cbd 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -24,6 +24,7 @@ #include "qdf_trace.h" #include "qdf_mem.h" +#include #include "wlan_cfg.h" #include "cfg_ucfg_api.h" @@ -273,9 +274,16 @@ struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach(void *psoc) wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID); - wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO); wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH); wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO); + wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO); + wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG); + wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO); + wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM); + wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM); + wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE); + wlan_cfg_ctx->peer_flow_ctrl_enabled = + cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL); wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI); /*Enable checksum offload by default*/ wlan_cfg_ctx->tcp_udp_checksumoffload = @@ -780,6 +788,32 @@ wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) return cfg->rxdma_err_dst_ring; } +bool +wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg, + enum cdp_capabilities dp_caps) +{ + switch (dp_caps) { + case CDP_CFG_DP_TSO: + return cfg->tso_enabled; + case CDP_CFG_DP_LRO: + return cfg->lro_enabled; + case CDP_CFG_DP_SG: + return cfg->sg_enabled; + case CDP_CFG_DP_GRO: + return cfg->gro_enabled; + case CDP_CFG_DP_OL_TX_CSUM: + return cfg->ol_tx_csum_enabled; + case CDP_CFG_DP_OL_RX_CSUM: + return cfg->ol_rx_csum_enabled; + case CDP_CFG_DP_RAWMODE: + return cfg->rawmode_enabled; + case CDP_CFG_DP_PEER_FLOW_CTRL: + return cfg->peer_flow_ctrl_enabled; + default: + return false; + } +} + #ifdef QCA_LL_TX_FLOW_CONTROL_V2 /** * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index f4fec20d8584..bbe521fa6b4c 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -164,9 +164,15 @@ struct wlan_cfg_dp_soc_ctxt { int int_host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; int hw_macid[MAX_PDEV_CNT]; int base_hw_macid; - bool lro_enabled; bool rx_hash; bool tso_enabled; + bool lro_enabled; + bool sg_enabled; + bool gro_enabled; + bool ol_tx_csum_enabled; + bool ol_rx_csum_enabled; + bool rawmode_enabled; + bool peer_flow_ctrl_enabled; bool napi_enabled; bool tcp_udp_checksumoffload; bool defrag_timeout_check; @@ -866,6 +872,17 @@ wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); int wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); +/* + * wlan_cfg_get_dp_caps - Get dp capablities + * @wlan_cfg_soc_ctx + * @dp_caps: enum for dp capablities + * + * Return: bool if a dp capabilities is enabled + */ +bool +wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg, + enum cdp_capabilities dp_caps); + #ifdef QCA_LL_TX_FLOW_CONTROL_V2 int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg);