From: Marek Lindner <lindner_marek@yahoo.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: "Martin Hundebøll" <martin@hundeboll.net>
Subject: Re: [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: Fragment and send skbs larger than mtu
Date: Wed, 24 Apr 2013 03:35:49 +0800 [thread overview]
Message-ID: <201304240335.49403.lindner_marek@yahoo.de> (raw)
In-Reply-To: <1366474654-26361-4-git-send-email-martin@hundeboll.net>
On Sunday, April 21, 2013 00:17:34 Martin Hundebøll wrote:
> Non-broadcast packets larger than MTU are fragmented and sent with
> an encapsulating header. Up to 16 fragments are supported, which are
> sent in reverse order on the wire.
If you explicitely mention the reverse order you should also say why it is
done that way.
> +/**
> + * batadv_frag_create() - Create a fragment from skb.
Same kernel doc complaints as in the other patch: no parenthesis and no
capital letters.
> + * @skb: skb to create fragment from.
> + * @frag_head: header to use in new fragment.
> + * @mtu: Size of new fragment.
> + *
> + * Split the passed skb into two fragments: A new one with size matching
> the + * passed mtu and the old one with the rest. The new skb contains
> data from the + * tail of the old skb.
> + *
> + * Returns the new fragment, NULL on error.
> + */
> +static struct sk_buff *batadv_frag_create(struct sk_buff *skb,
> + struct batadv_frag_packet *frag_head,
> + unsigned int mtu)
> +{
> + struct sk_buff *skb_fragment;
> + unsigned header_size = sizeof(*frag_head);
> + unsigned fragment_size = mtu - header_size - ETH_HLEN;
> +
> + skb_fragment = dev_alloc_skb(mtu);
> + if (!skb_fragment)
> + goto out_err;
> +
> + /* Eat the last mtu-bytes of the skb */
> + skb_reserve(skb_fragment, header_size);
> + skb_split(skb, skb_fragment, skb->len - fragment_size);
> +
> + /* Add the header */
> + skb_push(skb_fragment, header_size);
> + memcpy(skb_fragment->data, frag_head, header_size);
> +
> + return skb_fragment;
> +
> +out_err:
> + return NULL;
> +}
The two return statements can be merged into one.
> +/**
> + * batadv_frag_send_packet() - Create up to 16 fragments from the passed
> skb. + * @skb: skb to create fragments from.
> + * @orig_node: Final destination of the created fragments.
> + * @neigh_node: Next-hop of the created fragments.
> + *
> + * Returns true on success, false otherwise.
> + */
> +bool batadv_frag_send_packet(struct sk_buff *skb,
> + struct batadv_orig_node *orig_node,
> + struct batadv_neigh_node *neigh_node)
> +{
> + struct batadv_priv *bat_priv;
> + struct batadv_hard_iface *primary_if;
> + struct batadv_frag_packet frag_header;
> + struct sk_buff *skb_fragment;
> + unsigned mtu = neigh_node->if_incoming->net_dev->mtu;
> + unsigned header_size = sizeof(frag_header);
> + unsigned max_fragment_size, max_packet_size;
> +
> + /* To avoid merge and refragmentation at next-hops we never send
> + * fragments larger than BATADV_FRAG_MAX_FRAG_SIZE
> + */
> + mtu = min_t(int, mtu, BATADV_FRAG_MAX_FRAG_SIZE);
> + max_fragment_size = (mtu - header_size - ETH_HLEN);
> + max_packet_size = max_fragment_size*BATADV_FRAG_MAX_FRAGMENTS;
Afaik the linux coding style demands spaces between "*" and its neighbors.
> --- a/types.h
> +++ b/types.h
> @@ -336,6 +336,8 @@ enum batadv_counters {
> BATADV_CNT_MGMT_TX_BYTES,
> BATADV_CNT_MGMT_RX,
> BATADV_CNT_MGMT_RX_BYTES,
> + BATADV_CNT_FRAG_TX,
> + BATADV_CNT_FRAG_TX_BYTES,
> BATADV_CNT_FRAG_RX,
> BATADV_CNT_FRAG_RX_BYTES,
> BATADV_CNT_FRAG_FWD,
Kernel doc ?
> @@ -577,6 +579,7 @@ struct batadv_priv {
> atomic_t aggregated_ogms;
> atomic_t bonding;
> atomic_t fragmentation;
> + atomic_t frag_seqno;
> atomic_t ap_isolation;
> #ifdef CONFIG_BATMAN_ADV_BLA
> atomic_t bridge_loop_avoidance;
Kernel doc ?
Cheers,
Marek
prev parent reply other threads:[~2013-04-23 19:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-20 16:17 [B.A.T.M.A.N.] [PATCH 0/3] Fragmentation version 2 Martin Hundebøll
2013-04-20 16:17 ` [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: Remove old fragmentation code Martin Hundebøll
2013-04-23 17:32 ` Marek Lindner
2013-04-20 16:17 ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: Receive fragmented packets and merge Martin Hundebøll
2013-04-23 19:17 ` Marek Lindner
2013-04-23 19:30 ` Antonio Quartulli
2013-04-23 19:43 ` Marek Lindner
2013-04-23 19:47 ` Antonio Quartulli
2013-04-20 16:17 ` [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: Fragment and send skbs larger than mtu Martin Hundebøll
2013-04-23 19:35 ` Marek Lindner [this message]
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=201304240335.49403.lindner_marek@yahoo.de \
--to=lindner_marek@yahoo.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=martin@hundeboll.net \
/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