diff options
author | Alexander Usyskin <alexander.usyskin@intel.com> | 2015-05-07 15:53:58 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-05-24 21:15:53 +0300 |
commit | b8b730357967ac2ec49dcffd2dc2b354f0fdd011 (patch) | |
tree | 9d2e5d5318fe91b500168cb8feb07f6c555b39a3 | |
parent | 292f82c86c94c3d419c799e5e3e94e8cf34c69de (diff) | |
download | linux-b8b730357967ac2ec49dcffd2dc2b354f0fdd011.tar.xz |
mei: consume flow control on the first chunk of writing
Consume the write flow control on the first chunk of the write instead
of on the buffer completion.
We can safely assume that the consequent chunks have the flow control
granted.
This addresses two issues:
1. Blocks other callbacks from the same client riding on the client's
flow control and prevents interleaving of messages as FW cannot distinguish
between two messages from the same client.
2. Fixes single buffer flow control arbitration in a clean way, without
connection/disconnection book keeping
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>
-rw-r--r-- | drivers/misc/mei/client.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 36706705dfdc..ce88c2199b2c 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c @@ -755,9 +755,6 @@ void mei_cl_set_disconnected(struct mei_cl *cl) if (!WARN_ON(cl->me_cl->connect_count == 0)) cl->me_cl->connect_count--; - if (cl->me_cl->connect_count == 0) - cl->me_cl->mei_flow_ctrl_creds = 0; - mei_me_cl_put(cl->me_cl); cl->me_cl = NULL; } @@ -1272,6 +1269,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, u32 msg_slots; int slots; int rets; + bool first_chunk; if (WARN_ON(!cl || !cl->dev)) return -ENODEV; @@ -1280,7 +1278,9 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, buf = &cb->buf; - rets = mei_cl_flow_ctrl_creds(cl); + first_chunk = cb->buf_idx == 0; + + rets = first_chunk ? mei_cl_flow_ctrl_creds(cl) : 1; if (rets < 0) return rets; @@ -1327,12 +1327,14 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, cb->buf_idx += mei_hdr.length; cb->completed = mei_hdr.msg_complete == 1; - if (mei_hdr.msg_complete) { + if (first_chunk) { if (mei_cl_flow_ctrl_reduce(cl)) return -EIO; - list_move_tail(&cb->list, &dev->write_waiting_list.list); } + if (mei_hdr.msg_complete) + list_move_tail(&cb->list, &dev->write_waiting_list.list); + return 0; } @@ -1411,21 +1413,19 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking) if (rets) goto err; + rets = mei_cl_flow_ctrl_reduce(cl); + if (rets) + goto err; + cl->writing_state = MEI_WRITING; cb->buf_idx = mei_hdr.length; cb->completed = mei_hdr.msg_complete == 1; out: - if (mei_hdr.msg_complete) { - rets = mei_cl_flow_ctrl_reduce(cl); - if (rets < 0) - goto err; - + if (mei_hdr.msg_complete) list_add_tail(&cb->list, &dev->write_waiting_list.list); - } else { + else list_add_tail(&cb->list, &dev->write_list.list); - } - if (blocking && cl->writing_state != MEI_WRITE_COMPLETE) { |