[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160712084417.4ca31962@gandalf.local.home>
Date: Tue, 12 Jul 2016 08:44:17 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Jiri Pirko <jiri@...nulli.us>
Cc: netdev@...r.kernel.org, davem@...emloft.net, idosch@...lanox.com,
yotamg@...lanox.com, eladr@...lanox.com, nogahf@...lanox.com,
ogerlitz@...lanox.com, ivecera@...hat.com, mingo@...hat.com,
jolsa@...nel.org
Subject: Re: [patch net-next 1/2] devlink: add hardware messages tracing
facility
On Tue, 12 Jul 2016 10:38:37 +0200
Jiri Pirko <jiri@...nulli.us> wrote:
> Hmm, I'm trying to make it work this was but it seems to be a bit more
> complicated. I did not find any code doing this (having the tracepoint
> compiled in or not) so I cannot copy&paste the solution.
>
> The problem is that trace_devlink_hwmsg is included from
> include/trace/events/devlink.h when devlink is on and from
> include/net/devlink.h. Odd but ok.
>
> I cannot include include/trace/events/devlink.h in include/net/devlink.h
> because include/net/devlink.h is included in include/trace/events/devlink.h
>
> So I have to directly include include/trace/events/devlink.h from mlxsw
> driver (trace caller). But when devlink is not compiled in, trecepoint
> is not created and I'm getting errors.
>
> I see no easy way our of this other than the wrapper function I was
> originally using. Seem simple and elegant.
No. You missed my solution.
Any user of trace_devlink_hwmsg() should directly include
trace/events/devlink.h. That's what all other trace users do. They
include the trace file header.
I said in that header do:
#if IS_ENABLED(CONFIG_NET_DEVLINK)
#undef TRACE_SYSTEM
#define TRACE_SYSTEM devlink
#if !defined(_TRACE_DEVLINK_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_DEVLINK_H
#include <linux/device.h>
#include <net/devlink.h>
#include <linux/tracepoint.h>
[..]
#endif /* _TRACE_DEVLINK_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
#else /* CONFIG_NET_DEVLINK */
static inline void trace_devlink_hwmsg(const struct devlink *devlink,
bool incoming, unsigned long type,
const u8 *buf, size_t len)
{
}
#endif
-- Steve
Powered by blists - more mailing lists