greybus: Add loopback protocol
authorAlexandre Bailon <abailon@baylibre.com>
Tue, 31 Mar 2015 07:51:59 +0000 (09:51 +0200)
committerGreg Kroah-Hartman <greg@kroah.com>
Tue, 31 Mar 2015 20:53:59 +0000 (22:53 +0200)
commit355a7058153e04b53bed3fcb792110294693d386
tree9b33de7118f8ae28d5fe10de4b6791a37bc51f13
parente0feaf14b102f767d00ee28443f8443e4d76ba8b
greybus: Add loopback protocol

Add a simple Greybus protocol in order to stress USB and Greybus.
This protocol currently support 2 requests: ping and transfer.

ping request is useful to measure latency.
Kernel send a ping request and firmware should respond with a ping.

The transfer request request is useful to stress Greybus and USB.
Kernel can send data from 0 to 4k and the firmware must send back the data to kernel.

This behaviour of gb-loopback module is controlled via sysfs.
Curently, connection sysfs folder is updated with new entries:
- type: Type of loopback message to send
  * 0 => Don't send message
  * 1 => Send ping message continuously (message without payload)
  * 2 => Send transer message continuously (message with payload)
- size: Size of transfer message payload: 0-4096 bytes
- ms_wait: Time to wait between two messages: 0-1024 ms

Module also export some statistics about connection:
- latency: Time to send and receive one message
- frequency: Number of packet sent per second on this cport
- throughput: Quantity of data sent and received on this cport
- error
All this statistics are cleared everytime type, size or ms_wait entries are updated.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/Makefile
drivers/staging/greybus/greybus_manifest.h
drivers/staging/greybus/loopback.c [new file with mode: 0644]