diff mbox series

[wpan-next,3/3] ieee802154: Trace the registration of new PANs

Message ID 20221102151915.1007815-4-miquel.raynal@bootlin.com (mailing list archive)
State Superseded
Headers show
Series IEEE 802.15.4 PAN discovery handling | expand

Commit Message

Miquel Raynal Nov. 2, 2022, 3:19 p.m. UTC
From: David Girault <david.girault@qorvo.com>

Add an internal trace when new PANs get discovered.

Signed-off-by: David Girault <david.girault@qorvo.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 net/ieee802154/pan.c   |  2 ++
 net/ieee802154/trace.h | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

Comments

Alexander Aring Nov. 7, 2022, 1:36 a.m. UTC | #1
Hi,

On Wed, Nov 2, 2022 at 11:20 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> From: David Girault <david.girault@qorvo.com>
>
> Add an internal trace when new PANs get discovered.

I guess this will not be the API for the user that there is a PAN
discovered? Is it only for debugging purposes? There will be an
nl802154 event for this? As we discussed previously with additional
commands for start, discovered, etc.?

I am sorry, maybe I can read that somewhere on your previous patch
series, just want to be sure.

- Alex
Miquel Raynal Nov. 7, 2022, 8:49 a.m. UTC | #2
Hi Alexander,

aahringo@redhat.com wrote on Sun, 6 Nov 2022 20:36:21 -0500:

> Hi,
> 
> On Wed, Nov 2, 2022 at 11:20 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > From: David Girault <david.girault@qorvo.com>
> >
> > Add an internal trace when new PANs get discovered.  
> 
> I guess this will not be the API for the user that there is a PAN
> discovered? Is it only for debugging purposes? There will be an
> nl802154 event for this? As we discussed previously with additional
> commands for start, discovered, etc.?
> 
> I am sorry, maybe I can read that somewhere on your previous patch
> series, just want to be sure.

Yeah no problem, so yes, as you eventually saw in patch 1/3, the
internal tracing is just here for in-kernel debugging purposes, it's in
no way related to the user interface. It's a 2015 feature, we're just
adding support for tracing the new commands.

Let's discuss the nl user interface in the other thread.

Thanks,
Miquèl
diff mbox series

Patch

diff --git a/net/ieee802154/pan.c b/net/ieee802154/pan.c
index 0d4f752a090a..b41fe173edd3 100644
--- a/net/ieee802154/pan.c
+++ b/net/ieee802154/pan.c
@@ -18,6 +18,7 @@ 
 
 #include "ieee802154.h"
 #include "../ieee802154/nl802154.h"
+#include "trace.h"
 
 struct ieee802154_coord_desc *
 cfg802154_alloc_coordinator(struct ieee802154_addr *coord, gfp_t gfp)
@@ -91,6 +92,7 @@  void cfg802154_record_coordinator(struct wpan_phy *wpan_phy,
 		cfg802154_free_coordinator_desc(desc);
 	} else {
 		list_add_tail(&desc->node, &wpan_dev->coord_list);
+		trace_802154_new_coordinator(desc);
 		nl802154_advertise_new_coordinator(wpan_phy, wpan_dev, desc);
 	}
 
diff --git a/net/ieee802154/trace.h b/net/ieee802154/trace.h
index 19c2e5d60e76..03b3817c34ad 100644
--- a/net/ieee802154/trace.h
+++ b/net/ieee802154/trace.h
@@ -295,6 +295,31 @@  TRACE_EVENT(802154_rdev_set_ackreq_default,
 		WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->ackreq))
 );
 
+DECLARE_EVENT_CLASS(802154_new_coordinator_evt,
+	TP_PROTO(struct ieee802154_coord_desc *desc),
+	TP_ARGS(desc),
+	TP_STRUCT__entry(
+		__field(__le16, pan_id)
+		__field(__le64, addr)
+		__field(u8, channel)
+		__field(u8, page)
+	),
+	TP_fast_assign(
+		__entry->page = desc->page;
+		__entry->channel = desc->channel;
+		__entry->pan_id = desc->addr->pan_id;
+		__entry->addr = desc->addr->extended_addr;
+	),
+	TP_printk("panid: %u, coord_addr: 0x%llx, page: %u, channel: %u",
+		  __le16_to_cpu(__entry->pan_id), __le64_to_cpu(__entry->addr),
+		  __entry->page, __entry->channel)
+);
+
+DEFINE_EVENT(802154_new_coordinator_evt, 802154_new_coordinator,
+	TP_PROTO(struct ieee802154_coord_desc *desc),
+	TP_ARGS(desc)
+);
+
 TRACE_EVENT(802154_rdev_return_int,
 	TP_PROTO(struct wpan_phy *wpan_phy, int ret),
 	TP_ARGS(wpan_phy, ret),