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

Commit 18819576 authored by Karthikeyan Ramasubramanian's avatar Karthikeyan Ramasubramanian
Browse files

net: ipc_router: Remove registered server when an endpoint exits



When an endpoint gets released, remove the server registered with that
endpoint. This will reduce the number of messages being exchanged when
an endpoint hosting a server exits.

Change-Id: Idd539f92b2d11e57eec81265964c465b0782d406
Signed-off-by: default avatarKarthikeyan Ramasubramanian <kramasub@codeaurora.org>
parent 1315c860
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -2018,12 +2018,21 @@ static int process_rmv_server_msg(struct msm_ipc_router_xprt_info *xprt_info,
			union rr_control_msg *msg, struct rr_packet *pkt)
{
	struct msm_ipc_server *server;
	struct msm_ipc_router_remote_port *rport_ptr;

	RR("o REMOVE_SERVER service=%08x:%d\n",
	    msg->srv.service, msg->srv.instance);
	down_write(&server_list_lock_lha2);
	server = msm_ipc_router_lookup_server(msg->srv.service,
			msg->srv.instance, msg->srv.node_id, msg->srv.port_id);

	down_write(&routing_table_lock_lha3);
	rport_ptr = msm_ipc_router_lookup_remote_port(msg->srv.node_id,
						      msg->srv.port_id);
	if (rport_ptr && rport_ptr->server == server)
		rport_ptr->server = NULL;
	up_write(&routing_table_lock_lha3);

	if (server) {
		msm_ipc_router_destroy_server(server, msg->srv.node_id,
					      msg->srv.port_id);
@@ -2045,12 +2054,17 @@ static int process_rmv_client_msg(struct msm_ipc_router_xprt_info *xprt_info,
	struct msm_ipc_router_remote_port *rport_ptr;

	RR("o REMOVE_CLIENT id=%d:%08x\n", msg->cli.node_id, msg->cli.port_id);
	down_write(&server_list_lock_lha2);
	down_write(&routing_table_lock_lha3);
	rport_ptr = msm_ipc_router_lookup_remote_port(msg->cli.node_id,
						      msg->cli.port_id);
	if (rport_ptr)
	if (rport_ptr) {
		if (rport_ptr->server)
			cleanup_rmt_server(NULL, rport_ptr);
		msm_ipc_router_destroy_remote_port(rport_ptr);
	}
	up_write(&routing_table_lock_lha3);
	up_write(&server_list_lock_lha2);

	relay_ctl_msg(xprt_info, msg);
	post_control_ports(pkt);