#include <linux/tracepoint.h>
struct gb_message;
+struct gb_operation;
struct gb_host_device;
#define gb_bundle_name(message) \
TP_ARGS(message)
);
+DECLARE_EVENT_CLASS(gb_operation,
+
+ TP_PROTO(struct gb_operation *operation),
+
+ TP_ARGS(operation),
+
+ TP_STRUCT__entry(
+ __field(u16, cport_id) /* CPort of HD side of connection */
+ __field(u16, id) /* Operation ID */
+ __field(u8, type)
+ __field(unsigned long, flags)
+ __field(int, active)
+ __field(int, waiters)
+ __field(int, errno)
+ ),
+
+ TP_fast_assign(
+ __entry->cport_id = operation->connection->hd_cport_id;
+ __entry->id = operation->id;
+ __entry->type = operation->type;
+ __entry->flags = operation->flags;
+ __entry->active = operation->active;
+ __entry->waiters = atomic_read(&operation->waiters);
+ __entry->errno = operation->errno;
+ ),
+
+ TP_printk("id=%04x type=0x%02x cport_id=%04x flags=0x%lx active=%d waiters=%d errno=%d",
+ __entry->id, __entry->cport_id, __entry->type, __entry->flags,
+ __entry->active, __entry->waiters, __entry->errno)
+);
+
+#define DEFINE_OPERATION_EVENT(name) \
+ DEFINE_EVENT(gb_operation, name, \
+ TP_PROTO(struct gb_operation *operation), \
+ TP_ARGS(operation))
+
+/*
+ * Occurs after a new operation is created for an outgoing request
+ * has been successfully created.
+ */
+DEFINE_OPERATION_EVENT(gb_operation_create);
+
+/*
+ * Occurs after a new operation has been created for an incoming
+ * request has been successfully created and initialized.
+ */
+DEFINE_OPERATION_EVENT(gb_operation_create_incoming);
+
+/*
+ * Occurs when the last reference to an operation has been dropped,
+ * prior to freeing resources.
+ */
+DEFINE_OPERATION_EVENT(gb_operation_destroy);
+
+/*
+ * Occurs when an operation has been marked active, after updating
+ * its active count.
+ */
+DEFINE_OPERATION_EVENT(gb_operation_get_active);
+
+/*
+ * Occurs when an operation has been marked active, before updating
+ * its active count.
+ */
+DEFINE_OPERATION_EVENT(gb_operation_put_active);
+
+#undef DEFINE_OPERATION_EVENT
+
DECLARE_EVENT_CLASS(gb_host_device,
TP_PROTO(struct gb_host_device *hd, u16 intf_cport_id,
if (operation->active++ == 0)
list_add_tail(&operation->links, &connection->operations);
+ trace_gb_operation_get_active(operation);
+
spin_unlock_irqrestore(&connection->lock, flags);
return 0;
unsigned long flags;
spin_lock_irqsave(&connection->lock, flags);
+
+ trace_gb_operation_get_active(operation);
+
if (--operation->active == 0) {
list_del(&operation->links);
if (atomic_read(&operation->waiters))
size_t response_size, unsigned long flags,
gfp_t gfp)
{
+ struct gb_operation *operation;
+
if (WARN_ON_ONCE(type == GB_REQUEST_TYPE_INVALID))
return NULL;
if (WARN_ON_ONCE(type & GB_MESSAGE_TYPE_RESPONSE))
if (WARN_ON_ONCE(flags & ~GB_OPERATION_FLAG_USER_MASK))
flags &= GB_OPERATION_FLAG_USER_MASK;
- return gb_operation_create_common(connection, type,
+ operation = gb_operation_create_common(connection, type,
request_size, response_size,
flags, gfp);
+ if (operation)
+ trace_gb_operation_create(operation);
+
+ return operation;
+
}
EXPORT_SYMBOL_GPL(gb_operation_create_flags);
operation->id = id;
memcpy(operation->request->header, data, size);
+ trace_gb_operation_create_incoming(operation);
return operation;
}
operation = container_of(kref, struct gb_operation, kref);
+ trace_gb_operation_destroy(operation);
+
if (operation->response)
gb_operation_message_free(operation->response);
gb_operation_message_free(operation->request);