Commit ff1586a7 authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Greg Kroah-Hartman

mei: enqueue consecutive reads

The FW supports only one pending read per host client, in order to
support  issuing of consecutive reads the driver  queues read requests
internally and send them to the firmware after pending one has
completed.
Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3030dc05
...@@ -209,6 +209,9 @@ static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -209,6 +209,9 @@ static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb,
int slots; int slots;
int ret; int ret;
if (!list_empty(&cl->rd_pending))
return 0;
msg_slots = mei_data2slots(sizeof(struct hbm_flow_control)); msg_slots = mei_data2slots(sizeof(struct hbm_flow_control));
slots = mei_hbuf_empty_slots(dev); slots = mei_hbuf_empty_slots(dev);
......
...@@ -139,9 +139,8 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, ...@@ -139,9 +139,8 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
struct mei_cl *cl = file->private_data; struct mei_cl *cl = file->private_data;
struct mei_device *dev; struct mei_device *dev;
struct mei_cl_cb *cb = NULL; struct mei_cl_cb *cb = NULL;
bool nonblock = !!(file->f_flags & O_NONBLOCK);
int rets; int rets;
int err;
if (WARN_ON(!cl || !cl->dev)) if (WARN_ON(!cl || !cl->dev))
return -ENODEV; return -ENODEV;
...@@ -177,25 +176,29 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, ...@@ -177,25 +176,29 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
if (*offset > 0) if (*offset > 0)
*offset = 0; *offset = 0;
err = mei_cl_read_start(cl, length, file); rets = mei_cl_read_start(cl, length, file);
if (err && err != -EBUSY) { if (rets && rets != -EBUSY) {
cl_dbg(dev, cl, "mei start read failure status = %d\n", err); cl_dbg(dev, cl, "mei start read failure status = %d\n", rets);
rets = err;
goto out; goto out;
} }
/* synchronized under device mutex */ if (nonblock) {
if (!waitqueue_active(&cl->rx_wait)) { rets = -EAGAIN;
if (file->f_flags & O_NONBLOCK) { goto out;
rets = -EAGAIN; }
goto out;
} if (rets == -EBUSY &&
!mei_cl_enqueue_ctrl_wr_cb(cl, length, MEI_FOP_READ, file)) {
rets = -ENOMEM;
goto out;
}
do {
mutex_unlock(&dev->device_lock); mutex_unlock(&dev->device_lock);
if (wait_event_interruptible(cl->rx_wait, if (wait_event_interruptible(cl->rx_wait,
(!list_empty(&cl->rd_completed)) || (!list_empty(&cl->rd_completed)) ||
(!mei_cl_is_connected(cl)))) { (!mei_cl_is_connected(cl)))) {
if (signal_pending(current)) if (signal_pending(current))
return -EINTR; return -EINTR;
...@@ -207,13 +210,9 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, ...@@ -207,13 +210,9 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
rets = -ENODEV; rets = -ENODEV;
goto out; goto out;
} }
}
cb = mei_cl_read_cb(cl, file); cb = mei_cl_read_cb(cl, file);
if (!cb) { } while (!cb);
rets = 0;
goto out;
}
copy_buffer: copy_buffer:
/* now copy the data to user space */ /* now copy the data to user space */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment