msm: ipa3: send usb-connect from rndis-ipa
To resolve the timing issue between usb-driver and android framework, made the change on rndis ipa to send the usb-connect msg when usb-driver connect the IPA pipes. Change-Id: I51de37bc7610cb0a94659c64146f10ed322210b2 Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com> Signed-off-by: Mohammed Javid <mjavid@codeaurora.org> Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
This commit is contained in:
parent
b9806258a2
commit
ef9aa79b43
1 changed files with 47 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -449,6 +449,11 @@ struct rndis_pkt_hdr rndis_template_hdr = {
|
|||
.zeroes = {0},
|
||||
};
|
||||
|
||||
static void rndis_ipa_msg_free_cb(void *buff, u32 len, u32 type)
|
||||
{
|
||||
kfree(buff);
|
||||
}
|
||||
|
||||
/**
|
||||
* rndis_ipa_init() - create network device and initialize internal
|
||||
* data structures
|
||||
|
@ -648,6 +653,8 @@ int rndis_ipa_pipe_connect_notify(u32 usb_to_ipa_hdl,
|
|||
int next_state;
|
||||
int result;
|
||||
unsigned long flags;
|
||||
struct ipa_ecm_msg *rndis_msg;
|
||||
struct ipa_msg_meta msg_meta;
|
||||
|
||||
RNDIS_IPA_LOG_ENTRY();
|
||||
|
||||
|
@ -718,6 +725,26 @@ int rndis_ipa_pipe_connect_notify(u32 usb_to_ipa_hdl,
|
|||
}
|
||||
RNDIS_IPA_DEBUG("netif_carrier_on() was called\n");
|
||||
|
||||
rndis_msg = kzalloc(sizeof(*rndis_msg), GFP_KERNEL);
|
||||
if (!rndis_msg) {
|
||||
result = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
memset(&msg_meta, 0, sizeof(struct ipa_msg_meta));
|
||||
msg_meta.msg_type = ECM_CONNECT;
|
||||
msg_meta.msg_len = sizeof(struct ipa_ecm_msg);
|
||||
strlcpy(rndis_msg->name, rndis_ipa_ctx->net->name,
|
||||
IPA_RESOURCE_NAME_MAX);
|
||||
rndis_msg->ifindex = rndis_ipa_ctx->net->ifindex;
|
||||
|
||||
result = ipa_send_msg(&msg_meta, rndis_msg, rndis_ipa_msg_free_cb);
|
||||
if (result) {
|
||||
RNDIS_IPA_ERROR("fail to send ECM_CONNECT for rndis\n");
|
||||
kfree(rndis_msg);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&rndis_ipa_ctx->state_lock, flags);
|
||||
next_state = rndis_ipa_next_state(rndis_ipa_ctx->state,
|
||||
RNDIS_IPA_CONNECT);
|
||||
|
@ -1165,6 +1192,8 @@ int rndis_ipa_pipe_disconnect_notify(void *private)
|
|||
int outstanding_dropped_pkts;
|
||||
int retval;
|
||||
unsigned long flags;
|
||||
struct ipa_ecm_msg *rndis_msg;
|
||||
struct ipa_msg_meta msg_meta;
|
||||
|
||||
RNDIS_IPA_LOG_ENTRY();
|
||||
|
||||
|
@ -1192,6 +1221,23 @@ int rndis_ipa_pipe_disconnect_notify(void *private)
|
|||
netif_carrier_off(rndis_ipa_ctx->net);
|
||||
RNDIS_IPA_DEBUG("carrier_off notification was sent\n");
|
||||
|
||||
rndis_msg = kzalloc(sizeof(*rndis_msg), GFP_KERNEL);
|
||||
if (!rndis_msg)
|
||||
return -ENOMEM;
|
||||
|
||||
memset(&msg_meta, 0, sizeof(struct ipa_msg_meta));
|
||||
msg_meta.msg_type = ECM_DISCONNECT;
|
||||
msg_meta.msg_len = sizeof(struct ipa_ecm_msg);
|
||||
strlcpy(rndis_msg->name, rndis_ipa_ctx->net->name,
|
||||
IPA_RESOURCE_NAME_MAX);
|
||||
rndis_msg->ifindex = rndis_ipa_ctx->net->ifindex;
|
||||
|
||||
retval = ipa_send_msg(&msg_meta, rndis_msg, rndis_ipa_msg_free_cb);
|
||||
if (retval) {
|
||||
RNDIS_IPA_ERROR("fail to send ECM_DISCONNECT for rndis\n");
|
||||
kfree(rndis_msg);
|
||||
return -EPERM;
|
||||
}
|
||||
netif_stop_queue(rndis_ipa_ctx->net);
|
||||
RNDIS_IPA_DEBUG("queue stopped\n");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue