qcacmn: Rx Sw Descriptor allocation should be configurable
To make Rx Software descriptor allocation configurable for each radio,
new ini variable is added.
Change-Id: Ifc5683629747a6fe8238c18448695abe91876ec5
diff --git a/wlan_cfg/cfg_dp.h b/wlan_cfg/cfg_dp.h
index 261d428..ef0172b 100644
--- a/wlan_cfg/cfg_dp.h
+++ b/wlan_cfg/cfg_dp.h
@@ -277,6 +277,36 @@
#define WLAN_CFG_RXDMA_ERR_DST_RING_SIZE_MIN 1024
#define WLAN_CFG_RXDMA_ERR_DST_RING_SIZE_MAX 8192
+/**
+ * Allocate as many RX descriptors as buffers in the SW2RXDMA
+ * ring. This value may need to be tuned later.
+ */
+#if defined(QCA_HOST2FW_RXBUF_RING)
+#define WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE 1
+#define WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE_MIN 1
+#define WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE_MAX 1
+
+/**
+ * For low memory AP cases using 1 will reduce the rx descriptors memory req
+ */
+#elif defined(QCA_LOWMEM_CONFIG) || defined(QCA_512M_CONFIG)
+#define WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE 1
+#define WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE_MIN 1
+#define WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE_MAX 3
+
+/**
+ * AP use cases need to allocate more RX Descriptors than the number of
+ * entries avaialable in the SW2RXDMA buffer replenish ring. This is to account
+ * for frames sitting in REO queues, HW-HW DMA rings etc. Hence using a
+ * multiplication factor of 3, to allocate three times as many RX descriptors
+ * as RX buffers.
+ */
+#else
+#define WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE 3
+#define WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE_MIN 1
+#define WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE_MAX 3
+#endif //QCA_HOST2FW_RXBUF_RING
+
/* DP INI Declerations */
#define CFG_DP_HTT_PACKET_TYPE \
CFG_INI_UINT("dp_htt_packet_type", \
@@ -683,6 +713,13 @@
CFG_INI_BOOL("gEnableDataStallDetection", \
true, "Enable/Disable Data stall detection")
+#define CFG_DP_RX_SW_DESC_WEIGHT \
+ CFG_INI_UINT("dp_rx_sw_desc_weight", \
+ WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE_MIN, \
+ WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE_MAX, \
+ WLAN_CFG_RX_SW_DESC_WEIGHT_SIZE, \
+ CFG_VALUE_OR_DEFAULT, "DP RX SW DESC weight")
+
#define CFG_DP \
CFG(CFG_DP_HTT_PACKET_TYPE) \
CFG(CFG_DP_INT_BATCH_THRESHOLD_OTHER) \
@@ -747,6 +784,8 @@
CFG(CFG_DP_IPA_UC_RX_IND_RING_COUNT) \
CFG(CFG_DP_REORDER_OFFLOAD_SUPPORT) \
CFG(CFG_DP_AP_STA_SECURITY_SEPERATION) \
- CFG(CFG_DP_ENABLE_DATA_STALL_DETECTION)
+ CFG(CFG_DP_ENABLE_DATA_STALL_DETECTION) \
+ CFG(CFG_DP_RX_SW_DESC_WEIGHT)
+
#endif /* _CFG_DP_H_ */
diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c
index ae99ac0..ae2598e 100644
--- a/wlan_cfg/wlan_cfg.c
+++ b/wlan_cfg/wlan_cfg.c
@@ -420,7 +420,8 @@
cfg_get(psoc, CFG_DP_TX_FLOW_STOP_QUEUE_TH);
wlan_cfg_ctx->disable_intra_bss_fwd =
cfg_get(psoc, CFG_DP_AP_STA_SECURITY_SEPERATION);
-
+ wlan_cfg_ctx->rx_sw_desc_weight = cfg_get(psoc,
+ CFG_DP_RX_SW_DESC_WEIGHT);
return wlan_cfg_ctx;
}
@@ -978,6 +979,12 @@
return cfg->rxdma_err_dst_ring;
}
+int
+wlan_cfg_get_dp_soc_rx_sw_desc_weight(struct wlan_cfg_dp_soc_ctxt *cfg)
+{
+ return cfg->rx_sw_desc_weight;
+}
+
bool
wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
enum cdp_capabilities dp_caps)
diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h
index 6e85dbe..e27b8d3 100644
--- a/wlan_cfg/wlan_cfg.h
+++ b/wlan_cfg/wlan_cfg.h
@@ -159,6 +159,7 @@
* dp_rx_process loop
* tx_comp_enable_eol_data_check: flag to enable/disable checking for more data
* at end of tx_comp_handler loop.
+ * @rx_sw_desc_weight: rx sw descriptor weight configuration
*/
struct wlan_cfg_dp_soc_ctxt {
int num_int_ctxts;
@@ -245,6 +246,7 @@
bool rx_enable_eol_data_check;
bool tx_comp_enable_eol_data_check;
#endif /* WLAN_FEATURE_RX_SOFTIRQ_TIME_LIMIT */
+ int rx_sw_desc_weight;
};
/**
@@ -1065,6 +1067,15 @@
wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg);
/*
+ * wlan_cfg_get_dp_soc_rx_sw_desc_weight - Get rx sw desc weight
+ * @wlan_cfg_soc_ctx
+ *
+ * Return: rx_sw_desc_weight
+ */
+int
+wlan_cfg_get_dp_soc_rx_sw_desc_weight(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