2016-06-21 14:46:56

by Alexander Aring

[permalink] [raw]
Subject: [RFC bluetooth-next] 6lowpan: add debugfs to get lltype

This patch adds debugfs entry for get the link layer type for userspace.

Signed-off-by: Alexander Aring <[email protected]>
---
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(+)

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;
--
2.9.0



2016-06-22 08:12:38

by Alexander Aring

[permalink] [raw]
Subject: Re: [RFC bluetooth-next] 6lowpan: add debugfs to get lltype

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 <[email protected]>
> ---
> 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