Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: "Guido Günther" <agx@sigxcpu.org>
Cc: linux-wpan@vger.kernel.org
Subject: Re: [PATCH] ieee802154: Add trace events for rdev->ops
Date: Fri, 17 Apr 2015 12:27:53 +0200	[thread overview]
Message-ID: <20150417102749.GB3288@omega> (raw)
In-Reply-To: <20150412120733.GA6181@bogon.m.sigxcpu.org>

On Sun, Apr 12, 2015 at 02:07:33PM +0200, Guido Günther wrote:
...
> +DECLARE_EVENT_CLASS(802154_le16_template,
> +	TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
> +		 __le16 le16arg),
> +	TP_ARGS(wpan_phy, wpan_dev, le16arg),
> +	TP_STRUCT__entry(
> +		WPAN_PHY_ENTRY
> +		WPAN_DEV_ENTRY
> +		__field(__le16, le16arg)
> +	),
> +	TP_fast_assign(
> +		WPAN_PHY_ASSIGN;
> +		WPAN_DEV_ASSIGN;
> +		__entry->le16arg = __le16_to_cpu(le16arg);

When "__entry->le16arg" is type of "__le16" which is given by
"__field(__le16, le16arg)". Then translation of __le16_to_cpu is here
wrong because __le16_to_cpu return u16.

> +	),
> +	TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", pan id: 0x%04x",
> +		  WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG, __entry->le16arg)

When then we need to do the translation here. The format string requires
a host byte-order type. So it's __le16_to_cpu(__entry->le16arg), I don't
know why sparse (the C=2) doesn't report about that.

This is like wireless it does at [0], but with a pointer. When wireless
do that in kernelspace, then I have no idea why there is a cfg80211
plugin which doing byte order translation at [1]. I think this not for
parsing the argument, it's for correct handling of handling the display
of __le16_to_cpup (We use __le16_to_cpu here).

Then we need a cfg802154 plugin in trace_cmd for handling "__le16_to_cpu"
correct.

- Alex

[0] http://lxr.free-electrons.com/source/net/wireless/trace.h?v=3.19#L2160
[1] http://git.kernel.org/cgit/linux/kernel/git/rostedt/trace-cmd.git/tree/plugin_cfg80211.c

  parent reply	other threads:[~2015-04-17 10:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-12 12:07 [PATCH] ieee802154: Add trace events for rdev->ops Guido Günther
2015-04-17 10:03 ` Alexander Aring
2015-04-17 10:32   ` Alexander Aring
2015-04-17 10:27 ` Alexander Aring [this message]
2015-04-20 18:36   ` Guido Günther
2015-04-17 11:49 ` Varka Bhadram
2015-04-20 18:35   ` Guido Günther
2015-04-20 18:50     ` Alexander Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150417102749.GB3288@omega \
    --to=alex.aring@gmail.com \
    --cc=agx@sigxcpu.org \
    --cc=linux-wpan@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox