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

Commit 61218504 authored by Chris Lew's avatar Chris Lew
Browse files

net: qrtr: Move tx_resume handling to work context



There will be non-atomic work associated with receiving the tx resume
packet from the remote. Move the handling to work function context in
preparation for the non-blocking socket blocking improvement.

Change-Id: I2389bdcffba068258650bfbb579f8cb98a0ac928
Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
parent bb300aed
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ static void __qrtr_node_release(struct kref *kref)
		kfree(*slot);
	}

	cancel_work_sync(&node->work);
	skb_queue_purge(&node->rx_queue);
	kfree(node);
}
@@ -552,7 +553,8 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len)
	}

	if (cb->type == QRTR_TYPE_RESUME_TX) {
		qrtr_tx_resume(node, skb);
		skb_queue_tail(&node->rx_queue, skb);
		schedule_work(&node->work);
	} else {
		ipc = qrtr_port_lookup(cb->dst_port);
		if (!ipc)
@@ -597,6 +599,20 @@ static struct sk_buff *qrtr_alloc_ctrl_packet(struct qrtr_ctrl_pkt **pkt)
	return skb;
}

/* Handle not atomic operations for a received packet. */
static void qrtr_node_rx_work(struct work_struct *work)
{
	struct qrtr_node *node = container_of(work, struct qrtr_node, work);
	struct sk_buff *skb;

	while ((skb = skb_dequeue(&node->rx_queue)) != NULL) {
		struct qrtr_cb *cb = (struct qrtr_cb *)skb->cb;

		if (cb->type == QRTR_TYPE_RESUME_TX)
			qrtr_tx_resume(node, skb);
	}
}

/**
 * qrtr_endpoint_register() - register a new endpoint
 * @ep: endpoint to register
@@ -616,6 +632,7 @@ int qrtr_endpoint_register(struct qrtr_endpoint *ep, unsigned int nid)
	if (!node)
		return -ENOMEM;

	INIT_WORK(&node->work, qrtr_node_rx_work);
	kref_init(&node->ref);
	mutex_init(&node->ep_lock);
	skb_queue_head_init(&node->rx_queue);