#ifdef CONFIG_MODEM_IF_ADAPTIVE_QOS
static struct pm_qos_request pm_qos_req_cpu[2];
static struct pm_qos_request pm_qos_req_mif;
-static struct pm_qos_request pm_qos_req_int;
#endif
enum smc_error_flag {
schedule_work(&shmd->pm_qos_work_normal);
}
-static void check_rx_shmem_status(struct shmem_link_device *shmd,
- struct circ_status *circ)
+static enum hrtimer_restart tp_monitor_timer_func(struct hrtimer *timer)
{
- if (circ->size > SHM_RX_MAX_QOS_TRIGGER_BYTES) {
+ struct shmem_link_device *shmd = container_of(timer, struct shmem_link_device, tp_timer);
+
+ unsigned long rx_bytes;
+ ktime_t currtime, interval;
+
+ currtime = ktime_get();
+ interval = ktime_set(0, TIMER_INTERVAL_NS); /* 500ms */
+ hrtimer_forward(timer, currtime, interval);
+
+ rx_bytes = shmd->ndev_rx_bytes - shmd->prev_ndv_rx_bytes;
+ shmd->prev_ndv_rx_bytes = shmd->ndev_rx_bytes;
+
+ if (!shmd->ndev_rx_bytes || !rx_bytes)
+ return HRTIMER_RESTART;
+
+ if (rx_bytes > SHM_RX_MAX_QOS_TRIGGER_BYTES) {
/* Timer is working */
if (timer_pending(&shmd->max_qos_timer)) {
/* Expand timer value */
msecs_to_jiffies(SHM_RX_MIN_QOS_HOLD_MS));
}
}
+
+ return HRTIMER_RESTART;
}
#endif
return 0;
}
- check_rx_shmem_status(shmd, &circ);
+#ifdef CONFIG_MODEM_IF_ADAPTIVE_QOS
+ shmd->ndev_rx_bytes += circ.size;
+#endif
/* Read data in the RXQ */
ret = rx_ipc_frames(shmd, i, &circ, *budget, &work_done);
}
#ifdef CONFIG_MODEM_IF_ADAPTIVE_QOS
- check_rx_shmem_status(shmd, &circ);
+ shmd->ndev_rx_bytes += circ.size;
#endif
/* Read data in the RXQ */
mif_info("Request MAX QOS\n");
pm_qos_update_request(&pm_qos_req_mif, INT_MAX);
- pm_qos_update_request(&pm_qos_req_int, INT_MAX);
pm_qos_update_request(&pm_qos_req_cpu[0], INT_MAX);
pm_qos_update_request(&pm_qos_req_cpu[1], INT_MAX);
pm_qos_update_request(&pm_qos_req_cpu[0], 0);
pm_qos_update_request(&pm_qos_req_cpu[1], 0);
- pm_qos_update_request(&pm_qos_req_int, 0);
pm_qos_update_request(&pm_qos_req_mif, 0);
}
#endif
struct device *dev = &pdev->dev;
int err = 0;
int i = 0;
+ ktime_t ktime;
mif_info("+++\n");
/* Get the modem (platform) data */
shmd->irq_cp2ap_wakelock = modem->mbx->irq_cp2ap_wake_lock;
#ifdef CONFIG_MODEM_IF_ADAPTIVE_QOS
+ hrtimer_init(&shmd->tp_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+ shmd->tp_timer.function = tp_monitor_timer_func;
+
+ ktime = ktime_set(1, 0);
+ hrtimer_start(&shmd->tp_timer, ktime, HRTIMER_MODE_REL);
+
pm_qos_add_request(&pm_qos_req_cpu[0], PM_QOS_CLUSTER0_FREQ_MIN, 0);
pm_qos_add_request(&pm_qos_req_cpu[1], PM_QOS_CLUSTER1_FREQ_MIN, 0);
pm_qos_add_request(&pm_qos_req_mif, PM_QOS_BUS_THROUGHPUT, 0);
- pm_qos_add_request(&pm_qos_req_int, PM_QOS_DEVICE_THROUGHPUT, 0);
INIT_WORK(&shmd->pm_qos_work_max, shmem_qos_work_max);
INIT_WORK(&shmd->pm_qos_work_normal, shmem_qos_work_normal);
#define MEM_CRASH_REASON_RIL 2
#define MEM_CRASH_REASON_SIZE 512
-#define SHM_RX_MAX_QOS_TRIGGER_BYTES 4000 /* 32 Mbps */
-#define SHM_RX_MIN_QOS_HOLD_MS 500 /* 500ms */
+#define SHM_RX_MAX_QOS_TRIGGER_BYTES 6250000 /* Express 100Mbps as Bytes per 0.5ms */
+#define SHM_RX_MIN_QOS_HOLD_MS 500 /* 500ms */
+
+#define TIMER_INTERVAL_NS 500000000 /* 500ms */
struct crash_reason {
u32 owner;
#ifdef CONFIG_MODEM_IF_NET_GRO
struct timespec flush_time;
#endif
+
+#ifdef CONFIG_MODEM_IF_ADAPTIVE_QOS
+ struct hrtimer tp_timer;
+
+ unsigned long ndev_rx_bytes;
+ unsigned long prev_ndv_rx_bytes;
+#endif
};
/* converts from struct link_device* to struct xxx_link_device* */