Merge "slim-msm: Optimize descriptor reading in the rx path"

This commit is contained in:
Linux Build Service Account 2015-10-30 16:36:12 -07:00 committed by Gerrit - the friendly Code Review server
commit ab7c5d37ad
2 changed files with 27 additions and 12 deletions

View File

@ -684,10 +684,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) {
@ -695,24 +694,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)
@ -763,8 +772,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;

View File

@ -306,6 +306,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 {