Loading include/linux/ipc_router_xprt.h +3 −1 Original line number Diff line number Diff line /* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2015, 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 Loading Loading @@ -100,6 +100,7 @@ struct rr_opt_hdr { * @pkt_fragment_q: Queue of SKBs containing payload. * @length: Length of data in the chain of SKBs * @ref: Reference count for the packet. * @ws_need: Flag to check wakeup soruce need */ struct rr_packet { struct list_head list; Loading @@ -108,6 +109,7 @@ struct rr_packet { struct sk_buff_head *pkt_fragment_q; uint32_t length; struct kref ref; bool ws_need; }; /** Loading net/ipc_router/ipc_router_core.c +48 −12 Original line number Diff line number Diff line Loading @@ -216,6 +216,25 @@ enum { UP, }; /** * is_sensor_port() - Check if the remote port is sensor service or not * @rport: Pointer to the remote port. * * Return: true if the remote port is sensor service else false. */ static int is_sensor_port(struct msm_ipc_router_remote_port *rport) { u32 svcid = 0; if (rport && rport->server) { svcid = rport->server->name.service; if (svcid == 400 || (svcid >= 256 && svcid <= 320)) return true; } return false; } static void init_routing_table(void) { int i; Loading Loading @@ -1165,6 +1184,7 @@ static int post_pkt_to_port(struct msm_ipc_port *port_ptr, } mutex_lock(&port_ptr->port_rx_q_lock_lhc3); if (pkt->ws_need) __pm_stay_awake(port_ptr->port_rx_ws); list_add_tail(&temp_pkt->list, &port_ptr->port_rx_q); wake_up(&port_ptr->port_rx_wait_q); Loading Loading @@ -2718,7 +2738,6 @@ static void do_read_data(struct work_struct *work) struct rr_packet *pkt = NULL; struct msm_ipc_port *port_ptr; struct msm_ipc_router_remote_port *rport_ptr; int ret; struct msm_ipc_router_xprt_info *xprt_info = container_of(work, Loading @@ -2726,16 +2745,7 @@ static void do_read_data(struct work_struct *work) read_data); while ((pkt = rr_read(xprt_info)) != NULL) { if (pkt->length < calc_rx_header_size(xprt_info) || pkt->length > MAX_IPC_PKT_SIZE) { IPC_RTR_ERR("%s: Invalid pkt length %d\n", __func__, pkt->length); goto read_next_pkt1; } ret = extract_header(pkt); if (ret < 0) goto read_next_pkt1; hdr = &(pkt->hdr); if ((hdr->dst_node_id != IPC_ROUTER_NID_LOCAL) && Loading Loading @@ -4167,6 +4177,7 @@ void msm_ipc_router_xprt_notify(struct msm_ipc_router_xprt *xprt, { struct msm_ipc_router_xprt_info *xprt_info = xprt->priv; struct msm_ipc_router_xprt_work *xprt_work; struct msm_ipc_router_remote_port *rport_ptr = NULL; struct rr_packet *pkt; int ret; Loading Loading @@ -4219,9 +4230,34 @@ void msm_ipc_router_xprt_notify(struct msm_ipc_router_xprt *xprt, if (!pkt) return; if (pkt->length < calc_rx_header_size(xprt_info) || pkt->length > MAX_IPC_PKT_SIZE) { IPC_RTR_ERR("%s: Invalid pkt length %d\n", __func__, pkt->length); release_pkt(pkt); return; } ret = extract_header(pkt); if (ret < 0) { release_pkt(pkt); return; } pkt->ws_need = true; if (pkt->hdr.type == IPC_ROUTER_CTRL_CMD_DATA) rport_ptr = ipc_router_get_rport_ref(pkt->hdr.src_node_id, pkt->hdr.src_port_id); mutex_lock(&xprt_info->rx_lock_lhb2); list_add_tail(&pkt->list, &xprt_info->pkt_list); /* check every pkt is from SENSOR services or not*/ if (is_sensor_port(rport_ptr)) pkt->ws_need = false; else __pm_stay_awake(&xprt_info->ws); mutex_unlock(&xprt_info->rx_lock_lhb2); queue_work(xprt_info->workqueue, &xprt_info->read_data); } Loading Loading
include/linux/ipc_router_xprt.h +3 −1 Original line number Diff line number Diff line /* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2011-2015, 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 Loading Loading @@ -100,6 +100,7 @@ struct rr_opt_hdr { * @pkt_fragment_q: Queue of SKBs containing payload. * @length: Length of data in the chain of SKBs * @ref: Reference count for the packet. * @ws_need: Flag to check wakeup soruce need */ struct rr_packet { struct list_head list; Loading @@ -108,6 +109,7 @@ struct rr_packet { struct sk_buff_head *pkt_fragment_q; uint32_t length; struct kref ref; bool ws_need; }; /** Loading
net/ipc_router/ipc_router_core.c +48 −12 Original line number Diff line number Diff line Loading @@ -216,6 +216,25 @@ enum { UP, }; /** * is_sensor_port() - Check if the remote port is sensor service or not * @rport: Pointer to the remote port. * * Return: true if the remote port is sensor service else false. */ static int is_sensor_port(struct msm_ipc_router_remote_port *rport) { u32 svcid = 0; if (rport && rport->server) { svcid = rport->server->name.service; if (svcid == 400 || (svcid >= 256 && svcid <= 320)) return true; } return false; } static void init_routing_table(void) { int i; Loading Loading @@ -1165,6 +1184,7 @@ static int post_pkt_to_port(struct msm_ipc_port *port_ptr, } mutex_lock(&port_ptr->port_rx_q_lock_lhc3); if (pkt->ws_need) __pm_stay_awake(port_ptr->port_rx_ws); list_add_tail(&temp_pkt->list, &port_ptr->port_rx_q); wake_up(&port_ptr->port_rx_wait_q); Loading Loading @@ -2718,7 +2738,6 @@ static void do_read_data(struct work_struct *work) struct rr_packet *pkt = NULL; struct msm_ipc_port *port_ptr; struct msm_ipc_router_remote_port *rport_ptr; int ret; struct msm_ipc_router_xprt_info *xprt_info = container_of(work, Loading @@ -2726,16 +2745,7 @@ static void do_read_data(struct work_struct *work) read_data); while ((pkt = rr_read(xprt_info)) != NULL) { if (pkt->length < calc_rx_header_size(xprt_info) || pkt->length > MAX_IPC_PKT_SIZE) { IPC_RTR_ERR("%s: Invalid pkt length %d\n", __func__, pkt->length); goto read_next_pkt1; } ret = extract_header(pkt); if (ret < 0) goto read_next_pkt1; hdr = &(pkt->hdr); if ((hdr->dst_node_id != IPC_ROUTER_NID_LOCAL) && Loading Loading @@ -4167,6 +4177,7 @@ void msm_ipc_router_xprt_notify(struct msm_ipc_router_xprt *xprt, { struct msm_ipc_router_xprt_info *xprt_info = xprt->priv; struct msm_ipc_router_xprt_work *xprt_work; struct msm_ipc_router_remote_port *rport_ptr = NULL; struct rr_packet *pkt; int ret; Loading Loading @@ -4219,9 +4230,34 @@ void msm_ipc_router_xprt_notify(struct msm_ipc_router_xprt *xprt, if (!pkt) return; if (pkt->length < calc_rx_header_size(xprt_info) || pkt->length > MAX_IPC_PKT_SIZE) { IPC_RTR_ERR("%s: Invalid pkt length %d\n", __func__, pkt->length); release_pkt(pkt); return; } ret = extract_header(pkt); if (ret < 0) { release_pkt(pkt); return; } pkt->ws_need = true; if (pkt->hdr.type == IPC_ROUTER_CTRL_CMD_DATA) rport_ptr = ipc_router_get_rport_ref(pkt->hdr.src_node_id, pkt->hdr.src_port_id); mutex_lock(&xprt_info->rx_lock_lhb2); list_add_tail(&pkt->list, &xprt_info->pkt_list); /* check every pkt is from SENSOR services or not*/ if (is_sensor_port(rport_ptr)) pkt->ws_need = false; else __pm_stay_awake(&xprt_info->ws); mutex_unlock(&xprt_info->rx_lock_lhb2); queue_work(xprt_info->workqueue, &xprt_info->read_data); } Loading