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

Commit acb1a2e0 authored by Naveen Kaje's avatar Naveen Kaje Committed by Gerrit - the friendly Code Review server
Browse files

slim-msm: Optimize descriptor reading in the rx path



Read and process as many RX DMA descriptors as possible
in a single callback. Handle the case where partial messages
are received and process them later when the complete message
arrives.

Change-Id: I40beb701874d1d2fafc3acf69c144b654ebae74b
Signed-off-by: default avatarNaveen Kaje <nkaje@codeaurora.org>
parent d9642cc2
Loading
Loading
Loading
Loading
+25 −12
Original line number Diff line number Diff line
@@ -597,10 +597,9 @@ msm_slim_rx_msgq_event(struct msm_slim_ctrl *dev, struct sps_event_notify *ev)
static void
msm_slim_handle_rx(struct msm_slim_ctrl *dev, struct sps_event_notify *ev)
{
	int ret = 0, index = 0;
	int ret = 0;
	u32 mc = 0;
	u32 mt = 0;
	u32 buffer[10];
	u8 msg_len = 0;

	if (ev->event_id != SPS_EVENT_EOT) {
@@ -608,24 +607,34 @@ msm_slim_handle_rx(struct msm_slim_ctrl *dev, struct sps_event_notify *ev)
					__func__, ev->event_id);
		return;
	}

	do {
		ret = msm_slim_rx_msgq_get(dev, buffer, index);
		if (ret) {
		ret = msm_slim_rx_msgq_get(dev, dev->current_rx_buf,
					   dev->current_count);
		if (ret == -ENODATA) {
			return;
		} else if (ret) {
			SLIM_ERR(dev, "rx_msgq_get() failed 0x%x\n",
								ret);
			return;
		}

		/* Traverse first byte of message for message length */
		if (index++ == 0) {
			msg_len = *buffer & 0x1F;
			mt = (buffer[0] >> 5) & 0x7;
			mc = (buffer[0] >> 8) & 0xff;
		if (dev->current_count++ == 0) {
			msg_len = *(dev->current_rx_buf) & 0x1F;
			mt = (*(dev->current_rx_buf) >> 5) & 0x7;
			mc = (*(dev->current_rx_buf) >> 8) & 0xff;
			dev_dbg(dev->dev, "MC: %x, MT: %x\n", mc, mt);
		}

		msg_len = (msg_len < 4) ? 0 : (msg_len - 4);
	} while (msg_len);
	dev->rx_slim(dev, (u8 *)buffer);

		if (!msg_len) {
			dev->rx_slim(dev, (u8 *)dev->current_rx_buf);
			dev->current_count = 0;
		}

	} while (1);
}

static void msm_slim_rx_msgq_cb(struct sps_event_notify *notify)
@@ -676,8 +685,12 @@ int msm_slim_rx_msgq_get(struct msm_slim_ctrl *dev, u32 *data, int offset)
	addr = DESC_FULL_ADDR(iovec.flags, iovec.addr);
	pr_debug("iovec = (0x%x 0x%x 0x%x)\n",
		iovec.addr, iovec.size, iovec.flags);
	BUG_ON(addr < mem->phys_base);
	BUG_ON(addr >= mem->phys_base + mem->size);

	/* no more descriptors */
	if (!ret && (iovec.addr == 0) && (iovec.size == 0)) {
		ret = -ENODATA;
		goto err_exit;
	}

	/* Calculate buffer index */
	index = (addr - mem->phys_base) / 4;
+2 −0
Original line number Diff line number Diff line
@@ -288,6 +288,8 @@ struct msm_slim_ctrl {
	bool			sysfs_created;
	void			*ipc_slimbus_log;
	void (*rx_slim)(struct msm_slim_ctrl *dev, u8 *buf);
	u32			current_rx_buf[10];
	int			current_count;
};

struct msm_sat_chan {