From patchwork Thu Apr 26 09:24:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alex.bluesman.smirnov@gmail.com X-Patchwork-Id: 155205 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 62FE9B6FA7 for ; Thu, 26 Apr 2012 19:31:14 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755046Ab2DZJbJ (ORCPT ); Thu, 26 Apr 2012 05:31:09 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:37864 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754753Ab2DZJbI (ORCPT ); Thu, 26 Apr 2012 05:31:08 -0400 Received: by wejx9 with SMTP id x9so619427wej.19 for ; Thu, 26 Apr 2012 02:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=35Q95Vz4w1NRiEOHSB7uN77l+8xUxyanKpTdDKBjgF8=; b=FmAnxsUMIz0gZ8/zYKecy2v3Y6X7evJT3ixWEkFJV9vNPfoFQ4KEy1z+EcrKf3/9nI ozz5LUFGJ/4zgqSi1AhVRJ4T1KSHB5OMJhWKBwJydeNUy4hc2XY7tn2zbPM2OpoDg9Pw Ayo46RZz++uhwq5sO3a2+NdXSwKf6uxyMSW6z4Rbn78VhNU3qDKH6pjd6cK1aGvclfGO VVsjizK909aFWaVye9nndh6VrkRut33cJME2MyvFule9ND9fw5sMLKovgiAq0S5rqdHb vx8KcHWPVzkUalPNUqLayQ5Queqi0jCzvMjC7oJsFL5Vc2eVcEudCIE1SntcPmPnzCah SVFw== Received: by 10.180.79.72 with SMTP id h8mr49688104wix.1.1335432666990; Thu, 26 Apr 2012 02:31:06 -0700 (PDT) Received: from localhost.localdomain ([91.213.169.4]) by mx.google.com with ESMTPS id gd4sm9226564wib.6.2012.04.26.02.31.05 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Apr 2012 02:31:06 -0700 (PDT) From: Alexander Smirnov To: netdev@vger.kernel.org Cc: davem@davemloft.net, linux-zigbee-devel@lists.sourceforge.net, Alexander Smirnov Subject: [PATCH net 1/3] 6lowpan: fix segmentation fault caused by mlme request Date: Thu, 26 Apr 2012 13:24:56 +0400 Message-Id: <1335432298-17161-2-git-send-email-alex.bluesman.smirnov@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1335432298-17161-1-git-send-email-alex.bluesman.smirnov@gmail.com> References: <1335432298-17161-1-git-send-email-alex.bluesman.smirnov@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add nescesary mlme callbacks to satisfy "iz list" request from user space. Due to 6lowpan device doesn't have its own phy, mlme implemented as a pipe to a real phy to which 6lowpan is attached. Signed-off-by: Alexander Smirnov --- net/ieee802154/6lowpan.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 58c8895..7ce508f 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c @@ -1044,6 +1044,24 @@ static void lowpan_dev_free(struct net_device *dev) free_netdev(dev); } +static struct wpan_phy *lowpan_get_phy(const struct net_device *dev) +{ + struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; + return ieee802154_mlme_ops(real_dev)->get_phy(real_dev); +} + +static u16 lowpan_get_pan_id(const struct net_device *dev) +{ + struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; + return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev); +} + +static u16 lowpan_get_short_addr(const struct net_device *dev) +{ + struct net_device *real_dev = lowpan_dev_info(dev)->real_dev; + return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev); +} + static struct header_ops lowpan_header_ops = { .create = lowpan_header_create, }; @@ -1053,6 +1071,12 @@ static const struct net_device_ops lowpan_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, }; +static struct ieee802154_mlme_ops lowpan_mlme = { + .get_pan_id = lowpan_get_pan_id, + .get_phy = lowpan_get_phy, + .get_short_addr = lowpan_get_short_addr, +}; + static void lowpan_setup(struct net_device *dev) { pr_debug("(%s)\n", __func__); @@ -1070,6 +1094,7 @@ static void lowpan_setup(struct net_device *dev) dev->netdev_ops = &lowpan_netdev_ops; dev->header_ops = &lowpan_header_ops; + dev->ml_priv = &lowpan_mlme; dev->destructor = lowpan_dev_free; }