soc: qcom: hab: add send/recv total msg count
This stat can be used to determine if there is any message lost between hab_vchan_send and hab_vchan_recv. Change-Id: I37be3e0a1359315e213399b9f91b18158006cd3e Signed-off-by: Rahul Sharma <rahsha@codeaurora.org> Signed-off-by: Yong Ding <yongding@codeaurora.org>
This commit is contained in:
parent
e2ae22f904
commit
4201acd054
@ -587,6 +587,13 @@ long hab_vchan_send(struct uhab_context *ctx,
|
||||
|
||||
schedule();
|
||||
}
|
||||
|
||||
/*
|
||||
* The ret here as 0 indicates the message was already sent out
|
||||
* from the hab_vchan_send()'s perspective.
|
||||
*/
|
||||
if (!ret)
|
||||
vchan->tx_cnt++;
|
||||
err:
|
||||
if (vchan)
|
||||
hab_vchan_put(vchan);
|
||||
@ -611,6 +618,8 @@ int hab_vchan_recv(struct uhab_context *ctx,
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
vchan->rx_inflight = 1;
|
||||
|
||||
if (nonblocking_flag) {
|
||||
/*
|
||||
* Try to pull data from the ring in this context instead of
|
||||
@ -628,8 +637,17 @@ int hab_vchan_recv(struct uhab_context *ctx,
|
||||
ret = -ENODEV;
|
||||
else if (ret == -ERESTARTSYS)
|
||||
ret = -EINTR;
|
||||
} else if (!ret) {
|
||||
/*
|
||||
* Here, it is for sure that a message was received from the
|
||||
* hab_vchan_recv()'s view w/ the ret as 0 and *message as
|
||||
* non-zero.
|
||||
*/
|
||||
vchan->rx_cnt++;
|
||||
}
|
||||
|
||||
vchan->rx_inflight = 0;
|
||||
|
||||
hab_vchan_put(vchan);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
#ifndef __HAB_H
|
||||
#define __HAB_H
|
||||
@ -341,6 +341,10 @@ struct virtual_channel {
|
||||
*/
|
||||
int closed;
|
||||
int forked; /* if fork is detected and assume only once */
|
||||
/* stats */
|
||||
uint64_t tx_cnt; /* total succeeded tx */
|
||||
uint64_t rx_cnt; /* total succeeded rx */
|
||||
int rx_inflight; /* rx in progress/blocking */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
#include "hab.h"
|
||||
#include "hab_grantable.h"
|
||||
@ -61,9 +61,12 @@ int hab_stat_show_vchan(struct hab_driver *driver,
|
||||
read_lock(&pchan->vchans_lock);
|
||||
list_for_each_entry(vc, &pchan->vchannels, pnode) {
|
||||
ret = hab_stat_buffer_print(buf, size,
|
||||
"%08X(%d:%d) ", vc->id,
|
||||
"%08X(%d:%d:%lu:%lu:%d) ", vc->id,
|
||||
get_refcnt(vc->refcount),
|
||||
vc->otherend_closed);
|
||||
vc->otherend_closed,
|
||||
(unsigned long)vc->tx_cnt,
|
||||
(unsigned long)vc->rx_cnt,
|
||||
vc->rx_inflight);
|
||||
}
|
||||
ret = hab_stat_buffer_print(buf, size, "\n");
|
||||
read_unlock(&pchan->vchans_lock);
|
||||
|
Loading…
Reference in New Issue
Block a user