From patchwork Thu Feb 16 17:19:43 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: 9577757 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 254F360244 for ; Thu, 16 Feb 2017 17:20:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17FFA2040D for ; Thu, 16 Feb 2017 17:20:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BBA12864C; Thu, 16 Feb 2017 17:20:00 +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 A51782040D for ; Thu, 16 Feb 2017 17:19:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932491AbdBPRTz (ORCPT ); Thu, 16 Feb 2017 12:19:55 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:34073 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932503AbdBPRTx (ORCPT ); Thu, 16 Feb 2017 12:19:53 -0500 Received: by mail-lf0-f65.google.com with SMTP id q89so1981147lfi.1; Thu, 16 Feb 2017 09:19:52 -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=rLVT4u9cQNg8hxQxjG6Aw4cXLpWOnSwgwL2yImChgds2nB+6lVOkHig/F+otO6VFs/ 5dvwLfy+F4I2mS8NlS3Zapl6OJMoogn00BpN2HF+iL5nR3rqyKiMkcb7axDPxQqx9Z4C ffW3kwt0vSE/pqVGhK/IGCjbDKQx6PH0e6e4Z4CxgKu1J3NIJjjgNBSLiqlIWE/LnfCj Up0AHhO+2wfEGGEqttL3miFNHutijP5h7Y+jKARa5kO9UHZEQGp6EM/o8k36NBjccCi1 vSBYJdVJtygr8dG5GSMkLS9aSFybad+qeD+hsBWYJjITWWS/1qXMKBHP+oBC1IZBQvW1 GQNA== 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=hOpfhE0X0DTNI7OakQ5TA5AJpUZ9VLlWbc8IuqKHJKmnPDGh0CSe5FiZAlEr387Og7 unXqtcCj7c/kjrTMauiPCo+KOspQdkUI66lLqOAdoZ7BPrtYKeK1T4XpZQfYXem3qX6v I68iWy5QdVuq+XfL7BZfflsimqNU9qKvhGejgrEwAUEzxHFb8Q3hSbv+NdjiUvxRSMMI O4fJ6G+SF8IE51BcTBZAQlMsbTB776lQ4T9CjEEYCXavKPqjiaXjp4RhYpUL5lZgjQ7s 1sxayGFeQx+pcAQEKjQk1LIR/VzsciK2a6NibPFQ6UNFmsPPxDNbds8UherMyEQjMZQG nfPw== X-Gm-Message-State: AMke39ndNxTKItanq6civdtgfBR4ChNhSU8XC+E+SzpEloq9qyTpo0WFF0QBBpV0RGtvNQ== X-Received: by 10.25.202.83 with SMTP id h19mr1092127lfj.33.1487265591921; Thu, 16 Feb 2017 09:19:51 -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 187sm1874292ljj.7.2017.02.16.09.19.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 09:19:51 -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 v2 2/5] 6lowpan: Set MAC address lenght according to LOWPAN_LLTYPE Date: Thu, 16 Feb 2017 19:19:43 +0200 Message-Id: <20170216171946.5105-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170216171946.5105-1-luiz.dentz@gmail.com> References: <20170216171946.5105-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;