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> Signed-off-by: Chris Lew <quic_clew@quicinc.com>
This commit is contained in:
parent
188c64d260
commit
43c9f45b6a
@ -15,6 +15,7 @@
|
||||
#include <linux/uidgid.h>
|
||||
|
||||
#include <net/sock.h>
|
||||
#include <uapi/linux/sched/types.h>
|
||||
|
||||
#include "qrtr.h"
|
||||
|
||||
@ -807,13 +808,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;
|
||||
@ -836,6 +840,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, ¶m);
|
||||
|
||||
INIT_RADIX_TREE(&node->qrtr_tx_flow, GFP_KERNEL);
|
||||
mutex_init(&node->qrtr_tx_lock);
|
||||
|
@ -82,7 +82,7 @@ static int qcom_mhi_qrtr_send(struct qrtr_endpoint *ep, struct sk_buff *skb)
|
||||
}
|
||||
|
||||
static void qrtr_mhi_of_parse(struct mhi_device *mhi_dev,
|
||||
u32 *net_id)
|
||||
u32 *net_id, bool *rt)
|
||||
{
|
||||
struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl;
|
||||
struct device_node *np = NULL;
|
||||
@ -103,6 +103,7 @@ static void qrtr_mhi_of_parse(struct mhi_device *mhi_dev,
|
||||
rc = of_property_read_u32(np, "qcom,net-id", &nid);
|
||||
if (!rc)
|
||||
*net_id = nid;
|
||||
*rt = of_property_read_bool(np, "qcom,low-latency");
|
||||
}
|
||||
}
|
||||
of_node_put(np);
|
||||
@ -113,6 +114,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);
|
||||
@ -126,9 +128,9 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
|
||||
|
||||
dev_set_drvdata(&mhi_dev->dev, qdev);
|
||||
|
||||
qrtr_mhi_of_parse(mhi_dev, &net_id);
|
||||
qrtr_mhi_of_parse(mhi_dev, &net_id, &rt);
|
||||
|
||||
rc = qrtr_endpoint_register(&qdev->ep, net_id);
|
||||
rc = qrtr_endpoint_register(&qdev->ep, net_id, rt);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
|
@ -24,7 +24,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);
|
||||
|
||||
|
@ -64,6 +64,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);
|
||||
@ -78,9 +79,11 @@ 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) {
|
||||
dev_err(qdev->dev, "endpoint register failed: %d\n", rc);
|
||||
dev_err(qdev->dev, "endpoint register failed: %d\n", rc, rt);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ static int qrtr_tun_open(struct inode *inode, struct file *filp)
|
||||
|
||||
filp->private_data = tun;
|
||||
|
||||
ret = qrtr_endpoint_register(&tun->ep, QRTR_EP_NET_ID_AUTO);
|
||||
ret = qrtr_endpoint_register(&tun->ep, QRTR_EP_NET_ID_AUTO, 0);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user