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

Commit 1e3777b2 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: ipc_router: Remove wakeup-source for Sensor ports"

parents 760df657 029e846b
Loading
Loading
Loading
Loading
+49 −15
Original line number Diff line number Diff line
@@ -223,6 +223,25 @@ void msm_ipc_router_set_ws_allowed(bool flag)
	is_wakeup_source_allowed = flag;
}

/**
 * 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;
@@ -2729,7 +2748,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,
@@ -2737,16 +2755,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) &&
@@ -4173,6 +4182,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;

@@ -4223,9 +4233,32 @@ 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 = false;

	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 and
	 * avoid holding both edge and port specific wake-up sources
	 */
	if (!is_sensor_port(rport_ptr)) {
		if (!xprt_info->dynamic_ws) {
			__pm_stay_awake(&xprt_info->ws);
			pkt->ws_need = true;
@@ -4235,6 +4268,7 @@ void msm_ipc_router_xprt_notify(struct msm_ipc_router_xprt *xprt,
				pkt->ws_need = true;
			}
		}
	}
	mutex_unlock(&xprt_info->rx_lock_lhb2);
	queue_work(xprt_info->workqueue, &xprt_info->read_data);
}