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

Commit 03b7faad authored by Mohammed Javid's avatar Mohammed Javid
Browse files

msm: ipa4: Decrement number of packet in queue only if count was not zero



Decrement number of packet in ODL queue only if the count was not zero,
otherwise it was leading packet count value to negative value.

Change-Id: I21f913396f7062d4e175c923cf4f523a567f06a9
Acked-by: default avatarAshok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: default avatarMohammed Javid <mjavid@codeaurora.org>
parent 418f4a45
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1152,7 +1152,7 @@ static ssize_t ipa3_read_odlstats(struct file *file, char __user *ubuf,
			ipa3_odl_ctx->stats.odl_rx_pkt,
			ipa3_odl_ctx->stats.odl_tx_diag_pkt,
			ipa3_odl_ctx->stats.odl_drop_pkt,
			ipa3_odl_ctx->stats.numer_in_queue);
			atomic_read(&ipa3_odl_ctx->stats.numer_in_queue));

	cnt += nbytes;

+9 −6
Original line number Diff line number Diff line
@@ -215,7 +215,8 @@ static void delete_first_node(void)
			kfree(msg->buff);
			kfree(msg);
			ipa3_odl_ctx->stats.odl_drop_pkt++;
			IPA_STATS_DEC_CNT(ipa3_odl_ctx->stats.numer_in_queue);
			if (atomic_read(&ipa3_odl_ctx->stats.numer_in_queue))
				atomic_dec(&ipa3_odl_ctx->stats.numer_in_queue);
		}
	} else {
		IPADBG("List Empty\n");
@@ -244,10 +245,11 @@ int ipa3_send_adpl_msg(unsigned long skb_data)
	msg->buff = data;
	msg->len = skb->len;
	mutex_lock(&ipa3_odl_ctx->adpl_msg_lock);
	if (ipa3_odl_ctx->stats.numer_in_queue >= MAX_QUEUE_TO_ODL)
	if (atomic_read(&ipa3_odl_ctx->stats.numer_in_queue) >=
						MAX_QUEUE_TO_ODL)
		delete_first_node();
	list_add_tail(&msg->link, &ipa3_odl_ctx->adpl_msg_list);
	IPA_STATS_INC_CNT(ipa3_odl_ctx->stats.numer_in_queue);
	atomic_inc(&ipa3_odl_ctx->stats.numer_in_queue);
	mutex_unlock(&ipa3_odl_ctx->adpl_msg_lock);
	IPA_STATS_INC_CNT(ipa3_odl_ctx->stats.odl_rx_pkt);

@@ -342,7 +344,7 @@ int ipa3_odl_pipe_open(void)
	IPADBG("Setup endpoint config success\n");

	ipa3_odl_ctx->stats.odl_drop_pkt = 0;
	ipa3_odl_ctx->stats.numer_in_queue = 0;
	atomic_set(&ipa3_odl_ctx->stats.numer_in_queue, 0);
	ipa3_odl_ctx->stats.odl_rx_pkt = 0;
	ipa3_odl_ctx->stats.odl_tx_diag_pkt = 0;
	/*
@@ -422,7 +424,7 @@ void ipa3_odl_pipe_cleanup(bool is_ssr)
	 */
	ipa3_odl_ctx->odl_ctl_msg_wq_flag = true;
	ipa3_odl_ctx->stats.odl_drop_pkt = 0;
	ipa3_odl_ctx->stats.numer_in_queue = 0;
	atomic_set(&ipa3_odl_ctx->stats.numer_in_queue, 0);
	ipa3_odl_ctx->stats.odl_rx_pkt = 0;
	ipa3_odl_ctx->stats.odl_tx_diag_pkt = 0;
	IPADBG("Wake up odl ctl\n");
@@ -465,7 +467,8 @@ static ssize_t ipa_adpl_read(struct file *filp, char __user *buf, size_t count,
			msg = list_first_entry(&ipa3_odl_ctx->adpl_msg_list,
					struct ipa3_push_msg_odl, link);
			list_del(&msg->link);
			IPA_STATS_DEC_CNT(ipa3_odl_ctx->stats.numer_in_queue);
			if (atomic_read(&ipa3_odl_ctx->stats.numer_in_queue))
				atomic_dec(&ipa3_odl_ctx->stats.numer_in_queue);
		}

		mutex_unlock(&ipa3_odl_ctx->adpl_msg_lock);
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ struct ipa3_odlstats {
	u32 odl_rx_pkt;
	u32 odl_tx_diag_pkt;
	u32 odl_drop_pkt;
	u32 numer_in_queue;
	atomic_t numer_in_queue;
};

struct odl_state_bit_mask {