From patchwork Thu Jan 20 23:00:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 721 Return-Path: Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 54E9B154623 for ; Fri, 21 Jan 2011 00:00:31 +0100 (CET) Received: from localhost (i59F6C37A.versanet.de [89.246.195.122]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id D7D6394059; Fri, 21 Jan 2011 00:00:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=narfation.org; s=mail; t=1295564457; bh=MeFGZl/uvyqFalYRBB0p2q7hY42YCnmwMZ2gvw006hw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=TQGnDUkTG9bvlpb+IcooxgbI+2F3PZ0UACc//NiXMbmC7yi2DEnkY7pQfT3ieQVQv bAqhMeiLaohA5N+aADTkO1kTuMBrvKBz950IkhujWT4ZGoEE25mvZ/pZZd2Gzmcyf9 WlK/oIMndGB1/IWUtkalyt5y9YBTernw7B8qJeng= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 21 Jan 2011 00:00:18 +0100 Message-Id: <1295564419-28216-1-git-send-email-sven@narfation.org> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1295563736-27526-1-git-send-email-sven@narfation.org> References: <1295563736-27526-1-git-send-email-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCHv2 1/2] batman-adv: Create roughly equal sized fragments X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2011 23:00:31 -0000 The routing algorithm must know how large two fragments are to be able to decide that it is safe to merge them or if it should resubmit without waiting for the second part. When these two fragments have a too different size, it is not possible to guess right in every situation. The user could easily configure the MTU of the attached cards so that one fragment is forwarded and the other one is added to the fragments table to wait for the missing part. For even sized packets, it is possible to split it so that the resulting packages are equal sized by ignoring the old non-fragment header at the beginning of the original packet. This still creates different sized fragments for uneven sized packets. Reported-by: Russell Senior Reported-by: Marek Lindner Signed-off-by: Sven Eckelmann --- This patch is completely untested and is currently only to support marec and russell-- during their debugging sessions. Maybe it doesn't even compile. batman-adv/unicast.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/batman-adv/unicast.c b/batman-adv/unicast.c index 677663b..84e70bc 100644 --- a/batman-adv/unicast.c +++ b/batman-adv/unicast.c @@ -230,7 +230,7 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, struct unicast_frag_packet *frag1, *frag2; int uc_hdr_len = sizeof(struct unicast_packet); int ucf_hdr_len = sizeof(struct unicast_frag_packet); - int data_len = skb->len; + int data_len = skb->len - uc_hdr_len; if (!bat_priv->primary_if) goto dropped; @@ -238,10 +238,11 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, frag_skb = dev_alloc_skb(data_len - (data_len / 2) + ucf_hdr_len); if (!frag_skb) goto dropped; + skb_reserve(frag_skb, ucf_hdr_len); unicast_packet = (struct unicast_packet *) skb->data; memcpy(&tmp_uc, unicast_packet, uc_hdr_len); - skb_split(skb, frag_skb, data_len / 2); + skb_split(skb, frag_skb, data_len / 2 + uc_hdr_len); if (my_skb_head_push(skb, ucf_hdr_len - uc_hdr_len) < 0 || my_skb_head_push(frag_skb, ucf_hdr_len) < 0)