Эх сурвалжийг харах

Merge "msm: ipa: Add wrb_mod_threshold to AQC evt scratch"

qctecmdr 3 жил өмнө
parent
commit
7b2c2c8683

+ 6 - 4
drivers/platform/msm/gsi/gsi.h

@@ -1195,12 +1195,14 @@ struct __packed gsi_rtk_evt_scratch {
 /**
  * gsi_aqc_evt_scratch - AQC protocol SW config area of
  * event scratch
- * @reserved1: reserve bit.
- * @reserved2: reserve bit.
+ * @head_ptr_wrb_mod_threshold: head pointer write-back moderation threshold
+ * @reserved1-3: reserve bit.
  */
 struct __packed gsi_aqc_evt_scratch {
-	uint32_t reserved1;
-	uint32_t reserved2;
+	uint8_t head_ptr_wrb_mod_threshold;
+	uint8_t reserved1;
+	uint16_t reserved2;
+	uint32_t reserved3;
 };
 
 /**

+ 13 - 4
drivers/platform/msm/ipa/ipa_v3/ipa_eth_i.c

@@ -11,7 +11,11 @@
 #define IPA_ETH_RTK_MODC (128)
 
 #define IPA_ETH_AQC_MODT (32)
-#define IPA_ETH_AQC_MODC (128)
+/*
+ * MODC factors are the number of percents from ring len (i.e 10 is 10% of len)
+ */
+#define IPA_ETH_AQC_MODC_FACTOR (10)
+#define AQC_WRB_MODC_FACTOR (10)
 
 
 #define IPA_ETH_AGGR_PKT_LIMIT 1
@@ -605,14 +609,16 @@ static int ipa_eth_setup_aqc_gsi_channel(
 	gsi_evt_ring_props.intr = GSI_INTR_MSI;
 	gsi_evt_ring_props.re_size = GSI_EVT_RING_RE_SIZE_16B;
 	gsi_evt_ring_props.int_modt = IPA_ETH_AQC_MODT;
-	gsi_evt_ring_props.int_modc = IPA_ETH_AQC_MODC;
+	len = pipe->info.transfer_ring_size;
+	/* len / RE_SIZE == len in counts (convert from bytes) */
+	gsi_evt_ring_props.int_modc = len * IPA_ETH_AQC_MODC_FACTOR /
+		(100 * GSI_EVT_RING_RE_SIZE_16B);
 	gsi_evt_ring_props.exclusive = true;
 	gsi_evt_ring_props.err_cb = ipa_eth_gsi_evt_ring_err_cb;
 	gsi_evt_ring_props.user_data = NULL;
 	gsi_evt_ring_props.msi_addr =
 		bar_addr +
 		pipe->info.client_info.aqc.dest_tail_ptr_offs;
-	len = pipe->info.transfer_ring_size;
 	gsi_evt_ring_props.ring_len = len;
 	gsi_evt_ring_props.ring_base_addr =
 		(u64)pipe->info.transfer_ring_base;
@@ -668,7 +674,10 @@ static int ipa_eth_setup_aqc_gsi_channel(
 
 	/* write event scratch */
 	memset(&evt_scratch, 0, sizeof(evt_scratch));
-	/* nothing is needed for AQC event scratch */
+	if (pipe->dir == IPA_ETH_PIPE_DIR_TX)
+		/* len / RE_SIZE == len in counts (convert from bytes) */
+		evt_scratch.aqc.head_ptr_wrb_mod_threshold =
+		len * AQC_WRB_MODC_FACTOR / (100 * GSI_EVT_RING_RE_SIZE_16B);
 
 	/* write ch scratch */
 	memset(&ch_scratch, 0, sizeof(ch_scratch));