net: qrtr: Make wakeup timeout configurable

The qrtr driver can guarantee that the packet gets queued to the socket
but cannot guarantee the client process will get time to run if auto
sleep is enabled. This config will help mitigate missed packets on
systems where auto sleep is too aggressive.

Use the pm_wakeup_ws_event() api so a hard wakeup can be specified.
This will ensure a resume occurs if the data coming in happens while
the device is going into suspend.

Change-Id: Ic596e06e585b3479a6faa1d0210c016fc9138c6e
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
This commit is contained in:
Chris Lew 2022-10-27 11:07:54 -07:00
parent 533788bfca
commit e2b39c0d6e
2 changed files with 14 additions and 2 deletions

View File

@ -25,6 +25,17 @@ config QRTR_NODE_ID
but the name service application is not priveleged enough to use
netlink sockets.
config QRTR_WAKEUP_MS
int "QRTR Wakeup timeout"
default 0
help
This option is used to configure the wakesource timeout that QRTR
should take when a packet is received. The qrtr driver can guarantee
that the packet gets queued to the socket but cannot guarantee the
client process will get time to run if auto sleep is enabled. This
config will help mitigate missed packets on systems where auto sleep
is aggressive.
config QRTR_SMD
tristate "SMD IPC Router channels"
depends on RPMSG || (COMPILE_TEST && RPMSG=n)

View File

@ -114,6 +114,7 @@ static inline struct qrtr_sock *qrtr_sk(struct sock *sk)
}
static unsigned int qrtr_local_nid = CONFIG_QRTR_NODE_ID;
static unsigned int qrtr_wakeup_ms = CONFIG_QRTR_WAKEUP_MS;
/* for node ids */
static RADIX_TREE(qrtr_nodes, GFP_ATOMIC);
@ -732,7 +733,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len)
if (cb->type != QRTR_TYPE_DATA || cb->dst_node != qrtr_local_nid) {
skb_queue_tail(&node->rx_queue, skb);
kthread_queue_work(&node->kworker, &node->read_data);
__pm_wakeup_event(node->ws, 0);
pm_wakeup_ws_event(node->ws, qrtr_wakeup_ms, true);
} else {
ipc = qrtr_port_lookup(cb->dst_port);
if (!ipc) {
@ -747,7 +748,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len)
/* Force wakeup for all packets except for sensors */
if (node->nid != 9)
__pm_wakeup_event(node->ws, 0);
pm_wakeup_ws_event(node->ws, qrtr_wakeup_ms, true);
qrtr_port_put(ipc);
}