Browse Source

qcacmn: get NAPI scale factor through ini configuration

NAPI scale factor should be configured based on the board
type. for example Hawkeye could have a different scale factor
compared to Alder.

CRs-Fixed: 3212330
Change-Id: Ie0bad6aade9ca9379997aa974154f9fb903ab93e
Tallapragada Kalyan 3 years ago
parent
commit
204b765390
5 changed files with 41 additions and 3 deletions
  1. 7 2
      dp/wifi3.0/dp_main.c
  2. 2 0
      dp/wifi3.0/dp_stats.c
  3. 14 1
      wlan_cfg/cfg_dp.h
  4. 7 0
      wlan_cfg/wlan_cfg.c
  5. 11 0
      wlan_cfg/wlan_cfg.h

+ 7 - 2
dp/wifi3.0/dp_main.c

@@ -3290,6 +3290,7 @@ static QDF_STATUS dp_soc_interrupt_attach(struct cdp_soc_t *txrx_soc)
 	int num_irq = 0;
 	int rx_err_ring_intr_ctxt_id = HIF_MAX_GROUP;
 	int lmac_id = 0;
+	int napi_scale;
 
 	qdf_mem_set(&soc->mon_intr_id_lmac_map,
 		    sizeof(soc->mon_intr_id_lmac_map), DP_MON_INVALID_LMAC_ID);
@@ -3365,11 +3366,15 @@ static QDF_STATUS dp_soc_interrupt_attach(struct cdp_soc_t *txrx_soc)
 			dp_soc_near_full_interrupt_attach(soc, num_irq,
 							  irq_id_map, i);
 		} else {
+			napi_scale = wlan_cfg_get_napi_scale_factor(
+							    soc->wlan_cfg_ctx);
+			if (!napi_scale)
+				napi_scale = QCA_NAPI_DEF_SCALE_BIN_SHIFT;
+
 			ret = hif_register_ext_group(soc->hif_handle,
 				num_irq, irq_id_map, dp_service_srngs,
 				&soc->intr_ctx[i], "dp_intr",
-				HIF_EXEC_NAPI_TYPE,
-				QCA_NAPI_DEF_SCALE_BIN_SHIFT);
+				HIF_EXEC_NAPI_TYPE, napi_scale);
 		}
 
 		dp_debug(" int ctx %u num_irq %u irq_id_map %u %u",

+ 2 - 0
dp/wifi3.0/dp_stats.c

@@ -5269,6 +5269,8 @@ void dp_print_soc_cfg_params(struct dp_soc *soc)
 		       soc_cfg_ctx->int_batch_threshold_other);
 	DP_PRINT_STATS("Int timer threshold other: %u ",
 		       soc_cfg_ctx->int_timer_threshold_other);
+	DP_PRINT_STATS("DP NAPI scale factor: %u ",
+		       soc_cfg_ctx->napi_scale_factor);
 
 	for (i = 0; i < num_of_int_contexts; i++) {
 		index += qdf_snprint(&ring_mask[index],

+ 14 - 1
wlan_cfg/cfg_dp.h

@@ -463,6 +463,10 @@
 #define CFG_DP_MPDU_RETRY_THRESHOLD_MAX 255
 #define CFG_DP_MPDU_RETRY_THRESHOLD 0
 
+#define WLAN_CFG_DP_NAPI_SCALE_FACTOR 0
+#define WLAN_CFG_DP_NAPI_SCALE_FACTOR_MIN 0
+#define WLAN_CFG_DP_NAPI_SCALE_FACTOR_MAX 4
+
 /*
  * <ini>
  * "dp_tx_capt_max_mem_mb"- maximum memory used by Tx capture
@@ -1316,6 +1320,14 @@
 #define CFG_DP_PEER_EXT_STATS \
 		CFG_INI_BOOL("peer_ext_stats", \
 		false, "Peer extended stats")
+
+#define CFG_DP_NAPI_SCALE_FACTOR \
+		CFG_INI_UINT("dp_napi_scale_factor", \
+		WLAN_CFG_DP_NAPI_SCALE_FACTOR_MIN, \
+		WLAN_CFG_DP_NAPI_SCALE_FACTOR_MAX, \
+		WLAN_CFG_DP_NAPI_SCALE_FACTOR, \
+		CFG_VALUE_OR_DEFAULT, "NAPI scale factor for DP")
+
 /*
  * <ini>
  * legacy_mode_csum_disable - Disable csum offload for legacy 802.11abg modes
@@ -1808,5 +1820,6 @@
 		CFG_DP_MLO_CONFIG \
 		CFG_DP_INI_SECTION_PARAMS \
 		CFG_DP_VDEV_STATS_HW_OFFLOAD \
-		CFG(CFG_DP_TX_CAPT_MAX_MEM_MB)
+		CFG(CFG_DP_TX_CAPT_MAX_MEM_MB) \
+		CFG(CFG_DP_NAPI_SCALE_FACTOR)
 #endif /* _CFG_DP_H_ */

+ 7 - 0
wlan_cfg/wlan_cfg.c

@@ -2154,6 +2154,8 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
 	wlan_cfg_ctx->mpdu_retry_threshold_2 =
 			cfg_get(psoc, CFG_DP_MPDU_RETRY_THRESHOLD_2);
 
+	wlan_cfg_ctx->napi_scale_factor = cfg_get(psoc,
+						  CFG_DP_NAPI_SCALE_FACTOR);
 	return wlan_cfg_ctx;
 }
 
@@ -3401,3 +3403,8 @@ bool wlan_cfg_get_txmon_hw_support(struct wlan_cfg_dp_soc_ctxt *cfg)
 }
 
 qdf_export_symbol(wlan_cfg_get_txmon_hw_support);
+
+uint8_t wlan_cfg_get_napi_scale_factor(struct wlan_cfg_dp_soc_ctxt *cfg)
+{
+	return cfg->napi_scale_factor;
+}

+ 11 - 0
wlan_cfg/wlan_cfg.h

@@ -427,6 +427,7 @@ struct wlan_cfg_dp_soc_ctxt {
 #endif
 	uint8_t mpdu_retry_threshold_1;
 	uint8_t mpdu_retry_threshold_2;
+	uint8_t napi_scale_factor;
 };
 
 /**
@@ -2156,4 +2157,14 @@ wlan_cfg_get_tx_capt_max_mem(struct wlan_cfg_dp_soc_ctxt *cfg)
 }
 #endif /* WLAN_TX_PKT_CAPTURE_ENH */
 
+/**
+ * wlan_cfg_get_napi_scale_factor() - Get napi scale factor
+ *
+ *
+ * @cfg: soc configuration context
+ *
+ * Return: napi scale factor
+ */
+uint8_t wlan_cfg_get_napi_scale_factor(struct wlan_cfg_dp_soc_ctxt *cfg);
+
 #endif /*__WLAN_CFG_H*/