Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33308942 authored by Jeff Hugo's avatar Jeff Hugo
Browse files

msm: bam_dmux: add downlink processing state logging



State transitions of the downlink packet processing task are not directly
logged.  This leads to information gaps when debugging downlink issues.

Add explict logging of the state transitions to provide complete
information on what the downlink processing task has done.

Change-Id: Ie253c9739447da6ed236e865b7f1ed318e13cb6e
Signed-off-by: default avatarJeffrey Hugo <jhugo@codeaurora.org>
parent 9ccf1dee
Loading
Loading
Loading
Loading
+36 −3
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ static struct sps_register_event tx_register_event;
static struct sps_register_event rx_register_event;
static bool satellite_mode;
static uint32_t num_buffers;
static unsigned long long last_rx_pkt_timestamp;

static struct bam_ch_info bam_ch[BAM_DMUX_NUM_CHANNELS];
static int bam_mux_initialized;
@@ -1117,6 +1118,29 @@ fail:
	queue_work_on(0, bam_mux_rx_workqueue, &rx_timer_work);
}

/**
 * store_rx_timestamp() - store the current raw time as as a timestamp for when
 *			the last rx packet was processed
 */
static void store_rx_timestamp(void)
{
	last_rx_pkt_timestamp = sched_clock();
}

/**
 * log_rx_timestamp() - Log the stored rx pkt timestamp in a human readable
 *			format
 */
static void log_rx_timestamp(void)
{
	unsigned long long t = last_rx_pkt_timestamp;
	unsigned long nanosec_rem;

	nanosec_rem = do_div(t, 1000000000U);
	BAM_DMUX_LOG("Last rx pkt processed at [%6u.%09lu]\n", (unsigned)t,
								nanosec_rem);
}

static void rx_timer_work_func(struct work_struct *work)
{
	struct sps_iovec iov;
@@ -1125,20 +1149,26 @@ static void rx_timer_work_func(struct work_struct *work)
	int ret;
	u32 buffs_unused, buffs_used;

	BAM_DMUX_LOG("%s: polling start\n", __func__);
	while (bam_connection_is_active) { /* timer loop */
		++inactive_cycles;
		while (bam_connection_is_active) { /* deplete queue loop */
			if (in_global_reset)
			if (in_global_reset) {
				BAM_DMUX_LOG(
						"%s: polling exit, global reset detected\n",
						__func__);
				return;
			}

			ret = sps_get_iovec(bam_rx_pipe, &iov);
			if (ret) {
				pr_err("%s: sps_get_iovec failed %d\n",
				DMUX_LOG_KERR("%s: sps_get_iovec failed %d\n",
						__func__, ret);
				break;
			}
			if (iov.addr == 0)
				break;
			store_rx_timestamp();
			inactive_cycles = 0;
			mutex_lock(&bam_rx_pool_mutexlock);
			if (unlikely(list_empty(&bam_rx_pool))) {
@@ -1171,6 +1201,7 @@ static void rx_timer_work_func(struct work_struct *work)
		}

		if (inactive_cycles >= POLLING_INACTIVITY) {
			BAM_DMUX_LOG("%s: polling exit, no data\n", __func__);
			rx_switch_to_interrupt_mode();
			break;
		}
@@ -1182,7 +1213,8 @@ static void rx_timer_work_func(struct work_struct *work)
						&buffs_unused);

			if (ret) {
				pr_err("%s: error getting num buffers unused after sleep\n",
				DMUX_LOG_KERR(
					"%s: error getting num buffers unused after sleep\n",
					__func__);

				break;
@@ -1768,6 +1800,7 @@ static void disconnect_to_bam(void)
		if (time_remaining == 0) {
			DMUX_LOG_KERR("%s: shutdown completion timed out\n",
					__func__);
			log_rx_timestamp();
			ssrestart_check();
		}
	}