Tue, Jul 12, 2016 at 02:44:17PM CEST, rost...@goodmis.org wrote:
>On Tue, 12 Jul 2016 10:38:37 +0200
>Jiri Pirko <j...@resnulli.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


Okay. That looks good. Thanks!


>
>
>-- Steve

Reply via email to