It should remove the object from sysfs when loopback
connection init error.
Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
There's no reason we can't support loopback pings or transfers
initiated by the module. Allow it.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Add some symbols to indicate what kind of "function" the
loopback thread is supposed to be performing--the type of
traffic it generates over its connection.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Use a symbolic constant to define the maximum time (number of
milliseconds) to delay between initiated operations.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Fix a comment that incorrectly says the delay between messages is
limited to 1024 msec; it actually must be <= 1000 msec.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
If an error occurs starting up the loopback thread, the error code
is not extracted properly. Fix that.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
In gb_loopback_check_attr(), the value of gb->type is checked for
validity. The only valid values are 0, 1, and 2. But the check
allows the value 3. Fix that.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The code uses 64-bit divisions, which should be avoided, and also
prevents the module from loading on 32-bit systems:
gb_loopback: Unknown symbol __aeabi_uldivmod (err 0)
Fix by using the kernel's 64-bit by 32-bit division implementation
do_div.
Compile tested only. I did not look very closely at the code itself.
Perhaps this could be worked around in some other way, but this silences
the linker warning and allows the module to be loaded.
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We should use the attribute groups, not group, for the device, so
add and remove it. No one should ever be updating a sysfs group for a
device, as that can be pretty dangerous if you don't duplicate _all_
existing attribute for that device, and I don't think we were doing that
here.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
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>