Skip to contentSkip to conversation

mac802154: add trace functionality for driver ops

RFC In review Varka Bhadram 3 participants 6 messages May 27, 2015 – May 31, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 mac802154: add trace functionality for driver ops

This patch adds trace events for driver operations.

---
 net/mac802154/Makefile     |    4 +-
 net/mac802154/driver-ops.h |   92 ++++++++++++---
 net/mac802154/trace.c      |    9 ++
 net/mac802154/trace.h      |  272 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 362 insertions(+), 15 deletions(-)
 create mode 100644 net/mac802154/trace.c
 create mode 100644 net/mac802154/trace.h
net/mac802154/Makefile +3 -1
index 702d8b4..17a51e8 100644
@@ -1,5 +1,7 @@
 obj-$(CONFIG_MAC802154)	+= mac802154.o
 mac802154-objs		:= main.o rx.o tx.o mac_cmd.o mib.o \
-			   iface.o llsec.o util.o cfg.o
+			   iface.o llsec.o util.o cfg.o trace.o
+
+CFLAGS_trace.o := -I$(src)
 
 ccflags-y += -D__CHECK_ENDIAN__
net/mac802154/driver-ops.h +78 -14

251 lines not on this page · raw message

net/mac802154/trace.c new file +9 -0
new file mode 100644
index 0000000..863e5e6
@@ -0,0 +1,9 @@
+#include <linux/module.h>
+
+#ifndef __CHECKER__
+#include <net/cfg802154.h>
+#include "driver-ops.h"
+#define CREATE_TRACE_POINTS
+#include "trace.h"
+
+#endif
net/mac802154/trace.h new file +272 -0

272 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#1 lore raw

Hi,

I did not test yet, but found some review things.

On Wed, May 27, 2015 at 01:54:50PM +0530, Varka Bhadram wrote:
...

Quoted 13 lines
net/mac802154/trace.h new file +13 -0
+		__field(bool, mode)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->mode = mode;
+	),
+	TP_printk(LOCAL_PR_FMT ", lbt mode: %s", LOCAL_PR_ARG,
+		  BOOL_TO_STR(__entry->mode))
+);
+
+TRACE_EVENT(802154_drv_set_short_addr,
+	TP_PROTO(struct ieee802154_local *local, __le16 short_addr),
+	TP_ARGS(local, short_addr),

net/mac802154/trace.h line 167

Quoted 10 lines
net/mac802154/trace.h new file +10 -0
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(__le16, short_addr)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->short_addr = short_addr;
+	),
+	TP_printk(LOCAL_PR_FMT ", sa: 0x%04x", LOCAL_PR_ARG,
+		  __entry->short_addr)

care about byteorder here. you need cpu_to_le16 in the format string, please.

Quoted 5 lines
net/mac802154/trace.h new file +5 -0
+);
+
+TRACE_EVENT(802154_drv_set_pan_id,
+	TP_PROTO(struct ieee802154_local *local, __le16 pan_id),
+	TP_ARGS(local, pan_id),

net/mac802154/trace.h line 182

Quoted 10 lines
net/mac802154/trace.h new file +10 -0
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(__le16, pan_id)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->pan_id = pan_id;
+	),
+	TP_printk(LOCAL_PR_FMT ", pan id: 0x%04x", LOCAL_PR_ARG,
+		  __entry->pan_id)

same here.

Quoted 7 lines
net/mac802154/trace.h new file +7 -0
+);
+
+TRACE_EVENT(802154_drv_set_extended_addr,
+	TP_PROTO(struct ieee802154_local *local, __le64 extended_addr),
+	TP_ARGS(local, extended_addr),
+	TP_STRUCT__entry(
+		LOCAL_ENTRY

net/mac802154/trace.h line 199

Quoted 10 lines
net/mac802154/trace.h new file +10 -0
+		__field(__le64, extended_addr)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->extended_addr = extended_addr;
+	),
+	TP_printk(LOCAL_PR_FMT ", extended addr %llx", LOCAL_PR_ARG,
+		  __entry->extended_addr)
+);
+

same here.

Quoted 5 lines
net/mac802154/trace.h new file +5 -0
+TRACE_EVENT(802154_drv_set_pan_coord,
+	TP_PROTO(struct ieee802154_local *local, bool is_coord),
+	TP_ARGS(local, is_coord),
+	TP_STRUCT__entry(
+		LOCAL_ENTRY

net/mac802154/trace.h line 214

Quoted 10 lines
net/mac802154/trace.h new file +10 -0
+		__field(bool, is_coord)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->is_coord = is_coord;
+	),
+	TP_printk(LOCAL_PR_FMT ", is_coord: %s", LOCAL_PR_ARG,
+		  BOOL_TO_STR(__entry->is_coord))
+);
+

- Alex

#2 lore raw

Hi Alex,

Quoted 3 lines · Alexander Aring

Hi,

I did not test yet, but found some review things.

Please test it.

Quoted 65 lines · Varka Bhadram

...

Quoted 13 lines
net/mac802154/trace.h new file +13 -0
+		__field(bool, mode)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->mode = mode;
+	),
+	TP_printk(LOCAL_PR_FMT ", lbt mode: %s", LOCAL_PR_ARG,
+		  BOOL_TO_STR(__entry->mode))
+);
+
+TRACE_EVENT(802154_drv_set_short_addr,
+	TP_PROTO(struct ieee802154_local *local, __le16 short_addr),
+	TP_ARGS(local, short_addr),

net/mac802154/trace.h line 167

Quoted 10 lines
net/mac802154/trace.h new file +10 -0
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(__le16, short_addr)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->short_addr = short_addr;
+	),
+	TP_printk(LOCAL_PR_FMT ", sa: 0x%04x", LOCAL_PR_ARG,
+		  __entry->short_addr)

care about byteorder here. you need cpu_to_le16 in the format string, please.

Quoted 5 lines
net/mac802154/trace.h new file +5 -0
+);
+
+TRACE_EVENT(802154_drv_set_pan_id,
+	TP_PROTO(struct ieee802154_local *local, __le16 pan_id),
+	TP_ARGS(local, pan_id),

net/mac802154/trace.h line 182

Quoted 10 lines
net/mac802154/trace.h new file +10 -0
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(__le16, pan_id)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->pan_id = pan_id;
+	),
+	TP_printk(LOCAL_PR_FMT ", pan id: 0x%04x", LOCAL_PR_ARG,
+		  __entry->pan_id)

same here.

Quoted 7 lines
net/mac802154/trace.h new file +7 -0
+);
+
+TRACE_EVENT(802154_drv_set_extended_addr,
+	TP_PROTO(struct ieee802154_local *local, __le64 extended_addr),
+	TP_ARGS(local, extended_addr),
+	TP_STRUCT__entry(
+		LOCAL_ENTRY

net/mac802154/trace.h line 199

Quoted 10 lines
net/mac802154/trace.h new file +10 -0
+		__field(__le64, extended_addr)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->extended_addr = extended_addr;
+	),
+	TP_printk(LOCAL_PR_FMT ", extended addr %llx", LOCAL_PR_ARG,
+		  __entry->extended_addr)
+);
+

same here.

Quoted 15 lines
Quoted 5 lines
net/mac802154/trace.h new file +5 -0
+TRACE_EVENT(802154_drv_set_pan_coord,
+	TP_PROTO(struct ieee802154_local *local, bool is_coord),
+	TP_ARGS(local, is_coord),
+	TP_STRUCT__entry(
+		LOCAL_ENTRY

net/mac802154/trace.h line 214

Quoted 10 lines
net/mac802154/trace.h new file +10 -0
+		__field(bool, is_coord)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->is_coord = is_coord;
+	),
+	TP_printk(LOCAL_PR_FMT ", is_coord: %s", LOCAL_PR_ARG,
+		  BOOL_TO_STR(__entry->is_coord))
+);
+

Ok i will do.

Thanks.

Signature · 1 line
Varka Bhadram
maintainer
#3 lore raw
Quoted 39 lines · Varka Bhadram

Hi Alex,

Quoted 3 lines · Alexander Aring

Hi,

I did not test yet, but found some review things.

Please test it.

Quoted 29 lines · Varka Bhadram

...

Quoted 13 lines
net/mac802154/trace.h new file +13 -0
+		__field(bool, mode)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->mode = mode;
+	),
+	TP_printk(LOCAL_PR_FMT ", lbt mode: %s", LOCAL_PR_ARG,
+		  BOOL_TO_STR(__entry->mode))
+);
+
+TRACE_EVENT(802154_drv_set_short_addr,
+	TP_PROTO(struct ieee802154_local *local, __le16 short_addr),
+	TP_ARGS(local, short_addr),

net/mac802154/trace.h line 167

Quoted 10 lines
net/mac802154/trace.h new file +10 -0
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(__le16, short_addr)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->short_addr = short_addr;
+	),
+	TP_printk(LOCAL_PR_FMT ", sa: 0x%04x", LOCAL_PR_ARG,
+		  __entry->short_addr)

care about byteorder here. you need cpu_to_le16 in the format string, please.

meant s/cpu_to_le16/le16_to_cpu/

- Alex

#4 lore raw
Quoted 39 lines · Alexander Aring
Quoted 38 lines · Varka Bhadram

Hi Alex,

Quoted 3 lines · Alexander Aring

Hi,

I did not test yet, but found some review things.

Please test it.

Quoted 29 lines · Varka Bhadram

...

Quoted 13 lines
net/mac802154/trace.h new file +13 -0
+		__field(bool, mode)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->mode = mode;
+	),
+	TP_printk(LOCAL_PR_FMT ", lbt mode: %s", LOCAL_PR_ARG,
+		  BOOL_TO_STR(__entry->mode))
+);
+
+TRACE_EVENT(802154_drv_set_short_addr,
+	TP_PROTO(struct ieee802154_local *local, __le16 short_addr),
+	TP_ARGS(local, short_addr),

net/mac802154/trace.h line 167

Quoted 10 lines
net/mac802154/trace.h new file +10 -0
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(__le16, short_addr)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->short_addr = short_addr;
+	),
+	TP_printk(LOCAL_PR_FMT ", sa: 0x%04x", LOCAL_PR_ARG,
+		  __entry->short_addr)

care about byteorder here. you need cpu_to_le16 in the format string, please.

Quoted 1 line

meant s/cpu_to_le16/le16_to_cpu/

Got it.

Signature · 14 lines
Varka Bhadram


-------------------------------------------------------------------------------------------------------------------------------
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------
maintainer
#5 lore raw
In reply to Varka Bhadram

Hi,

I test it now and it works perfectly. Nice to have for complex userspace applications.

I saw something which would be maybe to handle the output better.

802154_rdev_set_tx_power: phy0, power: -1200
802154_drv_set_tx_power: phy0, power: -1200

Maybe the parameter should not be shown as "power", we should use the same naming convention like in the code which is "mbm".

I know I did it wrong in rdev trace, but we could change it now.

The same for:

802154_drv_set_csma_params: phy0, min be: 3, max be: 5, max csma bo: 4

"max csma bo" should be "max csma backoffs" then. If you like you can fix it, it's just a nitpick.

Quoted 24 lines · Varka Bhadram

This patch adds trace events for driver operations.

---
 net/mac802154/Makefile     |    4 +-
 net/mac802154/driver-ops.h |   92 ++++++++++++---
 net/mac802154/trace.c      |    9 ++
 net/mac802154/trace.h      |  272 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 362 insertions(+), 15 deletions(-)
 create mode 100644 net/mac802154/trace.c
 create mode 100644 net/mac802154/trace.h
net/mac802154/Makefile +3 -1
index 702d8b4..17a51e8 100644
@@ -1,5 +1,7 @@
 obj-$(CONFIG_MAC802154)	+= mac802154.o
 mac802154-objs		:= main.o rx.o tx.o mac_cmd.o mib.o \
-			   iface.o llsec.o util.o cfg.o
+			   iface.o llsec.o util.o cfg.o trace.o
+
+CFLAGS_trace.o := -I$(src)
 

...

Quoted 18 lines
net/mac802154/Makefile +18 -0
+
+TRACE_EVENT(802154_drv_set_pan_id,
+	TP_PROTO(struct ieee802154_local *local, __le16 pan_id),
+	TP_ARGS(local, pan_id),
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(__le16, pan_id)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->pan_id = pan_id;
+	),
+	TP_printk(LOCAL_PR_FMT ", pan id: 0x%04x", LOCAL_PR_ARG,
+		  __entry->pan_id)
+);
+
+TRACE_EVENT(802154_drv_set_extended_addr,
+	TP_PROTO(struct ieee802154_local *local, __le64 extended_addr),

net/mac802154/Makefile

Quoted 10 lines
net/mac802154/Makefile +10 -0
+	TP_ARGS(local, extended_addr),
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(__le64, extended_addr)
+	),
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->extended_addr = extended_addr;
+	),
+	TP_printk(LOCAL_PR_FMT ", extended addr %llx", LOCAL_PR_ARG,

add here a "0x"? I know this is also wrong in the rdev ops, maybe fix this too in a patch for "rdev-ops trace fixes".

But this is something which is a good example for keeping the naming convention the same:

When I do:

iwpan dev wpan0 interface add wpan1 type node ca:fe:fa:ce:de:ad:be:ef

will end in:

802154_rdev_add_virtual_intf: phy0, virtual intf name: wpan1, type: 0, ea cafefacedeadbeef

the extended_addr is here shown as "ea".

here it is shown as "extended addr". I like more to use "extended addr" than "ea". But what we should have is the same naming convention for meaning of the same parameter (orient you at the driver_ops declaration maybe).

- Alex