Commit 6872c461 authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Greg Kroah-Hartman

greybus: es1, es2: hook tracepoints to hardware send/recv operations

This patch hooks tracepoints for the handoff point to/from hardware. With
these tracepoints in place we can view the time between gb_message_send and
usb_submit_urb and similarly we can view the time between cport_in_callback
and gb_message_recv_response/gb_message_recv_request

- trace_gb_host_device_send
- trace_gb_host_device_recv

It provides standard tracepoints at

/sys/kernel/debug/tracing/events/greybus/gb_host_device_send
/sys/kernel/debug/tracing/events/greybus/gb_host_device_recv

Giving outputs like

gb_host_device_recv: greybus:2-1 if_id=0000 l=10
gb_host_device_send: greybus:2-1 if_id=0000 l=10
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 32b2b167
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "greybus.h" #include "greybus.h"
#include "kernel_ver.h" #include "kernel_ver.h"
#include "connection.h" #include "connection.h"
#include "greybus_trace.h"
/* Memory sizes for the buffers sent to/from the ES1 controller */ /* Memory sizes for the buffers sent to/from the ES1 controller */
#define ES1_GBUF_MSG_SIZE_MAX 2048 #define ES1_GBUF_MSG_SIZE_MAX 2048
...@@ -215,6 +216,7 @@ static int message_send(struct greybus_host_device *hd, u16 cport_id, ...@@ -215,6 +216,7 @@ static int message_send(struct greybus_host_device *hd, u16 cport_id,
message->buffer, buffer_size, message->buffer, buffer_size,
cport_out_callback, message); cport_out_callback, message);
urb->transfer_flags |= URB_ZERO_PACKET; urb->transfer_flags |= URB_ZERO_PACKET;
trace_gb_host_device_send(hd, cport_id, buffer_size);
retval = usb_submit_urb(urb, gfp_mask); retval = usb_submit_urb(urb, gfp_mask);
if (retval) { if (retval) {
pr_err("error %d submitting URB\n", retval); pr_err("error %d submitting URB\n", retval);
...@@ -369,12 +371,14 @@ static void cport_in_callback(struct urb *urb) ...@@ -369,12 +371,14 @@ static void cport_in_callback(struct urb *urb)
header = urb->transfer_buffer; header = urb->transfer_buffer;
cport_id = gb_message_cport_unpack(header); cport_id = gb_message_cport_unpack(header);
if (cport_id_valid(hd, cport_id)) if (cport_id_valid(hd, cport_id)) {
trace_gb_host_device_recv(hd, cport_id, urb->actual_length);
greybus_data_rcvd(hd, cport_id, urb->transfer_buffer, greybus_data_rcvd(hd, cport_id, urb->transfer_buffer,
urb->actual_length); urb->actual_length);
else } else {
dev_err(dev, "%s: invalid cport id 0x%02x received\n", dev_err(dev, "%s: invalid cport id 0x%02x received\n",
__func__, cport_id); __func__, cport_id);
}
exit: exit:
/* put our urb back in the request pool */ /* put our urb back in the request pool */
retval = usb_submit_urb(urb, GFP_ATOMIC); retval = usb_submit_urb(urb, GFP_ATOMIC);
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "greybus.h" #include "greybus.h"
#include "kernel_ver.h" #include "kernel_ver.h"
#include "connection.h" #include "connection.h"
#include "greybus_trace.h"
/* Memory sizes for the buffers sent to/from the ES1 controller */ /* Memory sizes for the buffers sent to/from the ES1 controller */
#define ES1_GBUF_MSG_SIZE_MAX 2048 #define ES1_GBUF_MSG_SIZE_MAX 2048
...@@ -319,6 +320,7 @@ static int message_send(struct greybus_host_device *hd, u16 cport_id, ...@@ -319,6 +320,7 @@ static int message_send(struct greybus_host_device *hd, u16 cport_id,
message->buffer, buffer_size, message->buffer, buffer_size,
cport_out_callback, message); cport_out_callback, message);
urb->transfer_flags |= URB_ZERO_PACKET; urb->transfer_flags |= URB_ZERO_PACKET;
trace_gb_host_device_send(hd, cport_id, buffer_size);
retval = usb_submit_urb(urb, gfp_mask); retval = usb_submit_urb(urb, gfp_mask);
if (retval) { if (retval) {
pr_err("error %d submitting URB\n", retval); pr_err("error %d submitting URB\n", retval);
...@@ -478,12 +480,14 @@ static void cport_in_callback(struct urb *urb) ...@@ -478,12 +480,14 @@ static void cport_in_callback(struct urb *urb)
header = urb->transfer_buffer; header = urb->transfer_buffer;
cport_id = gb_message_cport_unpack(header); cport_id = gb_message_cport_unpack(header);
if (cport_id_valid(hd, cport_id)) if (cport_id_valid(hd, cport_id)) {
trace_gb_host_device_recv(hd, cport_id, urb->actual_length);
greybus_data_rcvd(hd, cport_id, urb->transfer_buffer, greybus_data_rcvd(hd, cport_id, urb->transfer_buffer,
urb->actual_length); urb->actual_length);
else } else {
dev_err(dev, "%s: invalid cport id 0x%02x received\n", dev_err(dev, "%s: invalid cport id 0x%02x received\n",
__func__, cport_id); __func__, cport_id);
}
exit: exit:
/* put our urb back in the request pool */ /* put our urb back in the request pool */
retval = usb_submit_urb(urb, GFP_ATOMIC); retval = usb_submit_urb(urb, GFP_ATOMIC);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment