Ver código fonte

qcacmn: Enable CFR support for IPQ5018

Enable CFR support for IPQ5018.
Calculate stream FS buffer length based on CFR payload,
CFR uCode header and CSI metadata.

Change-Id: Idd903ead75d635ce87ffc0df80e5c32fb62d15aa
CRs-Fixed: 2751408
Adwait Nayak 4 anos atrás
pai
commit
9b8183fef6

+ 46 - 0
target_if/cfr/inc/target_if_cfr_enh.h

@@ -105,6 +105,52 @@ enum macrx_freeze_tlv_version {
 	MACRX_FREEZE_TLV_VERSION_MAX
 };
 
+/* Max 4 users in MU case for Maple */
+#define MAPLE_CFR_MU_USERS 4
+
+#define MAPLE_MAX_HEADER_LENGTH_WORDS 16
+
+#define MAPLE_MAX_DATA_LENGTH_BYTES 4096
+
+/* Max size :
+ * sizeof(csi_cfr_header) + 64 bytes(cfr uCode header) +
+ * 4096 bytes(cfr payload)
+ */
+#define STREAMFS_MAX_SUBBUF_MAPLE \
+	(sizeof(struct csi_cfr_header) + \
+	 (MAPLE_MAX_HEADER_LENGTH_WORDS * 4) + \
+	 MAPLE_MAX_DATA_LENGTH_BYTES)
+
+/* The number 470 has come up by considering the 2MB benchmark
+ * for Relay FS buffer pool. For Cascade, dakota and HK, the
+ * Relay FS buffer pool has been considered as 2MB and based
+ * on that the number of sub buffers are 1100, 2200 and 255.
+ * For Cypress and pine, since the buffer size has increased
+ * to 16K, if we would have considered to keep the relay FS
+ * buffer pool size as 2MB then the number of sub buffers /
+ * CFR records would have been lesser in number (around 130)
+ * So, the decision had been taken to keep the sub buffer
+ * count to 255 and as result the relay fs buffer pool size
+ * in case of Cypress and Pine exceeded 4MB.
+ *
+ * In case of Maple, since the Buffer size is small (4470B)
+ * we have decided to maintain the relay fs buffer pool size
+ * as 2MB, as a result the number of sub buffers has become
+ * 470.
+ *
+ * RelayFS memory required:
+ * Max sub buffer size * Number of sub buffers
+ *
+ * Cascade: (2200B  * 1100) ~= 2MB
+ * Dakota:  (1100B  * 2200) ~= 2MB
+ * Hawkeye: (8200B  * 255 ) ~= 2MB
+ * Cypress: (16438B * 255 ) ~= 4MB
+ * Pine   : (16894B * 255 ) ~= 4MB
+ * Maple  : (4470B *  470 ) ~= 2MB
+ *
+ */
+#define STREAMFS_NUM_SUBBUF_MAPLE 470
+
 /*
  * @tag: ucode fills this with 0xBA
  *

+ 4 - 2
target_if/cfr/src/target_if_cfr.c

@@ -275,7 +275,8 @@ int target_if_cfr_init_pdev(struct wlan_objmgr_psoc *psoc,
 
 		return cfr_wifi2_0_init_pdev(psoc, pdev);
 	} else if ((target_type == TARGET_TYPE_QCA6018) ||
-		   (target_type == TARGET_TYPE_QCN9000)) {
+		   (target_type == TARGET_TYPE_QCN9000) ||
+		   (target_type == TARGET_TYPE_QCA5018)) {
 		pa->is_cfr_capable = cfr_sc->is_cfr_capable;
 		return cfr_enh_init_pdev(psoc, pdev);
 	} else
@@ -302,7 +303,8 @@ int target_if_cfr_deinit_pdev(struct wlan_objmgr_psoc *psoc,
 
 		return cfr_wifi2_0_deinit_pdev(psoc, pdev);
 	} else if ((target_type == TARGET_TYPE_QCA6018) ||
-		   (target_type == TARGET_TYPE_QCN9000)) {
+		   (target_type == TARGET_TYPE_QCN9000) ||
+		   (target_type == TARGET_TYPE_QCA5018)) {
 		return cfr_enh_deinit_pdev(psoc, pdev);
 	} else
 		return QDF_STATUS_E_NOSUPPORT;

+ 10 - 1
target_if/cfr/src/target_if_cfr_enh.c

@@ -1158,6 +1158,8 @@ static void enh_prepare_cfr_header_txstatus(wmi_cfr_peer_tx_event_param
 
 	if (target_type == TARGET_TYPE_QCN9000)
 		header->chip_type      = CFR_CAPTURE_RADIO_PINE;
+	else if (target_type == TARGET_TYPE_QCA5018)
+		header->chip_type      = CFR_CAPTURE_RADIO_MAPLE;
 	else
 		header->chip_type      = CFR_CAPTURE_RADIO_CYP;
 
@@ -1354,6 +1356,8 @@ target_if_peer_capture_event(ol_scn_t sc, uint8_t *data, uint32_t datalen)
 
 	if (target_type == TARGET_TYPE_QCN9000)
 		header->chip_type      = CFR_CAPTURE_RADIO_PINE;
+	else if (target_type == TARGET_TYPE_QCA5018)
+		header->chip_type      = CFR_CAPTURE_RADIO_MAPLE;
 	else
 		header->chip_type      = CFR_CAPTURE_RADIO_CYP;
 
@@ -1724,7 +1728,7 @@ QDF_STATUS cfr_enh_init_pdev(struct wlan_objmgr_psoc *psoc,
 		/* Update global configuration */
 		target_if_cfr_update_global_cfg(pdev);
 	} else {
-		cfr_err("Sending WMI to configure default has failed\n");
+		cfr_err("Sending WMI to configure default has failed");
 		return status;
 	}
 
@@ -1737,6 +1741,11 @@ QDF_STATUS cfr_enh_init_pdev(struct wlan_objmgr_psoc *psoc,
 		pcfr->num_subbufs = STREAMFS_NUM_SUBBUF_PINE;
 		pcfr->chip_type = CFR_CAPTURE_RADIO_PINE;
 		pcfr->max_mu_users = PINE_CFR_MU_USERS;
+	} else if (target_type == TARGET_TYPE_QCA5018) {
+		pcfr->subbuf_size = STREAMFS_MAX_SUBBUF_MAPLE;
+		pcfr->num_subbufs = STREAMFS_NUM_SUBBUF_MAPLE;
+		pcfr->chip_type = CFR_CAPTURE_RADIO_MAPLE;
+		pcfr->max_mu_users = MAPLE_CFR_MU_USERS;
 	} else {
 		pcfr->subbuf_size = STREAMFS_MAX_SUBBUF_CYP;
 		pcfr->num_subbufs = STREAMFS_NUM_SUBBUF_CYP;

+ 1 - 0
umac/cfr/dispatcher/inc/wlan_cfr_utils_api.h

@@ -97,6 +97,7 @@ enum cfrradiotype {
 	CFR_CAPTURE_RADIO_HSP,
 	CFR_CAPTURE_RADIO_PINE,
 	CFR_CAPTURE_RADIO_ADRASTEA,
+	CFR_CAPTURE_RADIO_MAPLE,
 	CFR_CAPTURE_RADIO_MAX = 0xFF,
 };