mirror of
https://github.com/torvalds/linux.git
synced 2024-12-21 10:31:54 +00:00
mei: add read callback on demand for fixed_address clients
The Fixed address clients do not work with the flow control, and the packet RX callback was allocated upon TX with anticipation of a following RX. This won't work if the clients with unsolicited Rx. Rather than preparing read callback upon a write we allocate one directly on the reciev path if one doesn't exists. Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
97d549b4d5
commit
a808c80cda
@ -1145,26 +1145,19 @@ err:
|
|||||||
* mei_cl_flow_ctrl_creds - checks flow_control credits for cl.
|
* mei_cl_flow_ctrl_creds - checks flow_control credits for cl.
|
||||||
*
|
*
|
||||||
* @cl: host client
|
* @cl: host client
|
||||||
* @fp: the file pointer associated with the pointer
|
|
||||||
*
|
*
|
||||||
* Return: 1 if mei_flow_ctrl_creds >0, 0 - otherwise.
|
* Return: 1 if mei_flow_ctrl_creds >0, 0 - otherwise.
|
||||||
*/
|
*/
|
||||||
static int mei_cl_flow_ctrl_creds(struct mei_cl *cl, const struct file *fp)
|
static int mei_cl_flow_ctrl_creds(struct mei_cl *cl)
|
||||||
{
|
{
|
||||||
int rets;
|
|
||||||
|
|
||||||
if (WARN_ON(!cl || !cl->me_cl))
|
if (WARN_ON(!cl || !cl->me_cl))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (cl->mei_flow_ctrl_creds > 0)
|
if (cl->mei_flow_ctrl_creds > 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (mei_cl_is_fixed_address(cl)) {
|
if (mei_cl_is_fixed_address(cl))
|
||||||
rets = mei_cl_read_start(cl, mei_cl_mtu(cl), fp);
|
|
||||||
if (rets && rets != -EBUSY)
|
|
||||||
return rets;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
if (mei_cl_is_single_recv_buf(cl)) {
|
if (mei_cl_is_single_recv_buf(cl)) {
|
||||||
if (cl->me_cl->mei_flow_ctrl_creds > 0)
|
if (cl->me_cl->mei_flow_ctrl_creds > 0)
|
||||||
@ -1537,7 +1530,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
|
|||||||
|
|
||||||
first_chunk = cb->buf_idx == 0;
|
first_chunk = cb->buf_idx == 0;
|
||||||
|
|
||||||
rets = first_chunk ? mei_cl_flow_ctrl_creds(cl, cb->fp) : 1;
|
rets = first_chunk ? mei_cl_flow_ctrl_creds(cl) : 1;
|
||||||
if (rets < 0)
|
if (rets < 0)
|
||||||
return rets;
|
return rets;
|
||||||
|
|
||||||
@ -1643,7 +1636,7 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
|
|||||||
mei_hdr.msg_complete = 0;
|
mei_hdr.msg_complete = 0;
|
||||||
mei_hdr.internal = cb->internal;
|
mei_hdr.internal = cb->internal;
|
||||||
|
|
||||||
rets = mei_cl_flow_ctrl_creds(cl, cb->fp);
|
rets = mei_cl_flow_ctrl_creds(cl);
|
||||||
if (rets < 0)
|
if (rets < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
@ -107,8 +107,14 @@ int mei_cl_irq_read_msg(struct mei_cl *cl,
|
|||||||
|
|
||||||
cb = list_first_entry_or_null(&cl->rd_pending, struct mei_cl_cb, list);
|
cb = list_first_entry_or_null(&cl->rd_pending, struct mei_cl_cb, list);
|
||||||
if (!cb) {
|
if (!cb) {
|
||||||
cl_err(dev, cl, "pending read cb not found\n");
|
if (!mei_cl_is_fixed_address(cl)) {
|
||||||
goto out;
|
cl_err(dev, cl, "pending read cb not found\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
cb = mei_cl_alloc_cb(cl, mei_cl_mtu(cl), MEI_FOP_READ, cl->fp);
|
||||||
|
if (!cb)
|
||||||
|
goto out;
|
||||||
|
list_add_tail(&cb->list, &cl->rd_pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mei_cl_is_connected(cl)) {
|
if (!mei_cl_is_connected(cl)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user