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

mei: prevent queuing new flow control credit.

The MEI  FW can receive only one flow control for read.
Currently the driver only checks if a flow control credit was already
sent and read is pending in the rd_pending queue, but it also has to
check if flow control credit already queued in the write control queue
to prevent sending more than one flow control credits.
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 2bcfdc23
...@@ -1421,6 +1421,25 @@ int mei_cl_notify_get(struct mei_cl *cl, bool block, bool *notify_ev) ...@@ -1421,6 +1421,25 @@ int mei_cl_notify_get(struct mei_cl *cl, bool block, bool *notify_ev)
return 0; return 0;
} }
/**
* mei_cl_is_read_fc_cb - check if read cb is waiting for flow control
* for given host client
*
* @cl: host client
*
* Return: true, if found at least one cb.
*/
static bool mei_cl_is_read_fc_cb(struct mei_cl *cl)
{
struct mei_device *dev = cl->dev;
struct mei_cl_cb *cb;
list_for_each_entry(cb, &dev->ctrl_wr_list.list, list)
if (cb->fop_type == MEI_FOP_READ && cb->cl == cl)
return true;
return false;
}
/** /**
* mei_cl_read_start - the start read client message function. * mei_cl_read_start - the start read client message function.
* *
...@@ -1445,7 +1464,7 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length, struct file *fp) ...@@ -1445,7 +1464,7 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length, struct file *fp)
return -ENODEV; return -ENODEV;
/* HW currently supports only one pending read */ /* HW currently supports only one pending read */
if (!list_empty(&cl->rd_pending)) if (!list_empty(&cl->rd_pending) || mei_cl_is_read_fc_cb(cl))
return -EBUSY; return -EBUSY;
if (!mei_me_cl_is_active(cl->me_cl)) { if (!mei_me_cl_is_active(cl->me_cl)) {
......
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