From patchwork Thu Mar 2 13:23:31 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: 9600251 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 14CCA60453 for ; Thu, 2 Mar 2017 13:32:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07BB727F93 for ; Thu, 2 Mar 2017 13:32:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0BC627FA8; Thu, 2 Mar 2017 13:32:16 +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 6FDD627F93 for ; Thu, 2 Mar 2017 13:32:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752913AbdCBNcQ (ORCPT ); Thu, 2 Mar 2017 08:32:16 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:35479 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751035AbdCBNcL (ORCPT ); Thu, 2 Mar 2017 08:32:11 -0500 Received: by mail-lf0-f68.google.com with SMTP id z127so5750618lfa.2; Thu, 02 Mar 2017 05:32:04 -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=Ht8AghyaQFBc5j+e9V1WV4YTt+f4MhVdyPgnwiTXkYJvHyEMQuHXQkdZJNjlWN732J mgMUfyTHrBVqzVL3unVQX0TYADcU+LU7YXZlnNedPYXpCeyL1fQJ5fMczOuIDPo3sCS9 CTzx5aF1xQUl6OLnDmXr4/a35EVTJlniFPCz1a/SD+X9cuq4lMZkhi+7Rvwws0ZTk6Kd xEmuiSjvmu/AbkEZknU684RIEKpk1gR4RM5I4CV0z3sToGpzhpfhSq4DnjKv3UkVsEEd u20x8ZhflmtgITlkvrkT8/J/zlKxCu50TEhzvRkoXz3dRo6/sGAIZhh6+UNF2FqJmDDz poKQ== 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=A7p/pRruBKI1+x14q3EMB/etpz5RXKm6VAuLQoAK2ajqh7lVmPO8SWiWHRSDZ+MiMl GgAXe1JNT0FNf/NYtz7sepITDV/uPUeWaWWbuLukT/5RLzIWPvVuNDPXjr6tBXA7CMG1 fiM4wr1y5zdR/GLNGNJyyaxdNEAX+a88wxp7aoUi1B/SdQmo2HkP9W81ze3DoFpgh2n1 kiGmdRSlwMoA64mycyqqlYBe+WT0KN7njd/6mSQvsWwJu+MH4JRBYWPCWS8LFqA7FMKe OPbQ25Fw07nIUAuMkym/88X7vQw55Yo4pRiXawlWNPR+t2FmhPqnqRveHFvxjU9hLCJA s8OQ== X-Gm-Message-State: AMke39nrx/7aDi3VT8mkhY2iBcbTbOjC+EqQ7NW0aJgZR8DPgAY+vi69nvb0MfOBZ1dXrg== X-Received: by 10.25.230.9 with SMTP id d9mr3518767lfh.142.1488461021627; Thu, 02 Mar 2017 05:23:41 -0800 (PST) Received: from localhost.localdomain (85-76-69-169-nat.elisa-mobile.fi. [85.76.69.169]) by smtp.gmail.com with ESMTPSA id b72sm1700349lfb.24.2017.03.02.05.23.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 05:23:41 -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 v6 2/6] 6lowpan: Set MAC address length according to LOWPAN_LLTYPE Date: Thu, 2 Mar 2017 15:23:31 +0200 Message-Id: <20170302132335.21192-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170302132335.21192-1-luiz.dentz@gmail.com> References: <20170302132335.21192-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;