Merge "net: qrtr: Make qrtr rx threads as RT priorities"

This commit is contained in:
qctecmdr 2019-10-14 23:28:37 -07:00 • committed by Gerrit - the friendly Code Review server
commit 4f0ac1e0c8
4 changed files with 15 additions and 5 deletions

View file

@ -15,6 +15,7 @@
#include <linux/uidgid.h>
#include <net/sock.h>
#include <uapi/linux/sched/types.h>
#include "qrtr.h"
@ -843,13 +844,16 @@ static void qrtr_node_rx_work(struct kthread_work *work)
* qrtr_endpoint_register() - register a new endpoint
* @ep: endpoint to register
* @nid: desired node id; may be QRTR_EP_NID_AUTO for auto-assignment
* @rt: flag to notify real time low latency endpoint
* Return: 0 on success; negative error code on failure
*
* The specified endpoint must have the xmit function pointer set on call.
*/
int qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int net_id)
int qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int net_id,
bool rt)
{
struct qrtr_node *node;
struct sched_param param = {.sched_priority = 1};
if (!ep || !ep->xmit)
return -EINVAL;
@ -872,6 +876,8 @@ int qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int net_id)
kfree(node);
return -ENOMEM;
}
if (rt)
sched_setscheduler(node->task, SCHED_FIFO, &param);
mutex_init(&node->qrtr_tx_lock);
INIT_RADIX_TREE(&node->qrtr_tx_flow, GFP_KERNEL);

View file

@ -26,7 +26,8 @@ struct qrtr_endpoint {
struct qrtr_node *node;
};
int qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int net_id);
int qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int net_id,
bool rt);
void qrtr_endpoint_unregister(struct qrtr_endpoint *ep);

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2015, Sony Mobile Communications Inc.
* Copyright (c) 2013, 2018 The Linux Foundation. All rights reserved.
* Copyright (c) 2013, 2018-2019 The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@ -61,6 +61,7 @@ static int qcom_smd_qrtr_probe(struct rpmsg_device *rpdev)
{
struct qrtr_smd_dev *qdev;
u32 net_id;
bool rt;
int rc;
qdev = devm_kzalloc(&rpdev->dev, sizeof(*qdev), GFP_KERNEL);
@ -75,7 +76,9 @@ static int qcom_smd_qrtr_probe(struct rpmsg_device *rpdev)
if (rc < 0)
net_id = QRTR_EP_NET_ID_AUTO;
rc = qrtr_endpoint_register(&qdev->ep, net_id);
rt = of_property_read_bool(rpdev->dev.of_node, "qcom,low-latency");
rc = qrtr_endpoint_register(&qdev->ep, net_id, rt);
if (rc)
return rc;

View file

@ -43,7 +43,7 @@ static int qrtr_tun_open(struct inode *inode, struct file *filp)
filp->private_data = tun;
return qrtr_endpoint_register(&tun->ep, QRTR_EP_NET_ID_AUTO);
return qrtr_endpoint_register(&tun->ep, QRTR_EP_NET_ID_AUTO, 0);
}
static ssize_t qrtr_tun_read_iter(struct kiocb *iocb, struct iov_iter *to)