From patchwork Wed Oct 30 08:18:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 287158 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4C0B22C037D for ; Wed, 30 Oct 2013 19:19:01 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753053Ab3J3ISw (ORCPT ); Wed, 30 Oct 2013 04:18:52 -0400 Received: from mail-ea0-f171.google.com ([209.85.215.171]:41939 "EHLO mail-ea0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752142Ab3J3ISi (ORCPT ); Wed, 30 Oct 2013 04:18:38 -0400 Received: by mail-ea0-f171.google.com with SMTP id h10so452267eak.2 for ; Wed, 30 Oct 2013 01:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iE4wjRTc2aJFJCgpda/znwgeTCFpnDo9eL8b6ZZ3B+8=; b=JMNvF+4CUY6VUGKZi8XDOhIPaxHYU2C5zw9GT993S5ItdLhk7VnwK1a4VpQmY0Kbax YQDvXyulQXgdWOxGztyo1+Lpn7TVW53iqf0xsLMG4zZuRzgpc0lklUDqcFgW5cC9Npo3 hIRSG+GPBCuPqaXVIEGpEakXEo58EYXWjaeZxbptX9H7kIfLEndynGXba+P61fGUp4Kd NyojL6MiBwFsAL9svidhnTIvGRxQjV4EMV25f8Ayxzzy8w8jgss+Jbm9nIylJEEtyjxH SHu31HrKJoxpitXnifMd3WmY5TzjrkAM22X5Lqgr8II6BlNpcsSHtYBM0ogAhjMFYt0l XpnQ== X-Received: by 10.15.41.7 with SMTP id r7mr439823eev.116.1383121117603; Wed, 30 Oct 2013 01:18:37 -0700 (PDT) Received: from localhost.localdomain (p4FD31CA4.dip0.t-ipconnect.de. [79.211.28.164]) by mx.google.com with ESMTPSA id s3sm80508677eeo.3.2013.10.30.01.18.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Oct 2013 01:18:37 -0700 (PDT) From: Alexander Aring To: alex.bluesman.smirnov@gmail.com Cc: linux-zigbee-devel@lists.sourceforge.net, werner@almesberger.net, dbaryshkov@gmail.com, netdev@vger.kernel.org, Alexander Aring Subject: [PATCH net-next 2/4] 6lowpan: set and use mac_len for mac header length Date: Wed, 30 Oct 2013 09:18:22 +0100 Message-Id: <1383121104-2515-3-git-send-email-alex.aring@gmail.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1383121104-2515-1-git-send-email-alex.aring@gmail.com> References: <1383121104-2515-1-git-send-email-alex.aring@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Set the mac header length while creating the 802.15.4 mac header. Drop the function for recalculate mac header length in upper layers which was static and works for intra pan communication only. Signed-off-by: Alexander Aring Reviewed-by: Werner Almesberger --- net/ieee802154/6lowpan.c | 13 +------------ net/mac802154/wpan.c | 2 ++ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 6d67784..e6db1f5 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c @@ -1100,17 +1100,6 @@ static int lowpan_set_address(struct net_device *dev, void *p) return 0; } -static int lowpan_get_mac_header_length(struct sk_buff *skb) -{ - /* - * Currently long addressing mode is supported only, so the overall - * header size is 21: - * FC SeqNum DPAN DA SA Sec - * 2 + 1 + 2 + 8 + 8 + 0 = 21 - */ - return 21; -} - static int lowpan_fragment_xmit(struct sk_buff *skb, u8 *head, int mlen, int plen, int offset, int type) @@ -1150,7 +1139,7 @@ lowpan_skb_fragmentation(struct sk_buff *skb, struct net_device *dev) int err, header_length, payload_length, tag, offset = 0; u8 head[5]; - header_length = lowpan_get_mac_header_length(skb); + header_length = skb->mac_len; payload_length = skb->len - header_length; tag = lowpan_dev_info(dev)->fragment_tag++; diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index 2ca2f4d..e24bcf9 100644 --- a/net/mac802154/wpan.c +++ b/net/mac802154/wpan.c @@ -208,6 +208,8 @@ static int mac802154_header_create(struct sk_buff *skb, head[1] = fc >> 8; memcpy(skb_push(skb, pos), head, pos); + skb_reset_mac_header(skb); + skb->mac_len = pos; return pos; }