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

Commit d2850cc7 authored by Mohammed's avatar Mohammed Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa: rmnet_ipa: Fix to decrement the client upon disconenct



After lan client disconenct client counter is not decremented.
Due to which, the stats of lan client is not reset and leads
to incorrect stats upon next connect.
Fix to decrement the counter upon disconnect.

Looks like this is a propagation miss due to code
merge conflicts from previous kernel version.

Change-Id: I3506c65dd66e550724c51cd79f40556a15366af4
Signed-off-by: default avatarMohammed <mjavid@codeaurora.org>
parent 12165278
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -3706,7 +3706,11 @@ static inline int rmnet_ipa3_delete_lan_client_info
	int i;
	struct ipa_tether_device_info *teth_ptr = NULL;

	IPAWANDBG("Delete lan client info: %d, %d, %d\n",
		rmnet_ipa3_ctx->tether_device[device_type].num_clients,
		lan_clnt_idx, device_type);
	/* Check if Device type is valid. */

	if (device_type >= IPACM_MAX_CLIENT_DEVICE_TYPES ||
		device_type < 0) {
		IPAWANERR("Invalid Device type: %d\n", device_type);
@@ -3729,6 +3733,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;
@@ -3847,6 +3853,10 @@ int rmnet_ipa3_clear_lan_client_info(
		return -EINVAL;
	}

	IPAWANDBG("Client : %d:%d:%d\n",
		data->device_type, data->client_idx,
		rmnet_ipa3_ctx->tether_device[data->device_type].num_clients);

	teth_ptr = &rmnet_ipa3_ctx->tether_device[data->device_type];
	mutex_lock(&rmnet_ipa3_ctx->per_client_stats_guard);
	lan_client = &teth_ptr->lan_client[data->client_idx];
@@ -3995,6 +4005,21 @@ 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;
	}

	if (data->num_clients == 1) {
		/* Check if the client info is valid.*/
		lan_clnt_idx1 = rmnet_ipa3_get_lan_client_info(
@@ -4052,6 +4077,9 @@ int rmnet_ipa3_query_per_client_stats(
	memset(req, 0, sizeof(struct ipa_get_stats_per_client_req_msg_v01));
	memset(resp, 0, sizeof(struct ipa_get_stats_per_client_resp_msg_v01));

	IPAWANDBG("Reset stats: %s",
		data->reset_stats?"Yes":"No");

	if (data->reset_stats) {
		req->reset_stats_valid = true;
		req->reset_stats = true;
@@ -4119,6 +4147,9 @@ int rmnet_ipa3_query_per_client_stats(
		}
	}

	IPAWANDBG("Disconnect clnt: %s",
		data->disconnect_clnt?"Yes":"No");

	if (data->disconnect_clnt) {
		rmnet_ipa3_delete_lan_client_info(data->device_type,
		lan_clnt_idx1);