From patchwork Tue Jun 21 14:46:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 9190769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A62FE6075E for ; Tue, 21 Jun 2016 14:47:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 970A628066 for ; Tue, 21 Jun 2016 14:47:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B584281C3; Tue, 21 Jun 2016 14:47:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA84828066 for ; Tue, 21 Jun 2016 14:47:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752106AbcFUOrM (ORCPT ); Tue, 21 Jun 2016 10:47:12 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:45038 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752485AbcFUOrJ (ORCPT ); Tue, 21 Jun 2016 10:47:09 -0400 Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=omega.localdomain) by metis.ext.pengutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1bFMxD-00048z-44; Tue, 21 Jun 2016 16:47:03 +0200 From: Alexander Aring To: linux-wpan@vger.kernel.org Cc: linux-bluetooth@vger.kernel.org, kernel@pengutronix.de, patrik.flykt@linux.intel.com, jukka.rissanen@linux.intel.com, Alexander Aring Subject: [RFC bluetooth-next] 6lowpan: add debugfs to get lltype Date: Tue, 21 Jun 2016 16:46:56 +0200 Message-Id: <20160621144656.32469-1-aar@pengutronix.de> X-Mailer: git-send-email 2.9.0 X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: aar@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wpan@vger.kernel.org Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds debugfs entry for get the link layer type for userspace. Signed-off-by: Alexander Aring --- 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;