From patchwork Tue Feb 21 10:38:07 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: 9584211 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 DAFF3600C1 for ; Tue, 21 Feb 2017 10:38:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFC8028805 for ; Tue, 21 Feb 2017 10:38:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4AEC288DD; Tue, 21 Feb 2017 10:38:23 +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 6B2F228805 for ; Tue, 21 Feb 2017 10:38:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853AbdBUKiX (ORCPT ); Tue, 21 Feb 2017 05:38:23 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:36814 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751563AbdBUKiT (ORCPT ); Tue, 21 Feb 2017 05:38:19 -0500 Received: by mail-lf0-f68.google.com with SMTP id 90so3246973lfr.3; Tue, 21 Feb 2017 02:38:17 -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=zMP9AQZoemexmE+p+mYHVWKk0oMAif+1Mdy/N+l5fwA=; b=p6KeR5LMH1hcUJ12YHsq4xX3nLGR08LR9edL2ufjph5RXU6B+RNWly5RktbZudbYjR HK5dYTFoklP9RIKujhyK9zSIrh9PFkJFWqDHUeV5hvCGuSCE8PEgUH89LJNzuKNMvARm 8f3/YlnC4Of4CuZbUPYdlFVxXLW4J/QAVo9RrJZmqbC/0dN6VuPdaUYLTyAyMpcFjZmZ bLuLOwSpKlGPmDC2P6AsN8+Wj81ln/ZXHd6WfXqCmRxRk92Pep8nOuFUILentfW2haaD GAunT2hIqWq2ED5DJ1bwiV1omv/pOAmZBaAXVdVuZgT+8N3TIDrle4VoKQ2RcMdjGxbt qJPg== 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=zMP9AQZoemexmE+p+mYHVWKk0oMAif+1Mdy/N+l5fwA=; b=Mf0BY5M9mrDyIOKjydHwYIC609l+y+D/e7dtCG9S2tWv4OlX4wDEZaDEWiXE2RntZM i1sgDr7p8CVp3//BsVU/tKyZW6dhfi5Pgi3Njd4l+5Ck6pSbde3v5Mz11adCMM+Lx09n QmdCPv8Xm1w2hagHz9IcthTE6653SZfrmRccK1H06VFyBUBh2KKCv1/a/htsbVgsXpcx zitMv5X33RTVXyAaRl8EW6FTUXJGjx4J1n0VlehEeLRusnuIt7nIpEqqbQxAOGOllyLM tPYKOupUVqrJ7JcCP/r+UxjsS7qtpC9CfVwpm1clCqQ6H6w+SFyYKA3ArJF1fhZVlc4m SJZQ== X-Gm-Message-State: AMke39kw5CZiagxPHE1BcQWfgh//HeiuGqJZb12cS19sqlCw0QfGuazVHhogliIDgzcI0g== X-Received: by 10.25.227.14 with SMTP id a14mr6244509lfh.43.1487673496835; Tue, 21 Feb 2017 02:38:16 -0800 (PST) Received: from localhost.localdomain ([2001:998:22:0:4f7c:5e8e:5bc:71bd]) by smtp.gmail.com with ESMTPSA id f137sm469811lff.21.2017.02.21.02.38.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Feb 2017 02:38:16 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Cc: patrik.flykt@linux.intel.com, aar@pengutronix.de, linux-wpan@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v3 2/5] 6lowpan: Set MAC address lenght according to LOWPAN_LLTYPE Date: Tue, 21 Feb 2017 12:38:07 +0200 Message-Id: <20170221103811.1506-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170221103811.1506-1-luiz.dentz@gmail.com> References: <20170221103811.1506-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 --- 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;