فهرست منبع

qcacmn: Allow drop pkts when pkts pending is large

On some cases, dp_rx_thread can not handle nbufs in time,
then a large number of packets are pending in
rx_thread->nbuf_queue, which run out of system memory at
last and failed to malloc new buffers for refill buffer
ring, fw crash is encountered. To avoid this, drop RX
packets when the pending number becomes large.

Change-Id: I370ad983b185b6ecb28fa7c0b4820b8edc00c710
CRs-Fixed: 2737191
Yu Tian 5 سال پیش
والد
کامیت
db5374f08f
3فایلهای تغییر یافته به همراه93 افزوده شده و 1 حذف شده
  1. 54 1
      wlan_cfg/cfg_dp.h
  2. 17 0
      wlan_cfg/wlan_cfg.c
  3. 22 0
      wlan_cfg/wlan_cfg.h

+ 54 - 1
wlan_cfg/cfg_dp.h

@@ -107,6 +107,14 @@
 #define WLAN_CFG_INT_TIMER_THRESHOLD_OTHER 8
 #endif
 
+#define WLAN_CFG_RX_PENDING_HL_THRESHOLD 0x60000
+#define WLAN_CFG_RX_PENDING_HL_THRESHOLD_MIN 0
+#define WLAN_CFG_RX_PENDING_HL_THRESHOLD_MAX 0x80000
+
+#define WLAN_CFG_RX_PENDING_LO_THRESHOLD 0x60000
+#define WLAN_CFG_RX_PENDING_LO_THRESHOLD_MIN 100
+#define WLAN_CFG_RX_PENDING_LO_THRESHOLD_MAX 0x80000
+
 #define WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING 256
 #define WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING 512
 
@@ -523,6 +531,49 @@
 		WLAN_CFG_PER_PDEV_LMAC_RING_MAX, \
 		WLAN_CFG_PER_PDEV_LMAC_RING, \
 		CFG_VALUE_OR_DEFAULT, "DP pdev LMAC ring")
+/*
+ * <ini>
+ * dp_rx_pending_hl_threshold - High threshold of frame number to start
+ * frame dropping scheme
+ * @Min: 0
+ * @Max: 524288
+ * @Default: 393216
+ *
+ * This ini entry is used to set a high limit threshold to start frame
+ * dropping scheme
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_DP_RX_PENDING_HL_THRESHOLD \
+		CFG_INI_UINT("dp_rx_pending_hl_threshold", \
+		WLAN_CFG_RX_PENDING_HL_THRESHOLD_MIN, \
+		WLAN_CFG_RX_PENDING_HL_THRESHOLD_MAX, \
+		WLAN_CFG_RX_PENDING_HL_THRESHOLD, \
+		CFG_VALUE_OR_DEFAULT, "DP rx pending hl threshold")
+
+/*
+ * <ini>
+ * dp_rx_pending_lo_threshold - Low threshold of frame number to stop
+ * frame dropping scheme
+ * @Min: 100
+ * @Max: 524288
+ * @Default: 393216
+ *
+ * This ini entry is used to set a low limit threshold to stop frame
+ * dropping scheme
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_DP_RX_PENDING_LO_THRESHOLD \
+		CFG_INI_UINT("dp_rx_pending_lo_threshold", \
+		WLAN_CFG_RX_PENDING_LO_THRESHOLD_MIN, \
+		WLAN_CFG_RX_PENDING_LO_THRESHOLD_MAX, \
+		WLAN_CFG_RX_PENDING_LO_THRESHOLD, \
+		CFG_VALUE_OR_DEFAULT, "DP rx pending lo threshold")
 
 #define CFG_DP_BASE_HW_MAC_ID \
 		CFG_INI_UINT("dp_base_hw_macid", \
@@ -973,6 +1024,8 @@
 		CFG(CFG_DP_FULL_MON_MODE) \
 		CFG(CFG_DP_REO_RINGS_MAP) \
 		CFG(CFG_DP_PEER_EXT_STATS) \
-		CFG(CFG_DP_RX_BUFF_POOL_ENABLE)
+		CFG(CFG_DP_RX_BUFF_POOL_ENABLE) \
+		CFG(CFG_DP_RX_PENDING_HL_THRESHOLD) \
+		CFG(CFG_DP_RX_PENDING_LO_THRESHOLD)
 
 #endif /* _CFG_DP_H_ */

+ 17 - 0
wlan_cfg/wlan_cfg.c

@@ -612,6 +612,11 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
 	wlan_cfg_ctx->pext_stats_enabled = cfg_get(psoc, CFG_DP_PEER_EXT_STATS);
 	wlan_cfg_ctx->is_rx_buff_pool_enabled =
 			cfg_get(psoc, CFG_DP_RX_BUFF_POOL_ENABLE);
+	wlan_cfg_ctx->rx_pending_high_threshold =
+			cfg_get(psoc, CFG_DP_RX_PENDING_HL_THRESHOLD);
+	wlan_cfg_ctx->rx_pending_low_threshold =
+			cfg_get(psoc, CFG_DP_RX_PENDING_LO_THRESHOLD);
+
 	return wlan_cfg_ctx;
 }
 
@@ -882,6 +887,18 @@ int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
 	return cfg->per_pdev_tx_ring;
 }
 
+uint32_t
+wlan_cfg_rx_pending_hl_threshold(struct wlan_cfg_dp_soc_ctxt *cfg)
+{
+	return cfg->rx_pending_high_threshold;
+}
+
+uint32_t
+wlan_cfg_rx_pending_lo_threshold(struct wlan_cfg_dp_soc_ctxt *cfg)
+{
+	return cfg->rx_pending_low_threshold;
+}
+
 int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
 {
 	return cfg->per_pdev_lmac_ring;

+ 22 - 0
wlan_cfg/wlan_cfg.h

@@ -187,6 +187,8 @@ struct wlan_srng_cfg {
  * @pext_stats_enabled: Flag to enable and disabled peer extended stats
  * @is_rx_buff_pool_enabled: flag to enable/disable emergency RX buffer
  *                           pool support
+ * @rx_pending_high_threshold: threshold of starting pkt drop
+ * @rx_pending_low_threshold: threshold of stopping pkt drop
  */
 struct wlan_cfg_dp_soc_ctxt {
 	int num_int_ctxts;
@@ -292,6 +294,8 @@ struct wlan_cfg_dp_soc_ctxt {
 	uint32_t reo_rings_mapping;
 	bool pext_stats_enabled;
 	bool is_rx_buff_pool_enabled;
+	uint32_t rx_pending_high_threshold;
+	uint32_t rx_pending_low_threshold;
 };
 
 /**
@@ -867,6 +871,24 @@ wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg);
 int wlan_cfg_get_rx_dma_buf_ring_size(
 		struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx);
 
+/*
+ * wlan_cfg_rx_pending_hl_threshold() - Return high threshold of rx pending
+ * @wlan_cfg_pdev_ctx
+ *
+ * Return: rx_pending_high_threshold
+ */
+uint32_t
+wlan_cfg_rx_pending_hl_threshold(struct wlan_cfg_dp_soc_ctxt *cfg);
+
+/*
+ * wlan_cfg_rx_pending_lo_threshold() - Return low threshold of rx pending
+ * @wlan_cfg_pdev_ctx
+ *
+ * Return: rx_pending_low_threshold
+ */
+uint32_t
+wlan_cfg_rx_pending_lo_threshold(struct wlan_cfg_dp_soc_ctxt *cfg);
+
 /*
  * wlan_cfg_get_num_mac_rings() - Return the number of MAC RX DMA rings
  * per pdev