From patchwork Sun Mar 12 08:19:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 9619263 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 ED3B160522 for ; Sun, 12 Mar 2017 08:19:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE5F128511 for ; Sun, 12 Mar 2017 08:19:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2DF928527; Sun, 12 Mar 2017 08:19:58 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 48C7828520 for ; Sun, 12 Mar 2017 08:19:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933728AbdCLITy (ORCPT ); Sun, 12 Mar 2017 04:19:54 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:34841 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754702AbdCLITp (ORCPT ); Sun, 12 Mar 2017 04:19:45 -0400 Received: by mail-lf0-f66.google.com with SMTP id v2so9704605lfi.2; Sun, 12 Mar 2017 00:19:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QiWNE94h1W/y4txU6T+13mMClw2BcrRIJKYFPDZRDAU=; b=SDPOsOJU4/yuecmk+oTPH9gojvPJX84tidvqmYPaRQ0uaZt/BUCDXJpPxuul4rgI88 OzgG3DycAsuffkj44gnatwK26Xua35+8Y67Qs79iaGnJ/UIlcyAGWLErIiFbPZFhDcsU BNomKoTLbd9DU6DvPedBEoKTdM0lb0ZdwTeW7BIp3kElCeXwL/s62FzmOhzR9hN70qEi QQV+U67LA7qs6g86zItHfFqm74z39hpHkmobND20J75D8lOSU6AtKML+5Fh2NQQTGkcY RtlH3vwC+t3MkVtfmPm26tCKXpjLLSGPiXhER/e5Ng4gV0x3FbC/H/UjgjbPkG0qEpeg DhzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QiWNE94h1W/y4txU6T+13mMClw2BcrRIJKYFPDZRDAU=; b=dmaaGbZWYDLCNM+jqrH61GOIoEMfoIwDDaEvpImV+9mT3Bgy84jxrpI173bily+V/v JylaxFsdonlxe4EKTYmYCuwcz0jcwd3ANlPdmv2pkH1cQe79Y5N+HWdzvvLkb6ZVmWxx M+ACZky2guxFS+MEPNvGHCF8350TY5Zg8fRtolVwIfG3rL/OUmMw3Cd01OajIlWElMnP U7mK+daJz+G/pxGJCi1bVybb7PvnrGY0UXE416pldKXkig9no8wc8A+gPDPfLmtS/AQV gaex/TogbmYNQu+FcB0zympbiufpz28Wy+wrb44kSZ3dYjXFaqiZhI5VWbCX6fiNAYwQ u+Hg== X-Gm-Message-State: AMke39loSWQayZgjaxKo5w2Q7zAiCaHIiVE89jTanxTmCYlq18U5YSHoe28sp2urD2cX8g== X-Received: by 10.25.32.9 with SMTP id g9mr6809416lfg.7.1489306782921; Sun, 12 Mar 2017 00:19:42 -0800 (PST) Received: from vudentzs-t460s.pp.htv.fi (89-27-7-11.bb.dnainternet.fi. [89.27.7.11]) by smtp.gmail.com with ESMTPSA id i24sm2874937lfk.50.2017.03.12.00.19.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Mar 2017 00:19:42 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Cc: patrik.flykt@linux.intel.com, aar@pengutronix.de, jukka.rissanen@linux.intel.com, linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v7 2/6] 6lowpan: Set MAC address length according to LOWPAN_LLTYPE Date: Sun, 12 Mar 2017 10:19:34 +0200 Message-Id: <20170312081938.11700-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170312081938.11700-1-luiz.dentz@gmail.com> References: <20170312081938.11700-1-luiz.dentz@gmail.com> 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 From: Patrik Flykt Set MAC address length according to the 6LoWPAN link layer in use. Bluetooth Low Energy uses 48 bit addressing while IEEE802.15.4 uses 64 bits. Signed-off-by: Patrik Flykt Reviewed-by: Stefan Schmidt --- net/6lowpan/core.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c index 5945f7e..5f9909a 100644 --- a/net/6lowpan/core.c +++ b/net/6lowpan/core.c @@ -23,7 +23,16 @@ int lowpan_register_netdevice(struct net_device *dev, { int i, ret; - dev->addr_len = EUI64_ADDR_LEN; + switch (lltype) { + case LOWPAN_LLTYPE_IEEE802154: + dev->addr_len = EUI64_ADDR_LEN; + break; + + case LOWPAN_LLTYPE_BTLE: + dev->addr_len = ETH_ALEN; + break; + } + dev->type = ARPHRD_6LOWPAN; dev->mtu = IPV6_MIN_MTU; dev->priv_flags |= IFF_NO_QUEUE;