From: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org
Subject: [PATCH 02/13] batman-adv: Create roughly equal sized fragments
Date: Sat, 29 Jan 2011 22:47:29 +0100 [thread overview]
Message-ID: <1296337660-12376-3-git-send-email-sven@narfation.org> (raw)
In-Reply-To: <1296337660-12376-1-git-send-email-sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
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 <russell-LS+HbC+WUqwFvAYqzeGVJV6hYfS7NtTn@public.gmane.org>
Reported-by: Marek Lindner <lindner_marek-LWAfsSFWpa4@public.gmane.org>
Signed-off-by: Sven Eckelmann <sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
---
net/batman-adv/unicast.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index ee41fef..811f7fc 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -224,7 +224,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;
@@ -232,10 +232,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)
--
1.7.2.3
next prev parent reply other threads:[~2011-01-29 21:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-29 21:47 pull request: batman-adv 2011-01-29 Sven Eckelmann
[not found] ` <1296337660-12376-1-git-send-email-sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
2011-01-29 21:47 ` [PATCH 01/13] batman-adv: Fix kernel panic when fetching vis data on a vis server Sven Eckelmann
2011-01-29 21:47 ` Sven Eckelmann [this message]
2011-01-29 21:47 ` [PATCH 03/13] batman-adv: Calculate correct size for merged packets Sven Eckelmann
2011-01-29 21:47 ` [PATCH 04/13] batman-adv: Remove vis info on hashing errors Sven Eckelmann
2011-01-29 21:47 ` [PATCH 05/13] batman-adv: Remove vis info element in free_info Sven Eckelmann
2011-01-29 21:47 ` [PATCH 06/13] batman-adv: Make vis info stack traversal threadsafe Sven Eckelmann
2011-01-29 21:47 ` [PATCH 07/13] batman-adv: remove unused parameters Sven Eckelmann
2011-01-29 21:47 ` [PATCH 08/13] batman-adv: Remove dangling declaration of hash_remove_element Sven Eckelmann
2011-01-29 21:47 ` [PATCH 09/13] batman-adv: Remove unused definitions Sven Eckelmann
2011-01-29 21:47 ` [PATCH 10/13] batman-adv: Remove declaration of batman_skb_recv Sven Eckelmann
2011-01-29 21:47 ` [PATCH 11/13] batman-adv: Remove unused variables Sven Eckelmann
2011-01-29 21:47 ` [PATCH 12/13] batman-adv: Update copyright years Sven Eckelmann
2011-01-29 21:47 ` [PATCH 13/13] batman-adv: Merge README of v2011.0.0 release Sven Eckelmann
2011-01-30 3:08 ` pull request: batman-adv 2011-01-29 David Miller
[not found] ` <20110129.190815.226768755.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2011-01-30 9:36 ` Sven Eckelmann
2011-01-30 9:38 ` [PATCH 1/4] batman-adv: Fix kernel panic when fetching vis data on a vis server Sven Eckelmann
2011-01-30 9:38 ` [PATCH 2/4] batman-adv: Remove vis info on hashing errors Sven Eckelmann
2011-01-30 9:38 ` [PATCH 3/4] batman-adv: Remove vis info element in free_info Sven Eckelmann
2011-01-30 9:38 ` [PATCH 4/4] batman-adv: Make vis info stack traversal threadsafe Sven Eckelmann
[not found] ` <201101301036.57928.sven-KaDOiPu9UxWEi8DpZVb4nw@public.gmane.org>
2011-01-30 11:56 ` pull request: batman-adv 2011-01-29 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1296337660-12376-3-git-send-email-sven@narfation.org \
--to=sven-kadoipu9uxwei8dpzvb4nw@public.gmane.org \
--cc=b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).