From patchwork Tue Feb 21 10:38:08 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: 9584213 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 829B26042F for ; Tue, 21 Feb 2017 10:38:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65C0928805 for ; Tue, 21 Feb 2017 10:38:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59C33288DD; Tue, 21 Feb 2017 10:38:38 +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 B86E128805 for ; Tue, 21 Feb 2017 10:38:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751637AbdBUKi3 (ORCPT ); Tue, 21 Feb 2017 05:38:29 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:36817 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751352AbdBUKiU (ORCPT ); Tue, 21 Feb 2017 05:38:20 -0500 Received: by mail-lf0-f65.google.com with SMTP id 90so3246993lfr.3; Tue, 21 Feb 2017 02:38:19 -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=ciPP7QXfpMdTyrRuU8KSagfKt6Baudj5pflu5SMBaU6813XTNwK+LI5Y56qGFoWuV3 kzq/IZDmLdWpU1WVgLg28dNcZTbBREcXGeytvZoGIKrLRm5N4nLl6taWQdxhC0L808y2 8u/MhSrTZP4JFQhHj6ASenEGEa6r9gkJk2Q81ntull2Lo1Ub7UU/+8kCc0mFy6jSUHYI LS3608HZ7e0hEOjIERzvMNdKxwekBeUpx++/62L09qTIjI9X6U6DQcDVfQUDFGWB9u5C d3BIbnP4PbOc+Csh01HqAzVA6oQakMOfGRZd1un0NjZcncgEaEj3mkRrafJ+8t8moi17 2WBA== 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=g/CyPxAflism55MlRRpV9/mQ98bSxwvz3QxJ8P4e4kS56U0n63/FUSRX9ky7lpB/8w 3FfnPaC6F4B+kz3hJB80FVmCDDLpHqR8MTyGFuT/sdwzKcL3V8GWWwwUmRjewSUH+BQQ G977C7iJdyoqpc0PgYm9HIMG110fYd3rjccYSOOoTwnYXJgAmU4nLJojc3KxjbGf3H01 kbxyOcn5y5Zz2Nw19hWeGQkeAeNtj8eZfUTav4eZMXiQkb/uzirLMqpP00eJkSEA/ly9 wpi0wtqPBj8BCVGYFfZqLOzlsfuNIrtZFMdoFj7KjomZAHBZT9pcAikx7hSjINr3q2l3 GL1w== X-Gm-Message-State: AMke39ldVtuzbBWnNzwt6K86OylAUmjzWALk7O08SkSA3CLh2W1tLTBNJVk4lMTizGOUrw== X-Received: by 10.25.43.8 with SMTP id r8mr424066lfr.41.1487673497985; Tue, 21 Feb 2017 02:38:17 -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.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Feb 2017 02:38:17 -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 v4 2/5] 6lowpan: Set MAC address length according to LOWPAN_LLTYPE Date: Tue, 21 Feb 2017 12:38:08 +0200 Message-Id: <20170221103811.1506-4-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 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;