diff mbox

[RFC,bluetooth-next] 6lowpan: add debugfs to get lltype

Message ID 20160621144656.32469-1-aar@pengutronix.de (mailing list archive)
State Not Applicable
Headers show

Commit Message

Alexander Aring June 21, 2016, 2:46 p.m. UTC
This patch adds debugfs entry for get the link layer type for userspace.

Signed-off-by: Alexander Aring <aar@pengutronix.de>
---
Patrik,

after changing the dev->addr_len = 6 in btle 6lowpan. I think you should
add this patch to the end of your patch series. Then a "recent" radvd will use
the correct hardware address length.

 net/6lowpan/debugfs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Alexander Aring June 22, 2016, 8:12 a.m. UTC | #1
Hi,

On 06/21/2016 04:46 PM, Alexander Aring wrote:
> This patch adds debugfs entry for get the link layer type for userspace.
> 
> Signed-off-by: Alexander Aring <aar@pengutronix.de>
> ---
> Patrik,
> 
> after changing the dev->addr_len = 6 in btle 6lowpan. I think you should
> add this patch to the end of your patch series. Then a "recent" radvd will use
> the correct hardware address length.
> 

please ignore this patch. After chatting with Marcel we need a better
UAPI for bringing features into upstream radvd... and maybe RTNL has the
feature to get the dev->addr_len. :-)

I will try to add the current stuff which we have in debugfs into some
netlink UAPI.

- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/6lowpan/debugfs.c b/net/6lowpan/debugfs.c
index 24915e0..25bed7a 100644
--- a/net/6lowpan/debugfs.c
+++ b/net/6lowpan/debugfs.c
@@ -280,6 +280,19 @@  static int lowpan_dev_debugfs_802154_init(const struct net_device *dev,
 	return 0;
 }
 
+static int lowpan_lltype_get(void *data, u64 *val)
+{
+	struct lowpan_dev *ldev = data;
+
+	rtnl_lock();
+	*val = ldev->lltype;
+	rtnl_unlock();
+
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(lowpan_lltype_fops, lowpan_lltype_get, NULL, "%llu\n");
+
 int lowpan_dev_debugfs_init(struct net_device *dev)
 {
 	struct lowpan_dev *ldev = lowpan_dev(dev);
@@ -291,6 +304,11 @@  int lowpan_dev_debugfs_init(struct net_device *dev)
 	if (!ldev->iface_debugfs)
 		goto fail;
 
+	dentry = debugfs_create_file("lltype", 0444, ldev->iface_debugfs,
+				     lowpan_dev(dev), &lowpan_lltype_fops);
+	if (!dentry)
+		goto remove_root;
+
 	contexts = debugfs_create_dir("contexts", ldev->iface_debugfs);
 	if (!contexts)
 		goto remove_root;