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

Commit 1a3d3ced authored by Utkarsh Saxena's avatar Utkarsh Saxena
Browse files

msm: ipa: Fix to incorrect dl stats



DL stats from Q6 do not include the additional LAN/WLAN
header bytes for respective endpoint. Make a change to
not to deduct the header bytes to keep the stats
accurate.

Also make a change to not to send QMI message to Q6
when there are no clients connected to avoid unnecessary
QMI exchange with Q6.

Change-Id: I3e7b34b106053c6d902ac0aafa9a362c1de0e221
Acked-by: default avatarChaitanya Pratapa <cpratapa@qti.qualcomm.com>
Signed-off-by: default avatarUtkarsh Saxena <usaxena@codeaurora.org>
parent 01efcc0e
Loading
Loading
Loading
Loading
+21 −10
Original line number Diff line number Diff line
@@ -3023,7 +3023,8 @@ static inline int rmnet_ipa3_delete_lan_client_info
		/* Reset the client info before sending the message. */
		memset(lan_client, 0, sizeof(struct ipa_lan_client));
		lan_client->client_idx = -1;

		/* Decrement the number of clients. */
		rmnet_ipa3_ctx->tether_device[device_type].num_clients--;
	}
	return 0;
}
@@ -3097,7 +3098,7 @@ int rmnet_ipa3_set_lan_client_info(

	rmnet_ipa3_ctx->tether_device[data->device_type].num_clients++;

	IPAWANDBG("Set the lan client info: %d, %d, %d\n",
	IPAWANDBG("Set the lan client info: Id:%d, Source Pipe:%d, num:%d\n",
		lan_client->client_idx,
		rmnet_ipa3_ctx->tether_device[data->device_type].ul_src_pipe,
		rmnet_ipa3_ctx->tether_device[data->device_type].num_clients);
@@ -3292,6 +3293,22 @@ int rmnet_ipa3_query_per_client_stats(

	mutex_lock(&rmnet_ipa3_ctx->per_client_stats_guard);

	/* Check if Source pipe is valid. */
	if (rmnet_ipa3_ctx->tether_device
		[data->device_type].ul_src_pipe == -1) {
		IPAWANERR("Device not initialized: %d\n", data->device_type);
		mutex_unlock(&rmnet_ipa3_ctx->per_client_stats_guard);
		return -EINVAL;
	}

	/* Check if we have clients connected. */
	if (rmnet_ipa3_ctx->tether_device[data->device_type].num_clients == 0) {
		IPAWANERR("No clients connected: %d\n", data->device_type);
		mutex_unlock(&rmnet_ipa3_ctx->per_client_stats_guard);
		return -EINVAL;
	}

	/* Check if num_clients is valid. */
	if (data->num_clients == 1) {
		/* Check if the client info is valid.*/
		lan_clnt_idx1 = rmnet_ipa3_get_lan_client_info(
@@ -3375,19 +3392,13 @@ int rmnet_ipa3_query_per_client_stats(
				&& i < IPA_MAX_NUM_HW_PATH_CLIENTS; i++) {
			/* Subtract the header bytes from the DL bytes. */
			data->client_info[i].ipv4_rx_bytes =
			(resp->per_client_stats_list[i].num_dl_ipv4_bytes) -
			(rmnet_ipa3_ctx->
			tether_device[data->device_type].hdr_len *
			resp->per_client_stats_list[i].num_dl_ipv4_pkts);
			resp->per_client_stats_list[i].num_dl_ipv4_bytes;
			/* UL header bytes are subtracted by Q6. */
			data->client_info[i].ipv4_tx_bytes =
			resp->per_client_stats_list[i].num_ul_ipv4_bytes;
			/* Subtract the header bytes from the DL bytes. */
			data->client_info[i].ipv6_rx_bytes =
			(resp->per_client_stats_list[i].num_dl_ipv6_bytes) -
			(rmnet_ipa3_ctx->
			tether_device[data->device_type].hdr_len *
			resp->per_client_stats_list[i].num_dl_ipv6_pkts);
			resp->per_client_stats_list[i].num_dl_ipv6_bytes;
			/* UL header bytes are subtracted by Q6. */
			data->client_info[i].ipv6_tx_bytes =
			resp->per_client_stats_list[i].num_ul_ipv6_bytes;
+1 −0
Original line number Diff line number Diff line
@@ -215,6 +215,7 @@ struct wan_ioctl_query_per_client_stats {
#define WAN_IOC_ADD_UL_FLT_RULE _IOWR(WAN_IOC_MAGIC, \
		WAN_IOCTL_ADD_UL_FLT_RULE, \
		struct ipa_configure_ul_firewall_rules_req_msg_v01 *)

#define WAN_IOC_ENABLE_PER_CLIENT_STATS _IOWR(WAN_IOC_MAGIC, \
		WAN_IOCTL_ENABLE_PER_CLIENT_STATS, \
		bool *)