Merge "msm: ipa: rmnet_ipa: Fix to decrement the client upon disconenct"
diff --git a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c
index a161e00..890436b 100644
--- a/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c
+++ b/drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c
@@ -3730,7 +3730,11 @@
struct ipa_lan_client *lan_client = NULL;
int i;
+ 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);
@@ -3753,6 +3757,8 @@
/* 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;
@@ -3873,6 +3879,10 @@
return -EINVAL;
}
+ IPAWANDBG("Client : %d:%d:%d\n",
+ data->device_type, data->client_idx,
+ rmnet_ipa3_ctx->tether_device[data->device_type].num_clients);
+
mutex_lock(&rmnet_ipa3_ctx->per_client_stats_guard);
lan_client =
&rmnet_ipa3_ctx->tether_device[data->device_type].
@@ -4022,6 +4032,21 @@
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(
@@ -4078,6 +4103,9 @@
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;
@@ -4149,6 +4177,9 @@
}
}
+ 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);