OSDN Git Service

greybus: loopback: Add asynchronous bi-directional support
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Mon, 7 Dec 2015 01:59:06 +0000 (01:59 +0000)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 7 Dec 2015 19:32:20 +0000 (14:32 -0500)
commit12927835d21127d7e528b9ed56fc334ac96db985
treeab51bc9aa71514ed1be3edd06b82d3a36fb70ad6
parent2e238d71edadf03bed470cf58514ee10795a806b
greybus: loopback: Add asynchronous bi-directional support

A particular ask from the firmware people for some time now has been the
ability to drive multiple outstanding bi-directional operations from
loopback to loopback Interfaces. This patch implments that change.

The approach taken is to make a call to gb_operation_send() and have
loopback capture the completion callback itself, with a parallel timer to
timeout completion callbacks that take too long. The calling thread will
issue each gb_operation_send() as fast as it can within the constraints of
thread-safety.

In order to support this addition the following new sysfs entries are
created on a per-connection basis.

- async
  Zero indicates loopback should use the traditional synchronous model
  i.e. gb_operation_request_send_sync().

  Non-zero indicates loopback should use the new asynchronous model i.e.
  gb_operation_send()

- requests_completed
  This value indicates the number of requests successfully completed.

- requests_timedout
  This value indicates the number of requests which timed out.

- timeout
  The number of microseconds to give an individual asynchronous request
  before timing that request out.

- timeout_min
  Read-only attribute informs user-space of the minimum allowed timeout.

- timeout_max
  Read-only attribute informs user-space of the maximum allowed timeout.

Note requests_completed + requests_timedout should always equal
iteration_max, once iteration_count == iteration_max. Also, at this time we
support either synchronous or asynchronous operations in one set of
transactions.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/loopback.c