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: Sujeev Dias <sdias@codeaurora.org>
This commit is contained in:
Sujeev Dias 2018-05-30 18:13:47 -07:00 committed by Gerrit - the friendly Code Review server
parent c14114cf09
commit e8e017d7da

View File

@ -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);