From patchwork Fri Feb 24 12:14:36 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: 9590009 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 03E9860578 for ; Fri, 24 Feb 2017 12:16:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31456237A5 for ; Fri, 24 Feb 2017 12:16:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 261962877F; Fri, 24 Feb 2017 12:16:20 +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 8894E2872D for ; Fri, 24 Feb 2017 12:16:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751378AbdBXMPS (ORCPT ); Fri, 24 Feb 2017 07:15:18 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:32864 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751219AbdBXMPB (ORCPT ); Fri, 24 Feb 2017 07:15:01 -0500 Received: by mail-lf0-f66.google.com with SMTP id j2so1349510lfe.0; Fri, 24 Feb 2017 04:14:45 -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=q7aNXNr02dE6QbzLTCkuzExGC9PThsCvhh9nqEHJwOBy0Q1IhtbJV0Ic+STtDUHSAM z+2SO+7sbeeKC433hrpKtYrKVPBdDM6Rin6VA35VtbfruBCQbz5ib+cwEa9G1JOK7vFO V7/qRCYfAa68LnuiHhq5wPhGsGzVbHLFJfwA2N0v5ZgMEKjlh3cbp2Kj6FXzSKWgpIfH YX1an1wVg89/ZupJ42JSviEmQQVFu4xtkjgm4E6GR/EdfWlcvTVaY8/WtZnWIG9DJTBG YdsM3j494yttdpPn7iF09iBUSc1yeFLk1cF+gyzUjH6nq02fTqIp1YX6V3j8XxFW+XFz 5vPA== 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=ISN9ipCssZMJw9gOEyLHSZ3E5AVaZ+Dfhc8UE2f+7KjNsS2UfH0ArA0Jrb0dKsv1Zs EpP3gtdUuM5SndfULxD9lQOq70F2G19jCw9stnZAuFZNhU3yNr62gHCs1CAqFjc6gL1J 2X0Jjeqhfkx/bXEcTT53v6vl4bQbe/HcUEpzwIWlo2AxX0KKtB6W9nHrU8MQ9HfMKjOb 6DE6vGs6KH6uTdUOtLor+X6cpYGNkAaaQtYo/93SZhrG2NECf7U3pROo3+o/xOrY4LqA iKTqPWq2JbQkg5/x4RYYKgDqJ/ciNgUvTfvxKNQLUYrF9xkKjjiUbnH9zQ51ufIFVrxM eTKw== X-Gm-Message-State: AMke39mTLZq4M2q7RzRNz2WlwER8Ty+feeGqXORsflvrWNgwJbs/9wtaCELxIZ4IgsyEsA== X-Received: by 10.25.21.214 with SMTP id 83mr771707lfv.66.1487938484638; Fri, 24 Feb 2017 04:14:44 -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 26sm8569196ljo.21.2017.02.24.04.14.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 04:14:44 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Cc: patrik.flykt@linux.intel.com, jukka.rissanen@linux.intel.com, stefan@osg.samsung.com, aar@pengutronix.de, linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v5 2/6] 6lowpan: Set MAC address length according to LOWPAN_LLTYPE Date: Fri, 24 Feb 2017 14:14:36 +0200 Message-Id: <20170224121440.32269-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170224121440.32269-1-luiz.dentz@gmail.com> References: <20170224121440.32269-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;