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

Commit e8e017d7 authored by Sujeev Dias's avatar Sujeev Dias Committed by Gerrit - the friendly Code Review server
Browse files

mhi: dev: uci: chain large transfers together



If we're transferring a large (> mtu) packet, then chain the
descriptors together to reduce number of completion events.

CRs-Fixed: 2254571
Change-Id: I015b9b998461566541ddc1e660ccc4fc5991f84e
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent c14114cf
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -251,7 +251,7 @@ static ssize_t mhi_uci_write(struct file *file,
	struct mhi_device *mhi_dev = uci_dev->mhi_dev;
	struct uci_chan *uci_chan = &uci_dev->ul_chan;
	size_t bytes_xfered = 0;
	int ret;
	int ret, nr_avail;

	if (!buf || !count)
		return -EINVAL;
@@ -275,8 +275,8 @@ static ssize_t mhi_uci_write(struct file *file,
		/* wait for free descriptors */
		ret = wait_event_interruptible(uci_chan->wq,
			(!uci_dev->enabled) ||
			mhi_get_no_free_descriptors
					       (mhi_dev, DMA_TO_DEVICE) > 0);
			(nr_avail = mhi_get_no_free_descriptors(mhi_dev,
							DMA_TO_DEVICE)) > 0);

		if (ret == -ERESTARTSYS) {
			MSG_LOG("Exit signal caught for node\n");
@@ -297,7 +297,13 @@ static ssize_t mhi_uci_write(struct file *file,
		}

		spin_lock_bh(&uci_chan->lock);
		flags = (count - xfer_size) ? MHI_EOB : MHI_EOT;

		/* if ring is full after this force EOT */
		if (nr_avail > 1 && (count - xfer_size))
			flags = MHI_CHAIN;
		else
			flags = MHI_EOT;

		if (uci_dev->enabled)
			ret = mhi_queue_transfer(mhi_dev, DMA_TO_DEVICE, kbuf,
						 xfer_size, flags);