net: qrtr: Make qrtr rx threads as RT priorities

To support high priority clients like sensor use cases in all system
conditions elevating the router reader threads to RT priorities based
on configuration.

Change-Id: I6f46097f6678f2e00c3ec8872b208d773c377224
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
This commit is contained in:
Arun Kumar Neelakantam 2019-04-01 15:26:54 +05:30 committed by Chris Lew
parent 5219be0fd7
commit 4a6eb4b3e2
6 changed files with 21 additions and 8 deletions

View File

@ -341,7 +341,7 @@ static int qrtr_fifo_xprt_probe(struct platform_device *pdev)
qrtr_fifo_config_init(xprtp);
xprtp->ep.xmit = xprt_write;
ret = qrtr_endpoint_register(&xprtp->ep, QRTR_EP_NID_AUTO);
ret = qrtr_endpoint_register(&xprtp->ep, QRTR_EP_NID_AUTO, false);
if (ret)
return ret;

View File

@ -145,6 +145,7 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
{
struct qrtr_mhi_dev *qdev;
u32 net_id;
bool rt;
int rc;
qdev = devm_kzalloc(&mhi_dev->dev, sizeof(*qdev), GFP_KERNEL);
@ -160,10 +161,12 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
if (rc < 0)
net_id = QRTR_EP_NET_ID_AUTO;
rt = of_property_read_bool(mhi_dev->dev.of_node, "qcom,low-latency");
INIT_LIST_HEAD(&qdev->ul_pkts);
spin_lock_init(&qdev->ul_lock);
rc = qrtr_endpoint_register(&qdev->ep, net_id);
rc = qrtr_endpoint_register(&qdev->ep, net_id, rt);
if (rc)
return rc;

View File

@ -22,6 +22,7 @@
#include <linux/uidgid.h>
#include <net/sock.h>
#include <uapi/linux/sched/types.h>
#include "qrtr.h"
@ -921,13 +922,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;
@ -950,6 +954,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

@ -60,6 +60,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);
@ -74,7 +75,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

@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. */
#include <linux/kthread.h>
#include <linux/module.h>
@ -213,7 +213,7 @@ static int qcom_usb_qrtr_probe(struct usb_interface *interface,
init_usb_anchor(&qdev->submitted);
rc = qrtr_endpoint_register(&qdev->ep, QRTR_EP_NID_AUTO);
rc = qrtr_endpoint_register(&qdev->ep, QRTR_EP_NID_AUTO, false);
if (rc)
return rc;
@ -263,7 +263,7 @@ static int qcom_usb_qrtr_reset_resume(struct usb_interface *intf)
int rc = 0;
qrtr_endpoint_unregister(&qdev->ep);
rc = qrtr_endpoint_register(&qdev->ep, QRTR_EP_NID_AUTO);
rc = qrtr_endpoint_register(&qdev->ep, QRTR_EP_NID_AUTO, false);
if (rc)
return rc;