msm: ipc: Handle the Resume_Tx events from remote endpoints

To prevent the QMI clients from flooding the remote services, IPC Router
transport supports a flow control mechanism. When the IPC Router
transport returns -EAGAIN during message transmission, queue the packet
into client's pending transaction queue for transmission during later
time. In addition, handle RESUME_TX events from the remote services and
use that event to transmit the packets in pending transaction queue.

Change-Id: Ib24256fd0dbeecb9d96ea03ffd86afe2b4cc1483
Signed-off-by: Zaheerulla Meer <zmeer@codeaurora.org>
diff --git a/arch/arm/mach-msm/ipc_router.c b/arch/arm/mach-msm/ipc_router.c
index ef763d7..b0a6dfa 100644
--- a/arch/arm/mach-msm/ipc_router.c
+++ b/arch/arm/mach-msm/ipc_router.c
@@ -735,8 +735,14 @@
 				&rport_ptr->resume_tx_port_list, list) {
 		local_port =
 			msm_ipc_router_lookup_local_port(rtx_port->port_id);
-		if (local_port)
+		if (local_port && local_port->notify)
+			local_port->notify(MSM_IPC_ROUTER_RESUME_TX,
+						local_port->priv);
+		else if (local_port)
 			post_pkt_to_port(local_port, pkt, 1);
+		else
+			pr_err("%s: Local Port %d not Found",
+				__func__, rtx_port->port_id);
 		list_del(&rtx_port->list);
 		kfree(rtx_port);
 	}
@@ -2216,6 +2222,8 @@
 	}
 
 	ret = msm_ipc_router_send_to(src, out_skb_head, dest);
+	if (ret == -EAGAIN)
+		return ret;
 	if (ret < 0) {
 		pr_err("%s: msm_ipc_router_send_to failed - ret: %d\n",
 			__func__, ret);