From patchwork Fri Feb 17 15:50:00 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: 9580251 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 423706042F for ; Fri, 17 Feb 2017 15:50:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 348E828721 for ; Fri, 17 Feb 2017 15:50:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 297BA28724; Fri, 17 Feb 2017 15:50:15 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 C904928721 for ; Fri, 17 Feb 2017 15:50:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934662AbdBQPuO (ORCPT ); Fri, 17 Feb 2017 10:50:14 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:34454 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934626AbdBQPuM (ORCPT ); Fri, 17 Feb 2017 10:50:12 -0500 Received: by mail-lf0-f65.google.com with SMTP id q89so4139845lfi.1; Fri, 17 Feb 2017 07:50:11 -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=Jm8P2aUyQpgj612tSB+r9/OP1U3rNljGxbObOqxW3LcuYSBYwATZSYVmibHTNtlpIh Pms2aJOPAxxcITFSUKBW+iUrXn9j7hlq+rnkPPCbcA4KPu1V3eErD/dz+JawIxblE8C2 c+tUxO2vjhL+nlpftMRBTpbmRshCyKpby1FvrQXoR003U4Jrkc/0+60nfOOTTCYpxMGC mCoYH6lCSI6AurKZrGg/K7MRwwppeWwi7VCfVASaSIT4cNLiaS79Uh5v61EPqiD5GWB2 QWcxb5xXZZPgYGrdXZFWefyEptTLrcQI7mYlTTuJ5cFCJuaxQW3aJQaUlnX61rBXYbUj f3Qg== 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=cyPMwM/j+K6ZUVJVnIBOiVjDCfnl2i2zqA4BDUhOvDHHCVaEgm4UHPNwdDsUNNvA52 RqK2K6Vw0U0QW9ZweUnCm0XJWdBT9iZM462/z8OiBYg6KH+n470VeWTw62nmDAGaWr5U y1/ZC7MY5lt0KnXQGvZgTnB2PVyuRcp1esm+Cwij2aLtCFN0+E0p+ZM7LakymXj5NgNP GtTw7gO8OKAMIRDYsIxy0RhngFyfITGa6uPDAUmOiM6vWj7T9FHQv3+vQzThs7d6QbRm hZfETjqt4IFRRCv+LV8GkAJ4XG6UJwgklOpgutNaYOp3OZTTib0iQxxl1kt35UVRKjAV uqMg== X-Gm-Message-State: AMke39l4QFmYNnigxFqgo/r2R+C1mxexV/zQJtHLDrrpPKfu3YTb5VOMeB8pHHb4MCh2HQ== X-Received: by 10.25.74.72 with SMTP id x69mr2474545lfa.66.1487346610617; Fri, 17 Feb 2017 07:50:10 -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 c18sm2600726ljd.52.2017.02.17.07.50.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Feb 2017 07:50:09 -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 Subject: [PATCH v3 2/5] 6lowpan: Set MAC address lenght according to LOWPAN_LLTYPE Date: Fri, 17 Feb 2017 17:50:00 +0200 Message-Id: <20170217155003.4594-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170217155003.4594-1-luiz.dentz@gmail.com> References: <20170217155003.4594-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;